1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
9 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13 | };
|
14 | var __metadata = (this && this.__metadata) || function (k, v) {
|
15 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
16 | };
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | var context_1 = require("../context/context");
|
19 | var gridOptionsWrapper_1 = require("../gridOptionsWrapper");
|
20 | var ColumnAnimationService = (function () {
|
21 | function ColumnAnimationService() {
|
22 | this.executeNextFuncs = [];
|
23 | this.executeLaterFuncs = [];
|
24 | this.active = false;
|
25 | this.animationThreadCount = 0;
|
26 | }
|
27 | ColumnAnimationService.prototype.registerGridComp = function (gridPanel) {
|
28 | this.gridPanel = gridPanel;
|
29 | };
|
30 | ColumnAnimationService.prototype.isActive = function () {
|
31 | return this.active;
|
32 | };
|
33 | ColumnAnimationService.prototype.start = function () {
|
34 | if (this.active) {
|
35 | return;
|
36 | }
|
37 | if (this.gridOptionsWrapper.isSuppressColumnMoveAnimation()) {
|
38 | return;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 | if (this.gridOptionsWrapper.isEnableRtl()) {
|
44 | return;
|
45 | }
|
46 | this.ensureAnimationCssClassPresent();
|
47 | this.active = true;
|
48 | };
|
49 | ColumnAnimationService.prototype.finish = function () {
|
50 | if (!this.active) {
|
51 | return;
|
52 | }
|
53 | this.flush();
|
54 | this.active = false;
|
55 | };
|
56 | ColumnAnimationService.prototype.executeNextVMTurn = function (func) {
|
57 | if (this.active) {
|
58 | this.executeNextFuncs.push(func);
|
59 | }
|
60 | else {
|
61 | func();
|
62 | }
|
63 | };
|
64 | ColumnAnimationService.prototype.executeLaterVMTurn = function (func) {
|
65 | if (this.active) {
|
66 | this.executeLaterFuncs.push(func);
|
67 | }
|
68 | else {
|
69 | func();
|
70 | }
|
71 | };
|
72 | ColumnAnimationService.prototype.ensureAnimationCssClassPresent = function () {
|
73 | var _this = this;
|
74 |
|
75 |
|
76 | this.animationThreadCount++;
|
77 | var animationThreadCountCopy = this.animationThreadCount;
|
78 | this.gridPanel.setColumnMovingCss(true);
|
79 | this.executeLaterFuncs.push(function () {
|
80 |
|
81 | if (_this.animationThreadCount === animationThreadCountCopy) {
|
82 | _this.gridPanel.setColumnMovingCss(false);
|
83 | }
|
84 | });
|
85 | };
|
86 | ColumnAnimationService.prototype.flush = function () {
|
87 | var nowFuncs = this.executeNextFuncs;
|
88 | this.executeNextFuncs = [];
|
89 | var waitFuncs = this.executeLaterFuncs;
|
90 | this.executeLaterFuncs = [];
|
91 | if (nowFuncs.length === 0 && waitFuncs.length === 0) {
|
92 | return;
|
93 | }
|
94 | setTimeout(function () { return nowFuncs.forEach(function (func) { return func(); }); }, 0);
|
95 | setTimeout(function () { return waitFuncs.forEach(function (func) { return func(); }); }, 300);
|
96 | };
|
97 | __decorate([
|
98 | context_1.Autowired('gridOptionsWrapper'),
|
99 | __metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
|
100 | ], ColumnAnimationService.prototype, "gridOptionsWrapper", void 0);
|
101 | ColumnAnimationService = __decorate([
|
102 | context_1.Bean('columnAnimationService')
|
103 | ], ColumnAnimationService);
|
104 | return ColumnAnimationService;
|
105 | }());
|
106 | exports.ColumnAnimationService = ColumnAnimationService;
|