@refinitiv-ui/efx-grid 6.0.39 → 6.0.40
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +15 -3
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +10 -1
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +5 -2
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +4 -4
- package/lib/rt-grid/dist/rt-grid.js +168 -87
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +1 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +7 -8
- package/lib/rt-grid/es6/Grid.d.ts +2 -0
- package/lib/rt-grid/es6/Grid.js +43 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +3 -4
- package/lib/rt-grid/es6/RowDefinition.js +72 -40
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +27 -27
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +97 -93
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +3 -3
- package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +2 -2
- package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +5 -5
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +30 -12
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +2 -1
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +50 -18
- package/lib/types/es6/ContextMenu.d.ts +27 -27
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +3 -0
- package/lib/types/es6/MenuEventAPI.d.ts +3 -3
- package/lib/types/es6/MenuItem.d.ts +2 -2
- package/lib/types/es6/PopupMenu.d.ts +5 -5
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +1 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +3 -4
- package/lib/versions.json +8 -8
- package/package.json +1 -1
@@ -31,6 +31,7 @@ import VirtualizedLayoutGrid from "./VirtualizedLayoutGrid.js";
|
|
31
31
|
* @property {string} rowId
|
32
32
|
* @property {number} rowIndex
|
33
33
|
*/
|
34
|
+
/** @event Core#beforeContentBinding */
|
34
35
|
/** @event Core#postSectionDataBinding */
|
35
36
|
/** @event Core#rowHighlighted */
|
36
37
|
|
@@ -193,6 +194,7 @@ var Core = function (opt_initializer) {
|
|
193
194
|
"postDataSourceChanged",
|
194
195
|
"preSectionRender",
|
195
196
|
"postSectionRender",
|
197
|
+
"beforeContentBinding",
|
196
198
|
"preSectionDataBinding",
|
197
199
|
"postSectionDataBinding",
|
198
200
|
"rowExpansionBinding",
|
@@ -554,7 +556,7 @@ Core.prototype._batches = null;
|
|
554
556
|
* @return {string}
|
555
557
|
*/
|
556
558
|
Core.getVersion = function () {
|
557
|
-
return "5.1.
|
559
|
+
return "5.1.57";
|
558
560
|
};
|
559
561
|
/** {@link ElementWrapper#dispose}
|
560
562
|
* @override
|
@@ -1356,6 +1358,7 @@ Core.prototype.getColumnCount = function () {
|
|
1356
1358
|
* @fires Core#columnAdded
|
1357
1359
|
* @fires Core#preSectionRender
|
1358
1360
|
* @fires Core#columnRender
|
1361
|
+
* @fires Core#beforeContentBinding
|
1359
1362
|
* @fires Core#preSectionDataBinding
|
1360
1363
|
* @fires Core#columnDataBinding
|
1361
1364
|
* @fires Core#postSectionDataBinding
|
@@ -1383,6 +1386,7 @@ Core.prototype.setColumnCount = function(num) {
|
|
1383
1386
|
* @fires Core#columnAdded
|
1384
1387
|
* @fires Core#preSectionRender
|
1385
1388
|
* @fires Core#columnRender
|
1389
|
+
* @fires Core#beforeContentBinding
|
1386
1390
|
* @fires Core#preSectionDataBinding
|
1387
1391
|
* @fires Core#columnDataBinding
|
1388
1392
|
* @fires Core#postSectionDataBinding
|
@@ -2001,6 +2005,7 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
2001
2005
|
* @param {number=} opt_num Default is one row
|
2002
2006
|
* @fires Core#preSectionRender
|
2003
2007
|
* @fires Core#columnRender
|
2008
|
+
* @fires Core#beforeContentBinding
|
2004
2009
|
* @fires Core#preSectionDataBinding
|
2005
2010
|
* @fires Core#columnDataBinding
|
2006
2011
|
* @fires Core#postSectionDataBinding
|
@@ -3804,6 +3809,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
3804
3809
|
* @param {number=} fromRowIndex INCLUSIVE If the value is undefined, the first row index will be used
|
3805
3810
|
* @param {number=} lastRowIndex INCLUSIVE If the value is undefined, the last row index will be used
|
3806
3811
|
* @param {Object=} userParam Addtional parameters to be fired with the event
|
3812
|
+
* @fires Core#beforeContentBinding
|
3807
3813
|
* @fires Core#preSectionDataBinding
|
3808
3814
|
* @fires Core#columnDataBinding
|
3809
3815
|
* @fires Core#postSectionDataBinding
|
@@ -4881,6 +4887,9 @@ Core.prototype._onSectionDataChanged = function (e) {
|
|
4881
4887
|
rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
|
4882
4888
|
e["dataRows"] = rowDataCollection;
|
4883
4889
|
}
|
4890
|
+
if(e["sectionType"] === "content"){
|
4891
|
+
this._dispatch("beforeContentBinding", e);
|
4892
|
+
}
|
4884
4893
|
this._dispatch("preSectionDataBinding", e);
|
4885
4894
|
|
4886
4895
|
var dataMap = this.getDataColumnMap();
|
@@ -1525,8 +1525,11 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
|
1525
1525
|
|
1526
1526
|
var sortOrder = column["sortOrder"] || column["sort"];
|
1527
1527
|
if(sortOrder != null) {
|
1528
|
-
|
1529
|
-
|
1528
|
+
sortOrder = SortableTitlePlugin._toSortOrder(sortOrder); // Invalid input will return "n"
|
1529
|
+
if(sortOrder !== "n") {
|
1530
|
+
t.clearSortState(); // clear previous sorting state
|
1531
|
+
t.sortColumn(colIndex, sortOrder);
|
1532
|
+
}
|
1530
1533
|
}
|
1531
1534
|
};
|
1532
1535
|
|
package/lib/grid/index.js
CHANGED
@@ -33,7 +33,7 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
33
33
|
*/
|
34
34
|
var RowSegmentingPlugin = function (options) {
|
35
35
|
var t = this;
|
36
|
-
t.
|
36
|
+
t._onPreSectionDataBinding = t._onPreSectionDataBinding.bind(t);
|
37
37
|
t._updateHeader = t._updateHeader.bind(t);
|
38
38
|
t._onArrowClick = t._onArrowClick.bind(t);
|
39
39
|
t._rtSortingLogic = t._rtSortingLogic.bind(t);
|
@@ -128,7 +128,7 @@ RowSegmentingPlugin.prototype.initialize = function (host, options) {
|
|
128
128
|
ExpanderIcon.injectExpanderStyles(host.getElement());
|
129
129
|
|
130
130
|
this._hosts.push(host);
|
131
|
-
host.listen("
|
131
|
+
host.listen("preSectionDataBinding", this._onPreSectionDataBinding);
|
132
132
|
|
133
133
|
this.config(options);
|
134
134
|
|
@@ -182,7 +182,7 @@ RowSegmentingPlugin.prototype.unload = function (host) {
|
|
182
182
|
if (at < 0) {
|
183
183
|
return;
|
184
184
|
}
|
185
|
-
host.unlisten("
|
185
|
+
host.unlisten("preSectionDataBinding", this._onPreSectionDataBinding);
|
186
186
|
this._hosts.splice(at, 1);
|
187
187
|
this._dispose();
|
188
188
|
};
|
@@ -338,7 +338,7 @@ RowSegmentingPlugin.prototype._injectStyles = function(predefinedColors) {
|
|
338
338
|
/** @private
|
339
339
|
* @param {Object} e
|
340
340
|
*/
|
341
|
-
RowSegmentingPlugin.prototype.
|
341
|
+
RowSegmentingPlugin.prototype._onPreSectionDataBinding = function (e) {
|
342
342
|
this._updateHeader(
|
343
343
|
e.sectionSettings,
|
344
344
|
e.fromRowIndex,
|
@@ -13198,7 +13198,7 @@ DataTable._proto = DataTable.prototype;
|
|
13198
13198
|
* @property {boolean=} collapsed=true Chain is collapsed by default
|
13199
13199
|
* @property {(string|null)=} label=null
|
13200
13200
|
* @property {boolean=} hidden=true When this row is hidden
|
13201
|
-
* @
|
13201
|
+
* @property {boolean=} realTime=true Realtime row, able to request for JET/RTK
|
13202
13202
|
*/
|
13203
13203
|
|
13204
13204
|
/** @typedef {Object} RowDefinition~RowTypes
|
@@ -13400,6 +13400,8 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13400
13400
|
return;
|
13401
13401
|
}
|
13402
13402
|
|
13403
|
+
var extractedOptions = RowDefinition.extractRowOptions(rowOptions);
|
13404
|
+
|
13403
13405
|
var val = rowOptions["permId"];
|
13404
13406
|
if(val != null) {
|
13405
13407
|
this._permId = val;
|
@@ -13417,13 +13419,8 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13417
13419
|
if(val != null) {
|
13418
13420
|
this._chainRic = val;
|
13419
13421
|
}
|
13420
|
-
val = rowOptions["values"];
|
13421
|
-
// eslint-disable-next-line no-undefined
|
13422
|
-
if(val !== undefined) {
|
13423
|
-
this.setStaticRowData(val, rowOptions["fields"]);
|
13424
|
-
}
|
13425
13422
|
|
13426
|
-
val =
|
13423
|
+
val = extractedOptions["asChain"];
|
13427
13424
|
if(val !== null) {
|
13428
13425
|
this._isChain = val;
|
13429
13426
|
}
|
@@ -13435,28 +13432,22 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13435
13432
|
|
13436
13433
|
val = rowOptions["collapsed"];
|
13437
13434
|
if(val != null){
|
13438
|
-
this._expanded =
|
13435
|
+
this._expanded = extractedOptions["collapsed"];
|
13439
13436
|
}
|
13440
13437
|
val = rowOptions["keepModel"];
|
13441
13438
|
if(val) {
|
13442
13439
|
this._userModel = rowOptions;
|
13443
13440
|
}
|
13444
13441
|
|
13445
|
-
var expanded = this._expanded;
|
13446
13442
|
var symbol = this._ric || this._chainRic;
|
13447
|
-
var asChain = this._isChain || !!this._chainRic;
|
13448
|
-
if(this._ric && this._ric.indexOf("0#") >= 0){
|
13449
|
-
asChain = true;
|
13450
|
-
expanded = true;
|
13451
|
-
}
|
13452
|
-
if(this._isChain === false){
|
13453
|
-
asChain = false;
|
13454
|
-
}
|
13455
|
-
if(this._expanded === false){
|
13456
|
-
expanded = false;
|
13457
|
-
}
|
13458
13443
|
if(symbol || this._permId){
|
13459
|
-
this.setContent(symbol, this._permId,
|
13444
|
+
this.setContent(symbol, this._permId, this._isChain, this._expanded); // this._dataId is modified
|
13445
|
+
}
|
13446
|
+
|
13447
|
+
val = rowOptions["values"];
|
13448
|
+
// eslint-disable-next-line no-undefined
|
13449
|
+
if(val !== undefined) {
|
13450
|
+
this.setStaticRowData(val, rowOptions["fields"]);
|
13460
13451
|
}
|
13461
13452
|
};
|
13462
13453
|
/** @private
|
@@ -13483,11 +13474,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
|
13483
13474
|
}
|
13484
13475
|
};
|
13485
13476
|
/** @public
|
13477
|
+
* @ignore
|
13486
13478
|
* @param {string} userInput RIC
|
13487
13479
|
* @param {string=} permId=null Organization PermId, which use for getting ADC data for private company
|
13488
13480
|
* @param {boolean=} asChain
|
13489
13481
|
* @param {boolean=} expanded
|
13490
|
-
* @param {boolean=} realTime
|
13491
13482
|
* @return {boolean} True if there is any change otherwise false
|
13492
13483
|
*/
|
13493
13484
|
RowDefinition.prototype.setContent = function(userInput, permId, asChain, expanded) {
|
@@ -13510,33 +13501,40 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
|
|
13510
13501
|
return false;
|
13511
13502
|
}
|
13512
13503
|
|
13513
|
-
this.unsubscribeForUpdates()
|
13504
|
+
if(!this.unsubscribeForUpdates()){
|
13505
|
+
this._clearStaticData();
|
13506
|
+
}
|
13514
13507
|
this.resetUpdates(); // Remove all previous data updates because a new content is just entered
|
13515
13508
|
|
13516
|
-
// TODO: handle changing between chain and ric row
|
13517
13509
|
this._userInput = userInput;
|
13518
13510
|
if(this._userInput.charAt(0) === "'") { // This is a row header
|
13519
13511
|
this._ric = this._chainRic = ""; // No ric for realtime request
|
13520
13512
|
} else {
|
13521
|
-
if(
|
13522
|
-
|
13523
|
-
|
13524
|
-
|
13525
|
-
|
13526
|
-
this._expanded = expanded;
|
13527
|
-
this._isChain = true; // Only chain can be expanded by 0#
|
13528
|
-
this._chainRic = this._userInput;
|
13529
|
-
if(this._view) {
|
13530
|
-
this._view.setSegmentSeparator(this._rowId);
|
13531
|
-
this.expandChain();
|
13532
|
-
}
|
13533
|
-
}
|
13513
|
+
if(asChain === true){
|
13514
|
+
this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
|
13515
|
+
this._expanded = expanded;
|
13516
|
+
this._isChain = true; // Only chain can be expanded by 0#
|
13517
|
+
this._chainRic = this._userInput;
|
13534
13518
|
} else {
|
13535
13519
|
this._ric = this._userInput;
|
13536
|
-
|
13537
|
-
|
13520
|
+
this._isChain = asChain;
|
13521
|
+
}
|
13522
|
+
}
|
13523
|
+
|
13524
|
+
if(this._view) {
|
13525
|
+
if(this._isChain){
|
13526
|
+
var rid = this.getRowId();
|
13527
|
+
var segmentId = this._view.getSegmentParentRowId(rid);
|
13528
|
+
if(segmentId){
|
13529
|
+
this._view.removeSegmentChild(segmentId, rid);
|
13538
13530
|
}
|
13539
13531
|
}
|
13532
|
+
this._view.setSegmentSeparator(this._rowId, !!this._isChain);
|
13533
|
+
if(this._expanded && this.isChainCollapsed()){
|
13534
|
+
this.expandChain();
|
13535
|
+
} else if (!this._expanded && this.isChainExpanded()){
|
13536
|
+
this.collapseChain();
|
13537
|
+
}
|
13540
13538
|
}
|
13541
13539
|
|
13542
13540
|
this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
|
@@ -13981,7 +13979,7 @@ RowDefinition.prototype.unsubscribeForUpdates = function() {
|
|
13981
13979
|
this.resetUpdates();
|
13982
13980
|
// TODO: Reset only if this is the last ric
|
13983
13981
|
this._dc.setRowData(this._dataId, null); // Trigger data update immediately
|
13984
|
-
|
13982
|
+
this._clearStaticData();
|
13985
13983
|
// eslint-disable-next-line consistent-return
|
13986
13984
|
return prevRowData;
|
13987
13985
|
};
|
@@ -14393,6 +14391,40 @@ RowDefinition.prototype.getUserModel = function() {
|
|
14393
14391
|
RowDefinition.toRowId = function(rowDef) {
|
14394
14392
|
return rowDef.getRowId();
|
14395
14393
|
};
|
14394
|
+
/** For transforming row options into standard format
|
14395
|
+
* @public
|
14396
|
+
* @ignore
|
14397
|
+
* @function
|
14398
|
+
* @param {RowDefinition~Options} rowOptions
|
14399
|
+
* @return {RowDefinition~Options}
|
14400
|
+
*/
|
14401
|
+
RowDefinition.extractRowOptions = function(rowOptions) {
|
14402
|
+
var ric = rowOptions["ric"];
|
14403
|
+
var chainRic = rowOptions["chainRic"];
|
14404
|
+
var collapsed = rowOptions["collapsed"];
|
14405
|
+
var asChain = rowOptions["asChain"];
|
14406
|
+
if(asChain == null && chainRic){
|
14407
|
+
asChain = true;
|
14408
|
+
}
|
14409
|
+
var expanded = null;
|
14410
|
+
if(ric && ric.indexOf("0#") >= 0){
|
14411
|
+
if(asChain == null){
|
14412
|
+
asChain = true;
|
14413
|
+
}
|
14414
|
+
expanded = true;
|
14415
|
+
}
|
14416
|
+
|
14417
|
+
var extractedOptions = {};
|
14418
|
+
if(collapsed == null) {
|
14419
|
+
extractedOptions["collapsed"] = !expanded;
|
14420
|
+
} else {
|
14421
|
+
extractedOptions["collapsed"] = collapsed;
|
14422
|
+
}
|
14423
|
+
extractedOptions["ric"] = ric;
|
14424
|
+
extractedOptions["chainRic"] = chainRic;
|
14425
|
+
extractedOptions["asChain"] = asChain;
|
14426
|
+
return extractedOptions;
|
14427
|
+
};
|
14396
14428
|
/** For mapping row Id by Array.map()
|
14397
14429
|
* @public
|
14398
14430
|
* @function
|
@@ -15028,7 +15060,8 @@ PredefinedFormula.remove = function(field) {
|
|
15028
15060
|
* @property {ColumnDefinition~SortLogic=} sorter=null Alias to `sortLogic`
|
15029
15061
|
* @property {boolean=} rowSorting=null If set to true, RowDefinition object will be used for sorting comparison. If set to false, data from the given `field` will be used for sorting comparison.
|
15030
15062
|
* @property {boolean=} sortable=true If disabled, the column cannot be sorted by user click
|
15031
|
-
* @property {string=} sort=""
|
15063
|
+
* @property {string=} sort="" Deprecated Alias to `sortOrder`
|
15064
|
+
* @property {string=} sortOrder="" The column can be sorted in ascending and descending order by specifying the order "a", "d". This option will sort the column when it is initialized or inserted at runtime.
|
15032
15065
|
* @property {Object=} styles=null Key/value pair Object specifying CSS styles
|
15033
15066
|
* @property {number=} width=NaN If specified, column will have a fixed width in pixel
|
15034
15067
|
* @property {number=} minWidth=NaN If specified, column will have a minimum width in pixel
|
@@ -15406,7 +15439,7 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15406
15439
|
}
|
15407
15440
|
|
15408
15441
|
// Deprecate
|
15409
|
-
val = columnOption["sort"];
|
15442
|
+
val = columnOption["sortOrder"] || columnOption["sort"];
|
15410
15443
|
if(val) {
|
15411
15444
|
this._initialOrder = val;
|
15412
15445
|
}
|
@@ -15656,11 +15689,13 @@ ColumnDefinition.prototype.isScalable = function() {
|
|
15656
15689
|
var colIndex = grid.getColumnIndex(this);
|
15657
15690
|
return core.getColumnScalability(colIndex);
|
15658
15691
|
};
|
15659
|
-
/**
|
15660
|
-
|
15692
|
+
/** Deprecated, this function will be return initial sort order of this column, The current sort state may be different from initial sort state.
|
15693
|
+
* @public
|
15694
|
+
* @deprecated
|
15661
15695
|
* @return {string}
|
15662
15696
|
*/
|
15663
15697
|
ColumnDefinition.prototype.getInitialSortOrder = function() {
|
15698
|
+
// WARNING: This state is different from `sortOrder`, it is the state when grid is initialized.
|
15664
15699
|
return this._initialOrder;
|
15665
15700
|
};
|
15666
15701
|
/** @public
|
@@ -15764,10 +15799,6 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15764
15799
|
obj["sortable"] = false;
|
15765
15800
|
}
|
15766
15801
|
|
15767
|
-
if(this._initialOrder) {
|
15768
|
-
obj["sort"] = this._initialOrder;
|
15769
|
-
}
|
15770
|
-
|
15771
15802
|
var classes = this._classes;
|
15772
15803
|
if(classes && classes.length > 0) {
|
15773
15804
|
obj["className"] = classes.join(" ");
|
@@ -35947,7 +35978,7 @@ Core.prototype._batches = null;
|
|
35947
35978
|
* @return {string}
|
35948
35979
|
*/
|
35949
35980
|
Core.getVersion = function () {
|
35950
|
-
return "5.1.
|
35981
|
+
return "5.1.56";
|
35951
35982
|
};
|
35952
35983
|
/** {@link ElementWrapper#dispose}
|
35953
35984
|
* @override
|
@@ -38326,7 +38357,7 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
38326
38357
|
}
|
38327
38358
|
if(numRightColumn != null) {
|
38328
38359
|
rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
|
38329
|
-
if (this.
|
38360
|
+
if (this._pinnedRightColumnCount !== rightPinnedCount) {
|
38330
38361
|
dirty = true;
|
38331
38362
|
this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
|
38332
38363
|
}
|
@@ -42115,6 +42146,7 @@ Ext["b" /* default */].inherits(SortableTitlePlugin, event_EventDispatcher);
|
|
42115
42146
|
/** The sorting object which will be used for initialSort config.
|
42116
42147
|
* @typedef {Object} SortableTitlePlugin~InitialSort
|
42117
42148
|
* @property {number} colIndex Index of the column
|
42149
|
+
* @property {string} field field of the column
|
42118
42150
|
* @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
|
42119
42151
|
* @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
|
42120
42152
|
*/
|
@@ -42124,6 +42156,8 @@ SortableTitlePlugin.InitialSort;
|
|
42124
42156
|
* @typedef {Object} SortableTitlePlugin~ColumnOptions
|
42125
42157
|
* @property {boolean=} sortable=false If enable, the column can be sorted by user click
|
42126
42158
|
* @property {string=} sortBy Field to be used for sorting. If defined, user can click at the header section to sort the column
|
42159
|
+
* @property {string=} sort="" Deprecated Alias to `sortOrder`
|
42160
|
+
* @property {string=} sortOrder="" The column can be sorted in ascending and descending order by specifying the order "a", "d". This option will sort the column when it is initialized or inserted at runtime.
|
42127
42161
|
* @property {DataTable.SortLogic=} sortLogic=null Custom compare function for sorting
|
42128
42162
|
* @property {DataTable.SortLogic=} sortingLogic Alias to `sortLogic`
|
42129
42163
|
* @property {DataTable.SortLogic=} sorter Alias to `sortLogic`
|
@@ -42328,7 +42362,7 @@ SortableTitlePlugin.prototype.afterInit = function () {
|
|
42328
42362
|
// Set logic to the data source, since the data source not available during the initialization
|
42329
42363
|
t.setSortLogics(t._sortLogic);
|
42330
42364
|
|
42331
|
-
var userInput = t._initialSort;
|
42365
|
+
var userInput = t._initialSort; // This will be passed from the user when they want to start with initialize sort
|
42332
42366
|
if (userInput != null) {
|
42333
42367
|
if(Array.isArray(userInput)) {
|
42334
42368
|
if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
|
@@ -42477,14 +42511,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
42477
42511
|
|
42478
42512
|
if (!host) return obj;
|
42479
42513
|
|
42480
|
-
var
|
42481
|
-
var col,
|
42482
|
-
|
42514
|
+
var sortedColumns = this.getSortedColumns();
|
42515
|
+
var col, i, len;
|
42516
|
+
// Multiple column sorting cannot retain the sort order in the column option.
|
42517
|
+
if(this._maxCount === 1 && sortedColumns != null) {
|
42518
|
+
// assign sorting state to each columns
|
42519
|
+
len = sortedColumns.length;
|
42520
|
+
for (i = 0; i < len; i++) {
|
42521
|
+
var sortedColumn = sortedColumns[i];
|
42522
|
+
var colIndex = sortedColumn["colIndex"];
|
42523
|
+
col = columns[colIndex];
|
42524
|
+
if (!col) {
|
42525
|
+
col = columns[colIndex] = {};
|
42526
|
+
}
|
42527
|
+
col["sortOrder"] = sortedColumn["sortOrder"];
|
42528
|
+
}
|
42529
|
+
}
|
42530
|
+
|
42531
|
+
len = host.getColumnCount();
|
42532
|
+
var opt, field;
|
42533
|
+
for(i = 0; i < len; ++i) {
|
42483
42534
|
col = columns[i];
|
42484
42535
|
if (!col) {
|
42485
42536
|
col = columns[i] = {};
|
42486
42537
|
}
|
42487
42538
|
|
42539
|
+
// TODO: We should get the state from the core, instead of getting the sort options.
|
42488
42540
|
opt = this._getSortOptions(i);
|
42489
42541
|
|
42490
42542
|
if (!opt) { continue; }
|
@@ -42498,7 +42550,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
42498
42550
|
}
|
42499
42551
|
field = opt["field"];
|
42500
42552
|
if (field) {
|
42501
|
-
if(col["field"] !== field) {
|
42553
|
+
if(col["field"] != null && col["field"] !== field) { // Core does not have field properties, so when you try to call getConfigObject in Core, it will return sortBy too.
|
42502
42554
|
col["sortBy"] = field;
|
42503
42555
|
} // else The default value is an empty sortBy, which refers to the same column field by default.
|
42504
42556
|
|
@@ -42514,7 +42566,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
42514
42566
|
extOptions = obj["sorting"] = {};
|
42515
42567
|
}
|
42516
42568
|
|
42517
|
-
var val =
|
42569
|
+
var val = sortedColumns;
|
42518
42570
|
if(val != null) {
|
42519
42571
|
extOptions["initialSort"] = val;
|
42520
42572
|
}
|
@@ -43021,7 +43073,14 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
|
|
43021
43073
|
* @param {boolean=} bool=true, if set to false it will be unfreeze indicator
|
43022
43074
|
*/
|
43023
43075
|
SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
|
43076
|
+
var prevState = this._frozenIndicator;
|
43024
43077
|
this._frozenIndicator = bool !== false;
|
43078
|
+
if(prevState && !this._frozenIndicator) { // from frozen to unfrozen, update the ui
|
43079
|
+
for (var i = this._hosts.length; --i >= 0;) {
|
43080
|
+
this._updateSortableIndicator(i);
|
43081
|
+
}
|
43082
|
+
}
|
43083
|
+
|
43025
43084
|
};
|
43026
43085
|
/** @public
|
43027
43086
|
* @param {boolean=} disabled
|
@@ -43097,7 +43156,7 @@ SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
|
|
43097
43156
|
var colCount = columns ? columns.length : 0;
|
43098
43157
|
for (var i = 0; i < colCount; i++) {
|
43099
43158
|
var column = columns[i];
|
43100
|
-
var sortOrder = column["defaultSort"]
|
43159
|
+
var sortOrder = column["defaultSort"]; // composite and rt grid option for default sort order
|
43101
43160
|
if (sortOrder) {
|
43102
43161
|
// TODO: Support multi-column sorting
|
43103
43162
|
return {
|
@@ -43527,6 +43586,15 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
|
43527
43586
|
} else {
|
43528
43587
|
t.disableColumnSorting(colIndex, true);
|
43529
43588
|
}
|
43589
|
+
|
43590
|
+
var sortOrder = column["sortOrder"] || column["sort"];
|
43591
|
+
if(sortOrder != null) {
|
43592
|
+
sortOrder = SortableTitlePlugin._toSortOrder(sortOrder); // Invalid input will return "n"
|
43593
|
+
if(sortOrder !== "n") {
|
43594
|
+
t.clearSortState(); // clear previous sorting state
|
43595
|
+
t.sortColumn(colIndex, sortOrder);
|
43596
|
+
}
|
43597
|
+
}
|
43530
43598
|
};
|
43531
43599
|
|
43532
43600
|
/** @private
|
@@ -45374,6 +45442,9 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
45374
45442
|
colConfig["hidden"] = false;
|
45375
45443
|
}
|
45376
45444
|
|
45445
|
+
if(colConfig.id == null) {
|
45446
|
+
colConfig.id = colDef.getId(); // retain ID
|
45447
|
+
}
|
45377
45448
|
this._grid.startBatch("reset");
|
45378
45449
|
this.insertColumn(colConfig, colIndex);
|
45379
45450
|
this.removeColumn(colIndex + 1); // remove existing column after insert
|
@@ -45524,12 +45595,6 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
45524
45595
|
}
|
45525
45596
|
}
|
45526
45597
|
|
45527
|
-
var sortingStates;
|
45528
|
-
var removeLen = removingFields.length;
|
45529
|
-
if(removeLen > 0 && this._stp) {
|
45530
|
-
sortingStates = this._stp.getSortingStates().slice(); // We need to clone array for avoid object reference in remove column
|
45531
|
-
}
|
45532
|
-
|
45533
45598
|
this.removeColumns(removingFields);
|
45534
45599
|
|
45535
45600
|
var keepingLen = keepingColumns.length;
|
@@ -45557,10 +45622,6 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
45557
45622
|
this._grid.freezeLayout(prevState);
|
45558
45623
|
}
|
45559
45624
|
|
45560
|
-
if(removeLen > 0 && this._stp) {
|
45561
|
-
this._stp.sortColumns(sortingStates);
|
45562
|
-
}
|
45563
|
-
|
45564
45625
|
grid.reorderColumns(columnOrdering);
|
45565
45626
|
grid.stopBatch("reset");
|
45566
45627
|
};
|
@@ -46447,37 +46508,35 @@ Grid.prototype.hasHiddenRow = function(){
|
|
46447
46508
|
/** Set RIC to the specified row
|
46448
46509
|
* @public
|
46449
46510
|
* @param {Grid~RowReference} rowRef
|
46450
|
-
* @param {string} str
|
46511
|
+
* @param {string} str RIC to be set to a row
|
46451
46512
|
* @param {RowDefinition~Options=} options
|
46452
46513
|
*/
|
46453
46514
|
Grid.prototype.setRic = function(rowRef, str, options) {
|
46454
46515
|
if(this._mainGrid) {
|
46455
|
-
this._mainGrid.setRic(this._toRowId(rowRef), str);
|
46516
|
+
this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
46456
46517
|
return;
|
46457
46518
|
}
|
46458
46519
|
var rowDef = this._getRowDefinitionByRef(rowRef);
|
46459
46520
|
if(rowDef) {
|
46460
46521
|
options = options || {};
|
46461
|
-
|
46462
|
-
|
46463
|
-
|
46522
|
+
options["ric"] = str;
|
46523
|
+
var extractedOptions = RowDefinition.extractRowOptions(options);
|
46524
|
+
var oldRic = rowDef.getSymbol();
|
46525
|
+
var permId = options["permId"];
|
46526
|
+
var expanded = null;
|
46527
|
+
var collapsed = options["collapsed"];
|
46528
|
+
if(collapsed != null){
|
46529
|
+
expanded = !extractedOptions["collapsed"];
|
46530
|
+
}
|
46531
|
+
if(rowDef.setContent(str, permId, extractedOptions["asChain"], expanded)) { // The given string may not be a RIC
|
46532
|
+
this._connector.removeRic(rowDef, oldRic);
|
46533
|
+
this._initDuplicateRicData(rowDef);
|
46534
|
+
this._connector.addRic(rowDef);
|
46464
46535
|
}
|
46465
|
-
if(rowDef.isChain() || newChain) {
|
46466
|
-
if(rowDef.getRic() !== str.replace("0#", "")) {
|
46467
|
-
var rowIndex = this._dv.getRowIndex(rowDef.getRowId());
|
46468
|
-
this.removeRow(rowDef);
|
46469
46536
|
|
46470
|
-
|
46471
|
-
|
46472
|
-
|
46473
|
-
} else {
|
46474
|
-
var oldRic = rowDef.getSymbol();
|
46475
|
-
var permId = options["permId"] || "";
|
46476
|
-
if(rowDef.setContent(str, permId)) { // The given string may not be a RIC
|
46477
|
-
this._connector.removeRic(rowDef, oldRic);
|
46478
|
-
this._initDuplicateRicData(rowDef);
|
46479
|
-
this._connector.addRic(rowDef);
|
46480
|
-
}
|
46537
|
+
var values = options["values"];
|
46538
|
+
if(values != null) {
|
46539
|
+
rowDef.setStaticRowData(values, options["fields"]);
|
46481
46540
|
}
|
46482
46541
|
}
|
46483
46542
|
};
|
@@ -47728,6 +47787,28 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
47728
47787
|
|
47729
47788
|
console.table(tbl); // eslint-disable-line
|
47730
47789
|
};
|
47790
|
+
/** @public
|
47791
|
+
* @description Replace existing row with a new row. Row ID would be changed, after row is replaced.
|
47792
|
+
* @param {Grid~RowReference} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
47793
|
+
* @param {Object=} rowOption
|
47794
|
+
* @returns {Object}
|
47795
|
+
*/
|
47796
|
+
Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
47797
|
+
var rowId = this._getRowId(rowRef);
|
47798
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
47799
|
+
if(rowDef.isAutoGenerated()) { // Users cannot replace auto-generated
|
47800
|
+
return null;
|
47801
|
+
}
|
47802
|
+
var configObj = rowDef.getConfigObject();
|
47803
|
+
|
47804
|
+
if(Object(Util["c" /* deepEqual */])(configObj, rowOption)){
|
47805
|
+
return null;
|
47806
|
+
} else {
|
47807
|
+
var insertedRow = this.insertRow(rowOption, rowId);
|
47808
|
+
this.removeRow(rowId);
|
47809
|
+
return insertedRow;
|
47810
|
+
}
|
47811
|
+
};
|
47731
47812
|
|
47732
47813
|
|
47733
47814
|
/* harmony default export */ var js_Grid = (Grid);
|