@refinitiv-ui/efx-grid 6.0.20 → 6.0.22
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +46 -24
- package/lib/core/dist/core.js +61 -14
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +11 -1
- package/lib/core/es6/grid/LayoutGrid.js +1 -0
- package/lib/core/es6/grid/components/CellSpans.d.ts +2 -0
- package/lib/core/es6/grid/components/CellSpans.js +35 -10
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +2 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +14 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +362 -41
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +10 -1
- package/lib/rt-grid/es6/Grid.js +196 -17
- package/lib/rt-grid/es6/ReferenceCounter.js +13 -2
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/RowDefinition.js +74 -8
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +9 -5
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +365 -133
- package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +11 -37
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +15 -15
- package/lib/tr-grid-row-selection/es6/RowSelection.js +9 -1
- package/lib/types/es6/ColumnGrouping.d.ts +9 -5
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +2 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +10 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -0
- package/lib/types/es6/RowSelection.d.ts +15 -15
- package/lib/versions.json +4 -4
- package/package.json +6 -2
@@ -13094,6 +13094,10 @@ var RowDefinition = function(rowOptions) {
|
|
13094
13094
|
* @private
|
13095
13095
|
*/
|
13096
13096
|
RowDefinition._runningId = 0;
|
13097
|
+
/** @type {string}
|
13098
|
+
* @private
|
13099
|
+
*/
|
13100
|
+
RowDefinition._childDataField = "CHILD_VALUES";
|
13097
13101
|
//#region Private Members
|
13098
13102
|
/** @type {string}
|
13099
13103
|
* @private
|
@@ -13284,7 +13288,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
|
13284
13288
|
}
|
13285
13289
|
}
|
13286
13290
|
}
|
13287
|
-
|
13291
|
+
var val = rowOptions["values"];
|
13292
|
+
// eslint-disable-next-line no-undefined
|
13293
|
+
if(val !== undefined) {
|
13294
|
+
this.setStaticRowData(val, rowOptions["fields"]);
|
13295
|
+
}
|
13288
13296
|
};
|
13289
13297
|
/** @public
|
13290
13298
|
* @param {string} userInput
|
@@ -13356,11 +13364,6 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13356
13364
|
obj["ric"] = val;
|
13357
13365
|
}
|
13358
13366
|
|
13359
|
-
val = this._staticValues;
|
13360
|
-
if(val) {
|
13361
|
-
obj["values"] = Object(Util["b" /* cloneObject */])(val);
|
13362
|
-
}
|
13363
|
-
|
13364
13367
|
val = this._chainRic;
|
13365
13368
|
if(val) {
|
13366
13369
|
obj["chainRic"] = val;
|
@@ -13392,6 +13395,40 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13392
13395
|
obj["hidden"] = val;
|
13393
13396
|
}
|
13394
13397
|
|
13398
|
+
val = this._getStaticRowData();
|
13399
|
+
if(val) {
|
13400
|
+
obj["values"] = val;
|
13401
|
+
}
|
13402
|
+
|
13403
|
+
// obtain the static values of constituent rows
|
13404
|
+
if(this.isChain()) {
|
13405
|
+
var children = this.getChildren();
|
13406
|
+
if(children) {
|
13407
|
+
var childValues = val ? val[RowDefinition._childDataField] : {};
|
13408
|
+
if(!childValues) {
|
13409
|
+
childValues = {};
|
13410
|
+
}
|
13411
|
+
var dirty = false;
|
13412
|
+
var len = children.length;
|
13413
|
+
var i, rowDef, staticValues;
|
13414
|
+
for(i = 0; i < len; i++) {
|
13415
|
+
rowDef = children[i];
|
13416
|
+
staticValues = rowDef._getStaticRowData();
|
13417
|
+
if(staticValues) {
|
13418
|
+
dirty = true;
|
13419
|
+
childValues[rowDef.getRic()] = staticValues;
|
13420
|
+
}
|
13421
|
+
}
|
13422
|
+
|
13423
|
+
if(dirty) {
|
13424
|
+
if(!obj["values"]) {
|
13425
|
+
obj["values"] = {};
|
13426
|
+
}
|
13427
|
+
obj["values"][RowDefinition._childDataField] = childValues;
|
13428
|
+
}
|
13429
|
+
}
|
13430
|
+
}
|
13431
|
+
|
13395
13432
|
return obj;
|
13396
13433
|
};
|
13397
13434
|
/** Since an index chain (e.g. .FTSE) can automatically produce rows for its constituent, we need to separate rowId and dataId, so that the constituents still use the same data Id as that of its parent.
|
@@ -13466,6 +13503,12 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
13466
13503
|
}
|
13467
13504
|
};
|
13468
13505
|
/** @public
|
13506
|
+
* @return {Object.<string, *>}
|
13507
|
+
*/
|
13508
|
+
RowDefinition.prototype._getStaticRowData = function() {
|
13509
|
+
return this._staticValues ? Object(Util["b" /* cloneObject */])(this._staticValues) : null;
|
13510
|
+
};
|
13511
|
+
/** @public
|
13469
13512
|
* @param {Object.<string, *>|Array} data
|
13470
13513
|
* @param {Array.<string>=} opt_fields In case of the given data is an array, this param will be used for mapping index to field
|
13471
13514
|
*/
|
@@ -13766,6 +13809,22 @@ RowDefinition.deregisterFromView = function(rowIds, rowDef) {
|
|
13766
13809
|
rowDef._deregisterFromView(rowIds);
|
13767
13810
|
return rowIds;
|
13768
13811
|
};
|
13812
|
+
/** @private
|
13813
|
+
* @param {string} ric
|
13814
|
+
* @return {Object}
|
13815
|
+
*/
|
13816
|
+
RowDefinition.prototype._getChildStaticRowData = function(ric) {
|
13817
|
+
if(!this._staticValues) {
|
13818
|
+
return null;
|
13819
|
+
}
|
13820
|
+
|
13821
|
+
var childValues = this._staticValues[RowDefinition._childDataField];
|
13822
|
+
if(!childValues) {
|
13823
|
+
return null;
|
13824
|
+
}
|
13825
|
+
|
13826
|
+
return childValues[ric] || null;
|
13827
|
+
};
|
13769
13828
|
/** @public
|
13770
13829
|
* @ignore
|
13771
13830
|
* @param {string} ric
|
@@ -13793,12 +13852,19 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
13793
13852
|
|
13794
13853
|
var newChild = !childDef;
|
13795
13854
|
if(newChild) {
|
13796
|
-
|
13855
|
+
var rowOptions = {
|
13797
13856
|
"asConstituent": true,
|
13798
13857
|
"dataId": this._subId + ric,
|
13799
13858
|
"ric": ric,
|
13800
13859
|
"parent": this
|
13801
|
-
}
|
13860
|
+
};
|
13861
|
+
|
13862
|
+
var staticData = this._getChildStaticRowData(ric);
|
13863
|
+
if(staticData) {
|
13864
|
+
rowOptions["values"] = staticData;
|
13865
|
+
}
|
13866
|
+
|
13867
|
+
childDef = new RowDefinition(rowOptions);
|
13802
13868
|
}
|
13803
13869
|
|
13804
13870
|
if(this._view) {
|
@@ -20516,6 +20582,33 @@ CellSpans.prototype.removeColumn = function (at) { // Use when a column is remov
|
|
20516
20582
|
}
|
20517
20583
|
return dirty;
|
20518
20584
|
};
|
20585
|
+
/** @public
|
20586
|
+
* @param {boolean=} bool
|
20587
|
+
*/
|
20588
|
+
CellSpans.prototype.freezeMapping = function (bool) {
|
20589
|
+
this._frozenMapping = bool !== false;
|
20590
|
+
if(!this._frozenMapping) {
|
20591
|
+
this._mapCellSpans();
|
20592
|
+
}
|
20593
|
+
};
|
20594
|
+
|
20595
|
+
|
20596
|
+
/** @private
|
20597
|
+
*/
|
20598
|
+
CellSpans.prototype._mapCellSpans = function () {
|
20599
|
+
var cellSpans = this._spans;
|
20600
|
+
this._spans = [];
|
20601
|
+
this._occupiedMap = {};
|
20602
|
+
var i, cellSpan;
|
20603
|
+
for(i = cellSpans.length; --i >= 0;) {
|
20604
|
+
cellSpan = cellSpans[i];
|
20605
|
+
if(cellSpan.indexX >= 0) {
|
20606
|
+
cellSpan.register(this._spans, this._occupiedMap);
|
20607
|
+
}
|
20608
|
+
}
|
20609
|
+
};
|
20610
|
+
|
20611
|
+
|
20519
20612
|
/** @public
|
20520
20613
|
* @param {number} from
|
20521
20614
|
* @param {number} amount This can be negative number
|
@@ -20532,18 +20625,10 @@ CellSpans.prototype.shiftColumn = function (from, amount) { // Use when a column
|
|
20532
20625
|
cellSpan.indexX += amount;
|
20533
20626
|
}
|
20534
20627
|
}
|
20535
|
-
if(!dirty) { return false; }
|
20628
|
+
if(!dirty || this._frozenMapping) { return false; }
|
20536
20629
|
|
20537
20630
|
// Re-registers all cellspans. Some of the cellspans may be lost due to shifting
|
20538
|
-
|
20539
|
-
this._spans = [];
|
20540
|
-
this._occupiedMap = {};
|
20541
|
-
for(i = cellSpans.length; --i >= 0;) {
|
20542
|
-
cellSpan = cellSpans[i];
|
20543
|
-
if(cellSpan.indexX >= 0) {
|
20544
|
-
cellSpan.register(this._spans, this._occupiedMap);
|
20545
|
-
}
|
20546
|
-
}
|
20631
|
+
this._mapCellSpans();
|
20547
20632
|
return true;
|
20548
20633
|
};
|
20549
20634
|
/** @public
|
@@ -20832,6 +20917,12 @@ CellSpans.prototype._spans;
|
|
20832
20917
|
*/
|
20833
20918
|
CellSpans.prototype._occupiedMap;
|
20834
20919
|
|
20920
|
+
/**
|
20921
|
+
* @private
|
20922
|
+
* @type {boolean}
|
20923
|
+
*/
|
20924
|
+
CellSpans.prototype._frozenMapping = false;
|
20925
|
+
|
20835
20926
|
/* harmony default export */ var components_CellSpans = (CellSpans);
|
20836
20927
|
|
20837
20928
|
|
@@ -24585,6 +24676,7 @@ LayoutGrid.prototype.setFrozenLayout = function (bool) {
|
|
24585
24676
|
if (this._frozenLayout !== bool) {
|
24586
24677
|
this._frozenLayout = bool;
|
24587
24678
|
|
24679
|
+
this._cellSpans.freezeMapping(this._frozenLayout);
|
24588
24680
|
if (!this._frozenLayout) {
|
24589
24681
|
this._syncLayoutToColumns(0);
|
24590
24682
|
this._syncLayoutToRows(0, this._rowCount);
|
@@ -29299,6 +29391,20 @@ DataView.prototype.isCollapsed = function() {
|
|
29299
29391
|
DataView.prototype.enableContentAsHeader = function(bool) {
|
29300
29392
|
this._shared.contentAsHeader = bool !== false;
|
29301
29393
|
};
|
29394
|
+
/** set default collapse when new groups added
|
29395
|
+
* @public
|
29396
|
+
* @param {boolean=} collapse=false, if enable it, it will be set collapsing by default
|
29397
|
+
*/
|
29398
|
+
DataView.prototype.setDefaultCollapse = function(collapse) {
|
29399
|
+
this._shared.defaultCollapse = !!collapse;
|
29400
|
+
};
|
29401
|
+
/** get default collapse when new groups added
|
29402
|
+
* @public
|
29403
|
+
* @return {boolean}
|
29404
|
+
*/
|
29405
|
+
DataView.prototype.getDefaultCollapse = function() {
|
29406
|
+
return !!this._shared.defaultCollapse; // it can be null, convert to boolean
|
29407
|
+
};
|
29302
29408
|
/** @private
|
29303
29409
|
* @return {?Array.<string>}
|
29304
29410
|
*/
|
@@ -31217,6 +31323,10 @@ DataView.prototype._addGroup = function (value) {
|
|
31217
31323
|
}
|
31218
31324
|
}
|
31219
31325
|
member = new DataView();
|
31326
|
+
var collapsed = this._shared.defaultCollapse;
|
31327
|
+
if(collapsed != null) {
|
31328
|
+
member._collapsed = collapsed;
|
31329
|
+
}
|
31220
31330
|
member._groupId = groupId;
|
31221
31331
|
if(typeof value == "string") { // TODO: Raw value should not always be a string
|
31222
31332
|
if(value == "null") {
|
@@ -34529,7 +34639,7 @@ Core.prototype._rowHeightTimerId = 0;
|
|
34529
34639
|
* @return {string}
|
34530
34640
|
*/
|
34531
34641
|
Core.getVersion = function () {
|
34532
|
-
return "5.1.
|
34642
|
+
return "5.1.32";
|
34533
34643
|
};
|
34534
34644
|
/** {@link ElementWrapper#dispose}
|
34535
34645
|
* @override
|
@@ -36881,6 +36991,13 @@ Core.prototype.freezeLayout = function (opt_bool) {
|
|
36881
36991
|
if (prevState !== opt_bool) {
|
36882
36992
|
this._frozenLayout = opt_bool;
|
36883
36993
|
|
36994
|
+
var stp = this.getPlugin("SortableTitlePlugin");
|
36995
|
+
if(this._frozenLayout) {
|
36996
|
+
if(stp) {
|
36997
|
+
stp.freezeIndicator(true);
|
36998
|
+
}
|
36999
|
+
}
|
37000
|
+
|
36884
37001
|
if (!this._frozenLayout) {
|
36885
37002
|
// Width has not yet changed so we need to disable it first
|
36886
37003
|
this._disableEvent("widthChanged");
|
@@ -36909,6 +37026,9 @@ Core.prototype.freezeLayout = function (opt_bool) {
|
|
36909
37026
|
if(!viewChanged) { // Always update virtualizer
|
36910
37027
|
this._rowVirtualizer.update(true); // Force section activation
|
36911
37028
|
}
|
37029
|
+
if(stp) {
|
37030
|
+
stp.freezeIndicator(false);
|
37031
|
+
}
|
36912
37032
|
}
|
36913
37033
|
this._rowHeightSync = true;
|
36914
37034
|
}
|
@@ -39479,6 +39599,7 @@ ReferenceCounter.prototype.getSession = function() {
|
|
39479
39599
|
} else if(val < 0) {
|
39480
39600
|
removedEntries.push(key);
|
39481
39601
|
}
|
39602
|
+
// else {} // when val 0 do nothing, doesn't change anything
|
39482
39603
|
}
|
39483
39604
|
return {
|
39484
39605
|
newEntries: newEntries.filter(Boolean),
|
@@ -39507,9 +39628,15 @@ ReferenceCounter.prototype.addReference = function(key, referer) {
|
|
39507
39628
|
|
39508
39629
|
if(this._counter[key]) {
|
39509
39630
|
++this._counter[key];
|
39631
|
+
// The session will not change when a field already exists and a counter is attempted to be added
|
39510
39632
|
} else {
|
39511
39633
|
this._counter[key] = 1;
|
39512
|
-
this._session[key]
|
39634
|
+
if(this._session[key] === -1) {
|
39635
|
+
this._session[key] = 0;
|
39636
|
+
} else {
|
39637
|
+
this._session[key] = 1;
|
39638
|
+
}
|
39639
|
+
|
39513
39640
|
return true;
|
39514
39641
|
}
|
39515
39642
|
}
|
@@ -39559,7 +39686,11 @@ ReferenceCounter.prototype.removeReference = function(key, referer, count) {
|
|
39559
39686
|
val -= count;
|
39560
39687
|
if(!val || val < 0) {
|
39561
39688
|
delete this._counter[key];
|
39562
|
-
this._session[key]
|
39689
|
+
if(this._session[key] === 1) {
|
39690
|
+
this._session[key] = 0;
|
39691
|
+
} else {
|
39692
|
+
this._session[key] = -1;
|
39693
|
+
}
|
39563
39694
|
return true;
|
39564
39695
|
}
|
39565
39696
|
|
@@ -40252,6 +40383,10 @@ SortableTitlePlugin.prototype._userManagedLogic = false;
|
|
40252
40383
|
* @type {boolean}
|
40253
40384
|
*/
|
40254
40385
|
SortableTitlePlugin.prototype._disabled = false;
|
40386
|
+
/** @private
|
40387
|
+
* @type {boolean}
|
40388
|
+
*/
|
40389
|
+
SortableTitlePlugin.prototype._frozenIndicator = false;
|
40255
40390
|
/** Since DataView in real-time grid has only one ROW_DEF column, we need to re-map sorting field to sort correctly.
|
40256
40391
|
* @private
|
40257
40392
|
* @type {boolean}
|
@@ -40810,8 +40945,9 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
|
|
40810
40945
|
* @param {Object=} opt_arg Event argument to be sent with preDataSorting event
|
40811
40946
|
*/
|
40812
40947
|
SortableTitlePlugin.prototype.clearSortState = function (opt_arg) {
|
40813
|
-
this._popSortState(0, opt_arg)
|
40814
|
-
|
40948
|
+
if(this._popSortState(0, opt_arg)) {
|
40949
|
+
this.updateSortSymbols();
|
40950
|
+
}
|
40815
40951
|
};
|
40816
40952
|
/** @description Perform sorting with the same parameter.
|
40817
40953
|
* @public
|
@@ -41016,6 +41152,12 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
|
|
41016
41152
|
|
41017
41153
|
};
|
41018
41154
|
/** @public
|
41155
|
+
* @param {boolean=} bool=true, if set to false it will be unfreeze indicator
|
41156
|
+
*/
|
41157
|
+
SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
|
41158
|
+
this._frozenIndicator = bool !== false;
|
41159
|
+
};
|
41160
|
+
/** @public
|
41019
41161
|
* @param {boolean=} disabled
|
41020
41162
|
*/
|
41021
41163
|
SortableTitlePlugin.prototype.disableSortSymbols = function (disabled) {
|
@@ -41628,7 +41770,7 @@ SortableTitlePlugin.prototype._clearSortSymbols = function (state) {
|
|
41628
41770
|
SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
|
41629
41771
|
var t = this;
|
41630
41772
|
var host = t._hosts[hostIndex];
|
41631
|
-
if (!host) { return; }
|
41773
|
+
if (!host || this._frozenIndicator) { return; }
|
41632
41774
|
|
41633
41775
|
var section = host.getSection("title");
|
41634
41776
|
if (section == null) { return; }
|
@@ -41916,6 +42058,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
41916
42058
|
* @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
|
41917
42059
|
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
41918
42060
|
* @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
|
42061
|
+
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
41919
42062
|
*/
|
41920
42063
|
|
41921
42064
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -42378,6 +42521,10 @@ Grid.prototype._pollingEnabled = true;
|
|
42378
42521
|
* @private
|
42379
42522
|
*/
|
42380
42523
|
Grid.prototype._fieldCaching = false;
|
42524
|
+
/** @type {string}
|
42525
|
+
* @private
|
42526
|
+
*/
|
42527
|
+
Grid.prototype._childDataField = "";
|
42381
42528
|
|
42382
42529
|
|
42383
42530
|
/** @public
|
@@ -42792,6 +42939,9 @@ Grid.prototype.initialize = function(gridOption) {
|
|
42792
42939
|
}
|
42793
42940
|
|
42794
42941
|
// Row operations
|
42942
|
+
if(gridOption["childDataField"] != null) {
|
42943
|
+
this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
|
42944
|
+
}
|
42795
42945
|
var rows = gridOption["rows"];
|
42796
42946
|
if(!rows) {
|
42797
42947
|
rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
|
@@ -42947,6 +43097,10 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
42947
43097
|
obj["fieldCaching"] = this._fieldCaching;
|
42948
43098
|
}
|
42949
43099
|
|
43100
|
+
if(this._childDataField) {
|
43101
|
+
obj["childDataField"] = this._childDataField;
|
43102
|
+
}
|
43103
|
+
|
42950
43104
|
// get all rows config
|
42951
43105
|
var rowDefs = this.getAllRowDefinitions();
|
42952
43106
|
var rows = obj["rows"] = [];
|
@@ -43084,9 +43238,8 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
43084
43238
|
|
43085
43239
|
// JET
|
43086
43240
|
if (this._subs) {
|
43087
|
-
var
|
43088
|
-
|
43089
|
-
this._subs["addFields"](fields);
|
43241
|
+
var realtimeFields = addedFields.filter(ColumnDefinition.isRealTimeField);
|
43242
|
+
this._subs["addFields"](realtimeFields);
|
43090
43243
|
}
|
43091
43244
|
|
43092
43245
|
this._dispatch(e.type, e);
|
@@ -43097,6 +43250,7 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
43097
43250
|
Grid.prototype._onFieldRemoved = function(e) {
|
43098
43251
|
var removedFields = e.removedFields;
|
43099
43252
|
|
43253
|
+
// TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
|
43100
43254
|
// JET
|
43101
43255
|
if(this._subs) {
|
43102
43256
|
this._subs["removeFields"](removedFields);
|
@@ -43350,15 +43504,7 @@ Grid.prototype._onFieldLoadedError = function (err) {
|
|
43350
43504
|
* @param {string} referrer
|
43351
43505
|
*/
|
43352
43506
|
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
43353
|
-
|
43354
|
-
var colIndex = this.getColumnIndex(field);
|
43355
|
-
if(colIndex > -1) {
|
43356
|
-
var colDef = this._getColumnDefinition(field);
|
43357
|
-
if(colDef.isTimeSeriesField()) {
|
43358
|
-
this._insertTimeSeriesChildren(colDef);
|
43359
|
-
}
|
43360
|
-
this._connector.addFields(field, referrer);
|
43361
|
-
}
|
43507
|
+
this._connector.addFields(field, referrer);
|
43362
43508
|
};
|
43363
43509
|
|
43364
43510
|
/**
|
@@ -43677,6 +43823,62 @@ Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
|
43677
43823
|
return this.moveColumn(srcIndex, destIndex);
|
43678
43824
|
};
|
43679
43825
|
|
43826
|
+
/** @public
|
43827
|
+
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
43828
|
+
* @param {number|string} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
43829
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
43830
|
+
*/
|
43831
|
+
Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
43832
|
+
var destId = (typeof destCol === "number") ? this.getColumnId(destCol) : destCol;
|
43833
|
+
|
43834
|
+
if(Array.isArray(colRefs)) {
|
43835
|
+
var srcLen = colRefs.length;
|
43836
|
+
if(srcLen > 1) {
|
43837
|
+
var colIds = this.getColumnIds();
|
43838
|
+
var srcIds = [];
|
43839
|
+
var invalidDest = false;
|
43840
|
+
var i;
|
43841
|
+
for(i = 0; i < srcLen; ++i) {
|
43842
|
+
var colRef = colRefs[i];
|
43843
|
+
var srcId = (typeof colRef === "number") ? colIds[colRef] : colRef;
|
43844
|
+
if(srcId) {
|
43845
|
+
srcIds.push(srcId);
|
43846
|
+
if(destId === srcId) {
|
43847
|
+
invalidDest = true; // Destination must not exist in source columns
|
43848
|
+
}
|
43849
|
+
}
|
43850
|
+
}
|
43851
|
+
srcLen = srcIds.length;
|
43852
|
+
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
43853
|
+
var colCount = colIds.length;
|
43854
|
+
var destIdx = this.getColumnIndex(destId);
|
43855
|
+
if(destIdx >= 0) {
|
43856
|
+
while(++destIdx < colCount) {
|
43857
|
+
destId = colIds[destIdx];
|
43858
|
+
if(srcIds.indexOf(destId) < 0) {
|
43859
|
+
break;
|
43860
|
+
}
|
43861
|
+
}
|
43862
|
+
}
|
43863
|
+
if(destIdx < 0 || destIdx >= colCount) {
|
43864
|
+
destId = "";
|
43865
|
+
}
|
43866
|
+
}
|
43867
|
+
|
43868
|
+
var dirty = 0;
|
43869
|
+
for(i = 0; i < srcLen; ++i) {
|
43870
|
+
dirty |= this.moveColumnById(srcIds[i], destId);
|
43871
|
+
}
|
43872
|
+
// TODO: Handle the case where all columns stay in the same place
|
43873
|
+
return dirty ? true : false;
|
43874
|
+
} else {
|
43875
|
+
return this.moveColumnById(colRefs[0], destId);
|
43876
|
+
}
|
43877
|
+
}
|
43878
|
+
|
43879
|
+
// colRefs will be a number or string
|
43880
|
+
return this.moveColumnById(colRefs, destId);
|
43881
|
+
};
|
43680
43882
|
|
43681
43883
|
/** The hidden column still occupies the same index.
|
43682
43884
|
* @public
|
@@ -44797,17 +44999,136 @@ Grid.prototype.getAllFields = function() {
|
|
44797
44999
|
return this._connector.getAllFields();
|
44798
45000
|
};
|
44799
45001
|
/** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
|
44800
|
-
|
44801
|
-
|
44802
|
-
|
44803
|
-
|
44804
|
-
|
45002
|
+
* If no index is specified (null or undefined index), unfreeze all columns.
|
45003
|
+
* @public
|
45004
|
+
* @param {number=} colIndex Negative index is equivalent to null value
|
45005
|
+
* @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
|
45006
|
+
*/
|
44805
45007
|
Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
|
44806
45008
|
if(colIndex == null) {
|
44807
45009
|
colIndex = -1;
|
44808
45010
|
}
|
44809
45011
|
this._grid.freezeColumn(colIndex, pinnedRightColumns);
|
44810
45012
|
};
|
45013
|
+
/** Pin column to the left side by moving the specified column to the rightmost of the frozen columns. <br>
|
45014
|
+
* The method will do nothing if the specified column is already pinned to the left side
|
45015
|
+
* @public
|
45016
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
|
45017
|
+
* @return {boolean}
|
45018
|
+
*/
|
45019
|
+
Grid.prototype.pinColumn = function(colRef) {
|
45020
|
+
if(Array.isArray(colRef)) {
|
45021
|
+
var ary = colRef;
|
45022
|
+
var len = ary.length;
|
45023
|
+
|
45024
|
+
var dirty = 0;
|
45025
|
+
for(var i = 0; i < len; ++i) {
|
45026
|
+
dirty |= this._pinColumn(ary[i]);
|
45027
|
+
}
|
45028
|
+
return dirty ? true : false;
|
45029
|
+
}
|
45030
|
+
return this._pinColumn(colRef);
|
45031
|
+
};
|
45032
|
+
/** @private
|
45033
|
+
* @param {Grid~ColumnReference} colRef
|
45034
|
+
* @return {boolean}
|
45035
|
+
*/
|
45036
|
+
Grid.prototype._pinColumn = function(colRef) {
|
45037
|
+
var colIndex = this.getColumnIndex(colRef);
|
45038
|
+
if(colIndex < 0) {
|
45039
|
+
return false;
|
45040
|
+
}
|
45041
|
+
var pinnedCount = this._grid.getFrozenColumnCount();
|
45042
|
+
if(colIndex < pinnedCount) {
|
45043
|
+
return false; // The column is already pinned area
|
45044
|
+
}
|
45045
|
+
if(!pinnedCount) {
|
45046
|
+
var stationaryIdx = this._grid.getStationaryColumnIndex();
|
45047
|
+
if(stationaryIdx >= 0) {
|
45048
|
+
pinnedCount = stationaryIdx;
|
45049
|
+
if(colIndex > stationaryIdx) {
|
45050
|
+
pinnedCount++;
|
45051
|
+
}
|
45052
|
+
}
|
45053
|
+
}
|
45054
|
+
|
45055
|
+
this.moveColumnById(colIndex, pinnedCount);
|
45056
|
+
this._grid.freezeColumn(pinnedCount);
|
45057
|
+
return true;
|
45058
|
+
};
|
45059
|
+
/** Unpin column from the left side by moving the specified column to the end of the frozen columns. <br>
|
45060
|
+
* The method will do nothing if the specified column is not pinned on the left side.
|
45061
|
+
* @public
|
45062
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
|
45063
|
+
* @param {Grid~ColumnReference=} dest The unpinned column will be placed before the destination position after the operation
|
45064
|
+
* @return {boolean}
|
45065
|
+
*/
|
45066
|
+
Grid.prototype.unpinColumn = function(colRef, dest) {
|
45067
|
+
if(Array.isArray(colRef)) {
|
45068
|
+
var ary = colRef;
|
45069
|
+
var len = ary.length;
|
45070
|
+
|
45071
|
+
var dirty = 0;
|
45072
|
+
for(var i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
|
45073
|
+
dirty |= this._unpinColumn(ary[i], dest);
|
45074
|
+
}
|
45075
|
+
return dirty ? true : false;
|
45076
|
+
}
|
45077
|
+
return this._unpinColumn(colRef, dest);
|
45078
|
+
};
|
45079
|
+
/** @private
|
45080
|
+
* @param {Grid~ColumnReference} colRef
|
45081
|
+
* @param {Grid~ColumnReference=} dest The unpinned column will be placed before the destination position after the operation
|
45082
|
+
* @return {boolean}
|
45083
|
+
*/
|
45084
|
+
Grid.prototype._unpinColumn = function(colRef, dest) {
|
45085
|
+
var colIndex = this.getColumnIndex(colRef);
|
45086
|
+
if(colIndex < 0) {
|
45087
|
+
return false;
|
45088
|
+
}
|
45089
|
+
var pinnedCount = this._grid.getFrozenColumnCount();
|
45090
|
+
if(!pinnedCount) {
|
45091
|
+
return false;
|
45092
|
+
}
|
45093
|
+
if(colIndex >= pinnedCount) {
|
45094
|
+
return false; // The column is outside of frozen area
|
45095
|
+
}
|
45096
|
+
var srcId = null;
|
45097
|
+
var destId = null;
|
45098
|
+
if(dest != null) {
|
45099
|
+
var destIdx = this.getColumnIndex(dest);
|
45100
|
+
destId = this.getColumnId(destIdx);
|
45101
|
+
srcId = this.getColumnId(colIndex);
|
45102
|
+
}
|
45103
|
+
|
45104
|
+
var stationaryIdx = this._grid.getStationaryColumnIndex();
|
45105
|
+
|
45106
|
+
if(colIndex > stationaryIdx) {
|
45107
|
+
this.moveColumnById(colIndex, pinnedCount);
|
45108
|
+
}
|
45109
|
+
|
45110
|
+
this._grid.freezeColumn(pinnedCount - 2); // Column index is used for freezing
|
45111
|
+
|
45112
|
+
if(colIndex > stationaryIdx) {
|
45113
|
+
if(destId != null) {
|
45114
|
+
this.moveColumnById(srcId, destId);
|
45115
|
+
}
|
45116
|
+
}
|
45117
|
+
|
45118
|
+
return true;
|
45119
|
+
};
|
45120
|
+
/** A shorthand to unpin all columns from the left hand side
|
45121
|
+
* @public
|
45122
|
+
* @return {boolean}
|
45123
|
+
*/
|
45124
|
+
Grid.prototype.unpinAllColumns = function() {
|
45125
|
+
var pinnedCount = this._grid.getFrozenColumnCount();
|
45126
|
+
if(!pinnedCount) {
|
45127
|
+
return false;
|
45128
|
+
}
|
45129
|
+
this._grid.freezeColumn(-1); // Column index is used for freezing
|
45130
|
+
return true;
|
45131
|
+
};
|
44811
45132
|
|
44812
45133
|
/** @private
|
44813
45134
|
* @param {Object} e
|