@refinitiv-ui/efx-grid 6.0.16 → 6.0.18
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +177 -64
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +2 -1
- package/lib/rt-grid/es6/Grid.d.ts +12 -2
- package/lib/rt-grid/es6/Grid.js +152 -54
- package/lib/rt-grid/es6/RowDefinition.js +4 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -4
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +344 -185
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +7 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +164 -147
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +1 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.js +27 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +44 -43
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +202 -497
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +40 -40
- package/lib/types/es6/ColumnGrouping.d.ts +4 -4
- package/lib/types/es6/ColumnStack.d.ts +7 -1
- package/lib/types/es6/Core/data/Segment.d.ts +3 -3
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/lib/types/es6/InCellEditing.d.ts +44 -43
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +10 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +6 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +13 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
- package/lib/types/es6/RowColoring.d.ts +17 -15
- package/lib/types/es6/RowFiltering.d.ts +30 -29
- package/lib/types/es6/RowGrouping.d.ts +40 -40
- package/lib/versions.json +5 -5
- package/package.json +1 -1
@@ -804,7 +804,8 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
804
804
|
}
|
805
805
|
|
806
806
|
value = core.isColumnVisible(colIndex);
|
807
|
-
|
807
|
+
// If "hidden" property already available from core/extensions, don't override this property
|
808
|
+
if(!value && obj["hidden"] == null) {
|
808
809
|
obj["hidden"] = true;
|
809
810
|
}
|
810
811
|
|
@@ -141,6 +141,8 @@ declare class Grid extends EventDispatcher {
|
|
141
141
|
|
142
142
|
public moveColumn(fromColIndex: number|(number)[]|null, toColIndex: number): boolean;
|
143
143
|
|
144
|
+
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
145
|
+
|
144
146
|
public hideColumn(colRef: Grid.ColumnReference|null, hidden?: boolean|null): void;
|
145
147
|
|
146
148
|
public hideColumns(colRefs: (Grid.ColumnReference)[]|null, hidden?: boolean|null): void;
|
@@ -191,7 +193,7 @@ declare class Grid extends EventDispatcher {
|
|
191
193
|
|
192
194
|
public hasHiddenRow(): boolean;
|
193
195
|
|
194
|
-
public setRic(rowRef: Grid.RowReference|null, str: string): void;
|
196
|
+
public setRic(rowRef: Grid.RowReference|null, str: string, options?: RowDefinition.Options|null): void;
|
195
197
|
|
196
198
|
public unlinkChain(rowRef: Grid.RowReference|null): void;
|
197
199
|
|
@@ -213,6 +215,8 @@ declare class Grid extends EventDispatcher {
|
|
213
215
|
|
214
216
|
public getColumnDefinition(colIndex: number): ColumnDefinition|null;
|
215
217
|
|
218
|
+
public getColumnDefinitions(): (ColumnDefinition)[];
|
219
|
+
|
216
220
|
public getColumnDefinitionById(colId: string): ColumnDefinition|null;
|
217
221
|
|
218
222
|
public getColumnDefinitionsById(colIds: (string)[]|null): ColumnDefinition|null;
|
@@ -221,7 +225,7 @@ declare class Grid extends EventDispatcher {
|
|
221
225
|
|
222
226
|
public getRowDefinitions(): (RowDefinition)[];
|
223
227
|
|
224
|
-
public getAllRowDefinitions(
|
228
|
+
public getAllRowDefinitions(inclAutoGenerated?: boolean|null): (RowDefinition)[];
|
225
229
|
|
226
230
|
public getRowData(rowIndex: number): any;
|
227
231
|
|
@@ -241,10 +245,14 @@ declare class Grid extends EventDispatcher {
|
|
241
245
|
|
242
246
|
public getColumnId(colIndex: number): string;
|
243
247
|
|
248
|
+
public getColumnIds(): (string)[];
|
249
|
+
|
244
250
|
public getColumnField(colIndex: number): string;
|
245
251
|
|
246
252
|
public getColumnFields(): (string)[];
|
247
253
|
|
254
|
+
public getColumnNames(): (string)[];
|
255
|
+
|
248
256
|
public getAllFields(): (string)[];
|
249
257
|
|
250
258
|
public freezeColumn(colIndex?: number|null, pinnedRightColumns?: number|null): void;
|
@@ -295,5 +303,7 @@ declare class Grid extends EventDispatcher {
|
|
295
303
|
|
296
304
|
declare function borders(gridOptions?: any): any;
|
297
305
|
|
306
|
+
declare function colCount(rowRef: number|string|null): RowDefinition|null;
|
307
|
+
|
298
308
|
export { Grid };
|
299
309
|
export default Grid;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -227,6 +227,45 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
227
227
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
228
228
|
};
|
229
229
|
|
230
|
+
/** @private
|
231
|
+
* @param {ColumnDefinition} colDef
|
232
|
+
* @return {string}
|
233
|
+
*/
|
234
|
+
var _getId = function(colDef) {
|
235
|
+
if(colDef) {
|
236
|
+
return colDef.getId();
|
237
|
+
}
|
238
|
+
return "";
|
239
|
+
};
|
240
|
+
/** @private
|
241
|
+
* @param {ColumnDefinition} colDef
|
242
|
+
* @return {string}
|
243
|
+
*/
|
244
|
+
var _getField = function(colDef) {
|
245
|
+
if(colDef) {
|
246
|
+
return colDef.getField();
|
247
|
+
}
|
248
|
+
return "";
|
249
|
+
};
|
250
|
+
/** @private
|
251
|
+
* @param {ColumnDefinition} colDef
|
252
|
+
* @return {string}
|
253
|
+
*/
|
254
|
+
var _getName = function(colDef) {
|
255
|
+
if(colDef) {
|
256
|
+
return colDef.getName();
|
257
|
+
}
|
258
|
+
return "";
|
259
|
+
};
|
260
|
+
/** @private
|
261
|
+
* @param {ColumnDefinition} colDef
|
262
|
+
* @param {string} str
|
263
|
+
* @return {boolean}
|
264
|
+
*/
|
265
|
+
var _hasFieldOrId = function(colDef, str) {
|
266
|
+
return (colDef.getField() === str) || (colDef.getId() === str);
|
267
|
+
};
|
268
|
+
|
230
269
|
/** @constructor
|
231
270
|
* @extends {EventDispatcher}
|
232
271
|
* @param {(Element|null)=} placeholder
|
@@ -1213,7 +1252,7 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
1213
1252
|
|
1214
1253
|
// JET
|
1215
1254
|
if (this._subs) {
|
1216
|
-
var colDefs = this.
|
1255
|
+
var colDefs = this.getColumnDefinitions();
|
1217
1256
|
var fields = colDefs.reduce(ColumnDefinition.getRealTimeFields, []);
|
1218
1257
|
this._subs["addFields"](fields);
|
1219
1258
|
}
|
@@ -1763,16 +1802,49 @@ Grid.prototype.removeAllColumns = function() {
|
|
1763
1802
|
}
|
1764
1803
|
};
|
1765
1804
|
|
1766
|
-
/**
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1805
|
+
/** Move the column at the specified index to the target index. When moving multiple columns, the original order of the source columns will be sorted by their index and the position of the columns will not be guaranteed to be exactly at the destination index.
|
1806
|
+
* @public
|
1807
|
+
* @param {number|Array.<number>} fromColIndex index or array of indices of the column(s) to be moved.
|
1808
|
+
* @param {number} toColIndex target column index
|
1809
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
1810
|
+
* @see {@link Grid#moveColumnById}
|
1811
|
+
*/
|
1773
1812
|
Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
1774
1813
|
return this._grid.moveColumn(fromColIndex, toColIndex);
|
1775
1814
|
};
|
1815
|
+
/** If source column is not found, no operation is performed. If destination column is not found, the source column will be moved to the last position.<br>
|
1816
|
+
* Note: this method behaves slightly different from moveColumn method in that it always put source column at the position before the specified destination column, while moveColumn method will put column at exactly at the destination index.
|
1817
|
+
* @public
|
1818
|
+
* @param {number|string} srcCol Column Id or index
|
1819
|
+
* @param {(number|string)=} destCol Column Id or index of the destination
|
1820
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
1821
|
+
* @see {@link Grid#moveColumn}
|
1822
|
+
* @example
|
1823
|
+
* grid.moveColumnById(3, 1); // Move column 3 to position before column 1
|
1824
|
+
* grid.moveColumnById(0, 2); // Move column 0 to position before column 2 (column index 1)
|
1825
|
+
* grid.moveColumnById(0, 1); // Nothing is moved
|
1826
|
+
* grid.moveColumnById("sourceColumnId", "anotherId");
|
1827
|
+
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
1828
|
+
*/
|
1829
|
+
Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
1830
|
+
var colCount = this.getColumnCount();
|
1831
|
+
var srcIndex = this.getColumnIndex(srcCol);
|
1832
|
+
if(srcIndex < 0 || srcIndex >= colCount) {
|
1833
|
+
return false;
|
1834
|
+
}
|
1835
|
+
var destIndex = this.getColumnIndex(destCol);
|
1836
|
+
if(destIndex < 0) {
|
1837
|
+
destIndex = colCount;
|
1838
|
+
}
|
1839
|
+
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
1840
|
+
--destIndex;
|
1841
|
+
}
|
1842
|
+
if(srcIndex === destIndex) {
|
1843
|
+
return false;
|
1844
|
+
}
|
1845
|
+
return this.moveColumn(srcIndex, destIndex);
|
1846
|
+
};
|
1847
|
+
|
1776
1848
|
|
1777
1849
|
/** The hidden column still occupies the same index.
|
1778
1850
|
* @public
|
@@ -2339,12 +2411,18 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
2339
2411
|
}
|
2340
2412
|
this._dispatch("beforeRowRemoved", {});
|
2341
2413
|
|
2342
|
-
var
|
2343
|
-
|
2344
|
-
|
2414
|
+
var connector = this._connector;
|
2415
|
+
var dt = this._dt;
|
2416
|
+
var childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
|
2417
|
+
if(childRowDefs) { // Remove all children first
|
2418
|
+
for(var i = 0; i < childRowDefs.length; i++) {
|
2419
|
+
connector.removeRic(childRowDefs[i]);
|
2420
|
+
}
|
2421
|
+
var rowIds = childRowDefs.map(RowDefinition.toRowId);
|
2422
|
+
dt.removeRows(rowIds);
|
2345
2423
|
}
|
2346
|
-
|
2347
|
-
|
2424
|
+
connector.removeRic(rowDef);
|
2425
|
+
dt.removeRow(rowDef.getRowId()); // TODO: Merge this with the above removeRows() method
|
2348
2426
|
rowDef.dispose(); // WARNING: This does not remove child reference from its parent
|
2349
2427
|
};
|
2350
2428
|
|
@@ -2399,19 +2477,35 @@ Grid.prototype.hasHiddenRow = function(){
|
|
2399
2477
|
* @public
|
2400
2478
|
* @param {Grid~RowReference} rowRef
|
2401
2479
|
* @param {string} str
|
2480
|
+
* @param {RowDefinition~Options=} options
|
2402
2481
|
*/
|
2403
|
-
Grid.prototype.setRic = function(rowRef, str) {
|
2482
|
+
Grid.prototype.setRic = function(rowRef, str, options) {
|
2404
2483
|
if(this._mainGrid) {
|
2405
2484
|
this._mainGrid.setRic(this._toRowId(rowRef), str);
|
2406
2485
|
return;
|
2407
2486
|
}
|
2408
2487
|
var rowDef = this._getRowDefinition(rowRef);
|
2409
2488
|
if(rowDef) {
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2489
|
+
options = options || {};
|
2490
|
+
var newChain = false;
|
2491
|
+
if(str.indexOf("0#") > 0 || options["asChain"]) {
|
2492
|
+
newChain = true;
|
2493
|
+
}
|
2494
|
+
if(rowDef.isChain() || newChain) {
|
2495
|
+
if(rowDef.getRic() !== str.replace("0#", "")) {
|
2496
|
+
var rowIndex = this._dv.getRowIndex(rowDef.getRowId());
|
2497
|
+
this.removeRow(rowDef);
|
2498
|
+
|
2499
|
+
options["ric"] = str;
|
2500
|
+
this.insertRow(options, rowIndex);
|
2501
|
+
}
|
2502
|
+
} else {
|
2503
|
+
var oldRic = rowDef.getRic();
|
2504
|
+
if(rowDef.setContent(str)) { // The given string may not be a RIC
|
2505
|
+
this._connector.removeRic(rowDef, oldRic);
|
2506
|
+
this._initDuplicateRicData(rowDef);
|
2507
|
+
this._connector.addRic(rowDef);
|
2508
|
+
}
|
2415
2509
|
}
|
2416
2510
|
}
|
2417
2511
|
};
|
@@ -2535,6 +2629,17 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
|
|
2535
2629
|
}
|
2536
2630
|
return null;
|
2537
2631
|
};
|
2632
|
+
/** @public
|
2633
|
+
* @return {!Array.<ColumnDefinition>}
|
2634
|
+
*/
|
2635
|
+
Grid.prototype.getColumnDefinitions = function() {
|
2636
|
+
var colCount = this.getColumnCount();
|
2637
|
+
var colDefs = new Array(colCount);
|
2638
|
+
for(var i = 0; i < colCount; i++) {
|
2639
|
+
colDefs[i] = this.getColumnDefinition(i);
|
2640
|
+
}
|
2641
|
+
return colDefs;
|
2642
|
+
};
|
2538
2643
|
|
2539
2644
|
/** @public
|
2540
2645
|
* @param {string} colId
|
@@ -2542,11 +2647,7 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
|
|
2542
2647
|
*/
|
2543
2648
|
Grid.prototype.getColumnDefinitionById = function(colId) {
|
2544
2649
|
if(typeof colId === "string") {
|
2545
|
-
|
2546
|
-
var colData = this._grid.getColumnData(colIndex);
|
2547
|
-
if(colData) {
|
2548
|
-
return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
|
2549
|
-
}
|
2650
|
+
return this.getColumnDefinition(this.getColumnIndex(colId));
|
2550
2651
|
}
|
2551
2652
|
return null;
|
2552
2653
|
};
|
@@ -2582,24 +2683,13 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
2582
2683
|
var colCount = this.getColumnCount();
|
2583
2684
|
for(var i = 0; i < colCount; ++i) {
|
2584
2685
|
var colDef = this.getColumnDefinition(i);
|
2585
|
-
if(
|
2586
|
-
return colDef; // Return the first found
|
2686
|
+
if(_hasFieldOrId(colDef, colRef)) {
|
2687
|
+
return colDef; // Return the first found column
|
2587
2688
|
}
|
2588
2689
|
}
|
2589
2690
|
}
|
2590
2691
|
return null;
|
2591
2692
|
};
|
2592
|
-
/** @private
|
2593
|
-
* @return {Array.<ColumnDefinition>}
|
2594
|
-
*/
|
2595
|
-
Grid.prototype._getAllColumnDefinitions = function() {
|
2596
|
-
var colCount = this.getColumnCount();
|
2597
|
-
var colDefs = new Array(colCount);
|
2598
|
-
for(var i = 0; i < colCount; i++) {
|
2599
|
-
colDefs[i] = this.getColumnDefinition(i);
|
2600
|
-
}
|
2601
|
-
return colDefs;
|
2602
|
-
};
|
2603
2693
|
|
2604
2694
|
/** @public
|
2605
2695
|
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
@@ -2655,16 +2745,17 @@ Grid.prototype.getRowDefinitions = function() {
|
|
2655
2745
|
Grid.prototype._getAllRowDefinitions = function() {
|
2656
2746
|
return this._dt.getColumnData(ROW_DEF); // no group header rows
|
2657
2747
|
};
|
2658
|
-
|
2748
|
+
|
2749
|
+
/** Get all row definitions, including filtered and hidden rows, but without auto generated rows (i.e., group header and chain constituent).
|
2659
2750
|
* @public
|
2660
|
-
* @param {boolean=}
|
2751
|
+
* @param {boolean=} inclAutoGenerated=false Set to true to include auto generated rows. Default value is false (exclude auto generated rows)
|
2661
2752
|
* @return {!Array.<RowDefinition>}
|
2662
2753
|
*/
|
2663
|
-
Grid.prototype.getAllRowDefinitions = function(
|
2664
|
-
if(
|
2665
|
-
return this.
|
2754
|
+
Grid.prototype.getAllRowDefinitions = function(inclAutoGenerated) {
|
2755
|
+
if(inclAutoGenerated) {
|
2756
|
+
return this._getAllRowDefinitions();
|
2666
2757
|
}
|
2667
|
-
return this.
|
2758
|
+
return this._dt.getColumnData(ROW_DEF).filter(excludeAutoGenerated);
|
2668
2759
|
};
|
2669
2760
|
/** A shorthand to retrieve row data based on index of the specified row.
|
2670
2761
|
* @public
|
@@ -2801,7 +2892,7 @@ Grid.prototype.getColumnIndex = function(colRef) {
|
|
2801
2892
|
} else if(typeof colRef === "string") {
|
2802
2893
|
for(i = 0; i < colCount; ++i) {
|
2803
2894
|
colDef = this.getColumnDefinition(i);
|
2804
|
-
if(
|
2895
|
+
if(_hasFieldOrId(colDef, colRef)) {
|
2805
2896
|
return i; // Return the first found field
|
2806
2897
|
}
|
2807
2898
|
}
|
@@ -2834,8 +2925,14 @@ Grid.prototype.getColumnIndices = function(colRefs) {
|
|
2834
2925
|
* @see {@link Grid#getColumnDefinition}
|
2835
2926
|
*/
|
2836
2927
|
Grid.prototype.getColumnId = function(colIndex) {
|
2837
|
-
|
2838
|
-
|
2928
|
+
return _getId(this.getColumnDefinition(colIndex));
|
2929
|
+
};
|
2930
|
+
/** Get ids from each column definition.
|
2931
|
+
* @public
|
2932
|
+
* @return {!Array.<string>} New array is created
|
2933
|
+
*/
|
2934
|
+
Grid.prototype.getColumnIds = function() {
|
2935
|
+
return this.getColumnDefinitions().map(_getId);
|
2839
2936
|
};
|
2840
2937
|
/** Return field defined in the column definition
|
2841
2938
|
* @public
|
@@ -2844,20 +2941,21 @@ Grid.prototype.getColumnId = function(colIndex) {
|
|
2844
2941
|
* @see {@link Grid#getColumnDefinition}
|
2845
2942
|
*/
|
2846
2943
|
Grid.prototype.getColumnField = function(colIndex) {
|
2847
|
-
|
2848
|
-
return (colDef) ? colDef.getField() : "";
|
2944
|
+
return _getField(this.getColumnDefinition(colIndex));
|
2849
2945
|
};
|
2850
2946
|
/** Get fields from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
2851
2947
|
* @public
|
2852
2948
|
* @return {!Array.<string>} New array is created
|
2853
2949
|
*/
|
2854
2950
|
Grid.prototype.getColumnFields = function() {
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2951
|
+
return this.getColumnDefinitions().map(_getField);
|
2952
|
+
};
|
2953
|
+
/** Get column name from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
2954
|
+
* @public
|
2955
|
+
* @return {!Array.<string>} New array is created
|
2956
|
+
*/
|
2957
|
+
Grid.prototype.getColumnNames = function() {
|
2958
|
+
return this.getColumnDefinitions().map(_getName);
|
2861
2959
|
};
|
2862
2960
|
/** Get all fields, including required fields and data fields, with no duplicate
|
2863
2961
|
* @public
|
@@ -273,6 +273,10 @@ RowDefinition.prototype.setContent = function(userInput) {
|
|
273
273
|
this._ric = this._userInput.replace("0#", "");
|
274
274
|
this._isChain = this._expanded = true; // Only chain can be expanded by 0# TODO: RIC with 0# is not necessarily a chain
|
275
275
|
this._chainRic = this._userInput;
|
276
|
+
if(this._view) {
|
277
|
+
this._view.setSegmentSeparator(this._rowId);
|
278
|
+
this.expandChain();
|
279
|
+
}
|
276
280
|
} else {
|
277
281
|
this._ric = this._userInput;
|
278
282
|
this._chainRic = "";
|
@@ -24,12 +24,12 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
24
24
|
|
25
25
|
constructor(options?: ColumnGroupingPlugin.Options|null);
|
26
26
|
|
27
|
-
public beforeProcessOption(optionName: string, optionValue: any): any;
|
28
|
-
|
29
27
|
public getName(): string;
|
30
28
|
|
31
29
|
public initialize(host: any, options?: any): void;
|
32
30
|
|
31
|
+
public beforeProcessOption(optionName: string, optionValue: any): any;
|
32
|
+
|
33
33
|
public unload(host: any): void;
|
34
34
|
|
35
35
|
public config(options: any): void;
|
@@ -66,9 +66,9 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
66
66
|
|
67
67
|
public getCellInfo(e: Element|Event|MouseEvent|null): any;
|
68
68
|
|
69
|
-
public moveColumnIntoGroup(
|
69
|
+
public moveColumnIntoGroup(colRef: number|string|null, to: number, groupId: string): void;
|
70
70
|
|
71
|
-
public setColumnParent(
|
71
|
+
public setColumnParent(colRef: number|string|null, groupId: string): void;
|
72
72
|
|
73
73
|
}
|
74
74
|
|