@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +94 -104
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -1,4 +1,5 @@
|
|
1
1
|
/** @typedef {Object} FilterOperators~Operator
|
2
|
+
* @property {string} id Short name of the operator
|
2
3
|
* @property {string} name Full name of the operator
|
3
4
|
* @property {string} type Data type of the parameters required by the operator (e.g., number, string)
|
4
5
|
* @property {number} positive The value indicates that the operator has positive connotation. The negative counterparts for EQ and BEGIN are NEQ and NBEGIN respectively.
|
@@ -29,13 +30,23 @@
|
|
29
30
|
* @property {!FilterOperators~Operator} TXTEQ Alias to EQ
|
30
31
|
* @property {!FilterOperators~Operator} BLANK Alias to EQ_BLANK
|
31
32
|
* @property {!FilterOperators~Operator} NBLANK Alias to EQ_NBLANK
|
33
|
+
* @property {!FilterOperators~Operator} NEQ_BLANK Alias to EQ_NBLANK
|
34
|
+
* @property {!FilterOperators~Operator} GREATER_THAN Alias to GT
|
35
|
+
* @property {!FilterOperators~Operator} GREATER_THAN_OR_EQUAL_TO Alias to GTE
|
36
|
+
* @property {!FilterOperators~Operator} EQUAL_TO Alias to EQ
|
37
|
+
* @property {!FilterOperators~Operator} LESS_THAN Alias to LT
|
38
|
+
* @property {!FilterOperators~Operator} LESS_THAN_OR_EQUAL_TO Alias to LTE
|
39
|
+
* @property {!FilterOperators~Operator} TEXT_THAT_CONTAINS Alias to CONT
|
40
|
+
* @property {!FilterOperators~Operator} TEXT_THAT_NOT_CONTAINS Alias to NCONT
|
41
|
+
* @property {!FilterOperators~Operator} TEXT_IS Alias to EQ
|
42
|
+
* @property {!FilterOperators~Operator} NOT_BLANK Alias to EQ_NBLANK
|
32
43
|
*/
|
33
44
|
|
34
45
|
/** @type {!FilterOperators~Operators}
|
35
46
|
* @public
|
36
47
|
* @const
|
37
48
|
*/
|
38
|
-
|
49
|
+
let FilterOperators = {
|
39
50
|
EQ: {
|
40
51
|
id: "EQ",
|
41
52
|
name: "Equal to",
|
@@ -214,7 +225,7 @@ FilterOperators.NOT_BLANK = FilterOperators.EQ_NBLANK;
|
|
214
225
|
* @public
|
215
226
|
* @const
|
216
227
|
*/
|
217
|
-
|
228
|
+
let OperatorFunctions = {
|
218
229
|
EQ: function(str, input) { return str == input; },
|
219
230
|
NEQ: function(str, input) { return str != input; },
|
220
231
|
NUMEQ: function(num, input) { return num == input; },
|
@@ -11,10 +11,10 @@ import {ElfUtil} from "./ElfUtil.js";
|
|
11
11
|
* import {Ext} from "../../node_modules/tr-grid-util/src/Ext.js";
|
12
12
|
* import {GridPlugin} from "../../node_modules/tr-grid-util/src/GridPlugin.js";
|
13
13
|
*
|
14
|
-
*
|
14
|
+
* let SomePlugin = function() {};
|
15
15
|
* Ext.inherits(SomePlugin, GridPlugin);
|
16
16
|
*/
|
17
|
-
|
17
|
+
let GridPlugin = function() {};
|
18
18
|
Ext.inherits(GridPlugin, EventDispatcher);
|
19
19
|
|
20
20
|
/** @type {Array.<tr.Grid>}
|
@@ -68,7 +68,7 @@ GridPlugin.prototype.unlisten = GridPlugin.prototype.removeEventListener;
|
|
68
68
|
* @param {tr.CompositeGrid=} grid Composite grid control
|
69
69
|
*/
|
70
70
|
GridPlugin.prototype.afterInit = function(elem, model, grid) {
|
71
|
-
|
71
|
+
let core = null;
|
72
72
|
if(grid && grid["getCoreGrid"]) {
|
73
73
|
core = grid["getCoreGrid"]();
|
74
74
|
}
|
@@ -159,10 +159,10 @@ GridPlugin.prototype.unload = function (host) {
|
|
159
159
|
* @return {tr.Grid}
|
160
160
|
*/
|
161
161
|
GridPlugin.prototype.getRelativeGrid = function (e) {
|
162
|
-
|
162
|
+
let targetEl = null;
|
163
163
|
if(e.target) { // The Given object is an Event
|
164
164
|
targetEl = /** @type{Element} */(e.target);
|
165
|
-
|
165
|
+
let gridAPI = targetEl["api"];
|
166
166
|
if(gridAPI && gridAPI["getCoreGrid"]) {
|
167
167
|
return /** @type{tr.Grid} */(gridAPI["getCoreGrid"]());
|
168
168
|
}
|
@@ -173,8 +173,8 @@ GridPlugin.prototype.getRelativeGrid = function (e) {
|
|
173
173
|
}
|
174
174
|
|
175
175
|
if(targetEl) {
|
176
|
-
for(
|
177
|
-
|
176
|
+
for(let i = this._hosts.length; --i >= 0;) {
|
177
|
+
let host = this._hosts[i];
|
178
178
|
if(host.getElement().contains(targetEl)) {
|
179
179
|
return host;
|
180
180
|
}
|
@@ -206,7 +206,7 @@ GridPlugin.prototype.getGridApi = function (coreRef) {
|
|
206
206
|
if(coreRef == null) {
|
207
207
|
return this._compositeGrid || this._realTimeGrid;
|
208
208
|
} else {
|
209
|
-
|
209
|
+
let host = (typeof coreRef == "number") ? this._hosts[coreRef] : coreRef;
|
210
210
|
return host ? (host._wrapper || null) : null;
|
211
211
|
}
|
212
212
|
};
|
@@ -218,7 +218,7 @@ GridPlugin.prototype.getGridApi = function (coreRef) {
|
|
218
218
|
*/
|
219
219
|
GridPlugin.prototype.getColumnName = function (colRef) {
|
220
220
|
if(this._compositeGrid) {
|
221
|
-
|
221
|
+
let colOptions = this._compositeGrid.getColumnModel(colRef);
|
222
222
|
if(colOptions) {
|
223
223
|
if(colOptions.title) {
|
224
224
|
return colOptions.title;
|
@@ -227,8 +227,8 @@ GridPlugin.prototype.getColumnName = function (colRef) {
|
|
227
227
|
}
|
228
228
|
}
|
229
229
|
} else {
|
230
|
-
|
231
|
-
|
230
|
+
let colIndex = this.getColumnIndex(colRef);
|
231
|
+
let colDef = this._realTimeGrid.getColumnDefinition(colIndex);
|
232
232
|
if(colDef) {
|
233
233
|
return colDef.getName();
|
234
234
|
}
|
@@ -245,8 +245,8 @@ GridPlugin.prototype.getColumnIndex = function (colRef) {
|
|
245
245
|
return colRef;
|
246
246
|
}
|
247
247
|
if(this._compositeGrid) {
|
248
|
-
|
249
|
-
|
248
|
+
let allFields = this._compositeGrid.getColumnFields();
|
249
|
+
let colIndex = allFields.indexOf(colRef);
|
250
250
|
if(colIndex > -1) {
|
251
251
|
return colIndex;
|
252
252
|
} else {
|
@@ -261,25 +261,25 @@ GridPlugin.prototype.getColumnIndex = function (colRef) {
|
|
261
261
|
* @return {Array.<number>} column indices
|
262
262
|
*/
|
263
263
|
GridPlugin.prototype.getColumnIndices = function (colRefs) {
|
264
|
-
|
264
|
+
let api = this.getGridApi();
|
265
265
|
if(api.getColumnIndices) {
|
266
266
|
return api.getColumnIndices(colRefs);
|
267
267
|
}
|
268
268
|
|
269
269
|
// TODO: Unify the below logics
|
270
270
|
if(this._compositeGrid) {
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
for (
|
271
|
+
let allFields = this._compositeGrid.getColumnFields();
|
272
|
+
let columnCount = this._compositeGrid.getColumnCount();
|
273
|
+
let columnIndices = [];
|
274
|
+
let colRef;
|
275
|
+
for (let i = 0; i < colRefs.length; i++) {
|
276
276
|
colRef = colRefs[i];
|
277
277
|
if(typeof colRef === 'number') { // When user pass index
|
278
278
|
if(colRef >= 0 && colRef < columnCount) {
|
279
279
|
columnIndices.push(colRef);
|
280
280
|
}
|
281
281
|
} else {
|
282
|
-
|
282
|
+
let columnIndex = allFields.indexOf(colRef); // Looping check column index of colRefs field
|
283
283
|
if(columnIndex !== -1) {
|
284
284
|
columnIndices.push(columnIndex);
|
285
285
|
}
|
@@ -300,7 +300,7 @@ GridPlugin.prototype.getColumnId = function (colIndex) {
|
|
300
300
|
return colIndex;
|
301
301
|
}
|
302
302
|
|
303
|
-
|
303
|
+
let colCount = this.getColumnCount();
|
304
304
|
if(colIndex < 0 || colIndex >= colCount) { // Avoid creating undesired column definitions in Core Grid.
|
305
305
|
return "";
|
306
306
|
}
|
@@ -308,7 +308,7 @@ GridPlugin.prototype.getColumnId = function (colIndex) {
|
|
308
308
|
if(this._compositeGrid) {
|
309
309
|
return this._compositeGrid.getColumnId(colIndex);
|
310
310
|
} else {
|
311
|
-
|
311
|
+
let colDef = this._realTimeGrid.getColumnDefinition(colIndex);
|
312
312
|
if(colDef) {
|
313
313
|
return colDef.getId();
|
314
314
|
}
|
@@ -348,7 +348,7 @@ GridPlugin.prototype.getColumnFields = function () {
|
|
348
348
|
*/
|
349
349
|
GridPlugin.prototype.getColumnCount = function() {
|
350
350
|
if(this._hosts) {
|
351
|
-
|
351
|
+
let g = this._hosts[0];
|
352
352
|
return g ? g.getColumnCount() : 0;
|
353
353
|
}
|
354
354
|
return 0;
|
@@ -360,11 +360,11 @@ GridPlugin.prototype.getColumnCount = function() {
|
|
360
360
|
* @return {boolean}
|
361
361
|
*/
|
362
362
|
GridPlugin.prototype._moveColumnById = function (srcCol, destCol) {
|
363
|
-
|
364
|
-
|
363
|
+
let hosts = this._hosts;
|
364
|
+
let len = hosts ? hosts.length : 0;
|
365
365
|
if(len) {
|
366
|
-
|
367
|
-
for(
|
366
|
+
let dirty = 0;
|
367
|
+
for(let i = 0; i < len; ++i) {
|
368
368
|
dirty |= hosts[i].moveColumnById(srcCol, destCol);
|
369
369
|
}
|
370
370
|
return dirty ? true : false;
|
@@ -378,11 +378,11 @@ GridPlugin.prototype._moveColumnById = function (srcCol, destCol) {
|
|
378
378
|
* @return {boolean} Return true if there is any change, and false otherwise
|
379
379
|
*/
|
380
380
|
GridPlugin.prototype._reorderColumns = function (colRefs, destCol) {
|
381
|
-
|
382
|
-
|
381
|
+
let hosts = this._hosts;
|
382
|
+
let len = hosts ? hosts.length : 0;
|
383
383
|
if(len) {
|
384
|
-
|
385
|
-
for(
|
384
|
+
let dirty = 0;
|
385
|
+
for(let i = 0; i < len; ++i) {
|
386
386
|
dirty |= hosts[i].reorderColumns(colRefs, destCol);
|
387
387
|
}
|
388
388
|
return dirty ? true : false;
|
@@ -434,9 +434,9 @@ GridPlugin.prototype._requestPlugin = function (host, pluginRef, configObj) {
|
|
434
434
|
* @return {Promise}
|
435
435
|
*/
|
436
436
|
GridPlugin.requestPlugin = function (ref, pluginRef, configObj, compositeGrid, realTimeGrid) {
|
437
|
-
|
437
|
+
let core = null;
|
438
438
|
if(ref) {
|
439
|
-
|
439
|
+
let gridWrapper = null;
|
440
440
|
if(ref.nodeType === 1) { // This is an element
|
441
441
|
// TODO: Support delayed resolving
|
442
442
|
gridWrapper = ref.api; // Grid element must already be initialized and configured
|
@@ -461,11 +461,11 @@ GridPlugin.requestPlugin = function (ref, pluginRef, configObj, compositeGrid, r
|
|
461
461
|
return Promise.reject("Cannot find grid element");
|
462
462
|
}
|
463
463
|
|
464
|
-
|
464
|
+
let curPlugin = core.getPlugin(pluginRef);
|
465
465
|
if(curPlugin) {
|
466
466
|
return Promise.resolve(curPlugin);
|
467
467
|
} else {
|
468
|
-
|
468
|
+
let d = new Deferred();
|
469
469
|
setTimeout(GridPlugin._onPluginRequested.bind(null, {
|
470
470
|
grid: core,
|
471
471
|
pluginRef: pluginRef,
|
@@ -482,17 +482,17 @@ GridPlugin.requestPlugin = function (ref, pluginRef, configObj, compositeGrid, r
|
|
482
482
|
* @return {Promise.<*>} Promise of plugin object
|
483
483
|
*/
|
484
484
|
GridPlugin._onPluginRequested = function (ctx) {
|
485
|
-
|
485
|
+
let grid = ctx.grid;
|
486
486
|
if(!grid.getElement()) {
|
487
487
|
return ctx.deferred.reject("Grid has been disposed before the plugin is fully loaded: " + ctx.pluginRef);
|
488
488
|
}
|
489
489
|
|
490
|
-
|
490
|
+
let curPlugin = grid.getPlugin(ctx.pluginRef);
|
491
491
|
if(curPlugin) {
|
492
492
|
return ctx.deferred.resolve(curPlugin);
|
493
493
|
}
|
494
494
|
|
495
|
-
|
495
|
+
let beforeInitPerformed = false;
|
496
496
|
if(ctx.pluginRef.beforeInit) { // WARNING: beforeInit is usually performed before the actual loading
|
497
497
|
beforeInitPerformed = true;
|
498
498
|
ctx.pluginRef.beforeInit(grid.getElement(), ctx.config, true);
|
@@ -504,7 +504,6 @@ GridPlugin._onPluginRequested = function (ctx) {
|
|
504
504
|
}
|
505
505
|
|
506
506
|
if(!beforeInitPerformed && curPlugin.beforeInit) { // WARNING: beforeInit is usually performed before the actual loading
|
507
|
-
beforeInitPerformed = true;
|
508
507
|
curPlugin.beforeInit(grid.getElement(), ctx.config);
|
509
508
|
}
|
510
509
|
if(curPlugin.setGridWrapper) {
|
@@ -552,7 +551,7 @@ GridPlugin.prototype._getColumnData = function(colIndex, grid) {
|
|
552
551
|
* @return {*}
|
553
552
|
*/
|
554
553
|
GridPlugin.prototype._getColumnOption = function(colIndex, prop, grid) {
|
555
|
-
|
554
|
+
let colData = this._getColumnData(colIndex, grid);
|
556
555
|
if(colData) {
|
557
556
|
return colData[prop];
|
558
557
|
}
|
@@ -572,7 +571,7 @@ GridPlugin.prototype._newColumnData = function(colIndex, grid) {
|
|
572
571
|
return {};
|
573
572
|
}
|
574
573
|
|
575
|
-
|
574
|
+
let colData = grid.getColumnData(colIndex);
|
576
575
|
if(!colData) {
|
577
576
|
colData = grid.setColumnData(colIndex, {});
|
578
577
|
}
|
@@ -584,7 +583,7 @@ GridPlugin.prototype._newColumnData = function(colIndex, grid) {
|
|
584
583
|
* @return {string}
|
585
584
|
*/
|
586
585
|
GridPlugin.prototype._getField = function(colIndex) {
|
587
|
-
|
586
|
+
let gridInst = this._compositeGrid || this._realTimeGrid;
|
588
587
|
if (gridInst) {
|
589
588
|
return gridInst.getColumnField(colIndex);
|
590
589
|
}
|
@@ -623,7 +622,7 @@ GridPlugin.prototype._getRow = function(dv, rowIndex) {
|
|
623
622
|
* @return {*}
|
624
623
|
*/
|
625
624
|
GridPlugin.prototype._getData = function(dv, rowIndex, field) {
|
626
|
-
|
625
|
+
let row = this._getRow(dv, rowIndex);
|
627
626
|
return row ? row[field] : undefined; // eslint-disable-line
|
628
627
|
};
|
629
628
|
/** @protected
|
@@ -635,7 +634,7 @@ GridPlugin.prototype._getData = function(dv, rowIndex, field) {
|
|
635
634
|
*/
|
636
635
|
GridPlugin.prototype._setData = function(dv, rowRef, field, val) {
|
637
636
|
if(this._realTimeGrid) {
|
638
|
-
|
637
|
+
let rowDef = _toRowDef(dv, rowRef);
|
639
638
|
if(rowDef) {
|
640
639
|
rowDef.setData(field, val);
|
641
640
|
}
|
@@ -655,7 +654,7 @@ GridPlugin.prototype._setData = function(dv, rowRef, field, val) {
|
|
655
654
|
*/
|
656
655
|
GridPlugin.prototype._setRowData = function(dv, rowRef, rowData) {
|
657
656
|
if(this._realTimeGrid) {
|
658
|
-
|
657
|
+
let rowDef = _toRowDef(dv, rowRef);
|
659
658
|
if(rowDef) {
|
660
659
|
rowDef.setRowData(rowData);
|
661
660
|
}
|
@@ -676,7 +675,7 @@ GridPlugin.prototype._setRowData = function(dv, rowRef, rowData) {
|
|
676
675
|
*/
|
677
676
|
GridPlugin.prototype._setStaticData = function(dv, rowRef, field, value) {
|
678
677
|
if(this._realTimeGrid) {
|
679
|
-
|
678
|
+
let rowDef = _toRowDef(dv, rowRef);
|
680
679
|
if(rowDef) {
|
681
680
|
rowDef.setStaticData(field, value);
|
682
681
|
}
|
@@ -702,8 +701,8 @@ GridPlugin.prototype._setColumnData = function (dv, cid, valueList, ridList) { /
|
|
702
701
|
return;
|
703
702
|
}
|
704
703
|
|
705
|
-
|
706
|
-
|
704
|
+
let rids = Array.isArray(ridList) ? ridList : dv.getAllRowIds(true);
|
705
|
+
let rowCount = rids ? rids.length : 0;
|
707
706
|
if(!rowCount) {
|
708
707
|
return;
|
709
708
|
}
|
@@ -716,13 +715,13 @@ GridPlugin.prototype._setColumnData = function (dv, cid, valueList, ridList) { /
|
|
716
715
|
);
|
717
716
|
return;
|
718
717
|
}
|
719
|
-
|
718
|
+
let vals = Array.isArray(valueList) ? valueList : rids.map(function() { return valueList; });
|
720
719
|
|
721
720
|
if(this._realTimeGrid) {
|
722
|
-
for(
|
723
|
-
|
721
|
+
for(let i = 0; i < rowCount; ++i) {
|
722
|
+
let dvRowData = dv.getRowData(rids[i]);
|
724
723
|
if(dvRowData) {
|
725
|
-
|
724
|
+
let rowDef = dvRowData["ROW_DEF"];
|
726
725
|
|
727
726
|
if(rowDef){
|
728
727
|
// WARNING: This does not trigger dataChanged and dataComposed on the DataCache
|
@@ -754,7 +753,7 @@ GridPlugin.prototype._activateColumnRenderer = function(colIndex, id, renderer)
|
|
754
753
|
return;
|
755
754
|
}
|
756
755
|
|
757
|
-
|
756
|
+
let rtGrid = this._realTimeGrid;
|
758
757
|
if (rtGrid) {
|
759
758
|
rtGrid.activateColumnRenderer(colIndex, id, renderer);
|
760
759
|
} else {
|
@@ -769,12 +768,12 @@ GridPlugin.prototype._activateColumnRenderer = function(colIndex, id, renderer)
|
|
769
768
|
/** @private
|
770
769
|
* @function
|
771
770
|
*/
|
772
|
-
|
771
|
+
let _emptyFunc = function(){};
|
773
772
|
/** @private
|
774
773
|
* @type {Object.<string, number>}
|
775
774
|
* @constant
|
776
775
|
*/
|
777
|
-
|
776
|
+
let KEY_MAP = {
|
778
777
|
"left": 37,
|
779
778
|
"right": 39,
|
780
779
|
"up": 38,
|
@@ -805,13 +804,13 @@ GridPlugin.prototype._mockMouseEvent = function(colIndex, rowIndex, context) {
|
|
805
804
|
rowIndex = 0;
|
806
805
|
}
|
807
806
|
|
808
|
-
|
807
|
+
let evt = context ? context : {};
|
809
808
|
evt.preventDefault = _emptyFunc;
|
810
809
|
evt.stopPropagation = _emptyFunc;
|
811
810
|
|
812
811
|
if (colIndex >= 0 && rowIndex >= 0) {
|
813
|
-
|
814
|
-
|
812
|
+
let grid = this._activeGrid || this._hosts[0];
|
813
|
+
let cell = grid ? grid.getCell(evt.sectionType || "content", colIndex, rowIndex) : null;
|
815
814
|
evt.target = cell ? cell.getElement() : null;
|
816
815
|
}
|
817
816
|
|
@@ -823,12 +822,12 @@ GridPlugin.prototype._mockMouseEvent = function(colIndex, rowIndex, context) {
|
|
823
822
|
* @return {!Object}
|
824
823
|
*/
|
825
824
|
GridPlugin.prototype._mockKeyboardEvent = function(keyCode, context) {
|
826
|
-
|
825
|
+
let evt = context ? context : {};
|
827
826
|
evt.preventDefault = _emptyFunc;
|
828
827
|
evt.stopPropagation = _emptyFunc;
|
829
828
|
|
830
829
|
if (typeof keyCode === "string") {
|
831
|
-
|
830
|
+
let predefinedCode = KEY_MAP[keyCode.toLowerCase()] || 0;
|
832
831
|
keyCode = predefinedCode ? predefinedCode : keyCode.charCodeAt(0);
|
833
832
|
}
|
834
833
|
evt.keyCode = keyCode;
|
@@ -851,8 +850,8 @@ GridPlugin._themeLoaders = {};
|
|
851
850
|
* @param {Object} colors
|
852
851
|
*/
|
853
852
|
GridPlugin._themeLoadSuccess = function(styleCalculator, colors) {
|
854
|
-
|
855
|
-
|
853
|
+
let extName = this.getName();
|
854
|
+
let styles = GridPlugin._staticStyles[extName] = styleCalculator(colors);
|
856
855
|
this.applyStyles(styles, extName);
|
857
856
|
};
|
858
857
|
|
@@ -860,8 +859,8 @@ GridPlugin._themeLoadSuccess = function(styleCalculator, colors) {
|
|
860
859
|
* @param {Function} styleCalculator
|
861
860
|
*/
|
862
861
|
GridPlugin.prototype.applyStaticStyles = function(styleCalculator) {
|
863
|
-
|
864
|
-
|
862
|
+
let extName = this.getName();
|
863
|
+
let styles = GridPlugin._staticStyles[extName];
|
865
864
|
if (!styles) {
|
866
865
|
if (styleCalculator) {
|
867
866
|
if (!GridPlugin._themeLoaders[extName]) {
|
@@ -885,15 +884,15 @@ GridPlugin.prototype.applyStyles = function(cssString, nameSpace, replaceable) {
|
|
885
884
|
nameSpace = this.getName();
|
886
885
|
}
|
887
886
|
|
888
|
-
|
887
|
+
let intNameSpace = "_style" + nameSpace;
|
889
888
|
|
890
|
-
|
891
|
-
|
889
|
+
let hosts = this._hosts;
|
890
|
+
let len = hosts.length;
|
892
891
|
if (!len) {
|
893
892
|
return;
|
894
893
|
}
|
895
894
|
|
896
|
-
|
895
|
+
let i, host;
|
897
896
|
if (!replaceable) {
|
898
897
|
for (i = 0; i < len; i++) {
|
899
898
|
host = hosts[i];
|
@@ -921,7 +920,7 @@ GridPlugin.prototype.revokeStyles = function(host, nameSpace) {
|
|
921
920
|
}
|
922
921
|
|
923
922
|
nameSpace = "_style" + nameSpace;
|
924
|
-
|
923
|
+
let styleTag = host[nameSpace];
|
925
924
|
if (styleTag && styleTag.nodeType === 1) {
|
926
925
|
styleTag.parentNode.removeChild(styleTag);
|
927
926
|
host[nameSpace] = null;
|
@@ -940,17 +939,17 @@ GridPlugin.prototype.revokeStyles = function(host, nameSpace) {
|
|
940
939
|
* console.log(tr.grid.SomePlugin); // tr.grid.SomePlugin is added to window scope
|
941
940
|
* console.log(tr.SomeExtension); // tr.SomeExtension is added to window scope
|
942
941
|
*/
|
943
|
-
|
942
|
+
let exportExtension = function(winObj, plugin) {
|
944
943
|
if(!winObj || !plugin) { return; }
|
945
944
|
if(!plugin.prototype["getName"]) { return; }
|
946
|
-
|
945
|
+
let pluginName = plugin.prototype["getName"]().replace(/Plugin$/, "");
|
947
946
|
if(!pluginName) { return; }
|
948
947
|
|
949
|
-
|
948
|
+
let trNamespace = winObj["tr"]; // For supporting composite grid extension scheme
|
950
949
|
if(!trNamespace) {
|
951
950
|
trNamespace = winObj["tr"] = {};
|
952
951
|
}
|
953
|
-
|
952
|
+
let gridNamespace = trNamespace["grid"]; // For supporting grid plugin scheme
|
954
953
|
if(!gridNamespace) {
|
955
954
|
gridNamespace = trNamespace["grid"] = {};
|
956
955
|
}
|
@@ -965,8 +964,8 @@ var exportExtension = function(winObj, plugin) {
|
|
965
964
|
* @param {number|string} rowRef Row index or row id
|
966
965
|
* @return {*} RowDefinition instance
|
967
966
|
*/
|
968
|
-
|
969
|
-
|
967
|
+
let _toRowDef = function(dv, rowRef) {
|
968
|
+
let dvRowData = (typeof rowRef === "number") ? dv.getRowDataAt(rowRef) : dv.getRowData(rowRef);
|
970
969
|
if(dvRowData) {
|
971
970
|
return dvRowData["ROW_DEF"] || null;
|
972
971
|
}
|
@@ -979,7 +978,7 @@ var _toRowDef = function(dv, rowRef) {
|
|
979
978
|
* @param {Object} dvRowData Row data from tr.DataView
|
980
979
|
* @return {*} Data value returned from the specified row and field
|
981
980
|
*/
|
982
|
-
|
981
|
+
let defaultDataGetter = function (field, dvRowData) {
|
983
982
|
return dvRowData[field];
|
984
983
|
};
|
985
984
|
/** @public
|
@@ -988,8 +987,8 @@ var defaultDataGetter = function (field, dvRowData) {
|
|
988
987
|
* @param {Object} dvRowData Row data from tr.DataView
|
989
988
|
* @return {*} Data value returned from the specified row and field
|
990
989
|
*/
|
991
|
-
|
992
|
-
|
990
|
+
let rowDefDataGetter = function (field, dvRowData) {
|
991
|
+
let rowData = dvRowData["ROW_DEF"].getRowData();
|
993
992
|
return (rowData) ? rowData[field] : null;
|
994
993
|
};
|
995
994
|
/** @public
|
@@ -997,7 +996,7 @@ var rowDefDataGetter = function (field, dvRowData) {
|
|
997
996
|
* @param {Object} dvRowData
|
998
997
|
* @return {Object} Row data Nothing is changed
|
999
998
|
*/
|
1000
|
-
|
999
|
+
let defaultRowGetter = function (dvRowData) {
|
1001
1000
|
return dvRowData;
|
1002
1001
|
};
|
1003
1002
|
/** @public
|
@@ -1005,7 +1004,7 @@ var defaultRowGetter = function (dvRowData) {
|
|
1005
1004
|
* @param {Object} dvRowData Row data from tr.DataView
|
1006
1005
|
* @return {Object} Row data
|
1007
1006
|
*/
|
1008
|
-
|
1007
|
+
let rowDefRowGetter = function (dvRowData) {
|
1009
1008
|
return dvRowData ? dvRowData["ROW_DEF"].getRowData() : null;
|
1010
1009
|
};
|
1011
1010
|
/** This is slower version of row getter. It is intended for ease of use.
|
@@ -1014,9 +1013,9 @@ var rowDefRowGetter = function (dvRowData) {
|
|
1014
1013
|
* @param {Object} dvRowData Row data from tr.DataView
|
1015
1014
|
* @return {Object} Row data
|
1016
1015
|
*/
|
1017
|
-
|
1016
|
+
let rowGetter = function (dvRowData) {
|
1018
1017
|
if(dvRowData) {
|
1019
|
-
|
1018
|
+
let rowDef = dvRowData["ROW_DEF"];
|
1020
1019
|
return rowDef ? rowDef.getRowData() : dvRowData;
|
1021
1020
|
}
|
1022
1021
|
return null;
|
@@ -1028,11 +1027,11 @@ var rowGetter = function (dvRowData) {
|
|
1028
1027
|
* @param {tr.DataTable} dt
|
1029
1028
|
* @return {!Array.<Object>} Array of row data
|
1030
1029
|
*/
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
for(
|
1030
|
+
let colDataGetter = function(field, dt) {
|
1031
|
+
let rowDefs = dt.getAllRowData();
|
1032
|
+
let rowCount = rowDefs.length;
|
1033
|
+
let rows = new Array(rowCount);
|
1034
|
+
for(let i = 0; i < rowCount; ++i) { // WARNING: No data checking
|
1036
1035
|
rows[i] = rowDefDataGetter(field, rowDefs[i]);
|
1037
1036
|
}
|
1038
1037
|
return rows;
|