@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
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/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
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -157,7 +157,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
157
157
|
*/
|
158
158
|
|
159
159
|
/** @event Grid#beforeContentBinding
|
160
|
-
* @property {Object} e Event of beforeContentBinding,
|
160
|
+
* @property {Object} e Event of beforeContentBinding, we can use e.actualUpdate to check the actual data update, otherwise It will be empty when it is rendered by row virtualization or only the UI changes.
|
161
161
|
* @description Trigger before content binding.
|
162
162
|
*/
|
163
163
|
|
@@ -244,33 +244,33 @@ let compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
244
244
|
* @param {string} sortOrder
|
245
245
|
* @return {number} The outcome of the value comparison
|
246
246
|
*/
|
247
|
-
let _sortChildrenOfChain =
|
247
|
+
let _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
248
248
|
let parentA = rowDefA.getParent();
|
249
249
|
|
250
250
|
if (!parentA) {
|
251
|
-
|
251
|
+
return 0;
|
252
252
|
}
|
253
253
|
|
254
254
|
let parentB = rowDefB.getParent();
|
255
255
|
|
256
256
|
if (!parentB) {
|
257
|
-
|
257
|
+
return 0;
|
258
258
|
}
|
259
259
|
|
260
260
|
if (parentA !== parentB) {
|
261
|
-
|
261
|
+
return 0;
|
262
262
|
}
|
263
263
|
|
264
264
|
let a = rowDefA.getData('CHILD_ORDER');
|
265
265
|
|
266
266
|
if (a == null) {
|
267
|
-
|
267
|
+
return 0;
|
268
268
|
}
|
269
269
|
|
270
270
|
let b = rowDefB.getData('CHILD_ORDER');
|
271
271
|
|
272
272
|
if (b == null) {
|
273
|
-
|
273
|
+
return 0;
|
274
274
|
}
|
275
275
|
|
276
276
|
return ( a - b ) * sortOrder;
|
@@ -1493,7 +1493,7 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
|
1493
1493
|
return;
|
1494
1494
|
}
|
1495
1495
|
|
1496
|
-
let colDefs
|
1496
|
+
let colDefs = this._timeSeriesChildConflator.popAllData();
|
1497
1497
|
let i, j, len, childField, idx;
|
1498
1498
|
|
1499
1499
|
for (i = 0; i < colDefs.length; i++) {
|
@@ -1603,7 +1603,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
1603
1603
|
|
1604
1604
|
let colDef = this.getColumnDefinition(colIndex);
|
1605
1605
|
if(colDef && colConfig.id == null) {
|
1606
|
-
colConfig.id =
|
1606
|
+
colConfig.id = colDef.getId(); // retain ID
|
1607
1607
|
}
|
1608
1608
|
this._grid.startBatch("reset");
|
1609
1609
|
this.removeColumn(colIndex);
|
@@ -2374,7 +2374,7 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
2374
2374
|
* ], ["field1", "field2", "field3"]); // 3 rows are appended
|
2375
2375
|
*
|
2376
2376
|
* grid.addStaticDataRows([ // Object format can also be used
|
2377
|
-
* {"field1": 40, "field2": "a",
|
2377
|
+
* {"field1": 40, "field2": "a", "field3": true},
|
2378
2378
|
* {"field1": 50, "field2": "b"}, // each row doesn't have to be the same
|
2379
2379
|
* {"field1": 60, "field4": "some thing"}
|
2380
2380
|
* ]); // 3 more rows are appended
|
@@ -2710,9 +2710,16 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2710
2710
|
}
|
2711
2711
|
let rowDef = this._getRowDefinitionByRef(rowRef);
|
2712
2712
|
if(rowDef) {
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2713
|
+
var tempOpt = options || {};
|
2714
|
+
if(typeof str === "string") {
|
2715
|
+
tempOpt["ric"] = str;
|
2716
|
+
} else {
|
2717
|
+
if(str && !options) {
|
2718
|
+
tempOpt = str;
|
2719
|
+
}
|
2720
|
+
str = tempOpt["ric"] ? tempOpt["ric"] : "";
|
2721
|
+
}
|
2722
|
+
let extractedOptions = RowDefinition.extractRowOptions(tempOpt);
|
2716
2723
|
let oldRic = rowDef.getSymbol();
|
2717
2724
|
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
2718
2725
|
this._connector.removeRic(rowDef, oldRic);
|
@@ -2720,9 +2727,9 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2720
2727
|
this._connector.addRic(rowDef);
|
2721
2728
|
}
|
2722
2729
|
|
2723
|
-
let values =
|
2730
|
+
let values = tempOpt["values"];
|
2724
2731
|
if(values != null) {
|
2725
|
-
rowDef.setStaticRowData(values,
|
2732
|
+
rowDef.setStaticRowData(values, tempOpt["fields"]);
|
2726
2733
|
}
|
2727
2734
|
}
|
2728
2735
|
};
|
@@ -3694,7 +3701,7 @@ Grid.prototype.isFocused = function() {
|
|
3694
3701
|
return this.contains(activeElement);
|
3695
3702
|
}
|
3696
3703
|
// For wrapper scenarios, such as atlas-blotter or efx-grid
|
3697
|
-
return
|
3704
|
+
return activeElement.shadowRoot === this._topNode.parentNode;
|
3698
3705
|
};
|
3699
3706
|
/** @description Focus grid element without moving window scrollbar
|
3700
3707
|
* @public
|
@@ -3988,26 +3995,35 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
3988
3995
|
};
|
3989
3996
|
|
3990
3997
|
/** @public
|
3991
|
-
* @description Replace existing row
|
3998
|
+
* @description Replace existing row by a new row. Row Id is always changed, after the row is replaced.
|
3992
3999
|
* @param {Grid~RowReference} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
3993
4000
|
* @param {(RowDefinition~Options|string)=} rowOption
|
3994
|
-
* @returns {RowDefinition}
|
4001
|
+
* @returns {RowDefinition} Returns null, if the row is not replaced. Otherwise, a newly created row is returned
|
3995
4002
|
*/
|
3996
4003
|
Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
3997
|
-
let
|
3998
|
-
let rowDef = this.
|
3999
|
-
|
4000
|
-
|
4004
|
+
let insertPos = this._getRowId(rowRef);
|
4005
|
+
let rowDef = this._getRowDefinitionById(insertPos);
|
4006
|
+
|
4007
|
+
if(rowDef) {
|
4008
|
+
if(rowDef.isAutoGenerated()) {
|
4009
|
+
return null; // Users cannot replace an auto-generated row
|
4010
|
+
}
|
4011
|
+
|
4012
|
+
let configObj = rowDef.getConfigObject();
|
4013
|
+
if(rowDef.getRowId() === rowOption["rowId"]) {
|
4014
|
+
return null; // Cannot replace a row with the same row id
|
4015
|
+
}
|
4016
|
+
|
4017
|
+
if(deepEqual(configObj, rowOption)){
|
4018
|
+
return null;
|
4019
|
+
}
|
4001
4020
|
}
|
4002
|
-
let configObj = rowDef.getConfigObject();
|
4003
4021
|
|
4004
|
-
|
4005
|
-
|
4006
|
-
|
4007
|
-
let insertedRow = this.insertRow(rowOption, rowId);
|
4008
|
-
this.removeRow(rowId);
|
4009
|
-
return insertedRow;
|
4022
|
+
let newRow = this.insertRow(rowOption, insertPos);
|
4023
|
+
if(rowDef) {
|
4024
|
+
this.removeRow(insertPos);
|
4010
4025
|
}
|
4026
|
+
return newRow;
|
4011
4027
|
};
|
4012
4028
|
|
4013
4029
|
/** Scroll the view to the specified column. If the column is already in the view, nothing happens. If the column is outside of the view, the view will be moved to the column with some additional offsets
|
@@ -4051,7 +4067,7 @@ Grid.prototype.getScrollTop = function () {
|
|
4051
4067
|
Grid.prototype.setScrollLeft = function (pixels) {
|
4052
4068
|
this._grid.setScrollLeft(pixels);
|
4053
4069
|
};
|
4054
|
-
/**
|
4070
|
+
/** Set scroll value to the vertical scrollbar. This will move the scrollbar to specific position
|
4055
4071
|
* @public
|
4056
4072
|
* @param {number} pixels
|
4057
4073
|
* @see {@link Grid.scrollDown}
|
@@ -17,6 +17,7 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
|
|
17
17
|
* @property {boolean=} hidden=true When this row is hidden
|
18
18
|
* @property {boolean=} realTime=true Realtime row, able to request for JET/RTK
|
19
19
|
* @property {Object=} info=null For storing any additional information to the row
|
20
|
+
* @property {string=} rowId Row identifier used for referencing the row
|
20
21
|
*/
|
21
22
|
|
22
23
|
/** @typedef {Object} RowDefinition~RowTypes
|
@@ -113,6 +114,10 @@ RowDefinition.prototype._rowId = ""; // Row Id must be unique
|
|
113
114
|
* @private
|
114
115
|
*/
|
115
116
|
RowDefinition.prototype._dataId = ""; // Data id can be different from rowId for constituents of a chain
|
117
|
+
/** @type {boolean}
|
118
|
+
* @private
|
119
|
+
*/
|
120
|
+
RowDefinition.prototype._userId = false;
|
116
121
|
/** @type {DataCache}
|
117
122
|
* @private
|
118
123
|
*/
|
@@ -207,6 +212,7 @@ RowDefinition.prototype.dispose = function() {
|
|
207
212
|
this._view = null;
|
208
213
|
}
|
209
214
|
this._rowId = this._dataId = "";
|
215
|
+
this._userId = false;
|
210
216
|
this._userModel = null;
|
211
217
|
};
|
212
218
|
/** @public
|
@@ -223,6 +229,14 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
223
229
|
return;
|
224
230
|
}
|
225
231
|
|
232
|
+
if(!this._autoGenerated) {
|
233
|
+
let userRowId = rowOptions["rowId"];
|
234
|
+
if(userRowId && typeof userRowId === "string") {
|
235
|
+
this._rowId = this._dataId = userRowId;
|
236
|
+
this._userId = true;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
226
240
|
let extractedOptions = RowDefinition.extractRowOptions(rowOptions);
|
227
241
|
|
228
242
|
let val = rowOptions["permId"];
|
@@ -346,28 +360,36 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
346
360
|
} else {
|
347
361
|
this._ric = this._userInput;
|
348
362
|
}
|
349
|
-
this._isChain = asChain;
|
363
|
+
this._isChain = asChain != null ? asChain : null; // this could be null or undefined
|
350
364
|
this._chainRic = chainRic || "";
|
351
365
|
}
|
352
366
|
|
367
|
+
let segmentId = "";
|
353
368
|
if(this._view) {
|
354
|
-
|
355
|
-
|
356
|
-
let
|
357
|
-
|
358
|
-
|
359
|
-
|
369
|
+
segmentId = this._view.getSegmentParentRowId(this._rowId);
|
370
|
+
if(this._isChain && segmentId){ // If the row was a normal row and has been changed to a chain, remove it from existing segment
|
371
|
+
let targetRowId = _getEndOfSegmentRowId(this._view, this._rowId);
|
372
|
+
this._view.removeSegmentChild(segmentId, this._rowId);
|
373
|
+
this._view.moveRow(this._rowId, targetRowId);
|
374
|
+
|
375
|
+
segmentId = "";
|
360
376
|
}
|
361
377
|
this._view.setSegmentSeparator(this._rowId, !!this._isChain);
|
362
|
-
if(this.
|
363
|
-
this.
|
364
|
-
|
365
|
-
|
378
|
+
if(this.isChainCollapsed()) {
|
379
|
+
if(this._expanded){
|
380
|
+
this.expandChain();
|
381
|
+
}
|
382
|
+
} else {
|
383
|
+
if (!this._expanded) {
|
384
|
+
this.collapseChain();
|
385
|
+
}
|
366
386
|
}
|
367
387
|
}
|
368
388
|
|
369
|
-
this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric
|
370
|
-
|
389
|
+
this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric
|
390
|
+
if(segmentId) { // If data id is changed and the row is a child of a segment, then segment child data id must be updated
|
391
|
+
this._view.addSegmentChild(segmentId, this._rowId, this._dataId);
|
392
|
+
}
|
371
393
|
|
372
394
|
if(!this.subscribeForUpdates()) {
|
373
395
|
if(this._dc) {
|
@@ -393,6 +415,11 @@ RowDefinition.prototype.getRowId = function() {
|
|
393
415
|
*/
|
394
416
|
RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
395
417
|
let obj = rowOptions || {};
|
418
|
+
|
419
|
+
if(this._userId) {
|
420
|
+
obj["rowId"] = this._rowId;
|
421
|
+
}
|
422
|
+
|
396
423
|
let val = this._ric;
|
397
424
|
if(val) {
|
398
425
|
obj["ric"] = val;
|
@@ -870,6 +897,22 @@ RowDefinition.prototype.resetUpdates = function() {
|
|
870
897
|
}
|
871
898
|
};
|
872
899
|
|
900
|
+
/** @private
|
901
|
+
* @param {DataView} view
|
902
|
+
* @param {string} rowId
|
903
|
+
* @returns {string}
|
904
|
+
*/
|
905
|
+
let _getEndOfSegmentRowId = function(view, rowId) {
|
906
|
+
let rowIndex = view.getRowIndex(rowId);
|
907
|
+
do {
|
908
|
+
rowId = view.getRowId(++rowIndex);
|
909
|
+
if(rowId && !view.getSegmentParentRowId(rowId)) {
|
910
|
+
break;
|
911
|
+
}
|
912
|
+
} while(rowId);
|
913
|
+
return rowId;
|
914
|
+
};
|
915
|
+
|
873
916
|
/** @public
|
874
917
|
* @param {DataView} view
|
875
918
|
* @param {string=} rowId
|
@@ -892,14 +935,29 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
|
|
892
935
|
rowData = {};
|
893
936
|
rowData[ROW_DEF] = this;
|
894
937
|
|
895
|
-
let
|
896
|
-
|
938
|
+
let parentRowId = "";
|
939
|
+
if(rowId) {
|
940
|
+
parentRowId = view.getSegmentParentRowId(rowId);
|
941
|
+
if(parentRowId) {
|
942
|
+
if(this._isChain) { // A chain cannot be put inside another segment
|
943
|
+
rowId = _getEndOfSegmentRowId(view, rowId);
|
944
|
+
} // else { // Normal row is inserted into a segment
|
945
|
+
}
|
946
|
+
}
|
947
|
+
|
948
|
+
let newRowId = view.insertRow(rowId, rowData, this.getRowId());
|
949
|
+
if(newRowId !== this._rowId) {
|
950
|
+
this._rowId = newRowId; // In case there is some duplicate row id
|
951
|
+
this._userId = false;
|
952
|
+
}
|
897
953
|
|
898
954
|
if(this._isChain) {
|
899
955
|
view.setSegmentSeparator(this._rowId);
|
900
956
|
if(!this._expanded) {
|
901
957
|
this.collapseChain();
|
902
958
|
}
|
959
|
+
} else if(parentRowId) {
|
960
|
+
view.addSegmentChild(parentRowId, this._rowId, this._dataId);
|
903
961
|
}
|
904
962
|
};
|
905
963
|
/** @private
|
@@ -1285,7 +1343,7 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
1285
1343
|
extractedOptions["collapsed"] = collapsed;
|
1286
1344
|
}
|
1287
1345
|
extractedOptions["ric"] = ric;
|
1288
|
-
extractedOptions["permId"] = permId;
|
1346
|
+
extractedOptions["permId"] = permId || "";
|
1289
1347
|
extractedOptions["chainRic"] = chainRic;
|
1290
1348
|
extractedOptions["asChain"] = asChain;
|
1291
1349
|
return extractedOptions;
|
@@ -385,7 +385,62 @@ CellSelectionPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
385
385
|
}
|
386
386
|
return obj;
|
387
387
|
};
|
388
|
-
|
388
|
+
/** @public
|
389
|
+
* @description Emitate the mousedown event. This is for testing purpose.
|
390
|
+
* @ignore
|
391
|
+
* @param {number} colIndex
|
392
|
+
* @param {number} rowIndex
|
393
|
+
*/
|
394
|
+
CellSelectionPlugin.prototype.mockMouseClick = function (colIndex, rowIndex) {
|
395
|
+
var host = this._hosts[0];
|
396
|
+
host.focus(); // Used for blur event triggering
|
397
|
+
var evt = this._mockMouseEvent(colIndex, rowIndex);
|
398
|
+
this._onMouseDown(evt);
|
399
|
+
this._onMouseUp(evt);
|
400
|
+
};
|
401
|
+
/** @public
|
402
|
+
* @description Emitate the mousedown event. This is for testing purpose.
|
403
|
+
* @ignore
|
404
|
+
* @param {number} colIndex
|
405
|
+
* @param {number} rowIndex
|
406
|
+
*/
|
407
|
+
CellSelectionPlugin.prototype.mockMouseDown = function (colIndex, rowIndex) {
|
408
|
+
var evt = this._mockMouseEvent(colIndex, rowIndex);
|
409
|
+
this._onMouseDown(evt);
|
410
|
+
};
|
411
|
+
/** @public
|
412
|
+
* @description Emitate the mousedown event. This is for testing purpose.
|
413
|
+
* @ignore
|
414
|
+
* @param {number} colIndex
|
415
|
+
* @param {number} rowIndex
|
416
|
+
*/
|
417
|
+
CellSelectionPlugin.prototype.mockMouseUp = function (colIndex, rowIndex) {
|
418
|
+
var evt = this._mockMouseEvent(colIndex, rowIndex);
|
419
|
+
this._onMouseUp(evt);
|
420
|
+
};
|
421
|
+
/** @public
|
422
|
+
* @description Emitate the mousemove event. This is for testing purpose.
|
423
|
+
* @ignore
|
424
|
+
* @param {number} colIndex
|
425
|
+
* @param {number} rowIndex
|
426
|
+
* @param {number} x
|
427
|
+
* @param {number} y
|
428
|
+
* @param {Element} target Specify element out side of Grid to test scrolling
|
429
|
+
*/
|
430
|
+
CellSelectionPlugin.prototype.mockMouseMove = function (colIndex, rowIndex, x, y, target) {
|
431
|
+
var evt = {
|
432
|
+
clientX: x,
|
433
|
+
clientY: y
|
434
|
+
};
|
435
|
+
evt = this._mockMouseEvent(colIndex, rowIndex, evt);
|
436
|
+
if (target) {
|
437
|
+
evt.target = target;
|
438
|
+
evt.path = [target];
|
439
|
+
} else {
|
440
|
+
evt.path = [evt.target];
|
441
|
+
}
|
442
|
+
this._onMouseMove(evt);
|
443
|
+
};
|
389
444
|
/** Fire when mouse down.
|
390
445
|
* @private
|
391
446
|
* @param {MouseEvent} e
|
@@ -2,7 +2,7 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
|
2
2
|
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
3
3
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
4
|
import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
|
5
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
5
|
+
import { injectCss, prettifyCss, deepEqual } from "../../tr-grid-util/es6/Util.js";
|
6
6
|
|
7
7
|
declare namespace ColumnGroupingPlugin {
|
8
8
|
|
@@ -39,6 +39,8 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
39
39
|
|
40
40
|
public renderGroups(): void;
|
41
41
|
|
42
|
+
public getMutualGroupId(colRefs: (string|number)[]|null): string;
|
43
|
+
|
42
44
|
public addColumnToGroup(column: any, groupId: string, colIndex: number): void;
|
43
45
|
|
44
46
|
public addGroup(groupDef: ColumnGroupingPlugin.GroupDefinition|null): string;
|
@@ -2,7 +2,7 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
|
2
2
|
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
3
3
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
4
|
import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
|
5
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
5
|
+
import { injectCss, prettifyCss, deepEqual } from "../../tr-grid-util/es6/Util.js";
|
6
6
|
|
7
7
|
/** @typedef {Array<ColumnGroupingPlugin~GroupDefinition>} ColumnGroupingPlugin~Options
|
8
8
|
* @description This options can be specified by `columnGrouping` property of the main grid's options or extension options.
|
@@ -818,6 +818,34 @@ ColumnGroupingPlugin.prototype.renderGroups = function () {
|
|
818
818
|
}
|
819
819
|
}
|
820
820
|
};
|
821
|
+
|
822
|
+
/** @public
|
823
|
+
* @param {Array<string|number>} colRefs
|
824
|
+
* @return {string} groupId if all the given columns are children of that groupId, otherwise empty string
|
825
|
+
*/
|
826
|
+
ColumnGroupingPlugin.prototype.getMutualGroupId = function (colRefs) {
|
827
|
+
var colCount = colRefs.length;
|
828
|
+
for (var i = 0; i < colCount; i++) {
|
829
|
+
if (typeof colRefs[i] === "string") {
|
830
|
+
colRefs[i] = this.getColumnIndex(colRefs[i]);
|
831
|
+
}
|
832
|
+
var colIndex = colRefs[i];
|
833
|
+
var groupIds = this.getGroupIds(colIndex);
|
834
|
+
if (!groupIds) {
|
835
|
+
// If at least 1 column is not part of a group, there is no need to find the groupId.
|
836
|
+
return "";
|
837
|
+
}
|
838
|
+
var groupCount = groupIds.length;
|
839
|
+
for (var j = 0; j < groupCount; j++) {
|
840
|
+
var groupId = groupIds[j];
|
841
|
+
var childrenIndices = this.getChildColumnIndices(groupId);
|
842
|
+
if (deepEqual(childrenIndices, colRefs)) {
|
843
|
+
return groupId;
|
844
|
+
}
|
845
|
+
}
|
846
|
+
}
|
847
|
+
return "";
|
848
|
+
};
|
821
849
|
/** Render single column group header without affecting cell span.
|
822
850
|
* @private
|
823
851
|
* @param {Object} groupDef
|