@refinitiv-ui/efx-grid 6.0.38 → 6.0.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
@@ -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
 
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
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",
@@ -9,10 +9,10 @@
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.61",
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.38"
69
+ "version": "6.0.39"
70
70
  }