@refinitiv-ui/efx-grid 6.0.27 → 6.0.29
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/core/dist/core.js +248 -29
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +1 -1
- package/lib/core/es6/data/DataTable.js +3 -2
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +3 -2
- package/lib/core/es6/data/Segment.d.ts +1 -1
- package/lib/core/es6/data/Segment.js +12 -3
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
- package/lib/core/es6/data/SegmentCollection.js +3 -2
- package/lib/core/es6/grid/Core.d.ts +17 -3
- package/lib/core/es6/grid/Core.js +226 -20
- package/lib/core/es6/grid/LayoutGrid.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +21 -2
- package/lib/rt-grid/dist/rt-grid.js +418 -238
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -2
- package/lib/rt-grid/es6/ColumnDefinition.js +71 -70
- package/lib/rt-grid/es6/Grid.d.ts +9 -2
- package/lib/rt-grid/es6/Grid.js +55 -132
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -3
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +9 -27
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +6 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +68 -9
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +30 -23
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +78 -3
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +24 -10
- package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
- package/lib/tr-grid-util/es6/CellPainter.js +53 -15
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +6 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +67 -0
- package/lib/types/es6/ColumnGrouping.d.ts +3 -3
- package/lib/types/es6/ColumnStack.d.ts +6 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
- package/lib/types/es6/Core/data/DataView.d.ts +1 -1
- package/lib/types/es6/Core/data/Segment.d.ts +1 -1
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/lib/types/es6/Core/grid/Core.d.ts +17 -3
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -2
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +9 -2
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/versions.json +6 -6
- package/package.json +6 -2
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -85,6 +85,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
85
85
|
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
86
86
|
* @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
|
87
87
|
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
88
|
+
* @property {boolean=} topSection=true If disabled, title section will not be rendered
|
88
89
|
*/
|
89
90
|
|
90
91
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -228,26 +229,6 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
228
229
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
229
230
|
};
|
230
231
|
|
231
|
-
/** @private
|
232
|
-
* @param {ColumnDefinition} colDef
|
233
|
-
* @return {string}
|
234
|
-
*/
|
235
|
-
var _getId = function(colDef) {
|
236
|
-
if(colDef) {
|
237
|
-
return colDef.getId();
|
238
|
-
}
|
239
|
-
return "";
|
240
|
-
};
|
241
|
-
/** @private
|
242
|
-
* @param {ColumnDefinition} colDef
|
243
|
-
* @return {string}
|
244
|
-
*/
|
245
|
-
var _getField = function(colDef) {
|
246
|
-
if(colDef) {
|
247
|
-
return colDef.getField();
|
248
|
-
}
|
249
|
-
return "";
|
250
|
-
};
|
251
232
|
/** @private
|
252
233
|
* @param {ColumnDefinition} colDef
|
253
234
|
* @return {string}
|
@@ -336,6 +317,9 @@ var Grid = function(placeholder, config) {
|
|
336
317
|
if(config["SortableTitle"]) { // Exception for built-in plugin
|
337
318
|
t._stp = config["SortableTitle"];
|
338
319
|
}
|
320
|
+
if(config["topSection"] === false) {
|
321
|
+
t._topSection = false;
|
322
|
+
}
|
339
323
|
}
|
340
324
|
if(!t._sharedDataSource) {
|
341
325
|
t._dc = new DataCache();
|
@@ -550,7 +534,10 @@ Grid.prototype._fieldCaching = false;
|
|
550
534
|
* @private
|
551
535
|
*/
|
552
536
|
Grid.prototype._childDataField = "";
|
553
|
-
|
537
|
+
/** @type {boolean}
|
538
|
+
* @private
|
539
|
+
*/
|
540
|
+
Grid.prototype._topSection = true;
|
554
541
|
|
555
542
|
/** @public
|
556
543
|
*/
|
@@ -665,7 +652,11 @@ Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
|
665
652
|
*/
|
666
653
|
Grid.prototype._addGridSections = function () {
|
667
654
|
var title = this._grid.addSection("title");
|
668
|
-
|
655
|
+
if(this._topSection == false){
|
656
|
+
title.setRowCount(0);
|
657
|
+
} else {
|
658
|
+
title.setRowCount(1);
|
659
|
+
}
|
669
660
|
this._grid.addSection("content");
|
670
661
|
|
671
662
|
var titleSettings = this._grid.getSectionSettings("title");
|
@@ -1617,10 +1608,13 @@ Grid.prototype.setFields = Grid.prototype.setColumns;
|
|
1617
1608
|
* @param {Object} e
|
1618
1609
|
*/
|
1619
1610
|
Grid.prototype._onColumnAdded = function(e) {
|
1620
|
-
var colDef = e.context[COL_DEF];
|
1611
|
+
var colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
|
1621
1612
|
delete e.context[COL_DEF];
|
1622
1613
|
var idx = e.colIndex;
|
1623
1614
|
|
1615
|
+
var coreColDef = this._grid._getColumnDef(idx);
|
1616
|
+
colDef._setCoreColumnDef(coreColDef); // For column id and field
|
1617
|
+
|
1624
1618
|
var colData = this._grid.getColumnData(idx);
|
1625
1619
|
if(!colData) { // Save column inside grid
|
1626
1620
|
colData = this._grid.setColumnData(idx, {});
|
@@ -1847,102 +1841,16 @@ Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
|
1847
1841
|
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
1848
1842
|
*/
|
1849
1843
|
Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
1850
|
-
|
1851
|
-
var srcIndex = this.getColumnIndex(srcCol);
|
1852
|
-
if(srcIndex < 0 || srcIndex >= colCount) {
|
1853
|
-
return false;
|
1854
|
-
}
|
1855
|
-
var destIndex = this.getColumnIndex(destCol);
|
1856
|
-
if(destIndex < 0) {
|
1857
|
-
destIndex = colCount;
|
1858
|
-
}
|
1859
|
-
return this._moveColumnByIndex(srcIndex, destIndex);
|
1860
|
-
};
|
1861
|
-
/** Move column without verification for better performance
|
1862
|
-
* @private
|
1863
|
-
* @param {number} srcIndex Column index
|
1864
|
-
* @param {number} destIndex Column index of the destination
|
1865
|
-
* @return {boolean} Return true if there is any change, and false otherwise
|
1866
|
-
*/
|
1867
|
-
Grid.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
1868
|
-
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
1869
|
-
--destIndex;
|
1870
|
-
}
|
1871
|
-
if(srcIndex === destIndex) {
|
1872
|
-
return false;
|
1873
|
-
}
|
1874
|
-
return this.moveColumn(srcIndex, destIndex);
|
1844
|
+
return this._grid.moveColumnById(srcCol, destCol);
|
1875
1845
|
};
|
1876
1846
|
|
1877
1847
|
/** @public
|
1878
1848
|
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
1879
|
-
* @param {number|string} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
1849
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
1880
1850
|
* @return {boolean} Return true if there is any change, and false otherwise
|
1881
1851
|
*/
|
1882
1852
|
Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
1883
|
-
|
1884
|
-
|
1885
|
-
if(Array.isArray(colRefs)) {
|
1886
|
-
var srcLen = colRefs.length;
|
1887
|
-
if(srcLen > 1) {
|
1888
|
-
var colIds = this.getColumnIds();
|
1889
|
-
var colCount = colIds.length;
|
1890
|
-
var srcIds = [];
|
1891
|
-
var invalidDest = false;
|
1892
|
-
var i, srcId, srcIdx;
|
1893
|
-
for(i = 0; i < srcLen; ++i) {
|
1894
|
-
var colRef = colRefs[i];
|
1895
|
-
if(typeof colRef === "number") {
|
1896
|
-
srcIdx = colRef;
|
1897
|
-
srcId = colIds[colRef] || "";
|
1898
|
-
} else {
|
1899
|
-
srcId = colRef;
|
1900
|
-
srcIdx = colIds.indexOf(srcId);
|
1901
|
-
}
|
1902
|
-
if(srcId && srcIdx >= 0) {
|
1903
|
-
srcIds.push(srcId);
|
1904
|
-
if(destId === srcId) {
|
1905
|
-
invalidDest = true; // Destination must not exist in source columns
|
1906
|
-
}
|
1907
|
-
}
|
1908
|
-
}
|
1909
|
-
|
1910
|
-
var destIdx;
|
1911
|
-
srcLen = srcIds.length;
|
1912
|
-
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
1913
|
-
destIdx = this.getColumnIndex(destId);
|
1914
|
-
if(destIdx >= 0) {
|
1915
|
-
while(++destIdx < colCount) {
|
1916
|
-
destId = colIds[destIdx];
|
1917
|
-
if(srcIds.indexOf(destId) < 0) {
|
1918
|
-
break;
|
1919
|
-
}
|
1920
|
-
}
|
1921
|
-
}
|
1922
|
-
if(destIdx < 0 || destIdx >= colCount) {
|
1923
|
-
destId = "";
|
1924
|
-
}
|
1925
|
-
}
|
1926
|
-
|
1927
|
-
var dirty = 0;
|
1928
|
-
for(i = srcLen; --i >= 0;) {
|
1929
|
-
srcId = srcIds[i]; // Only valid source columns are left at this point
|
1930
|
-
srcIdx = this.getColumnIndex(srcId);
|
1931
|
-
destIdx = this.getColumnIndex(destId);
|
1932
|
-
if(destIdx < 0) { // Insert to the back when id is not found
|
1933
|
-
destIdx = colCount;
|
1934
|
-
}
|
1935
|
-
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
1936
|
-
destId = srcId;
|
1937
|
-
}
|
1938
|
-
return dirty ? true : false;
|
1939
|
-
} else {
|
1940
|
-
return this.moveColumnById(colRefs[0], destId);
|
1941
|
-
}
|
1942
|
-
}
|
1943
|
-
|
1944
|
-
// colRefs will be a number or string
|
1945
|
-
return this.moveColumnById(colRefs, destId);
|
1853
|
+
return this._grid.reorderColumns(colRefs, destCol);
|
1946
1854
|
};
|
1947
1855
|
|
1948
1856
|
/** The hidden column still occupies the same index.
|
@@ -2981,30 +2889,19 @@ Grid.prototype._getRowId = function(rowRef) {
|
|
2981
2889
|
* @return {number}
|
2982
2890
|
*/
|
2983
2891
|
Grid.prototype.getColumnIndex = function(colRef) {
|
2984
|
-
if(typeof colRef === "number") {
|
2985
|
-
return colRef;
|
2986
|
-
}
|
2987
|
-
|
2988
2892
|
if(colRef) {
|
2989
2893
|
var colCount = this.getColumnCount();
|
2990
|
-
var i, colDef;
|
2991
2894
|
if(colRef instanceof ColumnDefinition) {
|
2992
|
-
for(i = 0; i < colCount; ++i) {
|
2993
|
-
colDef = this.getColumnDefinition(i);
|
2895
|
+
for(var i = 0; i < colCount; ++i) {
|
2896
|
+
var colDef = this.getColumnDefinition(i);
|
2994
2897
|
if(colDef === colRef) {
|
2995
2898
|
return i;
|
2996
2899
|
}
|
2997
2900
|
}
|
2998
|
-
|
2999
|
-
for(i = 0; i < colCount; ++i) {
|
3000
|
-
colDef = this.getColumnDefinition(i);
|
3001
|
-
if(_hasFieldOrId(colDef, colRef)) {
|
3002
|
-
return i; // Return the first found field
|
3003
|
-
}
|
3004
|
-
}
|
2901
|
+
return -1;
|
3005
2902
|
}
|
3006
2903
|
}
|
3007
|
-
return
|
2904
|
+
return this._grid.getColumnIndex(colRef);
|
3008
2905
|
};
|
3009
2906
|
/** Any invalid column reference will be excluded from the output array
|
3010
2907
|
* @public
|
@@ -3020,7 +2917,7 @@ Grid.prototype.getColumnIndices = function(colRefs) {
|
|
3020
2917
|
for(var i = 0; i < len; ++i) {
|
3021
2918
|
var colIndex = this.getColumnIndex(inputAry[i]);
|
3022
2919
|
if(colIndex >= 0 && colIndex < colCount) {
|
3023
|
-
ary.push(colIndex); // WARNING: We have not
|
2920
|
+
ary.push(colIndex); // WARNING: We have not checked for duplication
|
3024
2921
|
}
|
3025
2922
|
}
|
3026
2923
|
return ary;
|
@@ -3032,14 +2929,14 @@ Grid.prototype.getColumnIndices = function(colRefs) {
|
|
3032
2929
|
* @see {@link Grid#getColumnDefinition}
|
3033
2930
|
*/
|
3034
2931
|
Grid.prototype.getColumnId = function(colIndex) {
|
3035
|
-
return
|
2932
|
+
return this._grid.getColumnId(colIndex);
|
3036
2933
|
};
|
3037
2934
|
/** Get ids from each column definition.
|
3038
2935
|
* @public
|
3039
2936
|
* @return {!Array.<string>} New array is created
|
3040
2937
|
*/
|
3041
2938
|
Grid.prototype.getColumnIds = function() {
|
3042
|
-
return this.
|
2939
|
+
return this._grid.getColumnIds();
|
3043
2940
|
};
|
3044
2941
|
/** Return field defined in the column definition
|
3045
2942
|
* @public
|
@@ -3048,14 +2945,14 @@ Grid.prototype.getColumnIds = function() {
|
|
3048
2945
|
* @see {@link Grid#getColumnDefinition}
|
3049
2946
|
*/
|
3050
2947
|
Grid.prototype.getColumnField = function(colIndex) {
|
3051
|
-
return
|
2948
|
+
return this._grid.getColumnField(colIndex);
|
3052
2949
|
};
|
3053
2950
|
/** Get fields from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
3054
2951
|
* @public
|
3055
2952
|
* @return {!Array.<string>} New array is created
|
3056
2953
|
*/
|
3057
2954
|
Grid.prototype.getColumnFields = function() {
|
3058
|
-
return this.
|
2955
|
+
return this._grid.getColumnFields();
|
3059
2956
|
};
|
3060
2957
|
/** Get column name from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
3061
2958
|
* @public
|
@@ -3513,6 +3410,32 @@ Grid.prototype.setClassification = function(rowRef, fields) {
|
|
3513
3410
|
return false;
|
3514
3411
|
};
|
3515
3412
|
|
3413
|
+
/** Check element in the grid element
|
3414
|
+
* @public
|
3415
|
+
* @param {Element} elem
|
3416
|
+
* @return {boolean}=true if an element from the parameter is inside a grid element
|
3417
|
+
*/
|
3418
|
+
Grid.prototype.contains = function(elem) {
|
3419
|
+
if(elem) {
|
3420
|
+
// This will impact the contents within the rt-grid element, but not those outside of it, such as the wrapper elements atlas-blotter and ef-grid.
|
3421
|
+
return this._topNode.contains(elem);
|
3422
|
+
}
|
3423
|
+
return false;
|
3424
|
+
};
|
3425
|
+
|
3426
|
+
/** Check grid element is focused
|
3427
|
+
* @public
|
3428
|
+
* @return {boolean}
|
3429
|
+
*/
|
3430
|
+
Grid.prototype.isFocused = function() {
|
3431
|
+
var activeElement = document.activeElement;
|
3432
|
+
if(!activeElement || !activeElement.shadowRoot) {
|
3433
|
+
// active element is not in the shadow DOM. try using contains method to check
|
3434
|
+
return this.contains(activeElement);
|
3435
|
+
}
|
3436
|
+
// For wrapper scenarios, such as atlas-blotter or efx-grid
|
3437
|
+
return activeElement.shadowRoot === this._topNode.parentNode;
|
3438
|
+
};
|
3516
3439
|
/** @description Focus grid element without moving window scrollbar
|
3517
3440
|
* @public
|
3518
3441
|
*/
|
@@ -79,11 +79,11 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
79
79
|
|
80
80
|
public getValidDestinationIndex(id: string, destCol: number|string|null): number;
|
81
81
|
|
82
|
-
public moveGroup(id: string, destCol
|
82
|
+
public moveGroup(id: string, destCol?: (number|string)|null): void;
|
83
83
|
|
84
|
-
public reorderColumns(colList: (number|string)[]|null, destCol
|
84
|
+
public reorderColumns(colList: (number|string)[]|null, destCol?: (number|string)|null): boolean;
|
85
85
|
|
86
|
-
public moveColumnById(srcCol: number|string|null, destCol?: number|string|null): boolean;
|
86
|
+
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
87
87
|
|
88
88
|
}
|
89
89
|
|
@@ -318,16 +318,7 @@ ColumnGroupingPlugin.prototype.config = function (options) {
|
|
318
318
|
}
|
319
319
|
var columns = options["columns"];
|
320
320
|
if (columns) {
|
321
|
-
|
322
|
-
for (var i = 0; i < len; ++i) {
|
323
|
-
var colData = this._newColumnData(i);
|
324
|
-
colData["columnGrouping"] = {
|
325
|
-
// used for columnRemoved event
|
326
|
-
id: columns[i].id // TODO: This does not work with runtime change
|
327
|
-
};
|
328
|
-
}
|
329
|
-
|
330
|
-
groupDefs = this._migrateLegacyStructure(groupDefs, options["columns"]);
|
321
|
+
groupDefs = this._migrateLegacyStructure(groupDefs, columns);
|
331
322
|
}
|
332
323
|
if (groupDefs) {
|
333
324
|
ColumnGroupingPlugin._flattenGroupDefs(groupDefs);
|
@@ -805,9 +796,8 @@ ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
|
|
805
796
|
* @param {Object} e
|
806
797
|
*/
|
807
798
|
ColumnGroupingPlugin.prototype._onColumnRemoved = function (e) {
|
808
|
-
var
|
809
|
-
if (
|
810
|
-
var colId = colData.columnGrouping.id;
|
799
|
+
var colId = e.colId;
|
800
|
+
if (colId) {
|
811
801
|
if (this._groupDefs.unsetParent(colId)) {
|
812
802
|
this._requestApplyGrouping();
|
813
803
|
}
|
@@ -1440,7 +1430,7 @@ ColumnGroupingPlugin.prototype.getValidDestinationIndex = function (id, destCol)
|
|
1440
1430
|
* Group or column can only be moved within the parent group.
|
1441
1431
|
* If the destination is between other column group, the destination will change to the end of that group instead.
|
1442
1432
|
* @param {string} id group id or column id
|
1443
|
-
* @param {number|string} destCol destination column index / id
|
1433
|
+
* @param {(number|string)=} destCol destination column index / id
|
1444
1434
|
*/
|
1445
1435
|
ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
|
1446
1436
|
var groupDef;
|
@@ -1466,7 +1456,7 @@ ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
|
|
1466
1456
|
/** Move and reorder the specified columns to position before the destination
|
1467
1457
|
* @public
|
1468
1458
|
* @param {Array.<number|string>} colList Column list to be reordered
|
1469
|
-
* @param {number|string} destCol
|
1459
|
+
* @param {(number|string)=} destCol Destination column id or index
|
1470
1460
|
* @return {boolean}
|
1471
1461
|
*/
|
1472
1462
|
ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
|
@@ -1474,29 +1464,21 @@ ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
|
|
1474
1464
|
// TODO: create method for toggling autoGrouping flag
|
1475
1465
|
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1476
1466
|
|
1477
|
-
|
1478
|
-
if (gridApi && gridApi.reorderColumns) {
|
1479
|
-
dirty = gridApi.reorderColumns(colList, destCol); // TODO: Support multi-table feature
|
1480
|
-
}
|
1481
|
-
|
1467
|
+
this._reorderColumns(colList, destCol);
|
1482
1468
|
this._autoGrouping = true;
|
1483
1469
|
return dirty;
|
1484
1470
|
};
|
1485
1471
|
/** Move the specified column to position before the destination
|
1486
1472
|
* @public
|
1487
|
-
* @param {number|string} srcCol
|
1488
|
-
* @param {number|string=} destCol
|
1473
|
+
* @param {number|string} srcCol Source column id or index
|
1474
|
+
* @param {(number|string)=} destCol Destination column id or index
|
1489
1475
|
* @return {boolean}
|
1490
1476
|
*/
|
1491
1477
|
ColumnGroupingPlugin.prototype.moveColumnById = function (srcCol, destCol) {
|
1492
1478
|
var dirty = false;
|
1493
1479
|
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1494
1480
|
|
1495
|
-
|
1496
|
-
if (gridApi && gridApi.moveColumnById) {
|
1497
|
-
dirty = gridApi.moveColumnById(srcCol, destCol); // TODO: Support multi-table feature
|
1498
|
-
}
|
1499
|
-
|
1481
|
+
this._moveColumnById(srcCol, destCol);
|
1500
1482
|
this._autoGrouping = true;
|
1501
1483
|
return dirty;
|
1502
1484
|
};
|
@@ -129,6 +129,12 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
129
129
|
|
130
130
|
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
131
131
|
|
132
|
+
public hideStack(stackId: string): void;
|
133
|
+
|
134
|
+
public showStack(stackId: string): void;
|
135
|
+
|
136
|
+
public isStackHidden(stackId: string): boolean|null|null;
|
137
|
+
|
132
138
|
}
|
133
139
|
|
134
140
|
export default ColumnStackPlugin;
|
@@ -336,6 +336,7 @@ ColumnStackPlugin.prototype.config = function (options) {
|
|
336
336
|
*/
|
337
337
|
ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
|
338
338
|
var obj = gridOptions || {};
|
339
|
+
var host = this._host || this._hosts[0];
|
339
340
|
|
340
341
|
var columnOptions = obj["columns"];
|
341
342
|
|
@@ -351,7 +352,7 @@ ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
351
352
|
for(var i = 0; i < memberIndices.length; i++){
|
352
353
|
var colIndex = memberIndices[i];
|
353
354
|
var colOption = columnOptions[colIndex];
|
354
|
-
if(colOption){
|
355
|
+
if(colOption && host.isColumnVisible(colIndex)){
|
355
356
|
colOption.hidden = colIndex !== activeColIndex;
|
356
357
|
}
|
357
358
|
}
|
@@ -1850,10 +1851,7 @@ ColumnStackPlugin.prototype.reorderColumns = function(colList, destCol) {
|
|
1850
1851
|
var dirty = false;
|
1851
1852
|
this._stacking = false;
|
1852
1853
|
|
1853
|
-
|
1854
|
-
if(gridApi && gridApi.reorderColumns) {
|
1855
|
-
dirty = gridApi.reorderColumns(colList, destCol); // TODO: Support multi-table feature
|
1856
|
-
}
|
1854
|
+
this._reorderColumns(colList, destCol);
|
1857
1855
|
|
1858
1856
|
this._stacking = true;
|
1859
1857
|
return dirty;
|
@@ -1868,15 +1866,76 @@ ColumnStackPlugin.prototype.moveColumnById = function(srcCol, destCol) {
|
|
1868
1866
|
var dirty = false;
|
1869
1867
|
this._stacking = false;
|
1870
1868
|
|
1871
|
-
|
1872
|
-
if(gridApi && gridApi.moveColumnById) {
|
1873
|
-
dirty = gridApi.moveColumnById(srcCol, destCol); // TODO: Support multi-table feature
|
1874
|
-
}
|
1869
|
+
this._moveColumnById(srcCol, destCol);
|
1875
1870
|
|
1876
1871
|
this._stacking = true;
|
1877
1872
|
return dirty;
|
1878
1873
|
};
|
1879
1874
|
|
1875
|
+
/** @private
|
1876
|
+
* @description Set stack visibility to the specific stack
|
1877
|
+
* @param {string} stackId
|
1878
|
+
* @param {boolean} visible
|
1879
|
+
*/
|
1880
|
+
ColumnStackPlugin.prototype._setStackVisibility = function(stackId, visible) {
|
1881
|
+
var stackOption = this._stacks[stackId];
|
1882
|
+
if(!stackOption){
|
1883
|
+
return;
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
if(stackOption["spreading"] && !stackOption["collapsed"]){
|
1887
|
+
var stackRefs = stackOption["stackRefs"];
|
1888
|
+
for(var i = 0; i < stackRefs.length; i++){
|
1889
|
+
var colIndex = this._getColumnIndex(stackRefs[i]);
|
1890
|
+
this._setColumnVisibility(colIndex, visible);
|
1891
|
+
}
|
1892
|
+
} else {
|
1893
|
+
var activeColIndex = this._getColumnIndex(stackOption.activeColumn);
|
1894
|
+
this._setColumnVisibility(activeColIndex, visible);
|
1895
|
+
}
|
1896
|
+
};
|
1897
|
+
|
1898
|
+
/** @public
|
1899
|
+
* @description Hide specific stack from grid
|
1900
|
+
* @param {string} stackId
|
1901
|
+
*/
|
1902
|
+
ColumnStackPlugin.prototype.hideStack = function(stackId) {
|
1903
|
+
if(!stackId){
|
1904
|
+
return;
|
1905
|
+
}
|
1906
|
+
this._setStackVisibility(stackId, false);
|
1907
|
+
};
|
1908
|
+
|
1909
|
+
/** @public
|
1910
|
+
* @description Show specific stack from grid
|
1911
|
+
* @param {string} stackId
|
1912
|
+
*/
|
1913
|
+
ColumnStackPlugin.prototype.showStack = function(stackId) {
|
1914
|
+
if(!stackId){
|
1915
|
+
return;
|
1916
|
+
}
|
1917
|
+
this._setStackVisibility(stackId, true);
|
1918
|
+
};
|
1919
|
+
|
1920
|
+
/** @public
|
1921
|
+
* @description Get hidden status of specific stack
|
1922
|
+
* @param {string} stackId
|
1923
|
+
* @return {boolean|null}
|
1924
|
+
*/
|
1925
|
+
ColumnStackPlugin.prototype.isStackHidden = function(stackId) {
|
1926
|
+
var stackOption = this._stacks[stackId];
|
1927
|
+
var host = this._host || this._hosts[0];
|
1928
|
+
|
1929
|
+
if(!stackOption || !host){
|
1930
|
+
return null;
|
1931
|
+
}
|
1932
|
+
|
1933
|
+
var activeColIndex = this._getColumnIndex(stackOption.activeColumn);
|
1934
|
+
var isVisible = host.isColumnVisible(activeColIndex);
|
1935
|
+
|
1936
|
+
return !isVisible;
|
1937
|
+
};
|
1938
|
+
|
1880
1939
|
|
1881
1940
|
|
1882
1941
|
export default ColumnStackPlugin;
|
@@ -1,39 +1,44 @@
|
|
1
1
|
import {Ext} from '../../tr-grid-util/es6/Ext.js';
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
|
3
|
+
import {extendObject, injectCss, prettifyCss} 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
6
|
import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
7
7
|
|
8
8
|
declare namespace ConditionalColoringPlugin {
|
9
9
|
|
10
|
+
type Options = {
|
11
|
+
predefinedColors?: any
|
12
|
+
};
|
13
|
+
|
10
14
|
type ColumnOptions = {
|
11
|
-
conditions?: (ConditionalColoringPlugin.Condition)[],
|
12
|
-
colorText?: (string|boolean),
|
13
|
-
tickColor?: (string|boolean),
|
14
|
-
blinking?: (ConditionalColoringPlugin.Blinking|boolean),
|
15
|
-
field?: string
|
15
|
+
conditions?: (ConditionalColoringPlugin.Condition)[]|null,
|
16
|
+
colorText?: (string|boolean)|null,
|
17
|
+
tickColor?: (string|boolean)|null,
|
18
|
+
blinking?: (ConditionalColoringPlugin.Blinking|boolean)|null,
|
19
|
+
field?: string|null
|
16
20
|
};
|
17
21
|
|
18
22
|
type ConditionalColoringOptions = {
|
19
|
-
conditions?: (ConditionalColoringPlugin.Condition)[],
|
20
|
-
colorText?: (string|boolean),
|
21
|
-
tickColor?: (string|boolean),
|
22
|
-
field?: string
|
23
|
+
conditions?: (ConditionalColoringPlugin.Condition)[]|null,
|
24
|
+
colorText?: (string|boolean)|null,
|
25
|
+
tickColor?: (string|boolean)|null,
|
26
|
+
field?: string|null
|
23
27
|
};
|
24
28
|
|
25
29
|
type Condition = {
|
26
|
-
expression?: (string|((...params: any[]) => any)),
|
27
|
-
backgroundColor?: string,
|
28
|
-
color?: string
|
30
|
+
expression?: (string|((...params: any[]) => any))|null,
|
31
|
+
backgroundColor?: string|null,
|
32
|
+
color?: string|null,
|
33
|
+
cssClass?: string|null
|
29
34
|
};
|
30
35
|
|
31
36
|
type Blinking = {
|
32
|
-
border?: boolean,
|
33
|
-
field?: string,
|
34
|
-
up?: string,
|
35
|
-
down?: string,
|
36
|
-
level?: (string|boolean)
|
37
|
+
border?: boolean|null,
|
38
|
+
field?: string|null,
|
39
|
+
up?: string|null,
|
40
|
+
down?: string|null,
|
41
|
+
level?: (string|boolean)|null
|
37
42
|
};
|
38
43
|
|
39
44
|
}
|
@@ -56,21 +61,23 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
56
61
|
|
57
62
|
public getColumnColoring(colIndex: number, options?: any): ConditionalColoringPlugin.ColumnOptions;
|
58
63
|
|
59
|
-
public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)): void;
|
64
|
+
public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)|null): void;
|
60
65
|
|
61
|
-
public setConditionalColoring(colIndex: number, coloringOptions?: (ConditionalColoringPlugin.ConditionalColoringOptions|null)): void;
|
66
|
+
public setConditionalColoring(colIndex: number, coloringOptions?: (ConditionalColoringPlugin.ConditionalColoringOptions|null)|null): void;
|
62
67
|
|
63
|
-
public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking), field?: string): void;
|
68
|
+
public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking)|null, field?: string|null): void;
|
64
69
|
|
65
70
|
public blinkRow(rowIndex: number, blinkSignal: number, host?: any): void;
|
66
71
|
|
72
|
+
public setPredefinedColors(predefinedColors: any): void;
|
73
|
+
|
67
74
|
public getColumnPainter(colIndex: number): CellPainter|null;
|
68
75
|
|
69
76
|
public applyColor(colIndex: number, cell: any, rowData?: any): void;
|
70
77
|
|
71
78
|
public static cleanUpPrevRows(): void;
|
72
79
|
|
73
|
-
public static setThemeColors(colors: { [key: string]: string }): void;
|
80
|
+
public static setThemeColors(colors: { [key: string]: string }|null): void;
|
74
81
|
|
75
82
|
public reloadThemeColors(): Promise<any>|null;
|
76
83
|
|