@refinitiv-ui/efx-grid 6.0.21 → 6.0.23
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +46 -24
- package/lib/core/dist/core.js +61 -14
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +11 -1
- package/lib/core/es6/grid/LayoutGrid.js +1 -0
- package/lib/core/es6/grid/components/CellSpans.d.ts +2 -0
- package/lib/core/es6/grid/components/CellSpans.js +35 -10
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +2 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +14 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +369 -90
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +21 -36
- package/lib/rt-grid/es6/FieldDefinition.d.ts +7 -1
- package/lib/rt-grid/es6/FieldDefinition.js +93 -4
- package/lib/rt-grid/es6/Grid.d.ts +4 -1
- package/lib/rt-grid/es6/Grid.js +88 -25
- package/lib/rt-grid/es6/ReferenceCounter.js +13 -2
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/RowDefinition.js +74 -8
- package/lib/rt-grid/es6/SnapshotFiller.js +1 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +5 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +228 -55
- package/lib/types/es6/ColumnGrouping.d.ts +5 -1
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +2 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -0
- package/lib/versions.json +2 -2
- package/package.json +3 -2
@@ -50,6 +50,10 @@ var RowDefinition = function(rowOptions) {
|
|
50
50
|
* @private
|
51
51
|
*/
|
52
52
|
RowDefinition._runningId = 0;
|
53
|
+
/** @type {string}
|
54
|
+
* @private
|
55
|
+
*/
|
56
|
+
RowDefinition._childDataField = "CHILD_VALUES";
|
53
57
|
//#region Private Members
|
54
58
|
/** @type {string}
|
55
59
|
* @private
|
@@ -240,7 +244,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
|
240
244
|
}
|
241
245
|
}
|
242
246
|
}
|
243
|
-
|
247
|
+
var val = rowOptions["values"];
|
248
|
+
// eslint-disable-next-line no-undefined
|
249
|
+
if(val !== undefined) {
|
250
|
+
this.setStaticRowData(val, rowOptions["fields"]);
|
251
|
+
}
|
244
252
|
};
|
245
253
|
/** @public
|
246
254
|
* @param {string} userInput
|
@@ -312,11 +320,6 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
312
320
|
obj["ric"] = val;
|
313
321
|
}
|
314
322
|
|
315
|
-
val = this._staticValues;
|
316
|
-
if(val) {
|
317
|
-
obj["values"] = cloneObject(val);
|
318
|
-
}
|
319
|
-
|
320
323
|
val = this._chainRic;
|
321
324
|
if(val) {
|
322
325
|
obj["chainRic"] = val;
|
@@ -348,6 +351,40 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
348
351
|
obj["hidden"] = val;
|
349
352
|
}
|
350
353
|
|
354
|
+
val = this._getStaticRowData();
|
355
|
+
if(val) {
|
356
|
+
obj["values"] = val;
|
357
|
+
}
|
358
|
+
|
359
|
+
// obtain the static values of constituent rows
|
360
|
+
if(this.isChain()) {
|
361
|
+
var children = this.getChildren();
|
362
|
+
if(children) {
|
363
|
+
var childValues = val ? val[RowDefinition._childDataField] : {};
|
364
|
+
if(!childValues) {
|
365
|
+
childValues = {};
|
366
|
+
}
|
367
|
+
var dirty = false;
|
368
|
+
var len = children.length;
|
369
|
+
var i, rowDef, staticValues;
|
370
|
+
for(i = 0; i < len; i++) {
|
371
|
+
rowDef = children[i];
|
372
|
+
staticValues = rowDef._getStaticRowData();
|
373
|
+
if(staticValues) {
|
374
|
+
dirty = true;
|
375
|
+
childValues[rowDef.getRic()] = staticValues;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
if(dirty) {
|
380
|
+
if(!obj["values"]) {
|
381
|
+
obj["values"] = {};
|
382
|
+
}
|
383
|
+
obj["values"][RowDefinition._childDataField] = childValues;
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
351
388
|
return obj;
|
352
389
|
};
|
353
390
|
/** Since an index chain (e.g. .FTSE) can automatically produce rows for its constituent, we need to separate rowId and dataId, so that the constituents still use the same data Id as that of its parent.
|
@@ -422,6 +459,12 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
422
459
|
}
|
423
460
|
};
|
424
461
|
/** @public
|
462
|
+
* @return {Object.<string, *>}
|
463
|
+
*/
|
464
|
+
RowDefinition.prototype._getStaticRowData = function() {
|
465
|
+
return this._staticValues ? cloneObject(this._staticValues) : null;
|
466
|
+
};
|
467
|
+
/** @public
|
425
468
|
* @param {Object.<string, *>|Array} data
|
426
469
|
* @param {Array.<string>=} opt_fields In case of the given data is an array, this param will be used for mapping index to field
|
427
470
|
*/
|
@@ -722,6 +765,22 @@ RowDefinition.deregisterFromView = function(rowIds, rowDef) {
|
|
722
765
|
rowDef._deregisterFromView(rowIds);
|
723
766
|
return rowIds;
|
724
767
|
};
|
768
|
+
/** @private
|
769
|
+
* @param {string} ric
|
770
|
+
* @return {Object}
|
771
|
+
*/
|
772
|
+
RowDefinition.prototype._getChildStaticRowData = function(ric) {
|
773
|
+
if(!this._staticValues) {
|
774
|
+
return null;
|
775
|
+
}
|
776
|
+
|
777
|
+
var childValues = this._staticValues[RowDefinition._childDataField];
|
778
|
+
if(!childValues) {
|
779
|
+
return null;
|
780
|
+
}
|
781
|
+
|
782
|
+
return childValues[ric] || null;
|
783
|
+
};
|
725
784
|
/** @public
|
726
785
|
* @ignore
|
727
786
|
* @param {string} ric
|
@@ -749,12 +808,19 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
749
808
|
|
750
809
|
var newChild = !childDef;
|
751
810
|
if(newChild) {
|
752
|
-
|
811
|
+
var rowOptions = {
|
753
812
|
"asConstituent": true,
|
754
813
|
"dataId": this._subId + ric,
|
755
814
|
"ric": ric,
|
756
815
|
"parent": this
|
757
|
-
}
|
816
|
+
};
|
817
|
+
|
818
|
+
var staticData = this._getChildStaticRowData(ric);
|
819
|
+
if(staticData) {
|
820
|
+
rowOptions["values"] = staticData;
|
821
|
+
}
|
822
|
+
|
823
|
+
childDef = new RowDefinition(rowOptions);
|
758
824
|
}
|
759
825
|
|
760
826
|
if(this._view) {
|
@@ -193,7 +193,7 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
193
193
|
var fields = [];
|
194
194
|
var timeSeriesFields = [];
|
195
195
|
for (var field in this._fields) {
|
196
|
-
if(!FieldDefinition.
|
196
|
+
if(!FieldDefinition.isTimeSeries(field)) {
|
197
197
|
fields.push(field);
|
198
198
|
} else {
|
199
199
|
timeSeriesFields.push(field);
|
@@ -48,7 +48,7 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
48
48
|
|
49
49
|
public getGroupDefinitions(): ColumnGroupingPlugin.GroupDefinitions;
|
50
50
|
|
51
|
-
public setGroupDefinition(groupId: string,
|
51
|
+
public setGroupDefinition(groupId: string, groupDef?: ColumnGroupingPlugin.GroupDefinition|null): string;
|
52
52
|
|
53
53
|
public setGroupDefinitions(groupDefs: ColumnGroupingPlugin.GroupDefinitions|null): void;
|
54
54
|
|
@@ -70,6 +70,10 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
70
70
|
|
71
71
|
public setColumnParent(colRef: number|string|null, groupId: string): void;
|
72
72
|
|
73
|
+
public getValidDestinationIndex(id: string, destCol: number|string|null): number;
|
74
|
+
|
75
|
+
public moveGroup(id: string, destCol: number|string|null): void;
|
76
|
+
|
73
77
|
}
|
74
78
|
|
75
79
|
export default ColumnGroupingPlugin;
|
@@ -74,6 +74,10 @@ ColumnGroupingPlugin.prototype._maxDepth = 0;
|
|
74
74
|
* @private
|
75
75
|
*/
|
76
76
|
ColumnGroupingPlugin.prototype._restructuring = false;
|
77
|
+
/** @type {boolean}
|
78
|
+
* @private
|
79
|
+
*/
|
80
|
+
ColumnGroupingPlugin.prototype._autoGrouping = true;
|
77
81
|
/** @type {number}
|
78
82
|
* @private
|
79
83
|
*/
|
@@ -128,6 +132,31 @@ ColumnGroupingPlugin._isValidGroup = function (groupDef) {
|
|
128
132
|
};
|
129
133
|
/** @private
|
130
134
|
* @function
|
135
|
+
* @param {Array|Object} obj
|
136
|
+
* @param {string=} groupId
|
137
|
+
* @return {ColumnGroupingPlugin~GroupDefinition}
|
138
|
+
*/
|
139
|
+
ColumnGroupingPlugin._toGroupDefinition = function (obj, groupId) {
|
140
|
+
var groupDef = null;
|
141
|
+
if (obj) {
|
142
|
+
if (Array.isArray(obj)) {
|
143
|
+
groupDef = {
|
144
|
+
children: obj
|
145
|
+
};
|
146
|
+
} else {
|
147
|
+
groupDef = ColumnGroupingPlugin._cloneObject(obj);
|
148
|
+
}
|
149
|
+
if (groupId) {
|
150
|
+
if (!groupDef.id) {
|
151
|
+
groupDef.name = groupId;
|
152
|
+
}
|
153
|
+
groupDef.id = groupId;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
return groupDef;
|
157
|
+
};
|
158
|
+
/** @private
|
159
|
+
* @function
|
131
160
|
* @param {Object} obj
|
132
161
|
* @return {Object}
|
133
162
|
*/
|
@@ -400,8 +429,8 @@ ColumnGroupingPlugin.prototype._applyGrouping = function () {
|
|
400
429
|
*/
|
401
430
|
ColumnGroupingPlugin.prototype._evaluateGroupStructure = function () {
|
402
431
|
// Clear existing group structure
|
403
|
-
var groupMap = this._groupMap = {};
|
404
|
-
var childToParent = this._childToParent = {};
|
432
|
+
var groupMap = this._groupMap = {}; // TODO: This is bad
|
433
|
+
var childToParent = this._childToParent = {}; // TODO: This is bad
|
405
434
|
var visibleGroupMap = this._visibleGroupMap = {};
|
406
435
|
this._maxDepth = -1;
|
407
436
|
|
@@ -501,7 +530,7 @@ ColumnGroupingPlugin.prototype._flattenGroupDefs = function (groupDef, groupDefs
|
|
501
530
|
}
|
502
531
|
this._flattenGroupDefs(member, groupDefs);
|
503
532
|
}
|
504
|
-
}
|
533
|
+
} // TODO: Invalid group is not flatten
|
505
534
|
}
|
506
535
|
}
|
507
536
|
};
|
@@ -813,25 +842,27 @@ ColumnGroupingPlugin.prototype._onColumnChanged = function () {
|
|
813
842
|
* @param {Object} e dispatching of columnMoved event object
|
814
843
|
*/
|
815
844
|
ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
845
|
+
if (this._autoGrouping) {
|
846
|
+
var toColIndex = e.toColIndex;
|
847
|
+
var colId = this.getColumnId(toColIndex);
|
848
|
+
var groupId = this._childToParent[colId];
|
849
|
+
if (groupId) {
|
850
|
+
var colIdLeft = this.getColumnId(toColIndex - 1);
|
851
|
+
var colIdRight = this.getColumnId(toColIndex + 1);
|
852
|
+
var groupIdLeft = this._childToParent[colIdLeft];
|
853
|
+
var groupIdRight = this._childToParent[colIdRight];
|
854
|
+
if (groupId != groupIdLeft && groupId != groupIdRight) {
|
855
|
+
// Remove column from previous group
|
856
|
+
var children = this.getGroupChildren(groupId);
|
857
|
+
var removeIndex = children.indexOf(colId);
|
858
|
+
if (removeIndex > -1) {
|
859
|
+
children.splice(removeIndex, 1);
|
860
|
+
}
|
861
|
+
this.setGroupChildren(groupId, children);
|
830
862
|
}
|
831
|
-
this.setGroupChildren(groupId, children);
|
832
863
|
}
|
864
|
+
this._applyNearestGrouping(toColIndex);
|
833
865
|
}
|
834
|
-
this._applyNearestGrouping(toColIndex);
|
835
866
|
this._requestApplyGrouping();
|
836
867
|
};
|
837
868
|
/** @private
|
@@ -956,21 +987,48 @@ ColumnGroupingPlugin.prototype.addColumnToGroup = function (column, groupId, col
|
|
956
987
|
* @param {Array.<string>} children
|
957
988
|
*/
|
958
989
|
ColumnGroupingPlugin.prototype._ungroupChildren = function (children) {
|
959
|
-
if (Array.isArray(children)
|
960
|
-
var childToParent = this._childToParent;
|
961
|
-
var groupMap = this._groupMap;
|
990
|
+
if (Array.isArray(children)) {
|
962
991
|
var len = children.length;
|
963
|
-
var
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
992
|
+
for (var i = 0; i < len; ++i) {
|
993
|
+
this._unsetParent(children[i]);
|
994
|
+
}
|
995
|
+
}
|
996
|
+
};
|
997
|
+
/** Unset parent of the specified id
|
998
|
+
* @private
|
999
|
+
* @param {string} childId
|
1000
|
+
*/
|
1001
|
+
ColumnGroupingPlugin.prototype._unsetParent = function (childId) {
|
1002
|
+
var parentId = this._childToParent[childId];
|
1003
|
+
if (parentId) {
|
1004
|
+
this._childToParent[childId] = "";
|
1005
|
+
var grpDef = this._groupMap[parentId];
|
1006
|
+
if (grpDef) {
|
1007
|
+
var chdr = grpDef.children;
|
1008
|
+
if (chdr.length) {
|
1009
|
+
var at = chdr.indexOf(childId);
|
1010
|
+
if (at >= 0) {
|
1011
|
+
chdr.splice(at, 1); // splice is slow
|
1012
|
+
}
|
1013
|
+
}
|
1014
|
+
}
|
1015
|
+
}
|
1016
|
+
};
|
1017
|
+
/** Remove all children from the specified group
|
1018
|
+
* @private
|
1019
|
+
* @param {string} grpId
|
1020
|
+
*/
|
1021
|
+
ColumnGroupingPlugin.prototype._removeAllChildren = function (grpId) {
|
1022
|
+
var grpDef = this._groupMap[grpId];
|
1023
|
+
if (grpDef) {
|
1024
|
+
var chdr = grpDef.children;
|
1025
|
+
var len = chdr.length;
|
1026
|
+
if (len) {
|
1027
|
+
grpDef.children = [];
|
1028
|
+
for (var i = 0; i < len; ++i) {
|
1029
|
+
var childId = chdr[i];
|
1030
|
+
if (this._childToParent[childId]) {
|
1031
|
+
this._childToParent[childId] = "";
|
974
1032
|
}
|
975
1033
|
}
|
976
1034
|
}
|
@@ -984,16 +1042,7 @@ ColumnGroupingPlugin.prototype._ungroupChildren = function (children) {
|
|
984
1042
|
*/
|
985
1043
|
ColumnGroupingPlugin.prototype.addGroup = function (groupDef) {
|
986
1044
|
if (ColumnGroupingPlugin._isValidGroup(groupDef)) {
|
987
|
-
|
988
|
-
if (!curDef) {
|
989
|
-
var newGroupDef = ColumnGroupingPlugin._cloneObject(groupDef);
|
990
|
-
this._ungroupChildren(newGroupDef.children);
|
991
|
-
this._groupDefs.push(newGroupDef);
|
992
|
-
this._applyGrouping();
|
993
|
-
} else {
|
994
|
-
this.setGroupDefinition(groupDef.id, groupDef);
|
995
|
-
}
|
996
|
-
return groupDef.id;
|
1045
|
+
return this.setGroupDefinition(groupDef.id, groupDef);
|
997
1046
|
}
|
998
1047
|
return "";
|
999
1048
|
};
|
@@ -1030,7 +1079,7 @@ ColumnGroupingPlugin.prototype.getGroupDefinition = function (groupId) {
|
|
1030
1079
|
if (!groupDef) {
|
1031
1080
|
return null;
|
1032
1081
|
}
|
1033
|
-
groupDef = ColumnGroupingPlugin._cloneObject(groupDef);
|
1082
|
+
groupDef = ColumnGroupingPlugin._cloneObject(groupDef); // TODO: this is slow
|
1034
1083
|
var children = this._getAvaliableChildren(groupId);
|
1035
1084
|
groupDef.children = children;
|
1036
1085
|
return groupDef;
|
@@ -1053,24 +1102,44 @@ ColumnGroupingPlugin.prototype.getGroupDefinitions = function () {
|
|
1053
1102
|
}
|
1054
1103
|
return validGroupDefs;
|
1055
1104
|
};
|
1056
|
-
/** Replace and update existing group definition.
|
1105
|
+
/** Replace and update existing group definition. New group is added if the given id has no match. Existing group will be removed of no new definition is given.
|
1057
1106
|
* @public
|
1058
1107
|
* @param {string} groupId
|
1059
|
-
* @param {ColumnGroupingPlugin~GroupDefinition}
|
1108
|
+
* @param {ColumnGroupingPlugin~GroupDefinition=} groupDef
|
1109
|
+
* @return {string} Group Id
|
1060
1110
|
*/
|
1061
|
-
ColumnGroupingPlugin.prototype.setGroupDefinition = function (groupId,
|
1111
|
+
ColumnGroupingPlugin.prototype.setGroupDefinition = function (groupId, groupDef) {
|
1062
1112
|
if (!groupId) {
|
1063
|
-
return;
|
1113
|
+
return "";
|
1064
1114
|
}
|
1065
|
-
|
1066
|
-
|
1067
|
-
newDef = ColumnGroupingPlugin._cloneObject(newDef);
|
1068
|
-
newDef.id = groupId;
|
1115
|
+
if (groupDef) {
|
1116
|
+
var newDef = ColumnGroupingPlugin._toGroupDefinition(groupDef, groupId);
|
1069
1117
|
this._ungroupChildren(newDef.children);
|
1070
|
-
var
|
1071
|
-
|
1118
|
+
var curDef = this._groupMap[groupId];
|
1119
|
+
if (curDef) {
|
1120
|
+
// Replace
|
1121
|
+
var at = this._groupDefs.indexOf(curDef);
|
1122
|
+
this._groupDefs[at] = newDef;
|
1123
|
+
} else {
|
1124
|
+
// Add
|
1125
|
+
this._groupDefs.push(newDef);
|
1126
|
+
}
|
1127
|
+
var chdr = newDef.children;
|
1128
|
+
var len = chdr.length;
|
1129
|
+
// TODO: Filter out group id
|
1130
|
+
if (len > 1) {
|
1131
|
+
var gridApi = this.getGridApi();
|
1132
|
+
if (gridApi && gridApi.reorderColumns) {
|
1133
|
+
gridApi.reorderColumns(chdr, chdr[0]); // WARNING: group id doesn't work
|
1134
|
+
}
|
1135
|
+
}
|
1136
|
+
|
1072
1137
|
this._applyGrouping();
|
1138
|
+
} else {
|
1139
|
+
// Remove
|
1140
|
+
this.removeGroup(groupId);
|
1073
1141
|
}
|
1142
|
+
return groupId;
|
1074
1143
|
};
|
1075
1144
|
/** Remove all existing group definitions and replace with the given definitions.
|
1076
1145
|
* @public
|
@@ -1128,10 +1197,11 @@ ColumnGroupingPlugin.prototype._getAvaliableChildren = function (groupId) {
|
|
1128
1197
|
for (var i = 0; i < children.length; i++) {
|
1129
1198
|
childId = children[i];
|
1130
1199
|
if (groupMap[childId] || this.getColumnIndex(childId) > -1) {
|
1131
|
-
validChildren.push(childId);
|
1200
|
+
validChildren.push(childId); // TODO: This is slow
|
1132
1201
|
}
|
1133
1202
|
}
|
1134
1203
|
}
|
1204
|
+
|
1135
1205
|
return validChildren;
|
1136
1206
|
};
|
1137
1207
|
|
@@ -1429,6 +1499,7 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1429
1499
|
host.moveColumn(fromIndex, to);
|
1430
1500
|
}
|
1431
1501
|
if (colId) {
|
1502
|
+
// TODO:
|
1432
1503
|
// Remove from current group
|
1433
1504
|
var previousGroup = this._childToParent[colId];
|
1434
1505
|
if (previousGroup) {
|
@@ -1470,5 +1541,107 @@ ColumnGroupingPlugin.prototype.setColumnParent = function (colRef, groupId) {
|
|
1470
1541
|
}
|
1471
1542
|
this.moveColumnIntoGroup(colRef, toIndex, groupId);
|
1472
1543
|
};
|
1544
|
+
|
1545
|
+
/** @public
|
1546
|
+
* Get a valid index for moving group/column to specific index
|
1547
|
+
* @param {string} id group id or column id
|
1548
|
+
* @param {number|string} destCol destination column index / id
|
1549
|
+
* @returns {number} destination index
|
1550
|
+
*/
|
1551
|
+
ColumnGroupingPlugin.prototype.getValidDestinationIndex = function (id, destCol) {
|
1552
|
+
var groupDef, parentGroupDef;
|
1553
|
+
groupDef = this._groupMap[id];
|
1554
|
+
if (groupDef) {
|
1555
|
+
parentGroupDef = this.getGroupDefinition(groupDef["parent"]);
|
1556
|
+
} else if (this.getColumnIndex(id) > -1) {
|
1557
|
+
parentGroupDef = this._getParentGroup(id);
|
1558
|
+
}
|
1559
|
+
var startIndex = -1;
|
1560
|
+
var endIndex = -1;
|
1561
|
+
var destColIndex = typeof destCol === "string" ? this.getColumnIndex(destCol) : destCol;
|
1562
|
+
if (parentGroupDef) {
|
1563
|
+
// If group/column is a child of a group, it should be move within the parent group
|
1564
|
+
var childIndices = this.getChildColumnIndices(parentGroupDef["id"]);
|
1565
|
+
if (childIndices && childIndices.length) {
|
1566
|
+
startIndex = childIndices[0];
|
1567
|
+
endIndex = childIndices[childIndices.length - 1];
|
1568
|
+
}
|
1569
|
+
if (destColIndex < startIndex && destColIndex != -1) {
|
1570
|
+
destColIndex = this.getColumnId(startIndex);
|
1571
|
+
} else if (destColIndex > endIndex || destColIndex == -1) {
|
1572
|
+
destColIndex = this.getColumnId(endIndex + 1);
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
// handle group/column should not insert between group
|
1576
|
+
var groupChildren = this.getGroupChildren(parentGroupDef["id"]);
|
1577
|
+
for (var i = 0; i < groupChildren.length; i++) {
|
1578
|
+
var childId = groupChildren[i];
|
1579
|
+
var childGroupIndices = this.getChildColumnIndices(childId);
|
1580
|
+
if (childGroupIndices && childGroupIndices.length) {
|
1581
|
+
startIndex = childGroupIndices[0];
|
1582
|
+
endIndex = childGroupIndices[childGroupIndices.length - 1];
|
1583
|
+
if (destColIndex > startIndex && destColIndex <= endIndex) {
|
1584
|
+
destColIndex = endIndex + 1;
|
1585
|
+
break;
|
1586
|
+
}
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
} else {
|
1590
|
+
// handle group/column should not insert between group when group/column is not a child of any group
|
1591
|
+
var destMemberIndices = [];
|
1592
|
+
var destColId = this.getColumnId(destColIndex);
|
1593
|
+
var destParent = this._getParentGroup(destColId);
|
1594
|
+
if (destParent) {
|
1595
|
+
if (destParent["parent"]) {
|
1596
|
+
destParent = this._getRootGroup(destParent["id"]);
|
1597
|
+
}
|
1598
|
+
destMemberIndices = this.getChildColumnIndices(destParent["id"]);
|
1599
|
+
}
|
1600
|
+
if (destMemberIndices && destMemberIndices.length) {
|
1601
|
+
startIndex = destMemberIndices[0];
|
1602
|
+
endIndex = destMemberIndices[destMemberIndices.length - 1];
|
1603
|
+
if (destColIndex > startIndex && destColIndex <= endIndex) {
|
1604
|
+
destColIndex = endIndex + 1;
|
1605
|
+
}
|
1606
|
+
}
|
1607
|
+
}
|
1608
|
+
return destColIndex;
|
1609
|
+
};
|
1610
|
+
|
1611
|
+
/** @public
|
1612
|
+
* Move group or column to left side of the destination column.
|
1613
|
+
* Group or column can only be moved within the parent group.
|
1614
|
+
* If the destination is between other column group, the destination will change to the end of that group instead.
|
1615
|
+
* @param {string} id group id or column id
|
1616
|
+
* @param {number|string} destCol destination column index / id
|
1617
|
+
*/
|
1618
|
+
ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
|
1619
|
+
var groupDef;
|
1620
|
+
var members = [];
|
1621
|
+
groupDef = this._groupMap[id];
|
1622
|
+
if (groupDef) {
|
1623
|
+
var indices = this.getChildColumnIndices(groupDef["id"]);
|
1624
|
+
for (var i = 0; i < indices.length; i++) {
|
1625
|
+
var index = indices[i];
|
1626
|
+
var colId = this.getColumnId(index);
|
1627
|
+
members.push(colId);
|
1628
|
+
}
|
1629
|
+
} else if (this.getColumnIndex(id) > -1) {
|
1630
|
+
members.push(id);
|
1631
|
+
} else {
|
1632
|
+
return;
|
1633
|
+
}
|
1634
|
+
var destColIndex = this.getValidDestinationIndex(id, destCol);
|
1635
|
+
var destColId = this.getColumnId(destColIndex);
|
1636
|
+
|
1637
|
+
// TODO: create method for toggling autoGrouping flag
|
1638
|
+
this._autoGrouping = false;
|
1639
|
+
if (this._realTimeGrid) {
|
1640
|
+
this._realTimeGrid.reorderColumns(members, destColId);
|
1641
|
+
} else if (this._compositeGrid) {
|
1642
|
+
this._compositeGrid.reorderColumns(members, destColId);
|
1643
|
+
}
|
1644
|
+
this._autoGrouping = true;
|
1645
|
+
};
|
1473
1646
|
export default ColumnGroupingPlugin;
|
1474
1647
|
export { ColumnGroupingPlugin, ColumnGroupingPlugin as ColumnGrouping, ColumnGroupingPlugin as ColumnGroupingExtension };
|
@@ -48,7 +48,7 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
48
48
|
|
49
49
|
public getGroupDefinitions(): ColumnGroupingPlugin.GroupDefinitions;
|
50
50
|
|
51
|
-
public setGroupDefinition(groupId: string,
|
51
|
+
public setGroupDefinition(groupId: string, groupDef?: ColumnGroupingPlugin.GroupDefinition|null): string;
|
52
52
|
|
53
53
|
public setGroupDefinitions(groupDefs: ColumnGroupingPlugin.GroupDefinitions|null): void;
|
54
54
|
|
@@ -70,6 +70,10 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
70
70
|
|
71
71
|
public setColumnParent(colRef: number|string|null, groupId: string): void;
|
72
72
|
|
73
|
+
public getValidDestinationIndex(id: string, destCol: number|string|null): number;
|
74
|
+
|
75
|
+
public moveGroup(id: string, destCol: number|string|null): void;
|
76
|
+
|
73
77
|
}
|
74
78
|
|
75
79
|
export default ColumnGroupingPlugin;
|
@@ -110,6 +110,8 @@ declare class SortableTitlePlugin extends EventDispatcher {
|
|
110
110
|
|
111
111
|
public disableTwoStateSorting(disabled?: boolean|null): void;
|
112
112
|
|
113
|
+
public freezeIndicator(bool?: boolean|null): void;
|
114
|
+
|
113
115
|
public disableSortSymbols(disabled?: boolean|null): void;
|
114
116
|
|
115
117
|
public disableDataSorting(disabled?: boolean|null): void;
|
@@ -82,7 +82,8 @@ declare namespace Grid {
|
|
82
82
|
scrollbarParent?: Element|null,
|
83
83
|
formulaEngine?: boolean|null,
|
84
84
|
adcPollingInterval?: number|null,
|
85
|
-
fieldCaching?: boolean|null
|
85
|
+
fieldCaching?: boolean|null,
|
86
|
+
childDataField?: string|null
|
86
87
|
};
|
87
88
|
|
88
89
|
type RowReference = number|string|RowDefinition|null;
|
@@ -145,6 +146,8 @@ declare class Grid extends EventDispatcher {
|
|
145
146
|
|
146
147
|
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
147
148
|
|
149
|
+
public reorderColumns(colRefs: number|string|(number|string)[]|null, destCol: number|string|null): boolean;
|
150
|
+
|
148
151
|
public hideColumn(colRef: Grid.ColumnReference|null, hidden?: boolean|null): void;
|
149
152
|
|
150
153
|
public hideColumns(colRefs: (Grid.ColumnReference)[]|null, hidden?: boolean|null): void;
|
@@ -45,6 +45,8 @@ declare class RowDefinition {
|
|
45
45
|
|
46
46
|
public setStaticRowData(data: { [key: string]: any }|any[], opt_fields?: (string)[]|null): void;
|
47
47
|
|
48
|
+
public _getStaticRowData(): { [key: string]: any };
|
49
|
+
|
48
50
|
public updateRowData(data: { [key: string]: any }|any[], opt_fields?: (string)[]|null): void;
|
49
51
|
|
50
52
|
public setStaticData(field: string, value: any): void;
|
package/lib/versions.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"tr-grid-util": "1.3.82",
|
3
|
-
"@grid/column-dragging": "1.0.
|
3
|
+
"@grid/column-dragging": "1.0.11",
|
4
4
|
"@grid/row-segmenting": "1.0.22",
|
5
5
|
"@grid/statistics-row": "1.0.13",
|
6
6
|
"@grid/zoom": "1.0.11",
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"tr-grid-checkbox": "1.0.60",
|
10
10
|
"tr-grid-column-fitter": "1.0.39",
|
11
11
|
"tr-grid-column-formatting": "0.9.34",
|
12
|
-
"tr-grid-column-grouping": "1.0.
|
12
|
+
"tr-grid-column-grouping": "1.0.41",
|
13
13
|
"tr-grid-column-resizing": "1.0.28",
|
14
14
|
"tr-grid-column-selection": "1.0.25",
|
15
15
|
"tr-grid-column-stack": "1.0.48",
|
package/package.json
CHANGED
@@ -52,7 +52,8 @@
|
|
52
52
|
"./filter-dialog/themes/solar/pearl": "./lib/filter-dialog/themes/solar/pearl.js",
|
53
53
|
"./extensions": "./lib/index.js",
|
54
54
|
"./window-exporter": "./lib/window-exporter.js",
|
55
|
-
"./grid": "./lib/grid/lib/efx-grid.js"
|
55
|
+
"./grid": "./lib/grid/lib/efx-grid.js",
|
56
|
+
"./formatters/": "./lib/formatters/es6/"
|
56
57
|
},
|
57
58
|
"peerDependencies": {
|
58
59
|
"@refinitiv-ui/core": "^6.2.0",
|
@@ -61,5 +62,5 @@
|
|
61
62
|
"publishConfig": {
|
62
63
|
"access": "public"
|
63
64
|
},
|
64
|
-
"version": "6.0.
|
65
|
+
"version": "6.0.23"
|
65
66
|
}
|