@refinitiv-ui/efx-grid 6.0.4 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +1 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +1 -1
- package/lib/core/dist/core.js +21 -2
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +2 -0
- package/lib/core/es6/grid/Core.js +8 -2
- package/lib/core/es6/grid/components/Scrollbar.d.ts +2 -0
- package/lib/core/es6/grid/components/Scrollbar.js +13 -0
- package/lib/grid/lib/efx-grid.js +4 -44
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +675 -78
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +7 -0
- package/lib/rt-grid/es6/Grid.js +81 -1
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +121 -15
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +3 -2
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +5 -0
- package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
- package/lib/tr-grid-row-selection/es6/RowSelection.js +14 -10
- package/lib/tr-grid-util/es6/CellPainter.js +1 -1
- package/lib/tr-grid-util/es6/ElementObserver.js +6 -3
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
- package/lib/tr-grid-util/es6/ElfUtil.js +130 -27
- package/lib/types/es6/ConditionalColoring.d.ts +3 -2
- package/lib/types/es6/Core/grid/Core.d.ts +2 -0
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +7 -0
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -0
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -30,6 +30,10 @@ declare namespace Grid {
|
|
30
30
|
debug?: boolean
|
31
31
|
};
|
32
32
|
|
33
|
+
type ADCOptions = {
|
34
|
+
productId?: string
|
35
|
+
};
|
36
|
+
|
33
37
|
type GridOptions = {
|
34
38
|
columns?: (ColumnDefinition.Options|string)[],
|
35
39
|
defaultColumnOptions?: ColumnDefinition.Options,
|
@@ -63,6 +67,7 @@ declare namespace Grid {
|
|
63
67
|
verticalLines?: boolean,
|
64
68
|
horizontalLines?: boolean,
|
65
69
|
RTK?: any,
|
70
|
+
ADC?: Grid.ADCOptions,
|
66
71
|
synapse?: Grid.SynapseConfig,
|
67
72
|
contentRightPadding?: number,
|
68
73
|
contentBottomPadding?: number,
|
@@ -120,6 +125,8 @@ declare class Grid extends EventDispatcher {
|
|
120
125
|
|
121
126
|
public insertColumn(columnOption: ColumnDefinition.Options|string, idx?: number): void;
|
122
127
|
|
128
|
+
public replaceColumn(columnOption: ColumnDefinition.Options|string, colRef: Grid.ColumnReference): void;
|
129
|
+
|
123
130
|
public setColumns(columns: (any)[]): void;
|
124
131
|
|
125
132
|
public setFields(ary: (string)[]): void;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -31,6 +31,11 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
31
31
|
* @property {boolean=} debug=false If true, Synapse response will be mock
|
32
32
|
*/
|
33
33
|
|
34
|
+
/** @typedef {Object} Grid~ADCOptions
|
35
|
+
* @description ADC requesting level config from adc team
|
36
|
+
* @property {string=} productId=001 required parameter, it specifies the product for which you request data. Contact the adc staff to create one.
|
37
|
+
*/
|
38
|
+
|
34
39
|
/** @typedef {Object} Grid~GridOptions
|
35
40
|
* @description Configuration object that can be provided directly at the initialization phase
|
36
41
|
* @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
|
@@ -65,6 +70,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
65
70
|
* @property {boolean=} verticalLines=true Vertical lines for all sections
|
66
71
|
* @property {boolean=} horizontalLines=true Horizontal lines for all sections
|
67
72
|
* @property {*=} RTK=null rtk toolkit instance
|
73
|
+
* @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
|
68
74
|
* @property {Grid~SynapseConfig=} synapse=null synapse config object
|
69
75
|
* @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
|
70
76
|
* @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
|
@@ -455,6 +461,10 @@ Grid.prototype._defaultColumnOptions = null;
|
|
455
461
|
* @type {*}
|
456
462
|
*/
|
457
463
|
Grid.prototype._RTK = null;
|
464
|
+
/** @private
|
465
|
+
* @type {Grid~ADCOptions}
|
466
|
+
*/
|
467
|
+
Grid.prototype._ADCOptions = null;
|
458
468
|
/** use for synapse service
|
459
469
|
* @private
|
460
470
|
* @type {string}
|
@@ -729,6 +739,12 @@ Grid.prototype.initialize = function(gridOption) {
|
|
729
739
|
t._RTK = gridOption["RTK"];
|
730
740
|
t._snapshot.setRTK(t._RTK);
|
731
741
|
}
|
742
|
+
|
743
|
+
if (gridOption["ADC"]) {
|
744
|
+
t._ADCOptions = gridOption["ADC"];
|
745
|
+
t._snapshot.setADCOptions(t._ADCOptions);
|
746
|
+
}
|
747
|
+
|
732
748
|
if (gridOption["synapse"]) {
|
733
749
|
t._synapse = gridOption["synapse"];
|
734
750
|
FieldDefinition.setSynapseConfig(t._synapse);
|
@@ -1084,7 +1100,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1084
1100
|
// topFreezingCount, bottomFreezingCount
|
1085
1101
|
// scrollbarParent
|
1086
1102
|
|
1087
|
-
// NOTE: no need to export synapseApiKey and RTK
|
1103
|
+
// NOTE: no need to export synapseApiKey, ADC and RTK
|
1088
1104
|
|
1089
1105
|
return obj;
|
1090
1106
|
};
|
@@ -1245,6 +1261,70 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
1245
1261
|
};
|
1246
1262
|
|
1247
1263
|
|
1264
|
+
/** @public
|
1265
|
+
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
1266
|
+
* @param {Grid~ColumnReference} colRef
|
1267
|
+
*/
|
1268
|
+
Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
1269
|
+
var colIndex = this.getColumnIndex(colRef);
|
1270
|
+
if(colIndex < 0) {
|
1271
|
+
return;
|
1272
|
+
}
|
1273
|
+
var colConfig = {};
|
1274
|
+
var core = this._grid;
|
1275
|
+
var columnDef = core._getColumnDef(colIndex);
|
1276
|
+
|
1277
|
+
var value = core.getColumnScalability(colIndex);
|
1278
|
+
colConfig["scalable"] = value;
|
1279
|
+
|
1280
|
+
value = core.getColumnCustomLaneSize(colIndex);
|
1281
|
+
colConfig["width"] = value;
|
1282
|
+
|
1283
|
+
value = core.getMinimumColumnWidth(colIndex);
|
1284
|
+
if(value !== 32) {
|
1285
|
+
colConfig["minWidth"] = value;
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
value = core.isColumnVisible(colIndex);
|
1289
|
+
if(!value) {
|
1290
|
+
colConfig["hidden"] = true;
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
value = columnDef["stationary"];
|
1294
|
+
if (value) {
|
1295
|
+
colConfig["stationary"] = value;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
value = columnDef["leftPinned"];
|
1299
|
+
if (value) {
|
1300
|
+
colConfig["leftPinned"] = value;
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
value = columnDef["rightPinned"];
|
1304
|
+
if (value) {
|
1305
|
+
colConfig["rightPinned"] = value;
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
if(typeof columnOption === "string") {
|
1309
|
+
colConfig["field"] = columnOption;
|
1310
|
+
} else { // type object from user
|
1311
|
+
for (var key in columnOption) {
|
1312
|
+
colConfig[key] = columnOption[key];
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
if(columnOption["width"] && !columnOption["scalable"]) {
|
1317
|
+
colConfig["scalable"] = false;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
if(columnOption["scalable"] && !columnOption["width"]) {
|
1321
|
+
colConfig["width"] = 1;
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
this.insertColumn(colConfig, colIndex);
|
1325
|
+
this.removeColumn(colIndex + 1); // remove existing column after insert
|
1326
|
+
};
|
1327
|
+
|
1248
1328
|
/** to update column name when field info is loaded
|
1249
1329
|
* @private
|
1250
1330
|
* @param {string} field
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import Grid from "./Grid.js";
|
1
2
|
import {Ext} from "../../tr-grid-util/es6/Ext.js";
|
2
3
|
import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
|
3
4
|
|
@@ -7,6 +8,8 @@ declare class SnapshotFiller extends EventDispatcher {
|
|
7
8
|
|
8
9
|
public setRTK(rtk: any): void;
|
9
10
|
|
11
|
+
public setADCOptions(adcOptions: Grid.ADCOptions): void;
|
12
|
+
|
10
13
|
public addRic(ric: string): void;
|
11
14
|
|
12
15
|
public addRics(rics: (string)[]): boolean;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
import Grid from "./Grid.js";
|
1
3
|
import {Ext} from "../../tr-grid-util/es6/Ext.js";
|
2
4
|
import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
|
3
5
|
|
@@ -21,6 +23,9 @@ var SnapshotFiller = function () {
|
|
21
23
|
|
22
24
|
this._rics = {};
|
23
25
|
this._fields = {};
|
26
|
+
this._adcOptions = { // TODO: support requesting level parameter
|
27
|
+
productId: "001"
|
28
|
+
};
|
24
29
|
};
|
25
30
|
Ext.inherits(SnapshotFiller, EventDispatcher);
|
26
31
|
|
@@ -41,6 +46,10 @@ SnapshotFiller.prototype._fields;
|
|
41
46
|
* @private
|
42
47
|
*/
|
43
48
|
SnapshotFiller.prototype._rtk;
|
49
|
+
/** @type {!Grid~ADCOptions}
|
50
|
+
* @private
|
51
|
+
*/
|
52
|
+
SnapshotFiller.prototype._adcOptions = null;
|
44
53
|
//#endregion Private Members
|
45
54
|
|
46
55
|
/** @public
|
@@ -50,6 +59,26 @@ SnapshotFiller.prototype.setRTK = function (rtk) {
|
|
50
59
|
this._rtk = rtk;
|
51
60
|
};
|
52
61
|
|
62
|
+
/** @public
|
63
|
+
* @param {Grid~ADCOptions} adcOptions ADC requesting level parameter options
|
64
|
+
*/
|
65
|
+
SnapshotFiller.prototype.setADCOptions = function (adcOptions) {
|
66
|
+
|
67
|
+
var val = adcOptions["productId"];
|
68
|
+
if(val) {
|
69
|
+
this._adcOptions.productId = val;
|
70
|
+
}
|
71
|
+
// TODO: support requesting level parameter https://confluence.refinitiv.com/display/ADC/Request+level+parameters
|
72
|
+
// var val = adcOptions["lang"];
|
73
|
+
// if(val) {
|
74
|
+
// this._adcOptions.lang = val;
|
75
|
+
// }
|
76
|
+
// var val = adcOptions["cache"];
|
77
|
+
// if(val) {
|
78
|
+
// this._adcOptions.cache = val;
|
79
|
+
// }
|
80
|
+
};
|
81
|
+
|
53
82
|
/** @public
|
54
83
|
* @param {string} ric
|
55
84
|
*/
|
@@ -167,29 +196,37 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
167
196
|
return;
|
168
197
|
}
|
169
198
|
|
170
|
-
var reqFields = [];
|
171
|
-
for(i = 0; i < fieldLen; i++) {
|
172
|
-
reqFields.push({ "name": fields[i] });
|
173
|
-
}
|
174
|
-
|
175
199
|
// Clean up members, preparing for the next request
|
176
200
|
this._rics = {};
|
177
201
|
this._fields = {};
|
178
202
|
|
179
|
-
var payload
|
180
|
-
"instruments": instruments,
|
181
|
-
"fields": reqFields
|
182
|
-
};
|
183
|
-
|
184
|
-
var onSuccess = this._onSuccess.bind(this, fields);
|
203
|
+
var onSuccess, payload;
|
185
204
|
if (this._rtk) {
|
186
|
-
|
205
|
+
var strFields = fields.join(',');
|
206
|
+
payload = {
|
207
|
+
"method": "select",
|
208
|
+
"formula": strFields,
|
209
|
+
"identifiers": instruments,
|
210
|
+
"productId": this._adcOptions.productId,
|
211
|
+
"output": "Col,In,va,T,NoEmptyTickers" // For customize output server, for more information please visit "https://confluence.refinitiv.com/display/ADC/Data+Cloud+Output+Format"
|
212
|
+
};
|
213
|
+
onSuccess = this._onRTKSuccess.bind(this, fields);
|
214
|
+
this._rtk.Data.Adc
|
187
215
|
.request(payload)
|
188
216
|
.then(onSuccess)
|
189
217
|
.catch(function (err) {
|
190
218
|
console.log(err);
|
191
219
|
});
|
192
220
|
} else {
|
221
|
+
var reqFields = [];
|
222
|
+
for(i = 0; i < fieldLen; i++) {
|
223
|
+
reqFields.push({ "name": fields[i] });
|
224
|
+
}
|
225
|
+
payload = {
|
226
|
+
"instruments": instruments,
|
227
|
+
"fields": reqFields
|
228
|
+
};
|
229
|
+
onSuccess = this._onJETSuccess.bind(this, fields);
|
193
230
|
jet["Data"]("datagrid")
|
194
231
|
.then(function (service) { return service["request"](payload); })
|
195
232
|
.then(JSON.parse)
|
@@ -205,16 +242,15 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
205
242
|
* @param {Array.<string>} fields
|
206
243
|
* @param {string} serverResult
|
207
244
|
*/
|
208
|
-
SnapshotFiller.prototype.
|
245
|
+
SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
246
|
+
this._dispatch("adcDataReceived", serverResult);
|
209
247
|
var data2D = serverResult["data"];
|
210
248
|
var svHeaders = serverResult["headers"] && serverResult["headers"][0];
|
211
249
|
|
212
250
|
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
213
|
-
console.log("Invalid server response detected");
|
214
251
|
return; //TODO: Return Promise.reject(errMsg);
|
215
252
|
}
|
216
253
|
|
217
|
-
this._dispatch("adcDataReceived", serverResult);
|
218
254
|
|
219
255
|
// Server will return field only in UPPERCASE
|
220
256
|
// ex. requestField = TR.Volume ===> serverField = TR.VOLUME
|
@@ -271,5 +307,75 @@ SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
|
|
271
307
|
});
|
272
308
|
};
|
273
309
|
|
310
|
+
/** @private
|
311
|
+
* @function
|
312
|
+
* @param {Array.<string>} fields
|
313
|
+
* @param {string} serverResult
|
314
|
+
*/
|
315
|
+
SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
316
|
+
this._dispatch("adcDataReceived", serverResult);
|
317
|
+
var data2D = serverResult["rows"];
|
318
|
+
var svHeaders = serverResult["rows"] && serverResult["rows"][0];
|
319
|
+
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
320
|
+
return; //TODO: Return Promise.reject(errMsg);
|
321
|
+
}
|
322
|
+
|
323
|
+
// Server will return field only in UPPERCASE
|
324
|
+
// ex. requestField = TR.Volume ===> serverField = TR.VOLUME
|
325
|
+
// so we need convert UPPERCASE to be original
|
326
|
+
var i, field, ric;
|
327
|
+
var j = 1; // to skip instrument index, use j = 1
|
328
|
+
var fLength = fields.length;
|
329
|
+
var hLength = svHeaders.length;
|
330
|
+
var headers = new Array(hLength);
|
331
|
+
for (i = 0; i < fLength && j < hLength; i++) {
|
332
|
+
field = fields[i];
|
333
|
+
if (svHeaders[j].r.toUpperCase() === field.toUpperCase()) {
|
334
|
+
headers[j] = field;
|
335
|
+
j++;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
var len = data2D.length;
|
340
|
+
var fieldLen = headers.length;
|
341
|
+
var ricMap = {};
|
342
|
+
|
343
|
+
// TODO: Freeze the data view before setting multiple data
|
344
|
+
for (i = 1; i < len; i++) { // to skip column header index, use i = 1
|
345
|
+
var dataRow = data2D[i];
|
346
|
+
ric = dataRow[0];
|
347
|
+
|
348
|
+
var snapData = ricMap[ric] = {};
|
349
|
+
|
350
|
+
// loop for create rowData for update
|
351
|
+
for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
|
352
|
+
var value = dataRow[j];
|
353
|
+
if (value != null && value !== "") {
|
354
|
+
if(typeof value !== 'object') {
|
355
|
+
field = headers[j];
|
356
|
+
snapData[field] = value;
|
357
|
+
}
|
358
|
+
// TODO : handled when a cell has a mistake and the value appears as {f: "1"} ( description error in fault attribute at index 1 ),
|
359
|
+
// Therefore, we need to store information to the error field for this cell.
|
360
|
+
// else {}
|
361
|
+
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
// return result only ric that has update data
|
367
|
+
var updatedData = {};
|
368
|
+
for (ric in ricMap) {
|
369
|
+
var obj = ricMap[ric];
|
370
|
+
if (!isEmptyObject(obj)) {
|
371
|
+
updatedData[ric] = obj;
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
this._dispatch("dataChanged", {
|
376
|
+
data: updatedData
|
377
|
+
});
|
378
|
+
};
|
379
|
+
|
274
380
|
export { SnapshotFiller };
|
275
381
|
export default SnapshotFiller;
|
@@ -3,6 +3,7 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
|
|
3
3
|
import { extendObject } from '../../tr-grid-util/es6/Util.js';
|
4
4
|
import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
|
5
5
|
import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
|
6
|
+
import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
6
7
|
|
7
8
|
declare namespace ConditionalColoringPlugin {
|
8
9
|
|
@@ -54,7 +55,7 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
54
55
|
|
55
56
|
public blinkRow(rowIndex: number, blinkSignal: number, host?: any): void;
|
56
57
|
|
57
|
-
public getColumnPainter(colIndex: number): CellPainter;
|
58
|
+
public getColumnPainter(colIndex: number): CellPainter|null;
|
58
59
|
|
59
60
|
public applyColor(colIndex: number, cell: any, rowData?: any): void;
|
60
61
|
|
@@ -62,7 +63,7 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
62
63
|
|
63
64
|
public static setThemeColors(colors: { [key: string]: string }): void;
|
64
65
|
|
65
|
-
public reloadThemeColors(): Promise<any
|
66
|
+
public reloadThemeColors(): Promise<any>|null;
|
66
67
|
|
67
68
|
}
|
68
69
|
|
@@ -3,6 +3,7 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
|
|
3
3
|
import { extendObject } from '../../tr-grid-util/es6/Util.js';
|
4
4
|
import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
|
5
5
|
import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
|
6
|
+
import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
6
7
|
|
7
8
|
/** @typedef {Object} ConditionalColoringPlugin~ColumnOptions
|
8
9
|
* @description Extension column options that can be specified on each individual grid's column option:
|
@@ -97,6 +98,10 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
97
98
|
if (!CellPainter.themeReady) {
|
98
99
|
CellPainter.loadThemeColors().then(this._onThemeLoaded);
|
99
100
|
}
|
101
|
+
|
102
|
+
// Register callback for movement-color-profile attribute changed event
|
103
|
+
ElfUtil.getThemeColors(this._onThemeLoaded);
|
104
|
+
|
100
105
|
// In case of lazy loading
|
101
106
|
// DO something
|
102
107
|
};
|
@@ -130,7 +130,7 @@ PercentBarPlugin.prototype.initialize = function (host, options) {
|
|
130
130
|
|
131
131
|
if (!PercentBarPlugin._themeLoaded && !this._themeLoading) {
|
132
132
|
this._themeLoading = true;
|
133
|
-
ElfUtil.getThemeColors().then(this._onThemeLoaded);
|
133
|
+
ElfUtil.getThemeColors(this._onThemeLoaded).then(this._onThemeLoaded);
|
134
134
|
}
|
135
135
|
};
|
136
136
|
/** @override */
|
@@ -50,7 +50,6 @@ var RowSelectionPlugin = function (options) {
|
|
50
50
|
t._updateMenuIcon = t._updateMenuIcon.bind(t);
|
51
51
|
|
52
52
|
t._hosts = [];
|
53
|
-
t._anchorRowDict = {};
|
54
53
|
t._isIE = isIE();
|
55
54
|
t._textRange = document.createRange();
|
56
55
|
|
@@ -94,11 +93,11 @@ RowSelectionPlugin.prototype._basedOnContent = false;
|
|
94
93
|
* @private
|
95
94
|
*/
|
96
95
|
RowSelectionPlugin.prototype._selectionField = "SELECTED_ROW";
|
97
|
-
/** @type {
|
96
|
+
/** @type {string}
|
98
97
|
* @private
|
99
98
|
* @description use with _basedOnContent mode for tracking current anchor row
|
100
99
|
*/
|
101
|
-
RowSelectionPlugin.prototype.
|
100
|
+
RowSelectionPlugin.prototype._anchorRowId = "";
|
102
101
|
/** @type {boolean}
|
103
102
|
* @private
|
104
103
|
*/
|
@@ -367,13 +366,18 @@ RowSelectionPlugin.prototype.getActiveGrid = function () {
|
|
367
366
|
* @return {number} rowIndex of anchor
|
368
367
|
*/
|
369
368
|
RowSelectionPlugin.prototype.getRowAnchor = function (sectRef) {
|
370
|
-
var section = this._getSection(sectRef);
|
371
|
-
if (!section || !section.getRowAnchor) return -1;
|
372
369
|
if (this._basedOnContent) {
|
373
|
-
|
370
|
+
var dv = this._activeGrid ? this._activeGrid.getDataSource() : null;
|
371
|
+
if( dv && this._anchorRowId){
|
372
|
+
return dv.getRowIndex(this._anchorRowId);
|
373
|
+
}
|
374
374
|
} else {
|
375
|
-
|
375
|
+
var section = this._getSection(sectRef);
|
376
|
+
if (section && section.getRowAnchor){
|
377
|
+
return section.getRowAnchor();
|
378
|
+
}
|
376
379
|
}
|
380
|
+
return -1;
|
377
381
|
};
|
378
382
|
|
379
383
|
/** @public
|
@@ -868,7 +872,7 @@ RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
|
|
868
872
|
|
869
873
|
var fromR = section.getFirstIndexInView();
|
870
874
|
var toR = section.getLastIndexInView();
|
871
|
-
for (var r = fromR; r
|
875
|
+
for (var r = fromR; r <= toR; ++r) {
|
872
876
|
var dataRow = this._rowGetter(dv.getRowDataAt(r));
|
873
877
|
if(dataRow) {
|
874
878
|
if(dataRow[field]) {
|
@@ -1084,7 +1088,7 @@ RowSelectionPlugin.prototype._sectionSetSelectedRow = function (section, rowInde
|
|
1084
1088
|
var dataRow = this._getRow(dv, rowIndex);
|
1085
1089
|
if (dataRow) {
|
1086
1090
|
this._setData(dv, rowIndex, this._selectionField, isSelect);
|
1087
|
-
if (isSelect) this.
|
1091
|
+
if (isSelect) this._anchorRowId = dv.getRowId(rowIndex);
|
1088
1092
|
}
|
1089
1093
|
}
|
1090
1094
|
} else {
|
@@ -1142,7 +1146,7 @@ RowSelectionPlugin.prototype._sectionClearSelectedRows = function (section, pres
|
|
1142
1146
|
}
|
1143
1147
|
}
|
1144
1148
|
if (!preserveAnchor) {
|
1145
|
-
this.
|
1149
|
+
this._anchorRowId = "";
|
1146
1150
|
}
|
1147
1151
|
} else {
|
1148
1152
|
section.clearSelectedRows();
|
@@ -840,7 +840,7 @@ CellPainter._onThemeChanged = function(colors) {
|
|
840
840
|
*/
|
841
841
|
CellPainter.loadThemeColors = function() {
|
842
842
|
if(!CellPainter.themeReady) {
|
843
|
-
CellPainter.themeReady = ElfUtil.getThemeColors().then(CellPainter._onThemeChanged);
|
843
|
+
CellPainter.themeReady = ElfUtil.getThemeColors(CellPainter._onThemeChanged).then(CellPainter._onThemeChanged);
|
844
844
|
}
|
845
845
|
return CellPainter.themeReady;
|
846
846
|
};
|
@@ -22,10 +22,10 @@ var _onAttributeMutated = function (listener, attributeName, mutation) {
|
|
22
22
|
if (mutation.type === "attributes") {
|
23
23
|
if (attributeName != null) {
|
24
24
|
if (mutation.attributeName === attributeName) {
|
25
|
-
listener(mutation);
|
25
|
+
listener(mutation.target.getAttribute(attributeName));
|
26
26
|
}
|
27
27
|
} else {
|
28
|
-
listener(mutation);
|
28
|
+
listener(mutation.target);
|
29
29
|
}
|
30
30
|
}
|
31
31
|
};
|
@@ -78,9 +78,12 @@ ElementObserver._addListener = function(elem, fn) {
|
|
78
78
|
}
|
79
79
|
if (!elem._observeId) {
|
80
80
|
var id = ElementObserver._getNewId();
|
81
|
-
listeners[id] = [];
|
82
81
|
elem._observeId = id;
|
83
82
|
}
|
83
|
+
if (!listeners[elem._observeId]) { // Always check to support the using of separated ElfUtil module in testing page
|
84
|
+
listeners[elem._observeId] = [];
|
85
|
+
}
|
86
|
+
|
84
87
|
var listener = listeners[elem._observeId];
|
85
88
|
if (listener.indexOf(fn) < 0) {
|
86
89
|
listener.push(fn);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { nestedObjectToArray, rgb2Hex } from "./Util.js";
|
2
2
|
import { Deferred } from "./Deferred.js";
|
3
|
+
import { ElementObserver } from "./ElementObserver.js";
|
3
4
|
|
4
5
|
declare namespace ElfUtil {
|
5
6
|
|
@@ -23,10 +24,12 @@ declare namespace ElfUtil {
|
|
23
24
|
|
24
25
|
function prepareIconPreloading(): (string)[]|null;
|
25
26
|
|
26
|
-
function
|
27
|
+
function setRTK(rtk: any): void;
|
27
28
|
|
28
29
|
function getMovementColorProfile(): string;
|
29
30
|
|
31
|
+
function getThemeColors(themeChangedCb?: ((...params: any[]) => any)): Promise<any>|null;
|
32
|
+
|
30
33
|
}
|
31
34
|
|
32
35
|
export default ElfUtil;
|