@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.
Files changed (32) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +1 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +1 -1
  3. package/lib/core/dist/core.js +21 -2
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/grid/Core.d.ts +2 -0
  6. package/lib/core/es6/grid/Core.js +8 -2
  7. package/lib/core/es6/grid/components/Scrollbar.d.ts +2 -0
  8. package/lib/core/es6/grid/components/Scrollbar.js +13 -0
  9. package/lib/grid/lib/efx-grid.js +4 -44
  10. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  11. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/rt-grid/dist/rt-grid.js +675 -78
  13. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  14. package/lib/rt-grid/es6/Grid.d.ts +7 -0
  15. package/lib/rt-grid/es6/Grid.js +81 -1
  16. package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -0
  17. package/lib/rt-grid/es6/SnapshotFiller.js +121 -15
  18. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +3 -2
  19. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +5 -0
  20. package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
  21. package/lib/tr-grid-row-selection/es6/RowSelection.js +14 -10
  22. package/lib/tr-grid-util/es6/CellPainter.js +1 -1
  23. package/lib/tr-grid-util/es6/ElementObserver.js +6 -3
  24. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
  25. package/lib/tr-grid-util/es6/ElfUtil.js +130 -27
  26. package/lib/types/es6/ConditionalColoring.d.ts +3 -2
  27. package/lib/types/es6/Core/grid/Core.d.ts +2 -0
  28. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +2 -0
  29. package/lib/types/es6/RealtimeGrid/Grid.d.ts +7 -0
  30. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -0
  31. package/lib/versions.json +4 -4
  32. package/package.json +1 -1
@@ -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
  /** Dialog supporting language (selection dialog, formater dialog and filter dialog)
5
6
  * @type {!Object.<string, boolean>}
@@ -63,6 +64,22 @@ ElfUtil._dummyIcon = null;
63
64
  * @private
64
65
  */
65
66
  ElfUtil._iconLoaded = false;
67
+ /** @type {string|null}
68
+ * @private
69
+ */
70
+ ElfUtil._profileName = null;
71
+ /** @type {Array}
72
+ * @private
73
+ */
74
+ ElfUtil._callbacks = [];
75
+ /** @type {boolean}
76
+ * @private
77
+ */
78
+ ElfUtil._observed = false;
79
+ /** @type {boolean}
80
+ * @private
81
+ */
82
+ ElfUtil._pendingResolve = false;
66
83
 
67
84
  /** @type {Object.<string, Object>}
68
85
  * @private
@@ -334,57 +351,146 @@ ElfUtil.getCssVariables = function (obj, optElem) {
334
351
  return obj || null;
335
352
  };
336
353
 
354
+ /** @public
355
+ * @param {Object} rtk
356
+ */
357
+ ElfUtil.setRTK = function(rtk) {
358
+ if(rtk != null) {
359
+ ElfUtil._rtk = rtk;
360
+ }
361
+ };
362
+
363
+ /** Get current profile name set on the root html element (document.documentElement)
364
+ * @public
365
+ * @return {string} Current profile name
366
+ */
367
+ ElfUtil.getMovementColorProfile = function() {
368
+ return document.documentElement.getAttribute("movement-color-profile");
369
+ };
370
+
371
+ /** @private
372
+ * @param {Function} cb
373
+ */
374
+ ElfUtil._addThemeChangedCallback = function(cb) {
375
+ var callbacks = ElfUtil._callbacks;
376
+ if(callbacks.indexOf(cb) < 0) {
377
+ callbacks.push(cb);
378
+ }
379
+ };
380
+
337
381
  /** Gets current theme colors from the document and returns a promise. <br>
338
- * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists. <br>
382
+ * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists or RTK is available. <br>
339
383
  * To re-request/reset theme colors, set ElfUtil.themeReady variable to null
340
384
  * @public
385
+ * @param {Function=} themeChangedCb
341
386
  * @return {Promise<Object>} A promise of object of theme colors
342
387
  */
343
- ElfUtil.getThemeColors = function() {
388
+ ElfUtil.getThemeColors = function(themeChangedCb) {
389
+ if(typeof themeChangedCb === "function") {
390
+ ElfUtil._addThemeChangedCallback(themeChangedCb);
391
+ }
392
+
344
393
  if(ElfUtil.themeReady) {
345
394
  return ElfUtil.themeReady;
346
395
  }
396
+
347
397
  var d = ElfUtil._deferred = new Deferred();
348
398
  ElfUtil.themeReady = d.promise;
349
399
 
350
- var jet = window ? window.JET : null;
351
- if(jet && jet.Settings) {
352
- try {
353
- jet.Settings.read(ElfUtil._onColorProfile, {
354
- providerName: "Configuration",
355
- settingName: "RDE_USER_CURRENT_TICK_COLOR"
356
- });
357
- } catch (err) {
358
- d.reject("Cannot read JET's settings");
400
+ var profileName = ElfUtil.getMovementColorProfile();
401
+ if(profileName) {
402
+ if(profileName !== ElfUtil._profileName) {
403
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
404
+ } else {
405
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
359
406
  }
360
407
  } else {
361
- setTimeout(ElfUtil._retrieveThemeColors, 100); // TODO: Find a proper way to ensure that theme is ready
408
+ var options = {
409
+ providerName: "Configuration",
410
+ settingName: "RDE_USER_CURRENT_TICK_COLOR"
411
+ };
412
+
413
+ var jet = window ? window.JET : null;
414
+ if(ElfUtil._rtk && ElfUtil._rtk.Settings) {
415
+ ElfUtil._rtk.Settings.getAsync(options).then(ElfUtil._loadingProfileSuccess, ElfUtil._loadingProfileFailure);
416
+ } else if(jet && jet.Settings) {
417
+ try {
418
+ jet.Settings.read(ElfUtil._loadingProfileSuccess, options);
419
+ } catch (err) {
420
+ ElfUtil._loadingProfileFailure();
421
+ }
422
+ } else {
423
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
424
+ }
362
425
  }
426
+
363
427
  return d.promise;
364
428
  };
365
429
 
366
- /** Get user's color profile from JET and set it to html tag (document.documentElement)
430
+ /** @private
431
+ * @param {string} profileName
432
+ */
433
+ var movementColorProfileChanged = function(profileName) {
434
+ if(profileName && profileName !== ElfUtil._profileName) {
435
+ ElfUtil._retrieveThemeColors(profileName);
436
+
437
+ if(ElfUtil._pendingResolve) {
438
+ ElfUtil._pendingResolve = false;
439
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
440
+ }
441
+
442
+ var callbacks = ElfUtil._callbacks;
443
+ for (var i = 0; i < callbacks.length; i++) {
444
+ callbacks[i]();
445
+ }
446
+ }
447
+ };
448
+
449
+ /** Get user's color profile from JET or TRK and set it to html tag (document.documentElement)
367
450
  * @private
368
- * @param {string} colorProfile Returned from JET.Settings
451
+ * @param {string} profileName Returned from JET.Settings or RTK.Settings
369
452
  */
370
- ElfUtil._onColorProfile = function (colorProfile) {
371
- if(colorProfile) {
372
- document.documentElement.setAttribute("movement-color-profile", colorProfile.toLowerCase());
453
+ ElfUtil._loadingProfileSuccess = function(profileName) {
454
+ if(profileName) {
455
+ document.documentElement.setAttribute("movement-color-profile", profileName.toLowerCase());
456
+ }
457
+
458
+ if(ElfUtil._observed) { // Let attribute listener does the job
459
+ ElfUtil._pendingResolve = true;
460
+ } else {
461
+ ElfUtil._profileNameRetrieved(profileName);
373
462
  }
374
- ElfUtil._retrieveThemeColors();
375
463
  };
376
- /** Get current profile name set on the root html element (document.documentElement)
377
- * @public
378
- * @return {string} Current profile name
464
+
465
+ /** @private
379
466
  */
380
- ElfUtil.getMovementColorProfile = function() {
381
- return document.documentElement.getAttribute("movement-color-profile");
467
+ ElfUtil._loadingProfileFailure = function() {
468
+ if(!ElfUtil._observed) {
469
+ ElfUtil._observed = true;
470
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
471
+ }
472
+ ElfUtil._deferred.reject("Failed to get movement color profile from settings.");
473
+ };
474
+
475
+ /** @private
476
+ */
477
+ ElfUtil._profileNameRetrieved = function() {
478
+ var profileName = ElfUtil.getMovementColorProfile();
479
+ ElfUtil._retrieveThemeColors(profileName);
480
+ if(!ElfUtil._observed) {
481
+ ElfUtil._observed = true;
482
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
483
+ }
484
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
382
485
  };
383
486
 
384
487
  /** Get theme colors from document
385
488
  * @private
489
+ * @param {string} profileName Movement color profile name
386
490
  */
387
- ElfUtil._retrieveThemeColors = function() {
491
+ ElfUtil._retrieveThemeColors = function(profileName) {
492
+ ElfUtil._profileName = profileName;
493
+
388
494
  var colors = ElfUtil.themeColors = ElfUtil.getCssVariables({
389
495
  "primary": "--color-scheme-primary", // Usually used in headers, and selection
390
496
  "secondary": "--color-scheme-secondary",
@@ -449,10 +555,7 @@ ElfUtil._retrieveThemeColors = function() {
449
555
  colors["baseGrid"] = colors["tableBg"];
450
556
  colors["baseText"] = colors["tableText"];
451
557
  colors["trackColor"] = colors["primary"] || ElfUtil._defaultColors["trackColor"];
452
-
453
- ElfUtil._deferred.resolve(colors);
454
558
  };
455
559
 
456
-
457
560
  export default ElfUtil;
458
561
  export { ElfUtil };
@@ -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
 
@@ -328,6 +328,8 @@ declare class Core extends ElementWrapper {
328
328
 
329
329
  public getScrollHeight(): number;
330
330
 
331
+ public restoreScrollbars(): void;
332
+
331
333
  public getRowVirtualizer(): Virtualizer;
332
334
 
333
335
  public getColumnVirtualizer(): Virtualizer;
@@ -55,6 +55,8 @@ declare class Scrollbar extends ElementWrapper {
55
55
 
56
56
  public freezeScrolling(frozen?: boolean): boolean;
57
57
 
58
+ public restoreTrackPosition(): void;
59
+
58
60
  }
59
61
 
60
62
  export default Scrollbar;
@@ -32,6 +32,10 @@ declare namespace Grid {
32
32
  debug?: boolean
33
33
  };
34
34
 
35
+ type ADCOptions = {
36
+ productId?: string
37
+ };
38
+
35
39
  type GridOptions = ExtensionOptions & {
36
40
  columns?: (ColumnDefinition.Options|string)[],
37
41
  defaultColumnOptions?: ColumnDefinition.Options,
@@ -65,6 +69,7 @@ declare namespace Grid {
65
69
  verticalLines?: boolean,
66
70
  horizontalLines?: boolean,
67
71
  RTK?: any,
72
+ ADC?: Grid.ADCOptions,
68
73
  synapse?: Grid.SynapseConfig,
69
74
  contentRightPadding?: number,
70
75
  contentBottomPadding?: number,
@@ -122,6 +127,8 @@ declare class Grid extends EventDispatcher {
122
127
 
123
128
  public insertColumn(columnOption: ColumnDefinition.Options|string, idx?: number): void;
124
129
 
130
+ public replaceColumn(columnOption: ColumnDefinition.Options|string, colRef: Grid.ColumnReference): void;
131
+
125
132
  public setColumns(columns: (any)[]): void;
126
133
 
127
134
  public setFields(ary: (string)[]): void;
@@ -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;
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.56",
2
+ "tr-grid-util": "1.3.58",
3
3
  "@grid/column-dragging": "1.0.6",
4
4
  "@grid/row-segmenting": "1.0.14",
5
5
  "@grid/statistics-row": "1.0.13",
@@ -13,20 +13,20 @@
13
13
  "tr-grid-column-resizing": "1.0.25",
14
14
  "tr-grid-column-selection": "1.0.24",
15
15
  "tr-grid-column-stack": "1.0.34",
16
- "tr-grid-conditional-coloring": "1.0.52",
16
+ "tr-grid-conditional-coloring": "1.0.53",
17
17
  "tr-grid-content-wrap": "1.0.18",
18
18
  "tr-grid-contextmenu": "1.0.37",
19
19
  "tr-grid-filter-input": "0.9.28",
20
20
  "tr-grid-heat-map": "1.0.27",
21
21
  "tr-grid-in-cell-editing": "1.0.66",
22
22
  "tr-grid-pagination": "1.0.23",
23
- "tr-grid-percent-bar": "1.0.20",
23
+ "tr-grid-percent-bar": "1.0.21",
24
24
  "tr-grid-printer": "1.0.15",
25
25
  "tr-grid-range-bar": "1.0.8",
26
26
  "tr-grid-row-dragging": "1.0.21",
27
27
  "tr-grid-row-filtering": "1.0.49",
28
28
  "tr-grid-row-grouping": "1.0.76",
29
- "tr-grid-row-selection": "1.0.18",
29
+ "tr-grid-row-selection": "1.0.20",
30
30
  "tr-grid-rowcoloring": "1.0.19",
31
31
  "tr-grid-textformatting": "1.0.44",
32
32
  "tr-grid-titlewrap": "1.0.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/efx-grid",
3
- "version": "6.0.4",
3
+ "version": "6.0.5",
4
4
  "description": "Grid Components Library",
5
5
  "author": "Refinitiv",
6
6
  "license": "SEE LICENSE IN LICENSE",