@refinitiv-ui/efx-grid 6.0.27 → 6.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +247 -29
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +1 -1
- package/lib/core/es6/data/DataTable.js +3 -2
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +3 -2
- package/lib/core/es6/data/Segment.d.ts +1 -1
- package/lib/core/es6/data/Segment.js +12 -3
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
- package/lib/core/es6/data/SegmentCollection.js +3 -2
- package/lib/core/es6/grid/Core.d.ts +17 -3
- package/lib/core/es6/grid/Core.js +226 -20
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +21 -2
- package/lib/rt-grid/dist/rt-grid.js +418 -238
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -2
- package/lib/rt-grid/es6/ColumnDefinition.js +71 -70
- package/lib/rt-grid/es6/Grid.d.ts +9 -2
- package/lib/rt-grid/es6/Grid.js +55 -132
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -3
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +9 -27
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +2 -8
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +6 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +67 -0
- package/lib/types/es6/ColumnGrouping.d.ts +3 -3
- package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
- package/lib/types/es6/Core/data/DataView.d.ts +1 -1
- package/lib/types/es6/Core/data/Segment.d.ts +1 -1
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/lib/types/es6/Core/grid/Core.d.ts +17 -3
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -2
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +9 -2
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -9988,14 +9988,23 @@ Segment.prototype.addChild = function(rid, dataId) {
|
|
9988
9988
|
};
|
9989
9989
|
/** @public
|
9990
9990
|
* @param {Array.<string>} rids
|
9991
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
9991
9992
|
* @return {boolean}
|
9992
9993
|
*/
|
9993
|
-
Segment.prototype.addChildren = function(rids) {
|
9994
|
+
Segment.prototype.addChildren = function(rids, dataIds) {
|
9994
9995
|
var rowIds = Array.isArray(rids) ? rids : [rids];
|
9995
9996
|
var rowCount = rowIds.length;
|
9996
9997
|
var dirty = 0;
|
9997
|
-
|
9998
|
-
|
9998
|
+
var i;
|
9999
|
+
if(dataIds != null) {
|
10000
|
+
dataIds = Array.isArray(dataIds) ? dataIds : [dataIds];
|
10001
|
+
for(i = 0; i < rowCount; ++i) {
|
10002
|
+
dirty |= this.addChild(rowIds[i], dataIds[i]);
|
10003
|
+
}
|
10004
|
+
} else {
|
10005
|
+
for(i = 0; i < rowCount; ++i) {
|
10006
|
+
dirty |= this.addChild(rowIds[i]);
|
10007
|
+
}
|
9999
10008
|
}
|
10000
10009
|
return dirty ? true : false;
|
10001
10010
|
};
|
@@ -10821,12 +10830,13 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
10821
10830
|
/** @public
|
10822
10831
|
* @param {string} segmentId
|
10823
10832
|
* @param {Array.<string>} rids
|
10833
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
10824
10834
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
10825
10835
|
*/
|
10826
|
-
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids) {
|
10836
|
+
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
10827
10837
|
var segment = this._segments[segmentId];
|
10828
10838
|
if(segment && !segment.isSubSegment()) {
|
10829
|
-
return segment.addChildren(rids);
|
10839
|
+
return segment.addChildren(rids, dataIds);
|
10830
10840
|
}
|
10831
10841
|
return false;
|
10832
10842
|
};
|
@@ -12290,11 +12300,12 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
12290
12300
|
/** @public
|
12291
12301
|
* @param {string} segmentId Row id
|
12292
12302
|
* @param {Array.<string>} rids Row id
|
12303
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
12293
12304
|
* @return {boolean} Return true if there is any change
|
12294
12305
|
*/
|
12295
|
-
DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
|
12306
|
+
DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
12296
12307
|
if(this._segments) {
|
12297
|
-
var dirty = this._segments.addSegmentChildren(segmentId, rids);
|
12308
|
+
var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
|
12298
12309
|
if(dirty) {
|
12299
12310
|
if(this._sort(null)) {
|
12300
12311
|
this._dispatchPositionChange();
|
@@ -14890,14 +14901,13 @@ var _toAlignment = function(str) {
|
|
14890
14901
|
};
|
14891
14902
|
|
14892
14903
|
/** @constructor
|
14893
|
-
* @param {ColumnDefinition~Options
|
14904
|
+
* @param {ColumnDefinition~Options=} columnOption
|
14894
14905
|
* @param {*=} hostGrid
|
14895
14906
|
*/
|
14896
14907
|
var ColumnDefinition = function(columnOption, hostGrid) {
|
14897
14908
|
this._defaultRenderer = this._defaultRenderer.bind(this);
|
14898
14909
|
this._customRenderer = this._customRenderer.bind(this);
|
14899
14910
|
|
14900
|
-
this._id = "" + ColumnDefinition._runningId++;
|
14901
14911
|
this._internalRenderer = this._defaultRenderer;
|
14902
14912
|
this._internalSorter = this._defaultSorter;
|
14903
14913
|
|
@@ -14922,16 +14932,8 @@ var ColumnDefinition = function(columnOption, hostGrid) {
|
|
14922
14932
|
|
14923
14933
|
};
|
14924
14934
|
//#region Private Members
|
14925
|
-
/**
|
14926
|
-
* @
|
14927
|
-
*/
|
14928
|
-
ColumnDefinition.prototype._id;
|
14929
|
-
/** @type {number}
|
14930
|
-
* @private
|
14931
|
-
*/
|
14932
|
-
ColumnDefinition._runningId = 1;
|
14933
|
-
|
14934
|
-
/** @type {string}
|
14935
|
+
/** This is used as a cache for better performance. The actual field is stored in the core
|
14936
|
+
* @type {string}
|
14935
14937
|
* @private
|
14936
14938
|
*/
|
14937
14939
|
ColumnDefinition.prototype._field = "";
|
@@ -14946,11 +14948,11 @@ ColumnDefinition.prototype._name = "";
|
|
14946
14948
|
/** @type {boolean}
|
14947
14949
|
* @private
|
14948
14950
|
*/
|
14949
|
-
ColumnDefinition.prototype.
|
14951
|
+
ColumnDefinition.prototype._defaultName = true;
|
14950
14952
|
/** @type {boolean}
|
14951
14953
|
* @private
|
14952
14954
|
*/
|
14953
|
-
ColumnDefinition.prototype.
|
14955
|
+
ColumnDefinition.prototype._defaultField = true;
|
14954
14956
|
/** @type {string|null}
|
14955
14957
|
* @private
|
14956
14958
|
*/
|
@@ -15049,6 +15051,10 @@ ColumnDefinition.prototype._children = null;
|
|
15049
15051
|
* @private
|
15050
15052
|
*/
|
15051
15053
|
ColumnDefinition.prototype._info = null;
|
15054
|
+
/** @type {Object}
|
15055
|
+
* @private
|
15056
|
+
*/
|
15057
|
+
ColumnDefinition.prototype._coreColDef = null;
|
15052
15058
|
//#endregion Private Members
|
15053
15059
|
|
15054
15060
|
|
@@ -15056,6 +15062,7 @@ ColumnDefinition.prototype._info = null;
|
|
15056
15062
|
*/
|
15057
15063
|
ColumnDefinition.prototype.dispose = function() {
|
15058
15064
|
this._eventArg = {}; // Clear all references
|
15065
|
+
this._coreColDef = null;
|
15059
15066
|
this._activatedRenderer = this._rendererMap = null;
|
15060
15067
|
this.setRenderer(null); // this._userRenderers are removed
|
15061
15068
|
this.setSorter(null);
|
@@ -15075,25 +15082,19 @@ ColumnDefinition.prototype._initializeTimeSeriesChild = function(columnOption) {
|
|
15075
15082
|
this.initialize(columnOption);
|
15076
15083
|
};
|
15077
15084
|
/** @public
|
15078
|
-
* @param {ColumnDefinition~Options
|
15085
|
+
* @param {ColumnDefinition~Options=} columnOption
|
15079
15086
|
*/
|
15080
15087
|
ColumnDefinition.prototype.initialize = function(columnOption) {
|
15081
|
-
var field = "";
|
15082
|
-
if(typeof columnOption === "string") {
|
15083
|
-
field = columnOption;
|
15084
|
-
columnOption = js_FieldDefinition.get(field) || null;
|
15085
|
-
}
|
15086
|
-
|
15087
15088
|
if(!columnOption) {
|
15088
|
-
this._setField(field);
|
15089
15089
|
return;
|
15090
15090
|
}
|
15091
15091
|
|
15092
|
-
var i, len, key;
|
15092
|
+
var i, len, key, val;
|
15093
15093
|
//#region Apply pre-defined option
|
15094
|
-
field = columnOption["field"];
|
15094
|
+
var field = columnOption["field"]; // Field could be null or undefined here
|
15095
15095
|
var defaultOption = js_FieldDefinition.get(field);
|
15096
15096
|
if(defaultOption && defaultOption !== columnOption) { // The column match the default field list
|
15097
|
+
// WARNING: This changes reference of the user object. Any new property added won't affect anything outside of this method
|
15097
15098
|
var userOption = columnOption;
|
15098
15099
|
columnOption = {}; // Create a new object for cloning process
|
15099
15100
|
|
@@ -15107,12 +15108,6 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15107
15108
|
}
|
15108
15109
|
//#endregion Apply pre-defined option
|
15109
15110
|
|
15110
|
-
var val;
|
15111
|
-
val = columnOption["id"];
|
15112
|
-
if(val) {
|
15113
|
-
this._id = val + "";
|
15114
|
-
}
|
15115
|
-
|
15116
15111
|
val = columnOption["formulaEngine"];
|
15117
15112
|
if(val && val["addFormula"]) {
|
15118
15113
|
this._fnEngine = /** @type{Engine} */(val);
|
@@ -15136,7 +15131,7 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15136
15131
|
val = columnOption["name"] || columnOption["title"]; // title is migrated from Composite Grid
|
15137
15132
|
if(val != null) { // Name can be empty string
|
15138
15133
|
this._name = val;
|
15139
|
-
this.
|
15134
|
+
this._defaultName = false;
|
15140
15135
|
}
|
15141
15136
|
|
15142
15137
|
val = columnOption["dataType"];
|
@@ -15225,14 +15220,17 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15225
15220
|
this._info = val;
|
15226
15221
|
}
|
15227
15222
|
|
15228
|
-
this._userModel = columnOption;
|
15223
|
+
this._userModel = columnOption; // WARNING: This may not actually the user object
|
15229
15224
|
};
|
15230
15225
|
|
15231
15226
|
/** @public
|
15232
15227
|
* @return {string}
|
15233
15228
|
*/
|
15234
15229
|
ColumnDefinition.prototype.getId = function() {
|
15235
|
-
|
15230
|
+
if(this._coreColDef) {
|
15231
|
+
return this._coreColDef["id"] || "";
|
15232
|
+
}
|
15233
|
+
return "";
|
15236
15234
|
};
|
15237
15235
|
/** @public
|
15238
15236
|
* @return {!Array.<string>}
|
@@ -15263,19 +15261,25 @@ ColumnDefinition.prototype.getHeaderRenderer = function() {
|
|
15263
15261
|
* @return {string}
|
15264
15262
|
*/
|
15265
15263
|
ColumnDefinition.prototype.getName = function() {
|
15264
|
+
if(this._defaultName) {
|
15265
|
+
if(this._defaultField) {
|
15266
|
+
return "Column " + this.getId();
|
15267
|
+
}
|
15268
|
+
return this.getField();
|
15269
|
+
}
|
15266
15270
|
return this._name;
|
15267
15271
|
};
|
15268
15272
|
/** @public
|
15269
15273
|
* @return {boolean}
|
15270
15274
|
*/
|
15271
15275
|
ColumnDefinition.prototype.isDefaultName = function() {
|
15272
|
-
return this.
|
15276
|
+
return this._defaultName;
|
15273
15277
|
};
|
15274
15278
|
/** @public
|
15275
15279
|
* @return {string}
|
15276
15280
|
*/
|
15277
15281
|
ColumnDefinition.prototype.getFieldDefinition = function () {
|
15278
|
-
return js_FieldDefinition.get(this.
|
15282
|
+
return js_FieldDefinition.get(this.getField());
|
15279
15283
|
};
|
15280
15284
|
/** get realtime field data type
|
15281
15285
|
* @public
|
@@ -15337,12 +15341,14 @@ ColumnDefinition.prototype.getTooltip = function() {
|
|
15337
15341
|
}
|
15338
15342
|
}
|
15339
15343
|
|
15340
|
-
|
15341
|
-
|
15344
|
+
var name = this.getName();
|
15345
|
+
if(name) {
|
15346
|
+
return name;
|
15342
15347
|
}
|
15343
15348
|
|
15344
|
-
|
15345
|
-
|
15349
|
+
var field = this.getField();
|
15350
|
+
if(field) {
|
15351
|
+
return field;
|
15346
15352
|
}
|
15347
15353
|
|
15348
15354
|
return "";
|
@@ -15351,25 +15357,32 @@ ColumnDefinition.prototype.getTooltip = function() {
|
|
15351
15357
|
* @return {string}
|
15352
15358
|
*/
|
15353
15359
|
ColumnDefinition.prototype.getField = function() {
|
15354
|
-
|
15360
|
+
if(this._coreColDef) {
|
15361
|
+
return this._coreColDef["field"] || "";
|
15362
|
+
}
|
15363
|
+
return "";
|
15355
15364
|
};
|
15356
15365
|
/** @public
|
15357
15366
|
* @return {!Array.<string>}
|
15358
15367
|
*/
|
15359
15368
|
ColumnDefinition.prototype.getAllFields = function() {
|
15360
|
-
|
15369
|
+
var field = this.getField();
|
15370
|
+
if(field) {
|
15371
|
+
return this._requiredFields.concat(field);
|
15372
|
+
}
|
15373
|
+
return this._requiredFields.slice();
|
15361
15374
|
};
|
15362
15375
|
/** @public
|
15363
15376
|
* @return {boolean}
|
15364
15377
|
*/
|
15365
15378
|
ColumnDefinition.prototype.isRealTimeField = function() {
|
15366
|
-
return js_FieldDefinition.isRealTimeField(this.
|
15379
|
+
return js_FieldDefinition.isRealTimeField(this.getField());
|
15367
15380
|
};
|
15368
15381
|
/** @public
|
15369
15382
|
* @return {boolean}
|
15370
15383
|
*/
|
15371
15384
|
ColumnDefinition.prototype.isTimeSeries = function() {
|
15372
|
-
return js_FieldDefinition.isTimeSeries(this.
|
15385
|
+
return js_FieldDefinition.isTimeSeries(this.getField());
|
15373
15386
|
};
|
15374
15387
|
/** @public
|
15375
15388
|
* @return {boolean}
|
@@ -15474,7 +15487,7 @@ ColumnDefinition.prototype.getTextAlign = function() {
|
|
15474
15487
|
* @return {boolean}
|
15475
15488
|
*/
|
15476
15489
|
ColumnDefinition.prototype.isFieldEmpty = function() {
|
15477
|
-
return this.
|
15490
|
+
return !this.getField();
|
15478
15491
|
};
|
15479
15492
|
|
15480
15493
|
/** @public
|
@@ -15500,8 +15513,13 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15500
15513
|
obj["info"] = this._info;
|
15501
15514
|
}
|
15502
15515
|
|
15503
|
-
if(
|
15504
|
-
|
15516
|
+
if(obj["field"] == null) {
|
15517
|
+
if(!this._defaultField) {
|
15518
|
+
var field = this.getField();
|
15519
|
+
if(field) {
|
15520
|
+
obj["field"] = field;
|
15521
|
+
}
|
15522
|
+
}
|
15505
15523
|
}
|
15506
15524
|
|
15507
15525
|
var value = this.getDataType();
|
@@ -15513,16 +15531,16 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
15513
15531
|
obj["formulaReference"] = this._formulaRef;
|
15514
15532
|
}
|
15515
15533
|
|
15516
|
-
if(this._requiredFields) {
|
15534
|
+
if(this._requiredFields && this._requiredFields.length) {
|
15517
15535
|
obj["require"] = this._requiredFields;
|
15518
15536
|
}
|
15519
15537
|
|
15520
|
-
if(this.
|
15521
|
-
obj["name"] = this.
|
15538
|
+
if(!this._defaultName) {
|
15539
|
+
obj["name"] = this.getName();
|
15522
15540
|
}
|
15523
15541
|
|
15524
15542
|
// The 'IsRealtimeField' property will only be set if the user sets 'notRealTimeField' in the column options. It will be returned if the user has this option enabled, otherwise it will not be returned
|
15525
|
-
value = js_FieldDefinition.getFieldProperty(this.
|
15543
|
+
value = js_FieldDefinition.getFieldProperty(this.getField(), "IsRealtimeField") === false;
|
15526
15544
|
if(value) {
|
15527
15545
|
obj["notRealTimeField"] = value;
|
15528
15546
|
}
|
@@ -15645,8 +15663,6 @@ ColumnDefinition.prototype.setRenderer = function(func) {
|
|
15645
15663
|
ColumnDefinition.prototype.getParent = function() {
|
15646
15664
|
return this._parent;
|
15647
15665
|
};
|
15648
|
-
|
15649
|
-
|
15650
15666
|
/**
|
15651
15667
|
* @private
|
15652
15668
|
* @param {ColumnDefinition} parentDef
|
@@ -15663,8 +15679,6 @@ ColumnDefinition.prototype._setParent = function(parentDef) {
|
|
15663
15679
|
}
|
15664
15680
|
return false;
|
15665
15681
|
};
|
15666
|
-
|
15667
|
-
|
15668
15682
|
/**
|
15669
15683
|
* @public
|
15670
15684
|
* @return {Array.<ColumnDefinition>}
|
@@ -15672,7 +15686,6 @@ ColumnDefinition.prototype._setParent = function(parentDef) {
|
|
15672
15686
|
ColumnDefinition.prototype.getChildren = function() {
|
15673
15687
|
return this._children;
|
15674
15688
|
};
|
15675
|
-
|
15676
15689
|
/**
|
15677
15690
|
* @private
|
15678
15691
|
* @param {string} colDef Child column definition
|
@@ -15745,7 +15758,7 @@ ColumnDefinition.prototype.setSorter = function(func) {
|
|
15745
15758
|
*/
|
15746
15759
|
ColumnDefinition.prototype.isRowSorting = function() {
|
15747
15760
|
if(this._rowSorting == null) {
|
15748
|
-
return !js_FieldDefinition.getFieldProperty(this.
|
15761
|
+
return !js_FieldDefinition.getFieldProperty(this.getField(), "IsRealtimeField");
|
15749
15762
|
}
|
15750
15763
|
return this._rowSorting ? true : false;
|
15751
15764
|
};
|
@@ -15763,7 +15776,7 @@ ColumnDefinition.prototype.isAutoGenerated = function() {
|
|
15763
15776
|
*/
|
15764
15777
|
ColumnDefinition.prototype.setName = function(str) {
|
15765
15778
|
this._name = str;
|
15766
|
-
this.
|
15779
|
+
this._defaultName = false;
|
15767
15780
|
};
|
15768
15781
|
|
15769
15782
|
/** @private
|
@@ -15771,14 +15784,14 @@ ColumnDefinition.prototype.setName = function(str) {
|
|
15771
15784
|
* @param {ColumnDefinition~Options=} columnOption
|
15772
15785
|
*/
|
15773
15786
|
ColumnDefinition.prototype._setField = function(field, columnOption) {
|
15774
|
-
|
15787
|
+
this._defaultField = (field == null); // undefined or null
|
15775
15788
|
if(!field) {
|
15776
15789
|
field = "";
|
15777
15790
|
}
|
15778
15791
|
// Trim white spaces -- equivalent to String.trim(), which is not support in IE8
|
15779
15792
|
field = field.replace(/^\s+|\s+$/gm, "");
|
15780
15793
|
|
15781
|
-
var formulaStr = columnOption["formula"];
|
15794
|
+
var formulaStr = columnOption ? columnOption["formula"] : "";
|
15782
15795
|
if(this._fnEngine) {
|
15783
15796
|
var uppercasedF = field.toUpperCase(); // For comparison only
|
15784
15797
|
var predefinedF = formulaStr || js_PredefinedFormula.get(uppercasedF);
|
@@ -15798,24 +15811,15 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
|
|
15798
15811
|
}
|
15799
15812
|
}
|
15800
15813
|
|
15801
|
-
|
15802
|
-
this._field = "COLUMN_" + this._id;
|
15803
|
-
this._name = "Column " + this._id;
|
15804
|
-
this._emptyField = true;
|
15805
|
-
} else {
|
15806
|
-
this._field = field;
|
15807
|
-
this._name = field;
|
15808
|
-
this._emptyField = false;
|
15809
|
-
}
|
15814
|
+
this._field = field; // WARNING: This could be out of sync with core. It is used as a cache for better performance
|
15810
15815
|
|
15811
15816
|
// We need to cache time series in field definition for improve performance of checking methond
|
15812
15817
|
js_FieldDefinition.setFieldProperty(field, "timeSeries", js_FieldDefinition.isTimeSeries(field) ? true : false);
|
15813
15818
|
|
15814
|
-
if(columnOption["parent"]) {
|
15819
|
+
if(columnOption && columnOption["parent"]) {
|
15815
15820
|
js_FieldDefinition.setFieldProperty(field, "timeSeriesChild", true);
|
15816
15821
|
}
|
15817
15822
|
|
15818
|
-
this._isDefaultName = true;
|
15819
15823
|
this._updateContext("field", field);
|
15820
15824
|
if(this.isRealTimeField()) { // Only realtime field will have a formatted field
|
15821
15825
|
this._updateContext("formattedField", field + "_FORMATTED");
|
@@ -15921,6 +15925,14 @@ ColumnDefinition.prototype.getColumnInfo = function() {
|
|
15921
15925
|
return this._info;
|
15922
15926
|
};
|
15923
15927
|
|
15928
|
+
/** @public
|
15929
|
+
* @ignore
|
15930
|
+
* @param {Object} obj
|
15931
|
+
*/
|
15932
|
+
ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
|
15933
|
+
this._coreColDef = obj || null;
|
15934
|
+
};
|
15935
|
+
|
15924
15936
|
|
15925
15937
|
|
15926
15938
|
/* harmony default export */ var js_ColumnDefinition = (ColumnDefinition);
|
@@ -16775,7 +16787,7 @@ GroupDefinitions.prototype.removeGroup = function (groupId) {
|
|
16775
16787
|
var curDef = this._groupMap[groupId];
|
16776
16788
|
if(curDef) {
|
16777
16789
|
this.removeAllChildren(groupId);
|
16778
|
-
this.
|
16790
|
+
this.unsetParent(groupId);
|
16779
16791
|
delete this._groupMap[groupId];
|
16780
16792
|
|
16781
16793
|
return true;
|
@@ -16834,12 +16846,26 @@ GroupDefinitions.prototype._ungroupChildren = function(children) {
|
|
16834
16846
|
if (Array.isArray(children)) {
|
16835
16847
|
var len = children.length;
|
16836
16848
|
for(var i = 0; i < len; ++i) {
|
16837
|
-
this.
|
16849
|
+
this.unsetParent(children[i]);
|
16838
16850
|
}
|
16839
16851
|
}
|
16840
16852
|
};
|
16841
16853
|
|
16842
|
-
|
16854
|
+
/** @public
|
16855
|
+
* @param {string} parentId Group id
|
16856
|
+
* @param {string} childId
|
16857
|
+
* @return {boolean}
|
16858
|
+
*/
|
16859
|
+
GroupDefinitions.prototype.hasGroupChild = function (parentId, childId) {
|
16860
|
+
var groupDef = this._groupMap[parentId];
|
16861
|
+
if(childId && groupDef) {
|
16862
|
+
var chdr = groupDef.children;
|
16863
|
+
if(chdr) {
|
16864
|
+
return chdr.indexOf(childId) >= 0;
|
16865
|
+
}
|
16866
|
+
}
|
16867
|
+
return false;
|
16868
|
+
};
|
16843
16869
|
/** @public
|
16844
16870
|
* @param {string} parentId Group id
|
16845
16871
|
* @param {string} childId
|
@@ -16851,7 +16877,7 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
|
|
16851
16877
|
if(childId && groupDef) {
|
16852
16878
|
var chdr = groupDef.children;
|
16853
16879
|
if(chdr && chdr.indexOf(childId) < 0) {
|
16854
|
-
this.
|
16880
|
+
this.unsetParent(childId); // Remove previous parent
|
16855
16881
|
// Add new child to group structures
|
16856
16882
|
this._childToParent[childId] = parentId;
|
16857
16883
|
var childDef = this._groupMap[childId];
|
@@ -16864,12 +16890,27 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
|
|
16864
16890
|
}
|
16865
16891
|
return false;
|
16866
16892
|
};
|
16893
|
+
/** Remove the given child from the specified parent. If childId is not given, unsetParent will be used on parentId instead of childId.
|
16894
|
+
* @public
|
16895
|
+
* @param {string} parentId Group id
|
16896
|
+
* @param {string=} childId
|
16897
|
+
* @return {boolean}
|
16898
|
+
*/
|
16899
|
+
GroupDefinitions.prototype.removeGroupChild = function (parentId, childId) {
|
16900
|
+
if(childId == null) {
|
16901
|
+
return this.unsetParent(parentId);
|
16902
|
+
}
|
16903
|
+
if(this.hasGroupChild(parentId, childId)) {
|
16904
|
+
return this.unsetParent(childId);
|
16905
|
+
}
|
16906
|
+
return false;
|
16907
|
+
};
|
16867
16908
|
/** Remove the given child from its own parent (i.e., unset Parent of the given child).
|
16868
16909
|
* @public
|
16869
16910
|
* @param {string} childId
|
16870
16911
|
* @return {boolean}
|
16871
16912
|
*/
|
16872
|
-
GroupDefinitions.prototype.
|
16913
|
+
GroupDefinitions.prototype.unsetParent = function (childId) {
|
16873
16914
|
var parentId = this._childToParent[childId];
|
16874
16915
|
if(!parentId) {
|
16875
16916
|
return false;
|
@@ -23429,6 +23470,12 @@ Scrollbar.prototype.getDefaultMouseWheelLogic = function () {
|
|
23429
23470
|
* @param {Event} e
|
23430
23471
|
*/
|
23431
23472
|
Scrollbar.prototype._onMouseWheel = function (e) {
|
23473
|
+
|
23474
|
+
// Blacklist for prevent triggering the scrollbar when the dialog is opened.
|
23475
|
+
if(e.target.opened) { // get attribute method doesn't work in elf element
|
23476
|
+
return;
|
23477
|
+
}
|
23478
|
+
|
23432
23479
|
if (this._isFrozen) {
|
23433
23480
|
util._preventDefault(e);
|
23434
23481
|
return;
|
@@ -30781,13 +30828,14 @@ DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
|
|
30781
30828
|
/** @public
|
30782
30829
|
* @param {string|number} segmentRef Row id or row index
|
30783
30830
|
* @param {Array.<string|number>} rowRefs Array of row ids or row indices
|
30831
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
30784
30832
|
* @return {boolean} Return true if there is any change
|
30785
30833
|
*/
|
30786
|
-
DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
30834
|
+
DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
|
30787
30835
|
if(this._dt._getSegmentSeparators()) {
|
30788
30836
|
var segmentId = this._toRowId(segmentRef);
|
30789
30837
|
var rowIds = this._toRowIds(rowRefs);
|
30790
|
-
return this._dt.addSegmentChildren(segmentId, rowIds);
|
30838
|
+
return this._dt.addSegmentChildren(segmentId, rowIds, dataIds);
|
30791
30839
|
}
|
30792
30840
|
return false;
|
30793
30841
|
};
|
@@ -34863,6 +34911,9 @@ var Core = function (opt_initializer) {
|
|
34863
34911
|
var _t = this;
|
34864
34912
|
|
34865
34913
|
// Initialize method binding
|
34914
|
+
_t.getColumnId = _t.getColumnId.bind(_t);
|
34915
|
+
_t.getColumnIndex = _t.getColumnIndex.bind(_t);
|
34916
|
+
|
34866
34917
|
_t._onMouseMove = _t._onMouseMove.bind(_t);
|
34867
34918
|
_t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
|
34868
34919
|
|
@@ -35321,7 +35372,7 @@ Core.prototype._groupDefs = null;
|
|
35321
35372
|
* @return {string}
|
35322
35373
|
*/
|
35323
35374
|
Core.getVersion = function () {
|
35324
|
-
return "5.1.
|
35375
|
+
return "5.1.38";
|
35325
35376
|
};
|
35326
35377
|
/** {@link ElementWrapper#dispose}
|
35327
35378
|
* @override
|
@@ -35437,6 +35488,12 @@ Core.prototype.getConfigObject = function (gridOptions) {
|
|
35437
35488
|
}
|
35438
35489
|
|
35439
35490
|
var columnDef = this._getColumnDef(colIndex);
|
35491
|
+
if(columnDef["userId"]) {
|
35492
|
+
column["id"] = columnDef["userId"];
|
35493
|
+
}
|
35494
|
+
if(columnDef["field"]) {
|
35495
|
+
column["field"] = columnDef["field"];
|
35496
|
+
}
|
35440
35497
|
if (columnDef["styles"]) {
|
35441
35498
|
column["styles"] = columnDef["styles"];
|
35442
35499
|
}
|
@@ -36521,6 +36578,126 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
36521
36578
|
return true;
|
36522
36579
|
};
|
36523
36580
|
|
36581
|
+
/** If source column is not found, no operation is performed. If destination column is not found, the source column will be moved to the last position.<br>
|
36582
|
+
* Note: this method behaves slightly different from moveColumn method in that it always put source column at the position before the specified destination column, while moveColumn method will put column at exactly at the destination index.
|
36583
|
+
* @public
|
36584
|
+
* @param {number|string} srcCol Column Id or index
|
36585
|
+
* @param {(number|string)=} destCol Column Id or index of the destination
|
36586
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
36587
|
+
* @see {@link Core#moveColumn}
|
36588
|
+
* @example
|
36589
|
+
* grid.moveColumnById(3, 1); // Move column 3 to position before column 1
|
36590
|
+
* grid.moveColumnById(0, 2); // Move column 0 to position before column 2 (column index 1)
|
36591
|
+
* grid.moveColumnById(0, 1); // Nothing is moved
|
36592
|
+
* grid.moveColumnById("sourceColumnId", "anotherId");
|
36593
|
+
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
36594
|
+
*/
|
36595
|
+
Core.prototype.moveColumnById = function (srcCol, destCol) {
|
36596
|
+
var colCount = this.getColumnCount();
|
36597
|
+
var srcIndex = this.getColumnIndex(srcCol);
|
36598
|
+
if(srcIndex < 0 || srcIndex >= colCount) {
|
36599
|
+
return false;
|
36600
|
+
}
|
36601
|
+
var destIndex = destCol != null ? this.getColumnIndex(destCol) : -1;
|
36602
|
+
if(destIndex < 0) {
|
36603
|
+
destIndex = colCount;
|
36604
|
+
}
|
36605
|
+
return this._moveColumnByIndex(srcIndex, destIndex);
|
36606
|
+
};
|
36607
|
+
/** Move column without verification for better performance
|
36608
|
+
* @private
|
36609
|
+
* @param {number} srcIndex Column index
|
36610
|
+
* @param {number} destIndex Column index of the destination
|
36611
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
36612
|
+
*/
|
36613
|
+
Core.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
36614
|
+
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
36615
|
+
--destIndex;
|
36616
|
+
}
|
36617
|
+
if(srcIndex === destIndex) {
|
36618
|
+
return false;
|
36619
|
+
}
|
36620
|
+
return this.moveColumn(srcIndex, destIndex);
|
36621
|
+
};
|
36622
|
+
/** @public
|
36623
|
+
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
36624
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
36625
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
36626
|
+
*/
|
36627
|
+
Core.prototype.reorderColumns = function (colRefs, destCol) {
|
36628
|
+
var destId = "";
|
36629
|
+
if(typeof destCol === "number") {
|
36630
|
+
destId = this.getColumnId(destCol);
|
36631
|
+
} else if(destCol) {
|
36632
|
+
destId = destCol;
|
36633
|
+
}
|
36634
|
+
|
36635
|
+
if(Array.isArray(colRefs)) {
|
36636
|
+
var srcLen = colRefs.length;
|
36637
|
+
if(srcLen > 1) {
|
36638
|
+
var colIds = this.getColumnIds();
|
36639
|
+
var colCount = colIds.length;
|
36640
|
+
var srcIds = [];
|
36641
|
+
var invalidDest = false;
|
36642
|
+
var i, srcId, srcIdx;
|
36643
|
+
for(i = 0; i < srcLen; ++i) {
|
36644
|
+
var colRef = colRefs[i];
|
36645
|
+
if(typeof colRef === "number") {
|
36646
|
+
srcIdx = colRef;
|
36647
|
+
srcId = colIds[colRef] || "";
|
36648
|
+
} else {
|
36649
|
+
srcId = colRef;
|
36650
|
+
srcIdx = colIds.indexOf(srcId);
|
36651
|
+
}
|
36652
|
+
if(srcId && srcIdx >= 0) {
|
36653
|
+
srcIds.push(srcId);
|
36654
|
+
if(destId === srcId) {
|
36655
|
+
invalidDest = true; // Destination must not exist in source columns
|
36656
|
+
}
|
36657
|
+
}
|
36658
|
+
}
|
36659
|
+
|
36660
|
+
var destIdx;
|
36661
|
+
srcLen = srcIds.length;
|
36662
|
+
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
36663
|
+
destIdx = this.getColumnIndex(destId);
|
36664
|
+
if(destIdx >= 0) {
|
36665
|
+
while(++destIdx < colCount) {
|
36666
|
+
destId = colIds[destIdx];
|
36667
|
+
if(srcIds.indexOf(destId) < 0) {
|
36668
|
+
break;
|
36669
|
+
}
|
36670
|
+
}
|
36671
|
+
}
|
36672
|
+
if(destIdx < 0 || destIdx >= colCount) {
|
36673
|
+
destId = "";
|
36674
|
+
}
|
36675
|
+
}
|
36676
|
+
|
36677
|
+
var dirty = 0;
|
36678
|
+
for(i = srcLen; --i >= 0;) {
|
36679
|
+
srcId = srcIds[i]; // Only valid source columns are left at this point
|
36680
|
+
srcIdx = this.getColumnIndex(srcId);
|
36681
|
+
destIdx = this.getColumnIndex(destId);
|
36682
|
+
if(destIdx < 0) { // Insert to the back when id is not found
|
36683
|
+
destIdx = colCount;
|
36684
|
+
}
|
36685
|
+
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
36686
|
+
destId = srcId;
|
36687
|
+
}
|
36688
|
+
return dirty ? true : false;
|
36689
|
+
} else {
|
36690
|
+
return this.moveColumnById(colRefs[0], destId);
|
36691
|
+
}
|
36692
|
+
}
|
36693
|
+
|
36694
|
+
if(colRefs != null) {
|
36695
|
+
// colRefs will be a number or string
|
36696
|
+
return this.moveColumnById(colRefs, destId);
|
36697
|
+
}
|
36698
|
+
return false;
|
36699
|
+
};
|
36700
|
+
|
36524
36701
|
/** @public
|
36525
36702
|
* @ignore
|
36526
36703
|
* @return {!TrackLayout}
|
@@ -36572,9 +36749,14 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
36572
36749
|
var colId = jsonObj["id"];
|
36573
36750
|
if(colId && typeof colId === "string") {
|
36574
36751
|
colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
|
36752
|
+
colDef["userId"] = colId;
|
36753
|
+
}
|
36754
|
+
var field = jsonObj["field"];
|
36755
|
+
if(field && typeof field === "string") {
|
36756
|
+
colDef["field"] = field;
|
36575
36757
|
}
|
36576
36758
|
|
36577
|
-
var value = jsonObj["dataColumnName"];
|
36759
|
+
var value = jsonObj["dataColumnName"]; // Deprecated
|
36578
36760
|
if (value != null) {
|
36579
36761
|
colDef["dataColumnName"] = value;
|
36580
36762
|
}
|
@@ -38017,24 +38199,6 @@ Core.prototype.getRelativePosition = function (obj, context) {
|
|
38017
38199
|
return ret_obj;
|
38018
38200
|
};
|
38019
38201
|
|
38020
|
-
/** Find column index by column id or data column name
|
38021
|
-
* @public
|
38022
|
-
* @param {string} str Column id or data column name
|
38023
|
-
* @return {number} Return negative value if there is no match
|
38024
|
-
*/
|
38025
|
-
Core.prototype.getColumnIndex = function (str) {
|
38026
|
-
if(str) {
|
38027
|
-
var colCount = this.getColumnCount();
|
38028
|
-
for(var c = 0; c < colCount; ++c) {
|
38029
|
-
var colDef = this._getColumnDef(c);
|
38030
|
-
if(str === colDef["id"] || str === colDef["dataColumnName"]) {
|
38031
|
-
return c;
|
38032
|
-
}
|
38033
|
-
}
|
38034
|
-
}
|
38035
|
-
return -1;
|
38036
|
-
};
|
38037
|
-
|
38038
38202
|
/** @public
|
38039
38203
|
* @return {!ElementWrapper}
|
38040
38204
|
*/
|
@@ -38927,7 +39091,7 @@ Core.prototype.setColumnGrouping = function (groupDefs) {
|
|
38927
39091
|
Core.prototype.getColumnGroupParentId = function (colRef) {
|
38928
39092
|
if(this._groupDefs) {
|
38929
39093
|
var colId = (typeof colRef === "number") ? this.getColumnId(colRef) : colRef;
|
38930
|
-
return this.
|
39094
|
+
return this._groupDefs.getParentId(colId);
|
38931
39095
|
}
|
38932
39096
|
return "";
|
38933
39097
|
};
|
@@ -38938,7 +39102,7 @@ Core.prototype.getColumnGroupParentId = function (colRef) {
|
|
38938
39102
|
*/
|
38939
39103
|
Core.prototype.getColumnGroupChildIds = function (groupId) {
|
38940
39104
|
if(this._groupDefs) {
|
38941
|
-
var ary = this.
|
39105
|
+
var ary = this._groupDefs.getLeafDescendants(groupId);
|
38942
39106
|
if(ary && ary.length > 0) {
|
38943
39107
|
return ary;
|
38944
39108
|
}
|
@@ -39633,6 +39797,99 @@ Core.prototype.getColumnIds = function () {
|
|
39633
39797
|
return ary;
|
39634
39798
|
};
|
39635
39799
|
|
39800
|
+
/** @public
|
39801
|
+
* @param {number} colIndex
|
39802
|
+
* @param {string} field
|
39803
|
+
*/
|
39804
|
+
Core.prototype.setColumnField = function (colIndex, field) {
|
39805
|
+
this._getColumnDef(colIndex)["field"] = field || "";
|
39806
|
+
};
|
39807
|
+
/** @public
|
39808
|
+
* @param {number} colIndex
|
39809
|
+
* @return {string} Return empty string if the specified column does not exist
|
39810
|
+
*/
|
39811
|
+
Core.prototype.getColumnField = function (colIndex) {
|
39812
|
+
if(colIndex >= 0 && colIndex < this.getColumnCount()) {
|
39813
|
+
return this._getColumnDef(colIndex)["field"] || "";
|
39814
|
+
}
|
39815
|
+
return "";
|
39816
|
+
};
|
39817
|
+
/** @public
|
39818
|
+
* @return {!Array.<string>} Return all column ids from existing column
|
39819
|
+
*/
|
39820
|
+
Core.prototype.getColumnFields = function () {
|
39821
|
+
var colCount = this.getColumnCount();
|
39822
|
+
var ary = new Array(colCount);
|
39823
|
+
for(var c = 0; c < colCount; ++c) {
|
39824
|
+
ary[c] = this._getColumnDef(c)["field"] || "";
|
39825
|
+
}
|
39826
|
+
return ary;
|
39827
|
+
};
|
39828
|
+
|
39829
|
+
/** Get column index by column id or column field
|
39830
|
+
* @public
|
39831
|
+
* @param {string|number} colRef Column id or data column name
|
39832
|
+
* @return {number} Return negative value if there is no match
|
39833
|
+
*/
|
39834
|
+
Core.prototype.getColumnIndex = function (colRef) {
|
39835
|
+
if(typeof colRef === "number") {
|
39836
|
+
return colRef;
|
39837
|
+
} else if(colRef) {
|
39838
|
+
var str = colRef;
|
39839
|
+
var colCount = this.getColumnCount();
|
39840
|
+
for(var c = 0; c < colCount; ++c) {
|
39841
|
+
var colDef = this._getColumnDef(c);
|
39842
|
+
if(str === colDef["id"] || str === colDef["field"]) {
|
39843
|
+
return c;
|
39844
|
+
}
|
39845
|
+
}
|
39846
|
+
}
|
39847
|
+
return -1;
|
39848
|
+
};
|
39849
|
+
/** Any invalid column reference will be excluded from the output array
|
39850
|
+
* @public
|
39851
|
+
* @param {Array.<number|string>} colRefs
|
39852
|
+
* @return {!Array.<number>} Return negative value if there is no match
|
39853
|
+
*/
|
39854
|
+
Core.prototype.getColumnIndices = function (colRefs) {
|
39855
|
+
var ary = [];
|
39856
|
+
var colCount = this.getColumnCount();
|
39857
|
+
var inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
39858
|
+
var len = inputAry.length;
|
39859
|
+
// Verify user input
|
39860
|
+
for(var i = 0; i < len; ++i) {
|
39861
|
+
var colIndex = this.getColumnIndex(inputAry[i]);
|
39862
|
+
if(colIndex >= 0 && colIndex < colCount) {
|
39863
|
+
ary.push(colIndex); // WARNING: We have not check for duplication
|
39864
|
+
}
|
39865
|
+
}
|
39866
|
+
return ary;
|
39867
|
+
};
|
39868
|
+
|
39869
|
+
/** Get a map from column id and field to column index. This should be useful when finding multiple column indices.
|
39870
|
+
* @public
|
39871
|
+
* @return {!Object.<string, number>}
|
39872
|
+
*/
|
39873
|
+
Core.prototype.getColumnIndexMap = function () {
|
39874
|
+
var colCount = this.getColumnCount();
|
39875
|
+
var obj = {};
|
39876
|
+
var str = "";
|
39877
|
+
for(var c = 0; c < colCount; ++c) {
|
39878
|
+
var colDef = this._getColumnDef(c);
|
39879
|
+
|
39880
|
+
str = colDef["field"];
|
39881
|
+
if(str) {
|
39882
|
+
obj[str] = c;
|
39883
|
+
}
|
39884
|
+
|
39885
|
+
str = colDef["id"];
|
39886
|
+
if(str) {
|
39887
|
+
obj[str] = c;
|
39888
|
+
}
|
39889
|
+
}
|
39890
|
+
return obj;
|
39891
|
+
};
|
39892
|
+
|
39636
39893
|
|
39637
39894
|
/** @private */
|
39638
39895
|
Core.prototype._onWindowResize = function() {
|
@@ -42804,6 +43061,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
42804
43061
|
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
42805
43062
|
* @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
|
42806
43063
|
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
43064
|
+
* @property {boolean=} topSection=true If disabled, title section will not be rendered
|
42807
43065
|
*/
|
42808
43066
|
|
42809
43067
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -42947,26 +43205,6 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
42947
43205
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
42948
43206
|
};
|
42949
43207
|
|
42950
|
-
/** @private
|
42951
|
-
* @param {ColumnDefinition} colDef
|
42952
|
-
* @return {string}
|
42953
|
-
*/
|
42954
|
-
var _getId = function(colDef) {
|
42955
|
-
if(colDef) {
|
42956
|
-
return colDef.getId();
|
42957
|
-
}
|
42958
|
-
return "";
|
42959
|
-
};
|
42960
|
-
/** @private
|
42961
|
-
* @param {ColumnDefinition} colDef
|
42962
|
-
* @return {string}
|
42963
|
-
*/
|
42964
|
-
var _getField = function(colDef) {
|
42965
|
-
if(colDef) {
|
42966
|
-
return colDef.getField();
|
42967
|
-
}
|
42968
|
-
return "";
|
42969
|
-
};
|
42970
43208
|
/** @private
|
42971
43209
|
* @param {ColumnDefinition} colDef
|
42972
43210
|
* @return {string}
|
@@ -43055,6 +43293,9 @@ var Grid = function(placeholder, config) {
|
|
43055
43293
|
if(config["SortableTitle"]) { // Exception for built-in plugin
|
43056
43294
|
t._stp = config["SortableTitle"];
|
43057
43295
|
}
|
43296
|
+
if(config["topSection"] === false) {
|
43297
|
+
t._topSection = false;
|
43298
|
+
}
|
43058
43299
|
}
|
43059
43300
|
if(!t._sharedDataSource) {
|
43060
43301
|
t._dc = new DataCache_DataCache();
|
@@ -43269,7 +43510,10 @@ Grid.prototype._fieldCaching = false;
|
|
43269
43510
|
* @private
|
43270
43511
|
*/
|
43271
43512
|
Grid.prototype._childDataField = "";
|
43272
|
-
|
43513
|
+
/** @type {boolean}
|
43514
|
+
* @private
|
43515
|
+
*/
|
43516
|
+
Grid.prototype._topSection = true;
|
43273
43517
|
|
43274
43518
|
/** @public
|
43275
43519
|
*/
|
@@ -43384,7 +43628,11 @@ Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
|
43384
43628
|
*/
|
43385
43629
|
Grid.prototype._addGridSections = function () {
|
43386
43630
|
var title = this._grid.addSection("title");
|
43387
|
-
|
43631
|
+
if(this._topSection == false){
|
43632
|
+
title.setRowCount(0);
|
43633
|
+
} else {
|
43634
|
+
title.setRowCount(1);
|
43635
|
+
}
|
43388
43636
|
this._grid.addSection("content");
|
43389
43637
|
|
43390
43638
|
var titleSettings = this._grid.getSectionSettings("title");
|
@@ -44336,10 +44584,13 @@ Grid.prototype.setFields = Grid.prototype.setColumns;
|
|
44336
44584
|
* @param {Object} e
|
44337
44585
|
*/
|
44338
44586
|
Grid.prototype._onColumnAdded = function(e) {
|
44339
|
-
var colDef = e.context[COL_DEF];
|
44587
|
+
var colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
|
44340
44588
|
delete e.context[COL_DEF];
|
44341
44589
|
var idx = e.colIndex;
|
44342
44590
|
|
44591
|
+
var coreColDef = this._grid._getColumnDef(idx);
|
44592
|
+
colDef._setCoreColumnDef(coreColDef); // For column id and field
|
44593
|
+
|
44343
44594
|
var colData = this._grid.getColumnData(idx);
|
44344
44595
|
if(!colData) { // Save column inside grid
|
44345
44596
|
colData = this._grid.setColumnData(idx, {});
|
@@ -44566,102 +44817,16 @@ Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
|
44566
44817
|
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
44567
44818
|
*/
|
44568
44819
|
Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
44569
|
-
|
44570
|
-
var srcIndex = this.getColumnIndex(srcCol);
|
44571
|
-
if(srcIndex < 0 || srcIndex >= colCount) {
|
44572
|
-
return false;
|
44573
|
-
}
|
44574
|
-
var destIndex = this.getColumnIndex(destCol);
|
44575
|
-
if(destIndex < 0) {
|
44576
|
-
destIndex = colCount;
|
44577
|
-
}
|
44578
|
-
return this._moveColumnByIndex(srcIndex, destIndex);
|
44579
|
-
};
|
44580
|
-
/** Move column without verification for better performance
|
44581
|
-
* @private
|
44582
|
-
* @param {number} srcIndex Column index
|
44583
|
-
* @param {number} destIndex Column index of the destination
|
44584
|
-
* @return {boolean} Return true if there is any change, and false otherwise
|
44585
|
-
*/
|
44586
|
-
Grid.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
44587
|
-
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
44588
|
-
--destIndex;
|
44589
|
-
}
|
44590
|
-
if(srcIndex === destIndex) {
|
44591
|
-
return false;
|
44592
|
-
}
|
44593
|
-
return this.moveColumn(srcIndex, destIndex);
|
44820
|
+
return this._grid.moveColumnById(srcCol, destCol);
|
44594
44821
|
};
|
44595
44822
|
|
44596
44823
|
/** @public
|
44597
44824
|
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
44598
|
-
* @param {number|string} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
44825
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
44599
44826
|
* @return {boolean} Return true if there is any change, and false otherwise
|
44600
44827
|
*/
|
44601
44828
|
Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
44602
|
-
|
44603
|
-
|
44604
|
-
if(Array.isArray(colRefs)) {
|
44605
|
-
var srcLen = colRefs.length;
|
44606
|
-
if(srcLen > 1) {
|
44607
|
-
var colIds = this.getColumnIds();
|
44608
|
-
var colCount = colIds.length;
|
44609
|
-
var srcIds = [];
|
44610
|
-
var invalidDest = false;
|
44611
|
-
var i, srcId, srcIdx;
|
44612
|
-
for(i = 0; i < srcLen; ++i) {
|
44613
|
-
var colRef = colRefs[i];
|
44614
|
-
if(typeof colRef === "number") {
|
44615
|
-
srcIdx = colRef;
|
44616
|
-
srcId = colIds[colRef] || "";
|
44617
|
-
} else {
|
44618
|
-
srcId = colRef;
|
44619
|
-
srcIdx = colIds.indexOf(srcId);
|
44620
|
-
}
|
44621
|
-
if(srcId && srcIdx >= 0) {
|
44622
|
-
srcIds.push(srcId);
|
44623
|
-
if(destId === srcId) {
|
44624
|
-
invalidDest = true; // Destination must not exist in source columns
|
44625
|
-
}
|
44626
|
-
}
|
44627
|
-
}
|
44628
|
-
|
44629
|
-
var destIdx;
|
44630
|
-
srcLen = srcIds.length;
|
44631
|
-
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
44632
|
-
destIdx = this.getColumnIndex(destId);
|
44633
|
-
if(destIdx >= 0) {
|
44634
|
-
while(++destIdx < colCount) {
|
44635
|
-
destId = colIds[destIdx];
|
44636
|
-
if(srcIds.indexOf(destId) < 0) {
|
44637
|
-
break;
|
44638
|
-
}
|
44639
|
-
}
|
44640
|
-
}
|
44641
|
-
if(destIdx < 0 || destIdx >= colCount) {
|
44642
|
-
destId = "";
|
44643
|
-
}
|
44644
|
-
}
|
44645
|
-
|
44646
|
-
var dirty = 0;
|
44647
|
-
for(i = srcLen; --i >= 0;) {
|
44648
|
-
srcId = srcIds[i]; // Only valid source columns are left at this point
|
44649
|
-
srcIdx = this.getColumnIndex(srcId);
|
44650
|
-
destIdx = this.getColumnIndex(destId);
|
44651
|
-
if(destIdx < 0) { // Insert to the back when id is not found
|
44652
|
-
destIdx = colCount;
|
44653
|
-
}
|
44654
|
-
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
44655
|
-
destId = srcId;
|
44656
|
-
}
|
44657
|
-
return dirty ? true : false;
|
44658
|
-
} else {
|
44659
|
-
return this.moveColumnById(colRefs[0], destId);
|
44660
|
-
}
|
44661
|
-
}
|
44662
|
-
|
44663
|
-
// colRefs will be a number or string
|
44664
|
-
return this.moveColumnById(colRefs, destId);
|
44829
|
+
return this._grid.reorderColumns(colRefs, destCol);
|
44665
44830
|
};
|
44666
44831
|
|
44667
44832
|
/** The hidden column still occupies the same index.
|
@@ -45700,30 +45865,19 @@ Grid.prototype._getRowId = function(rowRef) {
|
|
45700
45865
|
* @return {number}
|
45701
45866
|
*/
|
45702
45867
|
Grid.prototype.getColumnIndex = function(colRef) {
|
45703
|
-
if(typeof colRef === "number") {
|
45704
|
-
return colRef;
|
45705
|
-
}
|
45706
|
-
|
45707
45868
|
if(colRef) {
|
45708
45869
|
var colCount = this.getColumnCount();
|
45709
|
-
var i, colDef;
|
45710
45870
|
if(colRef instanceof ColumnDefinition) {
|
45711
|
-
for(i = 0; i < colCount; ++i) {
|
45712
|
-
colDef = this.getColumnDefinition(i);
|
45871
|
+
for(var i = 0; i < colCount; ++i) {
|
45872
|
+
var colDef = this.getColumnDefinition(i);
|
45713
45873
|
if(colDef === colRef) {
|
45714
45874
|
return i;
|
45715
45875
|
}
|
45716
45876
|
}
|
45717
|
-
|
45718
|
-
for(i = 0; i < colCount; ++i) {
|
45719
|
-
colDef = this.getColumnDefinition(i);
|
45720
|
-
if(_hasFieldOrId(colDef, colRef)) {
|
45721
|
-
return i; // Return the first found field
|
45722
|
-
}
|
45723
|
-
}
|
45877
|
+
return -1;
|
45724
45878
|
}
|
45725
45879
|
}
|
45726
|
-
return
|
45880
|
+
return this._grid.getColumnIndex(colRef);
|
45727
45881
|
};
|
45728
45882
|
/** Any invalid column reference will be excluded from the output array
|
45729
45883
|
* @public
|
@@ -45739,7 +45893,7 @@ Grid.prototype.getColumnIndices = function(colRefs) {
|
|
45739
45893
|
for(var i = 0; i < len; ++i) {
|
45740
45894
|
var colIndex = this.getColumnIndex(inputAry[i]);
|
45741
45895
|
if(colIndex >= 0 && colIndex < colCount) {
|
45742
|
-
ary.push(colIndex); // WARNING: We have not
|
45896
|
+
ary.push(colIndex); // WARNING: We have not checked for duplication
|
45743
45897
|
}
|
45744
45898
|
}
|
45745
45899
|
return ary;
|
@@ -45751,14 +45905,14 @@ Grid.prototype.getColumnIndices = function(colRefs) {
|
|
45751
45905
|
* @see {@link Grid#getColumnDefinition}
|
45752
45906
|
*/
|
45753
45907
|
Grid.prototype.getColumnId = function(colIndex) {
|
45754
|
-
return
|
45908
|
+
return this._grid.getColumnId(colIndex);
|
45755
45909
|
};
|
45756
45910
|
/** Get ids from each column definition.
|
45757
45911
|
* @public
|
45758
45912
|
* @return {!Array.<string>} New array is created
|
45759
45913
|
*/
|
45760
45914
|
Grid.prototype.getColumnIds = function() {
|
45761
|
-
return this.
|
45915
|
+
return this._grid.getColumnIds();
|
45762
45916
|
};
|
45763
45917
|
/** Return field defined in the column definition
|
45764
45918
|
* @public
|
@@ -45767,14 +45921,14 @@ Grid.prototype.getColumnIds = function() {
|
|
45767
45921
|
* @see {@link Grid#getColumnDefinition}
|
45768
45922
|
*/
|
45769
45923
|
Grid.prototype.getColumnField = function(colIndex) {
|
45770
|
-
return
|
45924
|
+
return this._grid.getColumnField(colIndex);
|
45771
45925
|
};
|
45772
45926
|
/** Get fields from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
45773
45927
|
* @public
|
45774
45928
|
* @return {!Array.<string>} New array is created
|
45775
45929
|
*/
|
45776
45930
|
Grid.prototype.getColumnFields = function() {
|
45777
|
-
return this.
|
45931
|
+
return this._grid.getColumnFields();
|
45778
45932
|
};
|
45779
45933
|
/** Get column name from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
45780
45934
|
* @public
|
@@ -46232,6 +46386,32 @@ Grid.prototype.setClassification = function(rowRef, fields) {
|
|
46232
46386
|
return false;
|
46233
46387
|
};
|
46234
46388
|
|
46389
|
+
/** Check element in the grid element
|
46390
|
+
* @public
|
46391
|
+
* @param {Element} elem
|
46392
|
+
* @return {boolean}=true if an element from the parameter is inside a grid element
|
46393
|
+
*/
|
46394
|
+
Grid.prototype.contains = function(elem) {
|
46395
|
+
if(elem) {
|
46396
|
+
// This will impact the contents within the rt-grid element, but not those outside of it, such as the wrapper elements atlas-blotter and ef-grid.
|
46397
|
+
return this._topNode.contains(elem);
|
46398
|
+
}
|
46399
|
+
return false;
|
46400
|
+
};
|
46401
|
+
|
46402
|
+
/** Check grid element is focused
|
46403
|
+
* @public
|
46404
|
+
* @return {boolean}
|
46405
|
+
*/
|
46406
|
+
Grid.prototype.isFocused = function() {
|
46407
|
+
var activeElement = document.activeElement;
|
46408
|
+
if(!activeElement || !activeElement.shadowRoot) {
|
46409
|
+
// active element is not in the shadow DOM. try using contains method to check
|
46410
|
+
return this.contains(activeElement);
|
46411
|
+
}
|
46412
|
+
// For wrapper scenarios, such as atlas-blotter or efx-grid
|
46413
|
+
return activeElement.shadowRoot === this._topNode.parentNode;
|
46414
|
+
};
|
46235
46415
|
/** @description Focus grid element without moving window scrollbar
|
46236
46416
|
* @public
|
46237
46417
|
*/
|