@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.
Files changed (31) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +46 -24
  2. package/lib/core/dist/core.js +61 -14
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/grid/Core.js +11 -1
  5. package/lib/core/es6/grid/LayoutGrid.js +1 -0
  6. package/lib/core/es6/grid/components/CellSpans.d.ts +2 -0
  7. package/lib/core/es6/grid/components/CellSpans.js +35 -10
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +2 -0
  9. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +14 -3
  10. package/lib/grid/index.js +1 -1
  11. package/lib/rt-grid/dist/rt-grid.js +369 -90
  12. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  13. package/lib/rt-grid/es6/ColumnDefinition.d.ts +1 -1
  14. package/lib/rt-grid/es6/ColumnDefinition.js +21 -36
  15. package/lib/rt-grid/es6/FieldDefinition.d.ts +7 -1
  16. package/lib/rt-grid/es6/FieldDefinition.js +93 -4
  17. package/lib/rt-grid/es6/Grid.d.ts +4 -1
  18. package/lib/rt-grid/es6/Grid.js +88 -25
  19. package/lib/rt-grid/es6/ReferenceCounter.js +13 -2
  20. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -0
  21. package/lib/rt-grid/es6/RowDefinition.js +74 -8
  22. package/lib/rt-grid/es6/SnapshotFiller.js +1 -1
  23. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +5 -1
  24. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +228 -55
  25. package/lib/types/es6/ColumnGrouping.d.ts +5 -1
  26. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +2 -0
  27. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +2 -0
  28. package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -1
  29. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -0
  30. package/lib/versions.json +2 -2
  31. package/package.json +3 -2
@@ -13094,6 +13094,10 @@ var RowDefinition = function(rowOptions) {
13094
13094
  * @private
13095
13095
  */
13096
13096
  RowDefinition._runningId = 0;
13097
+ /** @type {string}
13098
+ * @private
13099
+ */
13100
+ RowDefinition._childDataField = "CHILD_VALUES";
13097
13101
  //#region Private Members
13098
13102
  /** @type {string}
13099
13103
  * @private
@@ -13284,7 +13288,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
13284
13288
  }
13285
13289
  }
13286
13290
  }
13287
- // TODO: Allow constituent to have predefined static values
13291
+ var val = rowOptions["values"];
13292
+ // eslint-disable-next-line no-undefined
13293
+ if(val !== undefined) {
13294
+ this.setStaticRowData(val, rowOptions["fields"]);
13295
+ }
13288
13296
  };
13289
13297
  /** @public
13290
13298
  * @param {string} userInput
@@ -13356,11 +13364,6 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13356
13364
  obj["ric"] = val;
13357
13365
  }
13358
13366
 
13359
- val = this._staticValues;
13360
- if(val) {
13361
- obj["values"] = Object(Util["b" /* cloneObject */])(val);
13362
- }
13363
-
13364
13367
  val = this._chainRic;
13365
13368
  if(val) {
13366
13369
  obj["chainRic"] = val;
@@ -13392,6 +13395,40 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13392
13395
  obj["hidden"] = val;
13393
13396
  }
13394
13397
 
13398
+ val = this._getStaticRowData();
13399
+ if(val) {
13400
+ obj["values"] = val;
13401
+ }
13402
+
13403
+ // obtain the static values of constituent rows
13404
+ if(this.isChain()) {
13405
+ var children = this.getChildren();
13406
+ if(children) {
13407
+ var childValues = val ? val[RowDefinition._childDataField] : {};
13408
+ if(!childValues) {
13409
+ childValues = {};
13410
+ }
13411
+ var dirty = false;
13412
+ var len = children.length;
13413
+ var i, rowDef, staticValues;
13414
+ for(i = 0; i < len; i++) {
13415
+ rowDef = children[i];
13416
+ staticValues = rowDef._getStaticRowData();
13417
+ if(staticValues) {
13418
+ dirty = true;
13419
+ childValues[rowDef.getRic()] = staticValues;
13420
+ }
13421
+ }
13422
+
13423
+ if(dirty) {
13424
+ if(!obj["values"]) {
13425
+ obj["values"] = {};
13426
+ }
13427
+ obj["values"][RowDefinition._childDataField] = childValues;
13428
+ }
13429
+ }
13430
+ }
13431
+
13395
13432
  return obj;
13396
13433
  };
13397
13434
  /** 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.
@@ -13466,6 +13503,12 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
13466
13503
  }
13467
13504
  };
13468
13505
  /** @public
13506
+ * @return {Object.<string, *>}
13507
+ */
13508
+ RowDefinition.prototype._getStaticRowData = function() {
13509
+ return this._staticValues ? Object(Util["b" /* cloneObject */])(this._staticValues) : null;
13510
+ };
13511
+ /** @public
13469
13512
  * @param {Object.<string, *>|Array} data
13470
13513
  * @param {Array.<string>=} opt_fields In case of the given data is an array, this param will be used for mapping index to field
13471
13514
  */
@@ -13766,6 +13809,22 @@ RowDefinition.deregisterFromView = function(rowIds, rowDef) {
13766
13809
  rowDef._deregisterFromView(rowIds);
13767
13810
  return rowIds;
13768
13811
  };
13812
+ /** @private
13813
+ * @param {string} ric
13814
+ * @return {Object}
13815
+ */
13816
+ RowDefinition.prototype._getChildStaticRowData = function(ric) {
13817
+ if(!this._staticValues) {
13818
+ return null;
13819
+ }
13820
+
13821
+ var childValues = this._staticValues[RowDefinition._childDataField];
13822
+ if(!childValues) {
13823
+ return null;
13824
+ }
13825
+
13826
+ return childValues[ric] || null;
13827
+ };
13769
13828
  /** @public
13770
13829
  * @ignore
13771
13830
  * @param {string} ric
@@ -13793,12 +13852,19 @@ RowDefinition.prototype.addConstituent = function(ric) {
13793
13852
 
13794
13853
  var newChild = !childDef;
13795
13854
  if(newChild) {
13796
- childDef = new RowDefinition({
13855
+ var rowOptions = {
13797
13856
  "asConstituent": true,
13798
13857
  "dataId": this._subId + ric,
13799
13858
  "ric": ric,
13800
13859
  "parent": this
13801
- });
13860
+ };
13861
+
13862
+ var staticData = this._getChildStaticRowData(ric);
13863
+ if(staticData) {
13864
+ rowOptions["values"] = staticData;
13865
+ }
13866
+
13867
+ childDef = new RowDefinition(rowOptions);
13802
13868
  }
13803
13869
 
13804
13870
  if(this._view) {
@@ -14120,7 +14186,7 @@ var FieldDefinition = {};
14120
14186
  FieldDefinition._defs = {
14121
14187
  "X_RIC_NAME": {
14122
14188
  name: "RIC",
14123
- notRealTimeField: true,
14189
+ IsRealtimeField: false,
14124
14190
  width: 100,
14125
14191
  binding: xRicNameRenderer,
14126
14192
  sortLogic: xRicNameSorter
@@ -14258,7 +14324,13 @@ FieldDefinition._loadingField = {};
14258
14324
  * @param {Object} def
14259
14325
  */
14260
14326
  FieldDefinition.set = function(field, def) {
14261
- FieldDefinition._defs[field] = def || null;
14327
+ if (!FieldDefinition._defs[field]) {
14328
+ FieldDefinition._defs[field] = def;
14329
+ } else {
14330
+ for (var key in def) {
14331
+ FieldDefinition._defs[field][key] = def[key];
14332
+ }
14333
+ }
14262
14334
  };
14263
14335
  /** @public
14264
14336
  * @function
@@ -14315,11 +14387,64 @@ FieldDefinition.setFieldCaching = function (caching) {
14315
14387
  FieldDefinition._caching = caching;
14316
14388
  };
14317
14389
 
14390
+ /** @public
14391
+ * @param {string} field
14392
+ * @return {boolean}
14393
+ */
14394
+ FieldDefinition.isFormula = function(field) {
14395
+ return field.charAt(0) === "=";
14396
+ };
14397
+ /** @public
14398
+ * @param {string} field
14399
+ * @return {boolean}
14400
+ */
14401
+ FieldDefinition.isAdc = function(field) {
14402
+ return field.indexOf("TR.") === 0;
14403
+ };
14404
+
14405
+ /** @public
14406
+ * @param {string} field
14407
+ * @return {boolean}
14408
+ */
14409
+ FieldDefinition.isRealTimeField = function(field) {
14410
+ if (!field) {
14411
+ return false;
14412
+ }
14413
+
14414
+ if(FieldDefinition.isAdc(field)) {
14415
+ return false;
14416
+ }
14417
+
14418
+ if(FieldDefinition.isFormula(field)) {
14419
+ return false;
14420
+ }
14421
+
14422
+ if(FieldDefinition.getFieldProperty(field, "timeSeriesChild")) {
14423
+ return false;
14424
+ }
14425
+
14426
+ if(FieldDefinition.isTimeSeries(field)) {
14427
+ return false;
14428
+ }
14429
+
14430
+ return FieldDefinition.getFieldProperty(field, "IsRealtimeField") !== false;
14431
+ };
14432
+
14318
14433
  /** @public
14319
14434
  * @param {string} field
14320
14435
  * @return {boolean}=true if field is time series field
14321
14436
  */
14322
- FieldDefinition.isTimeSeriesField = function (field) {
14437
+ FieldDefinition.isTimeSeries = function (field) {
14438
+ if (!field) {
14439
+ return false;
14440
+ }
14441
+
14442
+ // We can check time series using a cache to avoid duplicating checks in regular expressions.
14443
+ var timeSeriesField = FieldDefinition.getFieldProperty(field, "timeSeries");
14444
+ if (timeSeriesField != null) {
14445
+ return timeSeriesField;
14446
+ }
14447
+
14323
14448
  /*
14324
14449
  ^TR. => start with TR.
14325
14450
  [\w]+ => any field with string and value
@@ -14328,9 +14453,39 @@ FieldDefinition.isTimeSeriesField = function (field) {
14328
14453
  EDATE\=+ => EDATE in bucket
14329
14454
  [\w\-\=\,]+ => another propertie param
14330
14455
  [\)]$ => end with only )
14456
+ i => for match both upper and lower cases
14331
14457
  */
14458
+ var timeSeriesRegex = /^TR.[\w]+[\(][\w\-\=\,]*EDATE\=+[\w\-\=\,]+[\)]$/i;
14459
+ return timeSeriesRegex.test(field);
14460
+ };
14461
+
14462
+ /**
14463
+ * Set property value into field definition
14464
+ * @private
14465
+ * @param {string} field field definition
14466
+ * @param {string} propertyName
14467
+ * @param {*} value
14468
+ */
14469
+ FieldDefinition.setFieldProperty = function(field, propertyName, value) {
14470
+ if(!FieldDefinition._defs[field]) {
14471
+ FieldDefinition._defs[field] = {};
14472
+ }
14473
+ FieldDefinition._defs[field][propertyName] = value;
14474
+ };
14332
14475
 
14333
- return !!field.toUpperCase().match(/^TR.[\w]+[\(][\w\-\=\,]*EDATE\=+[\w\-\=\,]+[\)]$/g);
14476
+ /**
14477
+ * Set property value into field definition
14478
+ * @private
14479
+ * @param {string} field field definition
14480
+ * @param {string} propertyName
14481
+ * @return {*}
14482
+ */
14483
+ FieldDefinition.getFieldProperty = function(field, propertyName) {
14484
+ var fieldDef = FieldDefinition._defs[field];
14485
+ if(fieldDef) {
14486
+ return fieldDef[propertyName];
14487
+ }
14488
+ return null;
14334
14489
  };
14335
14490
 
14336
14491
  /** to get more info about field via synapse service
@@ -14781,10 +14936,6 @@ ColumnDefinition.prototype._eventArg;
14781
14936
  /** @type {boolean}
14782
14937
  * @private
14783
14938
  */
14784
- ColumnDefinition.prototype._realTimeField = false;
14785
- /** @type {boolean}
14786
- * @private
14787
- */
14788
14939
  ColumnDefinition.prototype._autoGenerated = false;
14789
14940
 
14790
14941
  /** @type {!Array.<string>}
@@ -14831,10 +14982,6 @@ ColumnDefinition.prototype._parent = null;
14831
14982
  * @private
14832
14983
  */
14833
14984
  ColumnDefinition.prototype._children = null;
14834
- /** @type {boolean}
14835
- * @private
14836
- */
14837
- ColumnDefinition.prototype._timeSeriesField = false;
14838
14985
  /** @type {Object}
14839
14986
  * @private
14840
14987
  */
@@ -14921,7 +15068,7 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
14921
15068
  }
14922
15069
  }
14923
15070
 
14924
- this._setField(field, columnOption["formula"]); // Perform some field manipulation
15071
+ this._setField(field, columnOption); // Perform some field manipulation
14925
15072
 
14926
15073
  val = columnOption["name"] || columnOption["title"]; // title is migrated from Composite Grid
14927
15074
  if(val != null) { // Name can be empty string
@@ -14936,7 +15083,7 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
14936
15083
 
14937
15084
  val = columnOption["notRealTimeField"];
14938
15085
  if(val != null) {
14939
- this._realTimeField = !val;
15086
+ js_FieldDefinition.setFieldProperty(field, "IsRealtimeField", !val);
14940
15087
  }
14941
15088
 
14942
15089
  val = columnOption["tooltip"];
@@ -15153,17 +15300,13 @@ ColumnDefinition.prototype.getAllFields = function() {
15153
15300
  * @return {boolean}
15154
15301
  */
15155
15302
  ColumnDefinition.prototype.isRealTimeField = function() {
15156
- // TODO: Simplify this logic
15157
- if(this._field && this._realTimeField && !this._formula) {
15158
- return ColumnDefinition.isRealTimeField(this._field);
15159
- }
15160
- return false;
15303
+ return js_FieldDefinition.isRealTimeField(this._field);
15161
15304
  };
15162
15305
  /** @public
15163
15306
  * @return {boolean}
15164
15307
  */
15165
- ColumnDefinition.prototype.isTimeSeriesField = function() {
15166
- return this._timeSeriesField;
15308
+ ColumnDefinition.prototype.isTimeSeries = function() {
15309
+ return js_FieldDefinition.isTimeSeries(this._field);
15167
15310
  };
15168
15311
  /** @public
15169
15312
  * @return {boolean}
@@ -15176,27 +15319,21 @@ ColumnDefinition.prototype.isFormulaField = function() {
15176
15319
  * @return {boolean}
15177
15320
  */
15178
15321
  ColumnDefinition.isFormulaField = function(field) {
15179
- return field.charAt(0) === "=";
15322
+ return js_FieldDefinition.isFormula(field);
15180
15323
  };
15181
15324
  /** @public
15182
15325
  * @param {string} field
15183
15326
  * @return {boolean}
15184
15327
  */
15185
15328
  ColumnDefinition.isAdcField = function(field) {
15186
- return field.indexOf("TR.") === 0;
15329
+ return js_FieldDefinition.isAdc(field);
15187
15330
  };
15188
15331
  /** @public
15189
15332
  * @param {string} field
15190
15333
  * @return {boolean}
15191
15334
  */
15192
15335
  ColumnDefinition.isRealTimeField = function(field) {
15193
- if(field) {
15194
- if(!ColumnDefinition.isFormulaField(field)) {
15195
- return !ColumnDefinition.isAdcField(field);
15196
- }
15197
- }
15198
-
15199
- return false;
15336
+ return js_FieldDefinition.isRealTimeField(field);
15200
15337
  };
15201
15338
  /** @public
15202
15339
  * @function
@@ -15321,8 +15458,10 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15321
15458
  obj["name"] = this._name;
15322
15459
  }
15323
15460
 
15324
- if(!this._realTimeField) {
15325
- obj["notRealTimeField"] = true;
15461
+ // The 'IsRealtimeField' property will only be set if the user sets 'notRealTimeField' in the column options. It will be returned if the user has this option enabled, otherwise it will not be returned
15462
+ value = js_FieldDefinition.getFieldProperty(this._field, "IsRealtimeField") === false;
15463
+ if(value) {
15464
+ obj["notRealTimeField"] = value;
15326
15465
  }
15327
15466
 
15328
15467
  if(this._tooltip != null) {
@@ -15543,7 +15682,7 @@ ColumnDefinition.prototype.setSorter = function(func) {
15543
15682
  */
15544
15683
  ColumnDefinition.prototype.isRowSorting = function() {
15545
15684
  if(this._rowSorting == null) {
15546
- return !this._realTimeField;
15685
+ return !js_FieldDefinition.getFieldProperty(this._field, "IsRealtimeField");
15547
15686
  }
15548
15687
  return this._rowSorting ? true : false;
15549
15688
  };
@@ -15566,9 +15705,9 @@ ColumnDefinition.prototype.setName = function(str) {
15566
15705
 
15567
15706
  /** @private
15568
15707
  * @param {string|null=} field
15569
- * @param {string} formulaStr
15708
+ * @param {ColumnDefinition~Options=} columnOption
15570
15709
  */
15571
- ColumnDefinition.prototype._setField = function(field, formulaStr) {
15710
+ ColumnDefinition.prototype._setField = function(field, columnOption) {
15572
15711
  var defaultField = (field == null); // undefined or null
15573
15712
  if(!field) {
15574
15713
  field = "";
@@ -15576,6 +15715,7 @@ ColumnDefinition.prototype._setField = function(field, formulaStr) {
15576
15715
  // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
15577
15716
  field = field.replace(/^\s+|\s+$/gm, "");
15578
15717
 
15718
+ var formulaStr = columnOption["formula"];
15579
15719
  if(this._fnEngine) {
15580
15720
  var uppercasedF = field.toUpperCase(); // For comparison only
15581
15721
  var predefinedF = formulaStr || js_PredefinedFormula.get(uppercasedF);
@@ -15603,13 +15743,13 @@ ColumnDefinition.prototype._setField = function(field, formulaStr) {
15603
15743
  this._field = field;
15604
15744
  this._name = field;
15605
15745
  this._emptyField = false;
15606
- this._realTimeField = field ? true : false;
15607
15746
  }
15608
15747
 
15609
- if(js_FieldDefinition.isTimeSeriesField(field)) {
15610
- // children will be clone the config from parent too
15611
- this._realTimeField = false;
15612
- this._timeSeriesField = true;
15748
+ // We need to cache time series in field definition for improve performance of checking methond
15749
+ js_FieldDefinition.setFieldProperty(field, "timeSeries", js_FieldDefinition.isTimeSeries(field) ? true : false);
15750
+
15751
+ if(columnOption["parent"]) {
15752
+ js_FieldDefinition.setFieldProperty(field, "timeSeriesChild", true);
15613
15753
  }
15614
15754
 
15615
15755
  this._isDefaultName = true;
@@ -15918,7 +16058,7 @@ SnapshotFiller.prototype._onRequest = function () {
15918
16058
  var fields = [];
15919
16059
  var timeSeriesFields = [];
15920
16060
  for (var field in this._fields) {
15921
- if(!FieldDefinition.isTimeSeriesField(field)) {
16061
+ if(!FieldDefinition.isTimeSeries(field)) {
15922
16062
  fields.push(field);
15923
16063
  } else {
15924
16064
  timeSeriesFields.push(field);
@@ -20516,6 +20656,33 @@ CellSpans.prototype.removeColumn = function (at) { // Use when a column is remov
20516
20656
  }
20517
20657
  return dirty;
20518
20658
  };
20659
+ /** @public
20660
+ * @param {boolean=} bool
20661
+ */
20662
+ CellSpans.prototype.freezeMapping = function (bool) {
20663
+ this._frozenMapping = bool !== false;
20664
+ if(!this._frozenMapping) {
20665
+ this._mapCellSpans();
20666
+ }
20667
+ };
20668
+
20669
+
20670
+ /** @private
20671
+ */
20672
+ CellSpans.prototype._mapCellSpans = function () {
20673
+ var cellSpans = this._spans;
20674
+ this._spans = [];
20675
+ this._occupiedMap = {};
20676
+ var i, cellSpan;
20677
+ for(i = cellSpans.length; --i >= 0;) {
20678
+ cellSpan = cellSpans[i];
20679
+ if(cellSpan.indexX >= 0) {
20680
+ cellSpan.register(this._spans, this._occupiedMap);
20681
+ }
20682
+ }
20683
+ };
20684
+
20685
+
20519
20686
  /** @public
20520
20687
  * @param {number} from
20521
20688
  * @param {number} amount This can be negative number
@@ -20532,18 +20699,10 @@ CellSpans.prototype.shiftColumn = function (from, amount) { // Use when a column
20532
20699
  cellSpan.indexX += amount;
20533
20700
  }
20534
20701
  }
20535
- if(!dirty) { return false; }
20702
+ if(!dirty || this._frozenMapping) { return false; }
20536
20703
 
20537
20704
  // Re-registers all cellspans. Some of the cellspans may be lost due to shifting
20538
- var cellSpans = this._spans;
20539
- this._spans = [];
20540
- this._occupiedMap = {};
20541
- for(i = cellSpans.length; --i >= 0;) {
20542
- cellSpan = cellSpans[i];
20543
- if(cellSpan.indexX >= 0) {
20544
- cellSpan.register(this._spans, this._occupiedMap);
20545
- }
20546
- }
20705
+ this._mapCellSpans();
20547
20706
  return true;
20548
20707
  };
20549
20708
  /** @public
@@ -20832,6 +20991,12 @@ CellSpans.prototype._spans;
20832
20991
  */
20833
20992
  CellSpans.prototype._occupiedMap;
20834
20993
 
20994
+ /**
20995
+ * @private
20996
+ * @type {boolean}
20997
+ */
20998
+ CellSpans.prototype._frozenMapping = false;
20999
+
20835
21000
  /* harmony default export */ var components_CellSpans = (CellSpans);
20836
21001
 
20837
21002
 
@@ -24585,6 +24750,7 @@ LayoutGrid.prototype.setFrozenLayout = function (bool) {
24585
24750
  if (this._frozenLayout !== bool) {
24586
24751
  this._frozenLayout = bool;
24587
24752
 
24753
+ this._cellSpans.freezeMapping(this._frozenLayout);
24588
24754
  if (!this._frozenLayout) {
24589
24755
  this._syncLayoutToColumns(0);
24590
24756
  this._syncLayoutToRows(0, this._rowCount);
@@ -29299,6 +29465,20 @@ DataView.prototype.isCollapsed = function() {
29299
29465
  DataView.prototype.enableContentAsHeader = function(bool) {
29300
29466
  this._shared.contentAsHeader = bool !== false;
29301
29467
  };
29468
+ /** set default collapse when new groups added
29469
+ * @public
29470
+ * @param {boolean=} collapse=false, if enable it, it will be set collapsing by default
29471
+ */
29472
+ DataView.prototype.setDefaultCollapse = function(collapse) {
29473
+ this._shared.defaultCollapse = !!collapse;
29474
+ };
29475
+ /** get default collapse when new groups added
29476
+ * @public
29477
+ * @return {boolean}
29478
+ */
29479
+ DataView.prototype.getDefaultCollapse = function() {
29480
+ return !!this._shared.defaultCollapse; // it can be null, convert to boolean
29481
+ };
29302
29482
  /** @private
29303
29483
  * @return {?Array.<string>}
29304
29484
  */
@@ -31217,6 +31397,10 @@ DataView.prototype._addGroup = function (value) {
31217
31397
  }
31218
31398
  }
31219
31399
  member = new DataView();
31400
+ var collapsed = this._shared.defaultCollapse;
31401
+ if(collapsed != null) {
31402
+ member._collapsed = collapsed;
31403
+ }
31220
31404
  member._groupId = groupId;
31221
31405
  if(typeof value == "string") { // TODO: Raw value should not always be a string
31222
31406
  if(value == "null") {
@@ -34529,7 +34713,7 @@ Core.prototype._rowHeightTimerId = 0;
34529
34713
  * @return {string}
34530
34714
  */
34531
34715
  Core.getVersion = function () {
34532
- return "5.1.30";
34716
+ return "5.1.32";
34533
34717
  };
34534
34718
  /** {@link ElementWrapper#dispose}
34535
34719
  * @override
@@ -36881,6 +37065,13 @@ Core.prototype.freezeLayout = function (opt_bool) {
36881
37065
  if (prevState !== opt_bool) {
36882
37066
  this._frozenLayout = opt_bool;
36883
37067
 
37068
+ var stp = this.getPlugin("SortableTitlePlugin");
37069
+ if(this._frozenLayout) {
37070
+ if(stp) {
37071
+ stp.freezeIndicator(true);
37072
+ }
37073
+ }
37074
+
36884
37075
  if (!this._frozenLayout) {
36885
37076
  // Width has not yet changed so we need to disable it first
36886
37077
  this._disableEvent("widthChanged");
@@ -36909,6 +37100,9 @@ Core.prototype.freezeLayout = function (opt_bool) {
36909
37100
  if(!viewChanged) { // Always update virtualizer
36910
37101
  this._rowVirtualizer.update(true); // Force section activation
36911
37102
  }
37103
+ if(stp) {
37104
+ stp.freezeIndicator(false);
37105
+ }
36912
37106
  }
36913
37107
  this._rowHeightSync = true;
36914
37108
  }
@@ -39479,6 +39673,7 @@ ReferenceCounter.prototype.getSession = function() {
39479
39673
  } else if(val < 0) {
39480
39674
  removedEntries.push(key);
39481
39675
  }
39676
+ // else {} // when val 0 do nothing, doesn't change anything
39482
39677
  }
39483
39678
  return {
39484
39679
  newEntries: newEntries.filter(Boolean),
@@ -39507,9 +39702,15 @@ ReferenceCounter.prototype.addReference = function(key, referer) {
39507
39702
 
39508
39703
  if(this._counter[key]) {
39509
39704
  ++this._counter[key];
39705
+ // The session will not change when a field already exists and a counter is attempted to be added
39510
39706
  } else {
39511
39707
  this._counter[key] = 1;
39512
- this._session[key] = 1;
39708
+ if(this._session[key] === -1) {
39709
+ this._session[key] = 0;
39710
+ } else {
39711
+ this._session[key] = 1;
39712
+ }
39713
+
39513
39714
  return true;
39514
39715
  }
39515
39716
  }
@@ -39559,7 +39760,11 @@ ReferenceCounter.prototype.removeReference = function(key, referer, count) {
39559
39760
  val -= count;
39560
39761
  if(!val || val < 0) {
39561
39762
  delete this._counter[key];
39562
- this._session[key] = -1;
39763
+ if(this._session[key] === 1) {
39764
+ this._session[key] = 0;
39765
+ } else {
39766
+ this._session[key] = -1;
39767
+ }
39563
39768
  return true;
39564
39769
  }
39565
39770
 
@@ -40252,6 +40457,10 @@ SortableTitlePlugin.prototype._userManagedLogic = false;
40252
40457
  * @type {boolean}
40253
40458
  */
40254
40459
  SortableTitlePlugin.prototype._disabled = false;
40460
+ /** @private
40461
+ * @type {boolean}
40462
+ */
40463
+ SortableTitlePlugin.prototype._frozenIndicator = false;
40255
40464
  /** Since DataView in real-time grid has only one ROW_DEF column, we need to re-map sorting field to sort correctly.
40256
40465
  * @private
40257
40466
  * @type {boolean}
@@ -40810,8 +41019,9 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
40810
41019
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
40811
41020
  */
40812
41021
  SortableTitlePlugin.prototype.clearSortState = function (opt_arg) {
40813
- this._popSortState(0, opt_arg);
40814
- this.updateSortSymbols();
41022
+ if(this._popSortState(0, opt_arg)) {
41023
+ this.updateSortSymbols();
41024
+ }
40815
41025
  };
40816
41026
  /** @description Perform sorting with the same parameter.
40817
41027
  * @public
@@ -41016,6 +41226,12 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
41016
41226
 
41017
41227
  };
41018
41228
  /** @public
41229
+ * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
41230
+ */
41231
+ SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
41232
+ this._frozenIndicator = bool !== false;
41233
+ };
41234
+ /** @public
41019
41235
  * @param {boolean=} disabled
41020
41236
  */
41021
41237
  SortableTitlePlugin.prototype.disableSortSymbols = function (disabled) {
@@ -41628,7 +41844,7 @@ SortableTitlePlugin.prototype._clearSortSymbols = function (state) {
41628
41844
  SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
41629
41845
  var t = this;
41630
41846
  var host = t._hosts[hostIndex];
41631
- if (!host) { return; }
41847
+ if (!host || this._frozenIndicator) { return; }
41632
41848
 
41633
41849
  var section = host.getSection("title");
41634
41850
  if (section == null) { return; }
@@ -41916,6 +42132,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
41916
42132
  * @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
41917
42133
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
41918
42134
  * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
42135
+ * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
41919
42136
  */
41920
42137
 
41921
42138
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -42112,8 +42329,7 @@ var Grid = function(placeholder, config) {
42112
42329
  t._recalculateFormulas = t._recalculateFormulas.bind(t);
42113
42330
  t._updateStreamingData = t._updateStreamingData.bind(t);
42114
42331
  t.updateColumnTitle = t.updateColumnTitle.bind(t);
42115
- t._insertTimeSeriesChildren = t._insertTimeSeriesChildren.bind(t);
42116
-
42332
+ t._populateTimeSeriesChildren = t._populateTimeSeriesChildren.bind(t);
42117
42333
 
42118
42334
  t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
42119
42335
  t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
@@ -42137,7 +42353,7 @@ var Grid = function(placeholder, config) {
42137
42353
  t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
42138
42354
  t._chainConflator = new Conflator(100, t._addMemberOfChain);
42139
42355
  t._columnTitleConflator = new Conflator(0, t.updateColumnTitle);
42140
- t._timeSeriesChildConflator = new Conflator(0, t._insertTimeSeriesChildren);
42356
+ t._timeSeriesChildConflator = new Conflator(0, t._populateTimeSeriesChildren);
42141
42357
 
42142
42358
 
42143
42359
  t._defaultColumnOptions = {};
@@ -42378,6 +42594,10 @@ Grid.prototype._pollingEnabled = true;
42378
42594
  * @private
42379
42595
  */
42380
42596
  Grid.prototype._fieldCaching = false;
42597
+ /** @type {string}
42598
+ * @private
42599
+ */
42600
+ Grid.prototype._childDataField = "";
42381
42601
 
42382
42602
 
42383
42603
  /** @public
@@ -42792,6 +43012,9 @@ Grid.prototype.initialize = function(gridOption) {
42792
43012
  }
42793
43013
 
42794
43014
  // Row operations
43015
+ if(gridOption["childDataField"] != null) {
43016
+ this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
43017
+ }
42795
43018
  var rows = gridOption["rows"];
42796
43019
  if(!rows) {
42797
43020
  rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
@@ -42947,6 +43170,10 @@ Grid.prototype.getConfigObject = function (gridOptions) {
42947
43170
  obj["fieldCaching"] = this._fieldCaching;
42948
43171
  }
42949
43172
 
43173
+ if(this._childDataField) {
43174
+ obj["childDataField"] = this._childDataField;
43175
+ }
43176
+
42950
43177
  // get all rows config
42951
43178
  var rowDefs = this.getAllRowDefinitions();
42952
43179
  var rows = obj["rows"] = [];
@@ -43084,9 +43311,8 @@ Grid.prototype._onFieldAdded = function(e) {
43084
43311
 
43085
43312
  // JET
43086
43313
  if (this._subs) {
43087
- var colDefs = this.getColumnDefinitions();
43088
- var fields = colDefs.reduce(ColumnDefinition.getRealTimeFields, []);
43089
- this._subs["addFields"](fields);
43314
+ var realtimeFields = addedFields.filter(js_FieldDefinition.isRealTimeField);
43315
+ this._subs["addFields"](realtimeFields);
43090
43316
  }
43091
43317
 
43092
43318
  this._dispatch(e.type, e);
@@ -43097,6 +43323,7 @@ Grid.prototype._onFieldAdded = function(e) {
43097
43323
  Grid.prototype._onFieldRemoved = function(e) {
43098
43324
  var removedFields = e.removedFields;
43099
43325
 
43326
+ // TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
43100
43327
  // JET
43101
43328
  if(this._subs) {
43102
43329
  this._subs["removeFields"](removedFields);
@@ -43193,7 +43420,7 @@ Grid.prototype._updateTimeSeriesFields = function (e) {
43193
43420
  /** @private
43194
43421
  * @param {ColumnDefinition} colDef
43195
43422
  */
43196
- Grid.prototype._insertTimeSeriesChildren = function (colDef) {
43423
+ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
43197
43424
  if(this._timeSeriesChildConflator.conflate(colDef) ) {
43198
43425
  return;
43199
43426
  }
@@ -43243,7 +43470,7 @@ Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx)
43243
43470
  }
43244
43471
  }
43245
43472
  columnOption = Object(Util["b" /* cloneObject */])(obj);
43246
- columnOption["field"] = childField.replace("TR.", "");
43473
+ columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
43247
43474
  columnOption["name"] = childField.split("_")[1].split("T")[0]; // Currently, response server format utc date ex "2022-11-23T00:00:00"
43248
43475
  columnOption["parent"] = parentColDef;
43249
43476
  this.insertColumn(columnOption, idx++);
@@ -43350,15 +43577,12 @@ Grid.prototype._onFieldLoadedError = function (err) {
43350
43577
  * @param {string} referrer
43351
43578
  */
43352
43579
  Grid.prototype._onFieldLoaded = function (field, referrer) {
43353
- // async process, the field can be remove before column added
43354
- var colIndex = this.getColumnIndex(field);
43355
- if(colIndex > -1) {
43356
- var colDef = this._getColumnDefinition(field);
43357
- if(colDef.isTimeSeriesField()) {
43358
- this._insertTimeSeriesChildren(colDef);
43359
- }
43360
- this._connector.addFields(field, referrer);
43580
+ // For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
43581
+ if(js_FieldDefinition.isTimeSeries(field)) {
43582
+ var colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
43583
+ this._populateTimeSeriesChildren(colDef);
43361
43584
  }
43585
+ this._connector.addFields(field, referrer);
43362
43586
  };
43363
43587
 
43364
43588
  /**
@@ -43387,7 +43611,7 @@ Grid.prototype._shouldLoadFieldInfo = function (field, isRealTime) {
43387
43611
  var fieldDef = js_FieldDefinition.get(field);
43388
43612
  if (!fieldDef &&
43389
43613
  field !== 'X_RIC_NAME' && // ignore X_RIC_NAME
43390
- (isRealTime || ColumnDefinition.isAdcField(field)) && // realtime field or adc field (Without static field)
43614
+ (isRealTime || js_FieldDefinition.isAdc(field)) && // realtime field or adc field (Without static field)
43391
43615
  (this._RTK || window["JET"]) // have rtk instance or window jet sub
43392
43616
  ) {
43393
43617
  return true;
@@ -43491,14 +43715,13 @@ Grid.prototype._onColumnAdded = function(e) {
43491
43715
  }
43492
43716
  }
43493
43717
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
43494
-
43495
43718
  var fields = colDef.getAllFields();
43496
43719
  var referrer = colDef.getId();
43497
43720
  var len = fields.length;
43498
43721
  var field, dataType, prom, isRealTimeField, onLoaded;
43499
43722
  for(i = 0; i < len; i++) {
43500
43723
  field = fields[i];
43501
- isRealTimeField = ColumnDefinition.isRealTimeField(field);
43724
+ isRealTimeField = js_FieldDefinition.isRealTimeField(field);
43502
43725
  if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
43503
43726
  if(field === colField) {
43504
43727
  dataType = colDef.getDataType(); // Data-type from user's column options
@@ -43514,14 +43737,14 @@ Grid.prototype._onColumnAdded = function(e) {
43514
43737
  onLoaded = this._onFieldLoaded.bind(this, field, referrer);
43515
43738
  prom = prom.then(onLoaded).catch(onLoaded);
43516
43739
  } else {
43517
- if(colDef.isTimeSeriesField()) {
43518
- this._insertTimeSeriesChildren(colDef);
43740
+ if(colDef.isTimeSeries()) {
43741
+ this._populateTimeSeriesChildren(colDef);
43519
43742
  }
43520
43743
  this._connector.addFields(field, referrer);
43521
43744
  }
43522
43745
  } else {
43523
- if(colDef.isTimeSeriesField()) {
43524
- this._insertTimeSeriesChildren(colDef);
43746
+ if(colDef.isTimeSeries()) {
43747
+ this._populateTimeSeriesChildren(colDef);
43525
43748
  }
43526
43749
  this._connector.addFields(field, referrer);
43527
43750
  }
@@ -43677,6 +43900,62 @@ Grid.prototype.moveColumnById = function (srcCol, destCol) {
43677
43900
  return this.moveColumn(srcIndex, destIndex);
43678
43901
  };
43679
43902
 
43903
+ /** @public
43904
+ * @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
43905
+ * @param {number|string} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
43906
+ * @return {boolean} Return true if there is any change, and false otherwise
43907
+ */
43908
+ Grid.prototype.reorderColumns = function (colRefs, destCol) {
43909
+ var destId = (typeof destCol === "number") ? this.getColumnId(destCol) : destCol;
43910
+
43911
+ if(Array.isArray(colRefs)) {
43912
+ var srcLen = colRefs.length;
43913
+ if(srcLen > 1) {
43914
+ var colIds = this.getColumnIds();
43915
+ var srcIds = [];
43916
+ var invalidDest = false;
43917
+ var i;
43918
+ for(i = 0; i < srcLen; ++i) {
43919
+ var colRef = colRefs[i];
43920
+ var srcId = (typeof colRef === "number") ? colIds[colRef] : colRef;
43921
+ if(srcId) {
43922
+ srcIds.push(srcId);
43923
+ if(destId === srcId) {
43924
+ invalidDest = true; // Destination must not exist in source columns
43925
+ }
43926
+ }
43927
+ }
43928
+ srcLen = srcIds.length;
43929
+ if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
43930
+ var colCount = colIds.length;
43931
+ var destIdx = this.getColumnIndex(destId);
43932
+ if(destIdx >= 0) {
43933
+ while(++destIdx < colCount) {
43934
+ destId = colIds[destIdx];
43935
+ if(srcIds.indexOf(destId) < 0) {
43936
+ break;
43937
+ }
43938
+ }
43939
+ }
43940
+ if(destIdx < 0 || destIdx >= colCount) {
43941
+ destId = "";
43942
+ }
43943
+ }
43944
+
43945
+ var dirty = 0;
43946
+ for(i = 0; i < srcLen; ++i) {
43947
+ dirty |= this.moveColumnById(srcIds[i], destId);
43948
+ }
43949
+ // TODO: Handle the case where all columns stay in the same place
43950
+ return dirty ? true : false;
43951
+ } else {
43952
+ return this.moveColumnById(colRefs[0], destId);
43953
+ }
43954
+ }
43955
+
43956
+ // colRefs will be a number or string
43957
+ return this.moveColumnById(colRefs, destId);
43958
+ };
43680
43959
 
43681
43960
  /** The hidden column still occupies the same index.
43682
43961
  * @public
@@ -43747,7 +44026,7 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
43747
44026
  var i, field, dataType, prom, isRealTimeField, onLoaded;
43748
44027
  for(i = 0; i < len; i++) {
43749
44028
  field = fields[i];
43750
- isRealTimeField = ColumnDefinition.isRealTimeField(field);
44029
+ isRealTimeField = js_FieldDefinition.isRealTimeField(field);
43751
44030
  if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
43752
44031
  dataType = ColumnDefinition.getDataType(field);
43753
44032
  prom = js_FieldDefinition.loadFieldInfo(field)
@@ -44867,7 +45146,7 @@ Grid.prototype.unpinColumn = function(colRef, dest) {
44867
45146
  var len = ary.length;
44868
45147
 
44869
45148
  var dirty = 0;
44870
- for(var i = 0; i < len; ++i) {
45149
+ for(var i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
44871
45150
  dirty |= this._unpinColumn(ary[i], dest);
44872
45151
  }
44873
45152
  return dirty ? true : false;