@refinitiv-ui/efx-grid 6.0.87 → 6.0.89
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +55 -0
- package/lib/core/dist/core.js +2 -2
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +0 -2
- package/lib/core/es6/grid/Core.js +2 -2
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +786 -706
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +68 -68
- package/lib/rt-grid/es6/DataConnector.js +26 -26
- package/lib/rt-grid/es6/FieldDefinition.js +27 -27
- package/lib/rt-grid/es6/Grid.js +390 -378
- package/lib/rt-grid/es6/PredefinedFormula.js +1 -1
- package/lib/rt-grid/es6/ReferenceCounter.js +15 -15
- package/lib/rt-grid/es6/RowDefSorter.js +26 -26
- package/lib/rt-grid/es6/RowDefinition.d.ts +5 -6
- package/lib/rt-grid/es6/RowDefinition.js +105 -76
- package/lib/rt-grid/es6/SnapshotFiller.js +77 -77
- package/lib/rt-grid/es6/StyleLoader.js +1 -1
- package/lib/statistics-row/es6/StatisticsRow.d.ts +1 -0
- package/lib/statistics-row/es6/StatisticsRow.js +18 -2
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +0 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +2 -2
- package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +18 -18
- package/lib/tr-grid-percent-bar/es6/PercentBar.js +7 -1
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +69 -18
- package/lib/tr-grid-titlewrap/es6/TitleWrap.d.ts +0 -2
- package/lib/tr-grid-titlewrap/es6/TitleWrap.js +1 -1
- package/lib/tr-grid-util/es6/DragUI.js +2 -1
- package/lib/types/es6/PercentBar.d.ts +18 -18
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +5 -2
- package/lib/types/es6/RowFiltering.d.ts +2 -0
- package/lib/types/es6/StatisticsRow.d.ts +1 -0
- package/lib/versions.json +10 -10
- package/package.json +1 -1
@@ -13216,6 +13216,7 @@ DataTable._proto = DataTable.prototype;
|
|
13216
13216
|
* @property {(string|null)=} label=null
|
13217
13217
|
* @property {boolean=} hidden=true When this row is hidden
|
13218
13218
|
* @property {boolean=} realTime=true Realtime row, able to request for JET/RTK
|
13219
|
+
* @property {Object=} info=null For storing any additional information to the row
|
13219
13220
|
*/
|
13220
13221
|
|
13221
13222
|
/** @typedef {Object} RowDefinition~RowTypes
|
@@ -13231,13 +13232,13 @@ DataTable._proto = DataTable.prototype;
|
|
13231
13232
|
* @public
|
13232
13233
|
* @const
|
13233
13234
|
*/
|
13234
|
-
|
13235
|
+
const ROW_DEF = "ROW_DEF";
|
13235
13236
|
|
13236
13237
|
/** @type {!RowDefinition~RowTypes}
|
13237
13238
|
* @public
|
13238
13239
|
* @const
|
13239
13240
|
*/
|
13240
|
-
|
13241
|
+
const ROW_TYPES = {
|
13241
13242
|
CONTENT: "CONTENT",
|
13242
13243
|
CHAIN: "CHAIN",
|
13243
13244
|
CONSTITUENT: "CONSTITUENT",
|
@@ -13249,7 +13250,7 @@ var ROW_TYPES = {
|
|
13249
13250
|
/** @constructor
|
13250
13251
|
* @param {RowDefinition~Options=} rowOptions
|
13251
13252
|
*/
|
13252
|
-
|
13253
|
+
let RowDefinition = function(rowOptions) {
|
13253
13254
|
this._changes = {};
|
13254
13255
|
if(rowOptions && rowOptions["segmentId"]) { // This row will be classification header row
|
13255
13256
|
this._dataId = this._rowId = rowOptions["segmentId"];
|
@@ -13372,6 +13373,11 @@ RowDefinition.prototype._depthLevel = 0;
|
|
13372
13373
|
* @private
|
13373
13374
|
*/
|
13374
13375
|
RowDefinition.prototype._userModel = null;
|
13376
|
+
/** @type {Object}
|
13377
|
+
* @private
|
13378
|
+
*/
|
13379
|
+
RowDefinition.prototype._info = null;
|
13380
|
+
|
13375
13381
|
//#endregion Private Members
|
13376
13382
|
|
13377
13383
|
/** @public
|
@@ -13391,7 +13397,7 @@ RowDefinition.prototype.dispose = function() {
|
|
13391
13397
|
this._depthLevel = 0;
|
13392
13398
|
this.unsubscribeForUpdates();
|
13393
13399
|
if(this._dc) {
|
13394
|
-
|
13400
|
+
let rowData = this.getRowData();
|
13395
13401
|
if(rowData) {
|
13396
13402
|
rowData[ROW_DEF] = null;
|
13397
13403
|
}
|
@@ -13417,9 +13423,9 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13417
13423
|
return;
|
13418
13424
|
}
|
13419
13425
|
|
13420
|
-
|
13426
|
+
let extractedOptions = RowDefinition.extractRowOptions(rowOptions);
|
13421
13427
|
|
13422
|
-
|
13428
|
+
let val = rowOptions["permId"];
|
13423
13429
|
if(val != null) {
|
13424
13430
|
this._permId = val;
|
13425
13431
|
}
|
@@ -13448,7 +13454,7 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13448
13454
|
}
|
13449
13455
|
|
13450
13456
|
val = rowOptions["collapsed"];
|
13451
|
-
|
13457
|
+
let collapsed = extractedOptions["collapsed"];
|
13452
13458
|
if(val != null || !collapsed){
|
13453
13459
|
this._expanded = !collapsed;
|
13454
13460
|
}
|
@@ -13456,8 +13462,12 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13456
13462
|
if(val) {
|
13457
13463
|
this._userModel = rowOptions;
|
13458
13464
|
}
|
13465
|
+
val = rowOptions["info"];
|
13466
|
+
if(val) {
|
13467
|
+
this._info = val;
|
13468
|
+
}
|
13459
13469
|
|
13460
|
-
|
13470
|
+
let symbol = this._ric || this._chainRic;
|
13461
13471
|
if(symbol || this._permId){
|
13462
13472
|
this.setContent(symbol, extractedOptions); // this._dataId is modified
|
13463
13473
|
}
|
@@ -13473,19 +13483,19 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13473
13483
|
*/
|
13474
13484
|
RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
13475
13485
|
this._autoGenerated = true;
|
13476
|
-
|
13486
|
+
let parentDef = /** @type{RowDefinition} */(rowOptions["parent"]);
|
13477
13487
|
if(this.setParent(parentDef)) {
|
13478
13488
|
this._dataId = /** @type{string} */(rowOptions["dataId"]); // Constituent will have the same subId as its parent but with different ric
|
13479
13489
|
this._ric = /** @type{string} */(rowOptions["ric"]);
|
13480
13490
|
this._dc = parentDef._dc; // Parent chain must have data cache
|
13481
13491
|
if(this._dc) {
|
13482
|
-
|
13492
|
+
let rowData = this.getRowData(); // Do not trigger any data update
|
13483
13493
|
if(rowData) { // Row data from data cache must exist beforehand
|
13484
13494
|
rowData[ROW_DEF] = this; // This is for easy referencing from data streaming, also for preventing duplication
|
13485
13495
|
}
|
13486
13496
|
}
|
13487
13497
|
}
|
13488
|
-
|
13498
|
+
let val = rowOptions["values"];
|
13489
13499
|
// eslint-disable-next-line no-undefined
|
13490
13500
|
if(val !== undefined) {
|
13491
13501
|
this.setStaticRowData(val, rowOptions["fields"]);
|
@@ -13508,8 +13518,8 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13508
13518
|
userInput += "";
|
13509
13519
|
}
|
13510
13520
|
|
13511
|
-
|
13512
|
-
|
13521
|
+
let dirty = (this._userInput !== userInput);
|
13522
|
+
let permId = extractedOptions["permId"];
|
13513
13523
|
if(this._permId !== permId){
|
13514
13524
|
this._permId = permId || "";
|
13515
13525
|
dirty = true;
|
@@ -13527,9 +13537,9 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13527
13537
|
if(this._userInput.charAt(0) === "'") { // This is a row header
|
13528
13538
|
this._ric = this._chainRic = ""; // No ric for realtime request
|
13529
13539
|
} else {
|
13530
|
-
|
13531
|
-
|
13532
|
-
|
13540
|
+
let asChain = extractedOptions["asChain"];
|
13541
|
+
let expanded = !extractedOptions["collapsed"];
|
13542
|
+
let chainRic = extractedOptions["chainRic"];
|
13533
13543
|
if(asChain === true){
|
13534
13544
|
this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
|
13535
13545
|
this._expanded = expanded; // Only chain can be expanded by 0#
|
@@ -13542,8 +13552,8 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13542
13552
|
|
13543
13553
|
if(this._view) {
|
13544
13554
|
if(this._isChain){
|
13545
|
-
|
13546
|
-
|
13555
|
+
let rid = this.getRowId();
|
13556
|
+
let segmentId = this._view.getSegmentParentRowId(rid);
|
13547
13557
|
if(segmentId){
|
13548
13558
|
this._view.removeSegmentChild(segmentId, rid);
|
13549
13559
|
}
|
@@ -13563,7 +13573,7 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13563
13573
|
if(this._dc) {
|
13564
13574
|
// This will work for runtime ric modification, but not for first initilization.
|
13565
13575
|
// Avoid losing the ROW_DEF pointer.
|
13566
|
-
|
13576
|
+
let rowData = {};
|
13567
13577
|
rowData[ROW_DEF] = this; // Enable tracking back and updating data
|
13568
13578
|
rowData["X_RIC_NAME"] = this.getDisplayText();
|
13569
13579
|
this.setRowData(rowData);
|
@@ -13582,8 +13592,8 @@ RowDefinition.prototype.getRowId = function() {
|
|
13582
13592
|
* @return {RowDefinition~Options}
|
13583
13593
|
*/
|
13584
13594
|
RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
13585
|
-
|
13586
|
-
|
13595
|
+
let obj = rowOptions || {};
|
13596
|
+
let val = this._ric;
|
13587
13597
|
if(val) {
|
13588
13598
|
obj["ric"] = val;
|
13589
13599
|
}
|
@@ -13615,7 +13625,7 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13615
13625
|
|
13616
13626
|
val = this._userModel;
|
13617
13627
|
if(val) {
|
13618
|
-
obj["keepModel"] = obj;
|
13628
|
+
obj["keepModel"] = obj; // This is bad
|
13619
13629
|
}
|
13620
13630
|
|
13621
13631
|
val = this._isChain;
|
@@ -13634,6 +13644,11 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13634
13644
|
obj["hidden"] = val;
|
13635
13645
|
}
|
13636
13646
|
|
13647
|
+
val = this._info;
|
13648
|
+
if(val) {
|
13649
|
+
obj["info"] = this._info;
|
13650
|
+
}
|
13651
|
+
|
13637
13652
|
val = this._getStaticRowData();
|
13638
13653
|
if(val) {
|
13639
13654
|
obj["values"] = val;
|
@@ -13641,15 +13656,15 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13641
13656
|
|
13642
13657
|
// obtain the static values of constituent rows
|
13643
13658
|
if(this.isChain()) {
|
13644
|
-
|
13659
|
+
let children = this.getChildren();
|
13645
13660
|
if(children) {
|
13646
|
-
|
13661
|
+
let childValues = val ? val[RowDefinition._childDataField] : {};
|
13647
13662
|
if(!childValues) {
|
13648
13663
|
childValues = {};
|
13649
13664
|
}
|
13650
|
-
|
13651
|
-
|
13652
|
-
|
13665
|
+
let dirty = false;
|
13666
|
+
let len = children.length;
|
13667
|
+
let i, rowDef, staticValues;
|
13653
13668
|
for(i = 0; i < len; i++) {
|
13654
13669
|
rowDef = children[i];
|
13655
13670
|
staticValues = rowDef._getStaticRowData();
|
@@ -13686,11 +13701,11 @@ RowDefinition.prototype.getType = function() {
|
|
13686
13701
|
} else if(this._parent) {
|
13687
13702
|
return ROW_TYPES.CONSTITUENT;
|
13688
13703
|
} else {
|
13689
|
-
|
13704
|
+
let dv = this._view;
|
13690
13705
|
if(dv) {
|
13691
|
-
|
13692
|
-
|
13693
|
-
|
13706
|
+
let rid = this.getRowId();
|
13707
|
+
let separator = dv.isSegmentSeparator(rid);
|
13708
|
+
let level = dv.getSegmentLevel(rid);
|
13694
13709
|
if(separator) {
|
13695
13710
|
if(level === 1) {
|
13696
13711
|
return ROW_TYPES.GROUP_HEADER;
|
@@ -13718,7 +13733,7 @@ RowDefinition.prototype.setDataSource = function(dataSource) {
|
|
13718
13733
|
return;
|
13719
13734
|
}
|
13720
13735
|
|
13721
|
-
|
13736
|
+
let rowData = this.getRowData();
|
13722
13737
|
if(!rowData) {
|
13723
13738
|
rowData = {};
|
13724
13739
|
rowData[ROW_DEF] = this; // Enable tracking back and updating data
|
@@ -13772,7 +13787,7 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
13772
13787
|
this.setRowData(data);
|
13773
13788
|
}
|
13774
13789
|
};
|
13775
|
-
/** @
|
13790
|
+
/** @private
|
13776
13791
|
* @return {Object.<string, *>}
|
13777
13792
|
*/
|
13778
13793
|
RowDefinition.prototype._getStaticRowData = function() {
|
@@ -13824,7 +13839,7 @@ RowDefinition.prototype.setData = function(field, value) {
|
|
13824
13839
|
*/
|
13825
13840
|
RowDefinition.prototype._clearStaticData = function() {
|
13826
13841
|
if(this._staticValues) {
|
13827
|
-
for(
|
13842
|
+
for(let key in this._staticValues) {
|
13828
13843
|
this._staticValues[key] = null;
|
13829
13844
|
}
|
13830
13845
|
if(this._dc) {
|
@@ -13961,19 +13976,19 @@ RowDefinition.prototype.subscribeForUpdates = function() {
|
|
13961
13976
|
return false;
|
13962
13977
|
}
|
13963
13978
|
|
13964
|
-
|
13979
|
+
let subs = this._dc ? this._dc.getSubscriptions() : null;
|
13965
13980
|
if(!subs) {
|
13966
13981
|
return false;
|
13967
13982
|
}
|
13968
13983
|
// TODO: Check if the same subscription is being made.
|
13969
|
-
|
13984
|
+
let prevRowData = this.unsubscribeForUpdates();
|
13970
13985
|
|
13971
13986
|
if(this.isChain()) {
|
13972
|
-
|
13987
|
+
let symbol = this._chainRic;
|
13973
13988
|
if(!symbol){
|
13974
13989
|
symbol = this._ric;
|
13975
13990
|
if(symbol.indexOf("0#") < 0){
|
13976
|
-
|
13991
|
+
let count = (symbol.match(/\./g) || []).length;
|
13977
13992
|
if(count < 2){
|
13978
13993
|
symbol = "0#" + symbol;
|
13979
13994
|
}
|
@@ -13999,8 +14014,8 @@ RowDefinition.prototype.unsubscribeForUpdates = function() {
|
|
13999
14014
|
return;
|
14000
14015
|
}
|
14001
14016
|
|
14002
|
-
|
14003
|
-
|
14017
|
+
let subs = this._dc.getSubscriptions();
|
14018
|
+
let prevRowData = this.getRowData();
|
14004
14019
|
|
14005
14020
|
subs["removeSubscription"](this._subId);
|
14006
14021
|
this._subId = "";
|
@@ -14025,10 +14040,10 @@ RowDefinition.prototype.isSubscribing = function() {
|
|
14025
14040
|
*/
|
14026
14041
|
RowDefinition.prototype.addUpdate = function(e) {
|
14027
14042
|
if(e) {
|
14028
|
-
|
14043
|
+
let changes = e["changes"];
|
14029
14044
|
if(changes) {
|
14030
|
-
|
14031
|
-
for(
|
14045
|
+
let dirty = 0;
|
14046
|
+
for(let field in changes) {
|
14032
14047
|
this._changes[field] = dirty = 1;
|
14033
14048
|
}
|
14034
14049
|
if(dirty) {
|
@@ -14065,7 +14080,7 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
|
|
14065
14080
|
}
|
14066
14081
|
this._view = view;
|
14067
14082
|
|
14068
|
-
|
14083
|
+
let rowData = null;
|
14069
14084
|
if(this._subSegment) {
|
14070
14085
|
rowData = this._view.getRowData(this.getRowId());
|
14071
14086
|
if(rowData) {
|
@@ -14077,7 +14092,7 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
|
|
14077
14092
|
rowData = {};
|
14078
14093
|
rowData[ROW_DEF] = this;
|
14079
14094
|
|
14080
|
-
|
14095
|
+
let newRowId = this._view.insertRow(rowId, rowData, this.getRowId());
|
14081
14096
|
this._rowId = newRowId; // In case there is some duplicate row id.
|
14082
14097
|
|
14083
14098
|
if(this._isChain) {
|
@@ -14108,7 +14123,7 @@ RowDefinition.prototype._deregisterFromView = function(rowIds) {
|
|
14108
14123
|
* @param {RowDefinition} rowDef
|
14109
14124
|
* @return {Array.<string>}
|
14110
14125
|
* @example
|
14111
|
-
*
|
14126
|
+
* let rowIds = descendants.reduce(RowDefinition.deregisterFromView, []);
|
14112
14127
|
*/
|
14113
14128
|
RowDefinition.deregisterFromView = function(rowIds, rowDef) {
|
14114
14129
|
rowDef._deregisterFromView(rowIds);
|
@@ -14123,7 +14138,7 @@ RowDefinition.prototype._getChildStaticRowData = function(ric) {
|
|
14123
14138
|
return null;
|
14124
14139
|
}
|
14125
14140
|
|
14126
|
-
|
14141
|
+
let childValues = this._staticValues[RowDefinition._childDataField];
|
14127
14142
|
if(!childValues) {
|
14128
14143
|
return null;
|
14129
14144
|
}
|
@@ -14143,9 +14158,9 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
14143
14158
|
return null;
|
14144
14159
|
}
|
14145
14160
|
|
14146
|
-
|
14161
|
+
let childDef = null;
|
14147
14162
|
if(this._children) {
|
14148
|
-
for(
|
14163
|
+
for(let i = this._children.length; --i >= 0;) {
|
14149
14164
|
if(this._children[i]._ric === ric) {
|
14150
14165
|
childDef = this._children[i]; // Constituent has already been added
|
14151
14166
|
break;
|
@@ -14155,16 +14170,16 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
14155
14170
|
this._children = [];
|
14156
14171
|
}
|
14157
14172
|
|
14158
|
-
|
14173
|
+
let newChild = !childDef;
|
14159
14174
|
if(newChild) {
|
14160
|
-
|
14175
|
+
let rowOptions = {
|
14161
14176
|
"asConstituent": true,
|
14162
14177
|
"dataId": this._subId + ric,
|
14163
14178
|
"ric": ric,
|
14164
14179
|
"parent": this
|
14165
14180
|
};
|
14166
14181
|
|
14167
|
-
|
14182
|
+
let staticData = this._getChildStaticRowData(ric);
|
14168
14183
|
if(staticData) {
|
14169
14184
|
rowOptions["values"] = staticData;
|
14170
14185
|
}
|
@@ -14173,11 +14188,11 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
14173
14188
|
}
|
14174
14189
|
|
14175
14190
|
if(this._view) {
|
14176
|
-
|
14191
|
+
let rowId = this.getRowId();
|
14177
14192
|
// 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
|
14178
|
-
|
14179
|
-
|
14180
|
-
|
14193
|
+
let childOrder = childDef.getData("CHILD_ORDER");
|
14194
|
+
let parentIndex = this._view.getRowIndex(rowId);
|
14195
|
+
let position = parentIndex + this.getChildCount(); // push the last position
|
14181
14196
|
if(childOrder != null) {
|
14182
14197
|
// 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.
|
14183
14198
|
position = parentIndex + childOrder + 1; // insert between segment
|
@@ -14191,7 +14206,7 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
14191
14206
|
};
|
14192
14207
|
|
14193
14208
|
/** Used to convert autogenerated row to regular real-time row
|
14194
|
-
* @
|
14209
|
+
* @private
|
14195
14210
|
*/
|
14196
14211
|
RowDefinition.prototype._toRealTimeRow = function() {
|
14197
14212
|
if(!this._ric) { // Empty row
|
@@ -14219,19 +14234,19 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
14219
14234
|
}
|
14220
14235
|
|
14221
14236
|
if(this.isChainExpanded()) {
|
14222
|
-
|
14223
|
-
|
14224
|
-
for(
|
14237
|
+
let rowDefs = this.getDescendants();
|
14238
|
+
let len = rowDefs.length;
|
14239
|
+
for(let i = 0; i < len; i++) {
|
14225
14240
|
rowDefs[i]._toRealTimeRow();
|
14226
14241
|
}
|
14227
14242
|
}
|
14228
14243
|
|
14229
14244
|
this.unsubscribeForUpdates();
|
14230
14245
|
|
14231
|
-
|
14246
|
+
let view = this._view;
|
14232
14247
|
if(view) {
|
14233
|
-
|
14234
|
-
|
14248
|
+
let rid = this.getRowId();
|
14249
|
+
let segment = view.getSegment(rid);
|
14235
14250
|
if(segment) {
|
14236
14251
|
segment.setClassification(null);
|
14237
14252
|
}
|
@@ -14314,10 +14329,10 @@ RowDefinition.prototype.getDescendants = function(ary) {
|
|
14314
14329
|
ary = [];
|
14315
14330
|
}
|
14316
14331
|
if(this._children) {
|
14317
|
-
|
14318
|
-
|
14319
|
-
for(
|
14320
|
-
|
14332
|
+
let chdr = this._children;
|
14333
|
+
let len = chdr.length;
|
14334
|
+
for(let i = 0; i < len; ++i) {
|
14335
|
+
let ch = chdr[i];
|
14321
14336
|
ary.push(ch);
|
14322
14337
|
ch.getDescendants(ary);
|
14323
14338
|
}
|
@@ -14329,7 +14344,7 @@ RowDefinition.prototype.getDescendants = function(ary) {
|
|
14329
14344
|
* @return {Array.<string>} Null if there is no row Id
|
14330
14345
|
*/
|
14331
14346
|
RowDefinition.prototype.getAllDescendantIds = function() {
|
14332
|
-
|
14347
|
+
let descendants = this.getDescendants();
|
14333
14348
|
if(descendants.length) {
|
14334
14349
|
return descendants.map(RowDefinition.toRowId);
|
14335
14350
|
} else {
|
@@ -14358,7 +14373,7 @@ RowDefinition.prototype.setParent = function(parentDef) {
|
|
14358
14373
|
return false;
|
14359
14374
|
}
|
14360
14375
|
if(this._parent) { // Release from previous parent
|
14361
|
-
|
14376
|
+
let at = this._parent._children.lastIndexOf(this);
|
14362
14377
|
if(at >= 0) {
|
14363
14378
|
this._parent._children.splice(at, 1);
|
14364
14379
|
}
|
@@ -14410,12 +14425,26 @@ RowDefinition.prototype.setGroupOrder = function(num) {
|
|
14410
14425
|
};
|
14411
14426
|
|
14412
14427
|
/** @public
|
14428
|
+
* @ignore
|
14413
14429
|
* @return {Object}
|
14414
14430
|
*/
|
14415
14431
|
RowDefinition.prototype.getUserModel = function() {
|
14416
14432
|
return this._userModel;
|
14417
14433
|
};
|
14418
14434
|
|
14435
|
+
/** @public
|
14436
|
+
* @param {Object} obj
|
14437
|
+
*/
|
14438
|
+
RowDefinition.prototype.setRowInfo = function(obj) {
|
14439
|
+
this._info = obj;
|
14440
|
+
};
|
14441
|
+
/** @public
|
14442
|
+
* @return {Object}
|
14443
|
+
*/
|
14444
|
+
RowDefinition.prototype.getRowInfo = function() {
|
14445
|
+
return this._info;
|
14446
|
+
};
|
14447
|
+
|
14419
14448
|
/** For mapping row Id by Array.map()
|
14420
14449
|
* @public
|
14421
14450
|
* @function
|
@@ -14433,15 +14462,15 @@ RowDefinition.toRowId = function(rowDef) {
|
|
14433
14462
|
* @return {RowDefinition~Options}
|
14434
14463
|
*/
|
14435
14464
|
RowDefinition.extractRowOptions = function(rowOptions) {
|
14436
|
-
|
14437
|
-
|
14438
|
-
|
14439
|
-
|
14440
|
-
|
14465
|
+
let ric = rowOptions["ric"];
|
14466
|
+
let permId = rowOptions["permId"];
|
14467
|
+
let chainRic = rowOptions["chainRic"];
|
14468
|
+
let collapsed = rowOptions["collapsed"];
|
14469
|
+
let asChain = rowOptions["asChain"];
|
14441
14470
|
if(asChain == null && chainRic){
|
14442
14471
|
asChain = true;
|
14443
14472
|
}
|
14444
|
-
|
14473
|
+
let expanded = null;
|
14445
14474
|
if(ric && ric.indexOf("0#") >= 0){
|
14446
14475
|
if(asChain == null){
|
14447
14476
|
asChain = true;
|
@@ -14449,7 +14478,7 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
14449
14478
|
expanded = true;
|
14450
14479
|
}
|
14451
14480
|
|
14452
|
-
|
14481
|
+
let extractedOptions = {};
|
14453
14482
|
if(collapsed == null) {
|
14454
14483
|
extractedOptions["collapsed"] = !expanded;
|
14455
14484
|
} else {
|
@@ -14485,13 +14514,13 @@ RowDefinition.dispose = function(rowDef) {
|
|
14485
14514
|
* @private
|
14486
14515
|
* @const
|
14487
14516
|
*/
|
14488
|
-
|
14517
|
+
const SYNAPSE_URL =
|
14489
14518
|
"/synapse/service/suggestions/suggest/?"
|
14490
14519
|
+ "hits=1" // search only 1 result
|
14491
14520
|
+ "&profile=" + encodeURIComponent("Field Selector");
|
14492
14521
|
|
14493
14522
|
/* @namespace */
|
14494
|
-
|
14523
|
+
let FieldDefinition = {};
|
14495
14524
|
|
14496
14525
|
/** @type {Object.<string, Object>}
|
14497
14526
|
* @private
|
@@ -14633,7 +14662,7 @@ FieldDefinition.set = function(field, def) {
|
|
14633
14662
|
if (!FieldDefinition._defs[field]) {
|
14634
14663
|
FieldDefinition._defs[field] = def;
|
14635
14664
|
} else {
|
14636
|
-
for (
|
14665
|
+
for (let key in def) {
|
14637
14666
|
FieldDefinition._defs[field][key] = def[key];
|
14638
14667
|
}
|
14639
14668
|
}
|
@@ -14661,7 +14690,7 @@ FieldDefinition.getFieldInfo = FieldDefinition.get;
|
|
14661
14690
|
* @return {boolean}
|
14662
14691
|
*/
|
14663
14692
|
FieldDefinition.hasFieldInfo = function(field) {
|
14664
|
-
|
14693
|
+
let val = FieldDefinition.get(field);
|
14665
14694
|
return (val && val.field) ? true : false; // Already preventing an error caused by accessing a property on a null value
|
14666
14695
|
};
|
14667
14696
|
|
@@ -14774,7 +14803,7 @@ FieldDefinition.isTimeSeries = function (field) {
|
|
14774
14803
|
}
|
14775
14804
|
|
14776
14805
|
// We can check time series using a cache to avoid duplicating checks in regular expressions.
|
14777
|
-
|
14806
|
+
let timeSeriesField = FieldDefinition.getFieldProperty(field, "timeSeries");
|
14778
14807
|
if (timeSeriesField != null) {
|
14779
14808
|
return timeSeriesField;
|
14780
14809
|
}
|
@@ -14789,7 +14818,7 @@ FieldDefinition.isTimeSeries = function (field) {
|
|
14789
14818
|
[\)]$ => end with only )
|
14790
14819
|
i => for match both upper and lower cases
|
14791
14820
|
*/
|
14792
|
-
|
14821
|
+
let timeSeriesRegex = /^TR\.[\w]+\([\w\-\=\,]*(?:EDATE|SDATE)\=+[\w\-\=\,]*[ \w]*\)$/i;
|
14793
14822
|
return timeSeriesRegex.test(field);
|
14794
14823
|
};
|
14795
14824
|
|
@@ -14815,7 +14844,7 @@ FieldDefinition.setFieldProperty = function(field, propertyName, value) {
|
|
14815
14844
|
* @return {*}
|
14816
14845
|
*/
|
14817
14846
|
FieldDefinition.getFieldProperty = function(field, propertyName) {
|
14818
|
-
|
14847
|
+
let fieldDef = FieldDefinition._defs[field];
|
14819
14848
|
if(fieldDef) {
|
14820
14849
|
return fieldDef[propertyName];
|
14821
14850
|
}
|
@@ -14832,8 +14861,8 @@ FieldDefinition.loadFieldInfo = function (field) {
|
|
14832
14861
|
return FieldDefinition._loadingField[field].promise;
|
14833
14862
|
}
|
14834
14863
|
|
14835
|
-
|
14836
|
-
|
14864
|
+
let defer = new Deferred();
|
14865
|
+
let synapse = FieldDefinition._synapse;
|
14837
14866
|
// cannot call request without synapse config
|
14838
14867
|
if (!synapse) {
|
14839
14868
|
defer.resolve(null);
|
@@ -14844,7 +14873,7 @@ FieldDefinition.loadFieldInfo = function (field) {
|
|
14844
14873
|
}
|
14845
14874
|
// in debug using mock data instead
|
14846
14875
|
else if (synapse.debug) {
|
14847
|
-
|
14876
|
+
let mockData = this._mockOnLoadEndData(field, defer);
|
14848
14877
|
setTimeout(onLoadEnd.bind(null, mockData), 1000);
|
14849
14878
|
}
|
14850
14879
|
// cannot call request without apiKey and contextApp
|
@@ -14853,7 +14882,7 @@ FieldDefinition.loadFieldInfo = function (field) {
|
|
14853
14882
|
}
|
14854
14883
|
// everything fine, call synapse service
|
14855
14884
|
else {
|
14856
|
-
|
14885
|
+
let queryUrl = SYNAPSE_URL
|
14857
14886
|
+ "&api-key=" + encodeURIComponent(synapse.apiKey)
|
14858
14887
|
+ "&contextApp=" + encodeURIComponent(synapse.contextApp)
|
14859
14888
|
+ "&language=" + encodeURIComponent(FieldDefinition._lang)
|
@@ -14862,7 +14891,7 @@ FieldDefinition.loadFieldInfo = function (field) {
|
|
14862
14891
|
queryUrl += "&auth=" + encodeURIComponent(synapse.auth);
|
14863
14892
|
}
|
14864
14893
|
// TODO: handle client timeout
|
14865
|
-
|
14894
|
+
let xmr = new XMLHttpRequest();
|
14866
14895
|
xmr._defer = defer;
|
14867
14896
|
xmr._field = field;
|
14868
14897
|
FieldDefinition._loadingField[field] = defer;
|
@@ -14895,16 +14924,16 @@ function onError(e) {
|
|
14895
14924
|
* @returns {Object}
|
14896
14925
|
*/
|
14897
14926
|
FieldDefinition._mockOnLoadEndData = function (field, defer) {
|
14898
|
-
|
14899
|
-
|
14900
|
-
|
14927
|
+
let fieldUpperCase = field.toUpperCase();
|
14928
|
+
let fieldLowerCase = fieldUpperCase.toLowerCase();
|
14929
|
+
let label;
|
14901
14930
|
if (fieldLowerCase.indexOf("_") === 2) { // transform XX_ABCD -> Abcd
|
14902
14931
|
label = fieldUpperCase[3] + fieldLowerCase.substring(4);
|
14903
14932
|
} else {
|
14904
14933
|
label = fieldUpperCase[0] + fieldLowerCase.substring(1);
|
14905
14934
|
}
|
14906
|
-
|
14907
|
-
|
14935
|
+
let dataType = (fieldUpperCase.indexOf("DATE") >= 0) ? "DATE" : "PRICE";
|
14936
|
+
let item = {
|
14908
14937
|
cmd: label,
|
14909
14938
|
explanation: null,
|
14910
14939
|
fr: false,
|
@@ -14933,7 +14962,7 @@ FieldDefinition._mockOnLoadEndData = function (field, defer) {
|
|
14933
14962
|
vc: "FLD"
|
14934
14963
|
};
|
14935
14964
|
|
14936
|
-
|
14965
|
+
let response = {
|
14937
14966
|
action: '\"' + fieldUpperCase + '\" SRCH',
|
14938
14967
|
assetClassifierExplanation: "AssetClassifier is disabled.",
|
14939
14968
|
assetClassifierStatus: "NOT_INVOKED",
|
@@ -14958,21 +14987,21 @@ FieldDefinition._mockOnLoadEndData = function (field, defer) {
|
|
14958
14987
|
* @param {Event} e
|
14959
14988
|
*/
|
14960
14989
|
function onLoadEnd(e) {
|
14961
|
-
|
14962
|
-
|
14963
|
-
|
14990
|
+
let xmr = e.currentTarget;
|
14991
|
+
let defer = xmr._defer;
|
14992
|
+
let field = xmr._field;
|
14964
14993
|
|
14965
14994
|
delete FieldDefinition._loadingField[field];
|
14966
14995
|
|
14967
14996
|
if (xmr.status === 200) { // case success
|
14968
|
-
|
14969
|
-
|
14997
|
+
let res = JSON.parse(xmr.responseText);
|
14998
|
+
let fieldDef = null;
|
14970
14999
|
|
14971
|
-
|
15000
|
+
let result = res.result && res.result[0];
|
14972
15001
|
if (result) {
|
14973
|
-
|
15002
|
+
let item = result.hits && result.hits[0];
|
14974
15003
|
if (item && item.p) {
|
14975
|
-
|
15004
|
+
let profile = item.p;
|
14976
15005
|
if (profile.fn.toUpperCase() === field.toUpperCase()) {
|
14977
15006
|
fieldDef = FieldDefinition.get(field) || {};
|
14978
15007
|
|
@@ -15011,7 +15040,7 @@ function onLoadEnd(e) {
|
|
15011
15040
|
}
|
15012
15041
|
|
15013
15042
|
(function() { // Add "field" property to all default field definitions. This reduces file size and redundancy
|
15014
|
-
for(
|
15043
|
+
for(let key in FieldDefinition._defs) {
|
15015
15044
|
FieldDefinition._defs[key]["field"] = key;
|
15016
15045
|
}
|
15017
15046
|
})();
|
@@ -15022,7 +15051,7 @@ function onLoadEnd(e) {
|
|
15022
15051
|
// CONCATENATED MODULE: ./src/js/PredefinedFormula.js
|
15023
15052
|
|
15024
15053
|
/* @constructor */
|
15025
|
-
|
15054
|
+
let PredefinedFormula = {};
|
15026
15055
|
/** @private
|
15027
15056
|
* @type {Object<string, string>}
|
15028
15057
|
*/
|
@@ -15106,14 +15135,14 @@ PredefinedFormula.remove = function(field) {
|
|
15106
15135
|
* @property {boolean=} stationary=false If enabled, the column order cannot be changed (i.e., this column and any column to its left cannot be moved)
|
15107
15136
|
* @property {boolean=} leftPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the left side
|
15108
15137
|
* @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
|
15109
|
-
* @property {Object=} info=null
|
15138
|
+
* @property {Object=} info=null For storing any additional information to the column
|
15110
15139
|
*/
|
15111
15140
|
|
15112
15141
|
/** mapping of field type to javascript type
|
15113
15142
|
* @type {Object.<string, string>}
|
15114
15143
|
* @private
|
15115
15144
|
*/
|
15116
|
-
|
15145
|
+
const TYPE_MAPPING = {
|
15117
15146
|
STRING: "string",
|
15118
15147
|
BOOLEAN: "boolean",
|
15119
15148
|
NUMBER: "number",
|
@@ -15139,15 +15168,15 @@ var TYPE_MAPPING = {
|
|
15139
15168
|
* @public
|
15140
15169
|
* @const
|
15141
15170
|
*/
|
15142
|
-
|
15171
|
+
const COL_DEF = "COL_DEF";
|
15143
15172
|
|
15144
15173
|
/** @private
|
15145
15174
|
* @param {string} str
|
15146
15175
|
* @return {string}
|
15147
15176
|
*/
|
15148
|
-
|
15177
|
+
let _toAlignment = function(str) {
|
15149
15178
|
if(str) {
|
15150
|
-
|
15179
|
+
let ch = str.charAt(0).toLowerCase();
|
15151
15180
|
if(ch === "l") {
|
15152
15181
|
return "left";
|
15153
15182
|
}
|
@@ -15165,7 +15194,7 @@ var _toAlignment = function(str) {
|
|
15165
15194
|
* @param {ColumnDefinition~Options=} columnOption
|
15166
15195
|
* @param {*=} hostGrid
|
15167
15196
|
*/
|
15168
|
-
|
15197
|
+
let ColumnDefinition = function(columnOption, hostGrid) {
|
15169
15198
|
this._defaultRenderer = this._defaultRenderer.bind(this);
|
15170
15199
|
this._customRenderer = this._customRenderer.bind(this);
|
15171
15200
|
|
@@ -15337,7 +15366,7 @@ ColumnDefinition.prototype.dispose = function() {
|
|
15337
15366
|
*/
|
15338
15367
|
ColumnDefinition.prototype._initializeTimeSeriesChild = function(columnOption) {
|
15339
15368
|
this._autoGenerated = true;
|
15340
|
-
|
15369
|
+
let parentDef = /** @type{ColumnDefinition} */(columnOption["parent"]);
|
15341
15370
|
this._setParent(parentDef);
|
15342
15371
|
this.initialize(columnOption);
|
15343
15372
|
};
|
@@ -15349,13 +15378,13 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15349
15378
|
return;
|
15350
15379
|
}
|
15351
15380
|
|
15352
|
-
|
15381
|
+
let i, len, key, val;
|
15353
15382
|
//#region Apply pre-defined option
|
15354
|
-
|
15355
|
-
|
15383
|
+
let field = columnOption["field"]; // Field could be null or undefined here
|
15384
|
+
let defaultOption = js_FieldDefinition.get(field);
|
15356
15385
|
if(defaultOption && defaultOption !== columnOption) { // The column match the default field list
|
15357
15386
|
// WARNING: This changes reference of the user object. Any new property added won't affect anything outside of this method
|
15358
|
-
|
15387
|
+
let userOption = columnOption;
|
15359
15388
|
columnOption = {}; // Create a new object for cloning process
|
15360
15389
|
|
15361
15390
|
for(key in defaultOption) {
|
@@ -15546,7 +15575,7 @@ ColumnDefinition.prototype.getFieldDefinition = function () {
|
|
15546
15575
|
* @return {string}
|
15547
15576
|
*/
|
15548
15577
|
ColumnDefinition.prototype.getFieldDataType = function () {
|
15549
|
-
|
15578
|
+
let fieldDef = this.getFieldDefinition();
|
15550
15579
|
if(fieldDef && fieldDef.fieldDataType) {
|
15551
15580
|
return fieldDef.fieldDataType;
|
15552
15581
|
}
|
@@ -15559,7 +15588,7 @@ ColumnDefinition.prototype.getFieldDataType = function () {
|
|
15559
15588
|
ColumnDefinition.prototype.getDataType = function () {
|
15560
15589
|
if(this._dataType) return this._dataType;
|
15561
15590
|
|
15562
|
-
|
15591
|
+
let fieldDataType = this.getFieldDataType();
|
15563
15592
|
if(fieldDataType) {
|
15564
15593
|
return TYPE_MAPPING[fieldDataType.toUpperCase()];
|
15565
15594
|
}
|
@@ -15570,7 +15599,7 @@ ColumnDefinition.prototype.getDataType = function () {
|
|
15570
15599
|
* @param {string} dataType
|
15571
15600
|
*/
|
15572
15601
|
ColumnDefinition.prototype.setDataType = function (dataType) {
|
15573
|
-
|
15602
|
+
let val = TYPE_MAPPING[dataType.toUpperCase()];
|
15574
15603
|
if(val) {
|
15575
15604
|
dataType = val;
|
15576
15605
|
}
|
@@ -15582,9 +15611,9 @@ ColumnDefinition.prototype.setDataType = function (dataType) {
|
|
15582
15611
|
* @return {string}
|
15583
15612
|
*/
|
15584
15613
|
ColumnDefinition.getDataType = function(field) {
|
15585
|
-
|
15614
|
+
let fieldDef = js_FieldDefinition.get(field);
|
15586
15615
|
if(fieldDef) {
|
15587
|
-
|
15616
|
+
let fieldDataType = fieldDef.fieldDataType ? fieldDef.fieldDataType.toUpperCase() : null;
|
15588
15617
|
return TYPE_MAPPING[fieldDataType] ? TYPE_MAPPING[fieldDataType] : "";
|
15589
15618
|
}
|
15590
15619
|
return "";
|
@@ -15601,12 +15630,12 @@ ColumnDefinition.prototype.getTooltip = function() {
|
|
15601
15630
|
}
|
15602
15631
|
}
|
15603
15632
|
|
15604
|
-
|
15633
|
+
let name = this.getName();
|
15605
15634
|
if(name) {
|
15606
15635
|
return name;
|
15607
15636
|
}
|
15608
15637
|
|
15609
|
-
|
15638
|
+
let field = this.getField();
|
15610
15639
|
if(field) {
|
15611
15640
|
return field;
|
15612
15641
|
}
|
@@ -15626,7 +15655,7 @@ ColumnDefinition.prototype.getField = function() {
|
|
15626
15655
|
* @return {!Array.<string>}
|
15627
15656
|
*/
|
15628
15657
|
ColumnDefinition.prototype.getAllFields = function() {
|
15629
|
-
|
15658
|
+
let field = this.getField();
|
15630
15659
|
if(field) {
|
15631
15660
|
return this._requiredFields.concat(field);
|
15632
15661
|
}
|
@@ -15689,10 +15718,10 @@ ColumnDefinition.getRealTimeFields = function(fields, colDef) {
|
|
15689
15718
|
}
|
15690
15719
|
|
15691
15720
|
// TODO: Exclude any formula references from requesting real-time field
|
15692
|
-
|
15693
|
-
|
15694
|
-
for(
|
15695
|
-
|
15721
|
+
let reqFields = colDef.getRequiredFields();
|
15722
|
+
let len = reqFields.length;
|
15723
|
+
for(let i = 0; i < len; ++i) {
|
15724
|
+
let field = reqFields[i];
|
15696
15725
|
if(ColumnDefinition.isRealTimeField(field)) {
|
15697
15726
|
fields.push(field);
|
15698
15727
|
}
|
@@ -15710,9 +15739,9 @@ ColumnDefinition.prototype.isSortable = function() {
|
|
15710
15739
|
* @return {boolean}
|
15711
15740
|
*/
|
15712
15741
|
ColumnDefinition.prototype.isScalable = function() {
|
15713
|
-
|
15714
|
-
|
15715
|
-
|
15742
|
+
let core = this._eventArg["core"];
|
15743
|
+
let grid = this._eventArg["grid"];
|
15744
|
+
let colIndex = grid.getColumnIndex(this);
|
15716
15745
|
return core.getColumnScalability(colIndex);
|
15717
15746
|
};
|
15718
15747
|
/** Deprecated, this function will be return initial sort order of this column, The current sort state may be different from initial sort state.
|
@@ -15728,27 +15757,27 @@ ColumnDefinition.prototype.getInitialSortOrder = function() {
|
|
15728
15757
|
* @return {number}
|
15729
15758
|
*/
|
15730
15759
|
ColumnDefinition.prototype.getWidth = function() {
|
15731
|
-
|
15732
|
-
|
15733
|
-
|
15760
|
+
let core = this._eventArg["core"];
|
15761
|
+
let grid = this._eventArg["grid"];
|
15762
|
+
let colIndex = grid.getColumnIndex(this);
|
15734
15763
|
return core.getColumnWidth(colIndex);
|
15735
15764
|
};
|
15736
15765
|
/** @public
|
15737
15766
|
* @return {number}
|
15738
15767
|
*/
|
15739
15768
|
ColumnDefinition.prototype.getMinWidth = function() {
|
15740
|
-
|
15741
|
-
|
15742
|
-
|
15769
|
+
let core = this._eventArg["core"];
|
15770
|
+
let grid = this._eventArg["grid"];
|
15771
|
+
let colIndex = grid.getColumnIndex(this);
|
15743
15772
|
return core.getMinimumColumnWidth(colIndex);
|
15744
15773
|
};
|
15745
15774
|
/** @public
|
15746
15775
|
* @return {string}
|
15747
15776
|
*/
|
15748
15777
|
ColumnDefinition.prototype.getTextAlign = function() {
|
15749
|
-
|
15750
|
-
|
15751
|
-
|
15778
|
+
let core = this._eventArg["core"];
|
15779
|
+
let grid = this._eventArg["grid"];
|
15780
|
+
let colIndex = grid.getColumnIndex(this);
|
15752
15781
|
return core.getColumnAlignment(colIndex);
|
15753
15782
|
};
|
15754
15783
|
/** @public
|
@@ -15775,7 +15804,7 @@ ColumnDefinition.prototype.getClasses = function() {
|
|
15775
15804
|
* @return {!Object}
|
15776
15805
|
*/
|
15777
15806
|
ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
15778
|
-
|
15807
|
+
let obj = colOptions || {};
|
15779
15808
|
|
15780
15809
|
if(this._info){
|
15781
15810
|
obj["info"] = this._info;
|
@@ -15783,14 +15812,14 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15783
15812
|
|
15784
15813
|
if(obj["field"] == null) {
|
15785
15814
|
if(!this._defaultField) {
|
15786
|
-
|
15815
|
+
let field = this.getField();
|
15787
15816
|
if(field) {
|
15788
15817
|
obj["field"] = field;
|
15789
15818
|
}
|
15790
15819
|
}
|
15791
15820
|
}
|
15792
15821
|
|
15793
|
-
|
15822
|
+
let value = this.getDataType();
|
15794
15823
|
if(value) {
|
15795
15824
|
obj["dataType"] = value;
|
15796
15825
|
}
|
@@ -15825,7 +15854,7 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15825
15854
|
obj["sortable"] = false;
|
15826
15855
|
}
|
15827
15856
|
|
15828
|
-
|
15857
|
+
let classes = this._classes;
|
15829
15858
|
if(classes && classes.length > 0) {
|
15830
15859
|
obj["className"] = classes.join(" ");
|
15831
15860
|
}
|
@@ -15842,13 +15871,13 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15842
15871
|
obj["autoGenerated"] = this._autoGenerated;
|
15843
15872
|
}
|
15844
15873
|
|
15845
|
-
|
15846
|
-
|
15847
|
-
|
15874
|
+
let core = this._eventArg["core"];
|
15875
|
+
let grid = this._eventArg["grid"];
|
15876
|
+
let colIndex = grid.getColumnIndex(this);
|
15848
15877
|
|
15849
15878
|
// The scalable, width and minWidth cannot be shifted into core as getConfigObject is accessible from colDef.
|
15850
|
-
|
15851
|
-
|
15879
|
+
let scalable = core.getColumnScalability(colIndex);
|
15880
|
+
let width = core.getColumnCustomLaneSize(colIndex);
|
15852
15881
|
|
15853
15882
|
if (scalable !== true || width !== 1) {
|
15854
15883
|
obj["scalable"] = scalable;
|
@@ -15878,9 +15907,9 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15878
15907
|
* @return {boolean}
|
15879
15908
|
*/
|
15880
15909
|
ColumnDefinition.prototype.isHidden = function() {
|
15881
|
-
|
15882
|
-
|
15883
|
-
|
15910
|
+
let core = this._eventArg["core"];
|
15911
|
+
let grid = this._eventArg["grid"];
|
15912
|
+
let colIndex = grid.getColumnIndex(this);
|
15884
15913
|
return !core.isColumnVisible(colIndex);
|
15885
15914
|
};
|
15886
15915
|
/** @public
|
@@ -15893,9 +15922,9 @@ ColumnDefinition.prototype.isTextSelect = function () {
|
|
15893
15922
|
* @param {boolean=} bool
|
15894
15923
|
*/
|
15895
15924
|
ColumnDefinition.prototype.hide = function(bool) {
|
15896
|
-
|
15897
|
-
|
15898
|
-
|
15925
|
+
let core = this._eventArg["core"];
|
15926
|
+
let grid = this._eventArg["grid"];
|
15927
|
+
let colIndex = grid.getColumnIndex(this);
|
15899
15928
|
core.hideColumn(colIndex, bool !== false);
|
15900
15929
|
};
|
15901
15930
|
/** This will clear all previously stored renderers and set a new one.
|
@@ -15987,9 +16016,9 @@ ColumnDefinition.prototype.addRenderer = function(func) {
|
|
15987
16016
|
* @return {boolean} Current activation state after the call
|
15988
16017
|
*/
|
15989
16018
|
ColumnDefinition.prototype.activateRenderer = function(id, func) {
|
15990
|
-
|
16019
|
+
let renderer = null;
|
15991
16020
|
if (id != null) {
|
15992
|
-
|
16021
|
+
let rendererMap = this._rendererMap;
|
15993
16022
|
if (!rendererMap) {
|
15994
16023
|
rendererMap = this._rendererMap = {};
|
15995
16024
|
}
|
@@ -16060,10 +16089,10 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
|
|
16060
16089
|
}
|
16061
16090
|
field = field.trim();
|
16062
16091
|
|
16063
|
-
|
16092
|
+
let formulaStr = columnOption ? columnOption["formula"] : "";
|
16064
16093
|
if(this._fnEngine) {
|
16065
|
-
|
16066
|
-
|
16094
|
+
let uppercasedF = field.toUpperCase(); // For comparison only
|
16095
|
+
let predefinedF = formulaStr || js_PredefinedFormula.get(uppercasedF);
|
16067
16096
|
if(predefinedF || ColumnDefinition.isFormulaField(field)) {
|
16068
16097
|
field = formula_Formula.toUpperCase(field);
|
16069
16098
|
this._formula = this._fnEngine.addFormula(predefinedF || field); // Always a success
|
@@ -16085,7 +16114,7 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
|
|
16085
16114
|
// We need to cache time series in field definition for improve performance of checking methond
|
16086
16115
|
js_FieldDefinition.setFieldProperty(field, "timeSeries", js_FieldDefinition.isTimeSeries(field) ? true : false);
|
16087
16116
|
|
16088
|
-
|
16117
|
+
let parentColDef = columnOption["parent"];
|
16089
16118
|
if(columnOption && parentColDef) {
|
16090
16119
|
js_FieldDefinition.setFieldProperty(field, "timeSeriesParent", parentColDef.getField());
|
16091
16120
|
}
|
@@ -16102,12 +16131,12 @@ ColumnDefinition.prototype._retrieveNestedFields = function(fields) {
|
|
16102
16131
|
if(!fields) {
|
16103
16132
|
return;
|
16104
16133
|
}
|
16105
|
-
for(
|
16106
|
-
|
16107
|
-
|
16108
|
-
|
16134
|
+
for(let i = fields.length; --i >= 0;) {
|
16135
|
+
let field = fields[i];
|
16136
|
+
let uppercasedF = field.toUpperCase();
|
16137
|
+
let predefinedF = js_PredefinedFormula.get(uppercasedF);
|
16109
16138
|
if(predefinedF) { // Predefined formula
|
16110
|
-
|
16139
|
+
let f = this._fnEngine.getFormula(field); // Get formula by reference name
|
16111
16140
|
if(f) {
|
16112
16141
|
f.addFormulaCount(); // Add reference count
|
16113
16142
|
} else {
|
@@ -16125,18 +16154,18 @@ ColumnDefinition.prototype._retrieveNestedFields = function(fields) {
|
|
16125
16154
|
* @param {Object} e
|
16126
16155
|
*/
|
16127
16156
|
ColumnDefinition.prototype._defaultRenderer = function(e) {
|
16128
|
-
|
16157
|
+
let rowDef = /** @type{RowDefinition} */(e["dataValue"]);
|
16129
16158
|
e["cell"].setContent(rowDef ? rowDef.getData(this._field) : null);
|
16130
16159
|
};
|
16131
16160
|
/** @private
|
16132
16161
|
* @param {Object} e
|
16133
16162
|
*/
|
16134
16163
|
ColumnDefinition.prototype._customRenderer = function(e) {
|
16135
|
-
|
16164
|
+
let rowDef = /** @type{RowDefinition} */(e["dataValue"]);
|
16136
16165
|
|
16137
|
-
|
16166
|
+
let arg = this._eventArg; // Reuse the same object
|
16138
16167
|
if(rowDef) {
|
16139
|
-
|
16168
|
+
let rowData = rowDef.getRowData();
|
16140
16169
|
arg["rowDef"] = rowDef;
|
16141
16170
|
arg["rowData"] = rowData;
|
16142
16171
|
arg["rowIndex"] = e["rowIndex"];
|
@@ -16155,9 +16184,9 @@ ColumnDefinition.prototype._customRenderer = function(e) {
|
|
16155
16184
|
if(this._activatedRenderer) {
|
16156
16185
|
this._activatedRenderer(arg);
|
16157
16186
|
} else {
|
16158
|
-
|
16159
|
-
|
16160
|
-
for(
|
16187
|
+
let urs = this._userRenderers;
|
16188
|
+
let len = urs.length;
|
16189
|
+
for(let i = 0; i < len; ++i) {
|
16161
16190
|
urs[i](arg);
|
16162
16191
|
}
|
16163
16192
|
}
|
@@ -16222,7 +16251,7 @@ ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
|
|
16222
16251
|
* @constructor
|
16223
16252
|
* @extends {EventDispatcher}
|
16224
16253
|
*/
|
16225
|
-
|
16254
|
+
let SnapshotFiller = function () {
|
16226
16255
|
this._onRequest = this._onRequest.bind(this);
|
16227
16256
|
|
16228
16257
|
this._rics = {};
|
@@ -16305,16 +16334,16 @@ SnapshotFiller.clearMockAdc = function() {
|
|
16305
16334
|
*/
|
16306
16335
|
SnapshotFiller.prototype.setADCOptions = function (adcOptions) {
|
16307
16336
|
|
16308
|
-
|
16337
|
+
let val = adcOptions["productId"];
|
16309
16338
|
if(val) {
|
16310
16339
|
this._adcOptions.productId = val;
|
16311
16340
|
}
|
16312
16341
|
// TODO: support requesting level parameter https://confluence.refinitiv.com/display/ADC/Request+level+parameters
|
16313
|
-
//
|
16342
|
+
// let val = adcOptions["lang"];
|
16314
16343
|
// if(val) {
|
16315
16344
|
// this._adcOptions.lang = val;
|
16316
16345
|
// }
|
16317
|
-
//
|
16346
|
+
// let val = adcOptions["cache"];
|
16318
16347
|
// if(val) {
|
16319
16348
|
// this._adcOptions.cache = val;
|
16320
16349
|
// }
|
@@ -16342,10 +16371,10 @@ SnapshotFiller.prototype.addRic = function (ric) {
|
|
16342
16371
|
* @return {boolean}
|
16343
16372
|
*/
|
16344
16373
|
SnapshotFiller.prototype.addRics = function (rics) {
|
16345
|
-
|
16346
|
-
|
16347
|
-
for(
|
16348
|
-
|
16374
|
+
let len = rics ? rics.length : 0;
|
16375
|
+
let dirty = false;
|
16376
|
+
for(let i = 0; i < len; ++i) {
|
16377
|
+
let ric = rics[i];
|
16349
16378
|
if (ric && !this._rics[ric]) {
|
16350
16379
|
this._rics[ric] = 1;
|
16351
16380
|
dirty = true;
|
@@ -16370,9 +16399,9 @@ SnapshotFiller.prototype.addField = function (str) {
|
|
16370
16399
|
* @return {boolean}
|
16371
16400
|
*/
|
16372
16401
|
SnapshotFiller.prototype.addFields = function (fields) {
|
16373
|
-
|
16374
|
-
|
16375
|
-
for(
|
16402
|
+
let len = fields.length;
|
16403
|
+
let dirty = 0;
|
16404
|
+
for(let i = 0; i < len; ++i) {
|
16376
16405
|
dirty |= this._addField(fields[i]);
|
16377
16406
|
}
|
16378
16407
|
if(dirty) {
|
@@ -16417,7 +16446,7 @@ SnapshotFiller.prototype._request = function () {
|
|
16417
16446
|
SnapshotFiller.prototype._onRequest = function () {
|
16418
16447
|
this._timerId = 0;
|
16419
16448
|
|
16420
|
-
|
16449
|
+
let jet = window["JET"]; // Assume that JET is already exist.
|
16421
16450
|
if (this._rtk) {
|
16422
16451
|
if (!this._rtk.Data) {
|
16423
16452
|
return; // Require RTK.Data plugin to get snapshot data
|
@@ -16427,20 +16456,20 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
16427
16456
|
}
|
16428
16457
|
|
16429
16458
|
// Retrieve instruments and ADC fields
|
16430
|
-
|
16459
|
+
let instruments = Object.keys(this._rics);
|
16431
16460
|
|
16432
|
-
|
16433
|
-
|
16434
|
-
|
16435
|
-
for (
|
16461
|
+
let i;
|
16462
|
+
let fields = [];
|
16463
|
+
let timeSeriesFields = [];
|
16464
|
+
for (let field in this._fields) {
|
16436
16465
|
if(!FieldDefinition.isTimeSeries(field)) {
|
16437
16466
|
fields.push(field);
|
16438
16467
|
} else {
|
16439
16468
|
timeSeriesFields.push(field);
|
16440
16469
|
}
|
16441
16470
|
}
|
16442
|
-
|
16443
|
-
|
16471
|
+
let fieldLen = fields.length;
|
16472
|
+
let timeSeriesFieldLen = timeSeriesFields.length;
|
16444
16473
|
|
16445
16474
|
if ( (!fieldLen && !timeSeriesFieldLen ) || !instruments.length) { // No ADC field or real-time RIC
|
16446
16475
|
return;
|
@@ -16450,13 +16479,13 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
16450
16479
|
this._rics = {};
|
16451
16480
|
this._fields = {};
|
16452
16481
|
|
16453
|
-
|
16482
|
+
let onSuccess, payload;
|
16454
16483
|
if (this._rtk) {
|
16455
|
-
|
16484
|
+
let strFields;
|
16456
16485
|
// Request time serie fields
|
16457
16486
|
if(timeSeriesFields.length > 0) {
|
16458
16487
|
// request time series field
|
16459
|
-
|
16488
|
+
let strtTimeSeriesFields = timeSeriesFields.join(',');
|
16460
16489
|
payload = {
|
16461
16490
|
"method": "select",
|
16462
16491
|
"formula": strtTimeSeriesFields,
|
@@ -16465,7 +16494,7 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
16465
16494
|
"output": "Col,date|,Row,In|,va,T,NoEmptyTickers" // For customize output server, for more information please visit "https://confluence.refinitiv.com/display/ADC/Data+Cloud+Output+Format"
|
16466
16495
|
};
|
16467
16496
|
onSuccess = this._onRTKTimeSeriesSuccess.bind(this, timeSeriesFields);
|
16468
|
-
|
16497
|
+
let responseMockAdc = SnapshotFiller.getMockAdc(payload.formula);
|
16469
16498
|
if(responseMockAdc) {
|
16470
16499
|
setTimeout(function() {
|
16471
16500
|
onSuccess(responseMockAdc);
|
@@ -16501,7 +16530,7 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
16501
16530
|
|
16502
16531
|
|
16503
16532
|
} else {
|
16504
|
-
|
16533
|
+
let reqFields = [];
|
16505
16534
|
for(i = 0; i < fieldLen; i++) {
|
16506
16535
|
reqFields.push({ "name": fields[i] });
|
16507
16536
|
}
|
@@ -16527,8 +16556,8 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
16527
16556
|
*/
|
16528
16557
|
SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
16529
16558
|
this._dispatch("adcDataReceived", serverResult);
|
16530
|
-
|
16531
|
-
|
16559
|
+
let data2D = serverResult["data"];
|
16560
|
+
let svHeaders = serverResult["headers"] && serverResult["headers"][0];
|
16532
16561
|
|
16533
16562
|
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
16534
16563
|
return; //TODO: Return Promise.reject(errMsg);
|
@@ -16538,11 +16567,11 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
|
16538
16567
|
// Server will return field only in UPPERCASE
|
16539
16568
|
// ex. requestField = TR.Volume ===> serverField = TR.VOLUME
|
16540
16569
|
// so we need convert UPPERCASE to be original
|
16541
|
-
|
16542
|
-
|
16543
|
-
|
16544
|
-
|
16545
|
-
|
16570
|
+
let i, field, ric;
|
16571
|
+
let j = 1; // to skip instrument index, use j = 1
|
16572
|
+
let fLength = fields.length;
|
16573
|
+
let hLength = svHeaders.length;
|
16574
|
+
let headers = new Array(hLength);
|
16546
16575
|
for (i = 0; i < fLength && j < hLength; i++) {
|
16547
16576
|
field = fields[i];
|
16548
16577
|
if (svHeaders[j].field === field.toUpperCase()) {
|
@@ -16551,24 +16580,24 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
|
16551
16580
|
}
|
16552
16581
|
}
|
16553
16582
|
|
16554
|
-
|
16555
|
-
|
16556
|
-
|
16583
|
+
let len = data2D.length;
|
16584
|
+
let fieldLen = headers.length;
|
16585
|
+
let ricMap = {};
|
16557
16586
|
|
16558
16587
|
// TODO: Freeze the data view before setting multiple data
|
16559
16588
|
for (i = 0; i < len; i++) {
|
16560
|
-
|
16589
|
+
let dataRow = data2D[i];
|
16561
16590
|
ric = dataRow[0];
|
16562
16591
|
|
16563
16592
|
if (ricMap[ric]) {
|
16564
16593
|
continue; // we interested only first row of ric
|
16565
16594
|
}
|
16566
16595
|
|
16567
|
-
|
16596
|
+
let snapData = ricMap[ric] = {};
|
16568
16597
|
|
16569
16598
|
// loop for create rowData for update
|
16570
16599
|
for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
|
16571
|
-
|
16600
|
+
let value = dataRow[j];
|
16572
16601
|
if (value != null && value !== "") {
|
16573
16602
|
field = headers[j];
|
16574
16603
|
snapData[field] = value;
|
@@ -16577,9 +16606,9 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
|
16577
16606
|
}
|
16578
16607
|
|
16579
16608
|
// return result only ric that has update data
|
16580
|
-
|
16609
|
+
let updatedData = {};
|
16581
16610
|
for (ric in ricMap) {
|
16582
|
-
|
16611
|
+
let obj = ricMap[ric];
|
16583
16612
|
if (!isEmptyObject(obj)) {
|
16584
16613
|
updatedData[ric] = obj;
|
16585
16614
|
}
|
@@ -16597,8 +16626,8 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
|
16597
16626
|
*/
|
16598
16627
|
SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
16599
16628
|
this._dispatch("adcDataReceived", serverResult);
|
16600
|
-
|
16601
|
-
|
16629
|
+
let data2D = serverResult["rows"];
|
16630
|
+
let svHeaders = serverResult["rows"] && serverResult["rows"][0];
|
16602
16631
|
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
16603
16632
|
return; //TODO: Return Promise.reject(errMsg);
|
16604
16633
|
}
|
@@ -16606,11 +16635,11 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
|
16606
16635
|
// Server will return field only in UPPERCASE
|
16607
16636
|
// ex. requestField = TR.Volume ===> serverField = TR.VOLUME
|
16608
16637
|
// so we need convert UPPERCASE to be original
|
16609
|
-
|
16610
|
-
|
16611
|
-
|
16612
|
-
|
16613
|
-
|
16638
|
+
let i, field, ric;
|
16639
|
+
let j = 1; // to skip instrument index, use j = 1
|
16640
|
+
let fLength = fields.length;
|
16641
|
+
let hLength = svHeaders.length;
|
16642
|
+
let headers = new Array(hLength);
|
16614
16643
|
for (i = 0; i < fLength && j < hLength; i++) {
|
16615
16644
|
field = fields[i];
|
16616
16645
|
if (svHeaders[j].r.toUpperCase() === field.toUpperCase()) {
|
@@ -16619,23 +16648,23 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
|
16619
16648
|
}
|
16620
16649
|
}
|
16621
16650
|
|
16622
|
-
|
16623
|
-
|
16624
|
-
|
16651
|
+
let len = data2D.length;
|
16652
|
+
let fieldLen = headers.length;
|
16653
|
+
let ricMap = {};
|
16625
16654
|
|
16626
16655
|
// TODO: Freeze the data view before setting multiple data
|
16627
16656
|
for (i = 1; i < len; i++) { // to skip column header index, use i = 1
|
16628
|
-
|
16657
|
+
let dataRow = data2D[i];
|
16629
16658
|
ric = dataRow[0];
|
16630
16659
|
|
16631
16660
|
if (ricMap[ric]) {
|
16632
16661
|
continue; // we interested only first row of ric
|
16633
16662
|
}
|
16634
|
-
|
16663
|
+
let snapData = ricMap[ric] = {};
|
16635
16664
|
|
16636
16665
|
// loop for create rowData for update
|
16637
16666
|
for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
|
16638
|
-
|
16667
|
+
let value = dataRow[j];
|
16639
16668
|
if (value != null && value !== "") {
|
16640
16669
|
if(typeof value !== 'object') {
|
16641
16670
|
field = headers[j];
|
@@ -16650,9 +16679,9 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
|
16650
16679
|
}
|
16651
16680
|
|
16652
16681
|
// return result only ric that has update data
|
16653
|
-
|
16682
|
+
let updatedData = {};
|
16654
16683
|
for (ric in ricMap) {
|
16655
|
-
|
16684
|
+
let obj = ricMap[ric];
|
16656
16685
|
if (!isEmptyObject(obj)) {
|
16657
16686
|
updatedData[ric] = obj;
|
16658
16687
|
}
|
@@ -16673,45 +16702,45 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
|
|
16673
16702
|
|
16674
16703
|
// TODO: noti the user for change structure
|
16675
16704
|
this._dispatch("adcDataReceived", serverResult);
|
16676
|
-
|
16677
|
-
|
16705
|
+
let data2D = serverResult["rows"];
|
16706
|
+
let svHeaders = serverResult["rows"] && serverResult["rows"][0];
|
16678
16707
|
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
16679
16708
|
return; // TODO: Return Promise.reject(errMsg);
|
16680
16709
|
}
|
16681
16710
|
// Extract header dates
|
16682
|
-
|
16711
|
+
let headerDates = svHeaders.slice(2).map(header => header.v);
|
16683
16712
|
// Create necessary variables
|
16684
|
-
|
16685
|
-
|
16713
|
+
let fileNameToTSField = {};
|
16714
|
+
let count = 0;
|
16686
16715
|
// Convert map to fieldMap
|
16687
|
-
|
16688
|
-
for (
|
16689
|
-
|
16690
|
-
|
16716
|
+
let data2DLength = data2D.length;
|
16717
|
+
for (let i = 1; i < data2DLength; i++) {
|
16718
|
+
let dataRow = data2D[i];
|
16719
|
+
let fieldName = dataRow[1];
|
16691
16720
|
if (!fileNameToTSField[fieldName]) {
|
16692
16721
|
fileNameToTSField[fieldName] = fields[count++];
|
16693
16722
|
}
|
16694
16723
|
}
|
16695
16724
|
// Process data and populate ricMap and childrenFieldToParent
|
16696
|
-
|
16697
|
-
|
16698
|
-
for (
|
16699
|
-
|
16700
|
-
|
16701
|
-
|
16725
|
+
let ricMap = {};
|
16726
|
+
let childrenFieldToParent = {};
|
16727
|
+
for (let i = 1; i < data2DLength; i++) {
|
16728
|
+
let dataRow = data2D[i];
|
16729
|
+
let ric = dataRow[0];
|
16730
|
+
let fieldName = dataRow[1];
|
16702
16731
|
|
16703
16732
|
if (!ricMap[ric]) {
|
16704
16733
|
ricMap[ric] = {};
|
16705
16734
|
}
|
16706
|
-
|
16735
|
+
let snapData = ricMap[ric];
|
16707
16736
|
if (headerDates.length === 1) {
|
16708
16737
|
// Time series with only 1 column, it will be a normal adc field
|
16709
16738
|
snapData[fileNameToTSField[fieldName]] = dataRow[2];
|
16710
16739
|
} else {
|
16711
16740
|
// Multiple columns, it will be a time series field
|
16712
|
-
for (
|
16713
|
-
|
16714
|
-
|
16741
|
+
for (let k = 0; k < headerDates.length; k++) {
|
16742
|
+
let field = fileNameToTSField[fieldName].replace("TR.", "") + "_" + headerDates[k];
|
16743
|
+
let celLData = dataRow[2 + k];
|
16715
16744
|
if(celLData !== null) {
|
16716
16745
|
childrenFieldToParent[field] = fileNameToTSField[fieldName];
|
16717
16746
|
snapData[field] = celLData;
|
@@ -16721,16 +16750,16 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
|
|
16721
16750
|
}
|
16722
16751
|
|
16723
16752
|
// Return result only for ric that has updated data
|
16724
|
-
|
16725
|
-
for (
|
16726
|
-
|
16753
|
+
let dataMapping = {};
|
16754
|
+
for (let ric in ricMap) {
|
16755
|
+
let obj = ricMap[ric];
|
16727
16756
|
if (!isEmptyObject(obj)) {
|
16728
16757
|
dataMapping[ric] = obj;
|
16729
16758
|
}
|
16730
16759
|
}
|
16731
16760
|
|
16732
16761
|
// Dispatch events based on the header length
|
16733
|
-
|
16762
|
+
let eventData = {
|
16734
16763
|
data: dataMapping,
|
16735
16764
|
};
|
16736
16765
|
if (headerDates.length > 1) {
|
@@ -30557,7 +30586,7 @@ DataView.prototype.getGroupRowId = function () {
|
|
30557
30586
|
/**
|
30558
30587
|
* @public
|
30559
30588
|
* @ignore
|
30560
|
-
* @param {
|
30589
|
+
* @param {string} rid
|
30561
30590
|
* @return {number}
|
30562
30591
|
*/
|
30563
30592
|
DataView.prototype.getFooterRowIndex = function (rid) {
|
@@ -31092,6 +31121,17 @@ DataView.prototype.getExpansionParents = function (from, to) {
|
|
31092
31121
|
return parentMapping;
|
31093
31122
|
};
|
31094
31123
|
|
31124
|
+
/**
|
31125
|
+
* @public
|
31126
|
+
* @param {string} rid
|
31127
|
+
* @return {string} parent row id
|
31128
|
+
*/
|
31129
|
+
DataView.prototype.getExpansionParentByRowId = function(rid) {
|
31130
|
+
if(this._expansionChildren) {
|
31131
|
+
return this._expansionChildren[rid] || "";
|
31132
|
+
}
|
31133
|
+
return "";
|
31134
|
+
};
|
31095
31135
|
/** Check if the specified row is itself a row expansion.
|
31096
31136
|
* @public
|
31097
31137
|
* @param {string} rid rowId
|
@@ -31114,6 +31154,18 @@ DataView.prototype.hasRowExpansion = function(rid) {
|
|
31114
31154
|
}
|
31115
31155
|
return false;
|
31116
31156
|
};
|
31157
|
+
/**
|
31158
|
+
* @public
|
31159
|
+
* @param {string} rowId
|
31160
|
+
* @return {number}
|
31161
|
+
*/
|
31162
|
+
DataView.prototype.getRowExpansionCount = function(rowId) {
|
31163
|
+
if(this._expansionMap) {
|
31164
|
+
return this._expansionMap[rowId] || 0;
|
31165
|
+
}
|
31166
|
+
return 0;
|
31167
|
+
};
|
31168
|
+
|
31117
31169
|
/** Get row Id of the row expansion by providing the row Id of the row with row expansion (not row expansion itself). This is NOT recommended for normal usage, since the row expansion contains no data in the DataView
|
31118
31170
|
* @public
|
31119
31171
|
* @param {string} rid rowId
|
@@ -36280,7 +36332,7 @@ Core.prototype._hasPendingRowChange = false;
|
|
36280
36332
|
* @return {string}
|
36281
36333
|
*/
|
36282
36334
|
Core.getVersion = function () {
|
36283
|
-
return "5.1.
|
36335
|
+
return "5.1.92";
|
36284
36336
|
};
|
36285
36337
|
/** {@link ElementWrapper#dispose}
|
36286
36338
|
* @override
|
@@ -38578,6 +38630,12 @@ Core.prototype.freezeSection = function (opt_frozenSection) {
|
|
38578
38630
|
this._fixFrozenTopSections = true;
|
38579
38631
|
this._freezeTopSectionAt(opt_frozenSection);
|
38580
38632
|
};
|
38633
|
+
/** @public
|
38634
|
+
*/
|
38635
|
+
Core.prototype.resetSectionFreezing = function () {
|
38636
|
+
this._fixFrozenTopSections = false;
|
38637
|
+
this._updateFrozenTopSections();
|
38638
|
+
};
|
38581
38639
|
|
38582
38640
|
/** Vertical scrollbar will automatically appear for the rest of the sections, when container of Grid does NOT have enough space for Grid's content.
|
38583
38641
|
* @private
|
@@ -40587,25 +40645,35 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
|
|
40587
40645
|
|
40588
40646
|
var fromR = /** @type{number} */(e["fromRowIndex"]);
|
40589
40647
|
var toR = /** @type{number} */(e["toRowIndex"]);
|
40590
|
-
var parents = dataView.getExpansionParents(fromR, toR);
|
40591
40648
|
var rids = dataView.getVisibleRowIds(true);
|
40592
40649
|
var section = /** @type{ILayoutGrid} */(e["section"]);
|
40593
40650
|
|
40594
40651
|
e["rowData"] = null;
|
40595
40652
|
e["cell"] = null;
|
40596
|
-
|
40597
|
-
|
40653
|
+
var lastRowIndexChanged = false;
|
40654
|
+
for (var r = toR - 1; r >= fromR; --r) {
|
40655
|
+
var rowId = dataView.getRowId(r);
|
40656
|
+
if(!lastRowIndexChanged) {
|
40657
|
+
var reCount = dataView.getRowExpansionCount(rowId);
|
40658
|
+
if(reCount > 0){
|
40659
|
+
r = r + reCount + 1; // include parent row
|
40660
|
+
lastRowIndexChanged = true;
|
40661
|
+
continue;
|
40662
|
+
}
|
40663
|
+
}
|
40664
|
+
|
40598
40665
|
var ctxRow = section.getContextRow(r);
|
40599
|
-
|
40600
|
-
|
40601
|
-
e["
|
40666
|
+
var parentId = dataView.getExpansionParentByRowId(rowId);
|
40667
|
+
if(parentId) { // dispatch to render row expansion
|
40668
|
+
e["originalRowData"] = dataView.getRowData(parentId);
|
40669
|
+
e["originalRowId"] = parentId;
|
40602
40670
|
e["rowExpansion"] = ctxRow["rowExpansion"] = true;
|
40603
|
-
} else if(ctxRow["rowExpansion"])
|
40671
|
+
} else if(ctxRow["rowExpansion"] ){ // dispose cases
|
40604
40672
|
e["originalRowData"] = null;
|
40605
40673
|
e["originalRowId"] = null;
|
40606
40674
|
e["rowExpansion"] = ctxRow["rowExpansion"] = false;
|
40607
|
-
} else {
|
40608
|
-
continue;
|
40675
|
+
} else { // normal row no need to dispatch
|
40676
|
+
continue;
|
40609
40677
|
}
|
40610
40678
|
e["rowId"] = rids[r];
|
40611
40679
|
e["rowIndex"] = r;
|
@@ -41674,7 +41742,7 @@ Core._proto = Core.prototype;
|
|
41674
41742
|
/**
|
41675
41743
|
* @constructor
|
41676
41744
|
*/
|
41677
|
-
|
41745
|
+
let StyleLoader = {};
|
41678
41746
|
|
41679
41747
|
/** @public
|
41680
41748
|
* @type {string}
|
@@ -41717,7 +41785,7 @@ StyleLoader.applyStyle = function (grid) {
|
|
41717
41785
|
// CONCATENATED MODULE: ./src/js/ReferenceCounter.js
|
41718
41786
|
/** @constructor
|
41719
41787
|
*/
|
41720
|
-
|
41788
|
+
let ReferenceCounter = function() {
|
41721
41789
|
this._counter = {};
|
41722
41790
|
this._session = {};
|
41723
41791
|
this._referers = {};
|
@@ -41774,10 +41842,10 @@ ReferenceCounter.prototype.getAllReferrers = ReferenceCounter.prototype.getAllRe
|
|
41774
41842
|
* @return {Object} Object with newEntries and removedEntries
|
41775
41843
|
*/
|
41776
41844
|
ReferenceCounter.prototype.getSession = function() {
|
41777
|
-
|
41778
|
-
|
41779
|
-
for(
|
41780
|
-
|
41845
|
+
let newEntries = [];
|
41846
|
+
let removedEntries = [];
|
41847
|
+
for(let key in this._session) {
|
41848
|
+
let val = this._session[key];
|
41781
41849
|
if(val > 0) {
|
41782
41850
|
newEntries.push(key);
|
41783
41851
|
} else if(val < 0) {
|
@@ -41799,7 +41867,7 @@ ReferenceCounter.prototype.getSession = function() {
|
|
41799
41867
|
ReferenceCounter.prototype.addReference = function(key, referer) {
|
41800
41868
|
if(key) {
|
41801
41869
|
if(referer) {
|
41802
|
-
|
41870
|
+
let counter = this._referers[referer];
|
41803
41871
|
if(counter) {
|
41804
41872
|
if(counter[key]) { // Single Referer can only add specific key only once
|
41805
41873
|
return false;
|
@@ -41843,7 +41911,7 @@ ReferenceCounter.prototype.removeReference = function(key, referer, count) {
|
|
41843
41911
|
if(!key) {
|
41844
41912
|
return false;
|
41845
41913
|
}
|
41846
|
-
|
41914
|
+
let val = this._counter[key];
|
41847
41915
|
if(!val) {
|
41848
41916
|
return false;
|
41849
41917
|
}
|
@@ -41856,7 +41924,7 @@ ReferenceCounter.prototype.removeReference = function(key, referer, count) {
|
|
41856
41924
|
}
|
41857
41925
|
|
41858
41926
|
if(referer) {
|
41859
|
-
|
41927
|
+
let counter = this._referers[referer];
|
41860
41928
|
if(!counter) {
|
41861
41929
|
return false;
|
41862
41930
|
}
|
@@ -41896,10 +41964,10 @@ ReferenceCounter.prototype.addReferences = function(keys, referer) {
|
|
41896
41964
|
if(!keys) {
|
41897
41965
|
return 0;
|
41898
41966
|
}
|
41899
|
-
|
41967
|
+
let count = 0;
|
41900
41968
|
if(Array.isArray(keys)) {
|
41901
|
-
|
41902
|
-
for(
|
41969
|
+
let len = keys.length;
|
41970
|
+
for(let i = 0; i < len; ++i) {
|
41903
41971
|
if(this.addReference(keys[i], referer)) {
|
41904
41972
|
++count;
|
41905
41973
|
}
|
@@ -41909,7 +41977,7 @@ ReferenceCounter.prototype.addReferences = function(keys, referer) {
|
|
41909
41977
|
++count;
|
41910
41978
|
}
|
41911
41979
|
} else {
|
41912
|
-
for(
|
41980
|
+
for(let key in keys) {
|
41913
41981
|
if(this.addReference(key, referer)) {
|
41914
41982
|
++count;
|
41915
41983
|
}
|
@@ -41924,11 +41992,11 @@ ReferenceCounter.prototype.addReferences = function(keys, referer) {
|
|
41924
41992
|
* @return {number} Number of removed entries
|
41925
41993
|
*/
|
41926
41994
|
ReferenceCounter.prototype.removeReferer = function(referer) {
|
41927
|
-
|
41995
|
+
let count = 0;
|
41928
41996
|
if(referer) {
|
41929
|
-
|
41997
|
+
let counter = this._referers[referer];
|
41930
41998
|
if(counter) {
|
41931
|
-
for(
|
41999
|
+
for(let key in counter) {
|
41932
42000
|
if(this.removeReference(key, referer)) {
|
41933
42001
|
++count;
|
41934
42002
|
}
|
@@ -41969,8 +42037,8 @@ ReferenceCounter.prototype.log = function() {
|
|
41969
42037
|
* @constructor
|
41970
42038
|
* @extends {EventDispatcher}
|
41971
42039
|
*/
|
41972
|
-
|
41973
|
-
|
42040
|
+
let DataConnector = function () {
|
42041
|
+
let t = this;
|
41974
42042
|
t._commitRicsChanges = t._commitRicsChanges.bind(this);
|
41975
42043
|
t._commitFieldsChanges = t._commitFieldsChanges.bind(this);
|
41976
42044
|
t._fieldChangedConflator = new Conflator(0, t._commitFieldsChanges);
|
@@ -42017,8 +42085,8 @@ DataConnector.prototype.getAllRics = function () {
|
|
42017
42085
|
* @returns {Array.<RowDefinition>}
|
42018
42086
|
*/
|
42019
42087
|
DataConnector.prototype.getAllRowDefs = function () {
|
42020
|
-
|
42021
|
-
for (
|
42088
|
+
let results = [];
|
42089
|
+
for (let i in this._rowDefMap) { // TODO: Check if push is better than concat
|
42022
42090
|
results = results.concat(this._rowDefMap[i]);
|
42023
42091
|
}
|
42024
42092
|
return results;
|
@@ -42045,13 +42113,13 @@ DataConnector.prototype.getRowDefByRic = function (ric) {
|
|
42045
42113
|
* @return {boolean} True if new reference is added.
|
42046
42114
|
*/
|
42047
42115
|
DataConnector.prototype.addRic = function (rowDef) {
|
42048
|
-
|
42116
|
+
let ric = rowDef ? rowDef.getSymbol() : "";
|
42049
42117
|
if(!ric) {
|
42050
42118
|
return false;
|
42051
42119
|
}
|
42052
42120
|
|
42053
|
-
|
42054
|
-
|
42121
|
+
let rowDefMap = this._rowDefMap;
|
42122
|
+
let rowDefs = rowDefMap[ric];
|
42055
42123
|
if (!rowDefs) {
|
42056
42124
|
rowDefs = rowDefMap[ric] = [rowDef];
|
42057
42125
|
} else {
|
@@ -42061,7 +42129,7 @@ DataConnector.prototype.addRic = function (rowDef) {
|
|
42061
42129
|
}
|
42062
42130
|
|
42063
42131
|
// Referer could be added, even if no new reference is added.
|
42064
|
-
|
42132
|
+
let newReference = this._rics.addReference(ric, rowDef.getRowId());
|
42065
42133
|
|
42066
42134
|
this._commitRicsChanges();
|
42067
42135
|
return newReference;
|
@@ -42080,10 +42148,10 @@ DataConnector.prototype.removeRic = function (rowDef, ric) {
|
|
42080
42148
|
return;
|
42081
42149
|
}
|
42082
42150
|
|
42083
|
-
|
42084
|
-
|
42151
|
+
let rowDefMap = this._rowDefMap;
|
42152
|
+
let rowDefs = rowDefMap[ric];
|
42085
42153
|
if (rowDefs) {
|
42086
|
-
|
42154
|
+
let index = rowDefs.indexOf(rowDef);
|
42087
42155
|
if (index >= 0) {
|
42088
42156
|
rowDefs.splice(index, 1);
|
42089
42157
|
}
|
@@ -42096,8 +42164,8 @@ DataConnector.prototype.removeRic = function (rowDef, ric) {
|
|
42096
42164
|
/** @public
|
42097
42165
|
*/
|
42098
42166
|
DataConnector.prototype.removeAllRics = function () {
|
42099
|
-
|
42100
|
-
for (
|
42167
|
+
let referers = this._rics.getAllReferers(); // TODO: Add method to removeAllReferers at once
|
42168
|
+
for (let i in referers) {
|
42101
42169
|
this._rics.removeReferer(referers[i]);
|
42102
42170
|
}
|
42103
42171
|
this._rowDefMap = {};
|
@@ -42111,10 +42179,10 @@ DataConnector.prototype._commitRicsChanges = function () {
|
|
42111
42179
|
return;
|
42112
42180
|
}
|
42113
42181
|
|
42114
|
-
|
42115
|
-
|
42116
|
-
|
42117
|
-
|
42182
|
+
let rics = this._rics;
|
42183
|
+
let session = rics.getSession();
|
42184
|
+
let removedEntries = session.removedEntries;
|
42185
|
+
let newEntries = session.newEntries;
|
42118
42186
|
|
42119
42187
|
if (removedEntries.length) {
|
42120
42188
|
this._doDispatch({
|
@@ -42139,7 +42207,7 @@ DataConnector.prototype._commitRicsChanges = function () {
|
|
42139
42207
|
DataConnector.prototype.addFields = function (fieldRef, referer) {
|
42140
42208
|
if (!fieldRef) { return; }
|
42141
42209
|
|
42142
|
-
|
42210
|
+
let fields = this._fields;
|
42143
42211
|
|
42144
42212
|
if (fieldRef instanceof js_ColumnDefinition) {
|
42145
42213
|
fields.addReferences(fieldRef.getAllFields(), fieldRef.getId());
|
@@ -42175,8 +42243,8 @@ DataConnector.prototype.removeFieldReferrer = function (referrer) {
|
|
42175
42243
|
/** @public
|
42176
42244
|
*/
|
42177
42245
|
DataConnector.prototype.removeAllFields = function () {
|
42178
|
-
|
42179
|
-
for (
|
42246
|
+
let referers = this._fields.getAllReferers();
|
42247
|
+
for (let i in referers) { // TODO: Add method to removeAllReferers at once
|
42180
42248
|
this._fields.removeReferer(referers[i]);
|
42181
42249
|
}
|
42182
42250
|
this._commitFieldsChanges();
|
@@ -42189,10 +42257,10 @@ DataConnector.prototype._commitFieldsChanges = function () {
|
|
42189
42257
|
return;
|
42190
42258
|
}
|
42191
42259
|
|
42192
|
-
|
42193
|
-
|
42194
|
-
|
42195
|
-
|
42260
|
+
let fields = this._fields;
|
42261
|
+
let session = fields.getSession();
|
42262
|
+
let removedEntries = session.removedEntries;
|
42263
|
+
let newEntries = session.newEntries;
|
42196
42264
|
|
42197
42265
|
if (removedEntries.length) {
|
42198
42266
|
this._doDispatch({
|
@@ -42213,7 +42281,7 @@ DataConnector.prototype._commitFieldsChanges = function () {
|
|
42213
42281
|
* @param {Object} payload
|
42214
42282
|
*/
|
42215
42283
|
DataConnector.prototype._doDispatch = function (payload) {
|
42216
|
-
|
42284
|
+
let t = this;
|
42217
42285
|
payload.fields = t.getAllFields();
|
42218
42286
|
payload.rics = t.getAllRics();
|
42219
42287
|
payload.rowDefs = t.getAllRowDefs();
|
@@ -42223,7 +42291,7 @@ DataConnector.prototype._doDispatch = function (payload) {
|
|
42223
42291
|
/** @public
|
42224
42292
|
*/
|
42225
42293
|
DataConnector.prototype.reset = function () {
|
42226
|
-
|
42294
|
+
let t = this;
|
42227
42295
|
t._rowDefMap = {};
|
42228
42296
|
t._fields.reset();
|
42229
42297
|
t._rics.reset();
|
@@ -42243,7 +42311,7 @@ DataConnector.prototype.reset = function () {
|
|
42243
42311
|
* @param {number} order
|
42244
42312
|
* @return {number}
|
42245
42313
|
*/
|
42246
|
-
|
42314
|
+
let _defaultCompare = function(a, b, order) {
|
42247
42315
|
if(a == null || a !== a) {
|
42248
42316
|
if(b == null || b !== b) {
|
42249
42317
|
return 0;
|
@@ -42265,7 +42333,7 @@ var _defaultCompare = function(a, b, order) {
|
|
42265
42333
|
|
42266
42334
|
/** @constructor
|
42267
42335
|
*/
|
42268
|
-
|
42336
|
+
let RowDefSorter = function() {
|
42269
42337
|
this._defaultSorter = this._defaultSorter.bind(this);
|
42270
42338
|
this._dataSorter = this._dataSorter.bind(this);
|
42271
42339
|
this._rowDefSorter = this._rowDefSorter.bind(this);
|
@@ -42308,12 +42376,12 @@ RowDefSorter.prototype.dispose = function() {
|
|
42308
42376
|
*/
|
42309
42377
|
RowDefSorter.prototype.getSorter = function() {
|
42310
42378
|
this._primaryParams = null;
|
42311
|
-
|
42379
|
+
let sortCount = this._sortParams.length;
|
42312
42380
|
if(sortCount === 1) {
|
42313
|
-
|
42314
|
-
|
42381
|
+
let params = this._primaryParams = this._sortParams[0];
|
42382
|
+
let sortLogic = params[1];
|
42315
42383
|
if(sortLogic) {
|
42316
|
-
|
42384
|
+
let rowSorting = params[3];
|
42317
42385
|
return rowSorting ? this._rowDefSorter : this._dataSorter;
|
42318
42386
|
} else {
|
42319
42387
|
return this._defaultSorter;
|
@@ -42353,19 +42421,19 @@ RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, ord
|
|
42353
42421
|
if(!field) {
|
42354
42422
|
field = "";
|
42355
42423
|
}
|
42356
|
-
|
42357
|
-
|
42424
|
+
let sortPriority = this._sortParams.length;
|
42425
|
+
let ctx = this._ctxCaches[sortPriority];
|
42358
42426
|
if(!ctx) {
|
42359
42427
|
ctx = this._ctxCaches[sortPriority] = cloneObject(this._globalContext);
|
42360
42428
|
}
|
42361
|
-
|
42429
|
+
let orderNum = 0;
|
42362
42430
|
if(order === "a") {
|
42363
42431
|
orderNum = 1;
|
42364
42432
|
} else if(order === "d") {
|
42365
42433
|
orderNum = -1;
|
42366
42434
|
}
|
42367
42435
|
|
42368
|
-
|
42436
|
+
let params = [
|
42369
42437
|
field, // 0
|
42370
42438
|
(typeof logic === "function") ? logic : null, // 1
|
42371
42439
|
ctx, // 2
|
@@ -42397,7 +42465,7 @@ RowDefSorter._noSorting = function(rowDefA, rowDefB, order) {
|
|
42397
42465
|
* @return {number}
|
42398
42466
|
*/
|
42399
42467
|
RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
42400
|
-
|
42468
|
+
let field = this._primaryParams[0];
|
42401
42469
|
return _defaultCompare(
|
42402
42470
|
rowDefA.getData(field),
|
42403
42471
|
rowDefB.getData(field),
|
@@ -42411,9 +42479,9 @@ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
|
42411
42479
|
* @return {number}
|
42412
42480
|
*/
|
42413
42481
|
RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
42414
|
-
|
42415
|
-
|
42416
|
-
|
42482
|
+
let params = this._primaryParams;
|
42483
|
+
let field = params[0];
|
42484
|
+
let sortLogic = params[1];
|
42417
42485
|
return sortLogic(
|
42418
42486
|
rowDefA.getData(field),
|
42419
42487
|
rowDefB.getData(field),
|
@@ -42428,8 +42496,8 @@ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
|
42428
42496
|
* @return {number}
|
42429
42497
|
*/
|
42430
42498
|
RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
42431
|
-
|
42432
|
-
|
42499
|
+
let params = this._primaryParams;
|
42500
|
+
let sortLogic = params[1];
|
42433
42501
|
return sortLogic(rowDefA, rowDefB, order, params[2]);
|
42434
42502
|
};
|
42435
42503
|
/** @private
|
@@ -42439,16 +42507,16 @@ RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
|
42439
42507
|
* @return {number}
|
42440
42508
|
*/
|
42441
42509
|
RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryOrder) {
|
42442
|
-
|
42443
|
-
|
42444
|
-
for(
|
42445
|
-
|
42446
|
-
|
42447
|
-
|
42448
|
-
|
42449
|
-
|
42450
|
-
|
42451
|
-
|
42510
|
+
let sortParams = this._sortParams;
|
42511
|
+
let sortCount = sortParams.length;
|
42512
|
+
for(let i = 0; i < sortCount; ++i) {
|
42513
|
+
let params = sortParams[i];
|
42514
|
+
let field = params[0];
|
42515
|
+
let sortLogic = params[1];
|
42516
|
+
let ctx = params[2];
|
42517
|
+
let rowSorting = params[3];
|
42518
|
+
let orderNum = params[4];
|
42519
|
+
let ret = 0;
|
42452
42520
|
if(sortLogic) {
|
42453
42521
|
if(rowSorting) {
|
42454
42522
|
ret = sortLogic(rowDefA, rowDefB, orderNum, ctx);
|
@@ -44586,13 +44654,13 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
44586
44654
|
* @private
|
44587
44655
|
* @const
|
44588
44656
|
*/
|
44589
|
-
|
44657
|
+
const SUB_ID = "SUB_ID";
|
44590
44658
|
|
44591
44659
|
/** @private
|
44592
44660
|
* @param {RowDefinition} rowDef
|
44593
44661
|
* @return {Object}
|
44594
44662
|
*/
|
44595
|
-
|
44663
|
+
let toRowData = function(rowDef) {
|
44596
44664
|
return rowDef ? rowDef.getRowData() : null;
|
44597
44665
|
};
|
44598
44666
|
|
@@ -44600,7 +44668,7 @@ var toRowData = function(rowDef) {
|
|
44600
44668
|
* @const
|
44601
44669
|
* @type {Object.<string, number>}
|
44602
44670
|
*/
|
44603
|
-
|
44671
|
+
let _unclonableFields = {
|
44604
44672
|
"ROW_DEF": 1,
|
44605
44673
|
"SUB_ID": 1
|
44606
44674
|
};
|
@@ -44608,10 +44676,10 @@ var _unclonableFields = {
|
|
44608
44676
|
* @param {RowDefinition} fromRowDef
|
44609
44677
|
* @param {RowDefinition} toRowDef
|
44610
44678
|
*/
|
44611
|
-
|
44612
|
-
|
44613
|
-
|
44614
|
-
for(
|
44679
|
+
let cloneRowData = function(fromRowDef, toRowDef) {
|
44680
|
+
let from = toRowData(fromRowDef);
|
44681
|
+
let to = toRowData(toRowDef);
|
44682
|
+
for(let key in from) {
|
44615
44683
|
if(!_unclonableFields[key]) {
|
44616
44684
|
to[key] = from[key];
|
44617
44685
|
}
|
@@ -44622,7 +44690,7 @@ var cloneRowData = function(fromRowDef, toRowDef) {
|
|
44622
44690
|
* @param {RowDefinition} rowDef
|
44623
44691
|
* @return {boolean}
|
44624
44692
|
*/
|
44625
|
-
|
44693
|
+
let excludeAutoGenerated = function (rowDef) {
|
44626
44694
|
return !rowDef.isAutoGenerated();
|
44627
44695
|
};
|
44628
44696
|
|
@@ -44630,7 +44698,7 @@ var excludeAutoGenerated = function (rowDef) {
|
|
44630
44698
|
* @param {Object} colConfig column config
|
44631
44699
|
* @return {boolean}
|
44632
44700
|
*/
|
44633
|
-
|
44701
|
+
let _byNonAutoGeneratedColumn = function (colConfig) {
|
44634
44702
|
return !colConfig.autoGenerated;
|
44635
44703
|
};
|
44636
44704
|
/** @private
|
@@ -44640,7 +44708,7 @@ var _byNonAutoGeneratedColumn = function (colConfig) {
|
|
44640
44708
|
* @param {string} fieldName
|
44641
44709
|
* @return {number} The outcome of the value comparison
|
44642
44710
|
*/
|
44643
|
-
|
44711
|
+
let compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit name
|
44644
44712
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
44645
44713
|
};
|
44646
44714
|
|
@@ -44651,14 +44719,14 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
44651
44719
|
* @param {string} sortOrder
|
44652
44720
|
* @return {number} The outcome of the value comparison
|
44653
44721
|
*/
|
44654
|
-
|
44655
|
-
|
44722
|
+
let _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
44723
|
+
let parentA = rowDefA.getParent();
|
44656
44724
|
|
44657
44725
|
if (!parentA) {
|
44658
44726
|
return 0;
|
44659
44727
|
}
|
44660
44728
|
|
44661
|
-
|
44729
|
+
let parentB = rowDefB.getParent();
|
44662
44730
|
|
44663
44731
|
if (!parentB) {
|
44664
44732
|
return 0;
|
@@ -44668,13 +44736,13 @@ var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
|
44668
44736
|
return 0;
|
44669
44737
|
}
|
44670
44738
|
|
44671
|
-
|
44739
|
+
let a = rowDefA.getData('CHILD_ORDER');
|
44672
44740
|
|
44673
44741
|
if (a == null) {
|
44674
44742
|
return 0;
|
44675
44743
|
}
|
44676
44744
|
|
44677
|
-
|
44745
|
+
let b = rowDefB.getData('CHILD_ORDER');
|
44678
44746
|
|
44679
44747
|
if (b == null) {
|
44680
44748
|
return 0;
|
@@ -44687,7 +44755,7 @@ var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
|
44687
44755
|
* @param {ColumnDefinition} colDef
|
44688
44756
|
* @return {string}
|
44689
44757
|
*/
|
44690
|
-
|
44758
|
+
let _getName = function(colDef) {
|
44691
44759
|
if(colDef) {
|
44692
44760
|
return colDef.getName();
|
44693
44761
|
}
|
@@ -44698,7 +44766,7 @@ var _getName = function(colDef) {
|
|
44698
44766
|
* @param {string} str
|
44699
44767
|
* @return {boolean}
|
44700
44768
|
*/
|
44701
|
-
|
44769
|
+
let _hasFieldOrId = function(colDef, str) {
|
44702
44770
|
return (colDef.getField() === str) || (colDef.getId() === str);
|
44703
44771
|
};
|
44704
44772
|
|
@@ -44708,7 +44776,7 @@ var _hasFieldOrId = function(colDef, str) {
|
|
44708
44776
|
* @param {Object} obj2
|
44709
44777
|
* @returns {boolean} If the id property of two objects is equal, the return will be true, otherwise it will be false.
|
44710
44778
|
*/
|
44711
|
-
|
44779
|
+
let _hasMatchingId = function(obj1, obj2) {
|
44712
44780
|
if(!obj1 || !obj2 || !obj1.id || !obj2.id) { // Handle nullable, if the object or id have null, it's means difference value
|
44713
44781
|
return false;
|
44714
44782
|
}
|
@@ -44720,8 +44788,8 @@ var _hasMatchingId = function(obj1, obj2) {
|
|
44720
44788
|
* @param {(Element|null)=} placeholder
|
44721
44789
|
* @param {Grid~GridOptions=} config
|
44722
44790
|
*/
|
44723
|
-
|
44724
|
-
|
44791
|
+
let Grid = function(placeholder, config) {
|
44792
|
+
let t = this; // This is to primarily reduce file size
|
44725
44793
|
|
44726
44794
|
t._onDataChanged = t._onDataChanged.bind(t);
|
44727
44795
|
t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
|
@@ -44779,7 +44847,7 @@ var Grid = function(placeholder, config) {
|
|
44779
44847
|
t._dt = t._dv.getDataTable();
|
44780
44848
|
t._mainGrid = config["grid"];
|
44781
44849
|
|
44782
|
-
|
44850
|
+
let core = t._mainGrid.getCoreGrid();
|
44783
44851
|
t._stp = core.getPlugin("SortableTitlePlugin");
|
44784
44852
|
}
|
44785
44853
|
if(config["SortableTitle"]) { // Exception for built-in plugin
|
@@ -44846,7 +44914,6 @@ var Grid = function(placeholder, config) {
|
|
44846
44914
|
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
44847
44915
|
|
44848
44916
|
t.initialize(config);
|
44849
|
-
t.initSubscription();
|
44850
44917
|
|
44851
44918
|
js_StyleLoader.applyStyle(t._grid);
|
44852
44919
|
};
|
@@ -45074,7 +45141,7 @@ Grid.prototype.initSubscription = function() {
|
|
45074
45141
|
return;
|
45075
45142
|
}
|
45076
45143
|
|
45077
|
-
|
45144
|
+
let jet, q, s;
|
45078
45145
|
jet = window["JET"]; // Assume that JET is already exist.
|
45079
45146
|
if (this._RTK) {
|
45080
45147
|
q = this._RTK.Quotes;
|
@@ -45098,10 +45165,10 @@ Grid.prototype.initSubscription = function() {
|
|
45098
45165
|
|
45099
45166
|
// TODO: Subscriptions should be registered per row.
|
45100
45167
|
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
45101
|
-
|
45102
|
-
|
45103
|
-
for(
|
45104
|
-
|
45168
|
+
let rowDefs = this._getAllRowDefinitions();
|
45169
|
+
let len = rowDefs.length;
|
45170
|
+
for(let i = 0; i < len; ++i) {
|
45171
|
+
let rowDef = rowDefs[i];
|
45105
45172
|
if(rowDef) {
|
45106
45173
|
rowDef.subscribeForUpdates();
|
45107
45174
|
}
|
@@ -45120,7 +45187,7 @@ Grid.prototype.updateLayout = function() {
|
|
45120
45187
|
*/
|
45121
45188
|
Grid.prototype._updateRowData = function(rowIndex) {
|
45122
45189
|
if(rowIndex >= 0) {
|
45123
|
-
|
45190
|
+
let rowId = this._dv.getRowId(rowIndex);
|
45124
45191
|
if(rowId) {
|
45125
45192
|
this._dt.setRowData(rowId, {});
|
45126
45193
|
}
|
@@ -45137,7 +45204,7 @@ Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
|
45137
45204
|
/** @private
|
45138
45205
|
*/
|
45139
45206
|
Grid.prototype._addGridSections = function () {
|
45140
|
-
|
45207
|
+
let title = this._grid.addSection("title");
|
45141
45208
|
if(this._topSection == false){
|
45142
45209
|
title.setRowCount(0);
|
45143
45210
|
} else {
|
@@ -45145,10 +45212,10 @@ Grid.prototype._addGridSections = function () {
|
|
45145
45212
|
}
|
45146
45213
|
this._grid.addSection("content");
|
45147
45214
|
|
45148
|
-
|
45215
|
+
let titleSettings = this._grid.getSectionSettings("title");
|
45149
45216
|
titleSettings.disableDataBinding();
|
45150
45217
|
|
45151
|
-
|
45218
|
+
let contentSettings = this._grid.getSectionSettings("content");
|
45152
45219
|
contentSettings.setAutoSyncRowCount(true);
|
45153
45220
|
contentSettings.setParent(titleSettings);
|
45154
45221
|
};
|
@@ -45157,13 +45224,13 @@ Grid.prototype._addGridSections = function () {
|
|
45157
45224
|
* @return {*} Return Section instance
|
45158
45225
|
*/
|
45159
45226
|
Grid.prototype.addHeaderSection = function (sectionName) {
|
45160
|
-
|
45227
|
+
let titleSects = this._grid.getAllSections("title");
|
45161
45228
|
|
45162
|
-
|
45229
|
+
let headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
|
45163
45230
|
if(headerSect) {
|
45164
45231
|
headerSect.setRowCount(1);
|
45165
45232
|
|
45166
|
-
|
45233
|
+
let headerSettings = this._grid.getSectionSettings(headerSect);
|
45167
45234
|
headerSettings.disableDataBinding();
|
45168
45235
|
}
|
45169
45236
|
|
@@ -45174,11 +45241,11 @@ Grid.prototype.addHeaderSection = function (sectionName) {
|
|
45174
45241
|
* @return {*} Return Section instance
|
45175
45242
|
*/
|
45176
45243
|
Grid.prototype.addFooterSection = function (sectionName) {
|
45177
|
-
|
45244
|
+
let footerSect = this._grid.addSection("footer", sectionName);
|
45178
45245
|
if(footerSect) {
|
45179
45246
|
footerSect.setRowCount(1);
|
45180
45247
|
|
45181
|
-
|
45248
|
+
let footerSettings = this._grid.getSectionSettings(footerSect);
|
45182
45249
|
footerSettings.disableDataBinding();
|
45183
45250
|
}
|
45184
45251
|
|
@@ -45197,7 +45264,7 @@ Grid.prototype.setParent = function (elem) {
|
|
45197
45264
|
*/
|
45198
45265
|
Grid.prototype.insertBefore = function (elem) {
|
45199
45266
|
if(elem) {
|
45200
|
-
|
45267
|
+
let pn = elem.parentNode;
|
45201
45268
|
if(pn) {
|
45202
45269
|
pn.insertBefore(this._topNode, elem);
|
45203
45270
|
this.updateLayout();
|
@@ -45231,17 +45298,20 @@ Grid.prototype.getCoreGrid = function () {
|
|
45231
45298
|
* @param {Grid~GridOptions=} gridOption
|
45232
45299
|
*/
|
45233
45300
|
Grid.prototype.initialize = function(gridOption) {
|
45234
|
-
if (!gridOption) {
|
45301
|
+
if (!gridOption) {
|
45302
|
+
this.initSubscription();
|
45303
|
+
return;
|
45304
|
+
}
|
45235
45305
|
// TODO: clear all data before re-initialization
|
45236
|
-
|
45306
|
+
let t = this; // For minimizing file size
|
45237
45307
|
t._initializing = true;
|
45238
|
-
|
45308
|
+
let grid = t._grid; // core grid
|
45239
45309
|
grid.resetInternalState();
|
45240
45310
|
gridOption = grid.normalizeConfig(gridOption);
|
45241
45311
|
|
45242
|
-
|
45312
|
+
let exts = gridOption["plugins"] || gridOption["extensions"];
|
45243
45313
|
|
45244
|
-
|
45314
|
+
let cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
|
45245
45315
|
if (gridOption["defaultColumnOptions"]) {
|
45246
45316
|
t._defaultColumnOptions = gridOption["defaultColumnOptions"];
|
45247
45317
|
t._defaultColumnSetup(t._defaultColumnOptions, cols);
|
@@ -45291,23 +45361,23 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45291
45361
|
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
45292
45362
|
}
|
45293
45363
|
|
45294
|
-
|
45364
|
+
let borders = gridOption["borders"];
|
45295
45365
|
if (borders != null) {
|
45296
45366
|
grid.toggleBorders(borders);
|
45297
45367
|
}
|
45298
|
-
|
45368
|
+
let gridlines = gridOption["gridlines"];
|
45299
45369
|
if (gridlines != null) {
|
45300
45370
|
grid.toggleGridlines(gridlines);
|
45301
45371
|
}
|
45302
|
-
|
45372
|
+
let vLines = gridOption["verticalLines"];
|
45303
45373
|
if (vLines != null) {
|
45304
45374
|
grid.toggleVerticalLines(vLines);
|
45305
45375
|
}
|
45306
|
-
|
45376
|
+
let cvLines = gridOption["contentVerticalLines"];
|
45307
45377
|
if (cvLines != null) {
|
45308
45378
|
grid.toggleContentVerticalLines(cvLines);
|
45309
45379
|
}
|
45310
|
-
|
45380
|
+
let hLines = gridOption["horizontalLines"];
|
45311
45381
|
if (hLines != null) {
|
45312
45382
|
grid.toggleHorizontalLines(hLines);
|
45313
45383
|
}
|
@@ -45316,28 +45386,28 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45316
45386
|
t._dv.setPageSize(+gridOption["pageSize"]);
|
45317
45387
|
}
|
45318
45388
|
|
45319
|
-
|
45389
|
+
let rowHeight = +gridOption["rowHeight"];
|
45320
45390
|
if(rowHeight) { // Non empty or zero
|
45321
45391
|
grid.setDefaultRowHeight(rowHeight);
|
45322
45392
|
}
|
45323
|
-
|
45393
|
+
let hRowHeight = +gridOption["headerRowHeight"];
|
45324
45394
|
if(hRowHeight) { // Non empty or zero
|
45325
45395
|
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
45326
45396
|
}
|
45327
45397
|
|
45328
|
-
|
45398
|
+
let val = gridOption["autoLayoutUpdate"];
|
45329
45399
|
if(!t._autoLayoutTimer && val) {
|
45330
45400
|
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
45331
45401
|
t._autoLayoutTimer = setInterval(t._onAutoLayoutUpdate.bind(t), 2000);
|
45332
45402
|
}
|
45333
45403
|
}
|
45334
45404
|
|
45335
|
-
|
45405
|
+
let bool = gridOption["rowHighlighting"];
|
45336
45406
|
if(bool != null) {
|
45337
45407
|
grid.enableRowHighlighting(!!bool);
|
45338
45408
|
}
|
45339
45409
|
|
45340
|
-
|
45410
|
+
let rowExpansionBinding = gridOption["rowExpansionBinding"];
|
45341
45411
|
if(typeof rowExpansionBinding === "function") {
|
45342
45412
|
grid.listen("rowExpansionBinding", t._onRowExpansionBinding); // TODO: Support multi-table feature
|
45343
45413
|
t.listen("rowExpansionBinding", rowExpansionBinding);
|
@@ -45364,7 +45434,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45364
45434
|
if(gridOption["scrollbarParent"] != null) {
|
45365
45435
|
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
45366
45436
|
}
|
45367
|
-
|
45437
|
+
let pollingInterval = gridOption["adcPollingInterval"];
|
45368
45438
|
if(pollingInterval != null) {
|
45369
45439
|
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
45370
45440
|
}
|
@@ -45372,7 +45442,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45372
45442
|
// Column operations
|
45373
45443
|
t.setColumns(cols);
|
45374
45444
|
|
45375
|
-
|
45445
|
+
let rowVir = true;
|
45376
45446
|
if (gridOption["rowVirtualRendering"] != null) {
|
45377
45447
|
rowVir = gridOption["rowVirtualRendering"];
|
45378
45448
|
}
|
@@ -45381,7 +45451,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45381
45451
|
}
|
45382
45452
|
grid.enableRowVirtualization(!!rowVir);
|
45383
45453
|
|
45384
|
-
|
45454
|
+
let colVir = false;
|
45385
45455
|
if (gridOption["columnVirtualRendering"] != null) {
|
45386
45456
|
colVir = gridOption["columnVirtualRendering"];
|
45387
45457
|
}
|
@@ -45390,7 +45460,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45390
45460
|
}
|
45391
45461
|
grid.enableColumnVirtualization(!!colVir);
|
45392
45462
|
|
45393
|
-
|
45463
|
+
let scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
|
45394
45464
|
if (scrollbar) {
|
45395
45465
|
t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
|
45396
45466
|
} else {
|
@@ -45398,16 +45468,16 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45398
45468
|
t._topNode.style.overflow = "";
|
45399
45469
|
}
|
45400
45470
|
|
45401
|
-
|
45471
|
+
let topFreezingCount = gridOption["topFreezingCount"];
|
45402
45472
|
if (typeof topFreezingCount === "number") {
|
45403
45473
|
topFreezingCount = (topFreezingCount > 0) ? topFreezingCount : 0;
|
45404
|
-
|
45474
|
+
let sectionIndex = topFreezingCount - 1;
|
45405
45475
|
grid.freezeSection(sectionIndex);
|
45406
45476
|
} else if (topFreezingCount === false) {
|
45407
45477
|
grid.freezeSection(null);
|
45408
45478
|
}
|
45409
45479
|
|
45410
|
-
|
45480
|
+
let bottomFreezingCount = gridOption["bottomFreezingCount"];
|
45411
45481
|
if (typeof bottomFreezingCount === "number") {
|
45412
45482
|
bottomFreezingCount = (bottomFreezingCount > 0) ? bottomFreezingCount : 0;
|
45413
45483
|
grid.freezeFooter(bottomFreezingCount);
|
@@ -45418,11 +45488,11 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45418
45488
|
// Plugins
|
45419
45489
|
gridOption[ROW_DEF] = true; // Enable ROW_DEF mode
|
45420
45490
|
if (Array.isArray(exts)) {
|
45421
|
-
for (
|
45422
|
-
|
45423
|
-
|
45491
|
+
for (let i = 0; i < exts.length; ++i) {
|
45492
|
+
let ext = exts[i];
|
45493
|
+
let extInstance = null;
|
45424
45494
|
if (ext) {
|
45425
|
-
|
45495
|
+
let extName = ext["name"];
|
45426
45496
|
if(extName) {
|
45427
45497
|
extInstance = grid.loadPlugin(extName, ext); // pass plugin object as an argument for initialization
|
45428
45498
|
} else {
|
@@ -45430,7 +45500,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45430
45500
|
}
|
45431
45501
|
}
|
45432
45502
|
if (extInstance && extInstance["setGridWrapper"]) {
|
45433
|
-
|
45503
|
+
let hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
|
45434
45504
|
if(!hasApi) {
|
45435
45505
|
extInstance["setGridWrapper"]("realTimeGrid", t);
|
45436
45506
|
}
|
@@ -45439,7 +45509,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45439
45509
|
t._initializing = false;
|
45440
45510
|
}
|
45441
45511
|
|
45442
|
-
|
45512
|
+
let lang = gridOption["lang"];
|
45443
45513
|
if(lang != null) {
|
45444
45514
|
t._lang = lang;
|
45445
45515
|
t._dateTimeUtil.setLocale(lang);
|
@@ -45449,18 +45519,18 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45449
45519
|
if(gridOption["childDataField"] != null) {
|
45450
45520
|
this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
|
45451
45521
|
}
|
45452
|
-
|
45522
|
+
let rows = gridOption["rows"];
|
45453
45523
|
if(!rows) {
|
45454
45524
|
rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
|
45455
45525
|
}
|
45456
|
-
|
45526
|
+
let bodies = /** @type{Array} */(gridOption["bodies"]);
|
45457
45527
|
if(!bodies) {
|
45458
45528
|
bodies = [];
|
45459
45529
|
if(gridOption["body"]) {
|
45460
45530
|
bodies.push(gridOption["body"]);
|
45461
45531
|
}
|
45462
45532
|
if(rows) {
|
45463
|
-
for(
|
45533
|
+
for(let m = 0; m < rows.length; m++) {
|
45464
45534
|
if(typeof rows[m] === "string") {
|
45465
45535
|
rows[m] = { "ric": rows[m] };
|
45466
45536
|
}
|
@@ -45470,13 +45540,13 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45470
45540
|
}
|
45471
45541
|
|
45472
45542
|
// Merge rows with static data rows
|
45473
|
-
|
45543
|
+
let staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
|
45474
45544
|
if(rows && staticRows) {
|
45475
|
-
|
45476
|
-
|
45477
|
-
|
45478
|
-
|
45479
|
-
for(
|
45545
|
+
let ary = staticRows["data"] ? staticRows["data"] : staticRows;
|
45546
|
+
let fields = staticRows["fields"] || t.getColumnFields();
|
45547
|
+
let values, data;
|
45548
|
+
let len = rows.length;
|
45549
|
+
for(let n = 0; n < len; n++) {
|
45480
45550
|
if(rows[n]["values"]) { // merge row's values, values can be object or array
|
45481
45551
|
values = arrayToObject(rows[n]["values"], fields);
|
45482
45552
|
data = arrayToObject(ary[n], fields);
|
@@ -45493,7 +45563,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45493
45563
|
}
|
45494
45564
|
}
|
45495
45565
|
|
45496
|
-
for(
|
45566
|
+
for(let j = 0; j < bodies.length; ++j) {
|
45497
45567
|
t.insertRows(bodies[j]["rows"]);
|
45498
45568
|
// break; // TODO: The first version supports only 1 grid
|
45499
45569
|
}
|
@@ -45504,7 +45574,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45504
45574
|
grid.setBottomPaddingSection(gridOption.contentBottomPadding);
|
45505
45575
|
}
|
45506
45576
|
|
45507
|
-
|
45577
|
+
let contentRightPadding = gridOption.contentRightPadding;
|
45508
45578
|
if(contentRightPadding) {
|
45509
45579
|
if (typeof contentRightPadding !== "number") {
|
45510
45580
|
contentRightPadding = 6;
|
@@ -45515,14 +45585,15 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45515
45585
|
|
45516
45586
|
// Let everything init first
|
45517
45587
|
// then set conflationRate to grid for better perfomance on rapidly updating
|
45518
|
-
|
45588
|
+
let dataConflationRate = gridOption['dataConflationRate'];
|
45519
45589
|
if (dataConflationRate != null) {
|
45520
45590
|
grid.setDataConflationRate(dataConflationRate);
|
45521
45591
|
}
|
45522
45592
|
|
45523
45593
|
// Tell all plugins that the initialization phase has ended
|
45524
|
-
|
45594
|
+
let extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
|
45525
45595
|
t._processExtension(extObjects, "afterInit");
|
45596
|
+
t.initSubscription();
|
45526
45597
|
};
|
45527
45598
|
|
45528
45599
|
/** @public
|
@@ -45530,14 +45601,14 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45530
45601
|
* @return {!Object}
|
45531
45602
|
*/
|
45532
45603
|
Grid.prototype.getConfigObject = function (gridOptions) {
|
45533
|
-
|
45604
|
+
let obj = gridOptions || {};
|
45534
45605
|
|
45535
|
-
|
45606
|
+
let columns = obj.columns;
|
45536
45607
|
if(!columns) {
|
45537
45608
|
columns = obj.columns = [];
|
45538
45609
|
}
|
45539
45610
|
|
45540
|
-
|
45611
|
+
let grid = this._grid;
|
45541
45612
|
if(grid.getConfigObject) {
|
45542
45613
|
grid.getConfigObject(obj);
|
45543
45614
|
}
|
@@ -45564,17 +45635,17 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45564
45635
|
}
|
45565
45636
|
|
45566
45637
|
|
45567
|
-
|
45638
|
+
let i, len, prevTimeSeriesField;
|
45568
45639
|
len = this.getColumnCount();
|
45569
45640
|
for (i = 0; i < len; ++i) {
|
45570
|
-
|
45641
|
+
let column = columns[i];
|
45571
45642
|
if(!column) {
|
45572
45643
|
column = columns[i] = {};
|
45573
45644
|
}
|
45574
|
-
|
45645
|
+
let colDef = this.getColumnDefinition(i);
|
45575
45646
|
// TODO: Update width and scalability changed by the extensions
|
45576
45647
|
colDef.getConfigObject(column);
|
45577
|
-
|
45648
|
+
let parentField = js_FieldDefinition.getFieldProperty(colDef.getField(), "timeSeriesParent");
|
45578
45649
|
if(parentField && !prevTimeSeriesField) { // Assume first column of time series child to convert to time series parent
|
45579
45650
|
prevTimeSeriesField = parentField;
|
45580
45651
|
column.field = parentField;
|
@@ -45592,7 +45663,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45592
45663
|
obj["scrollbar"] = false;
|
45593
45664
|
}
|
45594
45665
|
|
45595
|
-
|
45666
|
+
let val = this._dv.getPageSize();
|
45596
45667
|
if(val > 0) {
|
45597
45668
|
obj["pageSize"] = val;
|
45598
45669
|
}
|
@@ -45645,9 +45716,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45645
45716
|
}
|
45646
45717
|
|
45647
45718
|
// get all rows config
|
45648
|
-
|
45649
|
-
|
45650
|
-
|
45719
|
+
let rowDefs = this.getAllRowDefinitions();
|
45720
|
+
let rows = obj["rows"] = [];
|
45721
|
+
let rowDef, rowConfig;
|
45651
45722
|
len = rowDefs.length;
|
45652
45723
|
for (i = 0; i < len; i++) {
|
45653
45724
|
rowDef = rowDefs[i];
|
@@ -45656,9 +45727,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45656
45727
|
}
|
45657
45728
|
|
45658
45729
|
// get row config from extensions
|
45659
|
-
|
45660
|
-
|
45661
|
-
for(
|
45730
|
+
let extensions = grid.getPlugins();
|
45731
|
+
let pluginInstance, row;
|
45732
|
+
for(let key in extensions) {
|
45662
45733
|
pluginInstance = extensions[key];
|
45663
45734
|
if(typeof pluginInstance["getRowConfigObject"] === "function") {
|
45664
45735
|
len = rows.length;
|
@@ -45710,11 +45781,11 @@ Grid.prototype.setLocale = function(lang) {
|
|
45710
45781
|
* @param {Array.<Object>} userColumns
|
45711
45782
|
*/
|
45712
45783
|
Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
45713
|
-
|
45714
|
-
for (
|
45715
|
-
|
45784
|
+
let c = userColumns.length;
|
45785
|
+
for (let i = 0; i < c; i++) {
|
45786
|
+
let column = userColumns[i];
|
45716
45787
|
if (typeof column === 'object') {
|
45717
|
-
for (
|
45788
|
+
for (let key in defaultCol) {
|
45718
45789
|
if (column[key] == null) {
|
45719
45790
|
column[key] = defaultCol[key];
|
45720
45791
|
}
|
@@ -45732,7 +45803,7 @@ Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
|
45732
45803
|
*/
|
45733
45804
|
Grid.prototype._processExtension = function (exts, field, params) {
|
45734
45805
|
if(Array.isArray(exts)) {
|
45735
|
-
for (
|
45806
|
+
for (let i = 0; i < exts.length; i++) {
|
45736
45807
|
if (exts[i][field]) {
|
45737
45808
|
exts[i][field].apply(exts[i], params);
|
45738
45809
|
}
|
@@ -45744,15 +45815,15 @@ Grid.prototype._processExtension = function (exts, field, params) {
|
|
45744
45815
|
* @param {Object} e
|
45745
45816
|
*/
|
45746
45817
|
Grid.prototype._onRicAdded = function(e) {
|
45747
|
-
|
45818
|
+
let addedRics = e.addedRics;
|
45748
45819
|
this._snapshot.addFields(e.fields);
|
45749
|
-
|
45750
|
-
for (
|
45751
|
-
|
45752
|
-
|
45753
|
-
|
45754
|
-
for (
|
45755
|
-
|
45820
|
+
let len = addedRics.length;
|
45821
|
+
for (let i = 0; i < len; ++i) {
|
45822
|
+
let ric = addedRics[i];
|
45823
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
45824
|
+
let jLen = rowDefs ? rowDefs.length : 0;
|
45825
|
+
for (let j = 0; j < jLen; ++j) {
|
45826
|
+
let rowDef = rowDefs[j];
|
45756
45827
|
if (rowDef.getSymbol() === ric) {
|
45757
45828
|
this._snapshot.addRic(ric); // ADC
|
45758
45829
|
}
|
@@ -45773,18 +45844,18 @@ Grid.prototype._onRicRemoved = function(e) {
|
|
45773
45844
|
* @param {Object} e
|
45774
45845
|
*/
|
45775
45846
|
Grid.prototype._onFieldAdded = function(e) {
|
45776
|
-
|
45777
|
-
|
45847
|
+
let rowDefs = e.rowDefs;
|
45848
|
+
let addedFields = e.addedFields;
|
45778
45849
|
|
45779
45850
|
// ADC
|
45780
|
-
for (
|
45851
|
+
for (let i in rowDefs) {
|
45781
45852
|
this._snapshot.addRic(rowDefs[i].getSymbol());
|
45782
45853
|
}
|
45783
45854
|
this._snapshot.addFields(addedFields);
|
45784
45855
|
|
45785
45856
|
// JET
|
45786
45857
|
if (this._subs) {
|
45787
|
-
|
45858
|
+
let realtimeFields = addedFields.filter(js_FieldDefinition.isRealTimeField);
|
45788
45859
|
if(realtimeFields.length > 0) {
|
45789
45860
|
this._subs["addFields"](realtimeFields);
|
45790
45861
|
}
|
@@ -45796,7 +45867,7 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
45796
45867
|
* @param {Object} e
|
45797
45868
|
*/
|
45798
45869
|
Grid.prototype._onFieldRemoved = function(e) {
|
45799
|
-
|
45870
|
+
let removedFields = e.removedFields;
|
45800
45871
|
|
45801
45872
|
// TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
|
45802
45873
|
// JET
|
@@ -45812,19 +45883,19 @@ Grid.prototype._onFieldRemoved = function(e) {
|
|
45812
45883
|
* @param {number=} idx
|
45813
45884
|
*/
|
45814
45885
|
Grid.prototype.insertColumn = function (columnOption, idx) {
|
45815
|
-
|
45886
|
+
let colCount = this.getColumnCount();
|
45816
45887
|
if(idx == null || idx > colCount) {
|
45817
45888
|
idx = colCount;
|
45818
45889
|
}
|
45819
45890
|
|
45820
45891
|
// no need to merge defaultColumn during initialize process
|
45821
45892
|
// because columnOption already mutate by initialize function
|
45822
|
-
|
45893
|
+
let configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
45823
45894
|
|
45824
45895
|
if (typeof columnOption === "string") {
|
45825
45896
|
configObj["field"] = columnOption;
|
45826
45897
|
} else { // columnOption is assumed to be an object
|
45827
|
-
for (
|
45898
|
+
for (let key in columnOption) {
|
45828
45899
|
configObj[key] = columnOption[key];
|
45829
45900
|
}
|
45830
45901
|
}
|
@@ -45833,7 +45904,7 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
45833
45904
|
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
45834
45905
|
}
|
45835
45906
|
|
45836
|
-
|
45907
|
+
let colDef = new ColumnDefinition(configObj, this);
|
45837
45908
|
configObj[COL_DEF] = colDef;
|
45838
45909
|
|
45839
45910
|
// WARNING: width is processed twice by tr-grid and rt-grid
|
@@ -45846,18 +45917,18 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
45846
45917
|
* @param {Object} e snapshort change event object
|
45847
45918
|
*/
|
45848
45919
|
Grid.prototype._updateTimeSeriesFields = function (e) {
|
45849
|
-
|
45850
|
-
|
45851
|
-
|
45852
|
-
for (
|
45920
|
+
let childField;
|
45921
|
+
let snapShotData = e.data;
|
45922
|
+
let childFields = {};
|
45923
|
+
for (let ric in snapShotData) {
|
45853
45924
|
// childFields = snapShotData[ric];
|
45854
45925
|
for (childField in snapShotData[ric]) {
|
45855
45926
|
childFields[childField] = true; // Merge child fields to parent (Don't truth each ric it will be have some empty data)
|
45856
45927
|
}
|
45857
45928
|
this.setRicData(ric, snapShotData[ric]); // update cell data if exist
|
45858
45929
|
}
|
45859
|
-
|
45860
|
-
|
45930
|
+
let parentField, field, colIndex, parentColDef, childColIndex;
|
45931
|
+
let parentMap = {}; // map parent time series field and their first child
|
45861
45932
|
for (field in childFields) { // Warning: data change can be differ time series child field
|
45862
45933
|
parentField = e.childrenFieldToParent[field];
|
45863
45934
|
if(!parentMap[parentField]) {
|
@@ -45868,10 +45939,10 @@ Grid.prototype._updateTimeSeriesFields = function (e) {
|
|
45868
45939
|
}
|
45869
45940
|
|
45870
45941
|
for (parentField in parentMap) { // WARNING: one dataChanged event can be multiple fields
|
45871
|
-
|
45942
|
+
let childrenField = parentMap[parentField];
|
45872
45943
|
colIndex = this.getColumnIndex(parentField);
|
45873
45944
|
parentColDef = this._getColumnDefinition(colIndex);
|
45874
|
-
|
45945
|
+
let i, len;
|
45875
45946
|
len = childrenField.length;
|
45876
45947
|
for (i = 0; i < len; i++) {
|
45877
45948
|
childField = childrenField[i];
|
@@ -45897,8 +45968,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45897
45968
|
return;
|
45898
45969
|
}
|
45899
45970
|
|
45900
|
-
|
45901
|
-
|
45971
|
+
let colDefs = this._timeSeriesChildConflator.popAllData();
|
45972
|
+
let i, j, len, childField, idx;
|
45902
45973
|
|
45903
45974
|
for (i = 0; i < colDefs.length; i++) {
|
45904
45975
|
colDef = colDefs[i];
|
@@ -45907,8 +45978,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45907
45978
|
if(!colDef) {
|
45908
45979
|
continue;
|
45909
45980
|
}
|
45910
|
-
|
45911
|
-
|
45981
|
+
let parentField = colDef.getField();
|
45982
|
+
let childFields = js_FieldDefinition.getTimeSeriesChildren(parentField);
|
45912
45983
|
if(!childFields) { // not found time series field
|
45913
45984
|
return;
|
45914
45985
|
}
|
@@ -45933,7 +46004,7 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45933
46004
|
* @param {number} idx index of insertion column
|
45934
46005
|
*/
|
45935
46006
|
Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx) {
|
45936
|
-
|
46007
|
+
let parentConfig, columnOption;
|
45937
46008
|
parentConfig = parentColDef.getConfigObject();
|
45938
46009
|
columnOption = cloneObject(parentConfig);
|
45939
46010
|
columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
|
@@ -45950,15 +46021,15 @@ Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx)
|
|
45950
46021
|
* @param {Grid~ColumnReference} colRef
|
45951
46022
|
*/
|
45952
46023
|
Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
45953
|
-
|
46024
|
+
let colIndex = this.getColumnIndex(colRef);
|
45954
46025
|
if(colIndex < 0) {
|
45955
46026
|
return;
|
45956
46027
|
}
|
45957
|
-
|
45958
|
-
|
45959
|
-
|
46028
|
+
let colConfig = {};
|
46029
|
+
let core = this._grid;
|
46030
|
+
let columnDef = core._getColumnDef(colIndex);
|
45960
46031
|
|
45961
|
-
|
46032
|
+
let value = core.getColumnScalability(colIndex);
|
45962
46033
|
colConfig["scalable"] = value;
|
45963
46034
|
|
45964
46035
|
value = core.getColumnCustomLaneSize(colIndex);
|
@@ -45992,7 +46063,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
45992
46063
|
if(typeof columnOption === "string") {
|
45993
46064
|
colConfig["field"] = columnOption;
|
45994
46065
|
} else { // type object from user
|
45995
|
-
for (
|
46066
|
+
for (let key in columnOption) {
|
45996
46067
|
colConfig[key] = columnOption[key];
|
45997
46068
|
}
|
45998
46069
|
}
|
@@ -46005,7 +46076,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
46005
46076
|
colConfig["width"] = 1;
|
46006
46077
|
}
|
46007
46078
|
|
46008
|
-
|
46079
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46009
46080
|
if(colDef && colConfig.id == null) {
|
46010
46081
|
colConfig.id = colDef.getId(); // retain ID
|
46011
46082
|
}
|
@@ -46023,7 +46094,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
46023
46094
|
*/
|
46024
46095
|
Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
|
46025
46096
|
if (response && response.id) {
|
46026
|
-
|
46097
|
+
let fieldDef = response;
|
46027
46098
|
if (colDef && colDef.getField() === field) {
|
46028
46099
|
if (colDef.isDefaultName() && fieldDef.name) {
|
46029
46100
|
colDef.setName(fieldDef.name);
|
@@ -46049,7 +46120,7 @@ Grid.prototype._onFieldLoadedError = function (err) {
|
|
46049
46120
|
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
46050
46121
|
// For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
|
46051
46122
|
if(js_FieldDefinition.isTimeSeries(field)) {
|
46052
|
-
|
46123
|
+
let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
|
46053
46124
|
this._populateTimeSeriesChildren(colDef);
|
46054
46125
|
}
|
46055
46126
|
this._connector.addFields(field, referrer);
|
@@ -46086,14 +46157,14 @@ Grid.prototype.getFieldInfo = function(field) {
|
|
46086
46157
|
* @param {string} field
|
46087
46158
|
* @return {Promise}
|
46088
46159
|
* @example
|
46089
|
-
*
|
46160
|
+
* let gridConfig = {
|
46090
46161
|
* synapse: { // define synapse configuration
|
46091
46162
|
* apiKey: "xxx",
|
46092
46163
|
* contextApp: "xxx",
|
46093
46164
|
* auth: "xxx" (optional)
|
46094
46165
|
* }
|
46095
46166
|
* };
|
46096
|
-
*
|
46167
|
+
* let promise = grid.loadFieldInfo("CF_LAST");
|
46097
46168
|
*/
|
46098
46169
|
Grid.prototype.loadFieldInfo = function(field) {
|
46099
46170
|
return js_FieldDefinition.loadFieldInfo(field);
|
@@ -46106,7 +46177,7 @@ Grid.prototype.loadFieldInfo = function(field) {
|
|
46106
46177
|
*/
|
46107
46178
|
Grid.prototype._shouldLoadFieldInfo = function (field) {
|
46108
46179
|
|
46109
|
-
|
46180
|
+
let val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
|
46110
46181
|
if(!val) {
|
46111
46182
|
return false;
|
46112
46183
|
}
|
@@ -46133,17 +46204,17 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
|
|
46133
46204
|
* @param {Array.<Object>} columns Array of column options
|
46134
46205
|
*/
|
46135
46206
|
Grid.prototype.setColumns = function(columns) {
|
46136
|
-
|
46137
|
-
|
46207
|
+
let grid = this._grid;
|
46208
|
+
let colCount = (columns) ? columns.length : 0;
|
46138
46209
|
|
46139
46210
|
grid.startBatch("reset");
|
46140
46211
|
this.removeAllColumns();
|
46141
46212
|
if(colCount > 0) {
|
46142
|
-
|
46213
|
+
let prevState = false;
|
46143
46214
|
if(colCount > 1) {
|
46144
46215
|
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
46145
46216
|
}
|
46146
|
-
for(
|
46217
|
+
for(let i = 0; i < colCount; ++i) {
|
46147
46218
|
this.insertColumn(columns[i], i);
|
46148
46219
|
}
|
46149
46220
|
if(colCount > 1) {
|
@@ -46160,20 +46231,20 @@ Grid.prototype.setColumns = function(columns) {
|
|
46160
46231
|
* @param {boolean=} byId=false, if enable it, this method will only check for differences in the 'id' property
|
46161
46232
|
*/
|
46162
46233
|
Grid.prototype.restoreColumns = function(columns, byId) {
|
46163
|
-
|
46234
|
+
let grid = this._grid;
|
46164
46235
|
grid.startBatch("reset");
|
46165
|
-
|
46166
|
-
|
46236
|
+
let configObj = this.getConfigObject();
|
46237
|
+
let previousColumns = configObj.columns;
|
46167
46238
|
|
46168
|
-
|
46169
|
-
|
46239
|
+
let preColLen = previousColumns.length;
|
46240
|
+
let newColLen = columns.length;
|
46170
46241
|
|
46171
|
-
|
46172
|
-
|
46173
|
-
|
46174
|
-
|
46242
|
+
let compareLogic = byId ? _hasMatchingId : deepEqual;
|
46243
|
+
let removingFields = [];
|
46244
|
+
let keepingColumns = [];
|
46245
|
+
let columnOrdering = [];
|
46175
46246
|
|
46176
|
-
|
46247
|
+
let i, j, found;
|
46177
46248
|
// Slow, time complexity BigO(n ^ 2)
|
46178
46249
|
for (i = 0; i < preColLen; i++) {
|
46179
46250
|
found = false;
|
@@ -46191,8 +46262,8 @@ Grid.prototype.restoreColumns = function(columns, byId) {
|
|
46191
46262
|
|
46192
46263
|
this.removeColumns(removingFields);
|
46193
46264
|
|
46194
|
-
|
46195
|
-
|
46265
|
+
let keepingLen = keepingColumns.length;
|
46266
|
+
let prevState = false;
|
46196
46267
|
if(newColLen > 1) {
|
46197
46268
|
prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
46198
46269
|
}
|
@@ -46201,7 +46272,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
|
|
46201
46272
|
for (j = 0; j < keepingLen; j++) { // loop only keeping column
|
46202
46273
|
if(compareLogic(columns[i], keepingColumns[j])) {
|
46203
46274
|
found = true;
|
46204
|
-
|
46275
|
+
let colIndex = this.getColumnIndex(columns[i].id || columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
|
46205
46276
|
columnOrdering.push(this.getColumnId(colIndex));
|
46206
46277
|
break;
|
46207
46278
|
}
|
@@ -46232,27 +46303,27 @@ Grid.prototype.setFields = Grid.prototype.setColumns;
|
|
46232
46303
|
* @param {Object} e
|
46233
46304
|
*/
|
46234
46305
|
Grid.prototype._onColumnAdded = function(e) {
|
46235
|
-
|
46306
|
+
let colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
|
46236
46307
|
delete e.context[COL_DEF];
|
46237
|
-
|
46308
|
+
let idx = e.colIndex;
|
46238
46309
|
|
46239
|
-
|
46310
|
+
let coreColDef = this._grid._getColumnDef(idx);
|
46240
46311
|
colDef._setCoreColumnDef(coreColDef); // For column id and field
|
46241
46312
|
|
46242
|
-
|
46313
|
+
let colData = this._grid.getColumnData(idx);
|
46243
46314
|
if(!colData) { // Save column inside grid
|
46244
46315
|
colData = this._grid.setColumnData(idx, {});
|
46245
46316
|
}
|
46246
46317
|
colData[COL_DEF] = colDef;
|
46247
|
-
|
46318
|
+
let userModel = colDef.getUserModel();
|
46248
46319
|
// binding
|
46249
46320
|
this._grid.setColumnDataBindingHandler(idx, colDef.getRenderer());
|
46250
46321
|
// width and scalable
|
46251
|
-
|
46322
|
+
let value = userModel["width"];
|
46252
46323
|
// eslint-disable-next-line no-undefined
|
46253
46324
|
if(value !== undefined) {
|
46254
46325
|
value = +value;
|
46255
|
-
|
46326
|
+
let scalable;
|
46256
46327
|
if(userModel["scalable"] != null) {
|
46257
46328
|
scalable = userModel["scalable"] ? true : false;
|
46258
46329
|
} else {
|
@@ -46288,16 +46359,16 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
46288
46359
|
}
|
46289
46360
|
|
46290
46361
|
// className
|
46291
|
-
|
46362
|
+
let i, classes = colDef.getClasses();
|
46292
46363
|
for(i = 0; i < classes.length; i++) {
|
46293
46364
|
this._grid.enableColumnClass(idx, classes[i]);
|
46294
46365
|
}
|
46295
|
-
|
46366
|
+
let colField = colDef.getField();
|
46296
46367
|
this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
|
46297
|
-
|
46298
|
-
|
46299
|
-
|
46300
|
-
|
46368
|
+
let fields = colDef.getAllFields();
|
46369
|
+
let referrer = colDef.getId();
|
46370
|
+
let len = fields.length;
|
46371
|
+
let field, dataType, prom, onLoaded;
|
46301
46372
|
for(i = 0; i < len; i++) {
|
46302
46373
|
field = fields[i];
|
46303
46374
|
if(this._shouldLoadFieldInfo(field)) {
|
@@ -46335,12 +46406,12 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
46335
46406
|
* @see {@link Grid#removeAllColumns}
|
46336
46407
|
*/
|
46337
46408
|
Grid.prototype.removeColumn = function(colRef) {
|
46338
|
-
|
46409
|
+
let colIndex = this.getColumnIndex(colRef);
|
46339
46410
|
if(colIndex < 0) {
|
46340
46411
|
return;
|
46341
46412
|
}
|
46342
46413
|
|
46343
|
-
|
46414
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46344
46415
|
|
46345
46416
|
if(!colDef.isRealTimeField()) {
|
46346
46417
|
if(this._dc) {
|
@@ -46361,8 +46432,8 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
46361
46432
|
* @see {@link Grid#removeAllColumns}
|
46362
46433
|
*/
|
46363
46434
|
Grid.prototype.removeColumns = function(colRefs) {
|
46364
|
-
|
46365
|
-
|
46435
|
+
let indices = this.getColumnIndices(colRefs);
|
46436
|
+
let len = indices.length;
|
46366
46437
|
if(len <= 1) {
|
46367
46438
|
if(len === 1) {
|
46368
46439
|
this.removeColumn(indices[0]);
|
@@ -46371,12 +46442,12 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
46371
46442
|
}
|
46372
46443
|
indices.sort(Grid._descendingOrder); // Removal must be done from the back
|
46373
46444
|
|
46374
|
-
|
46375
|
-
|
46445
|
+
let staticFields = []; // For clearing any data stored in our cache
|
46446
|
+
let prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
|
46376
46447
|
|
46377
|
-
for(
|
46378
|
-
|
46379
|
-
|
46448
|
+
for(let i = 0; i < len; ++i) {
|
46449
|
+
let colIndex = indices[i];
|
46450
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46380
46451
|
if(!colDef.isRealTimeField()) {
|
46381
46452
|
staticFields.push(colDef.getField());
|
46382
46453
|
}
|
@@ -46398,7 +46469,7 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
46398
46469
|
* @see {@link Grid#removeColumns}
|
46399
46470
|
*/
|
46400
46471
|
Grid.prototype.removeAllColumns = function() {
|
46401
|
-
|
46472
|
+
let colCount = this.getColumnCount();
|
46402
46473
|
if(colCount <= 0) {
|
46403
46474
|
return;
|
46404
46475
|
}
|
@@ -46406,10 +46477,10 @@ Grid.prototype.removeAllColumns = function() {
|
|
46406
46477
|
if(!this._sharedSorter) {
|
46407
46478
|
this.clearSort();
|
46408
46479
|
}
|
46409
|
-
for(
|
46480
|
+
for(let i = colCount; --i >= 0;) {
|
46410
46481
|
// WARNING: This may affect plugins event listeners
|
46411
46482
|
this._grid.setColumnDataBindingHandler(i, null);
|
46412
|
-
|
46483
|
+
let colDef = this.getColumnDefinition(i);
|
46413
46484
|
colDef.dispose();
|
46414
46485
|
}
|
46415
46486
|
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
@@ -46469,7 +46540,7 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
|
46469
46540
|
* @see {@link Grid#showAllColumns}
|
46470
46541
|
*/
|
46471
46542
|
Grid.prototype.hideColumn = function(colRef, hidden) {
|
46472
|
-
|
46543
|
+
let colIndex = this.getColumnIndex(colRef);
|
46473
46544
|
if(colIndex < 0) { // not found
|
46474
46545
|
return;
|
46475
46546
|
}
|
@@ -46514,9 +46585,9 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
|
|
46514
46585
|
return false;
|
46515
46586
|
}
|
46516
46587
|
|
46517
|
-
|
46518
|
-
|
46519
|
-
|
46588
|
+
let fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
|
46589
|
+
let len = fields.length;
|
46590
|
+
let i, field, dataType, prom, onLoaded;
|
46520
46591
|
for(i = 0; i < len; i++) {
|
46521
46592
|
field = fields[i];
|
46522
46593
|
if(this._shouldLoadFieldInfo(field)) {
|
@@ -46573,7 +46644,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
|
|
46573
46644
|
return;
|
46574
46645
|
}
|
46575
46646
|
|
46576
|
-
|
46647
|
+
let colIndex = this.getColumnIndex(colRef);
|
46577
46648
|
if(colIndex < 0) {
|
46578
46649
|
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
46579
46650
|
} else {
|
@@ -46585,7 +46656,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
|
|
46585
46656
|
* @param {string} str
|
46586
46657
|
*/
|
46587
46658
|
Grid.prototype.setColumnName = function(colIndex, str) {
|
46588
|
-
|
46659
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46589
46660
|
if(colDef) {
|
46590
46661
|
colDef.setName(str);
|
46591
46662
|
this.updateColumnTitle();
|
@@ -46596,7 +46667,7 @@ Grid.prototype.setColumnName = function(colIndex, str) {
|
|
46596
46667
|
* @param {Function=} func
|
46597
46668
|
*/
|
46598
46669
|
Grid.prototype.setColumnRenderer = function(colRef, func) {
|
46599
|
-
|
46670
|
+
let colIndex = this.getColumnIndex(colRef);
|
46600
46671
|
this.setColumnFormatter(colIndex, func);
|
46601
46672
|
};
|
46602
46673
|
|
@@ -46606,10 +46677,10 @@ Grid.prototype.setColumnRenderer = function(colRef, func) {
|
|
46606
46677
|
* @param {Function=} func If not specified the renderer which corresponded id from mapping will be picked up
|
46607
46678
|
*/
|
46608
46679
|
Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
46609
|
-
|
46680
|
+
let colIndex = this.getColumnIndex(colRef);
|
46610
46681
|
if (colIndex == null) { return; }
|
46611
46682
|
|
46612
|
-
|
46683
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46613
46684
|
if(!colDef) { return; }
|
46614
46685
|
|
46615
46686
|
colDef.activateRenderer(id, func);
|
@@ -46626,12 +46697,12 @@ Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
|
46626
46697
|
Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
46627
46698
|
if (colIndex == null) { return; }
|
46628
46699
|
|
46629
|
-
|
46700
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46630
46701
|
if(!colDef) {
|
46631
46702
|
return;
|
46632
46703
|
}
|
46633
46704
|
|
46634
|
-
|
46705
|
+
let func = null;
|
46635
46706
|
if (formatter) {
|
46636
46707
|
if(typeof formatter === "object") {
|
46637
46708
|
if(typeof formatter.init === "function") { // Initialize predefined formatter
|
@@ -46648,8 +46719,8 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
|
46648
46719
|
}
|
46649
46720
|
|
46650
46721
|
if(func !== colDef.getRenderer()) {
|
46651
|
-
|
46652
|
-
|
46722
|
+
let section = this._grid.getSection("content");
|
46723
|
+
let col = /** @type {Column} */section.getColumn(colIndex);
|
46653
46724
|
if (col) {
|
46654
46725
|
col.clearContent();
|
46655
46726
|
}
|
@@ -46668,12 +46739,12 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
|
46668
46739
|
* @param {ColumnDefinition~SortLogic=} func
|
46669
46740
|
*/
|
46670
46741
|
Grid.prototype.setColumnSorter = function(colRef, func) {
|
46671
|
-
|
46672
|
-
|
46742
|
+
let colIndex = this.getColumnIndex(colRef);
|
46743
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46673
46744
|
if(colDef) {
|
46674
46745
|
colDef.setSorter(func);
|
46675
46746
|
|
46676
|
-
|
46747
|
+
let sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
46677
46748
|
if(sortedColumn === colIndex) {
|
46678
46749
|
this._stp.refresh();
|
46679
46750
|
}
|
@@ -46686,8 +46757,8 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
46686
46757
|
* @param {RowDefinition} rowDef
|
46687
46758
|
*/
|
46688
46759
|
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
46689
|
-
|
46690
|
-
|
46760
|
+
let ric = rowDef.getSymbol();
|
46761
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
46691
46762
|
if(rowDefs && rowDefs.length) {
|
46692
46763
|
cloneRowData(rowDefs[0], rowDef);
|
46693
46764
|
}
|
@@ -46697,7 +46768,7 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
|
|
46697
46768
|
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
46698
46769
|
* @returns {RowDefinition}
|
46699
46770
|
* @example
|
46700
|
-
*
|
46771
|
+
* let grid = new rt.Grid(grid_div, options);
|
46701
46772
|
* grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
|
46702
46773
|
*/
|
46703
46774
|
Grid.prototype.insertRow = function(rowOption, rowRef) {
|
@@ -46714,7 +46785,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
46714
46785
|
}
|
46715
46786
|
}
|
46716
46787
|
}
|
46717
|
-
|
46788
|
+
let rowDef = new RowDefinition(rowOption);
|
46718
46789
|
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
46719
46790
|
this._initDuplicateRicData(rowDef);
|
46720
46791
|
|
@@ -46730,7 +46801,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
46730
46801
|
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
46731
46802
|
* @param {Array.<string>=} opt_fields
|
46732
46803
|
* @example
|
46733
|
-
*
|
46804
|
+
* let grid = new rt.Grid(grid_div, options);
|
46734
46805
|
* grid.insertRows([
|
46735
46806
|
* {ric: "RIC"},
|
46736
46807
|
* {values: {"field1": 0, "field2": 1}},
|
@@ -46747,12 +46818,12 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
46747
46818
|
return;
|
46748
46819
|
}
|
46749
46820
|
|
46750
|
-
|
46751
|
-
|
46752
|
-
|
46753
|
-
|
46754
|
-
for(
|
46755
|
-
|
46821
|
+
let prevState = this._dt.freeze(); // Avoid sorting for each inserted row
|
46822
|
+
let fields = opt_fields || this.getColumnFields();
|
46823
|
+
let rowId = this._getRowId(rowRef);
|
46824
|
+
let len = rowOptions.length;
|
46825
|
+
for(let r = 0; r < len; ++r) {
|
46826
|
+
let rowOption = rowOptions[r];
|
46756
46827
|
if(rowOption) {
|
46757
46828
|
if(typeof rowOption === "string") {
|
46758
46829
|
rowOption = { "ric": rowOption };
|
@@ -46770,7 +46841,7 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
46770
46841
|
* @see {@link Grid#logDV}
|
46771
46842
|
* @see {@link Grid#logDT}
|
46772
46843
|
* @example
|
46773
|
-
*
|
46844
|
+
* let grid = new rt.Grid(grid_div, options);
|
46774
46845
|
* grid.addStaticDataRows([
|
46775
46846
|
* [10, "a", true],
|
46776
46847
|
* [20, "b", false],
|
@@ -46791,7 +46862,7 @@ Grid.prototype.addStaticDataRows = function(dataRows, fields) {
|
|
46791
46862
|
}
|
46792
46863
|
|
46793
46864
|
if(!Array.isArray(dataRows)) {
|
46794
|
-
|
46865
|
+
let userObj = dataRows;
|
46795
46866
|
dataRows = null;
|
46796
46867
|
if(userObj) {
|
46797
46868
|
if(userObj.fields && !fields) {
|
@@ -46855,13 +46926,15 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46855
46926
|
}
|
46856
46927
|
|
46857
46928
|
// Map new data index
|
46858
|
-
|
46859
|
-
|
46860
|
-
|
46861
|
-
|
46862
|
-
|
46863
|
-
|
46929
|
+
let recordCount = records.length;
|
46930
|
+
let fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
|
46931
|
+
let oldDataMap = {};
|
46932
|
+
let rowDef, id, record, i;
|
46933
|
+
let rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
|
46934
|
+
let rowDefCount = rowDefs.length;
|
46935
|
+
let prevState = false;
|
46864
46936
|
if(rowIdentifier) {
|
46937
|
+
prevState = this._dt.freeze();
|
46865
46938
|
for (i = 0; i < rowDefCount; i++) {
|
46866
46939
|
rowDef = rowDefs[i];
|
46867
46940
|
if(rowDef) {
|
@@ -46874,8 +46947,8 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46874
46947
|
}
|
46875
46948
|
}
|
46876
46949
|
|
46877
|
-
|
46878
|
-
|
46950
|
+
let idMap = {};
|
46951
|
+
let newDataMap = {};
|
46879
46952
|
for (i = recordCount - 1; i >= 0; i--) {
|
46880
46953
|
record = records[i];
|
46881
46954
|
id = record[rowIdentifier];
|
@@ -46893,13 +46966,17 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46893
46966
|
}
|
46894
46967
|
}
|
46895
46968
|
// Check Remove previous data
|
46896
|
-
for (
|
46969
|
+
for (let rowIdentifierName in oldDataMap) {
|
46897
46970
|
if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
|
46898
46971
|
this.removeRow(oldDataMap[rowIdentifierName]); // Slow
|
46899
46972
|
}
|
46900
46973
|
}
|
46901
46974
|
this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
|
46975
|
+
this._dt.freeze(prevState);
|
46902
46976
|
} else {
|
46977
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
46978
|
+
prevState = this._dt.freeze();
|
46979
|
+
}
|
46903
46980
|
for (i = 0; i < rowDefCount; i++) {
|
46904
46981
|
record = records[i];
|
46905
46982
|
if(record) {
|
@@ -46918,6 +46995,9 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46918
46995
|
rowDef.setRowData(record);
|
46919
46996
|
}
|
46920
46997
|
}
|
46998
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
46999
|
+
this._dt.freeze(prevState);
|
47000
|
+
}
|
46921
47001
|
}
|
46922
47002
|
};
|
46923
47003
|
/** @private
|
@@ -46937,7 +47017,7 @@ Grid.prototype.removeRow = function(rowRef) {
|
|
46937
47017
|
if(this._mainGrid) {
|
46938
47018
|
return this._mainGrid.removeRow(this._getRowId(rowRef));
|
46939
47019
|
}
|
46940
|
-
|
47020
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
46941
47021
|
if(rowDef) {
|
46942
47022
|
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
46943
47023
|
this._removeRow(rowDef);
|
@@ -46953,7 +47033,7 @@ Grid.prototype.removeRow = function(rowRef) {
|
|
46953
47033
|
* @see {@link Grid#removeAllRows}
|
46954
47034
|
*/
|
46955
47035
|
Grid.prototype.removeRows = function(rowRefs) {
|
46956
|
-
|
47036
|
+
let rowDef;
|
46957
47037
|
if(!Array.isArray(rowRefs)) {
|
46958
47038
|
rowDef = this.removeRow(rowRefs);
|
46959
47039
|
return rowDef ? [rowDef] : [];
|
@@ -46962,9 +47042,9 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
46962
47042
|
return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
|
46963
47043
|
}
|
46964
47044
|
|
46965
|
-
|
46966
|
-
|
46967
|
-
|
47045
|
+
let i;
|
47046
|
+
let rowDefs = [];
|
47047
|
+
let len = rowRefs.length;
|
46968
47048
|
|
46969
47049
|
// Verify user input
|
46970
47050
|
for(i = 0; i < len; ++i) {
|
@@ -46977,7 +47057,7 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
46977
47057
|
}
|
46978
47058
|
len = rowDefs.length;
|
46979
47059
|
|
46980
|
-
|
47060
|
+
let prevState = false;
|
46981
47061
|
if(len > 1) {
|
46982
47062
|
prevState = this._dt.freeze(); // Prevent multiple changes that trigger sorting and filtering
|
46983
47063
|
}
|
@@ -47002,7 +47082,7 @@ Grid.prototype.removeAllRows = function() {
|
|
47002
47082
|
if(!this._dt.getRowCount()) {
|
47003
47083
|
return;
|
47004
47084
|
}
|
47005
|
-
|
47085
|
+
let rowDefs = this._getAllRowDefinitions();
|
47006
47086
|
|
47007
47087
|
if(!this._sharedDataSource) {
|
47008
47088
|
this._dc.clearAllData();
|
@@ -47030,14 +47110,14 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
47030
47110
|
}
|
47031
47111
|
this._dispatch("beforeRowRemoved", {});
|
47032
47112
|
|
47033
|
-
|
47034
|
-
|
47035
|
-
|
47113
|
+
let connector = this._connector;
|
47114
|
+
let dt = this._dt;
|
47115
|
+
let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
|
47036
47116
|
if(childRowDefs) { // Remove all children first
|
47037
|
-
for(
|
47117
|
+
for(let i = 0; i < childRowDefs.length; i++) {
|
47038
47118
|
connector.removeRic(childRowDefs[i]);
|
47039
47119
|
}
|
47040
|
-
|
47120
|
+
let rowIds = childRowDefs.map(RowDefinition.toRowId);
|
47041
47121
|
dt.removeRows(rowIds);
|
47042
47122
|
}
|
47043
47123
|
connector.removeRic(rowDef);
|
@@ -47050,8 +47130,8 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
47050
47130
|
* @param {boolean=} hidden if false, show instead of hide
|
47051
47131
|
*/
|
47052
47132
|
Grid.prototype.hideRow = function(rowRef, hidden) {
|
47053
|
-
|
47054
|
-
|
47133
|
+
let rid = this._getRowId(rowRef);
|
47134
|
+
let grid = this._mainGrid || this._grid;
|
47055
47135
|
grid.hideRow(rid, hidden);
|
47056
47136
|
};
|
47057
47137
|
|
@@ -47064,8 +47144,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
|
|
47064
47144
|
if (!Array.isArray(rowRefs)) {
|
47065
47145
|
rowRefs = [rowRefs];
|
47066
47146
|
}
|
47067
|
-
|
47068
|
-
|
47147
|
+
let rids = rowRefs.map(this._getRowId);
|
47148
|
+
let grid = this._mainGrid || this._grid;
|
47069
47149
|
grid.hideRows(rids, hidden);
|
47070
47150
|
};
|
47071
47151
|
/**
|
@@ -47103,19 +47183,19 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
47103
47183
|
this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
47104
47184
|
return;
|
47105
47185
|
}
|
47106
|
-
|
47186
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47107
47187
|
if(rowDef) {
|
47108
47188
|
options = options || {};
|
47109
47189
|
options["ric"] = str;
|
47110
|
-
|
47111
|
-
|
47190
|
+
let extractedOptions = RowDefinition.extractRowOptions(options);
|
47191
|
+
let oldRic = rowDef.getSymbol();
|
47112
47192
|
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
47113
47193
|
this._connector.removeRic(rowDef, oldRic);
|
47114
47194
|
this._initDuplicateRicData(rowDef);
|
47115
47195
|
this._connector.addRic(rowDef);
|
47116
47196
|
}
|
47117
47197
|
|
47118
|
-
|
47198
|
+
let values = options["values"];
|
47119
47199
|
if(values != null) {
|
47120
47200
|
rowDef.setStaticRowData(values, options["fields"]);
|
47121
47201
|
}
|
@@ -47131,7 +47211,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
47131
47211
|
* @param {Grid~RowReference} rowRef
|
47132
47212
|
*/
|
47133
47213
|
Grid.prototype.unlinkChain = function(rowRef) {
|
47134
|
-
|
47214
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47135
47215
|
if(!rowDef) {
|
47136
47216
|
return;
|
47137
47217
|
}
|
@@ -47170,7 +47250,7 @@ Grid.prototype._onRowExpansionBinding = function(e) {
|
|
47170
47250
|
}
|
47171
47251
|
|
47172
47252
|
if(e["originalRowId"]) {
|
47173
|
-
|
47253
|
+
let rowIndex = this._dv.getRowIndex(e["originalRowId"]);
|
47174
47254
|
e["originalRowDef"] = this._getRowDefinitionByIndex(rowIndex);
|
47175
47255
|
e["originalRowData"] = e["originalRowDef"].getRowData();
|
47176
47256
|
} else {
|
@@ -47224,7 +47304,7 @@ Grid.prototype.getColumnCount = function() {
|
|
47224
47304
|
* @return {string}
|
47225
47305
|
*/
|
47226
47306
|
Grid.prototype.getColumnDataType = function(colIndex) {
|
47227
|
-
|
47307
|
+
let colDef = this.getColumnDefinition(colIndex);
|
47228
47308
|
if (colDef) {
|
47229
47309
|
return colDef.getDataType();
|
47230
47310
|
}
|
@@ -47235,7 +47315,7 @@ Grid.prototype.getColumnDataType = function(colIndex) {
|
|
47235
47315
|
* @return {ColumnDefinition}
|
47236
47316
|
*/
|
47237
47317
|
Grid.prototype.getColumnDefinition = function(colIndex) {
|
47238
|
-
|
47318
|
+
let colData = this._grid.getColumnData(colIndex);
|
47239
47319
|
if(colData) {
|
47240
47320
|
return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
|
47241
47321
|
}
|
@@ -47245,9 +47325,9 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
|
|
47245
47325
|
* @return {!Array.<ColumnDefinition>}
|
47246
47326
|
*/
|
47247
47327
|
Grid.prototype.getColumnDefinitions = function() {
|
47248
|
-
|
47249
|
-
|
47250
|
-
for(
|
47328
|
+
let colCount = this.getColumnCount();
|
47329
|
+
let colDefs = new Array(colCount);
|
47330
|
+
for(let i = 0; i < colCount; i++) {
|
47251
47331
|
colDefs[i] = this.getColumnDefinition(i);
|
47252
47332
|
}
|
47253
47333
|
return colDefs;
|
@@ -47269,10 +47349,10 @@ Grid.prototype.getColumnDefinitionById = function(colId) {
|
|
47269
47349
|
* @return {ColumnDefinition}
|
47270
47350
|
*/
|
47271
47351
|
Grid.prototype.getColumnDefinitionsById = function(colIds) {
|
47272
|
-
|
47352
|
+
let colCount = Array.isArray(colIds) ? colIds.length : 0;
|
47273
47353
|
if(colCount > 0) {
|
47274
|
-
|
47275
|
-
|
47354
|
+
let i, colId;
|
47355
|
+
let colDefs = new Array(colCount);
|
47276
47356
|
for(i = 0; i < colCount; i++) {
|
47277
47357
|
colId = colIds[i];
|
47278
47358
|
colDefs[i] = this.getColumnDefinitionById(colId);
|
@@ -47292,9 +47372,9 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
47292
47372
|
} else if(typeof colRef === "number") {
|
47293
47373
|
return this.getColumnDefinition(colRef);
|
47294
47374
|
} else if(typeof colRef === "string") {
|
47295
|
-
|
47296
|
-
for(
|
47297
|
-
|
47375
|
+
let colCount = this.getColumnCount();
|
47376
|
+
for(let i = 0; i < colCount; ++i) {
|
47377
|
+
let colDef = this.getColumnDefinition(i);
|
47298
47378
|
if(_hasFieldOrId(colDef, colRef)) {
|
47299
47379
|
return colDef; // Return the first found column
|
47300
47380
|
}
|
@@ -47307,7 +47387,7 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
47307
47387
|
* @return {string}
|
47308
47388
|
*/
|
47309
47389
|
Grid.prototype.getRowType = function(rowRef) {
|
47310
|
-
|
47390
|
+
let rowDef = this.getRowDefinition(rowRef);
|
47311
47391
|
return rowDef ? rowDef.getType() : "";
|
47312
47392
|
};
|
47313
47393
|
/** Get RowDefinition object by either number or row id
|
@@ -47399,15 +47479,15 @@ Grid.prototype.getMultipleRowData = function(obj) {
|
|
47399
47479
|
if(typeof obj === "number") {
|
47400
47480
|
return [this.getRowData(obj)];
|
47401
47481
|
}
|
47402
|
-
|
47482
|
+
let rowDefs = null;
|
47403
47483
|
if(Array.isArray(obj)) {
|
47404
|
-
|
47405
|
-
|
47406
|
-
|
47484
|
+
let rowRefs = obj;
|
47485
|
+
let rowCount = rowRefs.length;
|
47486
|
+
let rows = new Array(rowCount);
|
47407
47487
|
rowDefs = this.getRowDefinitions();
|
47408
47488
|
|
47409
|
-
for(
|
47410
|
-
|
47489
|
+
for(let r = 0; r < rowCount; ++r) {
|
47490
|
+
let rowRef = rowRefs[r];
|
47411
47491
|
if(typeof rowRef === "number") {
|
47412
47492
|
rows[r] = toRowData(rowDefs[rowRef]);
|
47413
47493
|
} else if(rowRef && rowRef.getRowData) {
|
@@ -47430,10 +47510,10 @@ Grid.prototype.getMultipleRowData = function(obj) {
|
|
47430
47510
|
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
47431
47511
|
*/
|
47432
47512
|
Grid.prototype.setRicData = function(ric, values) {
|
47433
|
-
|
47434
|
-
|
47435
|
-
for (
|
47436
|
-
|
47513
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
47514
|
+
let rowCount = rowDefs ? rowDefs.length : 0;
|
47515
|
+
for (let i = 0; i < rowCount; ++i) {
|
47516
|
+
let rowDef = rowDefs[i];
|
47437
47517
|
if (rowDef && rowDef.getSymbol() === ric) {
|
47438
47518
|
rowDef.setRowData(values); // TODO: Need conflator to improve performance
|
47439
47519
|
}
|
@@ -47445,7 +47525,7 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
47445
47525
|
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
47446
47526
|
*/
|
47447
47527
|
Grid.prototype.setRowData = function(rowRef, values) {
|
47448
|
-
|
47528
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47449
47529
|
if(rowDef) {
|
47450
47530
|
rowDef.setRowData(values);
|
47451
47531
|
}
|
@@ -47457,7 +47537,7 @@ Grid.prototype.setRowData = function(rowRef, values) {
|
|
47457
47537
|
* @param {Object} values
|
47458
47538
|
*/
|
47459
47539
|
Grid.prototype.setStaticRowData = function(rowRef, values) {
|
47460
|
-
|
47540
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47461
47541
|
if(rowDef) {
|
47462
47542
|
rowDef.setStaticRowData(values);
|
47463
47543
|
}
|
@@ -47470,7 +47550,7 @@ Grid.prototype.setStaticRowData = function(rowRef, values) {
|
|
47470
47550
|
* @param {*} value
|
47471
47551
|
*/
|
47472
47552
|
Grid.prototype.setStaticData = function(rowRef, field, value) {
|
47473
|
-
|
47553
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47474
47554
|
if(rowDef) {
|
47475
47555
|
rowDef.setStaticData(field, value);
|
47476
47556
|
}
|
@@ -47498,9 +47578,9 @@ Grid.prototype._getRowId = function(rowRef) {
|
|
47498
47578
|
Grid.prototype.getColumnIndex = function(colRef) {
|
47499
47579
|
if(colRef) {
|
47500
47580
|
if(colRef instanceof ColumnDefinition) {
|
47501
|
-
|
47502
|
-
for(
|
47503
|
-
|
47581
|
+
let colCount = this.getColumnCount();
|
47582
|
+
for(let i = 0; i < colCount; ++i) {
|
47583
|
+
let colDef = this.getColumnDefinition(i);
|
47504
47584
|
if(colDef === colRef) {
|
47505
47585
|
return i;
|
47506
47586
|
}
|
@@ -47516,13 +47596,13 @@ Grid.prototype.getColumnIndex = function(colRef) {
|
|
47516
47596
|
* @return {!Array.<number>}
|
47517
47597
|
*/
|
47518
47598
|
Grid.prototype.getColumnIndices = function(colRefs) {
|
47519
|
-
|
47520
|
-
|
47521
|
-
|
47522
|
-
|
47599
|
+
let ary = [];
|
47600
|
+
let colCount = this.getColumnCount();
|
47601
|
+
let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
47602
|
+
let len = inputAry.length;
|
47523
47603
|
// Verify user input
|
47524
|
-
for(
|
47525
|
-
|
47604
|
+
for(let i = 0; i < len; ++i) {
|
47605
|
+
let colIndex = this.getColumnIndex(inputAry[i]);
|
47526
47606
|
if(colIndex >= 0 && colIndex < colCount) {
|
47527
47607
|
ary.push(colIndex); // WARNING: We have not checked for duplication
|
47528
47608
|
}
|
@@ -47597,11 +47677,11 @@ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
|
|
47597
47677
|
*/
|
47598
47678
|
Grid.prototype.pinColumn = function(colRef, side) {
|
47599
47679
|
if(Array.isArray(colRef)) {
|
47600
|
-
|
47601
|
-
|
47680
|
+
let ary = colRef;
|
47681
|
+
let len = ary.length;
|
47602
47682
|
|
47603
|
-
|
47604
|
-
for(
|
47683
|
+
let dirty = 0;
|
47684
|
+
for(let i = 0; i < len; ++i) {
|
47605
47685
|
dirty |= this._pinColumn(ary[i], side);
|
47606
47686
|
}
|
47607
47687
|
return dirty ? true : false;
|
@@ -47614,18 +47694,18 @@ Grid.prototype.pinColumn = function(colRef, side) {
|
|
47614
47694
|
* @return {boolean}
|
47615
47695
|
*/
|
47616
47696
|
Grid.prototype._pinColumn = function(colRef, side) {
|
47617
|
-
|
47618
|
-
|
47697
|
+
let colIndex = this.getColumnIndex(colRef);
|
47698
|
+
let colCount = this.getColumnCount();
|
47619
47699
|
if(colIndex < 0 || colIndex > colCount) {
|
47620
47700
|
return false;
|
47621
47701
|
}
|
47622
47702
|
|
47623
|
-
|
47624
|
-
|
47625
|
-
|
47703
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47704
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47705
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
47626
47706
|
|
47627
47707
|
if(side && side.toLowerCase() === "right") {
|
47628
|
-
|
47708
|
+
let rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
|
47629
47709
|
if(colIndex >= rightPinnedIndex) {
|
47630
47710
|
return false; // The column is already pinned area
|
47631
47711
|
}
|
@@ -47664,11 +47744,11 @@ Grid.prototype._pinColumn = function(colRef, side) {
|
|
47664
47744
|
*/
|
47665
47745
|
Grid.prototype.unpinColumn = function(colRef, dest) {
|
47666
47746
|
if(Array.isArray(colRef)) {
|
47667
|
-
|
47668
|
-
|
47747
|
+
let ary = colRef;
|
47748
|
+
let len = ary.length;
|
47669
47749
|
|
47670
|
-
|
47671
|
-
for(
|
47750
|
+
let dirty = 0;
|
47751
|
+
for(let i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
|
47672
47752
|
dirty |= this._unpinColumn(ary[i], dest);
|
47673
47753
|
}
|
47674
47754
|
return dirty ? true : false;
|
@@ -47681,29 +47761,29 @@ Grid.prototype.unpinColumn = function(colRef, dest) {
|
|
47681
47761
|
* @return {boolean}
|
47682
47762
|
*/
|
47683
47763
|
Grid.prototype._unpinColumn = function(colRef, dest) {
|
47684
|
-
|
47764
|
+
let colIndex = this.getColumnIndex(colRef);
|
47685
47765
|
if(colIndex < 0) {
|
47686
47766
|
return false;
|
47687
47767
|
}
|
47688
47768
|
|
47689
|
-
|
47690
|
-
|
47691
|
-
|
47692
|
-
|
47769
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47770
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47771
|
+
let colCount = this.getColumnCount();
|
47772
|
+
let firstRightPinnedIndex = colCount - rightPinnedCount;
|
47693
47773
|
|
47694
47774
|
if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
|
47695
47775
|
return false;
|
47696
47776
|
}
|
47697
47777
|
|
47698
|
-
|
47699
|
-
|
47778
|
+
let srcId = null;
|
47779
|
+
let destId = null;
|
47700
47780
|
if(dest != null) {
|
47701
|
-
|
47781
|
+
let destIdx = this.getColumnIndex(dest);
|
47702
47782
|
destId = this.getColumnId(destIdx);
|
47703
47783
|
srcId = this.getColumnId(colIndex);
|
47704
47784
|
}
|
47705
47785
|
|
47706
|
-
|
47786
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
47707
47787
|
|
47708
47788
|
if(colIndex < leftPinnedCount) {
|
47709
47789
|
if(colIndex > stationaryIdx) {
|
@@ -47732,8 +47812,8 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
|
|
47732
47812
|
* @return {boolean}
|
47733
47813
|
*/
|
47734
47814
|
Grid.prototype.unpinAllColumns = function() {
|
47735
|
-
|
47736
|
-
|
47815
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47816
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47737
47817
|
if(!leftPinnedCount && !rightPinnedCount) {
|
47738
47818
|
return false;
|
47739
47819
|
}
|
@@ -47749,8 +47829,8 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
|
|
47749
47829
|
return; // WARNING: Assume that only the first title section is owned by the grid. Anything else is assumed to be generated by plugins
|
47750
47830
|
}
|
47751
47831
|
|
47752
|
-
|
47753
|
-
|
47832
|
+
let c = e["fromColIndex"];
|
47833
|
+
let toC = e["toColIndex"];
|
47754
47834
|
while(c < toC) {
|
47755
47835
|
this._renderColumnHeader(c++, e);
|
47756
47836
|
}
|
@@ -47760,22 +47840,22 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
|
|
47760
47840
|
* @param {Object} arg
|
47761
47841
|
*/
|
47762
47842
|
Grid.prototype._renderColumnHeader = function(colIndex, arg) {
|
47763
|
-
|
47843
|
+
let colDef = this.getColumnDefinition(colIndex);
|
47764
47844
|
if(!colDef) {
|
47765
47845
|
return;
|
47766
47846
|
}
|
47767
|
-
|
47768
|
-
|
47769
|
-
|
47847
|
+
let customRenderer = colDef.getHeaderRenderer();
|
47848
|
+
let tSection = arg.section;
|
47849
|
+
let rowCount = tSection.getRowCount();
|
47770
47850
|
arg["colIndex"] = colIndex;
|
47771
47851
|
arg["columnDef"] = colDef;
|
47772
47852
|
|
47773
|
-
|
47774
|
-
|
47775
|
-
|
47853
|
+
let colName = colDef.getName();
|
47854
|
+
let colTooltip = colDef.getTooltip();
|
47855
|
+
let headerAlignment = colDef.getHeaderAlignment();
|
47776
47856
|
|
47777
|
-
for(
|
47778
|
-
|
47857
|
+
for(let r = 0; r < rowCount; ++r) {
|
47858
|
+
let tCell = tSection.getCell(colIndex, r, false);
|
47779
47859
|
// Default behaviors
|
47780
47860
|
tCell.setContent(colName);
|
47781
47861
|
tCell.setTooltip(colTooltip);
|
@@ -47794,7 +47874,7 @@ Grid.prototype.updateColumnTitle = function() {
|
|
47794
47874
|
if(this._columnTitleConflator.conflate()) {
|
47795
47875
|
return;
|
47796
47876
|
}
|
47797
|
-
|
47877
|
+
let tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
|
47798
47878
|
if(tss) {
|
47799
47879
|
tss.rerender();
|
47800
47880
|
}
|
@@ -47840,17 +47920,17 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
|
|
47840
47920
|
* @param {!Object} e
|
47841
47921
|
*/
|
47842
47922
|
Grid.prototype._onDataChanged = function(e) {
|
47843
|
-
|
47923
|
+
let rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
|
47844
47924
|
if (!rowData) {
|
47845
47925
|
return; // This must be a global change
|
47846
47926
|
}
|
47847
|
-
|
47927
|
+
let rowDef = rowData[ROW_DEF];
|
47848
47928
|
|
47849
47929
|
if(rowDef) {
|
47850
|
-
|
47930
|
+
let rowId = rowDef.getRowId();
|
47851
47931
|
if(rowId) {
|
47852
47932
|
// e["rid"] could be from JET/RTK (rowId + ric) or static data update (rowId)
|
47853
|
-
|
47933
|
+
let curRowData = this._dc.getRowData(e["rid"]);
|
47854
47934
|
if (curRowData) {
|
47855
47935
|
if(rowDef.addUpdate(e)) { // This is the only place that update array can grow. It is used for blinking data.
|
47856
47936
|
this._dt._hasNewUpdates = true; // Mark data table for cleaning it up later
|
@@ -47865,9 +47945,9 @@ Grid.prototype._onDataChanged = function(e) {
|
|
47865
47945
|
}
|
47866
47946
|
|
47867
47947
|
// The new data update has no row definition, meaning that we have found a new constituent from a chain.
|
47868
|
-
|
47948
|
+
let subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
|
47869
47949
|
if(subId) {
|
47870
|
-
|
47950
|
+
let parentDef = this._getRowDefinitionById(subId);
|
47871
47951
|
if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
|
47872
47952
|
if(!this._chainMembers) {
|
47873
47953
|
this._chainMembers = {};
|
@@ -47887,21 +47967,21 @@ Grid.prototype._addMemberOfChain = function(rowData) {
|
|
47887
47967
|
return;
|
47888
47968
|
}
|
47889
47969
|
|
47890
|
-
|
47891
|
-
|
47892
|
-
|
47970
|
+
let rows = this._chainConflator.popAllData(); // This must have no duplication
|
47971
|
+
let len = rows ? rows.length : 0;
|
47972
|
+
let i;
|
47893
47973
|
|
47894
|
-
|
47974
|
+
let prevState = false;
|
47895
47975
|
if(len > 1) {
|
47896
47976
|
prevState = this._dt.freeze(); // Avoid sorting for each insertion
|
47897
47977
|
}
|
47898
|
-
|
47978
|
+
let childDefs = [];
|
47899
47979
|
for(i = 0; i < len; ++i) {
|
47900
47980
|
rowData = /** @type{!Object} */(rows[i]);
|
47901
|
-
|
47902
|
-
|
47981
|
+
let subId = rowData[SUB_ID];
|
47982
|
+
let parentDef = this._getRowDefinitionById(subId);
|
47903
47983
|
if(parentDef) {
|
47904
|
-
|
47984
|
+
let childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
|
47905
47985
|
if(childDef) {
|
47906
47986
|
childDefs.push(childDef);
|
47907
47987
|
} // else { // childDef has already been added
|
@@ -47909,7 +47989,7 @@ Grid.prototype._addMemberOfChain = function(rowData) {
|
|
47909
47989
|
}
|
47910
47990
|
this._chainMembers = null; // Clear all waiting chain members
|
47911
47991
|
|
47912
|
-
|
47992
|
+
let childCount = childDefs.length;
|
47913
47993
|
if(childCount) {
|
47914
47994
|
for(i = childCount; --i >= 0;) {
|
47915
47995
|
this._connector.addRic(childDefs[i]); // TODO: JET/RTK should not re-subscribe this
|
@@ -47937,19 +48017,19 @@ Grid.prototype._updateStreamingData = function() {
|
|
47937
48017
|
* @param {Object} e
|
47938
48018
|
*/
|
47939
48019
|
Grid.prototype._onPreDataSorting = function (e) {
|
47940
|
-
|
48020
|
+
let objs = this._stp.getSortedColumns();
|
47941
48021
|
|
47942
48022
|
this._sorter.reset();
|
47943
48023
|
if(Array.isArray(objs)) {
|
47944
|
-
|
47945
|
-
for(
|
47946
|
-
|
47947
|
-
|
47948
|
-
|
47949
|
-
|
47950
|
-
|
47951
|
-
|
47952
|
-
|
48024
|
+
let sortCount = objs.length;
|
48025
|
+
for(let i = 0; i < sortCount; ++i) {
|
48026
|
+
let obj = objs[i];
|
48027
|
+
let field = obj["field"] || "";
|
48028
|
+
let colIndex = obj["colIndex"];
|
48029
|
+
let colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
48030
|
+
|
48031
|
+
let rowSorting = false;
|
48032
|
+
let sortLogic = null;
|
47953
48033
|
if(colDef) {
|
47954
48034
|
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
47955
48035
|
rowSorting = colDef.isRowSorting();
|
@@ -47995,10 +48075,10 @@ Grid.prototype._clearDataUpdates = function() {
|
|
47995
48075
|
if(!this._dt || !this._dt._hasNewUpdates) {
|
47996
48076
|
return;
|
47997
48077
|
}
|
47998
|
-
|
47999
|
-
for(
|
48000
|
-
|
48001
|
-
|
48078
|
+
let rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
|
48079
|
+
for(let i = rowIds.length; --i >= 0;) {
|
48080
|
+
let rowData = this._dt.getRowData(rowIds[i]);
|
48081
|
+
let rowDef = rowData[ROW_DEF];
|
48002
48082
|
rowDef.resetUpdates();
|
48003
48083
|
}
|
48004
48084
|
};
|
@@ -48046,7 +48126,7 @@ Grid.prototype.getPageCount = function() {
|
|
48046
48126
|
* @param {Grid~RowReference} rowRef
|
48047
48127
|
*/
|
48048
48128
|
Grid.prototype.toggleChain = function(rowRef) {
|
48049
|
-
|
48129
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48050
48130
|
if(rowDef) {
|
48051
48131
|
rowDef.toggleChain();
|
48052
48132
|
}
|
@@ -48058,7 +48138,7 @@ Grid.prototype.toggleChain = function(rowRef) {
|
|
48058
48138
|
* @return {boolean}
|
48059
48139
|
*/
|
48060
48140
|
Grid.prototype.setClassification = function(rowRef, fields) {
|
48061
|
-
|
48141
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48062
48142
|
if(rowDef) {
|
48063
48143
|
return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
|
48064
48144
|
}
|
@@ -48083,7 +48163,7 @@ Grid.prototype.contains = function(elem) {
|
|
48083
48163
|
* @return {boolean}
|
48084
48164
|
*/
|
48085
48165
|
Grid.prototype.isFocused = function() {
|
48086
|
-
|
48166
|
+
let activeElement = document.activeElement;
|
48087
48167
|
if(!activeElement || !activeElement.shadowRoot) {
|
48088
48168
|
// active element is not in the shadow DOM. try using contains method to check
|
48089
48169
|
return this.contains(activeElement);
|
@@ -48150,17 +48230,17 @@ Grid.prototype._onFormulaDataRequired = function(e) {
|
|
48150
48230
|
* @param {Object} e
|
48151
48231
|
*/
|
48152
48232
|
Grid.prototype._onDataComposed = function(e) {
|
48153
|
-
|
48233
|
+
let values = e["changes"];
|
48154
48234
|
if(!values) {
|
48155
48235
|
return; // Cannot do data composition if there is no change in data
|
48156
48236
|
}
|
48157
48237
|
|
48158
|
-
|
48238
|
+
let rowData = e["rowData"];
|
48159
48239
|
if(!rowData) {
|
48160
48240
|
return; // Row could already be removed or global change event is sent
|
48161
48241
|
}
|
48162
48242
|
|
48163
|
-
|
48243
|
+
let rowDef = rowData[ROW_DEF];
|
48164
48244
|
if(!rowDef) {
|
48165
48245
|
return;
|
48166
48246
|
}
|
@@ -48169,7 +48249,7 @@ Grid.prototype._onDataComposed = function(e) {
|
|
48169
48249
|
}
|
48170
48250
|
|
48171
48251
|
if(this._autoDateConversion) { // auto data conversion
|
48172
|
-
|
48252
|
+
let field, value, dataType, colDef;
|
48173
48253
|
for(field in values) {
|
48174
48254
|
colDef = this._getColumnDefinition(field);
|
48175
48255
|
if(colDef) {
|
@@ -48199,16 +48279,16 @@ Grid.prototype._onDataComposed = function(e) {
|
|
48199
48279
|
* @param {Object} e
|
48200
48280
|
*/
|
48201
48281
|
Grid.prototype._onSubSegmentChanged = function(e) {
|
48202
|
-
|
48203
|
-
|
48204
|
-
|
48282
|
+
let insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
|
48283
|
+
let removalList = /** @type{Array.<string>} */(e["removalList"]);
|
48284
|
+
let removedRows = /** @type{Object} */(e["removedRows"]);
|
48205
48285
|
|
48206
|
-
|
48207
|
-
|
48208
|
-
|
48286
|
+
let i;
|
48287
|
+
let removalCount = removalList.length;
|
48288
|
+
let rowDef = null;
|
48209
48289
|
for(i = 0; i < removalCount; i++) {
|
48210
|
-
|
48211
|
-
|
48290
|
+
let rid = removalList[i];
|
48291
|
+
let removedRow = removedRows[rid];
|
48212
48292
|
if(removedRow) {
|
48213
48293
|
rowDef = removedRow[ROW_DEF];
|
48214
48294
|
if(rowDef) {
|
@@ -48218,11 +48298,11 @@ Grid.prototype._onSubSegmentChanged = function(e) {
|
|
48218
48298
|
}
|
48219
48299
|
}
|
48220
48300
|
|
48221
|
-
|
48301
|
+
let insertionCount = insertionList.length;
|
48222
48302
|
for(i = 0; i < insertionCount; i++) {
|
48223
|
-
|
48224
|
-
//
|
48225
|
-
|
48303
|
+
let segment = insertionList[i];
|
48304
|
+
// let parentId = segment.getParentId();
|
48305
|
+
let segmentId = segment.getId();
|
48226
48306
|
rowDef = new RowDefinition({
|
48227
48307
|
"segmentId": segmentId
|
48228
48308
|
});
|
@@ -48242,10 +48322,10 @@ Grid.prototype._recalculateFormulas = function(e) {
|
|
48242
48322
|
if(e && e["rid"]) {
|
48243
48323
|
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
48244
48324
|
} else {
|
48245
|
-
|
48325
|
+
let rows = this._dc ? this._dc.getAllRowData() : null; // Slow
|
48246
48326
|
|
48247
|
-
|
48248
|
-
for(
|
48327
|
+
let rowCount = rows ? rows.length : 0;
|
48328
|
+
for(let r = 0; r < rowCount; ++r) { // WARNING: This is very slow
|
48249
48329
|
this._fnEngine.calculate(rows[r]);
|
48250
48330
|
}
|
48251
48331
|
}
|
@@ -48257,11 +48337,11 @@ Grid.prototype._recalculateFormulas = function(e) {
|
|
48257
48337
|
Grid.prototype._snapshotFillerDataChanged = function (e) {
|
48258
48338
|
if (!this._dt) return;
|
48259
48339
|
|
48260
|
-
|
48340
|
+
let data = e.data;
|
48261
48341
|
if(e.timeSeries) {
|
48262
48342
|
this._updateTimeSeriesFields(e); // Increase or decrease time series field
|
48263
48343
|
} else {
|
48264
|
-
for (
|
48344
|
+
for (let ric in data) {
|
48265
48345
|
this.setRicData(ric, data[ric]);
|
48266
48346
|
}
|
48267
48347
|
}
|
@@ -48276,7 +48356,7 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
48276
48356
|
Grid.prototype._startPolling = function () {
|
48277
48357
|
if(this._pollingEnabled && this._pollingInterval) {
|
48278
48358
|
if(this._lastPollingRequest && !this._pollingTimerId) {
|
48279
|
-
|
48359
|
+
let now = new Date();
|
48280
48360
|
this._lastPollingRequest = now.getTime();
|
48281
48361
|
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
48282
48362
|
}
|
@@ -48298,9 +48378,9 @@ Grid.prototype.activateADCPolling = function (activated) {
|
|
48298
48378
|
if(activated !== false) {
|
48299
48379
|
this._pollingEnabled = true;
|
48300
48380
|
// Make immediate request after re-activation if it has been a long time
|
48301
|
-
|
48381
|
+
let now = new Date();
|
48302
48382
|
if(this._lastPollingRequest) {
|
48303
|
-
|
48383
|
+
let diff = now.getTime() - this._lastPollingRequest;
|
48304
48384
|
if(diff > this._pollingInterval) {
|
48305
48385
|
this.refreshADCData();
|
48306
48386
|
}
|
@@ -48315,7 +48395,7 @@ Grid.prototype.activateADCPolling = function (activated) {
|
|
48315
48395
|
* @return {boolean} Return true, if a request has been made
|
48316
48396
|
*/
|
48317
48397
|
Grid.prototype.refreshADCData = function () {
|
48318
|
-
|
48398
|
+
let dirty = this._snapshot.addFields(this._connector.getAllFields());
|
48319
48399
|
if(dirty) {
|
48320
48400
|
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
48321
48401
|
if(dirty) {
|
@@ -48329,9 +48409,9 @@ Grid.prototype.refreshADCData = function () {
|
|
48329
48409
|
/** @private
|
48330
48410
|
*/
|
48331
48411
|
Grid.prototype._onAutoLayoutUpdate = function() {
|
48332
|
-
|
48412
|
+
let elem = this._topNode;
|
48333
48413
|
|
48334
|
-
|
48414
|
+
let cw = elem.clientWidth;
|
48335
48415
|
if(cw !== this._clientWidth) {
|
48336
48416
|
this._clientWidth = cw;
|
48337
48417
|
this.updateLayout();
|
@@ -48343,7 +48423,7 @@ Grid.prototype._onAutoLayoutUpdate = function() {
|
|
48343
48423
|
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
48344
48424
|
*/
|
48345
48425
|
Grid.prototype.logDT = function(opt_options) {
|
48346
|
-
|
48426
|
+
let rowDefs = this._getAllRowDefinitions();
|
48347
48427
|
this._logData(rowDefs, opt_options);
|
48348
48428
|
};
|
48349
48429
|
/** @description Log DataView to console. By default, this will log only fields specified in the column definition. To see other column data use "colNames" options
|
@@ -48361,7 +48441,7 @@ Grid.prototype.logDT = function(opt_options) {
|
|
48361
48441
|
grid.logDV({"rowCount": 10}); // Showing 10 records
|
48362
48442
|
*/
|
48363
48443
|
Grid.prototype.logDV = function(opt_options) {
|
48364
|
-
|
48444
|
+
let rowDefs = this.getRowDefinitions();
|
48365
48445
|
this._logData(rowDefs, opt_options);
|
48366
48446
|
};
|
48367
48447
|
/** Log the collection of data to console
|
@@ -48377,7 +48457,7 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
48377
48457
|
// TODO: Get all required fields and eliminate duplicate fields
|
48378
48458
|
options["colNames"] = this.getColumnFields();
|
48379
48459
|
}
|
48380
|
-
|
48460
|
+
let tbl = DataCache_DataCache.constructTable(rowDefs.map(toRowData), options);
|
48381
48461
|
|
48382
48462
|
console.table(tbl); // eslint-disable-line
|
48383
48463
|
};
|
@@ -48389,17 +48469,17 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
48389
48469
|
* @returns {RowDefinition}
|
48390
48470
|
*/
|
48391
48471
|
Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
48392
|
-
|
48393
|
-
|
48472
|
+
let rowId = this._getRowId(rowRef);
|
48473
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48394
48474
|
if(rowDef.isAutoGenerated()) { // Users cannot replace auto-generated
|
48395
48475
|
return null;
|
48396
48476
|
}
|
48397
|
-
|
48477
|
+
let configObj = rowDef.getConfigObject();
|
48398
48478
|
|
48399
48479
|
if(deepEqual(configObj, rowOption)){
|
48400
48480
|
return null;
|
48401
48481
|
} else {
|
48402
|
-
|
48482
|
+
let insertedRow = this.insertRow(rowOption, rowId);
|
48403
48483
|
this.removeRow(rowId);
|
48404
48484
|
return insertedRow;
|
48405
48485
|
}
|