@refinitiv-ui/efx-grid 6.0.27 → 6.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +247 -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/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.js +2 -8
- 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/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/versions.json +4 -4
- package/package.json +1 -1
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
|
};
|
@@ -1850,10 +1850,7 @@ ColumnStackPlugin.prototype.reorderColumns = function(colList, destCol) {
|
|
1850
1850
|
var dirty = false;
|
1851
1851
|
this._stacking = false;
|
1852
1852
|
|
1853
|
-
|
1854
|
-
if(gridApi && gridApi.reorderColumns) {
|
1855
|
-
dirty = gridApi.reorderColumns(colList, destCol); // TODO: Support multi-table feature
|
1856
|
-
}
|
1853
|
+
this._reorderColumns(colList, destCol);
|
1857
1854
|
|
1858
1855
|
this._stacking = true;
|
1859
1856
|
return dirty;
|
@@ -1868,10 +1865,7 @@ ColumnStackPlugin.prototype.moveColumnById = function(srcCol, destCol) {
|
|
1868
1865
|
var dirty = false;
|
1869
1866
|
this._stacking = false;
|
1870
1867
|
|
1871
|
-
|
1872
|
-
if(gridApi && gridApi.moveColumnById) {
|
1873
|
-
dirty = gridApi.moveColumnById(srcCol, destCol); // TODO: Support multi-table feature
|
1874
|
-
}
|
1868
|
+
this._moveColumnById(srcCol, destCol);
|
1875
1869
|
|
1876
1870
|
this._stacking = true;
|
1877
1871
|
return dirty;
|
@@ -34,6 +34,12 @@ declare class GridPlugin extends EventDispatcher {
|
|
34
34
|
|
35
35
|
public getColumnId(colIndex: number|string|null): string;
|
36
36
|
|
37
|
+
public getColumnIds(): (string)[];
|
38
|
+
|
39
|
+
public getColumnField(colIndex: number): string;
|
40
|
+
|
41
|
+
public getColumnFields(): (string)[];
|
42
|
+
|
37
43
|
public getColumnCount(): number;
|
38
44
|
|
39
45
|
public static requestPlugin(ref: any, pluginRef: any, configObj?: any, compositeGrid?: any, realTimeGrid?: any): Promise<any>|null;
|
@@ -238,6 +238,7 @@ GridPlugin.prototype.getColumnName = function (colRef) {
|
|
238
238
|
* @return {number}
|
239
239
|
*/
|
240
240
|
GridPlugin.prototype.getColumnIndex = function (colRef) {
|
241
|
+
// TODO: Unify the below logics
|
241
242
|
if(typeof colRef === "number") {
|
242
243
|
return colRef;
|
243
244
|
}
|
@@ -258,6 +259,7 @@ GridPlugin.prototype.getColumnIndex = function (colRef) {
|
|
258
259
|
* @return {Array.<number>} column indices
|
259
260
|
*/
|
260
261
|
GridPlugin.prototype.getColumnIndices = function (colRefs) {
|
262
|
+
// TODO: Unify the below logics
|
261
263
|
if(this._compositeGrid) {
|
262
264
|
var allFields = this._compositeGrid.getColumnFields();
|
263
265
|
var columnCount = this._compositeGrid.getColumnCount();
|
@@ -286,6 +288,7 @@ GridPlugin.prototype.getColumnIndices = function (colRefs) {
|
|
286
288
|
* @return {string}
|
287
289
|
*/
|
288
290
|
GridPlugin.prototype.getColumnId = function (colIndex) {
|
291
|
+
// TODO: Unify the below logics
|
289
292
|
if(typeof colIndex === "string") {
|
290
293
|
return colIndex;
|
291
294
|
}
|
@@ -300,6 +303,34 @@ GridPlugin.prototype.getColumnId = function (colIndex) {
|
|
300
303
|
return "";
|
301
304
|
};
|
302
305
|
/** @public
|
306
|
+
* @return {!Array.<string>} Return all column ids from existing column
|
307
|
+
*/
|
308
|
+
GridPlugin.prototype.getColumnIds = function () {
|
309
|
+
if(this._hosts && this._hosts.length) {
|
310
|
+
return this._hosts[0].getColumnIds();
|
311
|
+
}
|
312
|
+
return [];
|
313
|
+
};
|
314
|
+
/** @public
|
315
|
+
* @param {number} colIndex
|
316
|
+
* @return {string} Return empty string if the specified column does not exist
|
317
|
+
*/
|
318
|
+
GridPlugin.prototype.getColumnField = function (colIndex) {
|
319
|
+
if(this._hosts && this._hosts.length) {
|
320
|
+
return this._hosts[0].getColumnField(colIndex);
|
321
|
+
}
|
322
|
+
return "";
|
323
|
+
};
|
324
|
+
/** @public
|
325
|
+
* @return {!Array.<string>} Return all column fields from existing column
|
326
|
+
*/
|
327
|
+
GridPlugin.prototype.getColumnFields = function () {
|
328
|
+
if(this._hosts && this._hosts.length) {
|
329
|
+
return this._hosts[0].getColumnFields();
|
330
|
+
}
|
331
|
+
return [];
|
332
|
+
};
|
333
|
+
/** @public
|
303
334
|
* @return {number}
|
304
335
|
*/
|
305
336
|
GridPlugin.prototype.getColumnCount = function() {
|
@@ -309,6 +340,42 @@ GridPlugin.prototype.getColumnCount = function() {
|
|
309
340
|
}
|
310
341
|
return 0;
|
311
342
|
};
|
343
|
+
/** @protected
|
344
|
+
* @ignore
|
345
|
+
* @param {number|string} srcCol Column Id or index
|
346
|
+
* @param {(number|string)=} destCol Column Id or index of the destination
|
347
|
+
* @return {boolean}
|
348
|
+
*/
|
349
|
+
GridPlugin.prototype._moveColumnById = function (srcCol, destCol) {
|
350
|
+
var hosts = this._hosts;
|
351
|
+
var len = hosts ? hosts.length : 0;
|
352
|
+
if(len) {
|
353
|
+
var dirty = 0;
|
354
|
+
for(var i = 0; i < len; ++i) {
|
355
|
+
dirty |= hosts[i].moveColumnById(srcCol, destCol);
|
356
|
+
}
|
357
|
+
return dirty ? true : false;
|
358
|
+
}
|
359
|
+
return false;
|
360
|
+
};
|
361
|
+
/** @protected
|
362
|
+
* @ignore
|
363
|
+
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
364
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
365
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
366
|
+
*/
|
367
|
+
GridPlugin.prototype._reorderColumns = function (colRefs, destCol) {
|
368
|
+
var hosts = this._hosts;
|
369
|
+
var len = hosts ? hosts.length : 0;
|
370
|
+
if(len) {
|
371
|
+
var dirty = 0;
|
372
|
+
for(var i = 0; i < len; ++i) {
|
373
|
+
dirty |= hosts[i].reorderColumns(colRefs, destCol);
|
374
|
+
}
|
375
|
+
return dirty ? true : false;
|
376
|
+
}
|
377
|
+
return false;
|
378
|
+
};
|
312
379
|
|
313
380
|
/** @protected
|
314
381
|
* @deprecated
|
@@ -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
|
|
@@ -98,7 +98,7 @@ declare class DataTable extends DataCache {
|
|
98
98
|
|
99
99
|
public addSegmentChild(segmentId: string, rid: string, dataId?: string|null): boolean;
|
100
100
|
|
101
|
-
public addSegmentChildren(segmentId: string, rids: (string)[]|null): boolean;
|
101
|
+
public addSegmentChildren(segmentId: string, rids: (string)[]|null, dataIds?: (string)[]|null): boolean;
|
102
102
|
|
103
103
|
public removeSegmentChild(segmentId: string, rid: string): boolean;
|
104
104
|
|
@@ -258,7 +258,7 @@ declare class DataView extends EventDispatcher {
|
|
258
258
|
|
259
259
|
public addSegmentChild(segmentRef: string|number|null, rowRef: string|number|null, dataId?: string|null): boolean;
|
260
260
|
|
261
|
-
public addSegmentChildren(segmentRef: string|number|null, rowRefs: (string|number)[]|null): boolean;
|
261
|
+
public addSegmentChildren(segmentRef: string|number|null, rowRefs: (string|number)[]|null, dataIds?: (string)[]|null): boolean;
|
262
262
|
|
263
263
|
public removeSegmentChild(segmentRef: string|number|null, rowRef: string|number|null): boolean;
|
264
264
|
|
@@ -15,7 +15,7 @@ declare class Segment extends EventDispatcher {
|
|
15
15
|
|
16
16
|
public addChild(rid: string, dataId?: string|null): boolean;
|
17
17
|
|
18
|
-
public addChildren(rids: (string)[]|null): boolean;
|
18
|
+
public addChildren(rids: (string)[]|null, dataIds?: (string)[]|null): boolean;
|
19
19
|
|
20
20
|
public containsChild(rid: string): boolean;
|
21
21
|
|
@@ -40,7 +40,7 @@ declare class SegmentCollection extends EventDispatcher {
|
|
40
40
|
|
41
41
|
public addSegmentChild(segmentId: string, rid: string, dataId?: string|null): boolean;
|
42
42
|
|
43
|
-
public addSegmentChildren(segmentId: string, rids: (string)[]|null): boolean;
|
43
|
+
public addSegmentChildren(segmentId: string, rids: (string)[]|null, dataIds?: (string)[]|null): boolean;
|
44
44
|
|
45
45
|
public containsSegmentChild(segmentId: string, rid: string): boolean;
|
46
46
|
|
@@ -133,6 +133,10 @@ declare class Core extends ElementWrapper {
|
|
133
133
|
|
134
134
|
public moveColumn(fromCol: number|(number)[]|null, destCol: number): boolean;
|
135
135
|
|
136
|
+
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
137
|
+
|
138
|
+
public reorderColumns(colRefs: number|string|(number|string)[]|null, destCol?: (number|string)|null): boolean;
|
139
|
+
|
136
140
|
public addRow(opt_num?: number|null): void;
|
137
141
|
|
138
142
|
public removeRow(opt_num?: number|null): void;
|
@@ -297,8 +301,6 @@ declare class Core extends ElementWrapper {
|
|
297
301
|
|
298
302
|
public getRelativePosition(obj: ElementWrapper|Element|Event|MouseEvent, context?: any): Core.MouseInfo;
|
299
303
|
|
300
|
-
public getColumnIndex(str: string): number;
|
301
|
-
|
302
304
|
public getVScrollbar(): ElementWrapper;
|
303
305
|
|
304
306
|
public getHScrollbar(): ElementWrapper;
|
@@ -393,6 +395,18 @@ declare class Core extends ElementWrapper {
|
|
393
395
|
|
394
396
|
public getColumnIds(): (string)[];
|
395
397
|
|
398
|
+
public setColumnField(colIndex: number, field: string): void;
|
399
|
+
|
400
|
+
public getColumnField(colIndex: number): string;
|
401
|
+
|
402
|
+
public getColumnFields(): (string)[];
|
403
|
+
|
404
|
+
public getColumnIndex(colRef: string|number|null): number;
|
405
|
+
|
406
|
+
public getColumnIndices(colRefs: (number|string)[]|null): (number)[];
|
407
|
+
|
408
|
+
public getColumnIndexMap(): { [key: string]: number };
|
409
|
+
|
396
410
|
}
|
397
411
|
|
398
412
|
declare function num(opt_type?: string|null): (ILayoutGrid)[];
|
@@ -409,7 +423,7 @@ declare function section(): number;
|
|
409
423
|
|
410
424
|
declare function path(obj: ElementWrapper|Element|Event|MouseEvent, context?: any): Core.MouseInfo;
|
411
425
|
|
412
|
-
declare function cellElement(
|
426
|
+
declare function cellElement(): ElementWrapper;
|
413
427
|
|
414
428
|
export default Core;
|
415
429
|
export { Core };
|
@@ -51,13 +51,13 @@ declare namespace ColumnDefinition {
|
|
51
51
|
|
52
52
|
declare class ColumnDefinition {
|
53
53
|
|
54
|
-
constructor(columnOption?: ColumnDefinition.Options|
|
54
|
+
constructor(columnOption?: ColumnDefinition.Options|null, hostGrid?: any);
|
55
55
|
|
56
56
|
public dispose(): void;
|
57
57
|
|
58
58
|
public _initializeTimeSeriesChild(columnOption?: ColumnDefinition.Options|string|null): void;
|
59
59
|
|
60
|
-
public initialize(columnOption?: ColumnDefinition.Options|
|
60
|
+
public initialize(columnOption?: ColumnDefinition.Options|null): void;
|
61
61
|
|
62
62
|
public getId(): string;
|
63
63
|
|