@refinitiv-ui/efx-grid 6.0.40 → 6.0.41
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +2 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +23 -7
- package/lib/core/dist/core.js +25 -26
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +25 -26
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +2083 -1753
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +55 -7
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
- package/lib/rt-grid/es6/RowDefinition.js +37 -18
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +26 -40
- package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
- package/lib/tr-grid-util/es6/CellPainter.js +6 -4
- package/lib/tr-grid-util/es6/ExpressionParser.d.ts +10 -0
- package/lib/tr-grid-util/es6/ExpressionParser.js +366 -0
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +10 -6
- package/lib/tr-grid-util/es6/FilterBuilder.js +264 -234
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +3 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +51 -2
- package/lib/tr-grid-util/es6/Util.d.ts +0 -3
- package/lib/tr-grid-util/es6/Util.js +0 -53
- package/lib/tr-grid-util/es6/formula/Formula.js +3 -3
- package/lib/types/es6/ColumnDragging.d.ts +51 -0
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/Extensions.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
- package/lib/types/es6/index.d.ts +1 -0
- package/lib/versions.json +3 -3
- package/package.json +1 -1
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -230,6 +230,45 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
230
230
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
231
231
|
};
|
232
232
|
|
233
|
+
/**
|
234
|
+
* @private
|
235
|
+
* @param {string} rowDefA
|
236
|
+
* @param {string} rowDefB
|
237
|
+
* @param {string} sortOrder
|
238
|
+
* @return {number} The outcome of the value comparison
|
239
|
+
*/
|
240
|
+
var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
241
|
+
var parentA = rowDefA.getParent();
|
242
|
+
|
243
|
+
if (!parentA) {
|
244
|
+
return 0;
|
245
|
+
}
|
246
|
+
|
247
|
+
var parentB = rowDefB.getParent();
|
248
|
+
|
249
|
+
if (!parentB) {
|
250
|
+
return 0;
|
251
|
+
}
|
252
|
+
|
253
|
+
if (parentA !== parentB) {
|
254
|
+
return 0;
|
255
|
+
}
|
256
|
+
|
257
|
+
var a = rowDefA.getData('CHILD_ORDER');
|
258
|
+
|
259
|
+
if (a == null) {
|
260
|
+
return 0;
|
261
|
+
}
|
262
|
+
|
263
|
+
var b = rowDefB.getData('CHILD_ORDER');
|
264
|
+
|
265
|
+
if (b == null) {
|
266
|
+
return 0;
|
267
|
+
}
|
268
|
+
|
269
|
+
return ( a - b ) * sortOrder;
|
270
|
+
};
|
271
|
+
|
233
272
|
/** @private
|
234
273
|
* @param {ColumnDefinition} colDef
|
235
274
|
* @return {string}
|
@@ -258,6 +297,7 @@ var Grid = function(placeholder, config) {
|
|
258
297
|
var t = this; // This is to primarily reduce file size
|
259
298
|
|
260
299
|
t._onDataChanged = t._onDataChanged.bind(t);
|
300
|
+
t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
|
261
301
|
t._onDataComposed = t._onDataComposed.bind(t);
|
262
302
|
t._onSubSegmentChanged = t._onSubSegmentChanged.bind(t);
|
263
303
|
t._recalculateFormulas = t._recalculateFormulas.bind(t);
|
@@ -616,6 +656,7 @@ Grid.prototype.initSubscription = function() {
|
|
616
656
|
this._subs = s;
|
617
657
|
this._subs["start"]();
|
618
658
|
this._dc.setSubscriptions(s);
|
659
|
+
this._subs.addEventListener("postUpdate", this._onQuote2PostUpdate);
|
619
660
|
|
620
661
|
// TODO: Subscriptions should be registered per row.
|
621
662
|
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
@@ -2608,13 +2649,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2608
2649
|
options["ric"] = str;
|
2609
2650
|
var extractedOptions = RowDefinition.extractRowOptions(options);
|
2610
2651
|
var oldRic = rowDef.getSymbol();
|
2611
|
-
|
2612
|
-
var expanded = null;
|
2613
|
-
var collapsed = options["collapsed"];
|
2614
|
-
if(collapsed != null){
|
2615
|
-
expanded = !extractedOptions["collapsed"];
|
2616
|
-
}
|
2617
|
-
if(rowDef.setContent(str, permId, extractedOptions["asChain"], expanded)) { // The given string may not be a RIC
|
2652
|
+
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
2618
2653
|
this._connector.removeRic(rowDef, oldRic);
|
2619
2654
|
this._initDuplicateRicData(rowDef);
|
2620
2655
|
this._connector.addRic(rowDef);
|
@@ -3328,6 +3363,19 @@ Grid.prototype.clearSort = function() {
|
|
3328
3363
|
this._stp.clearSortState(); // WARNING: No event is dispatched
|
3329
3364
|
};
|
3330
3365
|
|
3366
|
+
/**
|
3367
|
+
* @private
|
3368
|
+
* @param {Object} e Event object from quote2
|
3369
|
+
*/
|
3370
|
+
Grid.prototype._onQuote2PostUpdate = function (e) {
|
3371
|
+
if(e.childOrderChange) { // For dynamic chain when CHILD_ORDER from the server change, it will be call sort children
|
3372
|
+
if(!this.isSorting()) {
|
3373
|
+
// Use rowDef for get CHILD_ORDER to sort
|
3374
|
+
this._dt.sortOnce("ROW_DEF", "a", _sortChildrenOfChain);
|
3375
|
+
}
|
3376
|
+
}
|
3377
|
+
};
|
3378
|
+
|
3331
3379
|
/** @private
|
3332
3380
|
* @param {!Object} e
|
3333
3381
|
*/
|
@@ -104,7 +104,7 @@ declare class RowDefinition {
|
|
104
104
|
|
105
105
|
public resetUpdates(): void;
|
106
106
|
|
107
|
-
public registerToView(view:
|
107
|
+
public registerToView(view: DataView|null, rowId?: string|null): void;
|
108
108
|
|
109
109
|
public static deregisterFromView(rowIds: (string)[]|null, rowDef: RowDefinition|null): (string)[]|null;
|
110
110
|
|
@@ -142,7 +142,7 @@ declare const ROW_DEF: string;
|
|
142
142
|
|
143
143
|
declare const ROW_TYPES: RowDefinition.RowTypes;
|
144
144
|
|
145
|
-
declare function rowData(userInput: string,
|
145
|
+
declare function rowData(userInput: string, extractedOptions: any): boolean;
|
146
146
|
|
147
147
|
export {RowDefinition, ROW_DEF, ROW_TYPES};
|
148
148
|
export default RowDefinition;
|
@@ -248,8 +248,9 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
248
248
|
}
|
249
249
|
|
250
250
|
val = rowOptions["collapsed"];
|
251
|
-
|
252
|
-
|
251
|
+
var collapsed = extractedOptions["collapsed"];
|
252
|
+
if(val != null || !collapsed){
|
253
|
+
this._expanded = !collapsed;
|
253
254
|
}
|
254
255
|
val = rowOptions["keepModel"];
|
255
256
|
if(val) {
|
@@ -258,7 +259,7 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
258
259
|
|
259
260
|
var symbol = this._ric || this._chainRic;
|
260
261
|
if(symbol || this._permId){
|
261
|
-
this.setContent(symbol,
|
262
|
+
this.setContent(symbol, extractedOptions); // this._dataId is modified
|
262
263
|
}
|
263
264
|
|
264
265
|
val = rowOptions["values"];
|
@@ -293,12 +294,10 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
|
293
294
|
/** @public
|
294
295
|
* @ignore
|
295
296
|
* @param {string} userInput RIC
|
296
|
-
* @param {
|
297
|
-
* @param {boolean=} asChain
|
298
|
-
* @param {boolean=} expanded
|
297
|
+
* @param {Object} extractedOptions
|
299
298
|
* @return {boolean} True if there is any change otherwise false
|
300
299
|
*/
|
301
|
-
RowDefinition.prototype.setContent = function(userInput,
|
300
|
+
RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
302
301
|
if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
|
303
302
|
return false;
|
304
303
|
}
|
@@ -310,6 +309,7 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
|
|
310
309
|
}
|
311
310
|
|
312
311
|
var dirty = (this._userInput !== userInput);
|
312
|
+
var permId = extractedOptions["permId"];
|
313
313
|
if(this._permId !== permId){
|
314
314
|
this._permId = permId || "";
|
315
315
|
dirty = true;
|
@@ -327,15 +327,17 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
|
|
327
327
|
if(this._userInput.charAt(0) === "'") { // This is a row header
|
328
328
|
this._ric = this._chainRic = ""; // No ric for realtime request
|
329
329
|
} else {
|
330
|
+
var asChain = extractedOptions["asChain"];
|
331
|
+
var expanded = !extractedOptions["collapsed"];
|
332
|
+
var chainRic = extractedOptions["chainRic"];
|
330
333
|
if(asChain === true){
|
331
334
|
this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
|
332
|
-
this._expanded = expanded;
|
333
|
-
this._isChain = true; // Only chain can be expanded by 0#
|
334
|
-
this._chainRic = this._userInput;
|
335
|
+
this._expanded = expanded; // Only chain can be expanded by 0#
|
335
336
|
} else {
|
336
337
|
this._ric = this._userInput;
|
337
|
-
this._isChain = asChain;
|
338
338
|
}
|
339
|
+
this._isChain = asChain;
|
340
|
+
this._chainRic = chainRic || "";
|
339
341
|
}
|
340
342
|
|
341
343
|
if(this._view) {
|
@@ -767,8 +769,17 @@ RowDefinition.prototype.subscribeForUpdates = function() {
|
|
767
769
|
var prevRowData = this.unsubscribeForUpdates();
|
768
770
|
|
769
771
|
if(this.isChain()) {
|
770
|
-
|
771
|
-
|
772
|
+
var symbol = this._chainRic;
|
773
|
+
if(!symbol){
|
774
|
+
symbol = this._ric;
|
775
|
+
if(symbol.indexOf("0#") < 0){
|
776
|
+
var count = (symbol.match(/\./g) || []).length;
|
777
|
+
if(count < 2){
|
778
|
+
symbol = "0#" + symbol;
|
779
|
+
}
|
780
|
+
}
|
781
|
+
}
|
782
|
+
this._subId = subs["addChain"](symbol, this._rowId); // Some chain require 0# symbol to populate its constituents
|
772
783
|
} else if(this._ric) {
|
773
784
|
this._subId = subs["addRic"](this._ric, this._rowId);
|
774
785
|
}
|
@@ -845,7 +856,7 @@ RowDefinition.prototype.resetUpdates = function() {
|
|
845
856
|
};
|
846
857
|
|
847
858
|
/** @public
|
848
|
-
* @param {
|
859
|
+
* @param {DataView} view
|
849
860
|
* @param {string=} rowId
|
850
861
|
*/
|
851
862
|
RowDefinition.prototype.registerToView = function(view, rowId) {
|
@@ -962,11 +973,17 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
962
973
|
}
|
963
974
|
|
964
975
|
if(this._view) {
|
965
|
-
// WARNING: ChildCount may not be enough to determine proper inserting position
|
966
|
-
// TODO: Handle nested children
|
967
976
|
var rowId = this.getRowId();
|
968
|
-
|
969
|
-
childDef.
|
977
|
+
// WARNING: insert position, we prioritize using CHILD_ORDER (From server) in dc first. If it does not exist, the last row of the segment will be pushed
|
978
|
+
var childOrder = childDef.getData("CHILD_ORDER");
|
979
|
+
var parentIndex = this._view.getRowIndex(rowId);
|
980
|
+
var position = parentIndex + this.getChildCount(); // push the last position
|
981
|
+
if(childOrder != null) {
|
982
|
+
// Warning: We need to carry a value of 1 because the CHILD_ORDER starts with 0, and it will be added to the parentIndex. In case the parent rowIndex is not included.
|
983
|
+
position = parentIndex + childOrder + 1; // insert between segment
|
984
|
+
} // else {} it will be push in the last row of segment
|
985
|
+
childDef.registerToView(this._view, this._view.getRowId(position));
|
986
|
+
// TODO: Handle nested children
|
970
987
|
this._view.addSegmentChild(rowId, childDef.getRowId(), childDef.getDataId());
|
971
988
|
}
|
972
989
|
|
@@ -1217,6 +1234,7 @@ RowDefinition.toRowId = function(rowDef) {
|
|
1217
1234
|
*/
|
1218
1235
|
RowDefinition.extractRowOptions = function(rowOptions) {
|
1219
1236
|
var ric = rowOptions["ric"];
|
1237
|
+
var permId = rowOptions["permId"];
|
1220
1238
|
var chainRic = rowOptions["chainRic"];
|
1221
1239
|
var collapsed = rowOptions["collapsed"];
|
1222
1240
|
var asChain = rowOptions["asChain"];
|
@@ -1238,6 +1256,7 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
1238
1256
|
extractedOptions["collapsed"] = collapsed;
|
1239
1257
|
}
|
1240
1258
|
extractedOptions["ric"] = ric;
|
1259
|
+
extractedOptions["permId"] = permId;
|
1241
1260
|
extractedOptions["chainRic"] = chainRic;
|
1242
1261
|
extractedOptions["asChain"] = asChain;
|
1243
1262
|
return extractedOptions;
|
@@ -64,10 +64,6 @@ ColumnGroupingPlugin.prototype._maxDepth = 0;
|
|
64
64
|
* @private
|
65
65
|
*/
|
66
66
|
ColumnGroupingPlugin.prototype._restructuring = false;
|
67
|
-
/** @type {boolean}
|
68
|
-
* @private
|
69
|
-
*/
|
70
|
-
ColumnGroupingPlugin.prototype._autoGrouping = true;
|
71
67
|
/** @type {number}
|
72
68
|
* @private
|
73
69
|
*/
|
@@ -894,9 +890,11 @@ ColumnGroupingPlugin.prototype._applyTimeSeries = function (e) {
|
|
894
890
|
* @param {Object} e dispatching of columnAdded event object
|
895
891
|
*/
|
896
892
|
ColumnGroupingPlugin.prototype._onColumnAdded = function (e) {
|
897
|
-
var
|
898
|
-
|
899
|
-
|
893
|
+
var batches = e["batches"];
|
894
|
+
if (!(batches && batches["reset"])) {
|
895
|
+
this._requestApplyAddChildGroup(e);
|
896
|
+
this._applyNearestGrouping(e.colIndex);
|
897
|
+
}
|
900
898
|
this._requestApplyGrouping();
|
901
899
|
};
|
902
900
|
/** @private
|
@@ -908,7 +906,8 @@ ColumnGroupingPlugin.prototype._onColumnChanged = function () {
|
|
908
906
|
* @param {Object} e dispatching of columnMoved event object
|
909
907
|
*/
|
910
908
|
ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
|
911
|
-
|
909
|
+
var batches = e["batches"];
|
910
|
+
if (!(batches && batches["move"])) {
|
912
911
|
this._applyNearestGrouping(e.toColIndex);
|
913
912
|
}
|
914
913
|
this._requestApplyGrouping();
|
@@ -917,11 +916,16 @@ ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
|
|
917
916
|
* @param {Object} e
|
918
917
|
*/
|
919
918
|
ColumnGroupingPlugin.prototype._onColumnRemoved = function (e) {
|
920
|
-
var
|
921
|
-
if (
|
922
|
-
|
923
|
-
|
919
|
+
var batches = e["batches"];
|
920
|
+
if (!(batches && batches["reset"])) {
|
921
|
+
var colId = e.colId;
|
922
|
+
if (colId) {
|
923
|
+
if (this._groupDefs.unsetParent(colId)) {
|
924
|
+
this._requestApplyGrouping();
|
925
|
+
}
|
924
926
|
}
|
927
|
+
} else {
|
928
|
+
this._requestApplyGrouping();
|
925
929
|
}
|
926
930
|
};
|
927
931
|
/** @private
|
@@ -1028,29 +1032,22 @@ ColumnGroupingPlugin.prototype._onBeforeColumnBoundUpdate = function (e) {
|
|
1028
1032
|
*/
|
1029
1033
|
ColumnGroupingPlugin.prototype.addColumnToGroup = function (column, groupId, colIndex) {
|
1030
1034
|
if (!column) return;
|
1031
|
-
var
|
1032
|
-
if (colIndex
|
1035
|
+
var destIndex = this.getColumnCount();
|
1036
|
+
if (colIndex != null) {
|
1033
1037
|
var groupDef = this._groupDefs.getGroup(groupId);
|
1034
1038
|
if (groupDef) {
|
1035
|
-
var childIndices = this.getChildColumnIndices(groupId);
|
1036
|
-
if (childIndices && childIndices.length) {
|
1037
|
-
// Child indices need to be sorted here
|
1038
|
-
columnIndex = childIndices[childIndices.length - 1] + 1; // Put new column next to the last child in the group
|
1039
|
-
}
|
1040
|
-
|
1041
1039
|
this._groupDefs.addGroupChild(groupId, column.id);
|
1042
1040
|
}
|
1043
|
-
|
1044
|
-
columnIndex = colIndex;
|
1045
|
-
}
|
1046
|
-
if (columnIndex < 0) {
|
1047
|
-
columnIndex = this.getColumnCount();
|
1041
|
+
destIndex = colIndex;
|
1048
1042
|
}
|
1049
1043
|
if (this._realTimeGrid) {
|
1050
1044
|
// TODO: Support multi-table feature
|
1051
|
-
this._realTimeGrid.insertColumn(column,
|
1045
|
+
this._realTimeGrid.insertColumn(column, destIndex);
|
1052
1046
|
} else if (this._compositeGrid) {
|
1053
|
-
this._compositeGrid.insertColumn(
|
1047
|
+
this._compositeGrid.insertColumn(destIndex, column);
|
1048
|
+
}
|
1049
|
+
if (colIndex == null) {
|
1050
|
+
this.setColumnParent(column.id || destColIndex, groupId);
|
1054
1051
|
}
|
1055
1052
|
};
|
1056
1053
|
|
@@ -1622,13 +1619,7 @@ ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
|
|
1622
1619
|
* @return {boolean}
|
1623
1620
|
*/
|
1624
1621
|
ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
|
1625
|
-
|
1626
|
-
// TODO: create method for toggling autoGrouping flag
|
1627
|
-
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1628
|
-
|
1629
|
-
this._reorderColumns(colList, destCol);
|
1630
|
-
this._autoGrouping = true;
|
1631
|
-
return dirty;
|
1622
|
+
return this._reorderColumns(colList, destCol);
|
1632
1623
|
};
|
1633
1624
|
/** Move the specified column to position before the destination
|
1634
1625
|
* @public
|
@@ -1637,12 +1628,7 @@ ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
|
|
1637
1628
|
* @return {boolean}
|
1638
1629
|
*/
|
1639
1630
|
ColumnGroupingPlugin.prototype.moveColumnById = function (srcCol, destCol) {
|
1640
|
-
|
1641
|
-
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1642
|
-
|
1643
|
-
this._moveColumnById(srcCol, destCol);
|
1644
|
-
this._autoGrouping = true;
|
1645
|
-
return dirty;
|
1631
|
+
return this._moveColumnById(srcCol, destCol);
|
1646
1632
|
};
|
1647
1633
|
/** @public
|
1648
1634
|
* @param {string} groupId
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { TickCodes, TickFields } from "./TickCodes.js";
|
2
|
-
import {
|
2
|
+
import { rgb2Hex } from "./Util.js";
|
3
3
|
import { ElfUtil } from "./ElfUtil.js";
|
4
|
+
import { ExpressionParser } from "./ExpressionParser.js";
|
4
5
|
|
5
6
|
declare namespace CellPainter {
|
6
7
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { TickCodes, TickFields } from "./TickCodes.js";
|
2
|
-
import {
|
2
|
+
import { rgb2Hex } from "./Util.js";
|
3
3
|
import { ElfUtil } from "./ElfUtil.js";
|
4
|
+
import { ExpressionParser } from "./ExpressionParser.js";
|
4
5
|
|
5
6
|
/** @typedef {Object} CellPainter~Expression
|
6
7
|
* @property {string=} name
|
@@ -131,7 +132,8 @@ CellPainter.supportedStyles = CellPainter.bgStyles.concat(CellPainter.nonBgStyle
|
|
131
132
|
*/
|
132
133
|
CellPainter.themeReady = null;
|
133
134
|
|
134
|
-
/**
|
135
|
+
/** Deprecated in favor of ExpressionParser
|
136
|
+
* @public
|
135
137
|
* @function
|
136
138
|
* @param {string|Function} expression
|
137
139
|
* @return {Function}
|
@@ -139,7 +141,7 @@ CellPainter.themeReady = null;
|
|
139
141
|
* var fn = CellPainter.parse("[CF_BID] >= 10 && [CF_BID] <= 100");
|
140
142
|
* window.console.log(fn(25));
|
141
143
|
*/
|
142
|
-
CellPainter.parse =
|
144
|
+
CellPainter.parse = ExpressionParser.parse;
|
143
145
|
|
144
146
|
|
145
147
|
/** @public */
|
@@ -311,7 +313,7 @@ CellPainter.prototype.getColumnStats = function() {
|
|
311
313
|
CellPainter.prototype._addCondition = function(condition) {
|
312
314
|
var exp = condition["expression"];
|
313
315
|
if(exp) {
|
314
|
-
condition._fn =
|
316
|
+
condition._fn = ExpressionParser.parse(exp["text"] || exp);
|
315
317
|
this._conditions.push(condition);
|
316
318
|
}
|
317
319
|
};
|