@refinitiv-ui/efx-grid 6.0.68 → 6.0.70

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,7 +73,6 @@ declare namespace Grid {
73
73
  contentRightPadding?: number|null,
74
74
  contentBottomPadding?: number|null,
75
75
  dataConflationRate?: number|null,
76
- dataComposed?: ((...params: any[]) => any)|null,
77
76
  autoDateConversion?: boolean|null,
78
77
  textSelect?: boolean|null,
79
78
  lang?: string|null,
@@ -84,7 +83,11 @@ declare namespace Grid {
84
83
  timeSeriesExpansion?: boolean|null,
85
84
  childDataField?: string|null,
86
85
  topSection?: boolean|null,
87
- sorting?: SortableTitlePlugin.Options|null
86
+ sorting?: SortableTitlePlugin.Options|null,
87
+ dataComposed?: ((...params: any[]) => any)|null,
88
+ beforeContentBinding?: ((...params: any[]) => any)|null,
89
+ firstRendered?: ((...params: any[]) => any)|null,
90
+ afterContentBinding?: ((...params: any[]) => any)|null
88
91
  };
89
92
 
90
93
  type RowReference = number|string|RowDefinition|null;
@@ -76,7 +76,6 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
76
76
  * @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
77
77
  * @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
78
78
  * @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
79
- * @property {Function=} dataComposed Handler for dataComposed event
80
79
  * @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
81
80
  * @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
82
81
  * @property {string=} lang laguage for config localization date time, if null the default language is "en"
@@ -88,6 +87,10 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
88
87
  * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
89
88
  * @property {boolean=} topSection=true If disabled, title section will not be rendered
90
89
  * @property {SortableTitlePlugin~Options=} sorting Options for sorting
90
+ * @property {Function=} dataComposed Handler for dataComposed event
91
+ * @property {Function=} beforeContentBinding Handler for beforeContentBinding event
92
+ * @property {Function=} firstRendered Handler for firstRendered event
93
+ * @property {Function=} afterContentBinding Handler for afterContentBinding event
91
94
  */
92
95
 
93
96
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -158,6 +161,16 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
158
161
  * @description Trigger before content binding.
159
162
  */
160
163
 
164
+ /** @event Grid#firstRendered
165
+ * @property {Object} e Event of firstRendered
166
+ * @description This event is triggered when the content is rendered for the first time.
167
+ */
168
+
169
+ /** @event Grid#afterContentBinding
170
+ * @property {Object} e Event of afterContentBinding
171
+ * @description Trigger after content binding.
172
+ */
173
+
161
174
  /** @event Grid#beforeRowRemoved
162
175
  * @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
163
176
  */
@@ -312,7 +325,6 @@ var Grid = function(placeholder, config) {
312
325
  t.updateColumnTitle = t.updateColumnTitle.bind(t);
313
326
  t._populateTimeSeriesChildren = t._populateTimeSeriesChildren.bind(t);
314
327
 
315
- t._onBeforeContentBinding = t._onBeforeContentBinding.bind(t);
316
328
  t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
317
329
  t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
318
330
  t._clearDataUpdates = t._clearDataUpdates.bind(t);
@@ -405,9 +417,11 @@ var Grid = function(placeholder, config) {
405
417
  t._grid.loadPlugin(t._stp, config);
406
418
  }
407
419
 
408
- t._grid.listen("beforeContentBinding", t._onBeforeContentBinding);
420
+ t._grid.listen("beforeContentBinding", t._dispatch.bind(t, "beforeContentBinding"));
409
421
  t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
410
422
  t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
423
+ t._grid.listen("firstRendered", t._dispatch.bind(t, "firstRendered"));
424
+ t._grid.listen("afterContentBinding", t._dispatch.bind(t, "afterContentBinding"));
411
425
 
412
426
  t._grid.enableRowHighlighting(true);
413
427
 
@@ -815,6 +829,7 @@ Grid.prototype.initialize = function(gridOption) {
815
829
  var t = this; // For minimizing file size
816
830
  t._initializing = true;
817
831
  var grid = t._grid; // core grid
832
+ grid.resetInternalState();
818
833
  gridOption = grid.normalizeConfig(gridOption);
819
834
 
820
835
  var exts = gridOption["plugins"] || gridOption["extensions"];
@@ -921,10 +936,10 @@ Grid.prototype.initialize = function(gridOption) {
921
936
  t.listen("rowExpansionBinding", rowExpansionBinding);
922
937
  }
923
938
 
924
- var dataComposedHandler = gridOption["dataComposed"];
925
- if(typeof dataComposedHandler === "function") {
926
- t.listen("dataComposed", dataComposedHandler);
927
- }
939
+ this.addListener(gridOption, "dataComposed");
940
+ this.addListener(gridOption, "beforeContentBinding");
941
+ this.addListener(gridOption, "firstRendered");
942
+ this.addListener(gridOption, "afterContentBinding");
928
943
 
929
944
  if(gridOption["autoDateConversion"]) {
930
945
  t._autoDateConversion = true;
@@ -2580,7 +2595,6 @@ Grid.prototype.removeAllRows = function() {
2580
2595
 
2581
2596
  // TODO: This logic should also be in the core grid
2582
2597
  this._grid.getVScrollbar().setScrollTop(0);
2583
- this._grid.getHScrollbar().setScrollLeft(0);
2584
2598
  };
2585
2599
  /** WARNING: This does not remove data stored in the data cache
2586
2600
  * @private
@@ -3538,13 +3552,6 @@ Grid.prototype._mainSorter = function (rowDefA, rowDefB, order) {
3538
3552
  return this._columnSorter(rowDefA, rowDefB, order);
3539
3553
  };
3540
3554
 
3541
- /** @private
3542
- * @param {Object} e
3543
- */
3544
- Grid.prototype._onBeforeContentBinding = function(e) {
3545
- this._dispatch("beforeContentBinding", e);
3546
- };
3547
-
3548
3555
  /** @private
3549
3556
  * @param {Object} e
3550
3557
  */
@@ -1392,6 +1392,38 @@ ColumnSelectionPlugin.prototype.dispatchSelectionChanged = function () {
1392
1392
  "grid": this._activeGrid
1393
1393
  });
1394
1394
  };
1395
+ /** @public
1396
+ * @description Select a specified column by a simulated mouse click input. This is for testing purpose.
1397
+ * @ignore
1398
+ * @param {number} colIndex
1399
+ * @param {Object=} mouseEvt
1400
+ */
1401
+
1402
+
1403
+ ColumnSelectionPlugin.prototype.selectByMouse = function (colIndex, mouseEvt) {
1404
+ if (!mouseEvt) {
1405
+ mouseEvt = {};
1406
+ }
1407
+
1408
+ mouseEvt.sectionType = "title";
1409
+
1410
+ var eventObj = this._mockMouseEvent(colIndex, 0, mouseEvt);
1411
+
1412
+ this._onClick(eventObj);
1413
+ };
1414
+ /** @public
1415
+ * @description Select a specified column by a keyboard input. This is for testing purpose.
1416
+ * @ignore
1417
+ * @param {number|string} keyCode Use key code number or "left" ,"right" or "tab" string
1418
+ * @param {Object=} keyboardEvt
1419
+ */
1420
+
1421
+
1422
+ ColumnSelectionPlugin.prototype.selectByKey = function (keyCode, keyboardEvt) {
1423
+ var eventObj = this._mockKeyboardEvent(keyCode, keyboardEvt);
1424
+
1425
+ this._onKeyDown(eventObj);
1426
+ };
1395
1427
 
1396
1428
  export default ColumnSelectionPlugin;
1397
1429
  export { ColumnSelectionPlugin, ColumnSelectionPlugin as ColumnSelection, ColumnSelectionPlugin as ColumnSelectionExtension };
@@ -299,14 +299,23 @@ ConditionalColoringPlugin.prototype.config = function (options) {
299
299
  ConditionalColoringPlugin.prototype.getConfigObject = function (gridOptions) {
300
300
  var obj = gridOptions || {};
301
301
 
302
+ var extOptions = obj["conditionalColoring"];
303
+ if(!extOptions) {
304
+ extOptions = obj["conditionalColoring"] = {};
305
+ }
306
+
302
307
  if(this._predefinedColors != null) {
303
- var extOptions = obj["conditionalColoring"];
304
- if(!extOptions) {
305
- extOptions = obj["conditionalColoring"] = {};
306
- }
307
308
  extOptions["predefinedColors"] = this._predefinedColors;
308
309
  }
309
310
 
311
+ if(this._blinkingDuration !== 250) {
312
+ extOptions["blinkingDuration"] = this._blinkingDuration;
313
+ }
314
+
315
+ if(this._insertionBlinking !== false) {
316
+ extOptions["insertionBlinking"] = this._insertionBlinking;
317
+ }
318
+
310
319
  var columns = obj.columns;
311
320
  if (!columns) {
312
321
  columns = obj.columns = [];
@@ -8,7 +8,7 @@ declare class CellWriter extends ElementWrapper {
8
8
 
9
9
  public getContent(): Node|null|null;
10
10
 
11
- public setContent(content: any, opt_tooltip?: boolean): Element|null;
11
+ public setContent(content: any, opt_tooltip?: boolean|null): Element|null;
12
12
 
13
13
  public setTooltip(str: string): void;
14
14
 
@@ -20,7 +20,7 @@ declare class CellWriter extends ElementWrapper {
20
20
 
21
21
  public removeIcon(n: any): void;
22
22
 
23
- public updateIcon(elem: Element): void;
23
+ public updateIcon(elem: Element|null): void;
24
24
 
25
25
  public unlisten(): void;
26
26
 
@@ -36,13 +36,13 @@ declare class CellWriter extends ElementWrapper {
36
36
 
37
37
  public enableClass(str: string, bool: boolean): void;
38
38
 
39
- public insertFloatingIcon(elem: Element, order: number): void;
39
+ public insertFloatingIcon(elem: Element|null, order: number): void;
40
40
 
41
- public removeFloatingIcon(elemRef: string|Element, order: number): void;
41
+ public removeFloatingIcon(elemRef: string|Element|null, order: number): void;
42
42
 
43
43
  public getSection(): null;
44
44
 
45
- public cloak(elem: Element): void;
45
+ public cloak(elem: Element|null): void;
46
46
 
47
47
  }
48
48
 
@@ -10,16 +10,16 @@ var CellWriter = function () {
10
10
  };
11
11
  Ext.inherits(CellWriter, ElementWrapper);
12
12
 
13
- /** @type
14
- * @private
13
+ /** @private
14
+ * @type {Element}
15
15
  */
16
16
  CellWriter.prototype._flexRow = null;
17
- /** @type
18
- * @private
17
+ /** @private
18
+ * @type {Element}
19
19
  */
20
20
  CellWriter.prototype._floatingPanel = null;
21
- /** @type
22
- * @private
21
+ /** @private
22
+ * @type {Element}
23
23
  */
24
24
  CellWriter.prototype._frontPanel = null;
25
25
 
@@ -7,13 +7,13 @@ import { SectionWriter } from "./SectionWriter.js";
7
7
 
8
8
  declare namespace GridPrinter {
9
9
 
10
- function setPrintOptions(options: GridPrinter.Options): void;
10
+ function setPrintOptions(options: GridPrinter.Options|null): void;
11
11
 
12
- function observe(iFrameElement?: HTMLIFrameElement): void;
12
+ function observe(iFrameElement?: HTMLIFrameElement|null): void;
13
13
 
14
14
  function unobserve(): void;
15
15
 
16
- function enableDebugMode(bool?: boolean): void;
16
+ function enableDebugMode(bool?: boolean|null): void;
17
17
 
18
18
  function getPreFlightInfo(grid: any, options?: any): any;
19
19
 
@@ -22,11 +22,12 @@ declare namespace GridPrinter {
22
22
  function print(grid: any): void;
23
23
 
24
24
  type Options = {
25
- pageWidth?: number,
26
- pageHeight?: number,
27
- primaryColumn?: number
25
+ pageWidth?: number|null,
26
+ pageHeight?: number|null,
27
+ primaryColumn?: number|null
28
28
  };
29
29
 
30
30
  }
31
31
 
32
+ export default GridPrinter;
32
33
  export { GridPrinter };
@@ -134,7 +134,7 @@ var _getCoreGrid = function (grid) {
134
134
  return core;
135
135
  };
136
136
 
137
- /** @namespaces
137
+ /** @namespace
138
138
  */
139
139
  var GridPrinter = {};
140
140
  /** @private
@@ -647,7 +647,7 @@ GridPrinter._applyCss = function () {
647
647
  };
648
648
 
649
649
  /** @public
650
- * @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
650
+ * @param {*} grid grid element, currently supports efx-grid, atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
651
651
  */
652
652
  GridPrinter.print = function (grid) {
653
653
  var core = null;
@@ -771,4 +771,6 @@ GridPrinter._onAfterPrint = function (e) {
771
771
  GridPrinter.Options;
772
772
 
773
773
 
774
+
775
+ export default GridPrinter;
774
776
  export { GridPrinter };
@@ -9,7 +9,7 @@ declare class PrintTrait {
9
9
 
10
10
  public static calculateEnvironment(): any;
11
11
 
12
- public observe(iframeElement?: HTMLIFrameElement): void;
12
+ public observe(iframeElement?: HTMLIFrameElement|null): void;
13
13
 
14
14
  public unobserve(): void;
15
15
 
@@ -29,7 +29,7 @@ declare class SectionWriter extends ElementWrapper {
29
29
 
30
30
  public enableRowClass(rowIndex: number, className: string, enabled: boolean): void;
31
31
 
32
- public stretchCell(colIndex: number, rowIndex: number, opt_stretching?: boolean, opt_noLeftStretching?: boolean): void;
32
+ public stretchCell(colIndex: number, rowIndex: number, opt_stretching?: boolean|null, opt_noLeftStretching?: boolean|null): void;
33
33
 
34
34
  public hasCellSpan(): boolean;
35
35
 
@@ -465,6 +465,7 @@ RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
465
465
  if(!extOptions) {
466
466
  extOptions = obj.rowDragging = {};
467
467
  }
468
+ // TODO: should not assign the config object if it's a default value
468
469
  extOptions.dragBox = this._dragBoxEnabled;
469
470
  extOptions.mouseInput = this._mouseInput;
470
471
  extOptions.autoScroll = this._autoScroll;
@@ -474,6 +475,70 @@ RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
474
475
  return obj;
475
476
  };
476
477
 
478
+ /** Drag start to simulate "dragStart" event for testing purpose
479
+ * @ignore
480
+ * @param {number} rowIndex
481
+ * @param {*=} mouseEvt
482
+ */
483
+ RowDraggingPlugin.prototype.dragStart = function (rowIndex, mouseEvt) {
484
+ // dragstart event
485
+ if(!mouseEvt) {
486
+ mouseEvt = {};
487
+ }
488
+ mouseEvt["type"] = "dragstart";
489
+ var core = this._hosts[0];
490
+ var cell = core ? core.getCell("content", 0, rowIndex) : null;
491
+ mouseEvt.target = cell ? cell.getElement() : null;
492
+ this._onMouseDown(mouseEvt);
493
+ this.startDrag(mouseEvt);
494
+ };
495
+
496
+ /** Move mouse to drag cell for testing purpose
497
+ * @public
498
+ * @ignore
499
+ * @param {number} rowIndex
500
+ * @param {*=} mouseEvt
501
+ */
502
+ RowDraggingPlugin.prototype.dragMove = function (rowIndex, mouseEvt) {
503
+ // mousemove, touchmove event
504
+ if(!mouseEvt) {
505
+ mouseEvt = {};
506
+ }
507
+ mouseEvt["type"] = "mousemove";
508
+ mouseEvt["which"] = 1; // Simulation of mouse down and move
509
+ var core = this._hosts[0];
510
+ var cell = core ? core.getCell("content", 0, rowIndex) : null;
511
+ var cellRelativePosition = core.getRelativePosition(cell); // get relative position of cell only when dragging for calculate dragBox
512
+
513
+ mouseEvt.clientX = cellRelativePosition.x;
514
+ mouseEvt.pageY = cellRelativePosition.y;
515
+ mouseEvt.target = cell ? cell.getElement() : null;
516
+ mouseEvt.stopPropagation = function() {};
517
+ mouseEvt.preventDefault = function() {};
518
+ this._onMouseMove(mouseEvt);
519
+
520
+ };
521
+
522
+ /** Mouse up to end of drag for testing purpose
523
+ * @public
524
+ * @ignore
525
+ * @param {number} rowIndex
526
+ * @param {*=} mouseEvt
527
+ */
528
+ RowDraggingPlugin.prototype.dragEnd = function (rowIndex, mouseEvt) {
529
+ // mouseup, touchend, touchcancel event
530
+ if(!mouseEvt) {
531
+ mouseEvt = {};
532
+ }
533
+ mouseEvt["type"] = "mouseup";
534
+ var core = this._hosts[0];
535
+ var cell = core ? core.getCell("content", 0, rowIndex) : null;
536
+ mouseEvt.target = cell ? cell.getElement() : null;
537
+ mouseEvt.stopPropagation = function() {};
538
+ mouseEvt.preventDefault = function() {};
539
+ this._onDragEnd(mouseEvt);
540
+ };
541
+
477
542
  /** @public
478
543
  * @param {*=} startRef
479
544
  */
@@ -113,7 +113,7 @@ declare class RowFilteringPlugin extends GridPlugin {
113
113
 
114
114
  public getColumnFilterStates(): any[];
115
115
 
116
- public getUniqueValues(field: string, formatter?: ((...params: any[]) => any)|null, fmtField?: string|null, rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null): any;
116
+ public getUniqueValues(field: string, formatter?: ((...params: any[]) => any)|null, fmtField?: string|null, rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null, filterFuncs?: ((...params: any[]) => any)|null, selectedItems?: any): any;
117
117
 
118
118
  public openDialog(colIndex: number, runtimeDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null): void;
119
119
 
@@ -123,7 +123,7 @@ declare class RowFilteringPlugin extends GridPlugin {
123
123
 
124
124
  }
125
125
 
126
- declare function field(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
126
+ declare function colSettings(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
127
127
 
128
128
  declare function crf(enabled?: boolean|null): void;
129
129