@refinitiv-ui/efx-grid 6.0.15 → 6.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +661 -84
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +10 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +110 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +6 -0
- package/lib/rt-grid/es6/FieldDefinition.js +43 -0
- package/lib/rt-grid/es6/Grid.js +184 -8
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +125 -17
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +2 -2
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +30 -29
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +176 -98
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +17 -15
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +89 -159
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -53,6 +53,8 @@ declare class ColumnDefinition {
|
|
53
53
|
|
54
54
|
public dispose(): void;
|
55
55
|
|
56
|
+
public _initializeTimeSeriesChild(columnOption?: ColumnDefinition.Options|string|null): void;
|
57
|
+
|
56
58
|
public initialize(columnOption?: ColumnDefinition.Options|string|null): void;
|
57
59
|
|
58
60
|
public getId(): string;
|
@@ -87,6 +89,8 @@ declare class ColumnDefinition {
|
|
87
89
|
|
88
90
|
public isRealTimeField(): boolean;
|
89
91
|
|
92
|
+
public isTimeSeriesField(): boolean;
|
93
|
+
|
90
94
|
public isFormulaField(): boolean;
|
91
95
|
|
92
96
|
public static isFormulaField(field: string): boolean;
|
@@ -127,6 +131,10 @@ declare class ColumnDefinition {
|
|
127
131
|
|
128
132
|
public setRenderer(func: ((...params: any[]) => any)|null): void;
|
129
133
|
|
134
|
+
public getParent(): ColumnDefinition|null;
|
135
|
+
|
136
|
+
public getChildren(): (ColumnDefinition)[]|null;
|
137
|
+
|
130
138
|
public addRenderer(func: ((...params: any[]) => any)|null): void;
|
131
139
|
|
132
140
|
public activateRenderer(id?: string|null, func?: ((...params: any[]) => any)|null): boolean;
|
@@ -137,6 +145,8 @@ declare class ColumnDefinition {
|
|
137
145
|
|
138
146
|
public isRowSorting(): boolean;
|
139
147
|
|
148
|
+
public isAutoGenerated(): boolean;
|
149
|
+
|
140
150
|
public setName(str: string): void;
|
141
151
|
|
142
152
|
public getUserModel(): any;
|
@@ -123,8 +123,17 @@ var ColumnDefinition = function(columnOption, hostGrid) {
|
|
123
123
|
|
124
124
|
this._classes = [];
|
125
125
|
this._requiredFields = [];
|
126
|
+
this._children = [];
|
127
|
+
this._parent = [];
|
128
|
+
|
129
|
+
if(columnOption) {
|
130
|
+
if(columnOption["parent"]) { // WARNING: This assume time series child, when have a parent
|
131
|
+
this._initializeTimeSeriesChild(columnOption);
|
132
|
+
} else {
|
133
|
+
this.initialize(columnOption);
|
134
|
+
}
|
135
|
+
}
|
126
136
|
|
127
|
-
this.initialize(columnOption);
|
128
137
|
};
|
129
138
|
//#region Private Members
|
130
139
|
/** @type {string}
|
@@ -205,6 +214,10 @@ ColumnDefinition.prototype._eventArg;
|
|
205
214
|
* @private
|
206
215
|
*/
|
207
216
|
ColumnDefinition.prototype._realTimeField = false;
|
217
|
+
/** @type {boolean}
|
218
|
+
* @private
|
219
|
+
*/
|
220
|
+
ColumnDefinition.prototype._autoGenerated = false;
|
208
221
|
|
209
222
|
/** @type {!Array.<string>}
|
210
223
|
* @private
|
@@ -241,6 +254,19 @@ ColumnDefinition.prototype._textSelect = false;
|
|
241
254
|
* @private
|
242
255
|
*/
|
243
256
|
ColumnDefinition.prototype._userModel = null;
|
257
|
+
|
258
|
+
/** @type {Grid~ColumnDefinition}
|
259
|
+
* @private
|
260
|
+
*/
|
261
|
+
ColumnDefinition.prototype._parent = null;
|
262
|
+
/** @type {Array<ColumnDefinition>}
|
263
|
+
* @private
|
264
|
+
*/
|
265
|
+
ColumnDefinition.prototype._children = null;
|
266
|
+
/** @type {boolean}
|
267
|
+
* @private
|
268
|
+
*/
|
269
|
+
ColumnDefinition.prototype._timeSeriesField = false;
|
244
270
|
/** @type {Object}
|
245
271
|
* @private
|
246
272
|
*/
|
@@ -256,8 +282,20 @@ ColumnDefinition.prototype.dispose = function() {
|
|
256
282
|
this.setRenderer(null); // this._userRenderers are removed
|
257
283
|
this.setSorter(null);
|
258
284
|
this._userModel = null;
|
285
|
+
this._parent = null;
|
286
|
+
this._children = null;
|
259
287
|
// TODO: Remove any related reference from this._fnEngine
|
260
288
|
};
|
289
|
+
|
290
|
+
/** @public
|
291
|
+
* @param {ColumnDefinition~Options|string=} columnOption
|
292
|
+
*/
|
293
|
+
ColumnDefinition.prototype._initializeTimeSeriesChild = function(columnOption) {
|
294
|
+
this._autoGenerated = true;
|
295
|
+
var parentDef = /** @type{ColumnDefinition} */(columnOption["parent"]);
|
296
|
+
this._setParent(parentDef);
|
297
|
+
this.initialize(columnOption);
|
298
|
+
};
|
261
299
|
/** @public
|
262
300
|
* @param {ColumnDefinition~Options|string=} columnOption
|
263
301
|
*/
|
@@ -556,6 +594,12 @@ ColumnDefinition.prototype.isRealTimeField = function() {
|
|
556
594
|
/** @public
|
557
595
|
* @return {boolean}
|
558
596
|
*/
|
597
|
+
ColumnDefinition.prototype.isTimeSeriesField = function() {
|
598
|
+
return this._timeSeriesField;
|
599
|
+
};
|
600
|
+
/** @public
|
601
|
+
* @return {boolean}
|
602
|
+
*/
|
559
603
|
ColumnDefinition.prototype.isFormulaField = function() {
|
560
604
|
return this._formula ? true : false;
|
561
605
|
};
|
@@ -741,6 +785,10 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
741
785
|
obj["headerAlignment"] = this._headerAlignment;
|
742
786
|
}
|
743
787
|
|
788
|
+
if(this._autoGenerated) {
|
789
|
+
obj["autoGenerated"] = this._autoGenerated;
|
790
|
+
}
|
791
|
+
|
744
792
|
var core = this._eventArg["core"];
|
745
793
|
var grid = this._eventArg["grid"];
|
746
794
|
var colIndex = grid.getColumnIndex(this);
|
@@ -818,6 +866,53 @@ ColumnDefinition.prototype.setRenderer = function(func) {
|
|
818
866
|
this._userRenderers = null;
|
819
867
|
}
|
820
868
|
};
|
869
|
+
|
870
|
+
|
871
|
+
/** @public
|
872
|
+
* @return {ColumnDefinition}
|
873
|
+
*/
|
874
|
+
ColumnDefinition.prototype.getParent = function() {
|
875
|
+
return this._parent;
|
876
|
+
};
|
877
|
+
|
878
|
+
|
879
|
+
/**
|
880
|
+
* @private
|
881
|
+
* @param {ColumnDefinition} parentDef
|
882
|
+
* @return {boolean}=true if have any change
|
883
|
+
*/
|
884
|
+
ColumnDefinition.prototype._setParent = function(parentDef) {
|
885
|
+
if(this._parent === parentDef || parentDef === this) { // The same parent is given
|
886
|
+
return false;
|
887
|
+
}
|
888
|
+
|
889
|
+
if(parentDef) {
|
890
|
+
this._parent = parentDef;
|
891
|
+
this._parent._addChild(this); // sync child and parent
|
892
|
+
}
|
893
|
+
return false;
|
894
|
+
};
|
895
|
+
|
896
|
+
|
897
|
+
/**
|
898
|
+
* @public
|
899
|
+
* @return {Array.<ColumnDefinition>}
|
900
|
+
*/
|
901
|
+
ColumnDefinition.prototype.getChildren = function() {
|
902
|
+
return this._children;
|
903
|
+
};
|
904
|
+
|
905
|
+
/**
|
906
|
+
* @private
|
907
|
+
* @param {string} colDef Child column definition
|
908
|
+
*/
|
909
|
+
ColumnDefinition.prototype._addChild = function(colDef) {
|
910
|
+
if(this === colDef || this._children.indexOf(colDef) > -1) {
|
911
|
+
return;
|
912
|
+
}
|
913
|
+
this._children.push(colDef);
|
914
|
+
};
|
915
|
+
|
821
916
|
/** Add more renderer to the existing list
|
822
917
|
* @public
|
823
918
|
* @param {Function} func
|
@@ -884,6 +979,13 @@ ColumnDefinition.prototype.isRowSorting = function() {
|
|
884
979
|
return this._rowSorting ? true : false;
|
885
980
|
};
|
886
981
|
|
982
|
+
/** @public
|
983
|
+
* @return {boolean}
|
984
|
+
*/
|
985
|
+
ColumnDefinition.prototype.isAutoGenerated = function() {
|
986
|
+
return this._autoGenerated;
|
987
|
+
};
|
988
|
+
|
887
989
|
/** To allow user change column name in run-time (language change or localization)
|
888
990
|
* @public
|
889
991
|
* @param {string} str
|
@@ -934,6 +1036,13 @@ ColumnDefinition.prototype._setField = function(field, formulaStr) {
|
|
934
1036
|
this._emptyField = false;
|
935
1037
|
this._realTimeField = field ? true : false;
|
936
1038
|
}
|
1039
|
+
|
1040
|
+
if(FieldDefinition.isTimeSeriesField(field)) {
|
1041
|
+
// children will be clone the config from parent too
|
1042
|
+
this._realTimeField = false;
|
1043
|
+
this._timeSeriesField = true;
|
1044
|
+
}
|
1045
|
+
|
937
1046
|
this._isDefaultName = true;
|
938
1047
|
this._updateContext("field", field);
|
939
1048
|
if(this.isRealTimeField()) { // Only realtime field will have a formatted field
|
@@ -8,12 +8,18 @@ declare namespace FieldDefinition {
|
|
8
8
|
|
9
9
|
function get(field: string): any;
|
10
10
|
|
11
|
+
function getTimeSeriesChildren(field: string): any;
|
12
|
+
|
13
|
+
function addTimeSeriesChild(tsDef: string, childDef: any): void;
|
14
|
+
|
11
15
|
function remove(field: string): void;
|
12
16
|
|
13
17
|
function setSynapseConfig(config: Grid.SynapseConfig|null): void;
|
14
18
|
|
15
19
|
function setFieldCaching(caching: boolean): void;
|
16
20
|
|
21
|
+
function isTimeSeriesField(field: string): boolean;
|
22
|
+
|
17
23
|
}
|
18
24
|
|
19
25
|
export {FieldDefinition};
|
@@ -159,6 +159,12 @@ FieldDefinition._defs = {
|
|
159
159
|
description: "The latest Ask price."
|
160
160
|
}
|
161
161
|
};
|
162
|
+
|
163
|
+
/** @type {Object.<string, Object>}
|
164
|
+
* @private
|
165
|
+
*/
|
166
|
+
FieldDefinition._timeSeriesChildren = {};
|
167
|
+
|
162
168
|
/** api-key to call synapse service
|
163
169
|
* @type {string}
|
164
170
|
* @private
|
@@ -205,6 +211,25 @@ FieldDefinition.get = function(field) {
|
|
205
211
|
/** @public
|
206
212
|
* @function
|
207
213
|
* @param {string} field
|
214
|
+
* @return {Object}
|
215
|
+
*/
|
216
|
+
FieldDefinition.getTimeSeriesChildren = function(field) {
|
217
|
+
return FieldDefinition._timeSeriesChildren[field];
|
218
|
+
};
|
219
|
+
/** @public
|
220
|
+
* @function
|
221
|
+
* @param {string} tsDef
|
222
|
+
* @param {Object} childDef
|
223
|
+
*/
|
224
|
+
FieldDefinition.addTimeSeriesChild = function(tsDef, childDef) {
|
225
|
+
if(!FieldDefinition._timeSeriesChildren[tsDef]) {
|
226
|
+
FieldDefinition._timeSeriesChildren[tsDef] = [];
|
227
|
+
}
|
228
|
+
FieldDefinition._timeSeriesChildren[tsDef].push(childDef);
|
229
|
+
};
|
230
|
+
/** @public
|
231
|
+
* @function
|
232
|
+
* @param {string} field
|
208
233
|
*/
|
209
234
|
FieldDefinition.remove = function(field) {
|
210
235
|
delete FieldDefinition._defs[field];
|
@@ -227,6 +252,24 @@ FieldDefinition.setFieldCaching = function (caching) {
|
|
227
252
|
FieldDefinition._caching = caching;
|
228
253
|
};
|
229
254
|
|
255
|
+
/** @public
|
256
|
+
* @param {string} field
|
257
|
+
* @return {boolean}=true if field is time series field
|
258
|
+
*/
|
259
|
+
FieldDefinition.isTimeSeriesField = function (field) {
|
260
|
+
/*
|
261
|
+
^TR. => start with TR.
|
262
|
+
[\w]+ => any field with string and value
|
263
|
+
[\(] => open bucket (
|
264
|
+
[\w\-\=\,]* => any property name and follow by = EX. SDATE=2011-11-11, PRIOD=123123
|
265
|
+
EDATE\=+ => EDATE in bucket
|
266
|
+
[\w\-\=\,]+ => another propertie param
|
267
|
+
[\)]$ => end with only )
|
268
|
+
*/
|
269
|
+
|
270
|
+
return !!field.toUpperCase().match(/^TR.[\w]+[\(][\w\-\=\,]*EDATE\=+[\w\-\=\,]+[\)]$/g);
|
271
|
+
};
|
272
|
+
|
230
273
|
/** to get more info about field via synapse service
|
231
274
|
* @private
|
232
275
|
* @param {string} field
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -209,6 +209,13 @@ var excludeAutoGenerated = function (rowDef) {
|
|
209
209
|
return !rowDef.isAutoGenerated();
|
210
210
|
};
|
211
211
|
|
212
|
+
/** @private
|
213
|
+
* @param {Object} colConfig column config
|
214
|
+
* @return {boolean}
|
215
|
+
*/
|
216
|
+
var _byNonAutoGeneratedColumn = function (colConfig) {
|
217
|
+
return !colConfig.autoGenerated;
|
218
|
+
};
|
212
219
|
/** @private
|
213
220
|
* @param {string} rowDefA
|
214
221
|
* @param {string} rowDefB
|
@@ -234,6 +241,8 @@ var Grid = function(placeholder, config) {
|
|
234
241
|
t._recalculateFormulas = t._recalculateFormulas.bind(t);
|
235
242
|
t._updateStreamingData = t._updateStreamingData.bind(t);
|
236
243
|
t.updateColumnTitle = t.updateColumnTitle.bind(t);
|
244
|
+
t._insertTimeSeriesChildren = t._insertTimeSeriesChildren.bind(t);
|
245
|
+
|
237
246
|
|
238
247
|
t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
|
239
248
|
t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
|
@@ -257,6 +266,8 @@ var Grid = function(placeholder, config) {
|
|
257
266
|
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
258
267
|
t._chainConflator = new Conflator(100, t._addMemberOfChain);
|
259
268
|
t._columnTitleConflator = new Conflator(0, t.updateColumnTitle);
|
269
|
+
t._timeSeriesChildConflator = new Conflator(0, t._insertTimeSeriesChildren);
|
270
|
+
|
260
271
|
|
261
272
|
t._defaultColumnOptions = {};
|
262
273
|
|
@@ -1003,8 +1014,8 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1003
1014
|
grid.getConfigObject(obj);
|
1004
1015
|
}
|
1005
1016
|
|
1006
|
-
var i;
|
1007
|
-
|
1017
|
+
var i, len;
|
1018
|
+
len = this.getColumnCount();
|
1008
1019
|
for (i = 0; i < len; ++i) {
|
1009
1020
|
var column = columns[i];
|
1010
1021
|
if(!column) {
|
@@ -1015,6 +1026,8 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1015
1026
|
colDef.getConfigObject(column);
|
1016
1027
|
}
|
1017
1028
|
|
1029
|
+
obj.columns = columns = columns.filter(_byNonAutoGeneratedColumn);
|
1030
|
+
|
1018
1031
|
if(this._topNode.style.overflow === "") {
|
1019
1032
|
obj["scrollbar"] = false;
|
1020
1033
|
}
|
@@ -1255,6 +1268,116 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
1255
1268
|
this._grid.insertColumn(idx, configObj); // columnAdded is fired
|
1256
1269
|
};
|
1257
1270
|
|
1271
|
+
/** @private
|
1272
|
+
* @param {Object} e snapshort change event object
|
1273
|
+
*/
|
1274
|
+
Grid.prototype._updateTimeSeriesFields = function (e) {
|
1275
|
+
var snapShortData = e.data;
|
1276
|
+
var childFields;
|
1277
|
+
for (var ric in snapShortData) {
|
1278
|
+
childFields = snapShortData[ric];
|
1279
|
+
this.setRicData(ric, snapShortData[ric]);
|
1280
|
+
}
|
1281
|
+
var parentField, field, colIndex, parentColDef, childColIndex;
|
1282
|
+
|
1283
|
+
var firstField;
|
1284
|
+
for (field in childFields) {
|
1285
|
+
firstField = field;
|
1286
|
+
break;
|
1287
|
+
}
|
1288
|
+
|
1289
|
+
parentField = e.childrenFieldToParent[firstField];
|
1290
|
+
colIndex = this.getColumnIndex(parentField);
|
1291
|
+
this._grid.setColumnVisibility(colIndex);
|
1292
|
+
parentColDef = this._getColumnDefinition(colIndex);
|
1293
|
+
|
1294
|
+
|
1295
|
+
var children = parentColDef.getChildren();
|
1296
|
+
var i, len, childDef, childField;
|
1297
|
+
len = children.length;
|
1298
|
+
if(len > 0){
|
1299
|
+
for (i = 0; i < len; i++) {
|
1300
|
+
childDef = children[i];
|
1301
|
+
childField = childDef.getField();
|
1302
|
+
if(!childFields[childField]) {
|
1303
|
+
this.removeColumn(childField);
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
for (childField in childFields) {
|
1309
|
+
parentField = e.childrenFieldToParent[childField];
|
1310
|
+
colIndex = this.getColumnIndex(parentField);
|
1311
|
+
parentColDef = this._getColumnDefinition(colIndex);
|
1312
|
+
childColIndex = this.getColumnIndex(childField);
|
1313
|
+
if(childColIndex < 0) { // not found column index in view tried to clone from parent
|
1314
|
+
this._cloneTimeSeriesColumn(parentColDef, childField, colIndex);
|
1315
|
+
FieldDefinition.addTimeSeriesChild(parentField, childField);
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
};
|
1320
|
+
|
1321
|
+
|
1322
|
+
/** @private
|
1323
|
+
* @param {ColumnDefinition} colDef
|
1324
|
+
*/
|
1325
|
+
Grid.prototype._insertTimeSeriesChildren = function (colDef) {
|
1326
|
+
if(this._timeSeriesChildConflator.conflate(colDef) ) {
|
1327
|
+
return;
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
var colDefs = this._timeSeriesChildConflator.popAllData();
|
1331
|
+
var i, j, len, childField, idx;
|
1332
|
+
|
1333
|
+
for (i = 0; i < colDefs.length; i++) {
|
1334
|
+
colDef = colDefs[i];
|
1335
|
+
idx = this.getColumnIndex(colDef);
|
1336
|
+
this._grid.setColumnVisibility(idx); // hide parent field
|
1337
|
+
|
1338
|
+
if(!colDef) {
|
1339
|
+
continue;
|
1340
|
+
}
|
1341
|
+
var childFields = FieldDefinition.getTimeSeriesChildren(colDef.getField());
|
1342
|
+
if(!childFields) { // not found time series field
|
1343
|
+
return;
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
len = childFields.length;
|
1347
|
+
if(len < 1) {
|
1348
|
+
return; // normal field
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
for (j = 0; j < len; j++) {
|
1352
|
+
idx = this.getColumnIndex(colDef);
|
1353
|
+
childField = childFields[j];
|
1354
|
+
this._cloneTimeSeriesColumn(colDef, childField, idx);
|
1355
|
+
}
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
};
|
1359
|
+
|
1360
|
+
/** @private
|
1361
|
+
* @param {ColumnDefinition} parentColDef Parent definition
|
1362
|
+
* @param {string} childField field
|
1363
|
+
* @param {number} idx index of insertion column
|
1364
|
+
*/
|
1365
|
+
Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx) {
|
1366
|
+
var parentConfig, columnOption, obj, key;
|
1367
|
+
parentConfig = parentColDef.getConfigObject();
|
1368
|
+
obj = {};
|
1369
|
+
for (key in parentConfig) {
|
1370
|
+
if(key !== "hidden") {
|
1371
|
+
obj[key] = parentConfig[key];
|
1372
|
+
}
|
1373
|
+
}
|
1374
|
+
columnOption = cloneObject(obj);
|
1375
|
+
columnOption["field"] = childField.replace("TR.", "");
|
1376
|
+
columnOption["name"] = childField.split("_")[1].split("T")[0]; // Currently, response server format utc date ex "2022-11-23T00:00:00"
|
1377
|
+
columnOption["parent"] = parentColDef;
|
1378
|
+
this.insertColumn(columnOption, idx++);
|
1379
|
+
|
1380
|
+
};
|
1258
1381
|
|
1259
1382
|
/** @public
|
1260
1383
|
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
@@ -1316,6 +1439,10 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
1316
1439
|
colConfig["width"] = 1;
|
1317
1440
|
}
|
1318
1441
|
|
1442
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1443
|
+
if(colDef.getChildren()) { // Parent time series field doesn't provide hidden property
|
1444
|
+
colConfig["hidden"] = false;
|
1445
|
+
}
|
1319
1446
|
this.insertColumn(colConfig, colIndex);
|
1320
1447
|
this.removeColumn(colIndex + 1); // remove existing column after insert
|
1321
1448
|
};
|
@@ -1352,7 +1479,15 @@ Grid.prototype._onFieldLoadedError = function (err) {
|
|
1352
1479
|
* @param {string} referrer
|
1353
1480
|
*/
|
1354
1481
|
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
1355
|
-
|
1482
|
+
// async process, the field can be remove before column added
|
1483
|
+
var colIndex = this.getColumnIndex(field);
|
1484
|
+
if(colIndex > -1) {
|
1485
|
+
var colDef = this._getColumnDefinition(field);
|
1486
|
+
if(colDef.isTimeSeriesField()) {
|
1487
|
+
this._insertTimeSeriesChildren(colDef);
|
1488
|
+
}
|
1489
|
+
this._connector.addFields(field, referrer);
|
1490
|
+
}
|
1356
1491
|
};
|
1357
1492
|
|
1358
1493
|
/**
|
@@ -1381,8 +1516,8 @@ Grid.prototype._shouldLoadFieldInfo = function (field, isRealTime) {
|
|
1381
1516
|
var fieldDef = FieldDefinition.get(field);
|
1382
1517
|
if (!fieldDef &&
|
1383
1518
|
field !== 'X_RIC_NAME' && // ignore X_RIC_NAME
|
1384
|
-
(isRealTime || ColumnDefinition.isAdcField(field)) &&
|
1385
|
-
(this._RTK || window["JET"])
|
1519
|
+
(isRealTime || ColumnDefinition.isAdcField(field)) && // realtime field or adc field (Without static field)
|
1520
|
+
(this._RTK || window["JET"]) // have rtk instance or window jet sub
|
1386
1521
|
) {
|
1387
1522
|
return true;
|
1388
1523
|
}
|
@@ -1508,9 +1643,15 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
1508
1643
|
onLoaded = this._onFieldLoaded.bind(this, field, referrer);
|
1509
1644
|
prom = prom.then(onLoaded).catch(onLoaded);
|
1510
1645
|
} else {
|
1646
|
+
if(colDef.isTimeSeriesField()) {
|
1647
|
+
this._insertTimeSeriesChildren(colDef);
|
1648
|
+
}
|
1511
1649
|
this._connector.addFields(field, referrer);
|
1512
1650
|
}
|
1513
1651
|
} else {
|
1652
|
+
if(colDef.isTimeSeriesField()) {
|
1653
|
+
this._insertTimeSeriesChildren(colDef);
|
1654
|
+
}
|
1514
1655
|
this._connector.addFields(field, referrer);
|
1515
1656
|
}
|
1516
1657
|
}
|
@@ -1528,6 +1669,19 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
1528
1669
|
}
|
1529
1670
|
|
1530
1671
|
var colDef = this.getColumnDefinition(colIndex);
|
1672
|
+
var children = colDef.getChildren();
|
1673
|
+
if(children) {
|
1674
|
+
var len = children.length;
|
1675
|
+
if(len > 0) { // remove time series child
|
1676
|
+
var i, childDef;
|
1677
|
+
for (i = 0; i < len; i++) {
|
1678
|
+
childDef = children[i];
|
1679
|
+
this.removeColumn(childDef);
|
1680
|
+
}
|
1681
|
+
colIndex = this.getColumnIndex(colRef); // children in parent will be remove the parent should be get new index
|
1682
|
+
}
|
1683
|
+
}
|
1684
|
+
|
1531
1685
|
if(!colDef.isRealTimeField()) {
|
1532
1686
|
if(this._dc) {
|
1533
1687
|
this._dc.removeStaticFields([colDef.getField()]);
|
@@ -1600,6 +1754,7 @@ Grid.prototype.removeAllColumns = function() {
|
|
1600
1754
|
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
1601
1755
|
|
1602
1756
|
this._columnTitleConflator.reset();
|
1757
|
+
this._timeSeriesChildConflator.reset();
|
1603
1758
|
|
1604
1759
|
this._connector.removeAllFields();
|
1605
1760
|
this._grid.setColumnCount(0);
|
@@ -1628,7 +1783,22 @@ Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
|
1628
1783
|
*/
|
1629
1784
|
Grid.prototype.hideColumn = function(colRef, hidden) {
|
1630
1785
|
var colIndex = this.getColumnIndex(colRef);
|
1631
|
-
|
1786
|
+
if(colIndex < 0) { // not found
|
1787
|
+
return;
|
1788
|
+
}
|
1789
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1790
|
+
var children = colDef.getChildren();
|
1791
|
+
var len = children.length;
|
1792
|
+
if(len > 0) { // remove time series child, and parent shouldn't unHide
|
1793
|
+
var i, childDef;
|
1794
|
+
for (i = 0; i < len; i++) {
|
1795
|
+
childDef = children[i];
|
1796
|
+
this.hideColumn(childDef, hidden);
|
1797
|
+
}
|
1798
|
+
} else {
|
1799
|
+
this._grid.hideColumn(colIndex, hidden);
|
1800
|
+
}
|
1801
|
+
|
1632
1802
|
};
|
1633
1803
|
/** Hide multiple columns at once. The hidden columns still occupy the same index.
|
1634
1804
|
* @public
|
@@ -2430,6 +2600,7 @@ Grid.prototype._getAllColumnDefinitions = function() {
|
|
2430
2600
|
}
|
2431
2601
|
return colDefs;
|
2432
2602
|
};
|
2603
|
+
|
2433
2604
|
/** @public
|
2434
2605
|
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
2435
2606
|
* @return {RowDefinition}
|
@@ -3185,9 +3356,14 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
3185
3356
|
if (!this._dt) return;
|
3186
3357
|
|
3187
3358
|
var data = e.data;
|
3188
|
-
|
3189
|
-
this.
|
3359
|
+
if(e.timeSeries) {
|
3360
|
+
this._updateTimeSeriesFields(e); // Increase or decrease time series field
|
3361
|
+
} else {
|
3362
|
+
for (var ric in data) {
|
3363
|
+
this.setRicData(ric, data[ric]);
|
3364
|
+
}
|
3190
3365
|
}
|
3366
|
+
|
3191
3367
|
if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
|
3192
3368
|
this._lastPollingRequest = 1; // Allow polling to be started
|
3193
3369
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import Grid from "./Grid.js";
|
2
2
|
import {Ext} from "../../tr-grid-util/es6/Ext.js";
|
3
3
|
import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
|
4
|
+
import {FieldDefinition} from "./FieldDefinition.js";
|
4
5
|
|
5
6
|
declare class SnapshotFiller extends EventDispatcher {
|
6
7
|
|