@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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/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-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- 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 +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- 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 -57
- 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 -86
- 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 +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- 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 +49 -49
- 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/versions.json +4 -4
- 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
|
@@ -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);
|
|
@@ -552,7 +552,7 @@ GridPlugin.prototype._getColumnData = function(colIndex, grid) {
|
|
|
552
552
|
* @return {*}
|
|
553
553
|
*/
|
|
554
554
|
GridPlugin.prototype._getColumnOption = function(colIndex, prop, grid) {
|
|
555
|
-
|
|
555
|
+
let colData = this._getColumnData(colIndex, grid);
|
|
556
556
|
if(colData) {
|
|
557
557
|
return colData[prop];
|
|
558
558
|
}
|
|
@@ -572,7 +572,7 @@ GridPlugin.prototype._newColumnData = function(colIndex, grid) {
|
|
|
572
572
|
return {};
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
-
|
|
575
|
+
let colData = grid.getColumnData(colIndex);
|
|
576
576
|
if(!colData) {
|
|
577
577
|
colData = grid.setColumnData(colIndex, {});
|
|
578
578
|
}
|
|
@@ -584,7 +584,7 @@ GridPlugin.prototype._newColumnData = function(colIndex, grid) {
|
|
|
584
584
|
* @return {string}
|
|
585
585
|
*/
|
|
586
586
|
GridPlugin.prototype._getField = function(colIndex) {
|
|
587
|
-
|
|
587
|
+
let gridInst = this._compositeGrid || this._realTimeGrid;
|
|
588
588
|
if (gridInst) {
|
|
589
589
|
return gridInst.getColumnField(colIndex);
|
|
590
590
|
}
|
|
@@ -623,7 +623,7 @@ GridPlugin.prototype._getRow = function(dv, rowIndex) {
|
|
|
623
623
|
* @return {*}
|
|
624
624
|
*/
|
|
625
625
|
GridPlugin.prototype._getData = function(dv, rowIndex, field) {
|
|
626
|
-
|
|
626
|
+
let row = this._getRow(dv, rowIndex);
|
|
627
627
|
return row ? row[field] : undefined; // eslint-disable-line
|
|
628
628
|
};
|
|
629
629
|
/** @protected
|
|
@@ -635,7 +635,7 @@ GridPlugin.prototype._getData = function(dv, rowIndex, field) {
|
|
|
635
635
|
*/
|
|
636
636
|
GridPlugin.prototype._setData = function(dv, rowRef, field, val) {
|
|
637
637
|
if(this._realTimeGrid) {
|
|
638
|
-
|
|
638
|
+
let rowDef = _toRowDef(dv, rowRef);
|
|
639
639
|
if(rowDef) {
|
|
640
640
|
rowDef.setData(field, val);
|
|
641
641
|
}
|
|
@@ -655,7 +655,7 @@ GridPlugin.prototype._setData = function(dv, rowRef, field, val) {
|
|
|
655
655
|
*/
|
|
656
656
|
GridPlugin.prototype._setRowData = function(dv, rowRef, rowData) {
|
|
657
657
|
if(this._realTimeGrid) {
|
|
658
|
-
|
|
658
|
+
let rowDef = _toRowDef(dv, rowRef);
|
|
659
659
|
if(rowDef) {
|
|
660
660
|
rowDef.setRowData(rowData);
|
|
661
661
|
}
|
|
@@ -676,7 +676,7 @@ GridPlugin.prototype._setRowData = function(dv, rowRef, rowData) {
|
|
|
676
676
|
*/
|
|
677
677
|
GridPlugin.prototype._setStaticData = function(dv, rowRef, field, value) {
|
|
678
678
|
if(this._realTimeGrid) {
|
|
679
|
-
|
|
679
|
+
let rowDef = _toRowDef(dv, rowRef);
|
|
680
680
|
if(rowDef) {
|
|
681
681
|
rowDef.setStaticData(field, value);
|
|
682
682
|
}
|
|
@@ -702,8 +702,8 @@ GridPlugin.prototype._setColumnData = function (dv, cid, valueList, ridList) { /
|
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
|
|
706
|
-
|
|
705
|
+
let rids = Array.isArray(ridList) ? ridList : dv.getAllRowIds(true);
|
|
706
|
+
let rowCount = rids ? rids.length : 0;
|
|
707
707
|
if(!rowCount) {
|
|
708
708
|
return;
|
|
709
709
|
}
|
|
@@ -716,13 +716,13 @@ GridPlugin.prototype._setColumnData = function (dv, cid, valueList, ridList) { /
|
|
|
716
716
|
);
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
719
|
-
|
|
719
|
+
let vals = Array.isArray(valueList) ? valueList : rids.map(function() { return valueList; });
|
|
720
720
|
|
|
721
721
|
if(this._realTimeGrid) {
|
|
722
|
-
for(
|
|
723
|
-
|
|
722
|
+
for(let i = 0; i < rowCount; ++i) {
|
|
723
|
+
let dvRowData = dv.getRowData(rids[i]);
|
|
724
724
|
if(dvRowData) {
|
|
725
|
-
|
|
725
|
+
let rowDef = dvRowData["ROW_DEF"];
|
|
726
726
|
|
|
727
727
|
if(rowDef){
|
|
728
728
|
// WARNING: This does not trigger dataChanged and dataComposed on the DataCache
|
|
@@ -754,7 +754,7 @@ GridPlugin.prototype._activateColumnRenderer = function(colIndex, id, renderer)
|
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
|
|
757
|
+
let rtGrid = this._realTimeGrid;
|
|
758
758
|
if (rtGrid) {
|
|
759
759
|
rtGrid.activateColumnRenderer(colIndex, id, renderer);
|
|
760
760
|
} else {
|
|
@@ -769,12 +769,12 @@ GridPlugin.prototype._activateColumnRenderer = function(colIndex, id, renderer)
|
|
|
769
769
|
/** @private
|
|
770
770
|
* @function
|
|
771
771
|
*/
|
|
772
|
-
|
|
772
|
+
let _emptyFunc = function(){};
|
|
773
773
|
/** @private
|
|
774
774
|
* @type {Object.<string, number>}
|
|
775
775
|
* @constant
|
|
776
776
|
*/
|
|
777
|
-
|
|
777
|
+
let KEY_MAP = {
|
|
778
778
|
"left": 37,
|
|
779
779
|
"right": 39,
|
|
780
780
|
"up": 38,
|
|
@@ -805,13 +805,13 @@ GridPlugin.prototype._mockMouseEvent = function(colIndex, rowIndex, context) {
|
|
|
805
805
|
rowIndex = 0;
|
|
806
806
|
}
|
|
807
807
|
|
|
808
|
-
|
|
808
|
+
let evt = context ? context : {};
|
|
809
809
|
evt.preventDefault = _emptyFunc;
|
|
810
810
|
evt.stopPropagation = _emptyFunc;
|
|
811
811
|
|
|
812
812
|
if (colIndex >= 0 && rowIndex >= 0) {
|
|
813
|
-
|
|
814
|
-
|
|
813
|
+
let grid = this._activeGrid || this._hosts[0];
|
|
814
|
+
let cell = grid ? grid.getCell(evt.sectionType || "content", colIndex, rowIndex) : null;
|
|
815
815
|
evt.target = cell ? cell.getElement() : null;
|
|
816
816
|
}
|
|
817
817
|
|
|
@@ -823,12 +823,12 @@ GridPlugin.prototype._mockMouseEvent = function(colIndex, rowIndex, context) {
|
|
|
823
823
|
* @return {!Object}
|
|
824
824
|
*/
|
|
825
825
|
GridPlugin.prototype._mockKeyboardEvent = function(keyCode, context) {
|
|
826
|
-
|
|
826
|
+
let evt = context ? context : {};
|
|
827
827
|
evt.preventDefault = _emptyFunc;
|
|
828
828
|
evt.stopPropagation = _emptyFunc;
|
|
829
829
|
|
|
830
830
|
if (typeof keyCode === "string") {
|
|
831
|
-
|
|
831
|
+
let predefinedCode = KEY_MAP[keyCode.toLowerCase()] || 0;
|
|
832
832
|
keyCode = predefinedCode ? predefinedCode : keyCode.charCodeAt(0);
|
|
833
833
|
}
|
|
834
834
|
evt.keyCode = keyCode;
|
|
@@ -851,8 +851,8 @@ GridPlugin._themeLoaders = {};
|
|
|
851
851
|
* @param {Object} colors
|
|
852
852
|
*/
|
|
853
853
|
GridPlugin._themeLoadSuccess = function(styleCalculator, colors) {
|
|
854
|
-
|
|
855
|
-
|
|
854
|
+
let extName = this.getName();
|
|
855
|
+
let styles = GridPlugin._staticStyles[extName] = styleCalculator(colors);
|
|
856
856
|
this.applyStyles(styles, extName);
|
|
857
857
|
};
|
|
858
858
|
|
|
@@ -860,8 +860,8 @@ GridPlugin._themeLoadSuccess = function(styleCalculator, colors) {
|
|
|
860
860
|
* @param {Function} styleCalculator
|
|
861
861
|
*/
|
|
862
862
|
GridPlugin.prototype.applyStaticStyles = function(styleCalculator) {
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
let extName = this.getName();
|
|
864
|
+
let styles = GridPlugin._staticStyles[extName];
|
|
865
865
|
if (!styles) {
|
|
866
866
|
if (styleCalculator) {
|
|
867
867
|
if (!GridPlugin._themeLoaders[extName]) {
|
|
@@ -885,15 +885,15 @@ GridPlugin.prototype.applyStyles = function(cssString, nameSpace, replaceable) {
|
|
|
885
885
|
nameSpace = this.getName();
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
|
|
888
|
+
let intNameSpace = "_style" + nameSpace;
|
|
889
889
|
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
let hosts = this._hosts;
|
|
891
|
+
let len = hosts.length;
|
|
892
892
|
if (!len) {
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
-
|
|
896
|
+
let i, host;
|
|
897
897
|
if (!replaceable) {
|
|
898
898
|
for (i = 0; i < len; i++) {
|
|
899
899
|
host = hosts[i];
|
|
@@ -921,7 +921,7 @@ GridPlugin.prototype.revokeStyles = function(host, nameSpace) {
|
|
|
921
921
|
}
|
|
922
922
|
|
|
923
923
|
nameSpace = "_style" + nameSpace;
|
|
924
|
-
|
|
924
|
+
let styleTag = host[nameSpace];
|
|
925
925
|
if (styleTag && styleTag.nodeType === 1) {
|
|
926
926
|
styleTag.parentNode.removeChild(styleTag);
|
|
927
927
|
host[nameSpace] = null;
|
|
@@ -940,17 +940,17 @@ GridPlugin.prototype.revokeStyles = function(host, nameSpace) {
|
|
|
940
940
|
* console.log(tr.grid.SomePlugin); // tr.grid.SomePlugin is added to window scope
|
|
941
941
|
* console.log(tr.SomeExtension); // tr.SomeExtension is added to window scope
|
|
942
942
|
*/
|
|
943
|
-
|
|
943
|
+
let exportExtension = function(winObj, plugin) {
|
|
944
944
|
if(!winObj || !plugin) { return; }
|
|
945
945
|
if(!plugin.prototype["getName"]) { return; }
|
|
946
|
-
|
|
946
|
+
let pluginName = plugin.prototype["getName"]().replace(/Plugin$/, "");
|
|
947
947
|
if(!pluginName) { return; }
|
|
948
948
|
|
|
949
|
-
|
|
949
|
+
let trNamespace = winObj["tr"]; // For supporting composite grid extension scheme
|
|
950
950
|
if(!trNamespace) {
|
|
951
951
|
trNamespace = winObj["tr"] = {};
|
|
952
952
|
}
|
|
953
|
-
|
|
953
|
+
let gridNamespace = trNamespace["grid"]; // For supporting grid plugin scheme
|
|
954
954
|
if(!gridNamespace) {
|
|
955
955
|
gridNamespace = trNamespace["grid"] = {};
|
|
956
956
|
}
|
|
@@ -965,8 +965,8 @@ var exportExtension = function(winObj, plugin) {
|
|
|
965
965
|
* @param {number|string} rowRef Row index or row id
|
|
966
966
|
* @return {*} RowDefinition instance
|
|
967
967
|
*/
|
|
968
|
-
|
|
969
|
-
|
|
968
|
+
let _toRowDef = function(dv, rowRef) {
|
|
969
|
+
let dvRowData = (typeof rowRef === "number") ? dv.getRowDataAt(rowRef) : dv.getRowData(rowRef);
|
|
970
970
|
if(dvRowData) {
|
|
971
971
|
return dvRowData["ROW_DEF"] || null;
|
|
972
972
|
}
|
|
@@ -979,7 +979,7 @@ var _toRowDef = function(dv, rowRef) {
|
|
|
979
979
|
* @param {Object} dvRowData Row data from tr.DataView
|
|
980
980
|
* @return {*} Data value returned from the specified row and field
|
|
981
981
|
*/
|
|
982
|
-
|
|
982
|
+
let defaultDataGetter = function (field, dvRowData) {
|
|
983
983
|
return dvRowData[field];
|
|
984
984
|
};
|
|
985
985
|
/** @public
|
|
@@ -988,8 +988,8 @@ var defaultDataGetter = function (field, dvRowData) {
|
|
|
988
988
|
* @param {Object} dvRowData Row data from tr.DataView
|
|
989
989
|
* @return {*} Data value returned from the specified row and field
|
|
990
990
|
*/
|
|
991
|
-
|
|
992
|
-
|
|
991
|
+
let rowDefDataGetter = function (field, dvRowData) {
|
|
992
|
+
let rowData = dvRowData["ROW_DEF"].getRowData();
|
|
993
993
|
return (rowData) ? rowData[field] : null;
|
|
994
994
|
};
|
|
995
995
|
/** @public
|
|
@@ -997,7 +997,7 @@ var rowDefDataGetter = function (field, dvRowData) {
|
|
|
997
997
|
* @param {Object} dvRowData
|
|
998
998
|
* @return {Object} Row data Nothing is changed
|
|
999
999
|
*/
|
|
1000
|
-
|
|
1000
|
+
let defaultRowGetter = function (dvRowData) {
|
|
1001
1001
|
return dvRowData;
|
|
1002
1002
|
};
|
|
1003
1003
|
/** @public
|
|
@@ -1005,7 +1005,7 @@ var defaultRowGetter = function (dvRowData) {
|
|
|
1005
1005
|
* @param {Object} dvRowData Row data from tr.DataView
|
|
1006
1006
|
* @return {Object} Row data
|
|
1007
1007
|
*/
|
|
1008
|
-
|
|
1008
|
+
let rowDefRowGetter = function (dvRowData) {
|
|
1009
1009
|
return dvRowData ? dvRowData["ROW_DEF"].getRowData() : null;
|
|
1010
1010
|
};
|
|
1011
1011
|
/** This is slower version of row getter. It is intended for ease of use.
|
|
@@ -1014,9 +1014,9 @@ var rowDefRowGetter = function (dvRowData) {
|
|
|
1014
1014
|
* @param {Object} dvRowData Row data from tr.DataView
|
|
1015
1015
|
* @return {Object} Row data
|
|
1016
1016
|
*/
|
|
1017
|
-
|
|
1017
|
+
let rowGetter = function (dvRowData) {
|
|
1018
1018
|
if(dvRowData) {
|
|
1019
|
-
|
|
1019
|
+
let rowDef = dvRowData["ROW_DEF"];
|
|
1020
1020
|
return rowDef ? rowDef.getRowData() : dvRowData;
|
|
1021
1021
|
}
|
|
1022
1022
|
return null;
|
|
@@ -1028,11 +1028,11 @@ var rowGetter = function (dvRowData) {
|
|
|
1028
1028
|
* @param {tr.DataTable} dt
|
|
1029
1029
|
* @return {!Array.<Object>} Array of row data
|
|
1030
1030
|
*/
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
for(
|
|
1031
|
+
let colDataGetter = function(field, dt) {
|
|
1032
|
+
let rowDefs = dt.getAllRowData();
|
|
1033
|
+
let rowCount = rowDefs.length;
|
|
1034
|
+
let rows = new Array(rowCount);
|
|
1035
|
+
for(let i = 0; i < rowCount; ++i) { // WARNING: No data checking
|
|
1036
1036
|
rows[i] = rowDefDataGetter(field, rowDefs[i]);
|
|
1037
1037
|
}
|
|
1038
1038
|
return rows;
|