@refinitiv-ui/efx-grid 6.0.13 → 6.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/column-format-dialog/index.d.ts +2 -1
- package/lib/column-format-dialog/index.js +2 -1
- package/lib/column-selection-dialog/index.d.ts +2 -1
- package/lib/column-selection-dialog/index.js +2 -1
- package/lib/core/dist/core.js +1220 -161
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataCache.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +18 -3
- package/lib/core/es6/data/DataTable.js +203 -17
- package/lib/core/es6/data/DataView.d.ts +8 -1
- package/lib/core/es6/data/DataView.js +30 -2
- package/lib/core/es6/data/Segment.d.ts +37 -12
- package/lib/core/es6/data/Segment.js +584 -60
- package/lib/core/es6/data/SegmentCollection.d.ts +16 -2
- package/lib/core/es6/data/SegmentCollection.js +238 -80
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/filter-dialog/index.d.ts +2 -1
- package/lib/filter-dialog/index.js +2 -1
- package/lib/grid/index.d.ts +2 -1
- package/lib/grid/index.js +3 -2
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +2 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +26 -3
- package/lib/rt-grid/dist/rt-grid.js +1194 -158
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +75 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +4 -0
- package/lib/rt-grid/es6/RowDefinition.js +79 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +194 -366
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +10 -3
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +93 -36
- package/lib/tr-grid-util/es6/RowPainter.d.ts +2 -1
- package/lib/tr-grid-util/es6/RowPainter.js +7 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -0
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +191 -52
- package/lib/types/es6/ColumnGrouping.d.ts +1 -0
- package/lib/types/es6/ColumnStack.d.ts +10 -3
- package/lib/types/es6/Core/data/DataTable.d.ts +18 -3
- package/lib/types/es6/Core/data/DataView.d.ts +8 -1
- package/lib/types/es6/Core/data/Segment.d.ts +36 -11
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +15 -1
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
- package/lib/types/es6/RowSegmenting.d.ts +2 -0
- package/lib/versions.json +4 -4
- package/package.json +15 -2
@@ -1,9 +1,13 @@
|
|
1
|
+
import Ext from "../../../tr-grid-util/es6/Ext.js";
|
2
|
+
import EventDispatcher from "../../../tr-grid-util/es6/EventDispatcher.js";
|
1
3
|
import Segment from "./Segment.js";
|
2
4
|
|
3
|
-
declare class SegmentCollection {
|
5
|
+
declare class SegmentCollection extends EventDispatcher {
|
4
6
|
|
5
7
|
constructor();
|
6
8
|
|
9
|
+
public dispose(): void;
|
10
|
+
|
7
11
|
public addSegment(rid: string): boolean;
|
8
12
|
|
9
13
|
public addSegments(rids: (string)[]|null): boolean;
|
@@ -34,7 +38,7 @@ declare class SegmentCollection {
|
|
34
38
|
|
35
39
|
public getCollapsedRows(): any;
|
36
40
|
|
37
|
-
public addSegmentChild(segmentId: string, rid: string): boolean;
|
41
|
+
public addSegmentChild(segmentId: string, rid: string, dataId?: string|null): boolean;
|
38
42
|
|
39
43
|
public addSegmentChildren(segmentId: string, rids: (string)[]|null): boolean;
|
40
44
|
|
@@ -54,6 +58,16 @@ declare class SegmentCollection {
|
|
54
58
|
|
55
59
|
public getSegmentValues(rids: (string)[]): (number)[]|null;
|
56
60
|
|
61
|
+
public logStructure(): string;
|
62
|
+
|
63
|
+
public logRowIdMap(): string;
|
64
|
+
|
65
|
+
public setSegmentClassification(segmentId: string, fields: string|(string)[]|null): boolean;
|
66
|
+
|
67
|
+
public hasClassification(): boolean;
|
68
|
+
|
69
|
+
public classify(rows: { [key: string]: any }|null): boolean;
|
70
|
+
|
57
71
|
}
|
58
72
|
|
59
73
|
export default SegmentCollection;
|
@@ -1,17 +1,30 @@
|
|
1
|
+
import Ext from "../../../tr-grid-util/es6/Ext.js";
|
2
|
+
import EventDispatcher from "../../../tr-grid-util/es6/EventDispatcher.js";
|
1
3
|
import Segment from "./Segment.js";
|
2
4
|
|
3
5
|
/** @constructor
|
6
|
+
* @extends {EventDispatcher}
|
4
7
|
*/
|
5
8
|
var SegmentCollection = function() {
|
9
|
+
this._onSubSegmentAdded = this._onSubSegmentAdded.bind(this);
|
10
|
+
this._onSubSegmentRemoved = this._onSubSegmentRemoved.bind(this);
|
11
|
+
|
6
12
|
this._segments = {};
|
7
|
-
this.
|
13
|
+
this._insertionList = [];
|
14
|
+
this._removalList = [];
|
15
|
+
|
16
|
+
this._shared = {
|
17
|
+
childToSegment: {}, // child Id to segment Id
|
18
|
+
dirtyCollapsingState: false
|
19
|
+
};
|
8
20
|
};
|
21
|
+
Ext.inherits(SegmentCollection, EventDispatcher);
|
9
22
|
|
10
23
|
|
11
24
|
/** @type {!Object.<string, Segment>}
|
12
25
|
* @private
|
13
26
|
*/
|
14
|
-
SegmentCollection.prototype._segments;
|
27
|
+
SegmentCollection.prototype._segments; // Contains both segment and their sub segments
|
15
28
|
/** @type {number}
|
16
29
|
* @private
|
17
30
|
*/
|
@@ -20,28 +33,54 @@ SegmentCollection.prototype._segmentCount = 0;
|
|
20
33
|
* @private
|
21
34
|
*/
|
22
35
|
SegmentCollection.prototype._collapsedRids = null;
|
36
|
+
/** @type {!Object}
|
37
|
+
* @private
|
38
|
+
*/
|
39
|
+
SegmentCollection.prototype._shared;
|
40
|
+
/** @type {Array.<Segment>}
|
41
|
+
* @private
|
42
|
+
*/
|
43
|
+
SegmentCollection.prototype._segmentList = null; // Array of main segments
|
44
|
+
/** @type {Array.<Segment>}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
SegmentCollection.prototype._insertionList = null; // Array of sub segments
|
48
|
+
/** @type {Array.<string>}
|
49
|
+
* @private
|
50
|
+
*/
|
51
|
+
SegmentCollection.prototype._removalList = null; // Array of sub segment ids
|
23
52
|
/** @type {boolean}
|
24
53
|
* @private
|
25
54
|
*/
|
26
|
-
SegmentCollection.prototype.
|
27
|
-
/** @type {
|
55
|
+
SegmentCollection.prototype._classification = false;
|
56
|
+
/** @type {boolean}
|
28
57
|
* @private
|
29
58
|
*/
|
30
|
-
SegmentCollection.prototype.
|
31
|
-
|
59
|
+
SegmentCollection.prototype._classifierChanged = false;
|
32
60
|
|
61
|
+
/** @public
|
62
|
+
*/
|
63
|
+
SegmentCollection.prototype.dispose = function() {
|
64
|
+
this.removeAllSegments();
|
65
|
+
this.removeAllEventListeners();
|
66
|
+
this._collapsedRids = null;
|
67
|
+
this._segmentList = this._insertionList = this._removalList = null;
|
68
|
+
};
|
33
69
|
/** @public
|
34
70
|
* @param {string} rid
|
35
71
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
36
72
|
*/
|
37
73
|
SegmentCollection.prototype.addSegment = function(rid) {
|
38
74
|
if(rid && !this._segments[rid]) {
|
39
|
-
if(this.
|
75
|
+
if(this.getParentRowId(rid)) {
|
40
76
|
console.log("child of a segment cannot be set as a segment separator");
|
41
77
|
return false;
|
42
78
|
}
|
43
|
-
this._segments[rid] = new Segment(rid);
|
79
|
+
var segment = this._segments[rid] = new Segment(rid, this._shared);
|
80
|
+
segment.addEventListener("subSegmentAdded", this._onSubSegmentAdded);
|
81
|
+
segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
|
44
82
|
++this._segmentCount;
|
83
|
+
this._segmentList = null; // order could be changed
|
45
84
|
return true;
|
46
85
|
}
|
47
86
|
return false;
|
@@ -71,7 +110,7 @@ SegmentCollection.prototype.containsSegment = function(rid) {
|
|
71
110
|
* @return {string} parent row id of this segmentation. If the parent row id for this segmentation cannot be found, return ""
|
72
111
|
*/
|
73
112
|
SegmentCollection.prototype.getParentRowId = function(rid) {
|
74
|
-
return this.
|
113
|
+
return this._shared.childToSegment[rid] || "";
|
75
114
|
};
|
76
115
|
/** @public
|
77
116
|
* @param {string} rid
|
@@ -80,10 +119,27 @@ SegmentCollection.prototype.getParentRowId = function(rid) {
|
|
80
119
|
SegmentCollection.prototype.removeSegment = function(rid) {
|
81
120
|
var segment = this._segments[rid];
|
82
121
|
if(segment) {
|
83
|
-
if(
|
84
|
-
this.
|
122
|
+
if(this._segmentCount <= 1) {
|
123
|
+
return this.removeAllSegments();
|
124
|
+
}
|
125
|
+
if(segment.isSubSegment()) {
|
126
|
+
this._removalList.push(segment.getId());
|
85
127
|
}
|
86
|
-
segment.
|
128
|
+
var subSegIds = segment.getSubSegmentIds();
|
129
|
+
if(subSegIds) {
|
130
|
+
var len = subSegIds.length;
|
131
|
+
for(var i = 0; i < len; ++i) {
|
132
|
+
var subSegId = subSegIds[i];
|
133
|
+
if(this._segments[subSegId]) {
|
134
|
+
this._removalList.push(subSegId);
|
135
|
+
delete this._segments[subSegId]; // Slow
|
136
|
+
--this._segmentCount;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
segment.removeAllChildren(); // This is important for updating childToSegment
|
141
|
+
segment.dispose();
|
142
|
+
|
87
143
|
delete this._segments[rid]; // Slow
|
88
144
|
--this._segmentCount;
|
89
145
|
return true;
|
@@ -95,10 +151,15 @@ SegmentCollection.prototype.removeSegment = function(rid) {
|
|
95
151
|
*/
|
96
152
|
SegmentCollection.prototype.removeAllSegments = function() {
|
97
153
|
if(this._segmentCount) {
|
154
|
+
for(var key in this._segments) {
|
155
|
+
this._segments[key].dispose();
|
156
|
+
}
|
98
157
|
this._segments = {};
|
99
|
-
this._childToSegmentId = {};
|
100
158
|
this._segmentCount = 0;
|
101
|
-
this.
|
159
|
+
this._segmentList = null;
|
160
|
+
this._shared.childToSegment = {};
|
161
|
+
|
162
|
+
this._classification = this._classifierChanged = false;
|
102
163
|
return true;
|
103
164
|
}
|
104
165
|
return false;
|
@@ -139,11 +200,7 @@ SegmentCollection.prototype.getSegmentIds = function() {
|
|
139
200
|
SegmentCollection.prototype.collapseSegment = function(segmentId, bool) {
|
140
201
|
var segment = this._segments[segmentId];
|
141
202
|
if(segment) {
|
142
|
-
|
143
|
-
if(dirty) {
|
144
|
-
this._dirtyCollapsingState = true;
|
145
|
-
return true;
|
146
|
-
}
|
203
|
+
return segment.collapse(bool);
|
147
204
|
}
|
148
205
|
return false;
|
149
206
|
};
|
@@ -166,7 +223,6 @@ SegmentCollection.prototype.expandAllSegments = function() {
|
|
166
223
|
dirty |= segmentSeparators[rid].expand();
|
167
224
|
}
|
168
225
|
if(dirty) {
|
169
|
-
this._dirtyCollapsingState = true;
|
170
226
|
return true;
|
171
227
|
}
|
172
228
|
}
|
@@ -187,17 +243,19 @@ SegmentCollection.prototype.isCollapsedSegment = function(segmentId) {
|
|
187
243
|
* @return {Object}
|
188
244
|
*/
|
189
245
|
SegmentCollection.prototype.getCollapsedRows = function() {
|
190
|
-
if(this.
|
191
|
-
this.
|
246
|
+
if(this._shared.dirtyCollapsingState) {
|
247
|
+
this._shared.dirtyCollapsingState = false;
|
192
248
|
var collapsedRids = null;
|
193
249
|
var count = 0;
|
194
250
|
if(this._segmentCount) {
|
195
251
|
var segmentSeparators = this._segments;
|
196
252
|
collapsedRids = {};
|
197
253
|
for(var rid in segmentSeparators) {
|
198
|
-
|
199
|
-
|
200
|
-
|
254
|
+
var segment = segmentSeparators[rid];
|
255
|
+
if(!segment.isSubSegment()) {
|
256
|
+
if(segment.getCollapsingStates(collapsedRids)) {
|
257
|
+
++count;
|
258
|
+
}
|
201
259
|
}
|
202
260
|
}
|
203
261
|
}
|
@@ -209,18 +267,13 @@ SegmentCollection.prototype.getCollapsedRows = function() {
|
|
209
267
|
/** @public
|
210
268
|
* @param {string} segmentId
|
211
269
|
* @param {string} rid
|
270
|
+
* @param {string=} dataId Row id for retrieving data
|
212
271
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
213
272
|
*/
|
214
|
-
SegmentCollection.prototype.addSegmentChild = function(segmentId, rid) {
|
273
|
+
SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
215
274
|
var segment = this._segments[segmentId];
|
216
|
-
if(segment) {
|
217
|
-
|
218
|
-
if(dirty) {
|
219
|
-
if(segment.isCollapsed()) {
|
220
|
-
this._dirtyCollapsingState = true;
|
221
|
-
}
|
222
|
-
return true;
|
223
|
-
}
|
275
|
+
if(segment && !segment.isSubSegment()) {
|
276
|
+
return segment.addChild(rid, dataId);
|
224
277
|
}
|
225
278
|
return false;
|
226
279
|
};
|
@@ -231,14 +284,8 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid) {
|
|
231
284
|
*/
|
232
285
|
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids) {
|
233
286
|
var segment = this._segments[segmentId];
|
234
|
-
if(segment) {
|
235
|
-
|
236
|
-
if(dirty) {
|
237
|
-
if(segment.isCollapsed()) {
|
238
|
-
this._dirtyCollapsingState = true;
|
239
|
-
}
|
240
|
-
return true;
|
241
|
-
}
|
287
|
+
if(segment && !segment.isSubSegment()) {
|
288
|
+
return segment.addChildren(rids);
|
242
289
|
}
|
243
290
|
return false;
|
244
291
|
};
|
@@ -262,13 +309,7 @@ SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
|
262
309
|
SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
263
310
|
var segment = this._segments[segmentId];
|
264
311
|
if(segment) {
|
265
|
-
|
266
|
-
if(dirty) {
|
267
|
-
if(segment.isCollapsed()) {
|
268
|
-
this._dirtyCollapsingState = true;
|
269
|
-
}
|
270
|
-
return true;
|
271
|
-
}
|
312
|
+
return segment.removeChild(rid);
|
272
313
|
}
|
273
314
|
return false;
|
274
315
|
};
|
@@ -280,13 +321,7 @@ SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
280
321
|
SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
281
322
|
var segment = this._segments[segmentId];
|
282
323
|
if(segment) {
|
283
|
-
|
284
|
-
if(dirty) {
|
285
|
-
if(segment.isCollapsed()) {
|
286
|
-
this._dirtyCollapsingState = true;
|
287
|
-
}
|
288
|
-
return true;
|
289
|
-
}
|
324
|
+
return segment.removeChildren(rids);
|
290
325
|
}
|
291
326
|
return false;
|
292
327
|
};
|
@@ -294,20 +329,20 @@ SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
|
294
329
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
295
330
|
*/
|
296
331
|
SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
297
|
-
this.
|
332
|
+
this._shared.childToSegment = {};
|
298
333
|
var segmentSeparators = this._segments;
|
299
|
-
var dirtyCollapsingState = this._dirtyCollapsingState;
|
300
334
|
var dirty = false;
|
301
335
|
for(var rid in segmentSeparators) {
|
302
|
-
var segment =
|
336
|
+
var segment = segmentSeparators[rid];
|
303
337
|
if(segment.removeAllChildren()) {
|
304
338
|
dirty = true;
|
305
|
-
if(!dirtyCollapsingState && segment.isCollapsed()) {
|
306
|
-
dirtyCollapsingState = this._dirtyCollapsingState = true;
|
307
|
-
}
|
308
339
|
}
|
309
340
|
}
|
310
341
|
|
342
|
+
if(dirty) {
|
343
|
+
this.classify(null);
|
344
|
+
}
|
345
|
+
|
311
346
|
return dirty;
|
312
347
|
};
|
313
348
|
|
@@ -321,22 +356,18 @@ SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
321
356
|
return;
|
322
357
|
}
|
323
358
|
var segmentSeparators = this._segments;
|
324
|
-
var childToSegmentId = this._childToSegmentId;
|
325
359
|
var curSegment = segmentSeparators[segmentId];
|
326
|
-
if(curSegment) {
|
360
|
+
if(curSegment && !curSegment.isSubSegment()) {
|
327
361
|
var segmentAt = rids.indexOf(segmentId);
|
328
362
|
if(segmentAt >= 0) {
|
329
|
-
|
330
|
-
this._dirtyCollapsingState = true;
|
331
|
-
}
|
332
|
-
curSegment.removeAllChildren(childToSegmentId);
|
363
|
+
curSegment.removeAllChildren();
|
333
364
|
for(var r = segmentAt + 1; r < rowCount; ++r) {
|
334
365
|
var rid = rids[r];
|
335
366
|
var segmentSeparator = segmentSeparators[rid];
|
336
367
|
if(segmentSeparator) {
|
337
368
|
break;
|
338
369
|
}
|
339
|
-
curSegment.addChild(rid
|
370
|
+
curSegment.addChild(rid);
|
340
371
|
}
|
341
372
|
}
|
342
373
|
}
|
@@ -346,23 +377,20 @@ SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
346
377
|
* @return {boolean} Return true if the fill segments have changed, otherwise return false
|
347
378
|
*/
|
348
379
|
SegmentCollection.prototype.fillSegments = function(rids) {
|
380
|
+
this._shared.childToSegment = {};
|
381
|
+
|
349
382
|
var rowCount = Array.isArray(rids) ? rids.length : 0;
|
350
|
-
this._childToSegmentId = {};
|
351
383
|
var segmentSeparators = this._segments;
|
352
|
-
var childToSegmentId = this._childToSegmentId;
|
353
384
|
var curSegment = null;
|
354
385
|
var change = false;
|
355
386
|
for(var r = 0; r < rowCount; ++r) {
|
356
387
|
var rid = rids[r];
|
357
388
|
var segmentSeparator = segmentSeparators[rid];
|
358
|
-
if(segmentSeparator) {
|
389
|
+
if(segmentSeparator && !segmentSeparator.isSubSegment()) {
|
359
390
|
curSegment = segmentSeparator;
|
360
|
-
if(curSegment.isCollapsed()) {
|
361
|
-
this._dirtyCollapsingState = true;
|
362
|
-
}
|
363
391
|
curSegment.removeAllChildren();
|
364
|
-
} else if(curSegment) {
|
365
|
-
curSegment.addChild(rid
|
392
|
+
} else if(curSegment && !curSegment.isSubSegment()) {
|
393
|
+
curSegment.addChild(rid);
|
366
394
|
change = true;
|
367
395
|
}
|
368
396
|
}
|
@@ -372,6 +400,13 @@ SegmentCollection.prototype.fillSegments = function(rids) {
|
|
372
400
|
* @param {Array.<string>} rids
|
373
401
|
*/
|
374
402
|
SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
403
|
+
var segmentList = this._segmentList;
|
404
|
+
if(segmentList) {
|
405
|
+
segmentList.length = 0;
|
406
|
+
} else {
|
407
|
+
segmentList = this._segmentList = [];
|
408
|
+
}
|
409
|
+
|
375
410
|
var ridCount = rids ? rids.length : 0;
|
376
411
|
var segmentSeparators = this._segments;
|
377
412
|
var segmentCount = this._segmentCount;
|
@@ -380,8 +415,11 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
|
380
415
|
var rid = rids[i];
|
381
416
|
var segment = segmentSeparators[rid];
|
382
417
|
if(segment) {
|
383
|
-
segment.
|
384
|
-
|
418
|
+
if(!segment.isSubSegment()) {
|
419
|
+
this._segmentList.push(segment);
|
420
|
+
segment.setOrder(++order); // WARNING: Segments and sub segments start with 1
|
421
|
+
}
|
422
|
+
if(--segmentCount <= 0) {
|
385
423
|
break;
|
386
424
|
}
|
387
425
|
}
|
@@ -397,7 +435,7 @@ SegmentCollection.prototype.getSegmentValues = function(rids) {
|
|
397
435
|
return null;
|
398
436
|
}
|
399
437
|
var segmentSeparators = this._segments;
|
400
|
-
var childToSegmentId = this.
|
438
|
+
var childToSegmentId = this._shared.childToSegment;
|
401
439
|
var curSegment = null;
|
402
440
|
var prevSegment = null;
|
403
441
|
var segmentValues = new Array(rowCount);
|
@@ -427,6 +465,126 @@ SegmentCollection.prototype.getSegmentValues = function(rids) {
|
|
427
465
|
|
428
466
|
return prevSegment ? segmentValues : null;
|
429
467
|
};
|
468
|
+
/** @public
|
469
|
+
* @return {string}
|
470
|
+
*/
|
471
|
+
SegmentCollection.prototype.logStructure = function() {
|
472
|
+
var segmentList = this._segmentList;
|
473
|
+
if(!segmentList) {
|
474
|
+
return "";
|
475
|
+
}
|
476
|
+
var segmentCount = segmentList.length;
|
477
|
+
var lines = [];
|
478
|
+
for(var i = 0; i < segmentCount; ++i) {
|
479
|
+
segmentList[i].log(lines);
|
480
|
+
}
|
481
|
+
|
482
|
+
return lines.join("\n");
|
483
|
+
};
|
484
|
+
/** @public
|
485
|
+
* @return {string}
|
486
|
+
*/
|
487
|
+
SegmentCollection.prototype.logRowIdMap = function() {
|
488
|
+
var lines = [];
|
489
|
+
var childToSegmentId = this._shared.childToSegment;
|
490
|
+
for(var rid in childToSegmentId) {
|
491
|
+
var segmentId = childToSegmentId[rid];
|
492
|
+
lines.push(rid + " > " + segmentId);
|
493
|
+
}
|
494
|
+
|
495
|
+
return lines.join("\n");
|
496
|
+
};
|
497
|
+
|
498
|
+
|
499
|
+
/** @public
|
500
|
+
* @param {string} segmentId
|
501
|
+
* @param {string|Array.<string>} fields
|
502
|
+
* @return {boolean}
|
503
|
+
*/
|
504
|
+
SegmentCollection.prototype.setSegmentClassification = function(segmentId, fields) {
|
505
|
+
var segment = this._segments[segmentId];
|
506
|
+
if(segment) {
|
507
|
+
if(segment.setClassification(fields)) {
|
508
|
+
if(segment.getClassification()) {
|
509
|
+
this._classification = true;
|
510
|
+
}
|
511
|
+
this._classifierChanged = true;
|
512
|
+
|
513
|
+
return true;
|
514
|
+
}
|
515
|
+
}
|
516
|
+
return false;
|
517
|
+
};
|
518
|
+
/** @public
|
519
|
+
* @return {boolean}
|
520
|
+
*/
|
521
|
+
SegmentCollection.prototype.hasClassification = function() {
|
522
|
+
// WARNING: This include the time when classification is removed
|
523
|
+
return this._classification || this._classifierChanged;
|
524
|
+
};
|
525
|
+
/** @public
|
526
|
+
* @param {Object.<string, Object>} rows Object maps between row id and its record
|
527
|
+
* @return {boolean}
|
528
|
+
*/
|
529
|
+
SegmentCollection.prototype.classify = function(rows) {
|
530
|
+
if(!this._segmentCount) {
|
531
|
+
return false;
|
532
|
+
}
|
533
|
+
if(!this.hasClassification()) {
|
534
|
+
return false;
|
535
|
+
}
|
536
|
+
this._classification = this._classifierChanged = false;
|
537
|
+
|
538
|
+
var segmentSeparators = this._segments;
|
539
|
+
for(var rid in segmentSeparators) {
|
540
|
+
var segment = this._segments[rid];
|
541
|
+
if(!segment.isSubSegment()) {
|
542
|
+
if(segment.getClassification()) {
|
543
|
+
this._classification = true;
|
544
|
+
}
|
545
|
+
segment.classify(rows);
|
546
|
+
}
|
547
|
+
}
|
548
|
+
if(this._insertionList.length || this._removalList.length) {
|
549
|
+
this._dispatch("subSegmentChanged", {
|
550
|
+
"insertionList": this._insertionList,
|
551
|
+
"removalList": this._removalList
|
552
|
+
});
|
553
|
+
this._insertionList.length = 0;
|
554
|
+
this._removalList.length = 0;
|
555
|
+
|
556
|
+
this._dispatch("classified", {});
|
557
|
+
return true;
|
558
|
+
}
|
559
|
+
|
560
|
+
this._dispatch("classified", {});
|
561
|
+
return false;
|
562
|
+
};
|
563
|
+
|
564
|
+
/** @private
|
565
|
+
* @param {!Object} e
|
566
|
+
*/
|
567
|
+
SegmentCollection.prototype._onSubSegmentAdded = function(e) {
|
568
|
+
var rid = e["rid"];
|
569
|
+
if(!this._segments[rid]) {
|
570
|
+
var segment = /** @type{Segment} */(e["segment"]);
|
571
|
+
this._insertionList.push(segment);
|
572
|
+
this._segments[rid] = segment;
|
573
|
+
this._segmentCount++;
|
574
|
+
|
575
|
+
segment.addEventListener("subSegmentAdded", this._onSubSegmentAdded);
|
576
|
+
segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
|
577
|
+
} else {
|
578
|
+
console.log("Incorrect logic detected.");
|
579
|
+
}
|
580
|
+
};
|
581
|
+
/** @private
|
582
|
+
* @param {!Object} e
|
583
|
+
*/
|
584
|
+
SegmentCollection.prototype._onSubSegmentRemoved = function(e) {
|
585
|
+
var rid = e["rid"];
|
586
|
+
this.removeSegment(rid);
|
587
|
+
};
|
430
588
|
|
431
589
|
|
432
590
|
export default SegmentCollection;
|
@@ -1 +1,2 @@
|
|
1
|
-
import "./lib/filter-dialog.js";
|
1
|
+
import {FilterDialog} from "./lib/filter-dialog.js";
|
2
|
+
export {FilterDialog}
|
@@ -1 +1,2 @@
|
|
1
|
-
import "./lib/filter-dialog.js";
|
1
|
+
import {FilterDialog} from "./lib/filter-dialog.js";
|
2
|
+
export {FilterDialog}
|
package/lib/grid/index.d.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
import "./lib/efx-grid.js";
|
1
|
+
import {Grid} from "./lib/efx-grid.js";
|
2
|
+
export {Grid}
|
package/lib/grid/index.js
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
import "./lib/efx-grid.js";
|
2
|
-
|
1
|
+
import {Grid} from "./lib/efx-grid.js";
|
2
|
+
export {Grid}
|
3
|
+
window.EFX_GRID = { version: "6.0.15" };
|
@@ -47,6 +47,8 @@ declare class RowSegmentingPlugin extends GridPlugin {
|
|
47
47
|
|
48
48
|
public setSegmentSeparator(rowRef: string|number|null, enabled?: boolean|null): boolean;
|
49
49
|
|
50
|
+
public setSegmentClassification(rowRef: string|number|null, fields: string|(string)[]|null): boolean;
|
51
|
+
|
50
52
|
public unsetAllSegmentSeparators(): boolean;
|
51
53
|
|
52
54
|
public hasSegmentation(): boolean;
|
@@ -424,7 +424,6 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
424
424
|
var arg = {};
|
425
425
|
arg.section = section;
|
426
426
|
arg.colIndex = headerColumn;
|
427
|
-
arg.groupLevel = 1;
|
428
427
|
|
429
428
|
var colCount = section.getColumnCount();
|
430
429
|
for (var c = 0; c < colCount; c++) {
|
@@ -446,12 +445,22 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
446
445
|
arg.rowIndex = r;
|
447
446
|
arg.rowData = this._getRow(dv, r); // Support composite and rt-grid
|
448
447
|
arg.spanning = null;
|
448
|
+
arg.content = null;
|
449
449
|
var rowId = arg.rowId = dv.getRowId(r); // Slow
|
450
|
+
// TODO: Getting segment once for better performance
|
450
451
|
var segmentSeparator = arg.segmentSeparator = dv.isSegmentSeparator(rowId);
|
451
452
|
arg.collapsedSegment = arg.collapsed = segmentSeparator ? dv.isSegmentCollapsed(rowId) : false;
|
452
|
-
var indentLevel = 0;
|
453
453
|
|
454
454
|
if (segmentSeparator) {
|
455
|
+
arg.groupLevel = dv.getSegmentLevel ? dv.getSegmentLevel(rowId) : 1;
|
456
|
+
arg.indentSize = this._getIndentSize(arg.groupLevel - 1, true); // Group level starts from 1
|
457
|
+
if(dv.getSegment) {
|
458
|
+
var segment = dv.getSegment(rowId);
|
459
|
+
if(segment && arg.groupLevel > 1) { // Sub segment always has name
|
460
|
+
arg.content = segment.getSubSegmentName();
|
461
|
+
}
|
462
|
+
}
|
463
|
+
|
455
464
|
var spanning = arg.rowData[this._rowSpanningField];
|
456
465
|
if(spanning != null) {
|
457
466
|
arg.spanning = !!spanning;
|
@@ -460,10 +469,11 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
460
469
|
if (this._predefinedColors) {
|
461
470
|
arg.colorTagClass = arg.rowData[cssField];
|
462
471
|
}
|
463
|
-
arg.indentSize = this._getIndentSize(indentLevel, true);
|
464
472
|
rowPainter.applyHeaderStyle(arg);
|
465
473
|
this._dispatch("segmentSeparatorBinding", arg);
|
466
474
|
} else {
|
475
|
+
arg.groupLevel = 0;
|
476
|
+
var indentLevel = 0;
|
467
477
|
var parentId = this.getSegmentParentRowId(rowId);
|
468
478
|
if(parentId) {
|
469
479
|
indentLevel = 1; // TODO: Provide a way for segmenting multiple levels. Currently, just one level is supported.
|
@@ -553,6 +563,19 @@ RowSegmentingPlugin.prototype.setSegmentSeparator = function(rowRef, enabled) {
|
|
553
563
|
}
|
554
564
|
return false;
|
555
565
|
};
|
566
|
+
/** Set classification for the specified segment
|
567
|
+
* @public
|
568
|
+
* @param {string|number} rowRef Row id or row index
|
569
|
+
* @param {string|Array.<string>} fields
|
570
|
+
* @return {boolean}
|
571
|
+
*/
|
572
|
+
RowSegmentingPlugin.prototype.setSegmentClassification = function(rowRef, fields) {
|
573
|
+
var dv = this._getDataView();
|
574
|
+
if(dv) {
|
575
|
+
return dv.setSegmentClassification(rowRef, fields);
|
576
|
+
}
|
577
|
+
return false;
|
578
|
+
};
|
556
579
|
/** Clear all segment separator rows
|
557
580
|
* @public
|
558
581
|
* @return {boolean} Return true if there is any change
|