@refinitiv-ui/efx-grid 6.0.103 → 6.0.105
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +14 -137
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataCache.d.ts +0 -8
- package/lib/core/es6/data/DataCache.js +13 -136
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +356 -734
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.js +4 -4
- package/lib/rt-grid/es6/Grid.d.ts +1 -1
- package/lib/rt-grid/es6/Grid.js +8 -49
- package/lib/rt-grid/es6/RowDefinition.d.ts +5 -3
- package/lib/rt-grid/es6/RowDefinition.js +49 -20
- package/lib/tr-grid-column-fitter/es6/ColumnFitter.js +523 -708
- package/lib/tr-grid-column-resizing/es6/ColumnResizing.d.ts +16 -16
- package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +131 -109
- package/lib/types/es6/ColumnResizing.d.ts +16 -16
- package/lib/types/es6/Core/data/DataCache.d.ts +0 -8
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +1 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +5 -3
- package/lib/versions.json +2 -2
- package/package.json +3 -2
@@ -19,15 +19,15 @@ const SYNAPSE_URL =
|
|
19
19
|
* @constant
|
20
20
|
* @description
|
21
21
|
* ^TR. => start with TR.
|
22
|
-
*
|
22
|
+
* \w+ => any field with string and value
|
23
23
|
* [\(] => open bucket (
|
24
|
-
* [\w
|
24
|
+
* [\w\-=,]* => any property name and follow by = EX. SDATE=2011-11-11, PRIOD=123123
|
25
25
|
* (?:EDATE|SDATE) => non-capturing group match EDATE or SDATE
|
26
|
-
* [\w
|
26
|
+
* [\w\-=,]+ => another propertie param
|
27
27
|
* [\)]$ => end with only )
|
28
28
|
* i => for match both upper and lower cases
|
29
29
|
*/
|
30
|
-
const TimeSeriesRegEx = /^TR
|
30
|
+
const TimeSeriesRegEx = /^TR\.\w+\([\w\-=,]*(?:EDATE|SDATE)=+[\w\-=,]*[ \w]*\)$/i;
|
31
31
|
|
32
32
|
/* @namespace */
|
33
33
|
let FieldDefinition = {};
|
@@ -208,7 +208,7 @@ declare class Grid extends EventDispatcher {
|
|
208
208
|
|
209
209
|
public hasHiddenRow(): boolean;
|
210
210
|
|
211
|
-
public setRic(rowRef: Grid.RowReference|null, str: string, options?: RowDefinition.Options|null):
|
211
|
+
public setRic(rowRef: Grid.RowReference|null, str: string, options?: RowDefinition.Options|null): RowDefinition|null;
|
212
212
|
|
213
213
|
public unlinkChain(rowRef: Grid.RowReference|null): void;
|
214
214
|
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -189,28 +189,6 @@ let toRowData = function(rowDef) {
|
|
189
189
|
return rowDef ? rowDef.getRowData() : null;
|
190
190
|
};
|
191
191
|
|
192
|
-
/** @private
|
193
|
-
* @const
|
194
|
-
* @type {Object.<string, number>}
|
195
|
-
*/
|
196
|
-
let _unclonableFields = {
|
197
|
-
"ROW_DEF": 1,
|
198
|
-
"SUB_ID": 1
|
199
|
-
};
|
200
|
-
/** @private
|
201
|
-
* @param {RowDefinition} fromRowDef
|
202
|
-
* @param {RowDefinition} toRowDef
|
203
|
-
*/
|
204
|
-
let cloneRowData = function(fromRowDef, toRowDef) {
|
205
|
-
let from = toRowData(fromRowDef);
|
206
|
-
let to = toRowData(toRowDef);
|
207
|
-
for(let key in from) {
|
208
|
-
if(!_unclonableFields[key]) {
|
209
|
-
to[key] = from[key];
|
210
|
-
}
|
211
|
-
}
|
212
|
-
};
|
213
|
-
|
214
192
|
/** @private
|
215
193
|
* @param {RowDefinition} rowDef
|
216
194
|
* @return {boolean}
|
@@ -391,7 +369,6 @@ let Grid = function(placeholder, config) {
|
|
391
369
|
t._dc = new DataCache();
|
392
370
|
t._dc.listen("dataChanged", t._onDataChanged);
|
393
371
|
t._dc.listen("dataComposed", t._onDataComposed);
|
394
|
-
t._dc.addStaticFields([ROW_DEF, SUB_ID]); // Static fields are deprecated, set fields to be ignore during clone in DataCache
|
395
372
|
|
396
373
|
t._dt = new DataTable();
|
397
374
|
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
@@ -1959,12 +1936,6 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
1959
1936
|
|
1960
1937
|
let colDef = this.getColumnDefinition(colIndex);
|
1961
1938
|
|
1962
|
-
if(!colDef.isRealTimeField()) {
|
1963
|
-
if(this._dc) {
|
1964
|
-
this._dc.removeStaticFields([colDef.getField()]);
|
1965
|
-
}
|
1966
|
-
}
|
1967
|
-
|
1968
1939
|
this._grid.removeColumnAt(colIndex);
|
1969
1940
|
this._connector.removeFields(colDef);
|
1970
1941
|
|
@@ -1988,25 +1959,16 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
1988
1959
|
}
|
1989
1960
|
indices.sort(Grid._descendingOrder); // Removal must be done from the back
|
1990
1961
|
|
1991
|
-
let staticFields = []; // For clearing any data stored in our cache
|
1992
1962
|
let prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
|
1993
1963
|
|
1994
1964
|
for(let i = 0; i < len; ++i) {
|
1995
1965
|
let colIndex = indices[i];
|
1996
1966
|
let colDef = this.getColumnDefinition(colIndex);
|
1997
|
-
if(!colDef.isRealTimeField()) {
|
1998
|
-
staticFields.push(colDef.getField());
|
1999
|
-
}
|
2000
1967
|
colDef.dispose();
|
2001
1968
|
this._grid.removeColumnAt(colIndex);
|
2002
1969
|
this._connector.removeFields(colDef);
|
2003
1970
|
}
|
2004
1971
|
|
2005
|
-
if(staticFields.length) {
|
2006
|
-
if(this._dc) {
|
2007
|
-
this._dc.removeStaticFields(staticFields);
|
2008
|
-
}
|
2009
|
-
}
|
2010
1972
|
this._grid.freezeLayout(prevState);
|
2011
1973
|
};
|
2012
1974
|
/** Sorting is also cleared.
|
@@ -2036,9 +1998,6 @@ Grid.prototype.removeAllColumns = function() {
|
|
2036
1998
|
|
2037
1999
|
this._connector.removeAllFields();
|
2038
2000
|
this._grid.setColumnCount(0);
|
2039
|
-
if(this._dc) {
|
2040
|
-
this._dc.resetStaticFields();
|
2041
|
-
}
|
2042
2001
|
};
|
2043
2002
|
|
2044
2003
|
/** Move the column at the specified index to the target index. When moving multiple columns, the original order of the source columns will be sorted by their index and the position of the columns will not be guaranteed to be exactly at the destination index.
|
@@ -2300,13 +2259,12 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
2300
2259
|
|
2301
2260
|
/** Initialize data for the given rowDef from another rowDef with the same RIC
|
2302
2261
|
* @private
|
2303
|
-
* @param {RowDefinition} rowDef
|
2262
|
+
* @param {!RowDefinition} rowDef
|
2304
2263
|
*/
|
2305
2264
|
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
2306
|
-
let
|
2307
|
-
|
2308
|
-
|
2309
|
-
cloneRowData(rowDefs[0], rowDef);
|
2265
|
+
let rowDefs = this._connector.getRowDefByRic(rowDef.getSymbol());
|
2266
|
+
if(rowDefs) {
|
2267
|
+
rowDef.copyRowData(rowDefs[0]);
|
2310
2268
|
}
|
2311
2269
|
};
|
2312
2270
|
/** @public
|
@@ -2739,15 +2697,15 @@ Grid.prototype.hasHiddenRow = function(){
|
|
2739
2697
|
* @param {Grid~RowReference} rowRef
|
2740
2698
|
* @param {string} str RIC to be set to a row
|
2741
2699
|
* @param {RowDefinition~Options=} options
|
2700
|
+
* @returns {RowDefinition} Returns modified Row Definition instance
|
2742
2701
|
*/
|
2743
2702
|
Grid.prototype.setRic = function(rowRef, str, options) {
|
2744
2703
|
if(this._mainGrid) {
|
2745
|
-
this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
2746
|
-
return;
|
2704
|
+
return this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
2747
2705
|
}
|
2748
2706
|
let rowDef = this._getRowDefinitionByRef(rowRef);
|
2749
2707
|
if(rowDef) {
|
2750
|
-
|
2708
|
+
let tempOpt = options || {};
|
2751
2709
|
if(typeof str === "string") {
|
2752
2710
|
tempOpt["ric"] = str;
|
2753
2711
|
} else {
|
@@ -2769,6 +2727,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2769
2727
|
rowDef.setStaticRowData(values, tempOpt["fields"]);
|
2770
2728
|
}
|
2771
2729
|
}
|
2730
|
+
return rowDef;
|
2772
2731
|
};
|
2773
2732
|
/** Unlink the chain and its constituents. When the chain is expanded,
|
2774
2733
|
* the chain row and its members are converted from autogenerated to
|
@@ -56,12 +56,14 @@ declare class RowDefinition {
|
|
56
56
|
|
57
57
|
public getData(field: string): any;
|
58
58
|
|
59
|
-
public setStaticRowData(data: { [key: string]: any }|any[],
|
60
|
-
|
61
|
-
public updateRowData(data: { [key: string]: any }|any[], opt_fields?: (string)[]|null): void;
|
59
|
+
public setStaticRowData(data: { [key: string]: any }|any[], indexToFieldMap?: (string)[]|null): void;
|
62
60
|
|
63
61
|
public setStaticData(field: string, value: any): void;
|
64
62
|
|
63
|
+
public updateRowData(data: { [key: string]: any }|any[], indexToFieldMap?: (string)[]|null): void;
|
64
|
+
|
65
|
+
public copyRowData(srcRowDef: RowDefinition|null): void;
|
66
|
+
|
65
67
|
public setRowData(data: { [key: string]: any }): void;
|
66
68
|
|
67
69
|
public setData(field: string, value: any): void;
|
@@ -535,7 +535,7 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
535
535
|
obj["info"] = this._info;
|
536
536
|
}
|
537
537
|
|
538
|
-
val = this.
|
538
|
+
val = this._cloneStaticRowData();
|
539
539
|
if(val) {
|
540
540
|
obj["values"] = val;
|
541
541
|
}
|
@@ -553,7 +553,7 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
553
553
|
let i, rowDef, staticValues;
|
554
554
|
for(i = 0; i < len; i++) {
|
555
555
|
rowDef = children[i];
|
556
|
-
staticValues = rowDef.
|
556
|
+
staticValues = rowDef._cloneStaticRowData();
|
557
557
|
if(staticValues) {
|
558
558
|
dirty = true;
|
559
559
|
childValues[rowDef.getRic()] = staticValues;
|
@@ -656,15 +656,16 @@ RowDefinition.prototype.getData = function(field) {
|
|
656
656
|
return this._dc ? this._dc.getData(this._dataId, field) : null;
|
657
657
|
};
|
658
658
|
|
659
|
-
/**
|
659
|
+
/** This method replaces all existing static data by the given data -- all existing static data are removed.
|
660
|
+
* @public
|
660
661
|
* @param {Object.<string, *>|Array} data
|
661
|
-
* @param {Array.<string>=}
|
662
|
+
* @param {Array.<string>=} indexToFieldMap In case of the given data is an array, this param will be used for mapping index to field
|
662
663
|
*/
|
663
|
-
RowDefinition.prototype.setStaticRowData = function(data,
|
664
|
+
RowDefinition.prototype.setStaticRowData = function(data, indexToFieldMap) {
|
664
665
|
this._clearStaticData();
|
665
666
|
|
666
667
|
if(Array.isArray(data)) { // Convert array to object
|
667
|
-
data = arrayToObject(data,
|
668
|
+
data = arrayToObject(data, indexToFieldMap);
|
668
669
|
}
|
669
670
|
|
670
671
|
this._staticValues = (typeof data === "object") ? data : null;
|
@@ -676,16 +677,28 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
676
677
|
/** @private
|
677
678
|
* @return {Object.<string, *>}
|
678
679
|
*/
|
679
|
-
RowDefinition.prototype.
|
680
|
+
RowDefinition.prototype._cloneStaticRowData = function() {
|
680
681
|
return this._staticValues ? cloneObject(this._staticValues) : null;
|
681
682
|
};
|
682
683
|
/** @public
|
684
|
+
* @param {string} field
|
685
|
+
* @param {*} value
|
686
|
+
*/
|
687
|
+
RowDefinition.prototype.setStaticData = function(field, value) {
|
688
|
+
if(!this._staticValues) {
|
689
|
+
this._staticValues = {};
|
690
|
+
}
|
691
|
+
this._staticValues[field] = value;
|
692
|
+
|
693
|
+
this.setData(field, value);
|
694
|
+
};
|
695
|
+
/** @public
|
683
696
|
* @param {Object.<string, *>|Array} data
|
684
|
-
* @param {Array.<string>=}
|
697
|
+
* @param {Array.<string>=} indexToFieldMap In case of the given data is an array, this param will be used for mapping index to field
|
685
698
|
*/
|
686
|
-
RowDefinition.prototype.updateRowData = function(data,
|
699
|
+
RowDefinition.prototype.updateRowData = function(data, indexToFieldMap) {
|
687
700
|
if(Array.isArray(data)) { // Convert array to object
|
688
|
-
data = arrayToObject(data,
|
701
|
+
data = arrayToObject(data, indexToFieldMap);
|
689
702
|
}
|
690
703
|
|
691
704
|
if(data) {
|
@@ -693,16 +706,32 @@ RowDefinition.prototype.updateRowData = function(data, opt_fields) {
|
|
693
706
|
}
|
694
707
|
};
|
695
708
|
/** @public
|
696
|
-
* @param {
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
709
|
+
* @param {RowDefinition} srcRowDef Original source of row data to be copied from
|
710
|
+
*/
|
711
|
+
RowDefinition.prototype.copyRowData = function(srcRowDef) {
|
712
|
+
if(srcRowDef && srcRowDef !== this) {
|
713
|
+
let field;
|
714
|
+
let uncopiable_fields = {
|
715
|
+
"ROW_DEF": 1,
|
716
|
+
"SUB_ID": 1
|
717
|
+
};
|
718
|
+
let staticValues = this._staticValues;
|
719
|
+
for(field in staticValues) {
|
720
|
+
uncopiable_fields[field] = 1;
|
721
|
+
}
|
722
|
+
staticValues = srcRowDef._staticValues;
|
723
|
+
for(field in staticValues) {
|
724
|
+
uncopiable_fields[field] = 1;
|
725
|
+
}
|
704
726
|
|
705
|
-
|
727
|
+
let srcRowData = srcRowDef.getRowData();
|
728
|
+
let rowData = this.getRowData();
|
729
|
+
for(field in srcRowData) {
|
730
|
+
if(!uncopiable_fields[field]) {
|
731
|
+
rowData[field] = srcRowData[field]; // There is no dataChanged event fired
|
732
|
+
}
|
733
|
+
}
|
734
|
+
}
|
706
735
|
};
|
707
736
|
/** @public
|
708
737
|
* @param {Object.<string, *>} data
|
@@ -1153,7 +1182,7 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
1153
1182
|
}
|
1154
1183
|
}
|
1155
1184
|
|
1156
|
-
let staticData = this.
|
1185
|
+
let staticData = this._cloneStaticRowData();
|
1157
1186
|
this.unsubscribeForUpdates();
|
1158
1187
|
|
1159
1188
|
// Restore static data
|