@refinitiv-ui/efx-grid 6.0.93 → 6.0.94
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/formatters/es6/CoralButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralButtonFormatter.js +9 -4
- package/lib/formatters/es6/CoralCheckboxFormatter.js +10 -5
- package/lib/formatters/es6/CoralComboBoxFormatter.js +13 -12
- package/lib/formatters/es6/CoralIconFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralIconFormatter.js +9 -4
- package/lib/formatters/es6/CoralInputFormatter.js +9 -4
- package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralRadioButtonFormatter.js +20 -15
- package/lib/formatters/es6/CoralSelectFormatter.js +12 -7
- package/lib/formatters/es6/CoralToggleFormatter.js +4 -4
- package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.js +20 -20
- package/lib/formatters/es6/EFButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFButtonFormatter.js +9 -4
- package/lib/formatters/es6/EFCheckboxFormatter.js +10 -5
- package/lib/formatters/es6/EFComboBoxFormatter.js +17 -7
- package/lib/formatters/es6/EFDateTimePickerFormatter.js +11 -6
- package/lib/formatters/es6/EFIconFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFIconFormatter.js +9 -4
- package/lib/formatters/es6/EFNumberFieldFormatter.js +9 -4
- package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFRadioButtonFormatter.js +25 -15
- package/lib/formatters/es6/EFSelectFormatter.js +17 -7
- package/lib/formatters/es6/EFTextFieldFormatter.js +4 -4
- package/lib/formatters/es6/EFToggleFormatter.js +4 -4
- package/lib/formatters/es6/EmeraldDateTimePickerFormatter.js +6 -6
- package/lib/formatters/es6/FormatterBuilder.js +32 -32
- package/lib/formatters/es6/NumericInputFormatter.js +7 -7
- package/lib/formatters/es6/PercentBarFormatter.js +5 -5
- package/lib/formatters/es6/SimpleImageFormatter.js +3 -3
- package/lib/formatters/es6/SimpleInputFormatter.js +4 -4
- package/lib/formatters/es6/SimpleLinkFormatter.js +4 -4
- package/lib/formatters/es6/SimpleTickerFormatter.js +5 -5
- package/lib/formatters/es6/SimpleToggleFormatter.js +16 -16
- package/lib/formatters/es6/TextFormatter.js +4 -4
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +1 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +1 -1
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +139 -137
- package/lib/tr-grid-row-selection/es6/RowSelection.js +260 -279
- package/lib/tr-grid-util/es6/DragUI.js +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +1 -2
- package/lib/versions.json +6 -6
- package/package.json +1 -1
@@ -126,8 +126,8 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
126
126
|
* @extends {GridPlugin}
|
127
127
|
* @param {RowGroupingPlugin~Options=} options Extension's configuration object
|
128
128
|
*/
|
129
|
-
|
130
|
-
|
129
|
+
let RowGroupingPlugin = function (options) {
|
130
|
+
let t = this;
|
131
131
|
t._onColumnIndexChanged = t._onColumnIndexChanged.bind(t);
|
132
132
|
t._getRowsForContentAsHeader = t._getRowsForContentAsHeader.bind(t);
|
133
133
|
t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
|
@@ -298,7 +298,7 @@ RowGroupingPlugin.prototype._criteriaGetter = null;
|
|
298
298
|
* @return {Array.<string>}
|
299
299
|
*/
|
300
300
|
RowGroupingPlugin._defaultCriteriaGetter = function (field, dvRowData) {
|
301
|
-
|
301
|
+
let val = dvRowData[field];
|
302
302
|
return RowGroupingPlugin._toArrayOfString(val);
|
303
303
|
};
|
304
304
|
/** @private
|
@@ -308,8 +308,8 @@ RowGroupingPlugin._defaultCriteriaGetter = function (field, dvRowData) {
|
|
308
308
|
* @return {Array.<string>}
|
309
309
|
*/
|
310
310
|
RowGroupingPlugin._rowDefCriteriaGetter = function (field, dvRowData) {
|
311
|
-
|
312
|
-
|
311
|
+
let rowData = /** @type{Object} */(dvRowData.ROW_DEF.getRowData());
|
312
|
+
let val = rowData[field];
|
313
313
|
return RowGroupingPlugin._toArrayOfString(val);
|
314
314
|
};
|
315
315
|
/** @private
|
@@ -332,8 +332,8 @@ RowGroupingPlugin._toArrayOfString = function (data) {
|
|
332
332
|
*/
|
333
333
|
RowGroupingPlugin.prototype._findCheckboxColumnIndexFromConfig = function (columns) {
|
334
334
|
if (!Array.isArray(columns)) return -1;
|
335
|
-
|
336
|
-
for (
|
335
|
+
let index = -1, c = columns.length;
|
336
|
+
for (let i = 0; i < c; i++) {
|
337
337
|
if (columns[i].checkboxColumn) {
|
338
338
|
index = i;
|
339
339
|
break;
|
@@ -408,7 +408,7 @@ RowGroupingPlugin.prototype.initialize = function (host, options) {
|
|
408
408
|
|
409
409
|
this.config(options);
|
410
410
|
|
411
|
-
|
411
|
+
let enabled = this._colorTag != null ? this._colorTag : ElfUtil.isHaloTheme();
|
412
412
|
RowPainter.disableColorTag(host, enabled === false);
|
413
413
|
|
414
414
|
if (this._predefinedColors != null) {
|
@@ -424,7 +424,7 @@ RowGroupingPlugin.prototype.initialize = function (host, options) {
|
|
424
424
|
* @param {Object=} host core grid object
|
425
425
|
*/
|
426
426
|
RowGroupingPlugin.prototype.unload = function (host) {
|
427
|
-
|
427
|
+
let at = this._hosts.indexOf(host);
|
428
428
|
if (at < 0) {
|
429
429
|
return;
|
430
430
|
}
|
@@ -457,7 +457,7 @@ RowGroupingPlugin.prototype.unload = function (host) {
|
|
457
457
|
RowGroupingPlugin.prototype.config = function (options) {
|
458
458
|
if (!options) { return; }
|
459
459
|
|
460
|
-
|
460
|
+
let option = options.rowGrouping;
|
461
461
|
if (option) {
|
462
462
|
if (option.autoGroupRemoval != null) {
|
463
463
|
this._autoGroupRemoval = !!option.autoGroupRemoval;
|
@@ -499,11 +499,11 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
499
499
|
option.groupFooterBinding = option.footerBinding;
|
500
500
|
}
|
501
501
|
if (option.hiddenArrow != null) {
|
502
|
-
|
502
|
+
let hiddenOption = option.hiddenArrow;
|
503
503
|
if (Array.isArray(hiddenOption)) {
|
504
|
-
|
504
|
+
let len = hiddenOption.length;
|
505
505
|
this._hiddenArrow = {};
|
506
|
-
for (
|
506
|
+
for (let i = 0; i < len; i++) {
|
507
507
|
this._hiddenArrow[hiddenOption[i]] = true;
|
508
508
|
}
|
509
509
|
} else if (typeof hiddenOption === "number") {
|
@@ -519,7 +519,7 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
519
519
|
if (option.clickableCell != null) {
|
520
520
|
this._clickableCell = !!option.clickableCell;
|
521
521
|
}
|
522
|
-
|
522
|
+
let indentSize = option.indentSize;
|
523
523
|
if (indentSize != null) {
|
524
524
|
if (typeof indentSize === "boolean") {
|
525
525
|
if (indentSize) {
|
@@ -529,7 +529,7 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
529
529
|
} // TODO: Handle default case
|
530
530
|
} else if (typeof indentSize === "number") {
|
531
531
|
this._indentSizes = new Array(5);
|
532
|
-
for (
|
532
|
+
for (let j = 0; j < 5; j++) {
|
533
533
|
this._indentSizes[j] = indentSize * j;
|
534
534
|
}
|
535
535
|
} else if (Array.isArray(indentSize)) {
|
@@ -578,7 +578,7 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
578
578
|
});
|
579
579
|
|
580
580
|
if (this._fixedDisplayColumn < 0) {
|
581
|
-
|
581
|
+
let checkboxColumnIndex = this._findCheckboxColumnIndexFromConfig(options.columns);
|
582
582
|
if (checkboxColumnIndex >= 0) { // has checkbox column
|
583
583
|
/** 27/04/21
|
584
584
|
* NOTE:: checkbox column could be
|
@@ -604,9 +604,9 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
604
604
|
* @return {!Object}
|
605
605
|
*/
|
606
606
|
RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
607
|
-
|
607
|
+
let obj = gridOptions || {};
|
608
608
|
|
609
|
-
|
609
|
+
let extOptions = obj.rowGrouping;
|
610
610
|
if(!extOptions) {
|
611
611
|
extOptions = obj.rowGrouping = {};
|
612
612
|
}
|
@@ -619,7 +619,7 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
619
619
|
if(this._predefinedGroups) {
|
620
620
|
extOptions.predefinedGroups = this._predefinedGroups;
|
621
621
|
}
|
622
|
-
|
622
|
+
let criterion = this._criteria.filter(isNonFunction);
|
623
623
|
if(criterion.length) {
|
624
624
|
extOptions.groupBy = criterion;
|
625
625
|
}
|
@@ -637,8 +637,8 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
637
637
|
if(this._hiddenArrow === true) {
|
638
638
|
extOptions.hiddenArrow = true;
|
639
639
|
} else {
|
640
|
-
|
641
|
-
for(
|
640
|
+
let hiddenArrows = extOptions.hiddenArrow = [];
|
641
|
+
for(let key in this._hiddenArrow) {
|
642
642
|
hiddenArrows.push(+key);
|
643
643
|
}
|
644
644
|
}
|
@@ -668,7 +668,7 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
668
668
|
extOptions.predefinedColors = this._predefinedColors;
|
669
669
|
}
|
670
670
|
|
671
|
-
|
671
|
+
let defaultCollapse = this.getDefaultCollapse();
|
672
672
|
if(defaultCollapse != null) {
|
673
673
|
extOptions.defaultCollapse = defaultCollapse;
|
674
674
|
}
|
@@ -687,12 +687,12 @@ RowGroupingPlugin.prototype.getColumnMenu = function (colIndex, config) {
|
|
687
687
|
config = {};
|
688
688
|
}
|
689
689
|
|
690
|
-
|
690
|
+
let menus = config.menus;
|
691
691
|
if (!menus) {
|
692
692
|
menus = config.menus = [];
|
693
693
|
}
|
694
694
|
|
695
|
-
|
695
|
+
let menu = menus[0];
|
696
696
|
if (!menu) {
|
697
697
|
menu = menus[0] = {
|
698
698
|
menuItems: []
|
@@ -700,9 +700,9 @@ RowGroupingPlugin.prototype.getColumnMenu = function (colIndex, config) {
|
|
700
700
|
}
|
701
701
|
|
702
702
|
// Menu items for this extension
|
703
|
-
|
704
|
-
|
705
|
-
|
703
|
+
let field = this._getField(colIndex);
|
704
|
+
let isGrouping = this.hasGroupingCriteria();
|
705
|
+
let extMenuItems = [{
|
706
706
|
indexScore: 200,
|
707
707
|
label: "Group",
|
708
708
|
group: "FREQUENTLY_USED",
|
@@ -751,10 +751,10 @@ RowGroupingPlugin.prototype.getColumnMenu = function (colIndex, config) {
|
|
751
751
|
* @param {Object} predefinedColors Predefined color object map
|
752
752
|
*/
|
753
753
|
RowGroupingPlugin.prototype._injectStyles = function(predefinedColors) {
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
for (
|
754
|
+
let prefix = ".tr-grid." + RowGroupingPlugin._controlClass + " .tr-lg .cell";
|
755
|
+
let css = [];
|
756
|
+
let value;
|
757
|
+
for (let className in predefinedColors) {
|
758
758
|
css.push(prefix + "." + className + "::before");
|
759
759
|
value = predefinedColors[className]["backgroundColor"];
|
760
760
|
if (value) {
|
@@ -762,7 +762,7 @@ RowGroupingPlugin.prototype._injectStyles = function(predefinedColors) {
|
|
762
762
|
}
|
763
763
|
}
|
764
764
|
|
765
|
-
|
765
|
+
let host = this._hosts[0];
|
766
766
|
|
767
767
|
if (this._styleTag) {
|
768
768
|
if (this._styleTag.parentNode) {
|
@@ -777,7 +777,7 @@ RowGroupingPlugin.prototype._injectStyles = function(predefinedColors) {
|
|
777
777
|
* @param {Object} e
|
778
778
|
*/
|
779
779
|
RowGroupingPlugin.prototype._onItemGroupColumnClicked = function (e) {
|
780
|
-
|
780
|
+
let field = this._getField(e.currentTarget.value.colIndex);
|
781
781
|
this._addGroup(field);
|
782
782
|
this._hideColumnMenu();
|
783
783
|
};
|
@@ -786,7 +786,7 @@ RowGroupingPlugin.prototype._onItemGroupColumnClicked = function (e) {
|
|
786
786
|
* @param {Object} e
|
787
787
|
*/
|
788
788
|
RowGroupingPlugin.prototype._onItemUnGroupColumnClicked = function (e) {
|
789
|
-
|
789
|
+
let field = this._getField(e.currentTarget.value.colIndex);
|
790
790
|
this._ungroup(field);
|
791
791
|
this._hideColumnMenu();
|
792
792
|
};
|
@@ -810,8 +810,8 @@ RowGroupingPlugin.prototype._onItemCollapseAllClicked = function (e) {
|
|
810
810
|
/** @private
|
811
811
|
*/
|
812
812
|
RowGroupingPlugin.prototype._hideColumnMenu = function () {
|
813
|
-
|
814
|
-
|
813
|
+
let host = this._hosts[0];
|
814
|
+
let columnMenuExt = host.getPlugin('ColumnMenuPlugin');
|
815
815
|
if (columnMenuExt) columnMenuExt.hide();
|
816
816
|
};
|
817
817
|
|
@@ -819,8 +819,8 @@ RowGroupingPlugin.prototype._hideColumnMenu = function () {
|
|
819
819
|
* @param {string} field
|
820
820
|
*/
|
821
821
|
RowGroupingPlugin.prototype._addGroup = function (field) {
|
822
|
-
|
823
|
-
|
822
|
+
let criteria = this.getGroupingCriteria();
|
823
|
+
let index = criteria.indexOf(field);
|
824
824
|
if (index < 0) {
|
825
825
|
criteria.push(field);
|
826
826
|
}
|
@@ -832,8 +832,8 @@ RowGroupingPlugin.prototype._addGroup = function (field) {
|
|
832
832
|
* @param {string} field
|
833
833
|
*/
|
834
834
|
RowGroupingPlugin.prototype._ungroup = function (field) {
|
835
|
-
|
836
|
-
|
835
|
+
let criteria = this.getGroupingCriteria();
|
836
|
+
let index = criteria.indexOf(field);
|
837
837
|
if (index >= 0) {
|
838
838
|
criteria.splice(index, 1);
|
839
839
|
}
|
@@ -900,7 +900,7 @@ RowGroupingPlugin.prototype._applyGrouping = function () {
|
|
900
900
|
return;
|
901
901
|
}
|
902
902
|
|
903
|
-
|
903
|
+
let dv = this.getDataView();
|
904
904
|
if (!dv) {
|
905
905
|
return;
|
906
906
|
}
|
@@ -936,7 +936,7 @@ RowGroupingPlugin.prototype._applyGrouping = function () {
|
|
936
936
|
* @return {Object} DataView instance
|
937
937
|
*/
|
938
938
|
RowGroupingPlugin.prototype.getDataView = function () {
|
939
|
-
|
939
|
+
let host = this._hosts[0];
|
940
940
|
if (host) {
|
941
941
|
return host.getDataSource();
|
942
942
|
}
|
@@ -949,10 +949,10 @@ RowGroupingPlugin.prototype.getDataView = function () {
|
|
949
949
|
* The two first parameters passed to the function are group value that separates group. <br>
|
950
950
|
* The two last parameters passed to the function are data views of corresponding group.
|
951
951
|
* @example
|
952
|
-
*
|
952
|
+
* let compare = function(grpA, grpB, dataViewA, dataViewB) {
|
953
953
|
* return (grpA <= grpB) ? -1 : 1;
|
954
954
|
* }
|
955
|
-
*
|
955
|
+
* let dstp = new RowGroupingExtension();
|
956
956
|
* dstp.setGroupSortingLogic(compare);
|
957
957
|
*/
|
958
958
|
RowGroupingPlugin.prototype.setGroupSortingLogic = function (sortFunction) {
|
@@ -986,7 +986,7 @@ RowGroupingPlugin.prototype.setPredefinedGroups = function (predefinedGroups) {
|
|
986
986
|
}
|
987
987
|
this._predefinedGroups = predefinedGroups;
|
988
988
|
|
989
|
-
|
989
|
+
let dv = this.getDataView();
|
990
990
|
if (dv) {
|
991
991
|
dv.setPredefinedGroups(this._predefinedGroups);
|
992
992
|
}
|
@@ -1006,7 +1006,7 @@ RowGroupingPlugin.prototype.setPredefinedColors = function(predefinedColors) {
|
|
1006
1006
|
* @param {boolean} collapse Predefined color object map
|
1007
1007
|
*/
|
1008
1008
|
RowGroupingPlugin.prototype.setDefaultCollapse = function(collapse) {
|
1009
|
-
|
1009
|
+
let dv = this.getDataView();
|
1010
1010
|
if (dv) {
|
1011
1011
|
dv.setDefaultCollapse(collapse);
|
1012
1012
|
}
|
@@ -1017,14 +1017,14 @@ RowGroupingPlugin.prototype.setDefaultCollapse = function(collapse) {
|
|
1017
1017
|
* @param {string} groupColor color name from predefinedColors
|
1018
1018
|
*/
|
1019
1019
|
RowGroupingPlugin.prototype.setGroupColor = function(groupRef, groupColor) {
|
1020
|
-
|
1020
|
+
let dv = this.getDataView();
|
1021
1021
|
if(!dv) {
|
1022
1022
|
return;
|
1023
1023
|
}
|
1024
|
-
|
1024
|
+
let grp = dv.getGroup(groupRef);
|
1025
1025
|
if(grp) {
|
1026
1026
|
grp.setGroupColor(groupColor);
|
1027
|
-
|
1027
|
+
let host = this._hosts[0];
|
1028
1028
|
if(host) {
|
1029
1029
|
host.requestRowRefresh();
|
1030
1030
|
}
|
@@ -1035,7 +1035,7 @@ RowGroupingPlugin.prototype.setGroupColor = function(groupRef, groupColor) {
|
|
1035
1035
|
* @return {boolean}
|
1036
1036
|
*/
|
1037
1037
|
RowGroupingPlugin.prototype.getDefaultCollapse = function() {
|
1038
|
-
|
1038
|
+
let dv = this.getDataView();
|
1039
1039
|
if (dv) {
|
1040
1040
|
return dv.getDefaultCollapse();
|
1041
1041
|
}
|
@@ -1048,7 +1048,7 @@ RowGroupingPlugin.prototype.getDefaultCollapse = function() {
|
|
1048
1048
|
RowGroupingPlugin.prototype.sortGroups = function () {
|
1049
1049
|
this._sortingTimer = 0;
|
1050
1050
|
if (this._groupSortFunction) {
|
1051
|
-
|
1051
|
+
let dv = this.getDataView();
|
1052
1052
|
if (dv) {
|
1053
1053
|
dv.sortGroups(this._groupSortFunction);
|
1054
1054
|
}
|
@@ -1075,8 +1075,8 @@ RowGroupingPlugin.prototype._onPostSectionDataBinding = function (e) {
|
|
1075
1075
|
* @return {number}
|
1076
1076
|
*/
|
1077
1077
|
RowGroupingPlugin._standardGroupSortFunction = function (valA, valB) {
|
1078
|
-
|
1079
|
-
|
1078
|
+
let strA = "" + valA;
|
1079
|
+
let strB = "" + valB;
|
1080
1080
|
if (strA < strB) {
|
1081
1081
|
return -1;
|
1082
1082
|
}
|
@@ -1095,7 +1095,7 @@ RowGroupingPlugin.prototype._isArrowHidden = function(dv) {
|
|
1095
1095
|
if (this._hiddenArrow === true) {
|
1096
1096
|
return true;
|
1097
1097
|
} else { // Object map
|
1098
|
-
|
1098
|
+
let lvl = dv.getGroupLevel();
|
1099
1099
|
if (this._hiddenArrow[lvl]) {
|
1100
1100
|
return true;
|
1101
1101
|
}
|
@@ -1110,7 +1110,7 @@ RowGroupingPlugin.prototype._isArrowHidden = function(dv) {
|
|
1110
1110
|
*/
|
1111
1111
|
RowGroupingPlugin.prototype._hasGroupHeader = function (settings) {
|
1112
1112
|
if (settings && settings.getType() === "content") {
|
1113
|
-
|
1113
|
+
let dv = settings.getDataSource();
|
1114
1114
|
if (dv) {
|
1115
1115
|
return dv.hasGroup();
|
1116
1116
|
}
|
@@ -1122,20 +1122,20 @@ RowGroupingPlugin.prototype._hasGroupHeader = function (settings) {
|
|
1122
1122
|
* @param {number} colIndex
|
1123
1123
|
*/
|
1124
1124
|
RowGroupingPlugin.prototype._clearSectionStyles = function (colIndex) {
|
1125
|
-
|
1125
|
+
let host = this._hosts[0];
|
1126
1126
|
if (!host || !(colIndex >= 0)) {
|
1127
1127
|
return;
|
1128
1128
|
}
|
1129
1129
|
// TODO: Optimize by checking isHeaderColumn flag
|
1130
1130
|
|
1131
|
-
|
1132
|
-
|
1133
|
-
for (
|
1134
|
-
|
1131
|
+
let sections = host.getAllSections("content");
|
1132
|
+
let rowPainter = this._rowPainter;
|
1133
|
+
for (let i = sections.length; --i >= 0;) {
|
1134
|
+
let section = sections[i];
|
1135
1135
|
|
1136
|
-
|
1137
|
-
|
1138
|
-
for (
|
1136
|
+
let fi = section.getFirstIndexInView();
|
1137
|
+
let li = section.getLastIndexInView();
|
1138
|
+
for (let r = fi; r <= li; r++) {
|
1139
1139
|
rowPainter.removeAllStyles(section, colIndex, r);
|
1140
1140
|
}
|
1141
1141
|
}
|
@@ -1146,8 +1146,8 @@ RowGroupingPlugin.prototype._clearSectionStyles = function (colIndex) {
|
|
1146
1146
|
* @return {number} headerColumn index, return -1 = not found
|
1147
1147
|
*/
|
1148
1148
|
RowGroupingPlugin.prototype._getHeaderColumnIndex = function () {
|
1149
|
-
|
1150
|
-
for (
|
1149
|
+
let colCount = this.getColumnCount();
|
1150
|
+
for (let columnIndex = 0; columnIndex < colCount; columnIndex++) {
|
1151
1151
|
if (this._getColumnOption(columnIndex, "isHeaderColumn")) {
|
1152
1152
|
return columnIndex;
|
1153
1153
|
}
|
@@ -1159,7 +1159,7 @@ RowGroupingPlugin.prototype._getHeaderColumnIndex = function () {
|
|
1159
1159
|
* @param {Object} e
|
1160
1160
|
*/
|
1161
1161
|
RowGroupingPlugin.prototype._onGroupCriteriaChanged = function (e) {
|
1162
|
-
|
1162
|
+
let dv = e.sender;
|
1163
1163
|
|
1164
1164
|
if (dv.hasGroup()) {
|
1165
1165
|
if (this._fixedDisplayColumn < 0 // no fixed index
|
@@ -1184,7 +1184,7 @@ RowGroupingPlugin.prototype._onGroupAdded = function (e) {
|
|
1184
1184
|
if (this._footerRows) {
|
1185
1185
|
e.newGroup.addFooter(this._footerRows);
|
1186
1186
|
}
|
1187
|
-
|
1187
|
+
let newGroup = e.newGroup;
|
1188
1188
|
// WARNING: contentAsHeader mode is overwrite arrow hidden to boolean
|
1189
1189
|
if(!this._contentAsHeader && newGroup.disableCollapsing) {
|
1190
1190
|
if(this._isArrowHidden(newGroup)) {
|
@@ -1192,10 +1192,10 @@ RowGroupingPlugin.prototype._onGroupAdded = function (e) {
|
|
1192
1192
|
}
|
1193
1193
|
}
|
1194
1194
|
|
1195
|
-
|
1196
|
-
|
1195
|
+
let groupColors = this._groupColors;
|
1196
|
+
let groupColor;
|
1197
1197
|
if(groupColors) { // Backward compatibility
|
1198
|
-
|
1198
|
+
let groupId = newGroup.getGroupId();
|
1199
1199
|
groupColor = groupColors[groupId];
|
1200
1200
|
if(groupColor) {
|
1201
1201
|
newGroup.setGroupColor(groupColor);
|
@@ -1228,8 +1228,8 @@ RowGroupingPlugin.prototype._updateDisplayColumn = function () {
|
|
1228
1228
|
if (this._shouldUpdateDisplayColumn) {
|
1229
1229
|
this._shouldUpdateDisplayColumn = false;
|
1230
1230
|
|
1231
|
-
|
1232
|
-
|
1231
|
+
let host = this._hosts[0];
|
1232
|
+
let c, colCount = host.getColumnCount();
|
1233
1233
|
this._headerColumn = this._getHeaderColumnIndex();
|
1234
1234
|
|
1235
1235
|
if (this._displayColumn < 0) {
|
@@ -1245,7 +1245,7 @@ RowGroupingPlugin.prototype._updateDisplayColumn = function () {
|
|
1245
1245
|
}
|
1246
1246
|
}
|
1247
1247
|
|
1248
|
-
|
1248
|
+
let tgtHeaderColumn = -1;
|
1249
1249
|
if (this._displayColumn >= 0) {
|
1250
1250
|
for (c = this._displayColumn; c < colCount; ++c) {
|
1251
1251
|
if (host.isColumnVisible(c)) {
|
@@ -1258,9 +1258,10 @@ RowGroupingPlugin.prototype._updateDisplayColumn = function () {
|
|
1258
1258
|
}
|
1259
1259
|
|
1260
1260
|
if (this._headerColumn !== tgtHeaderColumn) {
|
1261
|
+
let colData;
|
1261
1262
|
this._clearSectionStyles(this._headerColumn);
|
1262
1263
|
if (this._headerColumn >= 0) {
|
1263
|
-
|
1264
|
+
colData = this._getColumnData(this._headerColumn);
|
1264
1265
|
if (colData) {
|
1265
1266
|
colData.isHeaderColumn = false;
|
1266
1267
|
}
|
@@ -1289,47 +1290,47 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1289
1290
|
return;
|
1290
1291
|
}
|
1291
1292
|
|
1292
|
-
|
1293
|
+
let headerColumn = this._updateDisplayColumn();
|
1293
1294
|
if (headerColumn < 0) {
|
1294
1295
|
return;
|
1295
1296
|
} else if (!this._getColumnOption(headerColumn, "isHeaderColumn")) {
|
1296
1297
|
return; // Workaround: Newly inserted column doesn't have the flag
|
1297
1298
|
}
|
1298
1299
|
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1300
|
+
let dataSource = settings.getDataSource();
|
1301
|
+
let section = settings.getSection();
|
1302
|
+
let fi = (firstRowIndex != null) ? firstRowIndex : section.getFirstIndexInView();
|
1303
|
+
let li = (lastRowIndex != null) ? lastRowIndex : section.getLastIndexInView();
|
1304
|
+
let rowsForContentHeader = this._getRowsForContentAsHeader();
|
1304
1305
|
|
1305
|
-
|
1306
|
-
|
1306
|
+
let maxColWidth = -1; // -1 means no limit
|
1307
|
+
let colCell = section.getCell(headerColumn, 0, false);
|
1307
1308
|
if (!this._headerSpanning && colCell) {
|
1308
1309
|
maxColWidth = colCell.getWidth() - 27; // Ensure padding will subtract icon width (25px for halo, 27px for solar)
|
1309
1310
|
}
|
1310
1311
|
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1312
|
+
let colCount = section.getColumnCount();
|
1313
|
+
let nonGroupListener = this.hasListener("nonGroupBinding");
|
1314
|
+
let curGroupLevel = dataSource.getGroupLevel(fi);
|
1315
|
+
let arg = {
|
1315
1316
|
section: section,
|
1316
1317
|
colCount: colCount
|
1317
1318
|
};
|
1318
|
-
|
1319
|
-
|
1319
|
+
let currentGroup;
|
1320
|
+
let needCal = this._autoGroupHiding || this._contentAsHeader;
|
1320
1321
|
|
1321
|
-
for (
|
1322
|
+
for (let c = 0; c < colCount; c++) {
|
1322
1323
|
if(this._getColumnOption(c, "isCheckboxColumn")) {
|
1323
1324
|
arg.checkboxColumnIndex = c;
|
1324
1325
|
break;
|
1325
1326
|
}
|
1326
1327
|
}
|
1327
1328
|
|
1328
|
-
|
1329
|
-
for (
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1329
|
+
let rowPainter = this._rowPainter;
|
1330
|
+
for (let r = fi; r <= li; r++) {
|
1331
|
+
let indentOffset = 0;
|
1332
|
+
let rowId = dataSource.getRowId(r); // Slow
|
1333
|
+
let cell = section.getCell(headerColumn, r, false); // Work only one row
|
1333
1334
|
if (!cell) { // There may be no header to be updated
|
1334
1335
|
continue;
|
1335
1336
|
}
|
@@ -1341,14 +1342,15 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1341
1342
|
arg.rowData = this._rowGetter(dataSource.getRowData(rowId));
|
1342
1343
|
arg.noIndent = false;
|
1343
1344
|
|
1344
|
-
|
1345
|
-
|
1345
|
+
let contentHeaderGroup = rowsForContentHeader[rowId];
|
1346
|
+
let groupView = dataSource.getGroupByRowId(rowId);
|
1347
|
+
let footerRow = false;
|
1346
1348
|
if (groupView) { // Header Render
|
1347
1349
|
currentGroup = groupView;
|
1348
1350
|
curGroupLevel = groupView.getGroupLevel();
|
1349
1351
|
|
1350
1352
|
arg.footerIndex = groupView.getFooterRowIndex(rowId);
|
1351
|
-
|
1353
|
+
footerRow = arg.footerRow = (arg.footerIndex >= 0);
|
1352
1354
|
arg.groupId = groupView.getGroupId();
|
1353
1355
|
arg.dataSource = groupView;
|
1354
1356
|
arg.collapsed = groupView.isCollapsed();
|
@@ -1387,8 +1389,8 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1387
1389
|
|
1388
1390
|
arg.groupLevel = curGroupLevel;
|
1389
1391
|
|
1390
|
-
|
1391
|
-
|
1392
|
+
let rowLevel = 0;
|
1393
|
+
let nonGroupRow = this._autoGroupHiding && currentGroup.getGroupValue() == null && curGroupLevel === 1 && !this._contentAsHeader;
|
1392
1394
|
arg.nonGroupRow = nonGroupRow;
|
1393
1395
|
|
1394
1396
|
if (arg.noIndent || nonGroupRow) { // if user specific indent level, and if group hidden
|
@@ -1399,11 +1401,11 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1399
1401
|
rowLevel = curGroupLevel + indentOffset; // content have indent more than header 1
|
1400
1402
|
}
|
1401
1403
|
|
1402
|
-
|
1404
|
+
let indentSize = 0;
|
1403
1405
|
if(this._indentSizes) {
|
1404
1406
|
indentSize = this._indentSizes[0];
|
1405
1407
|
if(rowLevel > 0) {
|
1406
|
-
|
1408
|
+
let indentLimit = this._indentSizes.length;
|
1407
1409
|
indentSize = rowLevel < indentLimit ? this._indentSizes[rowLevel] : this._indentSizes[indentLimit - 1];
|
1408
1410
|
}
|
1409
1411
|
} else if(rowLevel > 0) {
|
@@ -1416,19 +1418,19 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1416
1418
|
indentSize = maxColWidth;
|
1417
1419
|
}
|
1418
1420
|
|
1419
|
-
|
1421
|
+
let groupColor;
|
1420
1422
|
if(currentGroup.getGroupColor) {
|
1421
1423
|
groupColor = currentGroup.getGroupColor();
|
1422
1424
|
} else { // Backward compatibility
|
1423
1425
|
if (this._groupColors) {
|
1424
1426
|
// TODO: Need better method to find the first level parent's group id
|
1425
|
-
|
1427
|
+
let rootGroup = currentGroup ? currentGroup : dataSource.getGroup(rowId); // Slow
|
1426
1428
|
if (curGroupLevel > 1) {
|
1427
|
-
for (
|
1429
|
+
for (let i = curGroupLevel; i > 1; i--) {
|
1428
1430
|
rootGroup = rootGroup.getDataSource();
|
1429
1431
|
}
|
1430
1432
|
}
|
1431
|
-
|
1433
|
+
let groupId = rootGroup.getGroupId();
|
1432
1434
|
groupColor = this._groupColors[groupId];
|
1433
1435
|
}
|
1434
1436
|
}
|
@@ -1457,13 +1459,13 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1457
1459
|
RowGroupingPlugin.prototype._getRowsForContentAsHeader = function () {
|
1458
1460
|
if (!this._contentAsHeader) return {};
|
1459
1461
|
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
for (
|
1464
|
-
|
1462
|
+
let result = {};
|
1463
|
+
let dv = this.getDataView();
|
1464
|
+
let allGroups = dv.getAllGroups();
|
1465
|
+
for (let grpId in allGroups) {
|
1466
|
+
let grp = allGroups[grpId];
|
1465
1467
|
if (!grp.hasGroup()) { // Deepest level group
|
1466
|
-
|
1468
|
+
let firstRowId = grp.getAllRowIds(true)[0]; // Prepare first row in group for contentAsHeader mode to use.
|
1467
1469
|
if (firstRowId) {
|
1468
1470
|
result[firstRowId] = grp;
|
1469
1471
|
}
|
@@ -1493,13 +1495,13 @@ RowGroupingPlugin.prototype._onColumnIndexChanged = function (e) {
|
|
1493
1495
|
RowGroupingPlugin.prototype.updateHeaders = function () {
|
1494
1496
|
this._timerId = 0;
|
1495
1497
|
this._shouldUpdateDisplayColumn = true;
|
1496
|
-
|
1498
|
+
let host = this._hosts[0];
|
1497
1499
|
if (!host || this._disabled) {
|
1498
1500
|
return;
|
1499
1501
|
}
|
1500
1502
|
|
1501
|
-
|
1502
|
-
for (
|
1503
|
+
let settingList = host.getAllSectionSettings("content");
|
1504
|
+
for (let i = settingList.length; --i >= 0;) {
|
1503
1505
|
this._updateHeader(settingList[i]);
|
1504
1506
|
}
|
1505
1507
|
};
|
@@ -1509,10 +1511,10 @@ RowGroupingPlugin.prototype.updateHeaders = function () {
|
|
1509
1511
|
* @param {boolean=} opt_collapsed=true
|
1510
1512
|
*/
|
1511
1513
|
RowGroupingPlugin.prototype._collapseDataRowId = function (rowId, opt_collapsed) {
|
1512
|
-
|
1514
|
+
let dv = this.getDataView();
|
1513
1515
|
if (dv) {
|
1514
|
-
|
1515
|
-
|
1516
|
+
let rowsForContentHeader = this._getRowsForContentAsHeader();
|
1517
|
+
let grp = rowsForContentHeader[rowId];
|
1516
1518
|
if (grp) {
|
1517
1519
|
grp.collapse(opt_collapsed);
|
1518
1520
|
}
|
@@ -1525,21 +1527,21 @@ RowGroupingPlugin.prototype._collapseDataRowId = function (rowId, opt_collapsed)
|
|
1525
1527
|
RowGroupingPlugin.prototype._onCellClicked = function (e) {
|
1526
1528
|
if (this._clickDisabled) { return; }
|
1527
1529
|
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1530
|
+
let changed = false;
|
1531
|
+
let host = this._hosts[0];
|
1532
|
+
let info = host.getRelativePosition(e);
|
1533
|
+
let cellElem = info.cell ? info.cell.getElement() : null;
|
1532
1534
|
if(!cellElem) {
|
1533
1535
|
return;
|
1534
1536
|
}
|
1535
1537
|
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1538
|
+
let collapsed = cellElem.classList.contains("closed");
|
1539
|
+
let rowIndex = info.rowIndex;
|
1540
|
+
let settings = info.sectionSettings;
|
1539
1541
|
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1542
|
+
let dv = settings.getDataSource();
|
1543
|
+
let rowId = dv.getRowId(rowIndex);
|
1544
|
+
let grpView = dv.getGroupByRowId(rowId);
|
1543
1545
|
if (grpView) {
|
1544
1546
|
changed = true;
|
1545
1547
|
if(grpView.isCollapsible && !grpView.isCollapsible()) { // Prevent applied styles
|
@@ -1565,10 +1567,10 @@ RowGroupingPlugin.prototype._onCellClicked = function (e) {
|
|
1565
1567
|
|
1566
1568
|
/** @private */
|
1567
1569
|
RowGroupingPlugin.prototype._updateCursor = function () {
|
1568
|
-
|
1570
|
+
let host = this._hosts[0]; // TODO: Make this work for multi-table
|
1569
1571
|
if (host) {
|
1570
|
-
|
1571
|
-
|
1572
|
+
let disableExpander = false;
|
1573
|
+
let disableFolder = false;
|
1572
1574
|
if (!this._clickableCell) {
|
1573
1575
|
disableFolder = true;
|
1574
1576
|
}
|
@@ -1612,7 +1614,7 @@ RowGroupingPlugin.prototype.expandAll = function (opt_expanded) {
|
|
1612
1614
|
* @param {boolean=} opt_collapsed
|
1613
1615
|
*/
|
1614
1616
|
RowGroupingPlugin.prototype.collapseAll = function (opt_collapsed) {
|
1615
|
-
|
1617
|
+
let dv = this.getDataView();
|
1616
1618
|
if (dv) {
|
1617
1619
|
dv.collapseAllGroups(opt_collapsed);
|
1618
1620
|
}
|
@@ -1630,9 +1632,9 @@ RowGroupingPlugin.prototype.expand = function (groupRowId, opt_expanded) {
|
|
1630
1632
|
* @param {boolean=} opt_collapsed
|
1631
1633
|
*/
|
1632
1634
|
RowGroupingPlugin.prototype.collapse = function (groupRowId, opt_collapsed) {
|
1633
|
-
|
1635
|
+
let dv = this.getDataView();
|
1634
1636
|
if (dv) {
|
1635
|
-
|
1637
|
+
let grp = dv.getGroup(groupRowId);
|
1636
1638
|
if (grp) {
|
1637
1639
|
grp.collapse(opt_collapsed);
|
1638
1640
|
}
|
@@ -1652,7 +1654,7 @@ RowGroupingPlugin.prototype.disableClicking = function (opt_disabled) {
|
|
1652
1654
|
* @returns {Array.<RowGroupingPlugin~GroupingState>}
|
1653
1655
|
*/
|
1654
1656
|
RowGroupingPlugin.prototype.getGroupingStates = function () {
|
1655
|
-
|
1657
|
+
let dv = this.getDataView();
|
1656
1658
|
|
1657
1659
|
return dv.getAllGroups().map(function (group) {
|
1658
1660
|
return {
|
@@ -1671,9 +1673,9 @@ RowGroupingPlugin.prototype.setGroupingStates = function (states) {
|
|
1671
1673
|
states = JSON.parse(states);
|
1672
1674
|
}
|
1673
1675
|
|
1674
|
-
for (
|
1675
|
-
|
1676
|
-
|
1676
|
+
for (let i = 0; i < states.length; i++) {
|
1677
|
+
let state = states[i];
|
1678
|
+
let groupRowId = state.groupId == null ? i : state.groupId;
|
1677
1679
|
this.collapse(groupRowId, state.collapsed);
|
1678
1680
|
}
|
1679
1681
|
};
|