@refinitiv-ui/efx-grid 6.0.12 → 6.0.14

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.
Files changed (42) hide show
  1. package/lib/core/dist/core.js +1209 -160
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataCache.js +1 -1
  4. package/lib/core/es6/data/DataTable.d.ts +18 -3
  5. package/lib/core/es6/data/DataTable.js +203 -17
  6. package/lib/core/es6/data/DataView.d.ts +8 -1
  7. package/lib/core/es6/data/DataView.js +30 -2
  8. package/lib/core/es6/data/Segment.d.ts +36 -11
  9. package/lib/core/es6/data/Segment.js +575 -59
  10. package/lib/core/es6/data/SegmentCollection.d.ts +15 -1
  11. package/lib/core/es6/data/SegmentCollection.js +236 -80
  12. package/lib/core/es6/grid/Core.js +1 -1
  13. package/lib/grid/index.js +1 -1
  14. package/lib/grid/lib/efx-grid.js +1 -1
  15. package/lib/row-segmenting/es6/RowSegmenting.d.ts +2 -0
  16. package/lib/row-segmenting/es6/RowSegmenting.js +26 -3
  17. package/lib/rt-grid/dist/rt-grid.js +1144 -158
  18. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  19. package/lib/rt-grid/es6/ColumnDefinition.d.ts +6 -1
  20. package/lib/rt-grid/es6/ColumnDefinition.js +29 -0
  21. package/lib/rt-grid/es6/Grid.d.ts +2 -0
  22. package/lib/rt-grid/es6/Grid.js +53 -0
  23. package/lib/rt-grid/es6/RowDefinition.js +22 -2
  24. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  25. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +194 -366
  26. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +24 -4
  27. package/lib/tr-grid-column-stack/es6/ColumnStack.js +177 -52
  28. package/lib/tr-grid-util/es6/RowPainter.d.ts +2 -1
  29. package/lib/tr-grid-util/es6/RowPainter.js +7 -1
  30. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -0
  31. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +191 -52
  32. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  33. package/lib/types/es6/ColumnStack.d.ts +24 -4
  34. package/lib/types/es6/Core/data/DataTable.d.ts +18 -3
  35. package/lib/types/es6/Core/data/DataView.d.ts +8 -1
  36. package/lib/types/es6/Core/data/Segment.d.ts +36 -11
  37. package/lib/types/es6/Core/data/SegmentCollection.d.ts +15 -1
  38. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
  39. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
  40. package/lib/types/es6/RowSegmenting.d.ts +2 -0
  41. package/lib/versions.json +4 -4
  42. package/package.json +1 -1
@@ -1231,7 +1231,7 @@ DataCache.prototype._cloneRowData = function (obj, ric, newSubId) {
1231
1231
 
1232
1232
  /** @protected
1233
1233
  * @ignore
1234
- * @type {!Object.<string, Object.<string, *>>}
1234
+ * @type {!Object.<string, Object>}
1235
1235
  */
1236
1236
  DataCache.prototype._rows;
1237
1237
 
@@ -1,6 +1,7 @@
1
1
  import Ext from "../../../tr-grid-util/es6/Ext.js";
2
2
  import DataCache from "./DataCache.js";
3
3
  import Util from "../grid/util/util.js";
4
+ import Segment from "./Segment.js"; // eslint-disable-line
4
5
  import SegmentCollection from "./SegmentCollection.js";
5
6
 
6
7
  declare namespace DataTable {
@@ -41,7 +42,7 @@ declare class DataTable extends DataCache {
41
42
 
42
43
  public unshiftRow(opt_values?: { [key: string]: any }|null, opt_rid?: string|null|null): string;
43
44
 
44
- public insertRow(rowRef?: string|number|null|null, values?: { [key: string]: any }|null, rid?: string|null|null): string;
45
+ public insertRow(rowRef?: (string|number|null)|null, values?: { [key: string]: any }|null, rid?: string|null|null): string;
45
46
 
46
47
  public insertAfter(rowRef: string|number|null, opt_values?: any, opt_rid?: string|null): string;
47
48
 
@@ -83,6 +84,10 @@ declare class DataTable extends DataCache {
83
84
 
84
85
  public isSegmentSeparator(rid: string): boolean;
85
86
 
87
+ public getSegment(rid: string): Segment|null;
88
+
89
+ public getSegmentLevel(rid: string): number;
90
+
86
91
  public getSegmentParentRowId(rid: string): string;
87
92
 
88
93
  public getSegmentValues(rids?: (string)[]|null): (number)[]|null;
@@ -91,7 +96,7 @@ declare class DataTable extends DataCache {
91
96
 
92
97
  public fillSegments(): boolean;
93
98
 
94
- public addSegmentChild(segmentId: string, rid: string): boolean;
99
+ public addSegmentChild(segmentId: string, rid: string, dataId?: string|null): boolean;
95
100
 
96
101
  public addSegmentChildren(segmentId: string, rids: (string)[]|null): boolean;
97
102
 
@@ -105,7 +110,15 @@ declare class DataTable extends DataCache {
105
110
 
106
111
  public getSegmentChildIds(segmentId: string): (string)[]|null;
107
112
 
108
- public sortSegments(compare: ((...params: any[]) => any)|null): void;
113
+ public sortSegments(compare: ((...params: any[]) => any)|null): boolean;
114
+
115
+ public setClassificationSource(dc: DataCache|null): void;
116
+
117
+ public setSegmentClassification(segmentId: string, fields: string|(string)[]|null): boolean;
118
+
119
+ public classifySegments(): boolean;
120
+
121
+ public requestClassifying(): void;
109
122
 
110
123
  public dispatchGlobalChange(suppressEvent?: boolean|null): void;
111
124
 
@@ -119,6 +132,8 @@ declare function prevFrozen(ary: (any)[][], opt_cidList?: (string)[]|null, opt_r
119
132
 
120
133
  declare function cid(): null;
121
134
 
135
+ declare function removalList(sortingDefs: (any[])[]|null): boolean;
136
+
122
137
  declare function logic(a: number, b: number, order: number, sortingDefs: (any[])[]|null): number;
123
138
 
124
139
  export default DataTable;
@@ -1,6 +1,7 @@
1
1
  import Ext from "../../../tr-grid-util/es6/Ext.js";
2
2
  import DataCache from "./DataCache.js";
3
3
  import Util from "../grid/util/util.js";
4
+ import Segment from "./Segment.js"; // eslint-disable-line
4
5
  import SegmentCollection from "./SegmentCollection.js";
5
6
 
6
7
  /** Trigger when data within the table has been changed
@@ -23,11 +24,15 @@ var DataTable = function() {
23
24
 
24
25
  this._removeRows = this._removeRows.bind(this);
25
26
  this._bySegmentSeparator = this._bySegmentSeparator.bind(this);
27
+ this._onClassifyingTimer = this._onClassifyingTimer.bind(this);
28
+ this._onSubSegmentChanged = this._onSubSegmentChanged.bind(this);
26
29
 
27
30
  this._prevData = {};
28
31
  this._rids = [];
29
32
 
30
33
  this._compMap = {};
34
+
35
+ this._addEvent("subSegmentChanged");
31
36
  };
32
37
  Ext.inherits(DataTable, DataCache);
33
38
 
@@ -70,6 +75,14 @@ DataTable.prototype._removedRows = null;
70
75
  * @type {Function}
71
76
  */
72
77
  DataTable.prototype._userSegmentComparer = null;
78
+ /** @private
79
+ * @type {Object.<string, Object>}
80
+ */
81
+ DataTable.prototype._clsSource = null;
82
+ /** @private
83
+ * @type {number}
84
+ */
85
+ DataTable.prototype._classifyingTimer = 0;
73
86
 
74
87
 
75
88
  /** @typedef {Function} DataTable~SortLogic
@@ -98,8 +111,17 @@ DataTable.prototype.dispose = function() {
98
111
  this.unlistenAll();
99
112
  this.clearAllData(true);
100
113
 
114
+ if(this._classifyingTimer) {
115
+ clearTimeout(this._onClassifyingTimer);
116
+ this._classifyingTimer = 0;
117
+ }
118
+
101
119
  this._compMap = null; // Release user function that may be bound
102
- this._segments = null;
120
+ this._clsSource = null;
121
+ if(this._segments) {
122
+ this._segments.dispose();
123
+ this._segments = null;
124
+ }
103
125
  };
104
126
 
105
127
  /** {@link DataCache#getColumnData}
@@ -217,7 +239,7 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
217
239
  this._prevData[rid] = {};
218
240
  if(eventArg) {
219
241
  var nextRid = /** @type{string} */(eventArg["nextRid"]); // Used for insertion only
220
- var rowIndex = (nextRid != null) ? this.getRowIndex(nextRid) : -1;
242
+ var rowIndex = (nextRid) ? this.getRowIndex(nextRid) : -1;
221
243
  if(rowIndex < 0) {
222
244
  rowIndex = /** @type{number} */(eventArg["fallback"]);
223
245
  }
@@ -249,6 +271,7 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
249
271
  var segment = this._segments.getSegment(rid);
250
272
  if(segment) {
251
273
  if(this._segments.removeSegment(rid)) {
274
+ // TODO: Handle sub segment removal
252
275
  segmentChanged = true;
253
276
  if(!this._segments.getSegmentCount()) {
254
277
  this._segments = null;
@@ -256,12 +279,7 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
256
279
  }
257
280
  }
258
281
  }
259
- for(var i = this._rids.length; --i >= 0;) {
260
- if(this._rids[i] === rid) {
261
- this._rids.splice(i, 1);
262
- break;
263
- }
264
- }
282
+ DataTable._removeArrayItem(this._rids, rid);
265
283
  dirty = true;
266
284
  }
267
285
  }
@@ -280,7 +298,7 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
280
298
  }
281
299
  this._dispatchDataChange(e);
282
300
  }
283
-
301
+ this.requestClassifying(); // TODO: Check if needFiring method should have an effect on this request
284
302
  }
285
303
  return dirty;
286
304
  };
@@ -483,7 +501,7 @@ DataTable.prototype.unshiftRow = function(opt_values, opt_rid) {
483
501
  return this.insertRow(0, opt_values, opt_rid);
484
502
  };
485
503
  /** @public
486
- * @param {string|number|null=} rowRef
504
+ * @param {(string|number|null)=} rowRef
487
505
  * @param {Object.<string, *>=} values Key/value pair object map
488
506
  * @param {string|null=} rid If the given row Id already exists, data is updated and no new row is added. Leave blank or null to let DataTable generate unique row Id
489
507
  * @return {string} Return Row id that has been inserted or changed
@@ -492,11 +510,13 @@ DataTable.prototype.unshiftRow = function(opt_values, opt_rid) {
492
510
  * @see {@link DataTable#removeRow}
493
511
  */
494
512
  DataTable.prototype.insertRow = function(rowRef, values, rid) {
495
- var arg = {};
513
+ var arg = null;
496
514
  if(typeof rowRef === "number") {
515
+ arg = {};
497
516
  arg["nextRid"] = this._rids[rowRef];
498
517
  arg["fallback"] = rowRef; // Fallback index in case of no nextRid found
499
- } else {
518
+ } else if(rowRef) {
519
+ arg = {};
500
520
  arg["nextRid"] = /** @type{string} */(rowRef);
501
521
  }
502
522
 
@@ -581,12 +601,34 @@ DataTable.prototype.removeRows = function(refs) {
581
601
  DataTable.prototype._removeRows = function(rid) {
582
602
  return !this._removedRows[rid];
583
603
  };
604
+
605
+ /** @private
606
+ * @param {Array} ary
607
+ * @param {*} item
608
+ * @return {boolean}
609
+ */
610
+ DataTable._removeArrayItem = function(ary, item) {
611
+ var at = ary.indexOf(item);
612
+ if(at >= 0) {
613
+ if(at >= ary.length) {
614
+ ary.pop(); // Array.pop is 100 times faster than Array.splice
615
+ } else {
616
+ ary.splice(at, 1);
617
+ }
618
+ return true;
619
+ }
620
+ return false;
621
+ };
584
622
  /** Remove all existing rows
585
623
  * @override
586
624
  */
587
625
  DataTable.prototype.clearAllData = function(suppressEvent) {
588
626
  DataTable.base(this, "clearAllData", true);
589
627
  this._prevData = {};
628
+ // TODO: Clear all segments
629
+ if(this._segments) {
630
+ this._segments.removeAllSegmentChildren(); // This immediately remove all sub segments
631
+ }
590
632
 
591
633
  if(this._rids.length) {
592
634
  this._rids.length = 0;
@@ -893,6 +935,7 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
893
935
  if(enabled !== false) {
894
936
  if(!this._segments) {
895
937
  this._segments = new SegmentCollection();
938
+ this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
896
939
  }
897
940
  if(this._autoSegmentFilling) {
898
941
  var parentId = this._segments.getParentRowId(rid);
@@ -965,6 +1008,29 @@ DataTable.prototype.isSegmentSeparator = function(rid) {
965
1008
  }
966
1009
  return false;
967
1010
  };
1011
+ /** Get Segment object
1012
+ * @public
1013
+ * @param {string} rid Row id
1014
+ * @return {Segment} Return 0 if the given rid is not a segment
1015
+ */
1016
+ DataTable.prototype.getSegment = function(rid) {
1017
+ if(this._segments) {
1018
+ return this._segments.getSegment(rid);
1019
+ }
1020
+ return null;
1021
+ };
1022
+ /** Segment level starts from 1
1023
+ * @public
1024
+ * @param {string} rid
1025
+ * @return {number} Return 0 if the given rid is not a segment
1026
+ */
1027
+ DataTable.prototype.getSegmentLevel = function(rid) {
1028
+ var segment = this.getSegment(rid);
1029
+ if(segment) {
1030
+ return segment.getSegmentLevel() + 1;
1031
+ }
1032
+ return 0;
1033
+ };
968
1034
  /**
969
1035
  * @public
970
1036
  * @param {string} rid
@@ -1038,6 +1104,7 @@ DataTable.prototype.fillSegment = function(segmentId) {
1038
1104
  if(this._segments) {
1039
1105
  this._segments.fillSegment(segmentId, this._rids);
1040
1106
  this.dispatchGlobalChange();
1107
+ this.requestClassifying();
1041
1108
  }
1042
1109
  };
1043
1110
  /** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
@@ -1049,6 +1116,7 @@ DataTable.prototype.fillSegments = function() {
1049
1116
  var dirty = this._segments.fillSegments(this._rids);
1050
1117
  if(dirty) {
1051
1118
  this.dispatchGlobalChange();
1119
+ this.requestClassifying();
1052
1120
  }
1053
1121
  return dirty;
1054
1122
  }
@@ -1057,15 +1125,17 @@ DataTable.prototype.fillSegments = function() {
1057
1125
  /** @public
1058
1126
  * @param {string} segmentId Row id
1059
1127
  * @param {string} rid Row id
1128
+ * @param {string=} dataId Row id for retrieving data
1060
1129
  * @return {boolean} Return true if there is any change
1061
1130
  */
1062
- DataTable.prototype.addSegmentChild = function(segmentId, rid) {
1131
+ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
1063
1132
  if(this._segments) {
1064
- var dirty = this._segments.addSegmentChild(segmentId, rid);
1133
+ var dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
1065
1134
  if(dirty) {
1066
1135
  if(this._sort(null)) {
1067
1136
  this._dispatchPositionChange();
1068
1137
  }
1138
+ this.requestClassifying();
1069
1139
  return true;
1070
1140
  }
1071
1141
  }
@@ -1083,6 +1153,7 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
1083
1153
  if(this._sort(null)) {
1084
1154
  this._dispatchPositionChange();
1085
1155
  }
1156
+ this.requestClassifying();
1086
1157
  return true;
1087
1158
  }
1088
1159
  }
@@ -1098,6 +1169,7 @@ DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
1098
1169
  var dirty = this._segments.removeSegmentChild(segmentId, rid);
1099
1170
  if(dirty) {
1100
1171
  this.dispatchGlobalChange();
1172
+ this.requestClassifying();
1101
1173
  }
1102
1174
  return dirty;
1103
1175
  }
@@ -1113,6 +1185,7 @@ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
1113
1185
  var dirty = this._segments.removeSegmentChildren(segmentId, rids);
1114
1186
  if(dirty) {
1115
1187
  this.dispatchGlobalChange();
1188
+ this.requestClassifying();
1116
1189
  }
1117
1190
  return dirty;
1118
1191
  }
@@ -1123,7 +1196,7 @@ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
1123
1196
  */
1124
1197
  DataTable.prototype.removeAllSegmentChildren = function() {
1125
1198
  if(this._segments) {
1126
- var dirty = this._segments.removeAllSegmentChildren();
1199
+ var dirty = this._segments.removeAllSegmentChildren(); // This immediately remove all sub segments
1127
1200
  if (dirty) {
1128
1201
  this.dispatchGlobalChange();
1129
1202
  }
@@ -1159,10 +1232,15 @@ DataTable.prototype.getSegmentChildIds = function(segmentId) {
1159
1232
  /** Sort all of existing segments by given compare function
1160
1233
  * @public
1161
1234
  * @param {Function} compare
1235
+ * @return {boolean}
1162
1236
  */
1163
1237
  DataTable.prototype.sortSegments = function (compare) {
1164
- if(!this._segments || typeof compare !== "function") {
1165
- return;
1238
+ if(!this._segments) {
1239
+ return false;
1240
+ }
1241
+ if(typeof compare !== "function") {
1242
+ this._segments.calcSegmentOrder(this._rids);
1243
+ return false;
1166
1244
  }
1167
1245
  var rids = this._rids;
1168
1246
  var segments = this._segments;
@@ -1206,7 +1284,9 @@ DataTable.prototype.sortSegments = function (compare) {
1206
1284
  this._segments.calcSegmentOrder(rids);
1207
1285
  this._sort(null);
1208
1286
  this._dispatchPositionChange();
1287
+ return true;
1209
1288
  }
1289
+ return false;
1210
1290
  };
1211
1291
  /** Sort all of existing segments by given compare function
1212
1292
  * @private
@@ -1221,6 +1301,112 @@ DataTable.prototype._bySegmentSeparator = function (segmentA, segmentB) {
1221
1301
  ));
1222
1302
  };
1223
1303
 
1304
+ /** A data source to be used with segment classification
1305
+ * @public
1306
+ * @param {DataCache} dc
1307
+ */
1308
+ DataTable.prototype.setClassificationSource = function(dc) {
1309
+ this._clsSource = null;
1310
+
1311
+ if(dc && dc._rows) {
1312
+ this._clsSource = dc._rows;
1313
+ }
1314
+ };
1315
+ /**
1316
+ * @public
1317
+ * @param {string} segmentId
1318
+ * @param {string|Array.<string>} fields
1319
+ * @return {boolean}
1320
+ */
1321
+ DataTable.prototype.setSegmentClassification = function(segmentId, fields) {
1322
+ if(this._segments) {
1323
+ var dirty = this._segments.setSegmentClassification(segmentId, fields);
1324
+ if(dirty) {
1325
+ return this.classifySegments();
1326
+ }
1327
+ }
1328
+ return false;
1329
+ };
1330
+ /** @public
1331
+ * @return {boolean}
1332
+ */
1333
+ DataTable.prototype.classifySegments = function() {
1334
+ if(this._segments) {
1335
+ if(this._rids.length) {
1336
+ return this._segments.classify(this._clsSource || this._rows);
1337
+ }
1338
+ }
1339
+ return false;
1340
+ };
1341
+
1342
+ /** @public
1343
+ */
1344
+ DataTable.prototype.requestClassifying = function() {
1345
+ if(this._segments && !this._classifyingTimer) {
1346
+ if(this._segments.hasClassification()) {
1347
+ this._classifyingTimer = setTimeout(this._onClassifyingTimer, 10);
1348
+ }
1349
+ }
1350
+ };
1351
+ /** @private
1352
+ */
1353
+ DataTable.prototype._onClassifyingTimer = function() {
1354
+ this._classifyingTimer = 0;
1355
+ this.classifySegments();
1356
+ };
1357
+ /** @private
1358
+ * @param {Object} e
1359
+ */
1360
+ DataTable.prototype._onSubSegmentChanged = function(e) {
1361
+ var insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
1362
+ var removalList = /** @type{Array.<string>} */(e["removalList"]);
1363
+
1364
+ var dirty = false;
1365
+ var rows = this._rows;
1366
+ var clsSource = this._clsSource || rows;
1367
+ var rids = this._rids;
1368
+ var prevData = this._prevData;
1369
+ var i;
1370
+
1371
+ var removalCount = removalList.length;
1372
+ var removedRows = {};
1373
+ for(i = 0; i < removalCount; i++) {
1374
+ var rid = removalList[i];
1375
+ if(rows[rid]) {
1376
+ removedRows[rid] = prevData[rid] = rows[rid];
1377
+ delete rows[rid];
1378
+ DataTable._removeArrayItem(rids, rid);
1379
+ dirty = true;
1380
+ // TODO: Remove classification source
1381
+ }
1382
+ }
1383
+
1384
+ var insertionCount = insertionList.length;
1385
+ for(i = 0; i < insertionCount; i++) {
1386
+ var segment = insertionList[i];
1387
+ var parentId = segment.getParentId();
1388
+ var segmentId = segment.getId();
1389
+
1390
+ if(!rows[segmentId]) {
1391
+ prevData[segmentId] = {};
1392
+ segment.setRowData(rows, clsSource);
1393
+
1394
+ var parentAt = rids.indexOf(parentId);
1395
+ if(parentAt < 0 || parentAt + 1 >= rids.length) {
1396
+ rids.push(segmentId);
1397
+ } else {
1398
+ rids.splice(parentAt + 1, 0, segmentId);
1399
+ }
1400
+ dirty = true;
1401
+ }
1402
+ }
1403
+ if(dirty) {
1404
+ e["removedRows"] = removedRows;
1405
+ this._dispatch("subSegmentChanged", e);
1406
+ this.dispatchGlobalChange(); // Rerender everything
1407
+ }
1408
+ };
1409
+
1224
1410
 
1225
1411
  /**
1226
1412
  * @public
@@ -3,6 +3,7 @@ import DataCache from "./DataCache.js";
3
3
  import DataTable from "./DataTable.js";
4
4
  import WrappedView from "./WrappedView.js"; // eslint-disable-line
5
5
  import ColumnStats from "./ColumnStats.js";
6
+ import Segment from "./Segment.js"; // eslint-disable-line
6
7
  import EventDispatcher from "../grid/event/EventDispatcher.js";
7
8
  import Util from "../grid/util/util.js";
8
9
  import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
@@ -233,6 +234,10 @@ declare class DataView extends EventDispatcher {
233
234
 
234
235
  public isSegmentSeparator(rid: string): boolean;
235
236
 
237
+ public getSegment(rid: string): Segment|null;
238
+
239
+ public getSegmentLevel(rid: string): number;
240
+
236
241
  public getSegmentParentRowId(rid: string): string;
237
242
 
238
243
  public collapseSegment(rowRef: string|number|null, collapsed?: boolean|null): boolean;
@@ -247,7 +252,7 @@ declare class DataView extends EventDispatcher {
247
252
 
248
253
  public fillSegments(): void;
249
254
 
250
- public addSegmentChild(segmentRef: string|number|null, rowRef: string|number|null): boolean;
255
+ public addSegmentChild(segmentRef: string|number|null, rowRef: string|number|null, dataId?: string|null): boolean;
251
256
 
252
257
  public addSegmentChildren(segmentRef: string|number|null, rowRefs: (string|number)[]|null): boolean;
253
258
 
@@ -263,6 +268,8 @@ declare class DataView extends EventDispatcher {
263
268
 
264
269
  public sortSegments(compare: ((...params: any[]) => any)|null): void;
265
270
 
271
+ public setSegmentClassification(segmentRef: string|number|null, fields: string|(string)[]|null): boolean;
272
+
266
273
  public getWrapSize(): number;
267
274
 
268
275
  public getWrappedViews(): (WrappedView)[]|null;
@@ -3,6 +3,7 @@ import DataCache from "./DataCache.js";
3
3
  import DataTable from "./DataTable.js";
4
4
  import WrappedView from "./WrappedView.js"; // eslint-disable-line
5
5
  import ColumnStats from "./ColumnStats.js";
6
+ import Segment from "./Segment.js"; // eslint-disable-line
6
7
  import EventDispatcher from "../grid/event/EventDispatcher.js";
7
8
  import Util from "../grid/util/util.js";
8
9
  import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
@@ -2347,6 +2348,22 @@ DataView.prototype.isSegmentSeparator = function(rid) {
2347
2348
  return this._dt.isSegmentSeparator(rid);
2348
2349
  };
2349
2350
 
2351
+ /** Get Segment object
2352
+ * @public
2353
+ * @param {string} rid Row id
2354
+ * @return {Segment} Return 0 if the given rid is not a segment
2355
+ */
2356
+ DataView.prototype.getSegment = function(rid) {
2357
+ return this._dt.getSegment(rid);
2358
+ };
2359
+ /** Segment level starts from 1
2360
+ * @public
2361
+ * @param {string} rid Row id
2362
+ * @return {number} Return 0 if the given rid is not a segment
2363
+ */
2364
+ DataView.prototype.getSegmentLevel = function(rid) {
2365
+ return this._dt.getSegmentLevel(rid);
2366
+ };
2350
2367
  /**
2351
2368
  * @public
2352
2369
  * @param {string} rid
@@ -2428,13 +2445,14 @@ DataView.prototype.fillSegments = function() {
2428
2445
  /** @public
2429
2446
  * @param {string|number} segmentRef Row id or row index
2430
2447
  * @param {string|number} rowRef Row id, row index
2448
+ * @param {string=} dataId Row id for retrieving data
2431
2449
  * @return {boolean} Return true if there is any change
2432
2450
  */
2433
- DataView.prototype.addSegmentChild = function(segmentRef, rowRef) {
2451
+ DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
2434
2452
  if(this._dt._getSegmentSeparators()) {
2435
2453
  var segmentId = this._toRowId(segmentRef);
2436
2454
  var rowId = this._toRowId(rowRef);
2437
- return this._dt.addSegmentChild(segmentId, rowId);
2455
+ return this._dt.addSegmentChild(segmentId, rowId, dataId);
2438
2456
  }
2439
2457
  return false;
2440
2458
  };
@@ -2506,6 +2524,16 @@ DataView.prototype.sortSegments = function (compare) {
2506
2524
  this._dt.sortSegments(compare);
2507
2525
  };
2508
2526
 
2527
+ /**
2528
+ * @public
2529
+ * @param {string|number} segmentRef Row id or row index
2530
+ * @param {string|Array.<string>} fields
2531
+ * @return {boolean}
2532
+ */
2533
+ DataView.prototype.setSegmentClassification = function(segmentRef, fields) {
2534
+ return this._dt.setSegmentClassification(this._toRowId(segmentRef), fields);
2535
+ };
2536
+
2509
2537
  /** @public
2510
2538
  * @ignore
2511
2539
  * @return {Object}
@@ -1,20 +1,27 @@
1
-
1
+ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
+ import EventDispatcher from "../../../tr-grid-util/es6/EventDispatcher.js";
2
3
 
3
4
  declare class Segment {
4
5
 
5
- constructor(rid: string);
6
+ constructor(rid: string, sharedObj: any);
7
+
8
+ public dispose(): void;
6
9
 
7
10
  public getId(): string;
8
11
 
9
- public addChild(rid: string, objMap?: any): boolean;
12
+ public getParentId(): string;
13
+
14
+ public getSubSegmentIds(out_ary?: (string)[]|null): (string)[]|null;
10
15
 
11
- public addChildren(rids: (string)[]|null, objMap?: any): boolean;
16
+ public addChild(rid: string, dataId?: string|null): boolean;
17
+
18
+ public addChildren(rids: (string)[]|null): boolean;
12
19
 
13
20
  public containsChild(rid: string): boolean;
14
21
 
15
- public removeChild(rid: string, objMap?: any): boolean;
22
+ public removeChild(rid: string): boolean;
16
23
 
17
- public removeChildren(rids: (string)[]|null, objMap?: any): boolean;
24
+ public removeChildren(rids: (string)[]|null): boolean;
18
25
 
19
26
  public removeAllChildren(objMap?: any): boolean;
20
27
 
@@ -22,22 +29,40 @@ declare class Segment {
22
29
 
23
30
  public getChildCount(): number;
24
31
 
32
+ public getClassification(): (string)[]|null;
33
+
34
+ public setClassification(fields: string|(string)[]|null): boolean;
35
+
36
+ public classify(rows?: { [key: string]: any }|null): boolean;
37
+
38
+ public hasSubSegments(): boolean;
39
+
40
+ public isSubSegment(): boolean;
41
+
42
+ public getFirstAncestor(): Segment|null;
43
+
44
+ public getAllSubSegments(out_ary?: (Segment)[]|null): (Segment)[]|null;
45
+
46
+ public getSegmentLevel(): number;
47
+
48
+ public setRowData(rows?: any, clsSource?: any): void;
49
+
50
+ public getSubSegmentName(row?: any): string;
51
+
25
52
  public collapse(bool?: boolean|null): boolean;
26
53
 
27
54
  public expand(bool?: boolean|null): boolean;
28
55
 
29
56
  public isCollapsed(): boolean;
30
57
 
31
- public getCollapsingStates(objMap?: any): any;
32
-
33
- public getValue(): number;
34
-
35
- public setValue(val: number): void;
58
+ public getCollapsingStates(objMap?: any, parentState?: boolean|null): number;
36
59
 
37
60
  public getOrder(): number;
38
61
 
39
62
  public setOrder(val: number): void;
40
63
 
64
+ public log(lines: (string)[]|null): (string)[]|null;
65
+
41
66
  }
42
67
 
43
68
  export default Segment;