@refinitiv-ui/efx-grid 6.0.159 → 6.0.160
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 +43 -17
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +2 -0
- package/lib/rt-grid/es6/Grid.js +43 -17
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +2 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +46 -19
- package/lib/types/es6/InCellEditing.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
- package/lib/versions.json +1 -1
- package/package.json +1 -1
@@ -266,6 +266,8 @@ declare class Grid extends EventDispatcher {
|
|
266
266
|
|
267
267
|
public setStaticData(rowRef: Grid.RowReference|null, field: string, value: any): void;
|
268
268
|
|
269
|
+
public clearColumnData(colRefs: Grid.ColumnReference|(Grid.ColumnReference)[]|null): void;
|
270
|
+
|
269
271
|
public getColumnIndex(colRef: Grid.ColumnReference|null): number;
|
270
272
|
|
271
273
|
public getColumnIndices(colRefs: (Grid.ColumnReference)[]|null): (number)[];
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -3274,22 +3274,46 @@ Grid.prototype._getRowId = function(rowRef) {
|
|
3274
3274
|
return "";
|
3275
3275
|
};
|
3276
3276
|
|
3277
|
+
/** Clear all existing data from the specified column(s).
|
3278
|
+
* @public
|
3279
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRefs
|
3280
|
+
*/
|
3281
|
+
Grid.prototype.clearColumnData = function(colRefs) {
|
3282
|
+
let colIndices = this.getColumnIndices(colRefs);
|
3283
|
+
let colCount = colIndices.length;
|
3284
|
+
if(!colCount) {
|
3285
|
+
return;
|
3286
|
+
}
|
3287
|
+
let emptyData = {};
|
3288
|
+
for(let c = 0; c < colCount; ++c) {
|
3289
|
+
let colIndex = colIndices[c];
|
3290
|
+
let field = this.getColumnField(colIndex);
|
3291
|
+
if(field) {
|
3292
|
+
emptyData[field] = null;
|
3293
|
+
}
|
3294
|
+
}
|
3295
|
+
|
3296
|
+
let rowDefs = this.getAllRowDefinitions();
|
3297
|
+
let rowCount = rowDefs.length;
|
3298
|
+
for(let r = 0; r < rowCount; ++r) {
|
3299
|
+
rowDefs[r].setRowData(emptyData); // There is a conflator caching the data change in DataCache
|
3300
|
+
}
|
3301
|
+
};
|
3302
|
+
|
3277
3303
|
/** @public
|
3278
3304
|
* @param {Grid~ColumnReference} colRef
|
3279
3305
|
* @return {number}
|
3280
3306
|
*/
|
3281
3307
|
Grid.prototype.getColumnIndex = function(colRef) {
|
3282
|
-
if(colRef) {
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
return i;
|
3289
|
-
}
|
3308
|
+
if(colRef instanceof ColumnDefinition) {
|
3309
|
+
let colCount = this.getColumnCount();
|
3310
|
+
for(let i = 0; i < colCount; ++i) {
|
3311
|
+
let colDef = this.getColumnDefinition(i);
|
3312
|
+
if(colDef === colRef) {
|
3313
|
+
return i;
|
3290
3314
|
}
|
3291
|
-
return -1;
|
3292
3315
|
}
|
3316
|
+
return -1;
|
3293
3317
|
}
|
3294
3318
|
return this._grid.getColumnIndex(colRef);
|
3295
3319
|
};
|
@@ -3300,14 +3324,16 @@ Grid.prototype.getColumnIndex = function(colRef) {
|
|
3300
3324
|
*/
|
3301
3325
|
Grid.prototype.getColumnIndices = function(colRefs) {
|
3302
3326
|
let ary = [];
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
let
|
3309
|
-
|
3310
|
-
|
3327
|
+
if(colRefs || colRefs === 0) {
|
3328
|
+
let colCount = this.getColumnCount();
|
3329
|
+
let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
3330
|
+
let len = inputAry.length;
|
3331
|
+
// Verify user input
|
3332
|
+
for(let i = 0; i < len; ++i) {
|
3333
|
+
let colIndex = this.getColumnIndex(inputAry[i]);
|
3334
|
+
if(colIndex >= 0 && colIndex < colCount) {
|
3335
|
+
ary.push(colIndex); // WARNING: We have not checked for duplication
|
3336
|
+
}
|
3311
3337
|
}
|
3312
3338
|
}
|
3313
3339
|
return ary;
|
@@ -108,6 +108,8 @@ declare class InCellEditingPlugin extends GridPlugin {
|
|
108
108
|
|
109
109
|
public isColumnEditable(colIndex: number): boolean;
|
110
110
|
|
111
|
+
public setColumnEditability(colIndex: number, bool?: (boolean|null)|null): void;
|
112
|
+
|
111
113
|
public enableReadonly(enabled?: boolean|null): void;
|
112
114
|
|
113
115
|
public disableReadonly(disabled?: boolean|null): void;
|
@@ -86,7 +86,8 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
86
86
|
/** @event InCellEditingPlugin#editorClosed
|
87
87
|
* @description Fired after the text editor has been closed and all operations are done. This is useful to clean up left over resource and get result text entered.
|
88
88
|
* @type {Object}
|
89
|
-
* @property {
|
89
|
+
* @property {*=} text Converted value from the text that user has entered. The value is used for the commit.
|
90
|
+
* @property {string=} enteredText Text that user has entered. The text is not used for the commit. The text will be undefined, if the text has not been changed from the initial text at the opening.
|
90
91
|
* @property {boolean=} groupHeader This value is set to true if the editing row is a group header.
|
91
92
|
* @property {boolean=} segmentSeparator This value is set to true if the editing row is a segment separator.
|
92
93
|
* @property {Object} suggestionDetail Suggestion detail for auto suggest "item-select" event
|
@@ -97,7 +98,8 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
97
98
|
/** @event InCellEditingPlugin#beforeCommit
|
98
99
|
* @description Fired before the actual text commit (i.e. after user press enter). This is used for validating or modifying user input, and canceling the operation
|
99
100
|
* @type {Object}
|
100
|
-
* @property {
|
101
|
+
* @property {*=} text Converted value (with appropriate data type) from the text that user has entered. The value will be committed or stored on Grid.
|
102
|
+
* @property {string=} enteredText Text that user has entered. The text will NOT be committed or stored on Grid. The text will be undefined, if the text has not been changed from the initial text at the opening.
|
101
103
|
* @property {boolean=} cancel Set to true to cancel the commit operation.
|
102
104
|
* @property {boolean=} groupHeader This value is set to true if the editing row is a group header.
|
103
105
|
* @property {boolean=} segmentSeparator This value is set to true if the editing row is a segment separator.
|
@@ -1388,6 +1390,15 @@ InCellEditingPlugin.prototype.isColumnEditable = function (colIndex) {
|
|
1388
1390
|
let val = this._getColumnOption(colIndex, "editableContent");
|
1389
1391
|
return val == null ? this._editableContent : val;
|
1390
1392
|
};
|
1393
|
+
/** Change editability of the specified column at runtime
|
1394
|
+
* @public
|
1395
|
+
* @param {number} colIndex
|
1396
|
+
* @param {(boolean|null)=} bool If null or undefined value is specified, the editability will be decided by other extension settings
|
1397
|
+
*/
|
1398
|
+
InCellEditingPlugin.prototype.setColumnEditability = function (colIndex, bool) {
|
1399
|
+
let colData = this._newColumnData(colIndex);
|
1400
|
+
colData["editableContent"] = (bool != null) ? bool : null;
|
1401
|
+
};
|
1391
1402
|
|
1392
1403
|
/**
|
1393
1404
|
* @public
|
@@ -1479,6 +1490,20 @@ InCellEditingPlugin.prototype._onDoubleClick = function (e, opt_host) {
|
|
1479
1490
|
t.openEditor(arg.colIndex, arg.rowIndex, arg.section, host);
|
1480
1491
|
};
|
1481
1492
|
|
1493
|
+
/** @private
|
1494
|
+
* @param {Object} section Section (LayoutGrid) object
|
1495
|
+
* @returns {string} bgColor
|
1496
|
+
*/
|
1497
|
+
InCellEditingPlugin.prototype._getSectionBGColor = function (section) {
|
1498
|
+
if(this._elfVersion || this._inlineStyling) {
|
1499
|
+
let computedStyle = section.getComputedStyle();
|
1500
|
+
if(computedStyle) {
|
1501
|
+
return computedStyle.backgroundColor;
|
1502
|
+
}
|
1503
|
+
}
|
1504
|
+
return "";
|
1505
|
+
};
|
1506
|
+
|
1482
1507
|
/** @private
|
1483
1508
|
* @param {Element} e
|
1484
1509
|
* @param {Object} host core grid object
|
@@ -1570,10 +1595,7 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1570
1595
|
}
|
1571
1596
|
|
1572
1597
|
let editorStyle = editor.style;
|
1573
|
-
|
1574
|
-
editorStyle.backgroundColor = section.getComputedStyle().backgroundColor;
|
1575
|
-
}
|
1576
|
-
|
1598
|
+
editorStyle.backgroundColor = this._getSectionBGColor(section);
|
1577
1599
|
let rowH = section.getRowHeight(rowIndex);
|
1578
1600
|
let width = cell.getWidth();
|
1579
1601
|
if(!host.isPinnedColumn(colIndex)) {
|
@@ -1657,10 +1679,10 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1657
1679
|
t._editing = true; // Editing state cannot be false until a text has been committed or cancelled
|
1658
1680
|
};
|
1659
1681
|
|
1660
|
-
/**
|
1682
|
+
/** Open the row editor on the specified row
|
1661
1683
|
* @public
|
1662
|
-
* @param {number} rowIndex
|
1663
|
-
* @param {Object=} grid
|
1684
|
+
* @param {number} rowIndex Row index of a row to be opened.
|
1685
|
+
* @param {Object=} grid Core grid object used mainly for multi-table configuration. No need to supply this parameter for default single grid configuration.
|
1664
1686
|
* @fires InCellEditingPlugin#rowEditorOpened
|
1665
1687
|
*/
|
1666
1688
|
InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
@@ -1670,6 +1692,9 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1670
1692
|
if(t._getRowIndex(t._activeRowId) === rowIndex || !grid || t._readonly) {
|
1671
1693
|
return;
|
1672
1694
|
}
|
1695
|
+
if(grid.isDisposed()) {
|
1696
|
+
return;
|
1697
|
+
}
|
1673
1698
|
|
1674
1699
|
t.closeRowEditor(false, grid);
|
1675
1700
|
t._commitText(false);
|
@@ -1680,7 +1705,7 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1680
1705
|
let dataSource = grid.getDataSource();
|
1681
1706
|
let colCount = section.getColumnCount();
|
1682
1707
|
let isBottom = (rowIndex + 1) >= section.getRowCount();
|
1683
|
-
let sectionBGColor =
|
1708
|
+
let sectionBGColor = this._getSectionBGColor(section);
|
1684
1709
|
let rowH = section.getRowHeight(rowIndex);
|
1685
1710
|
|
1686
1711
|
// if normally parent popup will be document.body
|
@@ -1744,9 +1769,7 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1744
1769
|
|
1745
1770
|
let editor = inCellCache["editor"];
|
1746
1771
|
let editorStyle = editor.style;
|
1747
|
-
|
1748
|
-
editorStyle.backgroundColor = sectionBGColor;
|
1749
|
-
}
|
1772
|
+
editorStyle.backgroundColor = sectionBGColor;
|
1750
1773
|
editorStyle.height = rowH + "px";
|
1751
1774
|
|
1752
1775
|
// row editing mode does not support balloon mode
|
@@ -2105,7 +2128,11 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2105
2128
|
arg["section"].removeClass("edit-mode");
|
2106
2129
|
t._editing = false;
|
2107
2130
|
|
2108
|
-
let enteredValue = arg["text"] =
|
2131
|
+
let enteredValue = arg["text"] = t.getValue();
|
2132
|
+
let enteredText = t.getText();
|
2133
|
+
if(enteredText !== t._initialText) {
|
2134
|
+
arg["enteredText"] = enteredText;
|
2135
|
+
}
|
2109
2136
|
let groupHeader = arg["groupHeader"] || false;
|
2110
2137
|
|
2111
2138
|
if(committed){
|
@@ -2123,7 +2150,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2123
2150
|
let sectionType = sectionSettings.getType();
|
2124
2151
|
// case edit content
|
2125
2152
|
if("content" === sectionType) {
|
2126
|
-
if(
|
2153
|
+
if(t._realTimeGrid && arg["field"] === "X_RIC_NAME") {
|
2127
2154
|
let ricOpt = null;
|
2128
2155
|
if(suggestionDetail) {
|
2129
2156
|
let suggestionVal = suggestionDetail["value"];
|
@@ -2135,11 +2162,11 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2135
2162
|
}
|
2136
2163
|
}
|
2137
2164
|
|
2138
|
-
|
2165
|
+
t._realTimeGrid.setRic(arg["rowId"], enteredValue, ricOpt);
|
2139
2166
|
} else {
|
2140
2167
|
let dv = sectionSettings.getDataSource();
|
2141
2168
|
if(dv) {
|
2142
|
-
if(
|
2169
|
+
if(t._realTimeGrid) {
|
2143
2170
|
t._setStaticData(dv, arg["rowIndex"], arg["field"], enteredValue);
|
2144
2171
|
} else {
|
2145
2172
|
t._setData(dv, arg["rowIndex"], arg["field"], enteredValue);
|
@@ -2151,7 +2178,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2151
2178
|
t._activeCell.setContent(enteredValue);
|
2152
2179
|
}
|
2153
2180
|
} else if("title" === sectionType) {
|
2154
|
-
let gridApi =
|
2181
|
+
let gridApi = t.getGridApi();
|
2155
2182
|
if(gridApi) {
|
2156
2183
|
gridApi.setColumnName(arg["colIndex"], enteredValue);
|
2157
2184
|
}
|
@@ -2174,7 +2201,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2174
2201
|
Dom.removeParent(t._customElement);
|
2175
2202
|
|
2176
2203
|
let grid = arg["grid"];
|
2177
|
-
|
2204
|
+
t._requestUpdateStarterText(); // Need to updaate starter text when text commit
|
2178
2205
|
if(grid) {
|
2179
2206
|
t._freezeScrolling(grid, false);
|
2180
2207
|
grid.focus();
|
@@ -108,6 +108,8 @@ declare class InCellEditingPlugin extends GridPlugin {
|
|
108
108
|
|
109
109
|
public isColumnEditable(colIndex: number): boolean;
|
110
110
|
|
111
|
+
public setColumnEditability(colIndex: number, bool?: (boolean|null)|null): void;
|
112
|
+
|
111
113
|
public enableReadonly(enabled?: boolean|null): void;
|
112
114
|
|
113
115
|
public disableReadonly(disabled?: boolean|null): void;
|
@@ -303,6 +303,8 @@ declare class Grid extends EventDispatcher {
|
|
303
303
|
|
304
304
|
public setStaticData(rowRef: Grid.RowReference|null, field: string, value: any): void;
|
305
305
|
|
306
|
+
public clearColumnData(colRefs: Grid.ColumnReference|(Grid.ColumnReference)[]|null): void;
|
307
|
+
|
306
308
|
public getColumnIndex(colRef: Grid.ColumnReference|null): number;
|
307
309
|
|
308
310
|
public getColumnIndices(colRefs: (Grid.ColumnReference)[]|null): (number)[];
|
package/lib/versions.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
"tr-grid-contextmenu": "1.0.44",
|
20
20
|
"tr-grid-filter-input": "0.9.43",
|
21
21
|
"tr-grid-heat-map": "1.0.30",
|
22
|
-
"tr-grid-in-cell-editing": "1.0.
|
22
|
+
"tr-grid-in-cell-editing": "1.0.94",
|
23
23
|
"tr-grid-pagination": "1.0.24",
|
24
24
|
"tr-grid-percent-bar": "1.0.24",
|
25
25
|
"tr-grid-range-bar": "2.0.9",
|
package/package.json
CHANGED