@refinitiv-ui/efx-grid 6.0.34 → 6.0.35
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +50 -40
- package/lib/core/dist/core.js +99 -3
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +2 -0
- package/lib/core/es6/data/DataTable.js +18 -1
- package/lib/core/es6/data/DataView.d.ts +2 -0
- package/lib/core/es6/data/DataView.js +11 -0
- package/lib/core/es6/grid/Core.d.ts +12 -0
- package/lib/core/es6/grid/Core.js +64 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
- package/lib/grid/index.js +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +1 -1
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +343 -142
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +33 -26
- package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
- package/lib/rt-grid/es6/RowDefSorter.js +165 -71
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +17 -3
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +14 -3
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
- package/lib/tr-grid-util/es6/DragUI.js +7 -3
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
- package/lib/types/es6/ColumnStack.d.ts +2 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
- package/lib/versions.json +7 -7
- package/package.json +1 -1
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -1620,21 +1620,24 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
|
|
1620
1620
|
* @param {Array.<Object>} columns Array of column options
|
1621
1621
|
*/
|
1622
1622
|
Grid.prototype.setColumns = function(columns) {
|
1623
|
+
var grid = this._grid;
|
1623
1624
|
var colCount = (columns) ? columns.length : 0;
|
1624
1625
|
|
1626
|
+
grid.startBatch("reset");
|
1625
1627
|
this.removeAllColumns();
|
1626
1628
|
if(colCount > 0) {
|
1627
1629
|
var prevState = false;
|
1628
1630
|
if(colCount > 1) {
|
1629
|
-
prevState =
|
1631
|
+
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1630
1632
|
}
|
1631
1633
|
for(var i = 0; i < colCount; ++i) {
|
1632
1634
|
this.insertColumn(columns[i], i);
|
1633
1635
|
}
|
1634
1636
|
if(colCount > 1) {
|
1635
|
-
|
1637
|
+
grid.freezeLayout(prevState);
|
1636
1638
|
}
|
1637
1639
|
}
|
1640
|
+
grid.stopBatch("reset");
|
1638
1641
|
};
|
1639
1642
|
|
1640
1643
|
|
@@ -1643,6 +1646,8 @@ Grid.prototype.setColumns = function(columns) {
|
|
1643
1646
|
* @param {Array.<Object>} columns Array of column options
|
1644
1647
|
*/
|
1645
1648
|
Grid.prototype.restoreColumns = function(columns) {
|
1649
|
+
var grid = this._grid;
|
1650
|
+
grid.startBatch("reset");
|
1646
1651
|
var configObj = this.getConfigObject();
|
1647
1652
|
var previousColumns = configObj.columns;
|
1648
1653
|
|
@@ -1706,7 +1711,8 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
1706
1711
|
this._stp.sortColumns(sortingStates);
|
1707
1712
|
}
|
1708
1713
|
|
1709
|
-
|
1714
|
+
grid.reorderColumns(columnOrdering);
|
1715
|
+
grid.stopBatch("reset");
|
1710
1716
|
};
|
1711
1717
|
|
1712
1718
|
/** Remove all existing columns and add new columns based on the given texts/fields
|
@@ -3399,33 +3405,34 @@ Grid.prototype._updateStreamingData = function() {
|
|
3399
3405
|
* @param {Object} e
|
3400
3406
|
*/
|
3401
3407
|
Grid.prototype._onPreDataSorting = function (e) {
|
3402
|
-
var
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3408
|
+
var objs = this._stp.getSortedColumns();
|
3409
|
+
|
3410
|
+
this._sorter.reset();
|
3411
|
+
if(Array.isArray(objs)) {
|
3412
|
+
var sortCount = objs.length;
|
3413
|
+
for(var i = 0; i < sortCount; ++i) {
|
3414
|
+
var obj = objs[i];
|
3415
|
+
var field = obj["field"] || "";
|
3416
|
+
var colIndex = obj["colIndex"];
|
3417
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
3418
|
+
|
3419
|
+
var rowSorting = false;
|
3420
|
+
var sortLogic = null;
|
3421
|
+
if(colDef) {
|
3422
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
3423
|
+
rowSorting = colDef.isRowSorting();
|
3424
|
+
sortLogic = colDef.getSorter();
|
3425
|
+
}
|
3426
|
+
// TODO: get sortLogic from DataView
|
3427
|
+
// if(!sortLogic && field) {
|
3428
|
+
// sortLogic = state["sortLogic"];
|
3429
|
+
// }
|
3415
3430
|
|
3416
|
-
|
3417
|
-
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
3418
|
-
sortLogic = colDef.getSorter();
|
3419
|
-
rowSorting = colDef.isRowSorting();
|
3431
|
+
this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
|
3420
3432
|
}
|
3421
3433
|
}
|
3422
|
-
if(!sortLogic && field) {
|
3423
|
-
sortLogic = state["sortLogic"];
|
3424
|
-
}
|
3425
3434
|
|
3426
|
-
this._sorter.
|
3427
|
-
this._sorter.setSortLogic(sortLogic);
|
3428
|
-
this._columnSorter = this._sorter.getSorter(rowSorting);
|
3435
|
+
this._columnSorter = this._sorter.getSorter();
|
3429
3436
|
};
|
3430
3437
|
/** @private
|
3431
3438
|
* @param {RowDefinition} rowDefA
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
2
2
|
|
3
3
|
declare class RowDefSorter {
|
4
4
|
|
@@ -6,14 +6,14 @@ declare class RowDefSorter {
|
|
6
6
|
|
7
7
|
public dispose(): void;
|
8
8
|
|
9
|
-
public getSorter(
|
10
|
-
|
11
|
-
public setSortLogic(func?: ((...params: any[]) => any)|null): void;
|
9
|
+
public getSorter(): ((...params: any[]) => any)|null;
|
12
10
|
|
13
|
-
public
|
11
|
+
public reset(key: string, value: any): void;
|
14
12
|
|
15
13
|
public setContext(key: string, value: any): void;
|
16
14
|
|
15
|
+
public addColumnContext(field: string, logic: ((...params: any[]) => any)|null, rowSorting: boolean, order: string, colIndex: number, colDef: any): void;
|
16
|
+
|
17
17
|
}
|
18
18
|
|
19
19
|
export default RowDefSorter;
|
@@ -1,70 +1,147 @@
|
|
1
|
+
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
2
|
+
|
3
|
+
/** @private
|
4
|
+
* @param {*} a
|
5
|
+
* @param {*} b
|
6
|
+
* @param {number} order
|
7
|
+
* @return {number}
|
8
|
+
*/
|
9
|
+
var _defaultCompare = function(a, b, order) {
|
10
|
+
if(a == null || a !== a) {
|
11
|
+
if(b == null || b !== b) {
|
12
|
+
return 0;
|
13
|
+
}
|
14
|
+
return 1;
|
15
|
+
}
|
16
|
+
if(b == null || b !== b) {
|
17
|
+
return -1;
|
18
|
+
}
|
19
|
+
|
20
|
+
if(a < b) {
|
21
|
+
return -order;
|
22
|
+
}
|
23
|
+
if(b < a) {
|
24
|
+
return order;
|
25
|
+
}
|
26
|
+
return 0;
|
27
|
+
};
|
28
|
+
|
1
29
|
/** @constructor
|
2
30
|
*/
|
3
31
|
var RowDefSorter = function() {
|
4
32
|
this._defaultSorter = this._defaultSorter.bind(this);
|
5
33
|
this._dataSorter = this._dataSorter.bind(this);
|
6
34
|
this._rowDefSorter = this._rowDefSorter.bind(this);
|
35
|
+
this._multiColumnsSorter = this._multiColumnsSorter.bind(this);
|
7
36
|
|
8
|
-
this.
|
37
|
+
this._globalContext = {};
|
38
|
+
this._sortParams = [];
|
39
|
+
this._ctxCaches = [];
|
9
40
|
};
|
10
41
|
|
11
|
-
|
12
|
-
/** @type {string}
|
42
|
+
/** @type {!Object}
|
13
43
|
* @private
|
14
44
|
*/
|
15
|
-
RowDefSorter.prototype.
|
16
|
-
/** @type {!
|
45
|
+
RowDefSorter.prototype._globalContext;
|
46
|
+
/** @type {!Array.<Array>}
|
47
|
+
* @private
|
48
|
+
*/
|
49
|
+
RowDefSorter.prototype._sortParams;
|
50
|
+
/** @type {!Array.<Object>}
|
17
51
|
* @private
|
18
52
|
*/
|
19
|
-
RowDefSorter.prototype.
|
20
|
-
/** @type {
|
53
|
+
RowDefSorter.prototype._ctxCaches;
|
54
|
+
/** @type {Array}
|
21
55
|
* @private
|
22
56
|
*/
|
23
|
-
RowDefSorter.prototype.
|
57
|
+
RowDefSorter.prototype._primaryParams;
|
24
58
|
|
25
59
|
|
26
60
|
/** @public
|
27
61
|
*/
|
28
62
|
RowDefSorter.prototype.dispose = function() {
|
29
|
-
this.
|
30
|
-
this.
|
63
|
+
this._globalContext = {}; // Clear any existing reference
|
64
|
+
this._sortParams.length = 0;
|
65
|
+
this._ctxCaches.length = 0;
|
66
|
+
this._primaryParams = null;
|
31
67
|
};
|
32
68
|
|
33
69
|
/** @public
|
34
|
-
* @param {boolean=} rowSorting=false
|
35
70
|
* @return {Function}
|
36
71
|
*/
|
37
|
-
RowDefSorter.prototype.getSorter = function(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
72
|
+
RowDefSorter.prototype.getSorter = function() {
|
73
|
+
this._primaryParams = null;
|
74
|
+
var sortCount = this._sortParams.length;
|
75
|
+
if(sortCount === 1) {
|
76
|
+
var params = this._primaryParams = this._sortParams[0];
|
77
|
+
var sortLogic = params[1];
|
78
|
+
if(sortLogic) {
|
79
|
+
var rowSorting = params[3];
|
80
|
+
return rowSorting ? this._rowDefSorter : this._dataSorter;
|
81
|
+
} else {
|
82
|
+
return this._defaultSorter;
|
83
|
+
}
|
84
|
+
} else if(sortCount > 1) {
|
85
|
+
return this._multiColumnsSorter;
|
42
86
|
}
|
43
|
-
};
|
44
|
-
/** @public
|
45
|
-
* @param {Function=} func
|
46
|
-
*/
|
47
|
-
RowDefSorter.prototype.setSortLogic = function(func) {
|
48
|
-
this._sortLogic = (typeof func === "function") ? func : null;
|
49
|
-
};
|
50
87
|
|
88
|
+
return RowDefSorter._noSorting;
|
89
|
+
};
|
51
90
|
|
52
91
|
/** @public
|
53
|
-
* @param {string}
|
92
|
+
* @param {string} key
|
93
|
+
* @param {*} value
|
54
94
|
*/
|
55
|
-
RowDefSorter.prototype.
|
56
|
-
if(
|
57
|
-
|
95
|
+
RowDefSorter.prototype.reset = function() {
|
96
|
+
if(this._sortParams.length) {
|
97
|
+
this._sortParams.length = 0;
|
58
98
|
}
|
59
|
-
this._sortContext["field"] = this._field = field;
|
60
|
-
this._sortContext["formattedField"] = field + "_FORMATTED";
|
61
99
|
};
|
62
100
|
/** @public
|
63
101
|
* @param {string} key
|
64
102
|
* @param {*} value
|
65
103
|
*/
|
66
104
|
RowDefSorter.prototype.setContext = function(key, value) {
|
67
|
-
this.
|
105
|
+
this._globalContext[key] = value;
|
106
|
+
};
|
107
|
+
/** @public
|
108
|
+
* @param {string} field
|
109
|
+
* @param {Function} logic
|
110
|
+
* @param {boolean} rowSorting
|
111
|
+
* @param {string} order
|
112
|
+
* @param {number} colIndex
|
113
|
+
* @param {*} colDef
|
114
|
+
*/
|
115
|
+
RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, order, colIndex, colDef) {
|
116
|
+
if(!field) {
|
117
|
+
field = "";
|
118
|
+
}
|
119
|
+
var sortPriority = this._sortParams.length;
|
120
|
+
var ctx = this._ctxCaches[sortPriority];
|
121
|
+
if(!ctx) {
|
122
|
+
ctx = this._ctxCaches[sortPriority] = cloneObject(this._globalContext);
|
123
|
+
}
|
124
|
+
var orderNum = 0;
|
125
|
+
if(order === "a") {
|
126
|
+
orderNum = 1;
|
127
|
+
} else if(order === "d") {
|
128
|
+
orderNum = -1;
|
129
|
+
}
|
130
|
+
|
131
|
+
var params = [
|
132
|
+
field, // 0
|
133
|
+
(typeof logic === "function") ? logic : null, // 1
|
134
|
+
ctx, // 2
|
135
|
+
rowSorting, // 3
|
136
|
+
orderNum // 4
|
137
|
+
];
|
138
|
+
|
139
|
+
ctx["colIndex"] = colIndex;
|
140
|
+
ctx["field"] = field;
|
141
|
+
ctx["formattedField"] = field + "_FORMATTED";
|
142
|
+
ctx["colDef"] = colDef;
|
143
|
+
|
144
|
+
this._sortParams.push(params);
|
68
145
|
};
|
69
146
|
|
70
147
|
/** @private
|
@@ -73,32 +150,7 @@ RowDefSorter.prototype.setContext = function(key, value) {
|
|
73
150
|
* @param {number} order
|
74
151
|
* @return {number}
|
75
152
|
*/
|
76
|
-
RowDefSorter.
|
77
|
-
var orderA = rowDefA.getGroupOrder();
|
78
|
-
var orderB = rowDefB.getGroupOrder();
|
79
|
-
if(orderA !== orderB) {
|
80
|
-
return orderA - orderB; // Regardless of sort order
|
81
|
-
}
|
82
|
-
|
83
|
-
var a = rowDefA.getData(this._field);
|
84
|
-
var b = rowDefB.getData(this._field);
|
85
|
-
|
86
|
-
if(a == null || a !== a) {
|
87
|
-
if(b == null || b !== b) {
|
88
|
-
return 0;
|
89
|
-
}
|
90
|
-
return 1;
|
91
|
-
}
|
92
|
-
if(b == null || b !== b) {
|
93
|
-
return -1;
|
94
|
-
}
|
95
|
-
|
96
|
-
if(a < b) {
|
97
|
-
return -order;
|
98
|
-
}
|
99
|
-
if(b < a) {
|
100
|
-
return order;
|
101
|
-
}
|
153
|
+
RowDefSorter._noSorting = function(rowDefA, rowDefB, order) {
|
102
154
|
return 0;
|
103
155
|
};
|
104
156
|
/** @private
|
@@ -107,16 +159,30 @@ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
|
107
159
|
* @param {number} order
|
108
160
|
* @return {number}
|
109
161
|
*/
|
162
|
+
RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
163
|
+
var field = this._primaryParams[0];
|
164
|
+
return _defaultCompare(
|
165
|
+
rowDefA.getData(field),
|
166
|
+
rowDefB.getData(field),
|
167
|
+
order
|
168
|
+
);
|
169
|
+
};
|
170
|
+
/** @private
|
171
|
+
* @param {RowDefinition} rowDefA
|
172
|
+
* @param {RowDefinition} rowDefB
|
173
|
+
* @param {number} order
|
174
|
+
* @return {number}
|
175
|
+
*/
|
110
176
|
RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
111
|
-
var
|
112
|
-
var
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
177
|
+
var params = this._primaryParams;
|
178
|
+
var field = params[0];
|
179
|
+
var sortLogic = params[1];
|
180
|
+
return sortLogic(
|
181
|
+
rowDefA.getData(field),
|
182
|
+
rowDefB.getData(field),
|
183
|
+
order,
|
184
|
+
params[2]
|
185
|
+
);
|
120
186
|
};
|
121
187
|
/** @private
|
122
188
|
* @param {RowDefinition} rowDefA
|
@@ -125,13 +191,41 @@ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
|
125
191
|
* @return {number}
|
126
192
|
*/
|
127
193
|
RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
128
|
-
var
|
129
|
-
var
|
130
|
-
|
131
|
-
|
194
|
+
var params = this._primaryParams;
|
195
|
+
var sortLogic = params[1];
|
196
|
+
return sortLogic(rowDefA, rowDefB, order, params[2]);
|
197
|
+
};
|
198
|
+
/** @private
|
199
|
+
* @param {RowDefinition} rowDefA
|
200
|
+
* @param {RowDefinition} rowDefB
|
201
|
+
* @param {number} primaryOrder
|
202
|
+
* @return {number}
|
203
|
+
*/
|
204
|
+
RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryOrder) {
|
205
|
+
var sortParams = this._sortParams;
|
206
|
+
var sortCount = sortParams.length;
|
207
|
+
for(var i = 0; i < sortCount; ++i) {
|
208
|
+
var params = sortParams[i];
|
209
|
+
var field = params[0];
|
210
|
+
var sortLogic = params[1];
|
211
|
+
var ctx = params[2];
|
212
|
+
var rowSorting = params[3];
|
213
|
+
var orderNum = params[4];
|
214
|
+
var ret = 0;
|
215
|
+
if(sortLogic) {
|
216
|
+
if(rowSorting) {
|
217
|
+
ret = sortLogic(rowDefA, rowDefB, orderNum, ctx);
|
218
|
+
} else {
|
219
|
+
ret = sortLogic(rowDefA.getData(field), rowDefB.getData(field), orderNum, ctx);
|
220
|
+
}
|
221
|
+
} else {
|
222
|
+
ret = _defaultCompare(rowDefA.getData(field), rowDefB.getData(field), orderNum);
|
223
|
+
}
|
224
|
+
if(ret) {
|
225
|
+
return ret;
|
226
|
+
}
|
132
227
|
}
|
133
|
-
|
134
|
-
return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
|
228
|
+
return 0;
|
135
229
|
};
|
136
230
|
|
137
231
|
export default RowDefSorter;
|
@@ -38,6 +38,8 @@ var ColumnSelectionPlugin = function ColumnSelectionPlugin(options) {
|
|
38
38
|
t._onReselection = t._onReselection.bind(t);
|
39
39
|
t._onThemeLoaded = t._onThemeLoaded.bind(t);
|
40
40
|
t._onColumnPositionChanged = t._onColumnPositionChanged.bind(t);
|
41
|
+
t._onBeforeBatchOperation = t._onBeforeBatchOperation.bind(t);
|
42
|
+
t._onAfterBatchOperation = t._onAfterBatchOperation.bind(t);
|
41
43
|
t._updateMenuIcon = t._updateMenuIcon.bind(t);
|
42
44
|
t._hosts = [];
|
43
45
|
|
@@ -121,6 +123,12 @@ ColumnSelectionPlugin.prototype._menuPosition = "outside";
|
|
121
123
|
|
122
124
|
ColumnSelectionPlugin.prototype._cgp = null; // Column grouping extension
|
123
125
|
|
126
|
+
/** @type {Array.<string>}
|
127
|
+
* @private
|
128
|
+
*/
|
129
|
+
|
130
|
+
ColumnSelectionPlugin.prototype._prevSelectedCols = {}; // previous selected columns during batch operation
|
131
|
+
|
124
132
|
/** @public
|
125
133
|
* @return {string}
|
126
134
|
*/
|
@@ -156,6 +164,8 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
|
|
156
164
|
host.listen("columnRemoved", this._onColumnRemoved);
|
157
165
|
host.listen("columnAdded", this._onColumnAdded);
|
158
166
|
host.listen("columnPositionChanged", this._onColumnPositionChanged);
|
167
|
+
host.listen("beforeBatchOperation", this._onBeforeBatchOperation);
|
168
|
+
host.listen("afterBatchOperation", this._onAfterBatchOperation);
|
159
169
|
this.config(options);
|
160
170
|
|
161
171
|
if (ColumnSelectionPlugin._stylePromise) {
|
@@ -1098,6 +1108,62 @@ ColumnSelectionPlugin.prototype._onReselection = function (e) {
|
|
1098
1108
|
this._activeGrid.focus();
|
1099
1109
|
};
|
1100
1110
|
/** @private
|
1111
|
+
* @param {Object} e
|
1112
|
+
*/
|
1113
|
+
|
1114
|
+
|
1115
|
+
ColumnSelectionPlugin.prototype._onBeforeBatchOperation = function (e) {
|
1116
|
+
var host = this._activeGrid;
|
1117
|
+
|
1118
|
+
if (this._hasSelection && e["batchType"] === "reset") {
|
1119
|
+
var colCount = this.getColumnCount();
|
1120
|
+
|
1121
|
+
for (var i = 0; i < colCount; ++i) {
|
1122
|
+
if (this.isSelectedColumn(i)) {
|
1123
|
+
var colId = host.getColumnId(i);
|
1124
|
+
var field = host.getColumnField(i);
|
1125
|
+
|
1126
|
+
if (colId) {
|
1127
|
+
this._prevSelectedCols[colId] = field;
|
1128
|
+
} else {
|
1129
|
+
this._prevSelectedCols[field] = "";
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
this.clearAllSelections(); //clear all to improve performance during add/remove operation
|
1135
|
+
}
|
1136
|
+
};
|
1137
|
+
/** @private
|
1138
|
+
* @param {Object} e
|
1139
|
+
*/
|
1140
|
+
|
1141
|
+
|
1142
|
+
ColumnSelectionPlugin.prototype._onAfterBatchOperation = function (e) {
|
1143
|
+
if (e["batchType"] === "reset") {
|
1144
|
+
var prevSelectedCols = Object.keys(this._prevSelectedCols);
|
1145
|
+
var prevSelectedCount = prevSelectedCols.length;
|
1146
|
+
|
1147
|
+
if (prevSelectedCount) {
|
1148
|
+
this.clearAllSelections();
|
1149
|
+
|
1150
|
+
for (var i = 0; i < prevSelectedCount; i++) {
|
1151
|
+
var colId = prevSelectedCols[i];
|
1152
|
+
var field = this._prevSelectedCols[colId];
|
1153
|
+
var prevSelectedIndex = this.getColumnIndex(colId);
|
1154
|
+
|
1155
|
+
if (prevSelectedIndex < 0) {
|
1156
|
+
prevSelectedIndex = this.getColumnIndex(field);
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
this.setSelectedColumn(prevSelectedIndex, true);
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
this._prevSelectedCols = {};
|
1163
|
+
}
|
1164
|
+
}
|
1165
|
+
};
|
1166
|
+
/** @private
|
1101
1167
|
* @param {KeyboardEvent} e
|
1102
1168
|
* @return {boolean}
|
1103
1169
|
*/
|
@@ -137,6 +137,8 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
137
137
|
|
138
138
|
public isStackHidden(stackId: string): boolean|null|null;
|
139
139
|
|
140
|
+
public moveStack(stackId: string, destCol?: (number|string)|null): boolean;
|
141
|
+
|
140
142
|
}
|
141
143
|
|
142
144
|
export default ColumnStackPlugin;
|
@@ -1867,11 +1867,11 @@ ColumnStackPlugin.prototype.unsetParent = ColumnStackPlugin.prototype.removeColu
|
|
1867
1867
|
*/
|
1868
1868
|
ColumnStackPlugin.prototype.reorderColumns = function(colList, destCol) {
|
1869
1869
|
var dirty = false;
|
1870
|
-
this._stacking =
|
1870
|
+
this._stacking = true;
|
1871
1871
|
|
1872
|
-
this._reorderColumns(colList, destCol);
|
1872
|
+
dirty = this._reorderColumns(colList, destCol);
|
1873
1873
|
|
1874
|
-
this._stacking =
|
1874
|
+
this._stacking = false;
|
1875
1875
|
return dirty;
|
1876
1876
|
};
|
1877
1877
|
/** Move the specified column to position before the destination
|
@@ -1973,6 +1973,20 @@ ColumnStackPlugin.prototype.isStackHidden = function(stackId) {
|
|
1973
1973
|
|
1974
1974
|
return !isVisible;
|
1975
1975
|
};
|
1976
|
+
/** Move an entire stack to position before the destination
|
1977
|
+
* @public
|
1978
|
+
* @param {string} stackId Stack id to be moved
|
1979
|
+
* @param {(number|string)=} destCol Destination column id or index
|
1980
|
+
* @return {boolean}
|
1981
|
+
*/
|
1982
|
+
ColumnStackPlugin.prototype.moveStack = function(stackId, destCol) {
|
1983
|
+
if(!stackId){
|
1984
|
+
return false;
|
1985
|
+
}
|
1986
|
+
var colList = this.getStackMemberIds(stackId);
|
1987
|
+
var dirty = this.reorderColumns(colList, destCol);
|
1988
|
+
return dirty;
|
1989
|
+
};
|
1976
1990
|
|
1977
1991
|
|
1978
1992
|
|
@@ -920,7 +920,7 @@ ConditionalColoringPlugin._mergeUpdates = function(e) {
|
|
920
920
|
* @return {string} prettified CSS string
|
921
921
|
*/
|
922
922
|
ConditionalColoringPlugin.prototype._prepareStyles = function(colors) {
|
923
|
-
var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .cell";
|
923
|
+
var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .column.conditionally-colored .cell";
|
924
924
|
var css = [];
|
925
925
|
var ss, styles, value;
|
926
926
|
for (var className in colors) {
|
@@ -906,9 +906,12 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
906
906
|
var srcRowTypes = [];
|
907
907
|
var conRowType = "";
|
908
908
|
var api = this.getGridApi();
|
909
|
+
if(api && !api.getRowType) {
|
910
|
+
api = null;
|
911
|
+
}
|
909
912
|
for(i = 0; i < srcCount; ++i) {
|
910
913
|
var srcIndex = srcRowIndices[i];
|
911
|
-
var rowType = api.getRowType(srcIndex);
|
914
|
+
var rowType = api ? api.getRowType(srcIndex) : "CONTENT";
|
912
915
|
srcRowIds[i] = srcDv.getRowId(srcIndex);
|
913
916
|
srcRowTypes[i] = rowType;
|
914
917
|
if(conRowType) {
|
@@ -919,7 +922,10 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
919
922
|
conRowType = rowType;
|
920
923
|
}
|
921
924
|
}
|
922
|
-
|
925
|
+
if(!conRowType) {
|
926
|
+
conRowType = "CONTENT";
|
927
|
+
}
|
928
|
+
var destRowType = api ? api.getRowType(destRowIndex) : ""; // TODO: this has to be get from destGrid
|
923
929
|
var destRowId = destDv.getRowId(destRowIndex);
|
924
930
|
var parentRowId, childRowIds;
|
925
931
|
|
@@ -966,7 +972,8 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
966
972
|
}
|
967
973
|
} else if(conRowType === "GROUP_MEMBER") {
|
968
974
|
if(srcCount === 1) {
|
969
|
-
|
975
|
+
var srcRowId = srcRowIds[0];
|
976
|
+
parentRowId = rsp.getSegmentParentRowId(srcRowId);
|
970
977
|
childRowIds = rsp.getSegmentChildIds(parentRowId);
|
971
978
|
var childCount = childRowIds ? childRowIds.length : 0;
|
972
979
|
var endOfSegment = srcDv.getRowIndex(parentRowId) + childCount + 1;
|
@@ -976,6 +983,10 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
976
983
|
var destParentRowId = rsp.getSegmentParentRowId(destRowId);
|
977
984
|
if(parentRowId === destParentRowId) {
|
978
985
|
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
986
|
+
} else { // Moving row between two segments
|
987
|
+
rsp.removeSegmentChild(parentRowId, srcRowId);
|
988
|
+
rsp.addSegmentChild(destParentRowId, srcRowId);
|
989
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
979
990
|
}
|
980
991
|
} else if(_isNormalRowType(destRowType)) { // move member out of existing segment
|
981
992
|
rsp.removeSegmentChild(parentRowId, srcRowIds[0]);
|
@@ -320,11 +320,12 @@ RowColoringPlugin.prototype.setPredefinedColors = function (predefinedColors) {
|
|
320
320
|
* @param {Object} predefinedColors Predefined color object map
|
321
321
|
*/
|
322
322
|
RowColoringPlugin.prototype._injectStyles = function (predefinedColors) {
|
323
|
-
var
|
323
|
+
var prefix1 = ".tr-grid." + RowColoringPlugin._controlClass + " .section .column .cell";
|
324
|
+
var prefix2 = ".tr-grid." + RowColoringPlugin._controlClass + " .section .cover-layer .cell";
|
324
325
|
var css = [];
|
325
326
|
var ss, styles, value;
|
326
327
|
for (var className in predefinedColors) {
|
327
|
-
css.push(
|
328
|
+
css.push(prefix1 + "." + className + ", " + prefix2 + "." + className);
|
328
329
|
ss = [];
|
329
330
|
styles = predefinedColors[className];
|
330
331
|
value = styles["backgroundColor"];
|
@@ -62,8 +62,9 @@ DragUI.applyThemeColor = function(grid) {
|
|
62
62
|
*/
|
63
63
|
DragUI.prototype.onThemeLoaded = function(colors) {
|
64
64
|
if(!DragUI._styles) {
|
65
|
+
var ElfVersion = ElfUtil.getElfVersion();
|
65
66
|
var cursor = "grabbing";
|
66
|
-
if (
|
67
|
+
if (ElfVersion < 3) {
|
67
68
|
cursor = "move";
|
68
69
|
}
|
69
70
|
var styles = [ // Main Styles without theme
|
@@ -135,7 +136,8 @@ DragUI.prototype.onThemeLoaded = function(colors) {
|
|
135
136
|
"--grid-insertion-icon-bgcolor: #39c46e;",
|
136
137
|
"--grid-insertion-icon-color: #1A1A1A;",
|
137
138
|
"--grid-void-icon-bgcolor: #F5475B;",
|
138
|
-
"--grid-void-icon-color: #FFFFFF;"
|
139
|
+
"--grid-void-icon-color: #FFFFFF;",
|
140
|
+
"--grid-title-icon-color: var(--grid-guideline-color);" // v3 fallback
|
139
141
|
],
|
140
142
|
".mouse-dragging .cell:hover", [ // for change mouse cursor when hover header while dragging
|
141
143
|
"cursor: " + cursor + " !important;"
|
@@ -149,10 +151,12 @@ DragUI.prototype.onThemeLoaded = function(colors) {
|
|
149
151
|
".tr-dragging, .tr-dragging *", [
|
150
152
|
"-webkit-touch-callout: none;",
|
151
153
|
".user-select(none);"
|
154
|
+
],
|
155
|
+
".tr-dragbox", [
|
156
|
+
"background-color: unset;" // v3 fallback
|
152
157
|
]
|
153
158
|
];
|
154
159
|
var guidelineColor = "#ff9933";
|
155
|
-
var ElfVersion = ElfUtil.getElfVersion();
|
156
160
|
if(colors.primary) {
|
157
161
|
guidelineColor = colors.primary;
|
158
162
|
}
|