1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | var __extends = (this && this.__extends) || (function () {
|
9 | var extendStatics = Object.setPrototypeOf ||
|
10 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12 | return function (d, b) {
|
13 | extendStatics(d, b);
|
14 | function __() { this.constructor = d; }
|
15 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16 | };
|
17 | })();
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | var utils_1 = require("../../utils");
|
20 | var column_1 = require("../../entities/column");
|
21 | var beanStub_1 = require("../../context/beanStub");
|
22 | var SetLeftFeature = (function (_super) {
|
23 | __extends(SetLeftFeature, _super);
|
24 | function SetLeftFeature(columnOrGroup, eCell, beans, colsSpanning) {
|
25 | var _this = _super.call(this) || this;
|
26 | _this.columnOrGroup = columnOrGroup;
|
27 | _this.eCell = eCell;
|
28 | _this.colsSpanning = colsSpanning;
|
29 | _this.beans = beans;
|
30 | return _this;
|
31 | }
|
32 | SetLeftFeature.prototype.setColsSpanning = function (colsSpanning) {
|
33 | this.colsSpanning = colsSpanning;
|
34 | this.onLeftChanged();
|
35 | };
|
36 | SetLeftFeature.prototype.getColumnOrGroup = function () {
|
37 | if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
|
38 | return this.colsSpanning[this.colsSpanning.length - 1];
|
39 | }
|
40 | else {
|
41 | return this.columnOrGroup;
|
42 | }
|
43 | };
|
44 | SetLeftFeature.prototype.init = function () {
|
45 | this.addDestroyableEventListener(this.columnOrGroup, column_1.Column.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this));
|
46 | this.setLeftFirstTime();
|
47 | };
|
48 | SetLeftFeature.prototype.setLeftFirstTime = function () {
|
49 | var suppressMoveAnimation = this.beans.gridOptionsWrapper.isSuppressColumnMoveAnimation();
|
50 | var oldLeftExists = utils_1.Utils.exists(this.columnOrGroup.getOldLeft());
|
51 | var animateColumnMove = this.beans.columnAnimationService.isActive() && oldLeftExists && !suppressMoveAnimation;
|
52 | if (animateColumnMove) {
|
53 | this.animateInLeft();
|
54 | }
|
55 | else {
|
56 | this.onLeftChanged();
|
57 | }
|
58 | };
|
59 | SetLeftFeature.prototype.animateInLeft = function () {
|
60 | var _this = this;
|
61 | var left = this.getColumnOrGroup().getLeft();
|
62 | var oldLeft = this.getColumnOrGroup().getOldLeft();
|
63 | this.setLeft(oldLeft);
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | this.actualLeft = left;
|
70 | this.beans.columnAnimationService.executeNextVMTurn(function () {
|
71 |
|
72 | if (_this.actualLeft === left) {
|
73 | _this.setLeft(left);
|
74 | }
|
75 | });
|
76 | };
|
77 | SetLeftFeature.prototype.onLeftChanged = function () {
|
78 | this.actualLeft = this.getColumnOrGroup().getLeft();
|
79 | this.setLeft(this.actualLeft);
|
80 | };
|
81 | SetLeftFeature.prototype.setLeft = function (value) {
|
82 |
|
83 |
|
84 |
|
85 | if (utils_1.Utils.exists(value)) {
|
86 | this.eCell.style.left = value + 'px';
|
87 | }
|
88 | };
|
89 | return SetLeftFeature;
|
90 | }(beanStub_1.BeanStub));
|
91 | exports.SetLeftFeature = SetLeftFeature;
|