@refinitiv-ui/efx-grid 6.0.18 → 6.0.19
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-format-dialog/themes/elemental/dark/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/elemental/light/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/halo/dark/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/halo/light/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/luna/default/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/luna/default/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/solar/charcoal/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/column-format-dialog/themes/solar/pearl/column-format-dialog.js +1 -1
- package/lib/column-format-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/core/dist/core.js +40 -23
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +4 -0
- package/lib/core/es6/data/DataView.js +19 -1
- package/lib/core/es6/data/SegmentCollection.js +20 -8
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/components/Cell.js +0 -13
- package/lib/filter-dialog/lib/filter-dialog.js +149 -131
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +22 -23
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +63 -12
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +70 -110
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +1 -1
- package/lib/tr-grid-filter-input/es6/FilterInput.js +10 -9
- package/lib/tr-grid-pagination/es6/Pagination.d.ts +1 -0
- package/lib/tr-grid-pagination/es6/Pagination.js +35 -29
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +5 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +30 -0
- package/lib/tr-grid-util/es6/Popup.js +5 -1
- package/lib/types/es6/Core/data/DataView.d.ts +4 -0
- package/lib/types/es6/FilterInput.d.ts +1 -0
- package/lib/types/es6/Pagination.d.ts +1 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
- package/lib/versions.json +8 -8
- package/package.json +1 -1
@@ -924,12 +924,12 @@ CheckboxPlugin.prototype._getCheckboxValue = function (dv, rowId) {
|
|
924
924
|
};
|
925
925
|
/** @private
|
926
926
|
* @param {Object} dv DataView
|
927
|
-
* @return {string} state
|
927
|
+
* @return {Array.<string>} state
|
928
928
|
*/
|
929
|
-
CheckboxPlugin.prototype.
|
930
|
-
|
929
|
+
CheckboxPlugin.prototype._getRowMemberIds = function (dv) {
|
930
|
+
var rowIds = [];
|
931
|
+
if (!dv) return rowIds;
|
931
932
|
|
932
|
-
var rowIds;
|
933
933
|
if (dv.getGroupLevel && 0 === dv.getGroupLevel()) {
|
934
934
|
// case root group we check state from member that visible in view
|
935
935
|
rowIds = this._getRowMemberIdsInView(dv);
|
@@ -937,6 +937,16 @@ CheckboxPlugin.prototype._getGroupState = function (dv) {
|
|
937
937
|
// case dataTable or subGroup we check state from member in group
|
938
938
|
rowIds = dv.getAllRowIds(true); // Getting shallow copy and excluding header rows
|
939
939
|
}
|
940
|
+
return rowIds;
|
941
|
+
};
|
942
|
+
/** @private
|
943
|
+
* @param {Object} dv DataView
|
944
|
+
* @return {string} state
|
945
|
+
*/
|
946
|
+
CheckboxPlugin.prototype._getGroupState = function (dv) {
|
947
|
+
if (!dv) return "unchecked";
|
948
|
+
|
949
|
+
var rowIds = this._getRowMemberIds(dv);
|
940
950
|
|
941
951
|
var dataRows = dv.getMultipleRowData(rowIds);
|
942
952
|
var len = rowIds.length;
|
@@ -955,6 +965,28 @@ CheckboxPlugin.prototype._getGroupState = function (dv) {
|
|
955
965
|
return CheckboxPlugin._mergeStates(states);
|
956
966
|
};
|
957
967
|
/** @private
|
968
|
+
* @param {Object} dv DataView
|
969
|
+
* @return {boolean} state
|
970
|
+
*/
|
971
|
+
CheckboxPlugin.prototype._getGroupDisabledState = function (dv) {
|
972
|
+
if (!dv) return false;
|
973
|
+
|
974
|
+
var rowIds = this._getRowMemberIds(dv);
|
975
|
+
var len = rowIds.length;
|
976
|
+
if (!len) return true;
|
977
|
+
|
978
|
+
var disabled = true;
|
979
|
+
for(var i = 0; i < len; ++i) {
|
980
|
+
var rid = rowIds[i];
|
981
|
+
var dataRow = this._getRowFromId(dv, rid);
|
982
|
+
if (!dataRow[this._disablingField]) {
|
983
|
+
disabled = false;
|
984
|
+
break;
|
985
|
+
}
|
986
|
+
}
|
987
|
+
return disabled;
|
988
|
+
};
|
989
|
+
/** @private
|
958
990
|
* @param {Object} sectionSettings Grid sectionSettings object
|
959
991
|
* @return {string}
|
960
992
|
*/
|
@@ -1025,11 +1057,14 @@ CheckboxPlugin.prototype._setDescendantCheckState = function (sectionSettings, s
|
|
1025
1057
|
/** @private
|
1026
1058
|
* @param {Object} sectionSettings Grid sectionSettings object
|
1027
1059
|
* @param {string=} callerState
|
1060
|
+
* @param {Object=} dv DataView
|
1028
1061
|
*/
|
1029
|
-
CheckboxPlugin.prototype.
|
1062
|
+
CheckboxPlugin.prototype._syncAscendantState = function (sectionSettings, callerState, dv) {
|
1030
1063
|
var parent = sectionSettings.getParent();
|
1031
|
-
|
1064
|
+
var host = this._hosts[0];
|
1065
|
+
if (!host || !parent || !parent.getSection().isVisible()) { return; }
|
1032
1066
|
|
1067
|
+
var i;
|
1033
1068
|
var state = callerState || "";
|
1034
1069
|
if (state !== "partial") {
|
1035
1070
|
if(!callerState) {
|
@@ -1038,7 +1073,7 @@ CheckboxPlugin.prototype._syncAscendantCheckState = function (sectionSettings, c
|
|
1038
1073
|
|
1039
1074
|
var children = parent.getChildren();
|
1040
1075
|
if(children) {
|
1041
|
-
for (
|
1076
|
+
for (i = children.length; --i >= 0; ) {
|
1042
1077
|
var child = children[i];
|
1043
1078
|
if (child !== sectionSettings) {
|
1044
1079
|
var childState = this._getSectionState(child);
|
@@ -1051,10 +1086,24 @@ CheckboxPlugin.prototype._syncAscendantCheckState = function (sectionSettings, c
|
|
1051
1086
|
}
|
1052
1087
|
}
|
1053
1088
|
|
1089
|
+
// sync disable status to header checkbox
|
1090
|
+
if(dv) {
|
1091
|
+
var titleSection = host.getSectionSettings("title");
|
1092
|
+
var disabled = this._getGroupDisabledState(dv);
|
1093
|
+
var checkboxes = this._getAllCheckboxes(titleSection);
|
1094
|
+
for(i = 0; i < checkboxes.length; i++){
|
1095
|
+
var checkbox = checkboxes[i];
|
1096
|
+
if(disabled) {
|
1097
|
+
checkbox.setAttribute("disabled", "");
|
1098
|
+
} else {
|
1099
|
+
checkbox.removeAttribute("disabled");
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
|
1054
1104
|
this._setSectionState(parent, state);
|
1055
|
-
this.
|
1105
|
+
this._syncAscendantState(parent, state);
|
1056
1106
|
};
|
1057
|
-
|
1058
1107
|
/** @private
|
1059
1108
|
* @param {Object} sectionSettings Grid sectionSettings object
|
1060
1109
|
* @param {string} state
|
@@ -1288,7 +1337,7 @@ CheckboxPlugin.prototype._onCheckboxClicked = function (e) {
|
|
1288
1337
|
}
|
1289
1338
|
|
1290
1339
|
this._setDescendantCheckState(sectionSettings, newState); // This only works with root section where root UI is linked with its children section.
|
1291
|
-
this.
|
1340
|
+
this._syncAscendantState(sectionSettings); // The clicked row may be a member of row group and thus the state has to be calculated
|
1292
1341
|
|
1293
1342
|
if (this.hasListener("clicked")) {
|
1294
1343
|
pos["checkbox"] = chkbox;
|
@@ -1498,7 +1547,9 @@ CheckboxPlugin.prototype._onPostSectionDataBinding = function (e) {
|
|
1498
1547
|
state = CheckboxPlugin._toCheckState(rowData[this._checkboxField]);
|
1499
1548
|
disabled = rowData[this._disablingField] === true;
|
1500
1549
|
} else { // Group header row has no rowData
|
1501
|
-
|
1550
|
+
var groupSetting = dv.getGroupByRowId(rowId);
|
1551
|
+
disabled = this._getGroupDisabledState(groupSetting);
|
1552
|
+
state = disabled ? "unchecked" : this._getGroupState(groupSetting);
|
1502
1553
|
}
|
1503
1554
|
if (this._autoRowSelection) {
|
1504
1555
|
section.setSelectedRow(rowIndex, (rowData || false) && state === "checked");
|
@@ -1514,7 +1565,7 @@ CheckboxPlugin.prototype._onPostSectionDataBinding = function (e) {
|
|
1514
1565
|
}
|
1515
1566
|
}
|
1516
1567
|
|
1517
|
-
this.
|
1568
|
+
this._syncAscendantState(e["sectionSettings"], null, dv);
|
1518
1569
|
};
|
1519
1570
|
|
1520
1571
|
|
@@ -87,6 +87,14 @@ ColumnGroupingPlugin.prototype._addingTimerId = 0;
|
|
87
87
|
*/
|
88
88
|
ColumnGroupingPlugin.prototype._addingEvents = null;
|
89
89
|
|
90
|
+
/** @private
|
91
|
+
* @param {number} a
|
92
|
+
* @param {number} b
|
93
|
+
* @return {number}
|
94
|
+
*/
|
95
|
+
ColumnGroupingPlugin._ascSortLogic = function (a, b) {
|
96
|
+
return a - b;
|
97
|
+
};
|
90
98
|
/** @private
|
91
99
|
* @param {ColumnGroupingPlugin~GroupDefinition} groupingOptions
|
92
100
|
* @return {string}
|
@@ -614,23 +622,29 @@ ColumnGroupingPlugin.prototype._spanGroupVertically = function (titleSection) {
|
|
614
622
|
*/
|
615
623
|
ColumnGroupingPlugin.prototype._spanGroupHorizontally = function (titleSection) {
|
616
624
|
var section = titleSection;
|
617
|
-
var
|
625
|
+
var visibleGroupMap = this._visibleGroupMap;
|
618
626
|
|
619
627
|
// Span column of column group
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
var end = spanIndexes[1];
|
630
|
-
section.setCellColSpan(start, node["onRow"], end - start + 1);
|
631
|
-
node["colIndex"] = start;
|
628
|
+
var groupDef, spanIndices, len, colIds, index, i;
|
629
|
+
for (var id in visibleGroupMap) {
|
630
|
+
spanIndices = [];
|
631
|
+
groupDef = visibleGroupMap[id];
|
632
|
+
colIds = this._getGroupMembers(visibleGroupMap, groupDef);
|
633
|
+
for (i = 0; i < colIds.length; i++) {
|
634
|
+
index = this._getColumnIndexById(colIds[i]);
|
635
|
+
if (index > -1) {
|
636
|
+
spanIndices.push(index);
|
632
637
|
}
|
633
638
|
}
|
639
|
+
spanIndices.sort(ColumnGroupingPlugin._ascSortLogic);
|
640
|
+
len = spanIndices.length;
|
641
|
+
if (len > 0) {
|
642
|
+
// This could be unnecessary
|
643
|
+
var start = spanIndices[0];
|
644
|
+
var end = spanIndices[len - 1];
|
645
|
+
section.setCellColSpan(start, groupDef["onRow"], end - start + 1);
|
646
|
+
groupDef["colIndex"] = start;
|
647
|
+
}
|
634
648
|
}
|
635
649
|
};
|
636
650
|
/** @private
|
@@ -647,6 +661,9 @@ ColumnGroupingPlugin.prototype._renderGroups = function () {
|
|
647
661
|
for (var id in groupMap) {
|
648
662
|
var node = groupMap[id];
|
649
663
|
var colIndex = node["colIndex"];
|
664
|
+
if (colIndex == null) {
|
665
|
+
continue;
|
666
|
+
}
|
650
667
|
var rowIndex = node["onRow"];
|
651
668
|
var cell = section.getCell(colIndex, rowIndex);
|
652
669
|
if (cell) {
|
@@ -823,7 +840,7 @@ ColumnGroupingPlugin.prototype._onColumnRemoved = function (e) {
|
|
823
840
|
* @param {Object} e
|
824
841
|
*/
|
825
842
|
ColumnGroupingPlugin.prototype._onBeforeColumnBoundUpdate = function (e) {
|
826
|
-
var selectedColumns = e.selectedColumns;
|
843
|
+
var selectedColumns = e.selectedColumns; // Hidden columns are included
|
827
844
|
var parentMap = this._childToParent;
|
828
845
|
|
829
846
|
// Find non-grouped column
|
@@ -872,7 +889,7 @@ ColumnGroupingPlugin.prototype._onBeforeColumnBoundUpdate = function (e) {
|
|
872
889
|
for (groupId in findingGroup) {
|
873
890
|
group = findingGroup[groupId];
|
874
891
|
allSelected = true;
|
875
|
-
members = this._getGroupMembers(group);
|
892
|
+
members = this._getGroupMembers(this._groupMap, group);
|
876
893
|
if (members.length <= colIds.length) {
|
877
894
|
for (n = 0; n < members.length; n++) {
|
878
895
|
if (colIds.indexOf(members[n]) < 0) {
|
@@ -1081,7 +1098,7 @@ ColumnGroupingPlugin.prototype.getGroupChildren = function (groupId) {
|
|
1081
1098
|
ColumnGroupingPlugin.prototype.getChildColumnIndices = function (groupId) {
|
1082
1099
|
var group = this._groupMap[groupId];
|
1083
1100
|
if (group) {
|
1084
|
-
var colIds = this._getGroupMembers(group);
|
1101
|
+
var colIds = this._getGroupMembers(this._groupMap, group);
|
1085
1102
|
var colIndices = [];
|
1086
1103
|
var index;
|
1087
1104
|
for (var i = 0; i < colIds.length; i++) {
|
@@ -1090,7 +1107,7 @@ ColumnGroupingPlugin.prototype.getChildColumnIndices = function (groupId) {
|
|
1090
1107
|
colIndices.push(index);
|
1091
1108
|
}
|
1092
1109
|
}
|
1093
|
-
return colIndices.sort();
|
1110
|
+
return colIndices.sort(ColumnGroupingPlugin._ascSortLogic);
|
1094
1111
|
}
|
1095
1112
|
return null;
|
1096
1113
|
};
|
@@ -1145,22 +1162,26 @@ ColumnGroupingPlugin.prototype.getGroupLevel = function (groupId) {
|
|
1145
1162
|
};
|
1146
1163
|
|
1147
1164
|
/** @private
|
1165
|
+
* @param {Object.<string, ColumnGroupingPlugin~GroupDefinition>} groupMap
|
1148
1166
|
* @param {ColumnGroupingPlugin~GroupDefinition} group Group definition
|
1149
1167
|
* @param {Array=} members
|
1150
1168
|
* @return {Array.<string>}
|
1151
1169
|
*/
|
1152
|
-
ColumnGroupingPlugin.prototype._getGroupMembers = function (group, members) {
|
1170
|
+
ColumnGroupingPlugin.prototype._getGroupMembers = function (groupMap, group, members) {
|
1153
1171
|
if (!members) {
|
1154
1172
|
members = [];
|
1155
1173
|
}
|
1156
1174
|
var children = group.children;
|
1157
|
-
var groupMap = this._groupMap;
|
1158
1175
|
var g, id;
|
1159
1176
|
for (var i = 0; i < children.length; i++) {
|
1160
1177
|
id = children[i];
|
1178
|
+
if (id === group.id) {
|
1179
|
+
// prevent from infinite loop
|
1180
|
+
continue;
|
1181
|
+
}
|
1161
1182
|
g = groupMap[id];
|
1162
1183
|
if (g) {
|
1163
|
-
this._getGroupMembers(g, members);
|
1184
|
+
this._getGroupMembers(groupMap, g, members);
|
1164
1185
|
} else {
|
1165
1186
|
members.push(id);
|
1166
1187
|
}
|
@@ -1201,79 +1222,6 @@ ColumnGroupingPlugin.prototype._getColumnIndexById = function (id) {
|
|
1201
1222
|
}
|
1202
1223
|
return -1;
|
1203
1224
|
};
|
1204
|
-
/** @private
|
1205
|
-
* @param {Object} node
|
1206
|
-
* @param {Array} cluster
|
1207
|
-
*/
|
1208
|
-
ColumnGroupingPlugin.prototype._findColumnIndexArr = function (node, cluster) {
|
1209
|
-
if (node) {
|
1210
|
-
var childrens = node.children;
|
1211
|
-
if (childrens && childrens.length) {
|
1212
|
-
for (var i = 0; i < childrens.length; i++) {
|
1213
|
-
var child = childrens[i];
|
1214
|
-
if (!child.id) {
|
1215
|
-
if (!this._visibleGroupMap[child]) {
|
1216
|
-
var colIndex = this._getColumnIndexById(child);
|
1217
|
-
if (colIndex !== -1) {
|
1218
|
-
cluster.push(colIndex);
|
1219
|
-
}
|
1220
|
-
} else {
|
1221
|
-
this._findColumnIndexArr(this._visibleGroupMap[child], cluster);
|
1222
|
-
}
|
1223
|
-
} else {
|
1224
|
-
// skip children that has same id as parent
|
1225
|
-
if (child.id === node.id) {
|
1226
|
-
return;
|
1227
|
-
}
|
1228
|
-
this._findColumnIndexArr(this._visibleGroupMap[child.id], cluster);
|
1229
|
-
}
|
1230
|
-
}
|
1231
|
-
}
|
1232
|
-
}
|
1233
|
-
};
|
1234
|
-
/** @private
|
1235
|
-
* @param {Object} node
|
1236
|
-
* @return {Array} group of span index
|
1237
|
-
*/
|
1238
|
-
ColumnGroupingPlugin.prototype._findColumnSpans = function (node) {
|
1239
|
-
var cluster = [];
|
1240
|
-
this._findColumnIndexArr(node, cluster); // Recursively get column index
|
1241
|
-
|
1242
|
-
return ColumnGroupingPlugin._groupConsecutiveArr(cluster);
|
1243
|
-
};
|
1244
|
-
/** @private
|
1245
|
-
* @param {Array} arr
|
1246
|
-
* @return {Array} group of Consecutive number
|
1247
|
-
*/
|
1248
|
-
ColumnGroupingPlugin._groupConsecutiveArr = function (arr) {
|
1249
|
-
var result = [];
|
1250
|
-
if (!arr || !arr.length) {
|
1251
|
-
return result;
|
1252
|
-
}
|
1253
|
-
var array = arr.sort(function (a, b) {
|
1254
|
-
return a - b;
|
1255
|
-
});
|
1256
|
-
var start = array[0];
|
1257
|
-
var stop = start;
|
1258
|
-
// start at second member of array
|
1259
|
-
for (var i = 1; i <= array.length; i++) {
|
1260
|
-
var next = array[i];
|
1261
|
-
if (next === stop + 1) {
|
1262
|
-
// move to next member
|
1263
|
-
stop = next;
|
1264
|
-
} else {
|
1265
|
-
if (start === stop) {
|
1266
|
-
result.push([start, start]);
|
1267
|
-
} else {
|
1268
|
-
result.push([start, stop]);
|
1269
|
-
}
|
1270
|
-
// reset the start and stop pointers
|
1271
|
-
start = array[i];
|
1272
|
-
stop = start;
|
1273
|
-
}
|
1274
|
-
}
|
1275
|
-
return result;
|
1276
|
-
};
|
1277
1225
|
/** This method modifies the group definition and outdates the group structure. It is necessary to recalculate group structure manually.
|
1278
1226
|
* @private
|
1279
1227
|
* @param {string} childId
|
@@ -1354,17 +1302,12 @@ ColumnGroupingPlugin.prototype.getCellInfo = function (e) {
|
|
1354
1302
|
return cellInfo;
|
1355
1303
|
};
|
1356
1304
|
/** @public
|
1357
|
-
* @param {number|string} colRef
|
1305
|
+
* @param {number|string} colRef Column index or id that should be moved
|
1358
1306
|
* @param {number} to
|
1359
1307
|
* @param {string} groupId
|
1360
1308
|
*/
|
1361
1309
|
ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, groupId) {
|
1362
|
-
var fromIndex =
|
1363
|
-
if (typeof colRef == "string") {
|
1364
|
-
fromIndex = this._getColumnIndexById(colRef);
|
1365
|
-
} else {
|
1366
|
-
fromIndex = colRef;
|
1367
|
-
}
|
1310
|
+
var fromIndex = this.getColumnIndex(colRef);
|
1368
1311
|
if (fromIndex == -1) {
|
1369
1312
|
return;
|
1370
1313
|
}
|
@@ -1382,6 +1325,9 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1382
1325
|
if (childIndices && childIndices.length) {
|
1383
1326
|
startIndex = childIndices[0];
|
1384
1327
|
endIndex = childIndices[childIndices.length - 1];
|
1328
|
+
} else {
|
1329
|
+
startIndex = 0;
|
1330
|
+
endIndex = this.getColumnCount();
|
1385
1331
|
}
|
1386
1332
|
if (to < startIndex) {
|
1387
1333
|
to = startIndex;
|
@@ -1397,20 +1343,21 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1397
1343
|
}
|
1398
1344
|
}
|
1399
1345
|
|
1400
|
-
//
|
1346
|
+
// Calculate left and right bound of the group, which column can be moved to.
|
1347
|
+
// destination should be between the bound, and it should not be placed between columns in child group
|
1401
1348
|
for (var i = 0; i < groupDef.children.length; i++) {
|
1402
1349
|
var notAllowIndices = this.getChildColumnIndices(groupDef.children[i]);
|
1403
1350
|
if (notAllowIndices && notAllowIndices.length) {
|
1404
|
-
var
|
1405
|
-
var
|
1351
|
+
var leftLimit = notAllowIndices[0];
|
1352
|
+
var rightLimit = notAllowIndices[notAllowIndices.length - 1];
|
1406
1353
|
if (to > fromIndex) {
|
1407
|
-
|
1354
|
+
leftLimit -= 1;
|
1408
1355
|
}
|
1409
1356
|
if (to < fromIndex) {
|
1410
|
-
|
1357
|
+
rightLimit += 1;
|
1411
1358
|
}
|
1412
|
-
if (to >
|
1413
|
-
to =
|
1359
|
+
if (to > leftLimit && to < rightLimit) {
|
1360
|
+
to = rightLimit;
|
1414
1361
|
}
|
1415
1362
|
}
|
1416
1363
|
}
|
@@ -1426,7 +1373,10 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1426
1373
|
var previousGroup = this._childToParent[colId];
|
1427
1374
|
if (previousGroup) {
|
1428
1375
|
var previousGroupChild = this.getGroupChildren(previousGroup);
|
1429
|
-
previousGroupChild.
|
1376
|
+
var removeIndex = previousGroupChild.indexOf(colId);
|
1377
|
+
if (removeIndex !== -1) {
|
1378
|
+
previousGroupChild.splice(previousGroupChild.indexOf(colId), 1);
|
1379
|
+
}
|
1430
1380
|
this.setGroupChildren(previousGroup, previousGroupChild);
|
1431
1381
|
}
|
1432
1382
|
|
@@ -1439,7 +1389,7 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1439
1389
|
}
|
1440
1390
|
};
|
1441
1391
|
/** @public
|
1442
|
-
* @param {number|string} colRef
|
1392
|
+
* @param {number|string} colRef Column index or id that should be moved
|
1443
1393
|
* @param {string} groupId
|
1444
1394
|
*/
|
1445
1395
|
ColumnGroupingPlugin.prototype.setColumnParent = function (colRef, groupId) {
|
@@ -1449,7 +1399,17 @@ ColumnGroupingPlugin.prototype.setColumnParent = function (colRef, groupId) {
|
|
1449
1399
|
}
|
1450
1400
|
var grid = this._hosts[0];
|
1451
1401
|
var colCount = grid.getColumnCount();
|
1452
|
-
|
1402
|
+
var toIndex = -1;
|
1403
|
+
var childIndices = this.getChildColumnIndices(groupId);
|
1404
|
+
|
1405
|
+
// When group has at least one child, move column to last index within a group
|
1406
|
+
// Otherwise, column will not be moved
|
1407
|
+
if (childIndices && childIndices.length) {
|
1408
|
+
toIndex = colCount;
|
1409
|
+
} else {
|
1410
|
+
toIndex = this.getColumnIndex(colRef);
|
1411
|
+
}
|
1412
|
+
this.moveColumnIntoGroup(colRef, toIndex, groupId);
|
1453
1413
|
};
|
1454
1414
|
export default ColumnGroupingPlugin;
|
1455
1415
|
export { ColumnGroupingPlugin, ColumnGroupingPlugin as ColumnGrouping, ColumnGroupingPlugin as ColumnGroupingExtension };
|
@@ -16,7 +16,7 @@ import { CoralItems } from '../../tr-grid-util/es6/CoralItems.js';
|
|
16
16
|
* @property {string=} placeholder="" Placeholder text inside the input
|
17
17
|
* @property {string=} type="text" Type of UI. Available types are "number", "select", "dropdown", "date"
|
18
18
|
* @property {Array=} entries Entries of dropdown filters when type is "select"
|
19
|
-
* @property {
|
19
|
+
* @property {*=} defaultValue Default value of input filter
|
20
20
|
* @property {string=} trigger="keyup" Available types of trigger are `false | ""` (no trigger) , `"keyup"` (default) , `"enter"` (on enter key *only available for text type)
|
21
21
|
*/
|
22
22
|
|
@@ -133,12 +133,10 @@ FilterInputPlugin.prototype.initialize = function (host, options) {
|
|
133
133
|
host.listen("postDataSourceChanged", this._onPostDataSourceChanged);
|
134
134
|
host.listen("columnAdded", this._onColumnAdded);
|
135
135
|
this.config(options); // In case of lazy loading
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
this._onPostDataSourceChanged();
|
141
|
-
}
|
136
|
+
// var title = host.getSection("title");
|
137
|
+
// if(title) {
|
138
|
+
// this._onPostDataSourceChanged();
|
139
|
+
// }
|
142
140
|
};
|
143
141
|
/** @public
|
144
142
|
* @param {Object} host core grid object
|
@@ -198,7 +196,9 @@ FilterInputPlugin.prototype.beforeProcessOption = function (optionName, options)
|
|
198
196
|
|
199
197
|
|
200
198
|
FilterInputPlugin.prototype._afterInit = function () {
|
201
|
-
|
199
|
+
// Retrieve RowFilteringPlugin is async operation
|
200
|
+
// onPostDataSourceChange has logic to apply default filter, which need to be done after RowFilteringPlugin is loaded
|
201
|
+
this._requestPlugin(this._hosts[0], "RowFilteringPlugin", this._gridConfig).then(this._onRowFilteringRetrieved)["catch"](this._onRowFilteringFailed)["finally"](this._onPostDataSourceChanged);
|
202
202
|
};
|
203
203
|
/** @public
|
204
204
|
* @param {Object=} options
|
@@ -459,7 +459,8 @@ FilterInputPlugin.prototype._createColumnInputs = function (section, host) {
|
|
459
459
|
inputArgs['colId'] = this._compositeGrid.getColumnId(c);
|
460
460
|
}
|
461
461
|
|
462
|
-
this._dispatch("inputCreated", inputArgs);
|
462
|
+
this._dispatch("inputCreated", inputArgs); // To apply default filter, colOpt._filterArguments needs to be initailzed
|
463
|
+
|
463
464
|
|
464
465
|
var defaultValue = colOpt.defaultValue;
|
465
466
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
2
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
3
|
+
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
3
4
|
|
4
5
|
/** @event PaginationPlugin#pageChanged
|
5
6
|
* @description Happens after pagination was changed, next, previous, first page, last page.
|
@@ -122,8 +123,12 @@ PaginationPlugin.prototype.setElement = function(elemRef) {
|
|
122
123
|
if(len) { // Remove all existing UI resources
|
123
124
|
for(var i = 0; i < len; ++i) {
|
124
125
|
var control = this._controls[i];
|
125
|
-
|
126
|
-
|
126
|
+
if (ElfUtil.getElfVersion() < 4) {
|
127
|
+
control.removeEventListener("page-changed", this._onPageChanged);
|
128
|
+
control.removeEventListener("page-size-changed", this._onPageSizeChanged);
|
129
|
+
} else {
|
130
|
+
control.removeEventListener("value-changed", this._onPageChanged);
|
131
|
+
}
|
127
132
|
}
|
128
133
|
this._controls.length = 0;
|
129
134
|
}
|
@@ -182,11 +187,16 @@ PaginationPlugin.prototype._resolveUIs = function() {
|
|
182
187
|
|
183
188
|
for(i = this._controls.length; --i >= 0;) {
|
184
189
|
var control = this._controls[i];
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
+
if (ElfUtil.getElfVersion() < 4) {
|
191
|
+
control.totalItems = this.getTotalRows();
|
192
|
+
control.pageSize = this.getPageSize();
|
193
|
+
control.page = this.getPageIndex();
|
194
|
+
control.addEventListener("page-changed", this._onPageChanged);
|
195
|
+
control.addEventListener("page-size-changed", this._onPageSizeChanged);
|
196
|
+
} else {
|
197
|
+
control.max = this.getPageCount();
|
198
|
+
control.addEventListener("value-changed", this._onPageChanged);
|
199
|
+
}
|
190
200
|
}
|
191
201
|
};
|
192
202
|
|
@@ -270,7 +280,7 @@ PaginationPlugin.prototype._configPaging = function(options) {
|
|
270
280
|
PaginationPlugin._toNumber = function(num) {
|
271
281
|
return (typeof num === "number") ? num : parseInt(num, 10);
|
272
282
|
};
|
273
|
-
/**
|
283
|
+
/** Handle page changed from pagination element
|
274
284
|
* @private
|
275
285
|
* @param {Event} e
|
276
286
|
*/
|
@@ -288,7 +298,7 @@ PaginationPlugin.prototype._onDispatchEvent = function() {
|
|
288
298
|
this._dispatch("pageChanged", { page: this.getPageIndex() });
|
289
299
|
};
|
290
300
|
|
291
|
-
/**
|
301
|
+
/** Handle page size changed from pagination element. Usually, this method is rarely called.
|
292
302
|
* @private
|
293
303
|
* @param {Event} e
|
294
304
|
*/
|
@@ -304,8 +314,22 @@ PaginationPlugin.prototype._onPageSizeChanged = function(e) {
|
|
304
314
|
PaginationPlugin.prototype._onDataChanged = function(e) {
|
305
315
|
var len = this._controls.length;
|
306
316
|
if (len && !e.positionChangeOnly) {
|
307
|
-
|
308
|
-
|
317
|
+
var pageIndex = this.getPageIndex();
|
318
|
+
var i;
|
319
|
+
if (ElfUtil.getElfVersion() < 4) {
|
320
|
+
var totalRows = this.getTotalRows();
|
321
|
+
var pageSize = this.getPageSize();
|
322
|
+
for(i = 0; i < len; ++i) {
|
323
|
+
this._controls[i].page = pageIndex;
|
324
|
+
this._controls[i].totalItems = totalRows;
|
325
|
+
this._controls[i].pageSize = pageSize; // In ELF v3 this may fire page-changed and page-size changed
|
326
|
+
}
|
327
|
+
} else {
|
328
|
+
var lastPageIndex = this.getPageCount();
|
329
|
+
for(i = 0; i < len; ++i) {
|
330
|
+
this._controls[i].value = pageIndex;
|
331
|
+
this._controls[i].max = lastPageIndex;
|
332
|
+
}
|
309
333
|
}
|
310
334
|
}
|
311
335
|
};
|
@@ -357,9 +381,6 @@ PaginationPlugin.prototype._setPageSize = function(size) {
|
|
357
381
|
if(this._dataView) {
|
358
382
|
this._dataView.setPageSize(size);
|
359
383
|
}
|
360
|
-
for(var i = this._controls.length; --i >= 0;) {
|
361
|
-
this._controls[i].pageSize = size; // In ELF v3 this may fire page-changed and page-size changed
|
362
|
-
}
|
363
384
|
};
|
364
385
|
|
365
386
|
/** Go to specfic page
|
@@ -370,9 +391,6 @@ PaginationPlugin.prototype.setPage = function(page) {
|
|
370
391
|
if (this._dataView) {
|
371
392
|
this._dataView.setPage(page);
|
372
393
|
}
|
373
|
-
for(var i = this._controls.length; --i >= 0;) {
|
374
|
-
this._controls[i].page = page;
|
375
|
-
}
|
376
394
|
};
|
377
395
|
/** Go to specfic page
|
378
396
|
* @public
|
@@ -386,9 +404,6 @@ PaginationPlugin.prototype.goto = PaginationPlugin.prototype.setPage;
|
|
386
404
|
*/
|
387
405
|
PaginationPlugin.prototype.first = function() {
|
388
406
|
this._dataView.firstPage();
|
389
|
-
for(var i = this._controls.length; --i >= 0;) {
|
390
|
-
this._controls[i].first();
|
391
|
-
}
|
392
407
|
};
|
393
408
|
|
394
409
|
/** Control pagination go to last page
|
@@ -396,9 +411,6 @@ PaginationPlugin.prototype.first = function() {
|
|
396
411
|
*/
|
397
412
|
PaginationPlugin.prototype.last = function() {
|
398
413
|
this._dataView.lastPage();
|
399
|
-
for(var i = this._controls.length; --i >= 0;) {
|
400
|
-
this._controls[i].last();
|
401
|
-
}
|
402
414
|
};
|
403
415
|
|
404
416
|
/** Control pagination go to next page
|
@@ -406,9 +418,6 @@ PaginationPlugin.prototype.last = function() {
|
|
406
418
|
*/
|
407
419
|
PaginationPlugin.prototype.next = function() {
|
408
420
|
this._dataView.nextPage();
|
409
|
-
for(var i = this._controls.length; --i >= 0;) {
|
410
|
-
this._controls[i].next();
|
411
|
-
}
|
412
421
|
};
|
413
422
|
|
414
423
|
/** Control pagination go to previous page
|
@@ -416,9 +425,6 @@ PaginationPlugin.prototype.next = function() {
|
|
416
425
|
*/
|
417
426
|
PaginationPlugin.prototype.previous = function() {
|
418
427
|
this._dataView.previousPage();
|
419
|
-
for(var i = this._controls.length; --i >= 0;) {
|
420
|
-
this._controls[i].previous();
|
421
|
-
}
|
422
428
|
};
|
423
429
|
|
424
430
|
|
@@ -29,6 +29,7 @@ declare namespace RowGroupingPlugin {
|
|
29
29
|
colorTag?: boolean|null,
|
30
30
|
predefinedColors?: any,
|
31
31
|
groupColors?: any,
|
32
|
+
defaultCollapse?: boolean|null,
|
32
33
|
clicked?: ((...params: any[]) => any)|null,
|
33
34
|
groupAdded?: ((...params: any[]) => any)|null,
|
34
35
|
beforeGroupAdded?: ((...params: any[]) => any)|null,
|
@@ -84,6 +85,10 @@ declare class RowGroupingPlugin extends GridPlugin {
|
|
84
85
|
|
85
86
|
public setPredefinedColors(predefinedColors: any): void;
|
86
87
|
|
88
|
+
public setDefaultCollapse(collapse: boolean): void;
|
89
|
+
|
90
|
+
public getDefaultCollapse(): boolean;
|
91
|
+
|
87
92
|
public sortGroups(): void;
|
88
93
|
|
89
94
|
public updateHeaders(): void;
|