@refinitiv-ui/efx-grid 6.0.138 → 6.0.139
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +0 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +117 -123
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -1
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +51 -5
- package/lib/versions.json +2 -2
- package/package.json +1 -1
package/lib/grid/index.js
CHANGED
@@ -49,8 +49,6 @@ declare class RowSegmentingPlugin extends GridPlugin {
|
|
49
49
|
|
50
50
|
public getSegmentParentRowId(rowRef: string|number|null): string;
|
51
51
|
|
52
|
-
public _resolveDisplayColumn(): number;
|
53
|
-
|
54
52
|
public setSegmentSeparators(rowIds: (string)[]|null, enabled?: boolean|null): boolean;
|
55
53
|
|
56
54
|
public setSegmentSeparator(rowRef: string|number|null, enabled?: boolean|null): boolean;
|
@@ -17,8 +17,8 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
17
17
|
* @property {Function=} segmentSeparatorBinding=null Logic that will be executed on each segment separator row
|
18
18
|
* @property {Function=} nonSegmentSeparatorBinding=null Logic that will be executed for all non segment separator row
|
19
19
|
* @property {Function=} sortingLogic=null Logic to be used by sortSegments method
|
20
|
-
* @property {string=} rowSpanningField="ROW_SPANNING"
|
21
|
-
* @property {string=} segmentIdField="
|
20
|
+
* @property {string=} rowSpanningField="ROW_SPANNING" Field to be used for spanning segment header rows based on the field values
|
21
|
+
* @property {string=} segmentIdField="" Field to be used for initializing segments based on text id
|
22
22
|
* @property {(string|number)=} displayColumn=null Render tags in the given column. It can be either the column index, column ID, or field.
|
23
23
|
*/
|
24
24
|
|
@@ -33,15 +33,15 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
33
33
|
* @param {RowSegmentingPlugin~Options=} options
|
34
34
|
* @extends {GridPlugin}
|
35
35
|
*/
|
36
|
-
|
37
|
-
|
36
|
+
let RowSegmentingPlugin = function (options) {
|
37
|
+
let t = this;
|
38
38
|
t._onPreSectionDataBinding = t._onPreSectionDataBinding.bind(t);
|
39
39
|
t._updateHeader = t._updateHeader.bind(t);
|
40
40
|
t._onArrowClick = t._onArrowClick.bind(t);
|
41
41
|
t._onColumnIndexChanged = t._onColumnIndexChanged.bind(t);
|
42
42
|
t._rtSortingLogic = t._rtSortingLogic.bind(t);
|
43
|
-
t.
|
44
|
-
t._separatorRefreshConflator = new Conflator(10, t.
|
43
|
+
t.requestSeparatorRefresh = t.requestSeparatorRefresh.bind(t);
|
44
|
+
t._separatorRefreshConflator = new Conflator(10, t.requestSeparatorRefresh);
|
45
45
|
t._columnIndexChangedConflator = new Conflator(10, t._onColumnIndexChanged);
|
46
46
|
|
47
47
|
t._hosts = [];
|
@@ -92,7 +92,7 @@ RowSegmentingPlugin.prototype._rowSpanningField = "ROW_SPANNING";
|
|
92
92
|
/** @type {string}
|
93
93
|
* @private
|
94
94
|
*/
|
95
|
-
RowSegmentingPlugin.prototype._segmentIdField = "
|
95
|
+
RowSegmentingPlugin.prototype._segmentIdField = "";
|
96
96
|
/** @type {number}
|
97
97
|
* @private
|
98
98
|
*/
|
@@ -155,7 +155,7 @@ RowSegmentingPlugin.prototype.initialize = function (host, options) {
|
|
155
155
|
|
156
156
|
this.config(options);
|
157
157
|
|
158
|
-
|
158
|
+
let enabled = this._colorTag != null ? this._colorTag : ElfUtil.isHaloTheme();
|
159
159
|
RowPainter.disableColorTag(host, enabled === false);
|
160
160
|
|
161
161
|
if (this._predefinedColors != null) {
|
@@ -170,35 +170,32 @@ RowSegmentingPlugin.prototype.initialize = function (host, options) {
|
|
170
170
|
RowPainter.enableHeaderMenu(host, enabled ? true : false);
|
171
171
|
};
|
172
172
|
|
173
|
-
/**
|
173
|
+
/** Request for updating the segment separators based on values from segment Id field in row data
|
174
174
|
* @public
|
175
175
|
*/
|
176
176
|
RowSegmentingPlugin.prototype.requestSeparatorRefresh = function () {
|
177
|
+
if(!this._segmentIdField) {
|
178
|
+
return;
|
179
|
+
}
|
177
180
|
if(this._separatorRefreshConflator.conflate()) {
|
178
181
|
return;
|
179
182
|
}
|
180
|
-
this._refreshSegmentSeparator();
|
181
|
-
};
|
182
183
|
|
183
|
-
|
184
|
-
* @private
|
185
|
-
*/
|
186
|
-
RowSegmentingPlugin.prototype._refreshSegmentSeparator = function () {
|
187
|
-
var dv = this._getDataView();
|
184
|
+
let dv = this._getDataView();
|
188
185
|
if (!dv) { return; }
|
189
186
|
|
190
|
-
|
187
|
+
let collapsingMap = {};
|
191
188
|
if (this._collapsingMap) {
|
192
189
|
collapsingMap = this._collapsingMap;
|
193
190
|
this._collapsingMap = null;
|
194
191
|
}
|
195
192
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
193
|
+
let rowId, rowData, segmentId;
|
194
|
+
let dt = dv.getDataSource();
|
195
|
+
let segmentRowIds = this.getSegmentIds() || [];
|
196
|
+
let segmentCount = segmentRowIds.length;
|
200
197
|
if (segmentCount){
|
201
|
-
for(
|
198
|
+
for(let s = 0; s < segmentCount; s++) {
|
202
199
|
rowId = segmentRowIds[s];
|
203
200
|
rowData = this._rowGetter(dt.getRowData(rowId));
|
204
201
|
segmentId = rowData[this._segmentIdField];
|
@@ -217,13 +214,13 @@ RowSegmentingPlugin.prototype._refreshSegmentSeparator = function () {
|
|
217
214
|
// because their children has no segment-id.
|
218
215
|
}
|
219
216
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
for(
|
217
|
+
let rowIds = dt.getAllRowIds();
|
218
|
+
let rowCount = rowIds.length;
|
219
|
+
let separatorMap = {};
|
220
|
+
let segmentArr = [];
|
221
|
+
let separatorArr = [];
|
222
|
+
let collapseArr = [];
|
223
|
+
for(let i = 0; i < rowCount; i++) {
|
227
224
|
rowId = rowIds[i];
|
228
225
|
rowData = this._rowGetter(dt.getRowData(rowId));
|
229
226
|
segmentId = rowData[this._segmentIdField];
|
@@ -254,7 +251,7 @@ RowSegmentingPlugin.prototype._refreshSegmentSeparator = function () {
|
|
254
251
|
* @param {Object=} host core grid instance
|
255
252
|
*/
|
256
253
|
RowSegmentingPlugin.prototype.unload = function (host) {
|
257
|
-
|
254
|
+
let at = this._hosts.indexOf(host);
|
258
255
|
if (at < 0) {
|
259
256
|
return;
|
260
257
|
}
|
@@ -276,7 +273,7 @@ RowSegmentingPlugin.prototype.unload = function (host) {
|
|
276
273
|
RowSegmentingPlugin.prototype.config = function (options) {
|
277
274
|
if (!options) { return; }
|
278
275
|
|
279
|
-
|
276
|
+
let option = options.rowSegmenting;
|
280
277
|
if (!option) { return; }
|
281
278
|
|
282
279
|
if (typeof option.sortingLogic === "function") {
|
@@ -321,20 +318,18 @@ RowSegmentingPlugin.prototype.config = function (options) {
|
|
321
318
|
this.addListener(option, "nonSegmentSeparatorBinding");
|
322
319
|
|
323
320
|
// Collect collapsing states from configuration
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
if (
|
334
|
-
|
335
|
-
|
336
|
-
collapsingMap[segmentId] = row["collapsed"] ? true : false;
|
337
|
-
}
|
321
|
+
let collapsingMap = {};
|
322
|
+
let dirty = false;
|
323
|
+
let rows = this._segmentIdField ? options.rows : null; // If there is no segment Id, collapsing states cannot be mapped to the inexistence segments
|
324
|
+
let len = rows ? rows.length : 0;
|
325
|
+
for (let i = 0; i < len; i++) {
|
326
|
+
let row = rows[i];
|
327
|
+
if (row && typeof row === "object") {
|
328
|
+
let segmentId = row.values ? row.values[this._segmentIdField] : null;
|
329
|
+
if (segmentId && collapsingMap[segmentId] == null) {
|
330
|
+
if (row["collapsed"] != null) {
|
331
|
+
dirty = true;
|
332
|
+
collapsingMap[segmentId] = row["collapsed"] ? true : false;
|
338
333
|
}
|
339
334
|
}
|
340
335
|
}
|
@@ -352,9 +347,9 @@ RowSegmentingPlugin.prototype.config = function (options) {
|
|
352
347
|
* @return {!Object}
|
353
348
|
*/
|
354
349
|
RowSegmentingPlugin.prototype.getConfigObject = function (gridOptions) {
|
355
|
-
|
350
|
+
let obj = gridOptions || {};
|
356
351
|
|
357
|
-
|
352
|
+
let extOptions = obj.rowSegmenting;
|
358
353
|
if(!extOptions) {
|
359
354
|
extOptions = obj.rowSegmenting = {};
|
360
355
|
}
|
@@ -373,7 +368,7 @@ RowSegmentingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
373
368
|
if(this._rowSpanningField != "ROW_SPANNING") {
|
374
369
|
extOptions.rowSpanningField = this._rowSpanningField;
|
375
370
|
}
|
376
|
-
if(this._segmentIdField
|
371
|
+
if(this._segmentIdField) {
|
377
372
|
extOptions.segmentIdField = this._segmentIdField;
|
378
373
|
}
|
379
374
|
|
@@ -407,8 +402,7 @@ RowSegmentingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
407
402
|
* @return {!Object} return row config object with update special field data
|
408
403
|
*/
|
409
404
|
RowSegmentingPlugin.prototype.getRowConfigObject = function (rowData, rowId) {
|
410
|
-
|
411
|
-
var obj = rowData || {};
|
405
|
+
let obj = rowData || {};
|
412
406
|
|
413
407
|
if(!this._segmentIdField) {
|
414
408
|
return obj;
|
@@ -430,7 +424,7 @@ RowSegmentingPlugin.prototype.getRowConfigObject = function (rowData, rowId) {
|
|
430
424
|
}
|
431
425
|
obj.values[this._segmentIdField] = ++this._runningId;
|
432
426
|
} else {
|
433
|
-
|
427
|
+
let parentId = this.getSegmentParentRowId(rowId);
|
434
428
|
if(parentId) {
|
435
429
|
if(!obj.values) {
|
436
430
|
obj.values = {};
|
@@ -446,10 +440,10 @@ RowSegmentingPlugin.prototype.getRowConfigObject = function (rowData, rowId) {
|
|
446
440
|
* @param {Object} predefinedColors Predefined color object map
|
447
441
|
*/
|
448
442
|
RowSegmentingPlugin.prototype._injectStyles = function(predefinedColors) {
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
for (
|
443
|
+
let prefix = ".tr-grid." + RowSegmentingPlugin._controlClass + " .tr-lg .cell";
|
444
|
+
let css = [];
|
445
|
+
let value;
|
446
|
+
for (let className in predefinedColors) {
|
453
447
|
css.push(prefix + "." + className + "::before");
|
454
448
|
value = predefinedColors[className]["backgroundColor"];
|
455
449
|
if (value) {
|
@@ -457,7 +451,7 @@ RowSegmentingPlugin.prototype._injectStyles = function(predefinedColors) {
|
|
457
451
|
}
|
458
452
|
}
|
459
453
|
|
460
|
-
|
454
|
+
let host = this._hosts[0];
|
461
455
|
|
462
456
|
if (this._styleTag) {
|
463
457
|
if (this._styleTag.parentNode) {
|
@@ -516,12 +510,12 @@ RowSegmentingPlugin.prototype._clearSectionHeaderStyle = function () {
|
|
516
510
|
|
517
511
|
/** @public */
|
518
512
|
RowSegmentingPlugin.prototype.updateHeaders = function () {
|
519
|
-
|
513
|
+
let host = this._hosts[0];
|
520
514
|
if (!host) {
|
521
515
|
return;
|
522
516
|
}
|
523
|
-
|
524
|
-
for (
|
517
|
+
let settingList = host.getAllSectionSettings("content");
|
518
|
+
for (let i = settingList.length; --i >= 0;) {
|
525
519
|
this._updateHeader(settingList[i]);
|
526
520
|
}
|
527
521
|
};
|
@@ -532,7 +526,7 @@ RowSegmentingPlugin.prototype.updateHeaders = function () {
|
|
532
526
|
*/
|
533
527
|
RowSegmentingPlugin.prototype._hasSegmentation = function (settings) {
|
534
528
|
if (settings && settings.getType() === "content") {
|
535
|
-
|
529
|
+
let dv = settings.getDataSource();
|
536
530
|
if (dv) {
|
537
531
|
if(dv.hasSegmentation()) {
|
538
532
|
dv._previouslyHasSegmentation = true; // Allow one more cycle to clean up styling
|
@@ -551,9 +545,9 @@ RowSegmentingPlugin.prototype._hasSegmentation = function (settings) {
|
|
551
545
|
* @return {string} parent row id of this segmentation. If the parent row id for this segmentation cannot be found, return ""
|
552
546
|
*/
|
553
547
|
RowSegmentingPlugin.prototype.getSegmentParentRowId = function (rowRef) {
|
554
|
-
|
548
|
+
let dv = this._getDataView();
|
555
549
|
if(dv) {
|
556
|
-
|
550
|
+
let rowId = "";
|
557
551
|
if(typeof rowRef === "number") {
|
558
552
|
rowId = dv.getRowId(rowRef); // WARNING: This is very slow
|
559
553
|
} else {
|
@@ -564,7 +558,7 @@ RowSegmentingPlugin.prototype.getSegmentParentRowId = function (rowRef) {
|
|
564
558
|
return "";
|
565
559
|
};
|
566
560
|
|
567
|
-
/** @
|
561
|
+
/** @private
|
568
562
|
* @description Resolve display column from column id to column index
|
569
563
|
* @return {number} return column index of display column
|
570
564
|
*/
|
@@ -600,32 +594,32 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
600
594
|
return;
|
601
595
|
}
|
602
596
|
|
603
|
-
|
597
|
+
let headerColumn = this._resolveDisplayColumn();
|
604
598
|
if(headerColumn < 0) {
|
605
599
|
return;
|
606
600
|
}
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
601
|
+
let dv = settings.getDataSource();
|
602
|
+
let dt = dv.getDataSource();
|
603
|
+
let section = settings.getSection();
|
604
|
+
let fi = (firstRowIndex != null) ? firstRowIndex : section.getFirstIndexInView();
|
605
|
+
let li = (lastRowIndex != null) ? lastRowIndex : section.getLastIndexInView();
|
612
606
|
|
613
|
-
|
607
|
+
let arg = {};
|
614
608
|
arg.section = section;
|
615
609
|
arg.colIndex = headerColumn;
|
616
610
|
|
617
|
-
|
618
|
-
for (
|
611
|
+
let colCount = section.getColumnCount();
|
612
|
+
for (let c = 0; c < colCount; c++) {
|
619
613
|
if(this._getColumnOption(c, "isCheckboxColumn")) {
|
620
614
|
arg.checkboxColumnIndex = c;
|
621
615
|
break;
|
622
616
|
}
|
623
617
|
}
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
for (
|
628
|
-
|
618
|
+
let cssField = this._cssField;
|
619
|
+
let rowPainter = this._rowPainter;
|
620
|
+
let parentRows = {};
|
621
|
+
for (let r = fi; r <= li; r++) {
|
622
|
+
let cell = section.getCell(headerColumn, r, false); // Work only one row
|
629
623
|
if (!cell) { // There may be no header to be updated
|
630
624
|
continue;
|
631
625
|
}
|
@@ -635,22 +629,22 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
635
629
|
arg.rowData = this._getRow(dv, r); // Support composite and rt-grid
|
636
630
|
arg.spanning = null;
|
637
631
|
arg.content = null;
|
638
|
-
|
632
|
+
let rowId = arg.rowId = dv.getRowId(r); // Slow
|
639
633
|
// TODO: Getting segment once for better performance
|
640
|
-
|
634
|
+
let segmentSeparator = arg.segmentSeparator = dv.isSegmentSeparator(rowId);
|
641
635
|
arg.collapsedSegment = arg.collapsed = segmentSeparator ? dv.isSegmentCollapsed(rowId) : false;
|
642
636
|
|
643
637
|
if (segmentSeparator) {
|
644
638
|
arg.groupLevel = dv.getSegmentLevel ? dv.getSegmentLevel(rowId) : 1;
|
645
639
|
arg.indentSize = this._getIndentSize(arg.groupLevel - 1, true); // Group level starts from 1
|
646
640
|
if(dv.getSegment) {
|
647
|
-
|
641
|
+
let segment = dv.getSegment(rowId);
|
648
642
|
if(segment && arg.groupLevel > 1) { // Sub segment always has name
|
649
643
|
arg.content = segment.getSubSegmentName();
|
650
644
|
}
|
651
645
|
}
|
652
646
|
|
653
|
-
|
647
|
+
let spanning = arg.rowData[this._rowSpanningField];
|
654
648
|
if(spanning != null) {
|
655
649
|
arg.spanning = !!spanning;
|
656
650
|
}
|
@@ -662,12 +656,12 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
662
656
|
this._dispatch("segmentSeparatorBinding", arg);
|
663
657
|
} else {
|
664
658
|
arg.groupLevel = 0;
|
665
|
-
|
666
|
-
|
659
|
+
let indentLevel = 0;
|
660
|
+
let parentId = this.getSegmentParentRowId(rowId);
|
667
661
|
if(parentId) {
|
668
662
|
indentLevel = 1; // TODO: Provide a way for segmenting multiple levels. Currently, just one level is supported.
|
669
663
|
arg.nonGroupRow = false;
|
670
|
-
|
664
|
+
let parentRowData = parentRows[parentId];
|
671
665
|
if (!parentRowData) {
|
672
666
|
parentRowData = parentRows[parentId] = this._rowGetter(dt.getRowData(parentId)); // We need to use Datable because parent row may be hidden
|
673
667
|
}
|
@@ -690,11 +684,11 @@ RowSegmentingPlugin.prototype._updateHeader = function (settings, firstRowIndex,
|
|
690
684
|
* @return {number}
|
691
685
|
*/
|
692
686
|
RowSegmentingPlugin.prototype._getIndentSize = function (indentLevel, groupRow) {
|
693
|
-
|
687
|
+
let indentSize = 0;
|
694
688
|
if(this._indentSizes) {
|
695
689
|
indentSize = this._indentSizes[0];
|
696
690
|
if(indentLevel > 0) {
|
697
|
-
|
691
|
+
let indentLimit = this._indentSizes.length;
|
698
692
|
indentSize = indentLevel < indentLimit ? this._indentSizes[indentLevel] : this._indentSizes[indentLimit - 1];
|
699
693
|
}
|
700
694
|
} else if(indentLevel > 0) {
|
@@ -709,15 +703,15 @@ RowSegmentingPlugin.prototype._getIndentSize = function (indentLevel, groupRow)
|
|
709
703
|
* @param {MouseEvent} e
|
710
704
|
*/
|
711
705
|
RowSegmentingPlugin.prototype._onArrowClick = function (e) {
|
712
|
-
|
713
|
-
|
714
|
-
|
706
|
+
let host = this._hosts[0];
|
707
|
+
let info = host.getRelativePosition(e);
|
708
|
+
let cellElem = info.cell ? info.cell.getElement() : null;
|
715
709
|
if(!cellElem) {
|
716
710
|
return;
|
717
711
|
}
|
718
712
|
|
719
|
-
|
720
|
-
|
713
|
+
let rowIndex = info.rowIndex;
|
714
|
+
let collapsedSegment = this.isSegmentCollapsed(rowIndex); // current state
|
721
715
|
collapsedSegment = !collapsedSegment; // Toggle state
|
722
716
|
|
723
717
|
if (collapsedSegment) {
|
@@ -735,7 +729,7 @@ RowSegmentingPlugin.prototype._onArrowClick = function (e) {
|
|
735
729
|
* @return {Object} DataView instance
|
736
730
|
*/
|
737
731
|
RowSegmentingPlugin.prototype._getDataView = function () {
|
738
|
-
|
732
|
+
let host = this._hosts[0];
|
739
733
|
return host ? host.getDataSource() : null;
|
740
734
|
};
|
741
735
|
|
@@ -746,7 +740,7 @@ RowSegmentingPlugin.prototype._getDataView = function () {
|
|
746
740
|
* @return {boolean} Return true if there is any change
|
747
741
|
*/
|
748
742
|
RowSegmentingPlugin.prototype.setSegmentSeparators = function(rowIds, enabled) {
|
749
|
-
|
743
|
+
let dv = this._getDataView();
|
750
744
|
if(dv) {
|
751
745
|
return dv.setSegmentSeparators(rowIds, enabled);
|
752
746
|
}
|
@@ -760,7 +754,7 @@ RowSegmentingPlugin.prototype.setSegmentSeparators = function(rowIds, enabled) {
|
|
760
754
|
* @return {boolean} Return true if there is any change
|
761
755
|
*/
|
762
756
|
RowSegmentingPlugin.prototype.setSegmentSeparator = function(rowRef, enabled) {
|
763
|
-
|
757
|
+
let dv = this._getDataView();
|
764
758
|
if(dv) {
|
765
759
|
return dv.setSegmentSeparator(rowRef, enabled);
|
766
760
|
}
|
@@ -773,7 +767,7 @@ RowSegmentingPlugin.prototype.setSegmentSeparator = function(rowRef, enabled) {
|
|
773
767
|
* @return {boolean}
|
774
768
|
*/
|
775
769
|
RowSegmentingPlugin.prototype.setSegmentClassification = function(rowRef, fields) {
|
776
|
-
|
770
|
+
let dv = this._getDataView();
|
777
771
|
if(dv) {
|
778
772
|
return dv.setSegmentClassification(rowRef, fields);
|
779
773
|
}
|
@@ -784,7 +778,7 @@ RowSegmentingPlugin.prototype.setSegmentClassification = function(rowRef, fields
|
|
784
778
|
* @return {boolean} Return true if there is any change
|
785
779
|
*/
|
786
780
|
RowSegmentingPlugin.prototype.unsetAllSegmentSeparators = function() {
|
787
|
-
|
781
|
+
let dv = this._getDataView();
|
788
782
|
if(dv) {
|
789
783
|
return dv.unsetAllSegmentSeparators();
|
790
784
|
}
|
@@ -795,7 +789,7 @@ RowSegmentingPlugin.prototype.unsetAllSegmentSeparators = function() {
|
|
795
789
|
* @return {boolean}
|
796
790
|
*/
|
797
791
|
RowSegmentingPlugin.prototype.hasSegmentation = function() {
|
798
|
-
|
792
|
+
let dv = this._getDataView();
|
799
793
|
if(dv) {
|
800
794
|
return dv.hasSegmentation();
|
801
795
|
}
|
@@ -807,9 +801,9 @@ RowSegmentingPlugin.prototype.hasSegmentation = function() {
|
|
807
801
|
* @return {boolean}
|
808
802
|
*/
|
809
803
|
RowSegmentingPlugin.prototype.isSegmentSeparator = function(rowRef) {
|
810
|
-
|
804
|
+
let dv = this._getDataView();
|
811
805
|
if(dv) {
|
812
|
-
|
806
|
+
let rowId = "";
|
813
807
|
if(typeof rowRef === "number") {
|
814
808
|
rowId = dv.getRowId(rowRef); // WARNING: This is very slow
|
815
809
|
} else {
|
@@ -829,7 +823,7 @@ RowSegmentingPlugin.prototype.isSegmentSeparator = function(rowRef) {
|
|
829
823
|
* @return {boolean} Return true if there is any change
|
830
824
|
*/
|
831
825
|
RowSegmentingPlugin.prototype.collapseSegments = function(rowIds, collapsed) {
|
832
|
-
|
826
|
+
let dv = this._getDataView();
|
833
827
|
if(dv) {
|
834
828
|
return dv.collapseSegments(rowIds, collapsed);
|
835
829
|
}
|
@@ -843,7 +837,7 @@ RowSegmentingPlugin.prototype.collapseSegments = function(rowIds, collapsed) {
|
|
843
837
|
* @return {boolean} Return true if there is any change
|
844
838
|
*/
|
845
839
|
RowSegmentingPlugin.prototype.collapseSegment = function(rowRef, collapsed) {
|
846
|
-
|
840
|
+
let dv = this._getDataView();
|
847
841
|
if(dv) {
|
848
842
|
return dv.collapseSegment(rowRef, collapsed);
|
849
843
|
}
|
@@ -855,7 +849,7 @@ RowSegmentingPlugin.prototype.collapseSegment = function(rowRef, collapsed) {
|
|
855
849
|
* @return {boolean} Return true if there is any change
|
856
850
|
*/
|
857
851
|
RowSegmentingPlugin.prototype.expandSegment = function(rowRef, expanded) {
|
858
|
-
|
852
|
+
let dv = this._getDataView();
|
859
853
|
if(dv) {
|
860
854
|
return dv.expandSegment(rowRef, expanded);
|
861
855
|
}
|
@@ -865,7 +859,7 @@ RowSegmentingPlugin.prototype.expandSegment = function(rowRef, expanded) {
|
|
865
859
|
* @return {boolean} Return true if there is any change
|
866
860
|
*/
|
867
861
|
RowSegmentingPlugin.prototype.expandAllSegments = function() {
|
868
|
-
|
862
|
+
let dv = this._getDataView();
|
869
863
|
if(dv) {
|
870
864
|
return dv.expandAllSegments();
|
871
865
|
}
|
@@ -876,7 +870,7 @@ RowSegmentingPlugin.prototype.expandAllSegments = function() {
|
|
876
870
|
* @return {boolean} Return true if only the given row is a collapsed segment separator
|
877
871
|
*/
|
878
872
|
RowSegmentingPlugin.prototype.isSegmentCollapsed = function(rowRef) {
|
879
|
-
|
873
|
+
let dv = this._getDataView();
|
880
874
|
if(dv) {
|
881
875
|
return dv.isSegmentCollapsed(rowRef);
|
882
876
|
}
|
@@ -886,7 +880,7 @@ RowSegmentingPlugin.prototype.isSegmentCollapsed = function(rowRef) {
|
|
886
880
|
* @param {Function} func By default, all row members are hidden in a collapsed segment
|
887
881
|
*/
|
888
882
|
RowSegmentingPlugin.prototype.setSegmentCollapsingLogic = function(func) {
|
889
|
-
|
883
|
+
let dv = this._getDataView();
|
890
884
|
if(dv) {
|
891
885
|
dv.setSegmentCollapsingLogic(func);
|
892
886
|
}
|
@@ -897,7 +891,7 @@ RowSegmentingPlugin.prototype.setSegmentCollapsingLogic = function(func) {
|
|
897
891
|
* @param {string|number} segmentRef Row id or row index
|
898
892
|
*/
|
899
893
|
RowSegmentingPlugin.prototype.fillSegment = function(segmentRef) {
|
900
|
-
|
894
|
+
let dv = this._getDataView();
|
901
895
|
if(dv) {
|
902
896
|
dv.fillSegment(segmentRef);
|
903
897
|
}
|
@@ -906,7 +900,7 @@ RowSegmentingPlugin.prototype.fillSegment = function(segmentRef) {
|
|
906
900
|
* @public
|
907
901
|
*/
|
908
902
|
RowSegmentingPlugin.prototype.fillSegments = function() {
|
909
|
-
|
903
|
+
let dv = this._getDataView();
|
910
904
|
if(dv) {
|
911
905
|
dv.fillSegments();
|
912
906
|
}
|
@@ -916,11 +910,11 @@ RowSegmentingPlugin.prototype.fillSegments = function() {
|
|
916
910
|
* @param {string|number} rowRef Row id, row index
|
917
911
|
*/
|
918
912
|
RowSegmentingPlugin.prototype.addSegmentChild = function(segmentRef, rowRef) {
|
919
|
-
|
913
|
+
let dv = this._getDataView();
|
920
914
|
if(dv) {
|
921
|
-
|
915
|
+
let dataId;
|
922
916
|
if(this._realTimeGrid) {
|
923
|
-
|
917
|
+
let rowDef = this._realTimeGrid.getRowDefinition(rowRef);
|
924
918
|
if(rowDef) {
|
925
919
|
dataId = rowDef.getDataId();
|
926
920
|
}
|
@@ -944,15 +938,15 @@ RowSegmentingPlugin.prototype.setSegmentChildren = function(segmentArr) {
|
|
944
938
|
* @param {Array.<string|number>} rowRefs Array of row ids or row indices. If null is given, no child will be removed.
|
945
939
|
*/
|
946
940
|
RowSegmentingPlugin.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
947
|
-
|
941
|
+
let dv = this._getDataView();
|
948
942
|
if(dv) {
|
949
|
-
|
943
|
+
let dataIds;
|
950
944
|
if(this._realTimeGrid) {
|
951
945
|
rowRefs = Array.isArray(rowRefs) ? rowRefs : [rowRefs];
|
952
|
-
|
946
|
+
let len = rowRefs.length;
|
953
947
|
dataIds = new Array(len);
|
954
|
-
for(
|
955
|
-
|
948
|
+
for(let i = 0; i < len; i++) {
|
949
|
+
let rowDef = this._realTimeGrid.getRowDefinition(rowRefs[i]);
|
956
950
|
if(rowDef) {
|
957
951
|
dataIds[i] = rowDef.getDataId();
|
958
952
|
}
|
@@ -966,7 +960,7 @@ RowSegmentingPlugin.prototype.addSegmentChildren = function(segmentRef, rowRefs)
|
|
966
960
|
* @param {string|number} rowRef Row id, row index
|
967
961
|
*/
|
968
962
|
RowSegmentingPlugin.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
969
|
-
|
963
|
+
let dv = this._getDataView();
|
970
964
|
if(dv) {
|
971
965
|
dv.removeSegmentChild(segmentRef, rowRef);
|
972
966
|
}
|
@@ -976,7 +970,7 @@ RowSegmentingPlugin.prototype.removeSegmentChild = function(segmentRef, rowRef)
|
|
976
970
|
* @param {Array.<string|number>} rowRefs Array of row ids or row indices
|
977
971
|
*/
|
978
972
|
RowSegmentingPlugin.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
|
979
|
-
|
973
|
+
let dv = this._getDataView();
|
980
974
|
if(dv) {
|
981
975
|
dv.removeSegmentChildren(segmentRef, rowRefs);
|
982
976
|
}
|
@@ -984,7 +978,7 @@ RowSegmentingPlugin.prototype.removeSegmentChildren = function(segmentRef, rowRe
|
|
984
978
|
/** @public
|
985
979
|
*/
|
986
980
|
RowSegmentingPlugin.prototype.removeAllSegmentChildren = function() {
|
987
|
-
|
981
|
+
let dv = this._getDataView();
|
988
982
|
if(dv) {
|
989
983
|
dv.removeAllSegmentChildren();
|
990
984
|
}
|
@@ -994,7 +988,7 @@ RowSegmentingPlugin.prototype.removeAllSegmentChildren = function() {
|
|
994
988
|
* @return {Array.<string>} Return null if there is no segment separator
|
995
989
|
*/
|
996
990
|
RowSegmentingPlugin.prototype.getSegmentIds = function() {
|
997
|
-
|
991
|
+
let dv = this._getDataView();
|
998
992
|
if(dv) {
|
999
993
|
return dv.getSegmentIds();
|
1000
994
|
}
|
@@ -1006,7 +1000,7 @@ RowSegmentingPlugin.prototype.getSegmentIds = function() {
|
|
1006
1000
|
* @return {Array.<string>} Returns array of row ids. Returns null if there is no child or no segment separator found
|
1007
1001
|
*/
|
1008
1002
|
RowSegmentingPlugin.prototype.getSegmentChildIds = function(segmentRef) {
|
1009
|
-
|
1003
|
+
let dv = this._getDataView();
|
1010
1004
|
if(dv) {
|
1011
1005
|
return dv.getSegmentChildIds(segmentRef);
|
1012
1006
|
}
|
@@ -1027,9 +1021,9 @@ RowSegmentingPlugin.prototype.sortSegments = function (sortFunction) {
|
|
1027
1021
|
this.setSortingLogic(sortFunction);
|
1028
1022
|
}
|
1029
1023
|
if (this._userSortingLogic) {
|
1030
|
-
|
1024
|
+
let dv = this._getDataView();
|
1031
1025
|
if (dv) {
|
1032
|
-
|
1026
|
+
let sortingLogic = this._realTimeGrid ? this._rtSortingLogic : this._userSortingLogic;
|
1033
1027
|
dv.sortSegments(sortingLogic);
|
1034
1028
|
}
|
1035
1029
|
}
|
@@ -1061,7 +1055,7 @@ RowSegmentingPlugin.prototype.setPredefinedColors = function(predefinedColors) {
|
|
1061
1055
|
* @param {boolean|null} spanning if set true when rowRef is row separator, then span that row
|
1062
1056
|
*/
|
1063
1057
|
RowSegmentingPlugin.prototype.spanSegmentSeparator = function(rowRef, spanning) {
|
1064
|
-
|
1058
|
+
let dv = this._getDataView();
|
1065
1059
|
if(!dv) { return; }
|
1066
1060
|
|
1067
1061
|
if(typeof rowRef === "string") {
|
@@ -38,7 +38,8 @@ declare namespace RowFilteringPlugin {
|
|
38
38
|
additionalItems?: any[]|null,
|
39
39
|
compactMode?: boolean|null,
|
40
40
|
blankValues?: (boolean|string)|null,
|
41
|
-
dateTimeFormat?: string|null
|
41
|
+
dateTimeFormat?: string|null,
|
42
|
+
showOnlyFilteredItems?: boolean|null
|
42
43
|
};
|
43
44
|
|
44
45
|
type FilterEntry = {
|
@@ -93,6 +93,7 @@ The expression can take various forms:<br>
|
|
93
93
|
* @property {boolean=} compactMode=false force compact mode in dialog
|
94
94
|
* @property {(boolean|string)=} blankValues=false Display a "(Blanks)" item in the filter dialog to represent an empty value. If a string is passed, it will be used as the label for the blank item
|
95
95
|
* @property {string=} dateTimeFormat="dd-MM-yy" Specifies the string format for the date time picker in the filter dialog based on date-fns format, follow https://date-fns.org/v3.6.0/docs/format.
|
96
|
+
* @property {boolean=} showOnlyFilteredItems=false If enabled, rows that are filtered out by other columns will not appear in the list, regardless of the current filter settings.
|
96
97
|
*/
|
97
98
|
|
98
99
|
/** @typedef {Object} RowFilteringPlugin~FilterEntry
|
@@ -1134,17 +1135,31 @@ RowFilteringPlugin.prototype.getFilters = function() {
|
|
1134
1135
|
* @see {@link RowFilteringPlugin.getConfigObject}
|
1135
1136
|
*/
|
1136
1137
|
RowFilteringPlugin.prototype.getAllColumnFilters = function() {
|
1138
|
+
return this._getAllColumnFilters();
|
1139
|
+
};
|
1140
|
+
/**
|
1141
|
+
* @private
|
1142
|
+
* @param {Object=} excludedMap
|
1143
|
+
* @return {!Array.<Function>} All column filters
|
1144
|
+
*/
|
1145
|
+
RowFilteringPlugin.prototype._getAllColumnFilters = function(excludedMap) {
|
1146
|
+
if(!excludedMap || typeof excludedMap !== "object") {
|
1147
|
+
excludedMap = {};
|
1148
|
+
}
|
1137
1149
|
let filters = [];
|
1138
1150
|
let len = this._columnFilters.length;
|
1139
1151
|
for(let i = 0; i < len; ++i) {
|
1140
1152
|
let cfo = this._columnFilters[i];
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1153
|
+
if(!excludedMap[cfo._field]) {
|
1154
|
+
let jLen = cfo._filters.length;
|
1155
|
+
for(let j = 0; j < jLen; ++j) {
|
1156
|
+
filters.push(cfo._filters[j]);
|
1157
|
+
}
|
1144
1158
|
}
|
1145
1159
|
}
|
1146
1160
|
return filters;
|
1147
1161
|
};
|
1162
|
+
|
1148
1163
|
/** Deprecated in favor of getConfigObject(). Get existing filter expressions for saving and restoring.
|
1149
1164
|
* @public
|
1150
1165
|
* @return {Array.<RowFilteringPlugin~FilterExpression>} Return null if there is no column filter
|
@@ -1613,6 +1628,24 @@ let _collectUniqueValue = function(uniqueValues, formattedVal, rawVal) {
|
|
1613
1628
|
uniqueValues[formattedVal] = [rawVal];
|
1614
1629
|
}
|
1615
1630
|
};
|
1631
|
+
|
1632
|
+
/** @private
|
1633
|
+
* @param {Object} row
|
1634
|
+
* @param {Array.<Function>} filterFuncs
|
1635
|
+
* @return {boolean}
|
1636
|
+
*/
|
1637
|
+
let isFilteredOutRow = function(row, filterFuncs) {
|
1638
|
+
let len = filterFuncs.length;
|
1639
|
+
if(len) {
|
1640
|
+
for(let i = 0; i < len; i++) {
|
1641
|
+
if(!filterFuncs[i](row)) {
|
1642
|
+
return true;
|
1643
|
+
}
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
return false;
|
1647
|
+
};
|
1648
|
+
|
1616
1649
|
/** @private
|
1617
1650
|
* @param {string} field A field name for getting raw value from row data
|
1618
1651
|
* @param {!Object} dialogConfig
|
@@ -1636,6 +1669,10 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
|
|
1636
1669
|
let blankAtLeastOne = false;
|
1637
1670
|
if(!Array.isArray(userItemList)) {
|
1638
1671
|
userItemList = null;
|
1672
|
+
let excludedMap = {};
|
1673
|
+
excludedMap[field] = true;
|
1674
|
+
let funcs = this._getAllColumnFilters(excludedMap);
|
1675
|
+
let showOnlyFilteredItems = dialogConfig.showOnlyFilteredItems;
|
1639
1676
|
let dvs = this._getAvailableDataViews();
|
1640
1677
|
let dts = dvs.map(this._getDataTable);
|
1641
1678
|
let tblCount = dts.length;
|
@@ -1650,6 +1687,9 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
|
|
1650
1687
|
if(this._rowTransform) {
|
1651
1688
|
row = this._rowTransform(row);
|
1652
1689
|
}
|
1690
|
+
if(showOnlyFilteredItems && isFilteredOutRow(row, funcs)) {
|
1691
|
+
continue;
|
1692
|
+
}
|
1653
1693
|
let fieldVal = row[field];
|
1654
1694
|
rawVal = fieldVal;
|
1655
1695
|
if(rawDataAccessor) {
|
@@ -1879,7 +1919,8 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1879
1919
|
formattedDataAccessor: null,
|
1880
1920
|
sortLogic: null,
|
1881
1921
|
blankValues: false,
|
1882
|
-
blankValuesChecked: false
|
1922
|
+
blankValuesChecked: false,
|
1923
|
+
showOnlyFilteredItems: false
|
1883
1924
|
};
|
1884
1925
|
|
1885
1926
|
let columnDialogOptions = null;
|
@@ -1932,7 +1973,7 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1932
1973
|
filterMode = "advanced";
|
1933
1974
|
}
|
1934
1975
|
} else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
|
1935
|
-
if(typeof exp === "object") {
|
1976
|
+
if(typeof exp === "object" && !dialogConfig.showOnlyFilteredItems) {
|
1936
1977
|
for(let expKey in exp) {
|
1937
1978
|
_pushRawValue(userInputs, expKey, exp[expKey]);
|
1938
1979
|
}
|
@@ -2058,6 +2099,11 @@ RowFilteringPlugin._overrideConfig = function(config, userConfig) {
|
|
2058
2099
|
config.lang = lang;
|
2059
2100
|
}
|
2060
2101
|
|
2102
|
+
let showOnlyFilteredItems = userConfig["showOnlyFilteredItems"];
|
2103
|
+
if(showOnlyFilteredItems != null) {
|
2104
|
+
config.showOnlyFilteredItems = showOnlyFilteredItems;
|
2105
|
+
}
|
2106
|
+
|
2061
2107
|
let rawDataAccessor = userConfig["rawDataAccessor"];
|
2062
2108
|
if(typeof rawDataAccessor === "function" || rawDataAccessor === null) { // Allow null value
|
2063
2109
|
config.rawDataAccessor = rawDataAccessor;
|
package/lib/versions.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"tr-grid-util": "1.3.168",
|
3
3
|
"tr-grid-printer": "1.0.18",
|
4
4
|
"@grid/column-dragging": "1.0.21",
|
5
|
-
"@grid/row-segmenting": "
|
5
|
+
"@grid/row-segmenting": "2.0.0",
|
6
6
|
"@grid/statistics-row": "1.0.17",
|
7
7
|
"@grid/zoom": "1.0.13",
|
8
8
|
"tr-grid-auto-tooltip": "1.1.9",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"tr-grid-percent-bar": "1.0.24",
|
25
25
|
"tr-grid-range-bar": "2.0.9",
|
26
26
|
"tr-grid-row-dragging": "1.0.38",
|
27
|
-
"tr-grid-row-filtering": "1.0.
|
27
|
+
"tr-grid-row-filtering": "1.0.88",
|
28
28
|
"tr-grid-row-grouping": "1.0.88",
|
29
29
|
"tr-grid-row-selection": "1.0.33",
|
30
30
|
"tr-grid-rowcoloring": "1.0.26",
|
package/package.json
CHANGED