@refinitiv-ui/efx-grid 6.0.37 → 6.0.39

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 (31) hide show
  1. package/lib/core/dist/core.js +165 -20
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.d.ts +2 -0
  4. package/lib/core/es6/grid/Core.js +62 -5
  5. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -0
  6. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +41 -7
  7. package/lib/core/es6/grid/util/TrackLayout.d.ts +3 -1
  8. package/lib/core/es6/grid/util/TrackLayout.js +23 -5
  9. package/lib/grid/index.js +1 -1
  10. package/lib/rt-grid/dist/rt-grid.js +158 -48
  11. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  12. package/lib/rt-grid/es6/ColumnDefinition.js +4 -3
  13. package/lib/rt-grid/es6/Grid.d.ts +1 -1
  14. package/lib/rt-grid/es6/Grid.js +63 -29
  15. package/lib/rt-grid/es6/RowDefinition.js +6 -6
  16. package/lib/tr-grid-cell-selection/es6/CellSelection.js +180 -421
  17. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +221 -2
  19. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +7 -1
  20. package/lib/tr-grid-column-stack/es6/ColumnStack.js +281 -69
  21. package/lib/tr-grid-row-dragging/es6/RowDragging.js +83 -3
  22. package/lib/tr-grid-row-selection/es6/RowSelection.js +18 -40
  23. package/lib/tr-grid-util/es6/GridPlugin.js +91 -42
  24. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  25. package/lib/types/es6/ColumnStack.d.ts +7 -1
  26. package/lib/types/es6/Core/grid/Core.d.ts +2 -0
  27. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +3 -1
  28. package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
  29. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  30. package/lib/versions.json +6 -6
  31. package/package.json +1 -1
@@ -968,49 +968,27 @@ RowSelectionPlugin.prototype._getSection = function (sectRef) {
968
968
  * @param {boolean=} preserveAnchor
969
969
  */
970
970
  RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { // Slow
971
- var i;
972
- if (this._activeGrid) {
973
- if (this._basedOnContent) {
974
- var dv = this._activeGrid.getDataSource();
975
- if (dv) {
976
- var rids = dv.getVisibleRowIds(true);
977
- var rows = dv.getMultipleRowData(rids);
978
- var valueList = [];
979
- var ridList = [];
980
- var dataRow, firstIndex;
981
- var len = rows.length;
982
- for (i = 0; i < len; i++) {
983
- dataRow = this._rowGetter(rows[i]);
984
- if (dataRow && dataRow[this._selectionField]) {
985
- valueList.push(false);
986
- ridList.push(rids[i]);
987
- if (firstIndex == null) {
988
- firstIndex = i;
989
- }
990
- }
991
- }
992
-
993
- len = valueList.length;
994
- if (len === 1) {
995
- // use setData for better optimization in case update only one row
996
- this._setData(dv, firstIndex, this._selectionField, valueList[0]);
997
- } else if (len > 1) {
998
- this._setColumnData(dv, this._selectionField, valueList, ridList);
999
- }
1000
- }
1001
- } else {
1002
- var sections = this._activeGrid.getAllSections("content");
1003
- for (i = sections.length; --i >= 0;) {
1004
- this._sectionClearSelectedRows(sections[i], preserveAnchor);
1005
- }
971
+ if (!this._activeGrid) {
972
+ return;
973
+ }
974
+ if (this._basedOnContent) {
975
+ var dv = this._activeGrid.getDataSource();
976
+ if (dv) {
977
+ var dt = dv.getDataSource();
978
+ this._setColumnData(dt, this._selectionField, false);
1006
979
  }
1007
-
1008
- if (!preserveAnchor) {
1009
- this._anchorSection = null;
980
+ } else {
981
+ var sections = this._activeGrid.getAllSections("content");
982
+ for (var i = sections.length; --i >= 0;) {
983
+ this._sectionClearSelectedRows(sections[i], preserveAnchor);
1010
984
  }
1011
- this._clearPendingClickIndex(this._activeGrid);
1012
- this._clearMenuIcon();
1013
985
  }
986
+
987
+ if (!preserveAnchor) {
988
+ this._anchorSection = null;
989
+ }
990
+ this._clearPendingClickIndex(this._activeGrid);
991
+ this._clearMenuIcon();
1014
992
  };
1015
993
  /** @private
1016
994
  * @suppress {missingProperties}
@@ -292,6 +292,12 @@ GridPlugin.prototype.getColumnId = function (colIndex) {
292
292
  if(typeof colIndex === "string") {
293
293
  return colIndex;
294
294
  }
295
+
296
+ var colCount = this.getColumnCount();
297
+ if(colIndex < 0 || colIndex >= colCount) { // Avoid creating undesired column definitions in Core Grid.
298
+ return "";
299
+ }
300
+
295
301
  if(this._compositeGrid) {
296
302
  return this._compositeGrid.getColumnId(colIndex);
297
303
  } else {
@@ -615,88 +621,117 @@ GridPlugin.prototype._getData = function(dv, rowIndex, field) {
615
621
  };
616
622
  /** @protected
617
623
  * @ignore
618
- * @param {tr.DataView} dv
619
- * @param {number} rowIndex
624
+ * @param {tr.DataView|tr.DataTable} dv
625
+ * @param {number|string} rowRef Row index or row id
620
626
  * @param {string} field
621
627
  * @param {*} val
622
628
  */
623
- GridPlugin.prototype._setData = function(dv, rowIndex, field, val) {
629
+ GridPlugin.prototype._setData = function(dv, rowRef, field, val) {
624
630
  if(this._realTimeGrid) {
625
- var row = dv.getRowDataAt(rowIndex);
626
- if(row) {
627
- row["ROW_DEF"].setData(field, val);
631
+ var rowDef = _toRowDef(dv, rowRef);
632
+ if(rowDef) {
633
+ rowDef.setData(field, val);
628
634
  }
629
635
  } else {
630
- dv.setDataAt(rowIndex, field, val);
636
+ if(typeof rowRef === "number") {
637
+ dv.setDataAt(rowRef, field, val);
638
+ } else {
639
+ dv.setData(rowRef, field, val);
640
+ }
631
641
  }
632
642
  };
633
643
  /** @protected
634
644
  * @ignore
635
- * @param {tr.DataView} dv
636
- * @param {number} rowIndex
645
+ * @param {tr.DataView|tr.DataTable} dv
646
+ * @param {number|string} rowRef Row index or row id
637
647
  * @param {Object} rowData
638
648
  */
639
- GridPlugin.prototype._setRowData = function(dv, rowIndex, rowData) {
649
+ GridPlugin.prototype._setRowData = function(dv, rowRef, rowData) {
640
650
  if(this._realTimeGrid) {
641
- var dvRowData = dv.getRowDataAt(rowIndex);
642
- if(dvRowData) {
643
- dvRowData["ROW_DEF"].setRowData(rowData);
651
+ var rowDef = _toRowDef(dv, rowRef);
652
+ if(rowDef) {
653
+ rowDef.setRowData(rowData);
644
654
  }
645
655
  } else {
646
- dv.setRowDataAt(rowIndex, rowData);
656
+ if(typeof rowRef === "number") {
657
+ dv.setRowDataAt(rowRef, rowData);
658
+ } else {
659
+ dv.setRowData(rowRef, rowData);
660
+ }
647
661
  }
648
662
  };
649
-
650
663
  /** @protected
651
664
  * @ignore
652
- * @param {tr.DataView} dv
653
- * @param {number} rowIndex
665
+ * @param {tr.DataView|tr.DataTable} dv
666
+ * @param {number|string} rowRef Row index or row id
654
667
  * @param {string} field
655
668
  * @param {*} value
656
669
  */
657
- GridPlugin.prototype._setStaticData = function(dv, rowIndex, field, value) {
670
+ GridPlugin.prototype._setStaticData = function(dv, rowRef, field, value) {
658
671
  if(this._realTimeGrid) {
659
- var dvRowData = dv.getRowDataAt(rowIndex);
660
- if(dvRowData) {
661
- dvRowData["ROW_DEF"].setStaticData(field, value);
672
+ var rowDef = _toRowDef(dv, rowRef);
673
+ if(rowDef) {
674
+ rowDef.setStaticData(field, value);
662
675
  }
663
676
  } else {
664
677
  // TODO: composite grid should be has staticValues when get configObject, wait for request feature
665
- dv.setDataAt(rowIndex, field, value);
678
+ this._setData(dv, rowRef, field, value);
666
679
  }
667
680
  };
668
681
 
669
682
  /** Set data in a column manner. This is faster than repeatedly calling this._setData
670
683
  * @protected
671
684
  * @ignore
672
- * @param {tr.DataView} dv
685
+ * @param {tr.DataView|tr.DataTable} dv
673
686
  * @param {string} cid
674
- * @param {Array} valueList
675
- * @param {Array.<string>=} opt_ridList Specify row id to be set corresponding to the data item
687
+ * @param {*} valueList
688
+ * @param {Array.<string>=} ridList Specify row id to be set corresponding to the data item
676
689
  * @example
677
- * var dv = this._activeGrid.getDataSource();
678
- * this._setColumnData(dv, "column 1", ["1st row data", "2nd row data", "3rd row data"]);
690
+ * this._setColumnData(dv, "column 1", ["data1", "data2", "data3"]);
691
+ * this._setColumnData(dv, "column 1", 10, ["rowId1", "rowId2]);
679
692
  */
680
- GridPlugin.prototype._setColumnData = function (dv, cid, valueList, opt_ridList) { // Data changed event may be dispatched
681
- opt_ridList = opt_ridList || dv.getAllRowIds() || [];
682
-
683
- if (this._realTimeGrid) {
684
- var dt = dv.getDataSource();
685
- // freeze data to prevent sorting event occur
686
- var prevFrozen = dt.freeze();
693
+ GridPlugin.prototype._setColumnData = function (dv, cid, valueList, ridList) { // Data changed event may be dispatched
694
+ if(!cid) {
695
+ return;
696
+ }
687
697
 
688
- var len = (valueList.length < opt_ridList.length) ? valueList.length : opt_ridList.length;
698
+ var rids = Array.isArray(ridList) ? ridList : dv.getAllRowIds(true);
699
+ var rowCount = rids ? rids.length : 0;
700
+ if(!rowCount) {
701
+ return;
702
+ }
703
+ if(rowCount === 1) {
704
+ this._setData(
705
+ dv,
706
+ rids[0],
707
+ this._selectionField,
708
+ Array.isArray(valueList) ? valueList[0] : valueList
709
+ );
710
+ return;
711
+ }
712
+ var vals = Array.isArray(valueList) ? valueList : rids.map(function() { return valueList; });
689
713
 
690
- for (var i = 0; i < len; ++i) {
691
- var row = dv.getRowData(opt_ridList[i]);
692
- if (row) {
693
- row["ROW_DEF"].setData(cid, valueList[i]);
714
+ if(this._realTimeGrid) {
715
+ for(var i = 0; i < rowCount; ++i) {
716
+ var dvRowData = dv.getRowData(rids[i]);
717
+ if(dvRowData) {
718
+ var rowDef = dvRowData["ROW_DEF"];
719
+
720
+ if(rowDef){
721
+ // WARNING: This does not trigger dataChanged and dataComposed on the DataCache
722
+ rowDef.getRowData()[cid] = vals[i];
723
+ }
694
724
  }
695
725
  }
696
-
697
- dt.freeze(prevFrozen);
726
+ if(!dv.dispatchGlobalChange) {
727
+ dv = dv.getDataSource(); // Get DataTable
728
+ }
729
+ // Force rendering by dispatching global change
730
+ if(dv && dv.dispatchGlobalChange) {
731
+ dv.dispatchGlobalChange();
732
+ }
698
733
  } else {
699
- dv.setColumnData(cid, valueList, opt_ridList);
734
+ dv.setColumnData(cid, vals, rids);
700
735
  }
701
736
  };
702
737
 
@@ -755,6 +790,20 @@ var exportExtension = function(winObj, plugin) {
755
790
  trNamespace[pluginName + "Extension"] = plugin;
756
791
  };
757
792
 
793
+ /** @private
794
+ * @function
795
+ * @param {tr.DataView|tr.DataTable} dv
796
+ * @param {number|string} rowRef Row index or row id
797
+ * @return {*} RowDefinition instance
798
+ */
799
+ var _toRowDef = function(dv, rowRef) {
800
+ var dvRowData = (typeof rowRef === "number") ? dv.getRowDataAt(rowRef) : dv.getRowData(rowRef);
801
+ if(dvRowData) {
802
+ return dvRowData["ROW_DEF"] || null;
803
+ }
804
+ return null;
805
+ };
806
+
758
807
  /** @public
759
808
  * @function
760
809
  * @param {string} field
@@ -89,6 +89,10 @@ declare class ColumnGroupingPlugin extends GridPlugin {
89
89
 
90
90
  public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
91
91
 
92
+ public pinGroup(groupId: string, side?: string|null): void;
93
+
94
+ public unpinGroup(groupId: string, dest?: (number|string)|null): void;
95
+
92
96
  }
93
97
 
94
98
  export default ColumnGroupingPlugin;
@@ -84,7 +84,7 @@ declare class ColumnStackPlugin extends GridPlugin {
84
84
 
85
85
  public isColumnActive(colIndex: number): boolean;
86
86
 
87
- public getStackId(colIndex: number): string;
87
+ public getStackId(colRef: number|string|null): string;
88
88
 
89
89
  public stackColumns(colRefs?: (number|string)[]|null, stackId?: string|null, options?: ColumnStackPlugin.StackConfiguration|null): boolean;
90
90
 
@@ -96,6 +96,8 @@ declare class ColumnStackPlugin extends GridPlugin {
96
96
 
97
97
  public removeAllStacks(enableUpdateUI?: boolean|null): boolean;
98
98
 
99
+ public setActiveColumn(activeColumn: number|string|null): boolean;
100
+
99
101
  public swapColumn(colRef: number|Event|null, swappingIndex: number): boolean;
100
102
 
101
103
  public getStackMemberIndices(stackId: string): (number)[];
@@ -140,6 +142,10 @@ declare class ColumnStackPlugin extends GridPlugin {
140
142
 
141
143
  public moveStack(stackId: string, destCol?: (number|string)|null): boolean;
142
144
 
145
+ public pinStack(stackId: string, side?: string|null): void;
146
+
147
+ public unpinStack(stackId: string, dest?: (number|string)|null): void;
148
+
143
149
  }
144
150
 
145
151
  export default ColumnStackPlugin;
@@ -359,6 +359,8 @@ declare class Core extends ElementWrapper {
359
359
 
360
360
  public synchronizeVScrollbar(subGrid: Core|null): void;
361
361
 
362
+ public synchronizeHScrollbar(subGrid: Core|null): void;
363
+
362
364
  public updateRowData(sectionRef?: Core.SectionReference|null, fromRowIndex?: number|null, lastRowIndex?: number|null, userParam?: any): void;
363
365
 
364
366
  public rerender(): void;
@@ -60,7 +60,9 @@ declare class TrackLayout {
60
60
 
61
61
  public showLane(index: number, opt_val?: boolean|null): boolean;
62
62
 
63
- public hideLane(index: number, opt_hidden?: boolean|null, opt_bitIndex?: number|null): boolean;
63
+ public hideLane(index: number, hidden?: boolean|null, bitIndex?: number|null): boolean;
64
+
65
+ public getLaneVisibilityBit(index: number, bitIndex?: number|null): boolean;
64
66
 
65
67
  public show(opt_shown?: boolean|null): void;
66
68
 
@@ -268,7 +268,7 @@ declare class Grid extends EventDispatcher {
268
268
 
269
269
  public freezeColumn(colIndex?: number|null, pinnedRightColumns?: number|null): void;
270
270
 
271
- public pinColumn(colRef: Grid.ColumnReference|(Grid.ColumnReference)[]|null): boolean;
271
+ public pinColumn(colRef: Grid.ColumnReference|(Grid.ColumnReference)[]|null, side?: string|null): boolean;
272
272
 
273
273
  public unpinColumn(colRef: Grid.ColumnReference|(Grid.ColumnReference)[]|null, dest?: Grid.ColumnReference|null): boolean;
274
274
 
@@ -37,7 +37,7 @@ declare class RowDefinition {
37
37
 
38
38
  public initialize(rowOptions?: RowDefinition.Options|null): void;
39
39
 
40
- public setContent(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null): boolean;
40
+ public setContent(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
41
41
 
42
42
  public getRowId(): string;
43
43
 
@@ -143,7 +143,7 @@ declare const ROW_DEF: string;
143
143
 
144
144
  declare const ROW_TYPES: RowDefinition.RowTypes;
145
145
 
146
- declare function rowData(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null): boolean;
146
+ declare function rowData(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
147
147
 
148
148
  export {RowDefinition, ROW_DEF, ROW_TYPES};
149
149
  export default RowDefinition;
package/lib/versions.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
- "tr-grid-util": "1.3.104",
2
+ "tr-grid-util": "1.3.106",
3
3
  "@grid/column-dragging": "1.0.13",
4
4
  "@grid/row-segmenting": "1.0.23",
5
5
  "@grid/statistics-row": "1.0.14",
6
6
  "@grid/zoom": "1.0.11",
7
7
  "tr-grid-auto-tooltip": "1.1.5",
8
- "tr-grid-cell-selection": "1.0.32",
8
+ "tr-grid-cell-selection": "1.0.33",
9
9
  "tr-grid-checkbox": "1.0.60",
10
10
  "tr-grid-column-fitter": "1.0.39",
11
11
  "tr-grid-column-formatting": "0.9.34",
12
- "tr-grid-column-grouping": "1.0.47",
12
+ "tr-grid-column-grouping": "1.0.49",
13
13
  "tr-grid-column-resizing": "1.0.28",
14
14
  "tr-grid-column-selection": "1.0.28",
15
- "tr-grid-column-stack": "1.0.59",
15
+ "tr-grid-column-stack": "1.0.63",
16
16
  "tr-grid-conditional-coloring": "1.0.61",
17
17
  "tr-grid-content-wrap": "1.0.20",
18
18
  "tr-grid-contextmenu": "1.0.38",
@@ -23,10 +23,10 @@
23
23
  "tr-grid-percent-bar": "1.0.22",
24
24
  "tr-grid-printer": "1.0.16",
25
25
  "tr-grid-range-bar": "2.0.4",
26
- "tr-grid-row-dragging": "1.0.27",
26
+ "tr-grid-row-dragging": "1.0.28",
27
27
  "tr-grid-row-filtering": "1.0.55",
28
28
  "tr-grid-row-grouping": "1.0.80",
29
- "tr-grid-row-selection": "1.0.22",
29
+ "tr-grid-row-selection": "1.0.23",
30
30
  "tr-grid-rowcoloring": "1.0.22",
31
31
  "tr-grid-textformatting": "1.0.45",
32
32
  "tr-grid-titlewrap": "1.0.19",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.37"
69
+ "version": "6.0.39"
70
70
  }