@refinitiv-ui/efx-grid 6.0.87 → 6.0.88
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/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +779 -702
- 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 +385 -376
- 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 -2
- package/lib/rt-grid/es6/RowDefinition.js +103 -74
- package/lib/rt-grid/es6/SnapshotFiller.js +77 -77
- package/lib/rt-grid/es6/StyleLoader.js +1 -1
- package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +18 -18
- package/lib/tr-grid-percent-bar/es6/PercentBar.js +4 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +28 -16
- 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/versions.json +5 -5
- 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
|
@@ -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
|
@@ -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
|
@@ -45074,7 +45142,7 @@ Grid.prototype.initSubscription = function() {
|
|
45074
45142
|
return;
|
45075
45143
|
}
|
45076
45144
|
|
45077
|
-
|
45145
|
+
let jet, q, s;
|
45078
45146
|
jet = window["JET"]; // Assume that JET is already exist.
|
45079
45147
|
if (this._RTK) {
|
45080
45148
|
q = this._RTK.Quotes;
|
@@ -45098,10 +45166,10 @@ Grid.prototype.initSubscription = function() {
|
|
45098
45166
|
|
45099
45167
|
// TODO: Subscriptions should be registered per row.
|
45100
45168
|
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
45101
|
-
|
45102
|
-
|
45103
|
-
for(
|
45104
|
-
|
45169
|
+
let rowDefs = this._getAllRowDefinitions();
|
45170
|
+
let len = rowDefs.length;
|
45171
|
+
for(let i = 0; i < len; ++i) {
|
45172
|
+
let rowDef = rowDefs[i];
|
45105
45173
|
if(rowDef) {
|
45106
45174
|
rowDef.subscribeForUpdates();
|
45107
45175
|
}
|
@@ -45120,7 +45188,7 @@ Grid.prototype.updateLayout = function() {
|
|
45120
45188
|
*/
|
45121
45189
|
Grid.prototype._updateRowData = function(rowIndex) {
|
45122
45190
|
if(rowIndex >= 0) {
|
45123
|
-
|
45191
|
+
let rowId = this._dv.getRowId(rowIndex);
|
45124
45192
|
if(rowId) {
|
45125
45193
|
this._dt.setRowData(rowId, {});
|
45126
45194
|
}
|
@@ -45137,7 +45205,7 @@ Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
|
45137
45205
|
/** @private
|
45138
45206
|
*/
|
45139
45207
|
Grid.prototype._addGridSections = function () {
|
45140
|
-
|
45208
|
+
let title = this._grid.addSection("title");
|
45141
45209
|
if(this._topSection == false){
|
45142
45210
|
title.setRowCount(0);
|
45143
45211
|
} else {
|
@@ -45145,10 +45213,10 @@ Grid.prototype._addGridSections = function () {
|
|
45145
45213
|
}
|
45146
45214
|
this._grid.addSection("content");
|
45147
45215
|
|
45148
|
-
|
45216
|
+
let titleSettings = this._grid.getSectionSettings("title");
|
45149
45217
|
titleSettings.disableDataBinding();
|
45150
45218
|
|
45151
|
-
|
45219
|
+
let contentSettings = this._grid.getSectionSettings("content");
|
45152
45220
|
contentSettings.setAutoSyncRowCount(true);
|
45153
45221
|
contentSettings.setParent(titleSettings);
|
45154
45222
|
};
|
@@ -45157,13 +45225,13 @@ Grid.prototype._addGridSections = function () {
|
|
45157
45225
|
* @return {*} Return Section instance
|
45158
45226
|
*/
|
45159
45227
|
Grid.prototype.addHeaderSection = function (sectionName) {
|
45160
|
-
|
45228
|
+
let titleSects = this._grid.getAllSections("title");
|
45161
45229
|
|
45162
|
-
|
45230
|
+
let headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
|
45163
45231
|
if(headerSect) {
|
45164
45232
|
headerSect.setRowCount(1);
|
45165
45233
|
|
45166
|
-
|
45234
|
+
let headerSettings = this._grid.getSectionSettings(headerSect);
|
45167
45235
|
headerSettings.disableDataBinding();
|
45168
45236
|
}
|
45169
45237
|
|
@@ -45174,11 +45242,11 @@ Grid.prototype.addHeaderSection = function (sectionName) {
|
|
45174
45242
|
* @return {*} Return Section instance
|
45175
45243
|
*/
|
45176
45244
|
Grid.prototype.addFooterSection = function (sectionName) {
|
45177
|
-
|
45245
|
+
let footerSect = this._grid.addSection("footer", sectionName);
|
45178
45246
|
if(footerSect) {
|
45179
45247
|
footerSect.setRowCount(1);
|
45180
45248
|
|
45181
|
-
|
45249
|
+
let footerSettings = this._grid.getSectionSettings(footerSect);
|
45182
45250
|
footerSettings.disableDataBinding();
|
45183
45251
|
}
|
45184
45252
|
|
@@ -45197,7 +45265,7 @@ Grid.prototype.setParent = function (elem) {
|
|
45197
45265
|
*/
|
45198
45266
|
Grid.prototype.insertBefore = function (elem) {
|
45199
45267
|
if(elem) {
|
45200
|
-
|
45268
|
+
let pn = elem.parentNode;
|
45201
45269
|
if(pn) {
|
45202
45270
|
pn.insertBefore(this._topNode, elem);
|
45203
45271
|
this.updateLayout();
|
@@ -45233,15 +45301,15 @@ Grid.prototype.getCoreGrid = function () {
|
|
45233
45301
|
Grid.prototype.initialize = function(gridOption) {
|
45234
45302
|
if (!gridOption) { return; }
|
45235
45303
|
// TODO: clear all data before re-initialization
|
45236
|
-
|
45304
|
+
let t = this; // For minimizing file size
|
45237
45305
|
t._initializing = true;
|
45238
|
-
|
45306
|
+
let grid = t._grid; // core grid
|
45239
45307
|
grid.resetInternalState();
|
45240
45308
|
gridOption = grid.normalizeConfig(gridOption);
|
45241
45309
|
|
45242
|
-
|
45310
|
+
let exts = gridOption["plugins"] || gridOption["extensions"];
|
45243
45311
|
|
45244
|
-
|
45312
|
+
let cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
|
45245
45313
|
if (gridOption["defaultColumnOptions"]) {
|
45246
45314
|
t._defaultColumnOptions = gridOption["defaultColumnOptions"];
|
45247
45315
|
t._defaultColumnSetup(t._defaultColumnOptions, cols);
|
@@ -45291,23 +45359,23 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45291
45359
|
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
45292
45360
|
}
|
45293
45361
|
|
45294
|
-
|
45362
|
+
let borders = gridOption["borders"];
|
45295
45363
|
if (borders != null) {
|
45296
45364
|
grid.toggleBorders(borders);
|
45297
45365
|
}
|
45298
|
-
|
45366
|
+
let gridlines = gridOption["gridlines"];
|
45299
45367
|
if (gridlines != null) {
|
45300
45368
|
grid.toggleGridlines(gridlines);
|
45301
45369
|
}
|
45302
|
-
|
45370
|
+
let vLines = gridOption["verticalLines"];
|
45303
45371
|
if (vLines != null) {
|
45304
45372
|
grid.toggleVerticalLines(vLines);
|
45305
45373
|
}
|
45306
|
-
|
45374
|
+
let cvLines = gridOption["contentVerticalLines"];
|
45307
45375
|
if (cvLines != null) {
|
45308
45376
|
grid.toggleContentVerticalLines(cvLines);
|
45309
45377
|
}
|
45310
|
-
|
45378
|
+
let hLines = gridOption["horizontalLines"];
|
45311
45379
|
if (hLines != null) {
|
45312
45380
|
grid.toggleHorizontalLines(hLines);
|
45313
45381
|
}
|
@@ -45316,28 +45384,28 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45316
45384
|
t._dv.setPageSize(+gridOption["pageSize"]);
|
45317
45385
|
}
|
45318
45386
|
|
45319
|
-
|
45387
|
+
let rowHeight = +gridOption["rowHeight"];
|
45320
45388
|
if(rowHeight) { // Non empty or zero
|
45321
45389
|
grid.setDefaultRowHeight(rowHeight);
|
45322
45390
|
}
|
45323
|
-
|
45391
|
+
let hRowHeight = +gridOption["headerRowHeight"];
|
45324
45392
|
if(hRowHeight) { // Non empty or zero
|
45325
45393
|
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
45326
45394
|
}
|
45327
45395
|
|
45328
|
-
|
45396
|
+
let val = gridOption["autoLayoutUpdate"];
|
45329
45397
|
if(!t._autoLayoutTimer && val) {
|
45330
45398
|
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
45331
45399
|
t._autoLayoutTimer = setInterval(t._onAutoLayoutUpdate.bind(t), 2000);
|
45332
45400
|
}
|
45333
45401
|
}
|
45334
45402
|
|
45335
|
-
|
45403
|
+
let bool = gridOption["rowHighlighting"];
|
45336
45404
|
if(bool != null) {
|
45337
45405
|
grid.enableRowHighlighting(!!bool);
|
45338
45406
|
}
|
45339
45407
|
|
45340
|
-
|
45408
|
+
let rowExpansionBinding = gridOption["rowExpansionBinding"];
|
45341
45409
|
if(typeof rowExpansionBinding === "function") {
|
45342
45410
|
grid.listen("rowExpansionBinding", t._onRowExpansionBinding); // TODO: Support multi-table feature
|
45343
45411
|
t.listen("rowExpansionBinding", rowExpansionBinding);
|
@@ -45364,7 +45432,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45364
45432
|
if(gridOption["scrollbarParent"] != null) {
|
45365
45433
|
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
45366
45434
|
}
|
45367
|
-
|
45435
|
+
let pollingInterval = gridOption["adcPollingInterval"];
|
45368
45436
|
if(pollingInterval != null) {
|
45369
45437
|
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
45370
45438
|
}
|
@@ -45372,7 +45440,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45372
45440
|
// Column operations
|
45373
45441
|
t.setColumns(cols);
|
45374
45442
|
|
45375
|
-
|
45443
|
+
let rowVir = true;
|
45376
45444
|
if (gridOption["rowVirtualRendering"] != null) {
|
45377
45445
|
rowVir = gridOption["rowVirtualRendering"];
|
45378
45446
|
}
|
@@ -45381,7 +45449,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45381
45449
|
}
|
45382
45450
|
grid.enableRowVirtualization(!!rowVir);
|
45383
45451
|
|
45384
|
-
|
45452
|
+
let colVir = false;
|
45385
45453
|
if (gridOption["columnVirtualRendering"] != null) {
|
45386
45454
|
colVir = gridOption["columnVirtualRendering"];
|
45387
45455
|
}
|
@@ -45390,7 +45458,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45390
45458
|
}
|
45391
45459
|
grid.enableColumnVirtualization(!!colVir);
|
45392
45460
|
|
45393
|
-
|
45461
|
+
let scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
|
45394
45462
|
if (scrollbar) {
|
45395
45463
|
t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
|
45396
45464
|
} else {
|
@@ -45398,16 +45466,16 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45398
45466
|
t._topNode.style.overflow = "";
|
45399
45467
|
}
|
45400
45468
|
|
45401
|
-
|
45469
|
+
let topFreezingCount = gridOption["topFreezingCount"];
|
45402
45470
|
if (typeof topFreezingCount === "number") {
|
45403
45471
|
topFreezingCount = (topFreezingCount > 0) ? topFreezingCount : 0;
|
45404
|
-
|
45472
|
+
let sectionIndex = topFreezingCount - 1;
|
45405
45473
|
grid.freezeSection(sectionIndex);
|
45406
45474
|
} else if (topFreezingCount === false) {
|
45407
45475
|
grid.freezeSection(null);
|
45408
45476
|
}
|
45409
45477
|
|
45410
|
-
|
45478
|
+
let bottomFreezingCount = gridOption["bottomFreezingCount"];
|
45411
45479
|
if (typeof bottomFreezingCount === "number") {
|
45412
45480
|
bottomFreezingCount = (bottomFreezingCount > 0) ? bottomFreezingCount : 0;
|
45413
45481
|
grid.freezeFooter(bottomFreezingCount);
|
@@ -45418,11 +45486,11 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45418
45486
|
// Plugins
|
45419
45487
|
gridOption[ROW_DEF] = true; // Enable ROW_DEF mode
|
45420
45488
|
if (Array.isArray(exts)) {
|
45421
|
-
for (
|
45422
|
-
|
45423
|
-
|
45489
|
+
for (let i = 0; i < exts.length; ++i) {
|
45490
|
+
let ext = exts[i];
|
45491
|
+
let extInstance = null;
|
45424
45492
|
if (ext) {
|
45425
|
-
|
45493
|
+
let extName = ext["name"];
|
45426
45494
|
if(extName) {
|
45427
45495
|
extInstance = grid.loadPlugin(extName, ext); // pass plugin object as an argument for initialization
|
45428
45496
|
} else {
|
@@ -45430,7 +45498,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45430
45498
|
}
|
45431
45499
|
}
|
45432
45500
|
if (extInstance && extInstance["setGridWrapper"]) {
|
45433
|
-
|
45501
|
+
let hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
|
45434
45502
|
if(!hasApi) {
|
45435
45503
|
extInstance["setGridWrapper"]("realTimeGrid", t);
|
45436
45504
|
}
|
@@ -45439,7 +45507,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45439
45507
|
t._initializing = false;
|
45440
45508
|
}
|
45441
45509
|
|
45442
|
-
|
45510
|
+
let lang = gridOption["lang"];
|
45443
45511
|
if(lang != null) {
|
45444
45512
|
t._lang = lang;
|
45445
45513
|
t._dateTimeUtil.setLocale(lang);
|
@@ -45449,18 +45517,18 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45449
45517
|
if(gridOption["childDataField"] != null) {
|
45450
45518
|
this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
|
45451
45519
|
}
|
45452
|
-
|
45520
|
+
let rows = gridOption["rows"];
|
45453
45521
|
if(!rows) {
|
45454
45522
|
rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
|
45455
45523
|
}
|
45456
|
-
|
45524
|
+
let bodies = /** @type{Array} */(gridOption["bodies"]);
|
45457
45525
|
if(!bodies) {
|
45458
45526
|
bodies = [];
|
45459
45527
|
if(gridOption["body"]) {
|
45460
45528
|
bodies.push(gridOption["body"]);
|
45461
45529
|
}
|
45462
45530
|
if(rows) {
|
45463
|
-
for(
|
45531
|
+
for(let m = 0; m < rows.length; m++) {
|
45464
45532
|
if(typeof rows[m] === "string") {
|
45465
45533
|
rows[m] = { "ric": rows[m] };
|
45466
45534
|
}
|
@@ -45470,13 +45538,13 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45470
45538
|
}
|
45471
45539
|
|
45472
45540
|
// Merge rows with static data rows
|
45473
|
-
|
45541
|
+
let staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
|
45474
45542
|
if(rows && staticRows) {
|
45475
|
-
|
45476
|
-
|
45477
|
-
|
45478
|
-
|
45479
|
-
for(
|
45543
|
+
let ary = staticRows["data"] ? staticRows["data"] : staticRows;
|
45544
|
+
let fields = staticRows["fields"] || t.getColumnFields();
|
45545
|
+
let values, data;
|
45546
|
+
let len = rows.length;
|
45547
|
+
for(let n = 0; n < len; n++) {
|
45480
45548
|
if(rows[n]["values"]) { // merge row's values, values can be object or array
|
45481
45549
|
values = arrayToObject(rows[n]["values"], fields);
|
45482
45550
|
data = arrayToObject(ary[n], fields);
|
@@ -45493,7 +45561,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45493
45561
|
}
|
45494
45562
|
}
|
45495
45563
|
|
45496
|
-
for(
|
45564
|
+
for(let j = 0; j < bodies.length; ++j) {
|
45497
45565
|
t.insertRows(bodies[j]["rows"]);
|
45498
45566
|
// break; // TODO: The first version supports only 1 grid
|
45499
45567
|
}
|
@@ -45504,7 +45572,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45504
45572
|
grid.setBottomPaddingSection(gridOption.contentBottomPadding);
|
45505
45573
|
}
|
45506
45574
|
|
45507
|
-
|
45575
|
+
let contentRightPadding = gridOption.contentRightPadding;
|
45508
45576
|
if(contentRightPadding) {
|
45509
45577
|
if (typeof contentRightPadding !== "number") {
|
45510
45578
|
contentRightPadding = 6;
|
@@ -45515,13 +45583,13 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45515
45583
|
|
45516
45584
|
// Let everything init first
|
45517
45585
|
// then set conflationRate to grid for better perfomance on rapidly updating
|
45518
|
-
|
45586
|
+
let dataConflationRate = gridOption['dataConflationRate'];
|
45519
45587
|
if (dataConflationRate != null) {
|
45520
45588
|
grid.setDataConflationRate(dataConflationRate);
|
45521
45589
|
}
|
45522
45590
|
|
45523
45591
|
// Tell all plugins that the initialization phase has ended
|
45524
|
-
|
45592
|
+
let extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
|
45525
45593
|
t._processExtension(extObjects, "afterInit");
|
45526
45594
|
};
|
45527
45595
|
|
@@ -45530,14 +45598,14 @@ Grid.prototype.initialize = function(gridOption) {
|
|
45530
45598
|
* @return {!Object}
|
45531
45599
|
*/
|
45532
45600
|
Grid.prototype.getConfigObject = function (gridOptions) {
|
45533
|
-
|
45601
|
+
let obj = gridOptions || {};
|
45534
45602
|
|
45535
|
-
|
45603
|
+
let columns = obj.columns;
|
45536
45604
|
if(!columns) {
|
45537
45605
|
columns = obj.columns = [];
|
45538
45606
|
}
|
45539
45607
|
|
45540
|
-
|
45608
|
+
let grid = this._grid;
|
45541
45609
|
if(grid.getConfigObject) {
|
45542
45610
|
grid.getConfigObject(obj);
|
45543
45611
|
}
|
@@ -45564,17 +45632,17 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45564
45632
|
}
|
45565
45633
|
|
45566
45634
|
|
45567
|
-
|
45635
|
+
let i, len, prevTimeSeriesField;
|
45568
45636
|
len = this.getColumnCount();
|
45569
45637
|
for (i = 0; i < len; ++i) {
|
45570
|
-
|
45638
|
+
let column = columns[i];
|
45571
45639
|
if(!column) {
|
45572
45640
|
column = columns[i] = {};
|
45573
45641
|
}
|
45574
|
-
|
45642
|
+
let colDef = this.getColumnDefinition(i);
|
45575
45643
|
// TODO: Update width and scalability changed by the extensions
|
45576
45644
|
colDef.getConfigObject(column);
|
45577
|
-
|
45645
|
+
let parentField = js_FieldDefinition.getFieldProperty(colDef.getField(), "timeSeriesParent");
|
45578
45646
|
if(parentField && !prevTimeSeriesField) { // Assume first column of time series child to convert to time series parent
|
45579
45647
|
prevTimeSeriesField = parentField;
|
45580
45648
|
column.field = parentField;
|
@@ -45592,7 +45660,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45592
45660
|
obj["scrollbar"] = false;
|
45593
45661
|
}
|
45594
45662
|
|
45595
|
-
|
45663
|
+
let val = this._dv.getPageSize();
|
45596
45664
|
if(val > 0) {
|
45597
45665
|
obj["pageSize"] = val;
|
45598
45666
|
}
|
@@ -45645,9 +45713,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45645
45713
|
}
|
45646
45714
|
|
45647
45715
|
// get all rows config
|
45648
|
-
|
45649
|
-
|
45650
|
-
|
45716
|
+
let rowDefs = this.getAllRowDefinitions();
|
45717
|
+
let rows = obj["rows"] = [];
|
45718
|
+
let rowDef, rowConfig;
|
45651
45719
|
len = rowDefs.length;
|
45652
45720
|
for (i = 0; i < len; i++) {
|
45653
45721
|
rowDef = rowDefs[i];
|
@@ -45656,9 +45724,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45656
45724
|
}
|
45657
45725
|
|
45658
45726
|
// get row config from extensions
|
45659
|
-
|
45660
|
-
|
45661
|
-
for(
|
45727
|
+
let extensions = grid.getPlugins();
|
45728
|
+
let pluginInstance, row;
|
45729
|
+
for(let key in extensions) {
|
45662
45730
|
pluginInstance = extensions[key];
|
45663
45731
|
if(typeof pluginInstance["getRowConfigObject"] === "function") {
|
45664
45732
|
len = rows.length;
|
@@ -45710,11 +45778,11 @@ Grid.prototype.setLocale = function(lang) {
|
|
45710
45778
|
* @param {Array.<Object>} userColumns
|
45711
45779
|
*/
|
45712
45780
|
Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
45713
|
-
|
45714
|
-
for (
|
45715
|
-
|
45781
|
+
let c = userColumns.length;
|
45782
|
+
for (let i = 0; i < c; i++) {
|
45783
|
+
let column = userColumns[i];
|
45716
45784
|
if (typeof column === 'object') {
|
45717
|
-
for (
|
45785
|
+
for (let key in defaultCol) {
|
45718
45786
|
if (column[key] == null) {
|
45719
45787
|
column[key] = defaultCol[key];
|
45720
45788
|
}
|
@@ -45732,7 +45800,7 @@ Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
|
45732
45800
|
*/
|
45733
45801
|
Grid.prototype._processExtension = function (exts, field, params) {
|
45734
45802
|
if(Array.isArray(exts)) {
|
45735
|
-
for (
|
45803
|
+
for (let i = 0; i < exts.length; i++) {
|
45736
45804
|
if (exts[i][field]) {
|
45737
45805
|
exts[i][field].apply(exts[i], params);
|
45738
45806
|
}
|
@@ -45744,15 +45812,15 @@ Grid.prototype._processExtension = function (exts, field, params) {
|
|
45744
45812
|
* @param {Object} e
|
45745
45813
|
*/
|
45746
45814
|
Grid.prototype._onRicAdded = function(e) {
|
45747
|
-
|
45815
|
+
let addedRics = e.addedRics;
|
45748
45816
|
this._snapshot.addFields(e.fields);
|
45749
|
-
|
45750
|
-
for (
|
45751
|
-
|
45752
|
-
|
45753
|
-
|
45754
|
-
for (
|
45755
|
-
|
45817
|
+
let len = addedRics.length;
|
45818
|
+
for (let i = 0; i < len; ++i) {
|
45819
|
+
let ric = addedRics[i];
|
45820
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
45821
|
+
let jLen = rowDefs ? rowDefs.length : 0;
|
45822
|
+
for (let j = 0; j < jLen; ++j) {
|
45823
|
+
let rowDef = rowDefs[j];
|
45756
45824
|
if (rowDef.getSymbol() === ric) {
|
45757
45825
|
this._snapshot.addRic(ric); // ADC
|
45758
45826
|
}
|
@@ -45773,18 +45841,18 @@ Grid.prototype._onRicRemoved = function(e) {
|
|
45773
45841
|
* @param {Object} e
|
45774
45842
|
*/
|
45775
45843
|
Grid.prototype._onFieldAdded = function(e) {
|
45776
|
-
|
45777
|
-
|
45844
|
+
let rowDefs = e.rowDefs;
|
45845
|
+
let addedFields = e.addedFields;
|
45778
45846
|
|
45779
45847
|
// ADC
|
45780
|
-
for (
|
45848
|
+
for (let i in rowDefs) {
|
45781
45849
|
this._snapshot.addRic(rowDefs[i].getSymbol());
|
45782
45850
|
}
|
45783
45851
|
this._snapshot.addFields(addedFields);
|
45784
45852
|
|
45785
45853
|
// JET
|
45786
45854
|
if (this._subs) {
|
45787
|
-
|
45855
|
+
let realtimeFields = addedFields.filter(js_FieldDefinition.isRealTimeField);
|
45788
45856
|
if(realtimeFields.length > 0) {
|
45789
45857
|
this._subs["addFields"](realtimeFields);
|
45790
45858
|
}
|
@@ -45796,7 +45864,7 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
45796
45864
|
* @param {Object} e
|
45797
45865
|
*/
|
45798
45866
|
Grid.prototype._onFieldRemoved = function(e) {
|
45799
|
-
|
45867
|
+
let removedFields = e.removedFields;
|
45800
45868
|
|
45801
45869
|
// TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
|
45802
45870
|
// JET
|
@@ -45812,19 +45880,19 @@ Grid.prototype._onFieldRemoved = function(e) {
|
|
45812
45880
|
* @param {number=} idx
|
45813
45881
|
*/
|
45814
45882
|
Grid.prototype.insertColumn = function (columnOption, idx) {
|
45815
|
-
|
45883
|
+
let colCount = this.getColumnCount();
|
45816
45884
|
if(idx == null || idx > colCount) {
|
45817
45885
|
idx = colCount;
|
45818
45886
|
}
|
45819
45887
|
|
45820
45888
|
// no need to merge defaultColumn during initialize process
|
45821
45889
|
// because columnOption already mutate by initialize function
|
45822
|
-
|
45890
|
+
let configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
45823
45891
|
|
45824
45892
|
if (typeof columnOption === "string") {
|
45825
45893
|
configObj["field"] = columnOption;
|
45826
45894
|
} else { // columnOption is assumed to be an object
|
45827
|
-
for (
|
45895
|
+
for (let key in columnOption) {
|
45828
45896
|
configObj[key] = columnOption[key];
|
45829
45897
|
}
|
45830
45898
|
}
|
@@ -45833,7 +45901,7 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
45833
45901
|
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
45834
45902
|
}
|
45835
45903
|
|
45836
|
-
|
45904
|
+
let colDef = new ColumnDefinition(configObj, this);
|
45837
45905
|
configObj[COL_DEF] = colDef;
|
45838
45906
|
|
45839
45907
|
// WARNING: width is processed twice by tr-grid and rt-grid
|
@@ -45846,18 +45914,18 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
45846
45914
|
* @param {Object} e snapshort change event object
|
45847
45915
|
*/
|
45848
45916
|
Grid.prototype._updateTimeSeriesFields = function (e) {
|
45849
|
-
|
45850
|
-
|
45851
|
-
|
45852
|
-
for (
|
45917
|
+
let childField;
|
45918
|
+
let snapShotData = e.data;
|
45919
|
+
let childFields = {};
|
45920
|
+
for (let ric in snapShotData) {
|
45853
45921
|
// childFields = snapShotData[ric];
|
45854
45922
|
for (childField in snapShotData[ric]) {
|
45855
45923
|
childFields[childField] = true; // Merge child fields to parent (Don't truth each ric it will be have some empty data)
|
45856
45924
|
}
|
45857
45925
|
this.setRicData(ric, snapShotData[ric]); // update cell data if exist
|
45858
45926
|
}
|
45859
|
-
|
45860
|
-
|
45927
|
+
let parentField, field, colIndex, parentColDef, childColIndex;
|
45928
|
+
let parentMap = {}; // map parent time series field and their first child
|
45861
45929
|
for (field in childFields) { // Warning: data change can be differ time series child field
|
45862
45930
|
parentField = e.childrenFieldToParent[field];
|
45863
45931
|
if(!parentMap[parentField]) {
|
@@ -45868,10 +45936,10 @@ Grid.prototype._updateTimeSeriesFields = function (e) {
|
|
45868
45936
|
}
|
45869
45937
|
|
45870
45938
|
for (parentField in parentMap) { // WARNING: one dataChanged event can be multiple fields
|
45871
|
-
|
45939
|
+
let childrenField = parentMap[parentField];
|
45872
45940
|
colIndex = this.getColumnIndex(parentField);
|
45873
45941
|
parentColDef = this._getColumnDefinition(colIndex);
|
45874
|
-
|
45942
|
+
let i, len;
|
45875
45943
|
len = childrenField.length;
|
45876
45944
|
for (i = 0; i < len; i++) {
|
45877
45945
|
childField = childrenField[i];
|
@@ -45897,8 +45965,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45897
45965
|
return;
|
45898
45966
|
}
|
45899
45967
|
|
45900
|
-
|
45901
|
-
|
45968
|
+
let colDefs = this._timeSeriesChildConflator.popAllData();
|
45969
|
+
let i, j, len, childField, idx;
|
45902
45970
|
|
45903
45971
|
for (i = 0; i < colDefs.length; i++) {
|
45904
45972
|
colDef = colDefs[i];
|
@@ -45907,8 +45975,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45907
45975
|
if(!colDef) {
|
45908
45976
|
continue;
|
45909
45977
|
}
|
45910
|
-
|
45911
|
-
|
45978
|
+
let parentField = colDef.getField();
|
45979
|
+
let childFields = js_FieldDefinition.getTimeSeriesChildren(parentField);
|
45912
45980
|
if(!childFields) { // not found time series field
|
45913
45981
|
return;
|
45914
45982
|
}
|
@@ -45933,7 +46001,7 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
45933
46001
|
* @param {number} idx index of insertion column
|
45934
46002
|
*/
|
45935
46003
|
Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx) {
|
45936
|
-
|
46004
|
+
let parentConfig, columnOption;
|
45937
46005
|
parentConfig = parentColDef.getConfigObject();
|
45938
46006
|
columnOption = cloneObject(parentConfig);
|
45939
46007
|
columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
|
@@ -45950,15 +46018,15 @@ Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx)
|
|
45950
46018
|
* @param {Grid~ColumnReference} colRef
|
45951
46019
|
*/
|
45952
46020
|
Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
45953
|
-
|
46021
|
+
let colIndex = this.getColumnIndex(colRef);
|
45954
46022
|
if(colIndex < 0) {
|
45955
46023
|
return;
|
45956
46024
|
}
|
45957
|
-
|
45958
|
-
|
45959
|
-
|
46025
|
+
let colConfig = {};
|
46026
|
+
let core = this._grid;
|
46027
|
+
let columnDef = core._getColumnDef(colIndex);
|
45960
46028
|
|
45961
|
-
|
46029
|
+
let value = core.getColumnScalability(colIndex);
|
45962
46030
|
colConfig["scalable"] = value;
|
45963
46031
|
|
45964
46032
|
value = core.getColumnCustomLaneSize(colIndex);
|
@@ -45992,7 +46060,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
45992
46060
|
if(typeof columnOption === "string") {
|
45993
46061
|
colConfig["field"] = columnOption;
|
45994
46062
|
} else { // type object from user
|
45995
|
-
for (
|
46063
|
+
for (let key in columnOption) {
|
45996
46064
|
colConfig[key] = columnOption[key];
|
45997
46065
|
}
|
45998
46066
|
}
|
@@ -46005,7 +46073,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
46005
46073
|
colConfig["width"] = 1;
|
46006
46074
|
}
|
46007
46075
|
|
46008
|
-
|
46076
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46009
46077
|
if(colDef && colConfig.id == null) {
|
46010
46078
|
colConfig.id = colDef.getId(); // retain ID
|
46011
46079
|
}
|
@@ -46023,7 +46091,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
46023
46091
|
*/
|
46024
46092
|
Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
|
46025
46093
|
if (response && response.id) {
|
46026
|
-
|
46094
|
+
let fieldDef = response;
|
46027
46095
|
if (colDef && colDef.getField() === field) {
|
46028
46096
|
if (colDef.isDefaultName() && fieldDef.name) {
|
46029
46097
|
colDef.setName(fieldDef.name);
|
@@ -46049,7 +46117,7 @@ Grid.prototype._onFieldLoadedError = function (err) {
|
|
46049
46117
|
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
46050
46118
|
// For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
|
46051
46119
|
if(js_FieldDefinition.isTimeSeries(field)) {
|
46052
|
-
|
46120
|
+
let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
|
46053
46121
|
this._populateTimeSeriesChildren(colDef);
|
46054
46122
|
}
|
46055
46123
|
this._connector.addFields(field, referrer);
|
@@ -46086,14 +46154,14 @@ Grid.prototype.getFieldInfo = function(field) {
|
|
46086
46154
|
* @param {string} field
|
46087
46155
|
* @return {Promise}
|
46088
46156
|
* @example
|
46089
|
-
*
|
46157
|
+
* let gridConfig = {
|
46090
46158
|
* synapse: { // define synapse configuration
|
46091
46159
|
* apiKey: "xxx",
|
46092
46160
|
* contextApp: "xxx",
|
46093
46161
|
* auth: "xxx" (optional)
|
46094
46162
|
* }
|
46095
46163
|
* };
|
46096
|
-
*
|
46164
|
+
* let promise = grid.loadFieldInfo("CF_LAST");
|
46097
46165
|
*/
|
46098
46166
|
Grid.prototype.loadFieldInfo = function(field) {
|
46099
46167
|
return js_FieldDefinition.loadFieldInfo(field);
|
@@ -46106,7 +46174,7 @@ Grid.prototype.loadFieldInfo = function(field) {
|
|
46106
46174
|
*/
|
46107
46175
|
Grid.prototype._shouldLoadFieldInfo = function (field) {
|
46108
46176
|
|
46109
|
-
|
46177
|
+
let val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
|
46110
46178
|
if(!val) {
|
46111
46179
|
return false;
|
46112
46180
|
}
|
@@ -46133,17 +46201,17 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
|
|
46133
46201
|
* @param {Array.<Object>} columns Array of column options
|
46134
46202
|
*/
|
46135
46203
|
Grid.prototype.setColumns = function(columns) {
|
46136
|
-
|
46137
|
-
|
46204
|
+
let grid = this._grid;
|
46205
|
+
let colCount = (columns) ? columns.length : 0;
|
46138
46206
|
|
46139
46207
|
grid.startBatch("reset");
|
46140
46208
|
this.removeAllColumns();
|
46141
46209
|
if(colCount > 0) {
|
46142
|
-
|
46210
|
+
let prevState = false;
|
46143
46211
|
if(colCount > 1) {
|
46144
46212
|
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
46145
46213
|
}
|
46146
|
-
for(
|
46214
|
+
for(let i = 0; i < colCount; ++i) {
|
46147
46215
|
this.insertColumn(columns[i], i);
|
46148
46216
|
}
|
46149
46217
|
if(colCount > 1) {
|
@@ -46160,20 +46228,20 @@ Grid.prototype.setColumns = function(columns) {
|
|
46160
46228
|
* @param {boolean=} byId=false, if enable it, this method will only check for differences in the 'id' property
|
46161
46229
|
*/
|
46162
46230
|
Grid.prototype.restoreColumns = function(columns, byId) {
|
46163
|
-
|
46231
|
+
let grid = this._grid;
|
46164
46232
|
grid.startBatch("reset");
|
46165
|
-
|
46166
|
-
|
46233
|
+
let configObj = this.getConfigObject();
|
46234
|
+
let previousColumns = configObj.columns;
|
46167
46235
|
|
46168
|
-
|
46169
|
-
|
46236
|
+
let preColLen = previousColumns.length;
|
46237
|
+
let newColLen = columns.length;
|
46170
46238
|
|
46171
|
-
|
46172
|
-
|
46173
|
-
|
46174
|
-
|
46239
|
+
let compareLogic = byId ? _hasMatchingId : deepEqual;
|
46240
|
+
let removingFields = [];
|
46241
|
+
let keepingColumns = [];
|
46242
|
+
let columnOrdering = [];
|
46175
46243
|
|
46176
|
-
|
46244
|
+
let i, j, found;
|
46177
46245
|
// Slow, time complexity BigO(n ^ 2)
|
46178
46246
|
for (i = 0; i < preColLen; i++) {
|
46179
46247
|
found = false;
|
@@ -46191,8 +46259,8 @@ Grid.prototype.restoreColumns = function(columns, byId) {
|
|
46191
46259
|
|
46192
46260
|
this.removeColumns(removingFields);
|
46193
46261
|
|
46194
|
-
|
46195
|
-
|
46262
|
+
let keepingLen = keepingColumns.length;
|
46263
|
+
let prevState = false;
|
46196
46264
|
if(newColLen > 1) {
|
46197
46265
|
prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
46198
46266
|
}
|
@@ -46201,7 +46269,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
|
|
46201
46269
|
for (j = 0; j < keepingLen; j++) { // loop only keeping column
|
46202
46270
|
if(compareLogic(columns[i], keepingColumns[j])) {
|
46203
46271
|
found = true;
|
46204
|
-
|
46272
|
+
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
46273
|
columnOrdering.push(this.getColumnId(colIndex));
|
46206
46274
|
break;
|
46207
46275
|
}
|
@@ -46232,27 +46300,27 @@ Grid.prototype.setFields = Grid.prototype.setColumns;
|
|
46232
46300
|
* @param {Object} e
|
46233
46301
|
*/
|
46234
46302
|
Grid.prototype._onColumnAdded = function(e) {
|
46235
|
-
|
46303
|
+
let colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
|
46236
46304
|
delete e.context[COL_DEF];
|
46237
|
-
|
46305
|
+
let idx = e.colIndex;
|
46238
46306
|
|
46239
|
-
|
46307
|
+
let coreColDef = this._grid._getColumnDef(idx);
|
46240
46308
|
colDef._setCoreColumnDef(coreColDef); // For column id and field
|
46241
46309
|
|
46242
|
-
|
46310
|
+
let colData = this._grid.getColumnData(idx);
|
46243
46311
|
if(!colData) { // Save column inside grid
|
46244
46312
|
colData = this._grid.setColumnData(idx, {});
|
46245
46313
|
}
|
46246
46314
|
colData[COL_DEF] = colDef;
|
46247
|
-
|
46315
|
+
let userModel = colDef.getUserModel();
|
46248
46316
|
// binding
|
46249
46317
|
this._grid.setColumnDataBindingHandler(idx, colDef.getRenderer());
|
46250
46318
|
// width and scalable
|
46251
|
-
|
46319
|
+
let value = userModel["width"];
|
46252
46320
|
// eslint-disable-next-line no-undefined
|
46253
46321
|
if(value !== undefined) {
|
46254
46322
|
value = +value;
|
46255
|
-
|
46323
|
+
let scalable;
|
46256
46324
|
if(userModel["scalable"] != null) {
|
46257
46325
|
scalable = userModel["scalable"] ? true : false;
|
46258
46326
|
} else {
|
@@ -46288,16 +46356,16 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
46288
46356
|
}
|
46289
46357
|
|
46290
46358
|
// className
|
46291
|
-
|
46359
|
+
let i, classes = colDef.getClasses();
|
46292
46360
|
for(i = 0; i < classes.length; i++) {
|
46293
46361
|
this._grid.enableColumnClass(idx, classes[i]);
|
46294
46362
|
}
|
46295
|
-
|
46363
|
+
let colField = colDef.getField();
|
46296
46364
|
this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
|
46297
|
-
|
46298
|
-
|
46299
|
-
|
46300
|
-
|
46365
|
+
let fields = colDef.getAllFields();
|
46366
|
+
let referrer = colDef.getId();
|
46367
|
+
let len = fields.length;
|
46368
|
+
let field, dataType, prom, onLoaded;
|
46301
46369
|
for(i = 0; i < len; i++) {
|
46302
46370
|
field = fields[i];
|
46303
46371
|
if(this._shouldLoadFieldInfo(field)) {
|
@@ -46335,12 +46403,12 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
46335
46403
|
* @see {@link Grid#removeAllColumns}
|
46336
46404
|
*/
|
46337
46405
|
Grid.prototype.removeColumn = function(colRef) {
|
46338
|
-
|
46406
|
+
let colIndex = this.getColumnIndex(colRef);
|
46339
46407
|
if(colIndex < 0) {
|
46340
46408
|
return;
|
46341
46409
|
}
|
46342
46410
|
|
46343
|
-
|
46411
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46344
46412
|
|
46345
46413
|
if(!colDef.isRealTimeField()) {
|
46346
46414
|
if(this._dc) {
|
@@ -46361,8 +46429,8 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
46361
46429
|
* @see {@link Grid#removeAllColumns}
|
46362
46430
|
*/
|
46363
46431
|
Grid.prototype.removeColumns = function(colRefs) {
|
46364
|
-
|
46365
|
-
|
46432
|
+
let indices = this.getColumnIndices(colRefs);
|
46433
|
+
let len = indices.length;
|
46366
46434
|
if(len <= 1) {
|
46367
46435
|
if(len === 1) {
|
46368
46436
|
this.removeColumn(indices[0]);
|
@@ -46371,12 +46439,12 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
46371
46439
|
}
|
46372
46440
|
indices.sort(Grid._descendingOrder); // Removal must be done from the back
|
46373
46441
|
|
46374
|
-
|
46375
|
-
|
46442
|
+
let staticFields = []; // For clearing any data stored in our cache
|
46443
|
+
let prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
|
46376
46444
|
|
46377
|
-
for(
|
46378
|
-
|
46379
|
-
|
46445
|
+
for(let i = 0; i < len; ++i) {
|
46446
|
+
let colIndex = indices[i];
|
46447
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46380
46448
|
if(!colDef.isRealTimeField()) {
|
46381
46449
|
staticFields.push(colDef.getField());
|
46382
46450
|
}
|
@@ -46398,7 +46466,7 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
46398
46466
|
* @see {@link Grid#removeColumns}
|
46399
46467
|
*/
|
46400
46468
|
Grid.prototype.removeAllColumns = function() {
|
46401
|
-
|
46469
|
+
let colCount = this.getColumnCount();
|
46402
46470
|
if(colCount <= 0) {
|
46403
46471
|
return;
|
46404
46472
|
}
|
@@ -46406,10 +46474,10 @@ Grid.prototype.removeAllColumns = function() {
|
|
46406
46474
|
if(!this._sharedSorter) {
|
46407
46475
|
this.clearSort();
|
46408
46476
|
}
|
46409
|
-
for(
|
46477
|
+
for(let i = colCount; --i >= 0;) {
|
46410
46478
|
// WARNING: This may affect plugins event listeners
|
46411
46479
|
this._grid.setColumnDataBindingHandler(i, null);
|
46412
|
-
|
46480
|
+
let colDef = this.getColumnDefinition(i);
|
46413
46481
|
colDef.dispose();
|
46414
46482
|
}
|
46415
46483
|
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
@@ -46469,7 +46537,7 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
|
46469
46537
|
* @see {@link Grid#showAllColumns}
|
46470
46538
|
*/
|
46471
46539
|
Grid.prototype.hideColumn = function(colRef, hidden) {
|
46472
|
-
|
46540
|
+
let colIndex = this.getColumnIndex(colRef);
|
46473
46541
|
if(colIndex < 0) { // not found
|
46474
46542
|
return;
|
46475
46543
|
}
|
@@ -46514,9 +46582,9 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
|
|
46514
46582
|
return false;
|
46515
46583
|
}
|
46516
46584
|
|
46517
|
-
|
46518
|
-
|
46519
|
-
|
46585
|
+
let fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
|
46586
|
+
let len = fields.length;
|
46587
|
+
let i, field, dataType, prom, onLoaded;
|
46520
46588
|
for(i = 0; i < len; i++) {
|
46521
46589
|
field = fields[i];
|
46522
46590
|
if(this._shouldLoadFieldInfo(field)) {
|
@@ -46573,7 +46641,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
|
|
46573
46641
|
return;
|
46574
46642
|
}
|
46575
46643
|
|
46576
|
-
|
46644
|
+
let colIndex = this.getColumnIndex(colRef);
|
46577
46645
|
if(colIndex < 0) {
|
46578
46646
|
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
46579
46647
|
} else {
|
@@ -46585,7 +46653,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
|
|
46585
46653
|
* @param {string} str
|
46586
46654
|
*/
|
46587
46655
|
Grid.prototype.setColumnName = function(colIndex, str) {
|
46588
|
-
|
46656
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46589
46657
|
if(colDef) {
|
46590
46658
|
colDef.setName(str);
|
46591
46659
|
this.updateColumnTitle();
|
@@ -46596,7 +46664,7 @@ Grid.prototype.setColumnName = function(colIndex, str) {
|
|
46596
46664
|
* @param {Function=} func
|
46597
46665
|
*/
|
46598
46666
|
Grid.prototype.setColumnRenderer = function(colRef, func) {
|
46599
|
-
|
46667
|
+
let colIndex = this.getColumnIndex(colRef);
|
46600
46668
|
this.setColumnFormatter(colIndex, func);
|
46601
46669
|
};
|
46602
46670
|
|
@@ -46606,10 +46674,10 @@ Grid.prototype.setColumnRenderer = function(colRef, func) {
|
|
46606
46674
|
* @param {Function=} func If not specified the renderer which corresponded id from mapping will be picked up
|
46607
46675
|
*/
|
46608
46676
|
Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
46609
|
-
|
46677
|
+
let colIndex = this.getColumnIndex(colRef);
|
46610
46678
|
if (colIndex == null) { return; }
|
46611
46679
|
|
46612
|
-
|
46680
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46613
46681
|
if(!colDef) { return; }
|
46614
46682
|
|
46615
46683
|
colDef.activateRenderer(id, func);
|
@@ -46626,12 +46694,12 @@ Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
|
46626
46694
|
Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
46627
46695
|
if (colIndex == null) { return; }
|
46628
46696
|
|
46629
|
-
|
46697
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46630
46698
|
if(!colDef) {
|
46631
46699
|
return;
|
46632
46700
|
}
|
46633
46701
|
|
46634
|
-
|
46702
|
+
let func = null;
|
46635
46703
|
if (formatter) {
|
46636
46704
|
if(typeof formatter === "object") {
|
46637
46705
|
if(typeof formatter.init === "function") { // Initialize predefined formatter
|
@@ -46648,8 +46716,8 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
|
46648
46716
|
}
|
46649
46717
|
|
46650
46718
|
if(func !== colDef.getRenderer()) {
|
46651
|
-
|
46652
|
-
|
46719
|
+
let section = this._grid.getSection("content");
|
46720
|
+
let col = /** @type {Column} */section.getColumn(colIndex);
|
46653
46721
|
if (col) {
|
46654
46722
|
col.clearContent();
|
46655
46723
|
}
|
@@ -46668,12 +46736,12 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
|
46668
46736
|
* @param {ColumnDefinition~SortLogic=} func
|
46669
46737
|
*/
|
46670
46738
|
Grid.prototype.setColumnSorter = function(colRef, func) {
|
46671
|
-
|
46672
|
-
|
46739
|
+
let colIndex = this.getColumnIndex(colRef);
|
46740
|
+
let colDef = this.getColumnDefinition(colIndex);
|
46673
46741
|
if(colDef) {
|
46674
46742
|
colDef.setSorter(func);
|
46675
46743
|
|
46676
|
-
|
46744
|
+
let sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
46677
46745
|
if(sortedColumn === colIndex) {
|
46678
46746
|
this._stp.refresh();
|
46679
46747
|
}
|
@@ -46686,8 +46754,8 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
46686
46754
|
* @param {RowDefinition} rowDef
|
46687
46755
|
*/
|
46688
46756
|
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
46689
|
-
|
46690
|
-
|
46757
|
+
let ric = rowDef.getSymbol();
|
46758
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
46691
46759
|
if(rowDefs && rowDefs.length) {
|
46692
46760
|
cloneRowData(rowDefs[0], rowDef);
|
46693
46761
|
}
|
@@ -46697,7 +46765,7 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
|
|
46697
46765
|
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
46698
46766
|
* @returns {RowDefinition}
|
46699
46767
|
* @example
|
46700
|
-
*
|
46768
|
+
* let grid = new rt.Grid(grid_div, options);
|
46701
46769
|
* grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
|
46702
46770
|
*/
|
46703
46771
|
Grid.prototype.insertRow = function(rowOption, rowRef) {
|
@@ -46714,7 +46782,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
46714
46782
|
}
|
46715
46783
|
}
|
46716
46784
|
}
|
46717
|
-
|
46785
|
+
let rowDef = new RowDefinition(rowOption);
|
46718
46786
|
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
46719
46787
|
this._initDuplicateRicData(rowDef);
|
46720
46788
|
|
@@ -46730,7 +46798,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
46730
46798
|
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
46731
46799
|
* @param {Array.<string>=} opt_fields
|
46732
46800
|
* @example
|
46733
|
-
*
|
46801
|
+
* let grid = new rt.Grid(grid_div, options);
|
46734
46802
|
* grid.insertRows([
|
46735
46803
|
* {ric: "RIC"},
|
46736
46804
|
* {values: {"field1": 0, "field2": 1}},
|
@@ -46747,12 +46815,12 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
46747
46815
|
return;
|
46748
46816
|
}
|
46749
46817
|
|
46750
|
-
|
46751
|
-
|
46752
|
-
|
46753
|
-
|
46754
|
-
for(
|
46755
|
-
|
46818
|
+
let prevState = this._dt.freeze(); // Avoid sorting for each inserted row
|
46819
|
+
let fields = opt_fields || this.getColumnFields();
|
46820
|
+
let rowId = this._getRowId(rowRef);
|
46821
|
+
let len = rowOptions.length;
|
46822
|
+
for(let r = 0; r < len; ++r) {
|
46823
|
+
let rowOption = rowOptions[r];
|
46756
46824
|
if(rowOption) {
|
46757
46825
|
if(typeof rowOption === "string") {
|
46758
46826
|
rowOption = { "ric": rowOption };
|
@@ -46770,7 +46838,7 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
46770
46838
|
* @see {@link Grid#logDV}
|
46771
46839
|
* @see {@link Grid#logDT}
|
46772
46840
|
* @example
|
46773
|
-
*
|
46841
|
+
* let grid = new rt.Grid(grid_div, options);
|
46774
46842
|
* grid.addStaticDataRows([
|
46775
46843
|
* [10, "a", true],
|
46776
46844
|
* [20, "b", false],
|
@@ -46791,7 +46859,7 @@ Grid.prototype.addStaticDataRows = function(dataRows, fields) {
|
|
46791
46859
|
}
|
46792
46860
|
|
46793
46861
|
if(!Array.isArray(dataRows)) {
|
46794
|
-
|
46862
|
+
let userObj = dataRows;
|
46795
46863
|
dataRows = null;
|
46796
46864
|
if(userObj) {
|
46797
46865
|
if(userObj.fields && !fields) {
|
@@ -46855,13 +46923,15 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46855
46923
|
}
|
46856
46924
|
|
46857
46925
|
// Map new data index
|
46858
|
-
|
46859
|
-
|
46860
|
-
|
46861
|
-
|
46862
|
-
|
46863
|
-
|
46926
|
+
let recordCount = records.length;
|
46927
|
+
let fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
|
46928
|
+
let oldDataMap = {};
|
46929
|
+
let rowDef, id, record, i;
|
46930
|
+
let rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
|
46931
|
+
let rowDefCount = rowDefs.length;
|
46932
|
+
let prevState = false;
|
46864
46933
|
if(rowIdentifier) {
|
46934
|
+
prevState = this._dt.freeze();
|
46865
46935
|
for (i = 0; i < rowDefCount; i++) {
|
46866
46936
|
rowDef = rowDefs[i];
|
46867
46937
|
if(rowDef) {
|
@@ -46874,8 +46944,8 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46874
46944
|
}
|
46875
46945
|
}
|
46876
46946
|
|
46877
|
-
|
46878
|
-
|
46947
|
+
let idMap = {};
|
46948
|
+
let newDataMap = {};
|
46879
46949
|
for (i = recordCount - 1; i >= 0; i--) {
|
46880
46950
|
record = records[i];
|
46881
46951
|
id = record[rowIdentifier];
|
@@ -46893,13 +46963,17 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46893
46963
|
}
|
46894
46964
|
}
|
46895
46965
|
// Check Remove previous data
|
46896
|
-
for (
|
46966
|
+
for (let rowIdentifierName in oldDataMap) {
|
46897
46967
|
if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
|
46898
46968
|
this.removeRow(oldDataMap[rowIdentifierName]); // Slow
|
46899
46969
|
}
|
46900
46970
|
}
|
46901
46971
|
this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
|
46972
|
+
this._dt.freeze(prevState);
|
46902
46973
|
} else {
|
46974
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
46975
|
+
prevState = this._dt.freeze();
|
46976
|
+
}
|
46903
46977
|
for (i = 0; i < rowDefCount; i++) {
|
46904
46978
|
record = records[i];
|
46905
46979
|
if(record) {
|
@@ -46918,6 +46992,9 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
|
46918
46992
|
rowDef.setRowData(record);
|
46919
46993
|
}
|
46920
46994
|
}
|
46995
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
46996
|
+
this._dt.freeze(prevState);
|
46997
|
+
}
|
46921
46998
|
}
|
46922
46999
|
};
|
46923
47000
|
/** @private
|
@@ -46937,7 +47014,7 @@ Grid.prototype.removeRow = function(rowRef) {
|
|
46937
47014
|
if(this._mainGrid) {
|
46938
47015
|
return this._mainGrid.removeRow(this._getRowId(rowRef));
|
46939
47016
|
}
|
46940
|
-
|
47017
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
46941
47018
|
if(rowDef) {
|
46942
47019
|
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
46943
47020
|
this._removeRow(rowDef);
|
@@ -46953,7 +47030,7 @@ Grid.prototype.removeRow = function(rowRef) {
|
|
46953
47030
|
* @see {@link Grid#removeAllRows}
|
46954
47031
|
*/
|
46955
47032
|
Grid.prototype.removeRows = function(rowRefs) {
|
46956
|
-
|
47033
|
+
let rowDef;
|
46957
47034
|
if(!Array.isArray(rowRefs)) {
|
46958
47035
|
rowDef = this.removeRow(rowRefs);
|
46959
47036
|
return rowDef ? [rowDef] : [];
|
@@ -46962,9 +47039,9 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
46962
47039
|
return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
|
46963
47040
|
}
|
46964
47041
|
|
46965
|
-
|
46966
|
-
|
46967
|
-
|
47042
|
+
let i;
|
47043
|
+
let rowDefs = [];
|
47044
|
+
let len = rowRefs.length;
|
46968
47045
|
|
46969
47046
|
// Verify user input
|
46970
47047
|
for(i = 0; i < len; ++i) {
|
@@ -46977,7 +47054,7 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
46977
47054
|
}
|
46978
47055
|
len = rowDefs.length;
|
46979
47056
|
|
46980
|
-
|
47057
|
+
let prevState = false;
|
46981
47058
|
if(len > 1) {
|
46982
47059
|
prevState = this._dt.freeze(); // Prevent multiple changes that trigger sorting and filtering
|
46983
47060
|
}
|
@@ -47002,7 +47079,7 @@ Grid.prototype.removeAllRows = function() {
|
|
47002
47079
|
if(!this._dt.getRowCount()) {
|
47003
47080
|
return;
|
47004
47081
|
}
|
47005
|
-
|
47082
|
+
let rowDefs = this._getAllRowDefinitions();
|
47006
47083
|
|
47007
47084
|
if(!this._sharedDataSource) {
|
47008
47085
|
this._dc.clearAllData();
|
@@ -47030,14 +47107,14 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
47030
47107
|
}
|
47031
47108
|
this._dispatch("beforeRowRemoved", {});
|
47032
47109
|
|
47033
|
-
|
47034
|
-
|
47035
|
-
|
47110
|
+
let connector = this._connector;
|
47111
|
+
let dt = this._dt;
|
47112
|
+
let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
|
47036
47113
|
if(childRowDefs) { // Remove all children first
|
47037
|
-
for(
|
47114
|
+
for(let i = 0; i < childRowDefs.length; i++) {
|
47038
47115
|
connector.removeRic(childRowDefs[i]);
|
47039
47116
|
}
|
47040
|
-
|
47117
|
+
let rowIds = childRowDefs.map(RowDefinition.toRowId);
|
47041
47118
|
dt.removeRows(rowIds);
|
47042
47119
|
}
|
47043
47120
|
connector.removeRic(rowDef);
|
@@ -47050,8 +47127,8 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
47050
47127
|
* @param {boolean=} hidden if false, show instead of hide
|
47051
47128
|
*/
|
47052
47129
|
Grid.prototype.hideRow = function(rowRef, hidden) {
|
47053
|
-
|
47054
|
-
|
47130
|
+
let rid = this._getRowId(rowRef);
|
47131
|
+
let grid = this._mainGrid || this._grid;
|
47055
47132
|
grid.hideRow(rid, hidden);
|
47056
47133
|
};
|
47057
47134
|
|
@@ -47064,8 +47141,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
|
|
47064
47141
|
if (!Array.isArray(rowRefs)) {
|
47065
47142
|
rowRefs = [rowRefs];
|
47066
47143
|
}
|
47067
|
-
|
47068
|
-
|
47144
|
+
let rids = rowRefs.map(this._getRowId);
|
47145
|
+
let grid = this._mainGrid || this._grid;
|
47069
47146
|
grid.hideRows(rids, hidden);
|
47070
47147
|
};
|
47071
47148
|
/**
|
@@ -47103,19 +47180,19 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
47103
47180
|
this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
47104
47181
|
return;
|
47105
47182
|
}
|
47106
|
-
|
47183
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47107
47184
|
if(rowDef) {
|
47108
47185
|
options = options || {};
|
47109
47186
|
options["ric"] = str;
|
47110
|
-
|
47111
|
-
|
47187
|
+
let extractedOptions = RowDefinition.extractRowOptions(options);
|
47188
|
+
let oldRic = rowDef.getSymbol();
|
47112
47189
|
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
47113
47190
|
this._connector.removeRic(rowDef, oldRic);
|
47114
47191
|
this._initDuplicateRicData(rowDef);
|
47115
47192
|
this._connector.addRic(rowDef);
|
47116
47193
|
}
|
47117
47194
|
|
47118
|
-
|
47195
|
+
let values = options["values"];
|
47119
47196
|
if(values != null) {
|
47120
47197
|
rowDef.setStaticRowData(values, options["fields"]);
|
47121
47198
|
}
|
@@ -47131,7 +47208,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
47131
47208
|
* @param {Grid~RowReference} rowRef
|
47132
47209
|
*/
|
47133
47210
|
Grid.prototype.unlinkChain = function(rowRef) {
|
47134
|
-
|
47211
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47135
47212
|
if(!rowDef) {
|
47136
47213
|
return;
|
47137
47214
|
}
|
@@ -47170,7 +47247,7 @@ Grid.prototype._onRowExpansionBinding = function(e) {
|
|
47170
47247
|
}
|
47171
47248
|
|
47172
47249
|
if(e["originalRowId"]) {
|
47173
|
-
|
47250
|
+
let rowIndex = this._dv.getRowIndex(e["originalRowId"]);
|
47174
47251
|
e["originalRowDef"] = this._getRowDefinitionByIndex(rowIndex);
|
47175
47252
|
e["originalRowData"] = e["originalRowDef"].getRowData();
|
47176
47253
|
} else {
|
@@ -47224,7 +47301,7 @@ Grid.prototype.getColumnCount = function() {
|
|
47224
47301
|
* @return {string}
|
47225
47302
|
*/
|
47226
47303
|
Grid.prototype.getColumnDataType = function(colIndex) {
|
47227
|
-
|
47304
|
+
let colDef = this.getColumnDefinition(colIndex);
|
47228
47305
|
if (colDef) {
|
47229
47306
|
return colDef.getDataType();
|
47230
47307
|
}
|
@@ -47235,7 +47312,7 @@ Grid.prototype.getColumnDataType = function(colIndex) {
|
|
47235
47312
|
* @return {ColumnDefinition}
|
47236
47313
|
*/
|
47237
47314
|
Grid.prototype.getColumnDefinition = function(colIndex) {
|
47238
|
-
|
47315
|
+
let colData = this._grid.getColumnData(colIndex);
|
47239
47316
|
if(colData) {
|
47240
47317
|
return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
|
47241
47318
|
}
|
@@ -47245,9 +47322,9 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
|
|
47245
47322
|
* @return {!Array.<ColumnDefinition>}
|
47246
47323
|
*/
|
47247
47324
|
Grid.prototype.getColumnDefinitions = function() {
|
47248
|
-
|
47249
|
-
|
47250
|
-
for(
|
47325
|
+
let colCount = this.getColumnCount();
|
47326
|
+
let colDefs = new Array(colCount);
|
47327
|
+
for(let i = 0; i < colCount; i++) {
|
47251
47328
|
colDefs[i] = this.getColumnDefinition(i);
|
47252
47329
|
}
|
47253
47330
|
return colDefs;
|
@@ -47269,10 +47346,10 @@ Grid.prototype.getColumnDefinitionById = function(colId) {
|
|
47269
47346
|
* @return {ColumnDefinition}
|
47270
47347
|
*/
|
47271
47348
|
Grid.prototype.getColumnDefinitionsById = function(colIds) {
|
47272
|
-
|
47349
|
+
let colCount = Array.isArray(colIds) ? colIds.length : 0;
|
47273
47350
|
if(colCount > 0) {
|
47274
|
-
|
47275
|
-
|
47351
|
+
let i, colId;
|
47352
|
+
let colDefs = new Array(colCount);
|
47276
47353
|
for(i = 0; i < colCount; i++) {
|
47277
47354
|
colId = colIds[i];
|
47278
47355
|
colDefs[i] = this.getColumnDefinitionById(colId);
|
@@ -47292,9 +47369,9 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
47292
47369
|
} else if(typeof colRef === "number") {
|
47293
47370
|
return this.getColumnDefinition(colRef);
|
47294
47371
|
} else if(typeof colRef === "string") {
|
47295
|
-
|
47296
|
-
for(
|
47297
|
-
|
47372
|
+
let colCount = this.getColumnCount();
|
47373
|
+
for(let i = 0; i < colCount; ++i) {
|
47374
|
+
let colDef = this.getColumnDefinition(i);
|
47298
47375
|
if(_hasFieldOrId(colDef, colRef)) {
|
47299
47376
|
return colDef; // Return the first found column
|
47300
47377
|
}
|
@@ -47307,7 +47384,7 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
47307
47384
|
* @return {string}
|
47308
47385
|
*/
|
47309
47386
|
Grid.prototype.getRowType = function(rowRef) {
|
47310
|
-
|
47387
|
+
let rowDef = this.getRowDefinition(rowRef);
|
47311
47388
|
return rowDef ? rowDef.getType() : "";
|
47312
47389
|
};
|
47313
47390
|
/** Get RowDefinition object by either number or row id
|
@@ -47399,15 +47476,15 @@ Grid.prototype.getMultipleRowData = function(obj) {
|
|
47399
47476
|
if(typeof obj === "number") {
|
47400
47477
|
return [this.getRowData(obj)];
|
47401
47478
|
}
|
47402
|
-
|
47479
|
+
let rowDefs = null;
|
47403
47480
|
if(Array.isArray(obj)) {
|
47404
|
-
|
47405
|
-
|
47406
|
-
|
47481
|
+
let rowRefs = obj;
|
47482
|
+
let rowCount = rowRefs.length;
|
47483
|
+
let rows = new Array(rowCount);
|
47407
47484
|
rowDefs = this.getRowDefinitions();
|
47408
47485
|
|
47409
|
-
for(
|
47410
|
-
|
47486
|
+
for(let r = 0; r < rowCount; ++r) {
|
47487
|
+
let rowRef = rowRefs[r];
|
47411
47488
|
if(typeof rowRef === "number") {
|
47412
47489
|
rows[r] = toRowData(rowDefs[rowRef]);
|
47413
47490
|
} else if(rowRef && rowRef.getRowData) {
|
@@ -47430,10 +47507,10 @@ Grid.prototype.getMultipleRowData = function(obj) {
|
|
47430
47507
|
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
47431
47508
|
*/
|
47432
47509
|
Grid.prototype.setRicData = function(ric, values) {
|
47433
|
-
|
47434
|
-
|
47435
|
-
for (
|
47436
|
-
|
47510
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
47511
|
+
let rowCount = rowDefs ? rowDefs.length : 0;
|
47512
|
+
for (let i = 0; i < rowCount; ++i) {
|
47513
|
+
let rowDef = rowDefs[i];
|
47437
47514
|
if (rowDef && rowDef.getSymbol() === ric) {
|
47438
47515
|
rowDef.setRowData(values); // TODO: Need conflator to improve performance
|
47439
47516
|
}
|
@@ -47445,7 +47522,7 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
47445
47522
|
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
47446
47523
|
*/
|
47447
47524
|
Grid.prototype.setRowData = function(rowRef, values) {
|
47448
|
-
|
47525
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47449
47526
|
if(rowDef) {
|
47450
47527
|
rowDef.setRowData(values);
|
47451
47528
|
}
|
@@ -47457,7 +47534,7 @@ Grid.prototype.setRowData = function(rowRef, values) {
|
|
47457
47534
|
* @param {Object} values
|
47458
47535
|
*/
|
47459
47536
|
Grid.prototype.setStaticRowData = function(rowRef, values) {
|
47460
|
-
|
47537
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47461
47538
|
if(rowDef) {
|
47462
47539
|
rowDef.setStaticRowData(values);
|
47463
47540
|
}
|
@@ -47470,7 +47547,7 @@ Grid.prototype.setStaticRowData = function(rowRef, values) {
|
|
47470
47547
|
* @param {*} value
|
47471
47548
|
*/
|
47472
47549
|
Grid.prototype.setStaticData = function(rowRef, field, value) {
|
47473
|
-
|
47550
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
47474
47551
|
if(rowDef) {
|
47475
47552
|
rowDef.setStaticData(field, value);
|
47476
47553
|
}
|
@@ -47498,9 +47575,9 @@ Grid.prototype._getRowId = function(rowRef) {
|
|
47498
47575
|
Grid.prototype.getColumnIndex = function(colRef) {
|
47499
47576
|
if(colRef) {
|
47500
47577
|
if(colRef instanceof ColumnDefinition) {
|
47501
|
-
|
47502
|
-
for(
|
47503
|
-
|
47578
|
+
let colCount = this.getColumnCount();
|
47579
|
+
for(let i = 0; i < colCount; ++i) {
|
47580
|
+
let colDef = this.getColumnDefinition(i);
|
47504
47581
|
if(colDef === colRef) {
|
47505
47582
|
return i;
|
47506
47583
|
}
|
@@ -47516,13 +47593,13 @@ Grid.prototype.getColumnIndex = function(colRef) {
|
|
47516
47593
|
* @return {!Array.<number>}
|
47517
47594
|
*/
|
47518
47595
|
Grid.prototype.getColumnIndices = function(colRefs) {
|
47519
|
-
|
47520
|
-
|
47521
|
-
|
47522
|
-
|
47596
|
+
let ary = [];
|
47597
|
+
let colCount = this.getColumnCount();
|
47598
|
+
let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
47599
|
+
let len = inputAry.length;
|
47523
47600
|
// Verify user input
|
47524
|
-
for(
|
47525
|
-
|
47601
|
+
for(let i = 0; i < len; ++i) {
|
47602
|
+
let colIndex = this.getColumnIndex(inputAry[i]);
|
47526
47603
|
if(colIndex >= 0 && colIndex < colCount) {
|
47527
47604
|
ary.push(colIndex); // WARNING: We have not checked for duplication
|
47528
47605
|
}
|
@@ -47597,11 +47674,11 @@ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
|
|
47597
47674
|
*/
|
47598
47675
|
Grid.prototype.pinColumn = function(colRef, side) {
|
47599
47676
|
if(Array.isArray(colRef)) {
|
47600
|
-
|
47601
|
-
|
47677
|
+
let ary = colRef;
|
47678
|
+
let len = ary.length;
|
47602
47679
|
|
47603
|
-
|
47604
|
-
for(
|
47680
|
+
let dirty = 0;
|
47681
|
+
for(let i = 0; i < len; ++i) {
|
47605
47682
|
dirty |= this._pinColumn(ary[i], side);
|
47606
47683
|
}
|
47607
47684
|
return dirty ? true : false;
|
@@ -47614,18 +47691,18 @@ Grid.prototype.pinColumn = function(colRef, side) {
|
|
47614
47691
|
* @return {boolean}
|
47615
47692
|
*/
|
47616
47693
|
Grid.prototype._pinColumn = function(colRef, side) {
|
47617
|
-
|
47618
|
-
|
47694
|
+
let colIndex = this.getColumnIndex(colRef);
|
47695
|
+
let colCount = this.getColumnCount();
|
47619
47696
|
if(colIndex < 0 || colIndex > colCount) {
|
47620
47697
|
return false;
|
47621
47698
|
}
|
47622
47699
|
|
47623
|
-
|
47624
|
-
|
47625
|
-
|
47700
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47701
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47702
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
47626
47703
|
|
47627
47704
|
if(side && side.toLowerCase() === "right") {
|
47628
|
-
|
47705
|
+
let rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
|
47629
47706
|
if(colIndex >= rightPinnedIndex) {
|
47630
47707
|
return false; // The column is already pinned area
|
47631
47708
|
}
|
@@ -47664,11 +47741,11 @@ Grid.prototype._pinColumn = function(colRef, side) {
|
|
47664
47741
|
*/
|
47665
47742
|
Grid.prototype.unpinColumn = function(colRef, dest) {
|
47666
47743
|
if(Array.isArray(colRef)) {
|
47667
|
-
|
47668
|
-
|
47744
|
+
let ary = colRef;
|
47745
|
+
let len = ary.length;
|
47669
47746
|
|
47670
|
-
|
47671
|
-
for(
|
47747
|
+
let dirty = 0;
|
47748
|
+
for(let i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
|
47672
47749
|
dirty |= this._unpinColumn(ary[i], dest);
|
47673
47750
|
}
|
47674
47751
|
return dirty ? true : false;
|
@@ -47681,29 +47758,29 @@ Grid.prototype.unpinColumn = function(colRef, dest) {
|
|
47681
47758
|
* @return {boolean}
|
47682
47759
|
*/
|
47683
47760
|
Grid.prototype._unpinColumn = function(colRef, dest) {
|
47684
|
-
|
47761
|
+
let colIndex = this.getColumnIndex(colRef);
|
47685
47762
|
if(colIndex < 0) {
|
47686
47763
|
return false;
|
47687
47764
|
}
|
47688
47765
|
|
47689
|
-
|
47690
|
-
|
47691
|
-
|
47692
|
-
|
47766
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47767
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47768
|
+
let colCount = this.getColumnCount();
|
47769
|
+
let firstRightPinnedIndex = colCount - rightPinnedCount;
|
47693
47770
|
|
47694
47771
|
if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
|
47695
47772
|
return false;
|
47696
47773
|
}
|
47697
47774
|
|
47698
|
-
|
47699
|
-
|
47775
|
+
let srcId = null;
|
47776
|
+
let destId = null;
|
47700
47777
|
if(dest != null) {
|
47701
|
-
|
47778
|
+
let destIdx = this.getColumnIndex(dest);
|
47702
47779
|
destId = this.getColumnId(destIdx);
|
47703
47780
|
srcId = this.getColumnId(colIndex);
|
47704
47781
|
}
|
47705
47782
|
|
47706
|
-
|
47783
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
47707
47784
|
|
47708
47785
|
if(colIndex < leftPinnedCount) {
|
47709
47786
|
if(colIndex > stationaryIdx) {
|
@@ -47732,8 +47809,8 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
|
|
47732
47809
|
* @return {boolean}
|
47733
47810
|
*/
|
47734
47811
|
Grid.prototype.unpinAllColumns = function() {
|
47735
|
-
|
47736
|
-
|
47812
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
47813
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
47737
47814
|
if(!leftPinnedCount && !rightPinnedCount) {
|
47738
47815
|
return false;
|
47739
47816
|
}
|
@@ -47749,8 +47826,8 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
|
|
47749
47826
|
return; // WARNING: Assume that only the first title section is owned by the grid. Anything else is assumed to be generated by plugins
|
47750
47827
|
}
|
47751
47828
|
|
47752
|
-
|
47753
|
-
|
47829
|
+
let c = e["fromColIndex"];
|
47830
|
+
let toC = e["toColIndex"];
|
47754
47831
|
while(c < toC) {
|
47755
47832
|
this._renderColumnHeader(c++, e);
|
47756
47833
|
}
|
@@ -47760,22 +47837,22 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
|
|
47760
47837
|
* @param {Object} arg
|
47761
47838
|
*/
|
47762
47839
|
Grid.prototype._renderColumnHeader = function(colIndex, arg) {
|
47763
|
-
|
47840
|
+
let colDef = this.getColumnDefinition(colIndex);
|
47764
47841
|
if(!colDef) {
|
47765
47842
|
return;
|
47766
47843
|
}
|
47767
|
-
|
47768
|
-
|
47769
|
-
|
47844
|
+
let customRenderer = colDef.getHeaderRenderer();
|
47845
|
+
let tSection = arg.section;
|
47846
|
+
let rowCount = tSection.getRowCount();
|
47770
47847
|
arg["colIndex"] = colIndex;
|
47771
47848
|
arg["columnDef"] = colDef;
|
47772
47849
|
|
47773
|
-
|
47774
|
-
|
47775
|
-
|
47850
|
+
let colName = colDef.getName();
|
47851
|
+
let colTooltip = colDef.getTooltip();
|
47852
|
+
let headerAlignment = colDef.getHeaderAlignment();
|
47776
47853
|
|
47777
|
-
for(
|
47778
|
-
|
47854
|
+
for(let r = 0; r < rowCount; ++r) {
|
47855
|
+
let tCell = tSection.getCell(colIndex, r, false);
|
47779
47856
|
// Default behaviors
|
47780
47857
|
tCell.setContent(colName);
|
47781
47858
|
tCell.setTooltip(colTooltip);
|
@@ -47794,7 +47871,7 @@ Grid.prototype.updateColumnTitle = function() {
|
|
47794
47871
|
if(this._columnTitleConflator.conflate()) {
|
47795
47872
|
return;
|
47796
47873
|
}
|
47797
|
-
|
47874
|
+
let tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
|
47798
47875
|
if(tss) {
|
47799
47876
|
tss.rerender();
|
47800
47877
|
}
|
@@ -47840,17 +47917,17 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
|
|
47840
47917
|
* @param {!Object} e
|
47841
47918
|
*/
|
47842
47919
|
Grid.prototype._onDataChanged = function(e) {
|
47843
|
-
|
47920
|
+
let rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
|
47844
47921
|
if (!rowData) {
|
47845
47922
|
return; // This must be a global change
|
47846
47923
|
}
|
47847
|
-
|
47924
|
+
let rowDef = rowData[ROW_DEF];
|
47848
47925
|
|
47849
47926
|
if(rowDef) {
|
47850
|
-
|
47927
|
+
let rowId = rowDef.getRowId();
|
47851
47928
|
if(rowId) {
|
47852
47929
|
// e["rid"] could be from JET/RTK (rowId + ric) or static data update (rowId)
|
47853
|
-
|
47930
|
+
let curRowData = this._dc.getRowData(e["rid"]);
|
47854
47931
|
if (curRowData) {
|
47855
47932
|
if(rowDef.addUpdate(e)) { // This is the only place that update array can grow. It is used for blinking data.
|
47856
47933
|
this._dt._hasNewUpdates = true; // Mark data table for cleaning it up later
|
@@ -47865,9 +47942,9 @@ Grid.prototype._onDataChanged = function(e) {
|
|
47865
47942
|
}
|
47866
47943
|
|
47867
47944
|
// The new data update has no row definition, meaning that we have found a new constituent from a chain.
|
47868
|
-
|
47945
|
+
let subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
|
47869
47946
|
if(subId) {
|
47870
|
-
|
47947
|
+
let parentDef = this._getRowDefinitionById(subId);
|
47871
47948
|
if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
|
47872
47949
|
if(!this._chainMembers) {
|
47873
47950
|
this._chainMembers = {};
|
@@ -47887,21 +47964,21 @@ Grid.prototype._addMemberOfChain = function(rowData) {
|
|
47887
47964
|
return;
|
47888
47965
|
}
|
47889
47966
|
|
47890
|
-
|
47891
|
-
|
47892
|
-
|
47967
|
+
let rows = this._chainConflator.popAllData(); // This must have no duplication
|
47968
|
+
let len = rows ? rows.length : 0;
|
47969
|
+
let i;
|
47893
47970
|
|
47894
|
-
|
47971
|
+
let prevState = false;
|
47895
47972
|
if(len > 1) {
|
47896
47973
|
prevState = this._dt.freeze(); // Avoid sorting for each insertion
|
47897
47974
|
}
|
47898
|
-
|
47975
|
+
let childDefs = [];
|
47899
47976
|
for(i = 0; i < len; ++i) {
|
47900
47977
|
rowData = /** @type{!Object} */(rows[i]);
|
47901
|
-
|
47902
|
-
|
47978
|
+
let subId = rowData[SUB_ID];
|
47979
|
+
let parentDef = this._getRowDefinitionById(subId);
|
47903
47980
|
if(parentDef) {
|
47904
|
-
|
47981
|
+
let childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
|
47905
47982
|
if(childDef) {
|
47906
47983
|
childDefs.push(childDef);
|
47907
47984
|
} // else { // childDef has already been added
|
@@ -47909,7 +47986,7 @@ Grid.prototype._addMemberOfChain = function(rowData) {
|
|
47909
47986
|
}
|
47910
47987
|
this._chainMembers = null; // Clear all waiting chain members
|
47911
47988
|
|
47912
|
-
|
47989
|
+
let childCount = childDefs.length;
|
47913
47990
|
if(childCount) {
|
47914
47991
|
for(i = childCount; --i >= 0;) {
|
47915
47992
|
this._connector.addRic(childDefs[i]); // TODO: JET/RTK should not re-subscribe this
|
@@ -47937,19 +48014,19 @@ Grid.prototype._updateStreamingData = function() {
|
|
47937
48014
|
* @param {Object} e
|
47938
48015
|
*/
|
47939
48016
|
Grid.prototype._onPreDataSorting = function (e) {
|
47940
|
-
|
48017
|
+
let objs = this._stp.getSortedColumns();
|
47941
48018
|
|
47942
48019
|
this._sorter.reset();
|
47943
48020
|
if(Array.isArray(objs)) {
|
47944
|
-
|
47945
|
-
for(
|
47946
|
-
|
47947
|
-
|
47948
|
-
|
47949
|
-
|
47950
|
-
|
47951
|
-
|
47952
|
-
|
48021
|
+
let sortCount = objs.length;
|
48022
|
+
for(let i = 0; i < sortCount; ++i) {
|
48023
|
+
let obj = objs[i];
|
48024
|
+
let field = obj["field"] || "";
|
48025
|
+
let colIndex = obj["colIndex"];
|
48026
|
+
let colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
48027
|
+
|
48028
|
+
let rowSorting = false;
|
48029
|
+
let sortLogic = null;
|
47953
48030
|
if(colDef) {
|
47954
48031
|
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
47955
48032
|
rowSorting = colDef.isRowSorting();
|
@@ -47995,10 +48072,10 @@ Grid.prototype._clearDataUpdates = function() {
|
|
47995
48072
|
if(!this._dt || !this._dt._hasNewUpdates) {
|
47996
48073
|
return;
|
47997
48074
|
}
|
47998
|
-
|
47999
|
-
for(
|
48000
|
-
|
48001
|
-
|
48075
|
+
let rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
|
48076
|
+
for(let i = rowIds.length; --i >= 0;) {
|
48077
|
+
let rowData = this._dt.getRowData(rowIds[i]);
|
48078
|
+
let rowDef = rowData[ROW_DEF];
|
48002
48079
|
rowDef.resetUpdates();
|
48003
48080
|
}
|
48004
48081
|
};
|
@@ -48046,7 +48123,7 @@ Grid.prototype.getPageCount = function() {
|
|
48046
48123
|
* @param {Grid~RowReference} rowRef
|
48047
48124
|
*/
|
48048
48125
|
Grid.prototype.toggleChain = function(rowRef) {
|
48049
|
-
|
48126
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48050
48127
|
if(rowDef) {
|
48051
48128
|
rowDef.toggleChain();
|
48052
48129
|
}
|
@@ -48058,7 +48135,7 @@ Grid.prototype.toggleChain = function(rowRef) {
|
|
48058
48135
|
* @return {boolean}
|
48059
48136
|
*/
|
48060
48137
|
Grid.prototype.setClassification = function(rowRef, fields) {
|
48061
|
-
|
48138
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48062
48139
|
if(rowDef) {
|
48063
48140
|
return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
|
48064
48141
|
}
|
@@ -48083,7 +48160,7 @@ Grid.prototype.contains = function(elem) {
|
|
48083
48160
|
* @return {boolean}
|
48084
48161
|
*/
|
48085
48162
|
Grid.prototype.isFocused = function() {
|
48086
|
-
|
48163
|
+
let activeElement = document.activeElement;
|
48087
48164
|
if(!activeElement || !activeElement.shadowRoot) {
|
48088
48165
|
// active element is not in the shadow DOM. try using contains method to check
|
48089
48166
|
return this.contains(activeElement);
|
@@ -48150,17 +48227,17 @@ Grid.prototype._onFormulaDataRequired = function(e) {
|
|
48150
48227
|
* @param {Object} e
|
48151
48228
|
*/
|
48152
48229
|
Grid.prototype._onDataComposed = function(e) {
|
48153
|
-
|
48230
|
+
let values = e["changes"];
|
48154
48231
|
if(!values) {
|
48155
48232
|
return; // Cannot do data composition if there is no change in data
|
48156
48233
|
}
|
48157
48234
|
|
48158
|
-
|
48235
|
+
let rowData = e["rowData"];
|
48159
48236
|
if(!rowData) {
|
48160
48237
|
return; // Row could already be removed or global change event is sent
|
48161
48238
|
}
|
48162
48239
|
|
48163
|
-
|
48240
|
+
let rowDef = rowData[ROW_DEF];
|
48164
48241
|
if(!rowDef) {
|
48165
48242
|
return;
|
48166
48243
|
}
|
@@ -48169,7 +48246,7 @@ Grid.prototype._onDataComposed = function(e) {
|
|
48169
48246
|
}
|
48170
48247
|
|
48171
48248
|
if(this._autoDateConversion) { // auto data conversion
|
48172
|
-
|
48249
|
+
let field, value, dataType, colDef;
|
48173
48250
|
for(field in values) {
|
48174
48251
|
colDef = this._getColumnDefinition(field);
|
48175
48252
|
if(colDef) {
|
@@ -48199,16 +48276,16 @@ Grid.prototype._onDataComposed = function(e) {
|
|
48199
48276
|
* @param {Object} e
|
48200
48277
|
*/
|
48201
48278
|
Grid.prototype._onSubSegmentChanged = function(e) {
|
48202
|
-
|
48203
|
-
|
48204
|
-
|
48279
|
+
let insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
|
48280
|
+
let removalList = /** @type{Array.<string>} */(e["removalList"]);
|
48281
|
+
let removedRows = /** @type{Object} */(e["removedRows"]);
|
48205
48282
|
|
48206
|
-
|
48207
|
-
|
48208
|
-
|
48283
|
+
let i;
|
48284
|
+
let removalCount = removalList.length;
|
48285
|
+
let rowDef = null;
|
48209
48286
|
for(i = 0; i < removalCount; i++) {
|
48210
|
-
|
48211
|
-
|
48287
|
+
let rid = removalList[i];
|
48288
|
+
let removedRow = removedRows[rid];
|
48212
48289
|
if(removedRow) {
|
48213
48290
|
rowDef = removedRow[ROW_DEF];
|
48214
48291
|
if(rowDef) {
|
@@ -48218,11 +48295,11 @@ Grid.prototype._onSubSegmentChanged = function(e) {
|
|
48218
48295
|
}
|
48219
48296
|
}
|
48220
48297
|
|
48221
|
-
|
48298
|
+
let insertionCount = insertionList.length;
|
48222
48299
|
for(i = 0; i < insertionCount; i++) {
|
48223
|
-
|
48224
|
-
//
|
48225
|
-
|
48300
|
+
let segment = insertionList[i];
|
48301
|
+
// let parentId = segment.getParentId();
|
48302
|
+
let segmentId = segment.getId();
|
48226
48303
|
rowDef = new RowDefinition({
|
48227
48304
|
"segmentId": segmentId
|
48228
48305
|
});
|
@@ -48242,10 +48319,10 @@ Grid.prototype._recalculateFormulas = function(e) {
|
|
48242
48319
|
if(e && e["rid"]) {
|
48243
48320
|
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
48244
48321
|
} else {
|
48245
|
-
|
48322
|
+
let rows = this._dc ? this._dc.getAllRowData() : null; // Slow
|
48246
48323
|
|
48247
|
-
|
48248
|
-
for(
|
48324
|
+
let rowCount = rows ? rows.length : 0;
|
48325
|
+
for(let r = 0; r < rowCount; ++r) { // WARNING: This is very slow
|
48249
48326
|
this._fnEngine.calculate(rows[r]);
|
48250
48327
|
}
|
48251
48328
|
}
|
@@ -48257,11 +48334,11 @@ Grid.prototype._recalculateFormulas = function(e) {
|
|
48257
48334
|
Grid.prototype._snapshotFillerDataChanged = function (e) {
|
48258
48335
|
if (!this._dt) return;
|
48259
48336
|
|
48260
|
-
|
48337
|
+
let data = e.data;
|
48261
48338
|
if(e.timeSeries) {
|
48262
48339
|
this._updateTimeSeriesFields(e); // Increase or decrease time series field
|
48263
48340
|
} else {
|
48264
|
-
for (
|
48341
|
+
for (let ric in data) {
|
48265
48342
|
this.setRicData(ric, data[ric]);
|
48266
48343
|
}
|
48267
48344
|
}
|
@@ -48276,7 +48353,7 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
48276
48353
|
Grid.prototype._startPolling = function () {
|
48277
48354
|
if(this._pollingEnabled && this._pollingInterval) {
|
48278
48355
|
if(this._lastPollingRequest && !this._pollingTimerId) {
|
48279
|
-
|
48356
|
+
let now = new Date();
|
48280
48357
|
this._lastPollingRequest = now.getTime();
|
48281
48358
|
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
48282
48359
|
}
|
@@ -48298,9 +48375,9 @@ Grid.prototype.activateADCPolling = function (activated) {
|
|
48298
48375
|
if(activated !== false) {
|
48299
48376
|
this._pollingEnabled = true;
|
48300
48377
|
// Make immediate request after re-activation if it has been a long time
|
48301
|
-
|
48378
|
+
let now = new Date();
|
48302
48379
|
if(this._lastPollingRequest) {
|
48303
|
-
|
48380
|
+
let diff = now.getTime() - this._lastPollingRequest;
|
48304
48381
|
if(diff > this._pollingInterval) {
|
48305
48382
|
this.refreshADCData();
|
48306
48383
|
}
|
@@ -48315,7 +48392,7 @@ Grid.prototype.activateADCPolling = function (activated) {
|
|
48315
48392
|
* @return {boolean} Return true, if a request has been made
|
48316
48393
|
*/
|
48317
48394
|
Grid.prototype.refreshADCData = function () {
|
48318
|
-
|
48395
|
+
let dirty = this._snapshot.addFields(this._connector.getAllFields());
|
48319
48396
|
if(dirty) {
|
48320
48397
|
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
48321
48398
|
if(dirty) {
|
@@ -48329,9 +48406,9 @@ Grid.prototype.refreshADCData = function () {
|
|
48329
48406
|
/** @private
|
48330
48407
|
*/
|
48331
48408
|
Grid.prototype._onAutoLayoutUpdate = function() {
|
48332
|
-
|
48409
|
+
let elem = this._topNode;
|
48333
48410
|
|
48334
|
-
|
48411
|
+
let cw = elem.clientWidth;
|
48335
48412
|
if(cw !== this._clientWidth) {
|
48336
48413
|
this._clientWidth = cw;
|
48337
48414
|
this.updateLayout();
|
@@ -48343,7 +48420,7 @@ Grid.prototype._onAutoLayoutUpdate = function() {
|
|
48343
48420
|
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
48344
48421
|
*/
|
48345
48422
|
Grid.prototype.logDT = function(opt_options) {
|
48346
|
-
|
48423
|
+
let rowDefs = this._getAllRowDefinitions();
|
48347
48424
|
this._logData(rowDefs, opt_options);
|
48348
48425
|
};
|
48349
48426
|
/** @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 +48438,7 @@ Grid.prototype.logDT = function(opt_options) {
|
|
48361
48438
|
grid.logDV({"rowCount": 10}); // Showing 10 records
|
48362
48439
|
*/
|
48363
48440
|
Grid.prototype.logDV = function(opt_options) {
|
48364
|
-
|
48441
|
+
let rowDefs = this.getRowDefinitions();
|
48365
48442
|
this._logData(rowDefs, opt_options);
|
48366
48443
|
};
|
48367
48444
|
/** Log the collection of data to console
|
@@ -48377,7 +48454,7 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
48377
48454
|
// TODO: Get all required fields and eliminate duplicate fields
|
48378
48455
|
options["colNames"] = this.getColumnFields();
|
48379
48456
|
}
|
48380
|
-
|
48457
|
+
let tbl = DataCache_DataCache.constructTable(rowDefs.map(toRowData), options);
|
48381
48458
|
|
48382
48459
|
console.table(tbl); // eslint-disable-line
|
48383
48460
|
};
|
@@ -48389,17 +48466,17 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
48389
48466
|
* @returns {RowDefinition}
|
48390
48467
|
*/
|
48391
48468
|
Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
48392
|
-
|
48393
|
-
|
48469
|
+
let rowId = this._getRowId(rowRef);
|
48470
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
48394
48471
|
if(rowDef.isAutoGenerated()) { // Users cannot replace auto-generated
|
48395
48472
|
return null;
|
48396
48473
|
}
|
48397
|
-
|
48474
|
+
let configObj = rowDef.getConfigObject();
|
48398
48475
|
|
48399
48476
|
if(deepEqual(configObj, rowOption)){
|
48400
48477
|
return null;
|
48401
48478
|
} else {
|
48402
|
-
|
48479
|
+
let insertedRow = this.insertRow(rowOption, rowId);
|
48403
48480
|
this.removeRow(rowId);
|
48404
48481
|
return insertedRow;
|
48405
48482
|
}
|