@refinitiv-ui/efx-grid 6.0.24 → 6.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/dist/core.js +1330 -144
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +11 -0
- package/lib/core/es6/grid/Core.js +81 -10
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +707 -51
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/FieldDefinition.js +13 -2
- package/lib/rt-grid/es6/Grid.js +75 -38
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +314 -566
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -3
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +45 -53
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +21 -9
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +1 -1
- package/lib/tr-grid-util/es6/GridPlugin.js +13 -15
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +58 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.js +538 -0
- package/lib/tr-grid-util/es6/Popup.js +1 -1
- package/lib/tr-grid-util/es6/index.d.ts +2 -0
- package/lib/tr-grid-util/es6/index.js +3 -0
- package/lib/types/es6/ColumnGrouping.d.ts +3 -2
- package/lib/types/es6/Core/grid/Core.d.ts +11 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -14343,6 +14343,17 @@ FieldDefinition.get = function(field) {
|
|
14343
14343
|
}
|
14344
14344
|
return null;
|
14345
14345
|
};
|
14346
|
+
|
14347
|
+
/** @public
|
14348
|
+
* @function
|
14349
|
+
* @param {string} field
|
14350
|
+
* @return {boolean}
|
14351
|
+
*/
|
14352
|
+
FieldDefinition.hasFieldInfo = function(field) {
|
14353
|
+
var val = FieldDefinition.get(field);
|
14354
|
+
return val && val.field; // Already preventing an error caused by accessing a property on a null value
|
14355
|
+
};
|
14356
|
+
|
14346
14357
|
/** @public
|
14347
14358
|
* @function
|
14348
14359
|
* @param {string} field
|
@@ -14505,8 +14516,8 @@ FieldDefinition.loadFieldInfo = function (field) {
|
|
14505
14516
|
defer.resolve(null);
|
14506
14517
|
}
|
14507
14518
|
// already have field definition then return
|
14508
|
-
else if (FieldDefinition.
|
14509
|
-
defer.resolve(FieldDefinition.
|
14519
|
+
else if (FieldDefinition.hasFieldInfo(field)) {
|
14520
|
+
defer.resolve(FieldDefinition.get(field));
|
14510
14521
|
}
|
14511
14522
|
// in debug using mock data instead
|
14512
14523
|
else if (synapse.debug) {
|
@@ -14765,7 +14776,7 @@ PredefinedFormula.remove = function(field) {
|
|
14765
14776
|
* @property {string=} headerAlignment="" Text alignment for column header. This will override `textAlign` option for column header.
|
14766
14777
|
* @property {string=} titleAlignment="" Alias to `headerAlignment`
|
14767
14778
|
* @property {boolean=} hidden=false
|
14768
|
-
* @property {string=} id
|
14779
|
+
* @property {string=} id A unique identifier for the column
|
14769
14780
|
* @property {boolean=} textSelect=false If enabled, user can select text in this column
|
14770
14781
|
* @property {boolean=} keepModel If enabled, initial column's options will be kept
|
14771
14782
|
* @property {boolean=} stationary=false If enabled, the column order cannot be changed (i.e., this column and any column to its left cannot be moved)
|
@@ -16353,6 +16364,546 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
|
|
16353
16364
|
|
16354
16365
|
/* harmony default export */ var js_SnapshotFiller = (SnapshotFiller);
|
16355
16366
|
|
16367
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/GroupDefinitions.js
|
16368
|
+
|
16369
|
+
|
16370
|
+
/** @constructor
|
16371
|
+
*/
|
16372
|
+
var GroupDefinitions = function () {
|
16373
|
+
this._groupMap = {};
|
16374
|
+
this._childToParent = {};
|
16375
|
+
};
|
16376
|
+
|
16377
|
+
/** @type {!Object.<string, Object>}
|
16378
|
+
* @description A map of group id to group defintion
|
16379
|
+
* @private
|
16380
|
+
*/
|
16381
|
+
GroupDefinitions.prototype._groupMap;
|
16382
|
+
/** @type {!Object.<string, string>}
|
16383
|
+
* @description A map of child id to parent id
|
16384
|
+
* @private
|
16385
|
+
*/
|
16386
|
+
GroupDefinitions.prototype._childToParent;
|
16387
|
+
|
16388
|
+
|
16389
|
+
/** @public
|
16390
|
+
* @function
|
16391
|
+
* @param {Object} groupDef
|
16392
|
+
* @return {string}
|
16393
|
+
*/
|
16394
|
+
GroupDefinitions.getGroupId = function(groupDef) {
|
16395
|
+
if(groupDef) {
|
16396
|
+
return groupDef.id || "";
|
16397
|
+
}
|
16398
|
+
return "";
|
16399
|
+
};
|
16400
|
+
/** @public
|
16401
|
+
* @param {Object.<string, Object>} groupMap
|
16402
|
+
* @param {Object} groupDef
|
16403
|
+
* @return {number} Return total number of parents. Return 0 if there is no parent.
|
16404
|
+
*/
|
16405
|
+
GroupDefinitions.calcTreeDepth = function (groupMap, groupDef) {
|
16406
|
+
var curDepth = -1;
|
16407
|
+
var curNode = groupDef;
|
16408
|
+
while(curNode) { // WARNING: infinite loop could occured, if parentId is cycle back to one of the child group
|
16409
|
+
if(++curDepth > 15) {
|
16410
|
+
console.log("WARNING: Infinite loop detected during column group creation");
|
16411
|
+
break;
|
16412
|
+
}
|
16413
|
+
var parentId = curNode.parentId;
|
16414
|
+
curNode = groupMap[parentId];
|
16415
|
+
}
|
16416
|
+
return curDepth;
|
16417
|
+
};
|
16418
|
+
/** @public
|
16419
|
+
* @param {Object.<string, Object>} groupMap
|
16420
|
+
* @param {string} groupId
|
16421
|
+
* @return {Array.<string>}
|
16422
|
+
*/
|
16423
|
+
GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
|
16424
|
+
var groupDef = groupMap[groupId];
|
16425
|
+
if(!groupDef) {
|
16426
|
+
return null;
|
16427
|
+
}
|
16428
|
+
|
16429
|
+
var leaves = [];
|
16430
|
+
var unvisitedGroups = [groupDef];
|
16431
|
+
var visitedCount = 0;
|
16432
|
+
var visitedMap = {};
|
16433
|
+
while(visitedCount < unvisitedGroups.length) {
|
16434
|
+
groupDef = unvisitedGroups[visitedCount++];
|
16435
|
+
visitedMap[groupDef.id] = true;
|
16436
|
+
var chdr = groupDef.children;
|
16437
|
+
var len = chdr.length;
|
16438
|
+
for(var i = 0; i < len; ++i) {
|
16439
|
+
var childId = chdr[i];
|
16440
|
+
groupDef = groupMap[childId];
|
16441
|
+
if(groupDef) {
|
16442
|
+
if(!visitedMap[groupDef.id]) { // Prevent infinite loop
|
16443
|
+
unvisitedGroups.push(groupDef);
|
16444
|
+
}
|
16445
|
+
} else {
|
16446
|
+
leaves.push(childId);
|
16447
|
+
}
|
16448
|
+
}
|
16449
|
+
}
|
16450
|
+
return leaves;
|
16451
|
+
};
|
16452
|
+
|
16453
|
+
|
16454
|
+
/** @private
|
16455
|
+
* @function
|
16456
|
+
* @param {Object} obj
|
16457
|
+
* @return {Object}
|
16458
|
+
*/
|
16459
|
+
GroupDefinitions._cloneObject = function(obj) {
|
16460
|
+
var newObj = Object(Util["b" /* cloneObject */])(obj);
|
16461
|
+
if(Array.isArray(newObj.children)) {
|
16462
|
+
newObj.children = newObj.children;
|
16463
|
+
} else {
|
16464
|
+
newObj.children = [];
|
16465
|
+
}
|
16466
|
+
return newObj;
|
16467
|
+
};
|
16468
|
+
/** @private
|
16469
|
+
* @param {Object} groupMap
|
16470
|
+
* @return {!Object}
|
16471
|
+
*/
|
16472
|
+
GroupDefinitions._cloneGroupMap = function (groupMap) {
|
16473
|
+
var outMap = {};
|
16474
|
+
for(var groupId in groupMap) {
|
16475
|
+
var groupDef = groupMap[groupId];
|
16476
|
+
var obj = GroupDefinitions._cloneObject(groupDef);
|
16477
|
+
obj.children = groupDef.children.slice();
|
16478
|
+
outMap[groupId] = obj;
|
16479
|
+
}
|
16480
|
+
return outMap;
|
16481
|
+
};
|
16482
|
+
|
16483
|
+
/** @private
|
16484
|
+
* @function
|
16485
|
+
* @param {Array.<string>|Object} obj
|
16486
|
+
* @param {string=} groupId
|
16487
|
+
* @return {Object}
|
16488
|
+
*/
|
16489
|
+
GroupDefinitions._toGroupDefinition = function(obj, groupId) {
|
16490
|
+
var groupDef = null;
|
16491
|
+
if(obj) {
|
16492
|
+
if(Array.isArray(obj)) {
|
16493
|
+
groupDef = {
|
16494
|
+
children: obj
|
16495
|
+
};
|
16496
|
+
} else {
|
16497
|
+
groupDef = GroupDefinitions._cloneObject(obj);
|
16498
|
+
}
|
16499
|
+
if(groupId) {
|
16500
|
+
if(!groupDef.id) {
|
16501
|
+
groupDef.name = groupId;
|
16502
|
+
}
|
16503
|
+
groupDef.id = groupId;
|
16504
|
+
}
|
16505
|
+
}
|
16506
|
+
return groupDef;
|
16507
|
+
};
|
16508
|
+
|
16509
|
+
/** @public
|
16510
|
+
* @return {string}
|
16511
|
+
*/
|
16512
|
+
GroupDefinitions.prototype.toString = function() {
|
16513
|
+
var groupMap = this._groupMap;
|
16514
|
+
var lines = [];
|
16515
|
+
lines.push("=== groupDefs ===");
|
16516
|
+
for(var key in groupMap) {
|
16517
|
+
var group = groupMap[key];
|
16518
|
+
lines.push(key + ": " + JSON.stringify(group, ["id", "parentId", "children"]));
|
16519
|
+
}
|
16520
|
+
|
16521
|
+
lines.push("=== childToParent ===");
|
16522
|
+
lines.push(JSON.stringify(this._childToParent, null, 2));
|
16523
|
+
lines.push("");
|
16524
|
+
|
16525
|
+
return lines.join("\n");
|
16526
|
+
};
|
16527
|
+
|
16528
|
+
/** Get group definition object. This method can be used to check whether the given id is a group id or not (i.e., isGroupId).
|
16529
|
+
* @public
|
16530
|
+
* @param {string} groupId
|
16531
|
+
* @return {Object}
|
16532
|
+
*/
|
16533
|
+
GroupDefinitions.prototype.getGroup = function (groupId) {
|
16534
|
+
if(groupId) {
|
16535
|
+
return this._groupMap[groupId] || null;
|
16536
|
+
}
|
16537
|
+
return null;
|
16538
|
+
};
|
16539
|
+
/** @public
|
16540
|
+
* @function
|
16541
|
+
* @param {string} groupId
|
16542
|
+
* @return {Object}
|
16543
|
+
*/
|
16544
|
+
GroupDefinitions.prototype.getDefinition = GroupDefinitions.prototype.getGroup;
|
16545
|
+
/** Get array of all existing group definitions
|
16546
|
+
* @public
|
16547
|
+
* @return {!Array.<Object>}
|
16548
|
+
*/
|
16549
|
+
GroupDefinitions.prototype.getGroups = function () {
|
16550
|
+
var groupDefs = [];
|
16551
|
+
var groupMap = this._groupMap;
|
16552
|
+
for(var key in groupMap) {
|
16553
|
+
groupDefs.push(groupMap[key]);
|
16554
|
+
}
|
16555
|
+
return groupDefs;
|
16556
|
+
};
|
16557
|
+
/** @public
|
16558
|
+
* @return {!Object.<string, Object>}
|
16559
|
+
*/
|
16560
|
+
GroupDefinitions.prototype.getGroupMap = function () {
|
16561
|
+
return this._groupMap; // WARNING: Allow access to private member
|
16562
|
+
};
|
16563
|
+
/** @public
|
16564
|
+
* @return {!Object.<string, Object>}
|
16565
|
+
*/
|
16566
|
+
GroupDefinitions.prototype.cloneGroupMap = function () {
|
16567
|
+
return GroupDefinitions._cloneGroupMap(this._groupMap);
|
16568
|
+
};
|
16569
|
+
|
16570
|
+
/** Get immediate child ids of the specified group. The returned array can contain both child ids and group ids
|
16571
|
+
* @public
|
16572
|
+
* @param {string} groupId
|
16573
|
+
* @return {Array.<string>}
|
16574
|
+
*/
|
16575
|
+
GroupDefinitions.prototype.getGroupChildren = function (groupId) {
|
16576
|
+
var groupDef = this._groupMap[groupId];
|
16577
|
+
return groupDef ? groupDef.children : null;
|
16578
|
+
};
|
16579
|
+
/** Get all non-group descendants of the given group id.
|
16580
|
+
* @public
|
16581
|
+
* @param {string} groupId
|
16582
|
+
* @return {Array.<string>}
|
16583
|
+
*/
|
16584
|
+
GroupDefinitions.prototype.getLeafDescendants = function (groupId) {
|
16585
|
+
return GroupDefinitions.getLeafDescendants(this._groupMap, groupId);
|
16586
|
+
};
|
16587
|
+
/** @public
|
16588
|
+
* @param {string} groupId
|
16589
|
+
* @return {number} Return -1 if the given groupDef is null. Return 0 if there is no parent. Return 1 or more if it has a parent
|
16590
|
+
*/
|
16591
|
+
GroupDefinitions.prototype.getGroupLevel = function (groupId) {
|
16592
|
+
return GroupDefinitions.calcTreeDepth(this._groupMap, this._groupMap[groupId]);
|
16593
|
+
};
|
16594
|
+
/** @public
|
16595
|
+
* @param {string} groupId
|
16596
|
+
* @return {Object}
|
16597
|
+
*/
|
16598
|
+
GroupDefinitions.prototype.getRootGroup = function (groupId) {
|
16599
|
+
if (!groupId) {
|
16600
|
+
return null;
|
16601
|
+
}
|
16602
|
+
var groupMap = this._groupMap;
|
16603
|
+
var groupDef = groupMap[groupId] || null;
|
16604
|
+
// TODO: Support column id
|
16605
|
+
if(groupDef) {
|
16606
|
+
while (groupDef.parentId) {
|
16607
|
+
var parentDef = groupMap[groupDef.parentId];
|
16608
|
+
if(parentDef) {
|
16609
|
+
groupDef = parentDef;
|
16610
|
+
} else {
|
16611
|
+
break;
|
16612
|
+
}
|
16613
|
+
}
|
16614
|
+
}
|
16615
|
+
return groupDef;
|
16616
|
+
};
|
16617
|
+
/** @public
|
16618
|
+
* @param {string} childId
|
16619
|
+
* @return {Object}
|
16620
|
+
*/
|
16621
|
+
GroupDefinitions.prototype.getParentGroup = function (childId) {
|
16622
|
+
return this.getGroup(this._childToParent[childId]);
|
16623
|
+
};
|
16624
|
+
/** @public
|
16625
|
+
* @param {string} childId
|
16626
|
+
* @return {Array.<string>}
|
16627
|
+
*/
|
16628
|
+
GroupDefinitions.prototype.getParentIds = function(childId) {
|
16629
|
+
if (childId && typeof childId === "string") {
|
16630
|
+
var groupId = this._childToParent[childId];
|
16631
|
+
if (groupId) {
|
16632
|
+
var groupIds = [groupId];
|
16633
|
+
var group = this._groupMap[groupId];
|
16634
|
+
while (group && group.parentId) {
|
16635
|
+
group = this._groupMap[group.parentId];
|
16636
|
+
if (group) {
|
16637
|
+
groupIds.push(group.id);
|
16638
|
+
}
|
16639
|
+
}
|
16640
|
+
return groupIds;
|
16641
|
+
}
|
16642
|
+
}
|
16643
|
+
return null;
|
16644
|
+
};
|
16645
|
+
/** @public
|
16646
|
+
* @param {string} childId
|
16647
|
+
* @param {number=} groupLevel
|
16648
|
+
* @return {string}
|
16649
|
+
*/
|
16650
|
+
GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
|
16651
|
+
var parentId = this._childToParent[childId];
|
16652
|
+
if(groupLevel != null) {
|
16653
|
+
var currentLevel = this.getGroupLevel(parentId);
|
16654
|
+
while(currentLevel > groupLevel && parentId){
|
16655
|
+
parentId = this._childToParent[parentId];
|
16656
|
+
currentLevel--;
|
16657
|
+
}
|
16658
|
+
}
|
16659
|
+
|
16660
|
+
return parentId || "";
|
16661
|
+
};
|
16662
|
+
|
16663
|
+
|
16664
|
+
/** Remove all existing group definitions and replace them with the given definitions.
|
16665
|
+
* @public
|
16666
|
+
* @param {Array.<Object>=} groupDefs Use null or empty array to remove all existing groups
|
16667
|
+
*/
|
16668
|
+
GroupDefinitions.prototype.setGroups = function (groupDefs) {
|
16669
|
+
// Clear existing group structure
|
16670
|
+
var groupMap = this._groupMap = {};
|
16671
|
+
var childToParent = this._childToParent = {};
|
16672
|
+
|
16673
|
+
// Create group map
|
16674
|
+
var i;
|
16675
|
+
var grpCount = groupDefs ? groupDefs.length : 0;
|
16676
|
+
var groupId = "";
|
16677
|
+
for (i = 0; i < grpCount; i++) {
|
16678
|
+
var groupDef = groupDefs[i];
|
16679
|
+
groupId = groupDef.id;
|
16680
|
+
if(groupId) {
|
16681
|
+
groupMap[groupId] = groupDef;
|
16682
|
+
}
|
16683
|
+
}
|
16684
|
+
|
16685
|
+
// Create child to parent map
|
16686
|
+
var groupIds = Object.keys(groupMap);
|
16687
|
+
grpCount = groupIds.length;
|
16688
|
+
for(i = 0; i < grpCount; ++i) {
|
16689
|
+
groupId = groupIds[i];
|
16690
|
+
var children = groupMap[groupId].children;
|
16691
|
+
var childCount = children.length;
|
16692
|
+
for (var j = 0; j < childCount; j++) {
|
16693
|
+
childToParent[children[j]] = groupId;
|
16694
|
+
}
|
16695
|
+
}
|
16696
|
+
|
16697
|
+
// Apply a parent id to group definition to make it easier to find depth
|
16698
|
+
for(i = 0; i < grpCount; ++i) {
|
16699
|
+
groupId = groupIds[i];
|
16700
|
+
var parentId = childToParent[groupId];
|
16701
|
+
if(parentId) {
|
16702
|
+
groupMap[groupId].parentId = parentId;
|
16703
|
+
}
|
16704
|
+
}
|
16705
|
+
};
|
16706
|
+
/** Add new group definition to existing group structure. Existing group with the same id will be replaced.
|
16707
|
+
* @public
|
16708
|
+
* @param {Object} groupDef Group definition object
|
16709
|
+
* @return {string} Return group ID
|
16710
|
+
*/
|
16711
|
+
GroupDefinitions.prototype.addGroup = function (groupDef) {
|
16712
|
+
var groupId = GroupDefinitions.getGroupId(groupDef);
|
16713
|
+
if(groupId) {
|
16714
|
+
return this.setGroup(groupId, groupDef);
|
16715
|
+
}
|
16716
|
+
return groupId;
|
16717
|
+
};
|
16718
|
+
/** @public
|
16719
|
+
* @param {string} groupId
|
16720
|
+
* @return {boolean}
|
16721
|
+
*/
|
16722
|
+
GroupDefinitions.prototype.removeGroup = function (groupId) {
|
16723
|
+
var curDef = this._groupMap[groupId];
|
16724
|
+
if(curDef) {
|
16725
|
+
this.removeAllChildren(groupId);
|
16726
|
+
this.removeGroupChild(groupId);
|
16727
|
+
delete this._groupMap[groupId];
|
16728
|
+
|
16729
|
+
return true;
|
16730
|
+
}
|
16731
|
+
return false;
|
16732
|
+
};
|
16733
|
+
/** Replace and update existing group definition. New group is added if the given id has no match. Existing group will be removed of no new definition is given.
|
16734
|
+
* @public
|
16735
|
+
* @param {string} groupId
|
16736
|
+
* @param {Array.<string>|Object=} groupDef
|
16737
|
+
* @return {string} Return group Id. Return empty string if nothing has been changed.
|
16738
|
+
*/
|
16739
|
+
GroupDefinitions.prototype.setGroup = function (groupId, groupDef) {
|
16740
|
+
if(!groupId) {
|
16741
|
+
return "";
|
16742
|
+
}
|
16743
|
+
|
16744
|
+
if(groupDef) {
|
16745
|
+
var newDef = GroupDefinitions._toGroupDefinition(groupDef, groupId);
|
16746
|
+
this._ungroupChildren(newDef.children);
|
16747
|
+
|
16748
|
+
var curDef = this._groupMap[groupId];
|
16749
|
+
if(curDef) { // Replace
|
16750
|
+
this.removeAllChildren(groupId);
|
16751
|
+
}
|
16752
|
+
var parentDef = this._childToParent[groupId];
|
16753
|
+
if(parentDef) {
|
16754
|
+
newDef.parentId = parentDef.id;
|
16755
|
+
}
|
16756
|
+
this._groupMap[groupId] = newDef;
|
16757
|
+
|
16758
|
+
var chdr = newDef.children;
|
16759
|
+
var len = chdr.length;
|
16760
|
+
for(var i = 0; i < len; ++i) {
|
16761
|
+
var childId = chdr[i];
|
16762
|
+
this._childToParent[childId] = groupId;
|
16763
|
+
var childDef = this._groupMap[childId];
|
16764
|
+
if(childDef) {
|
16765
|
+
childDef.parentId = groupId;
|
16766
|
+
}
|
16767
|
+
}
|
16768
|
+
} else { // Remove
|
16769
|
+
if(!this.removeGroup(groupId)) {
|
16770
|
+
return "";
|
16771
|
+
}
|
16772
|
+
}
|
16773
|
+
|
16774
|
+
return groupId;
|
16775
|
+
};
|
16776
|
+
|
16777
|
+
/** Remove each child from any group
|
16778
|
+
* @private
|
16779
|
+
* @param {Array.<string>} children
|
16780
|
+
*/
|
16781
|
+
GroupDefinitions.prototype._ungroupChildren = function(children) {
|
16782
|
+
if (Array.isArray(children)) {
|
16783
|
+
var len = children.length;
|
16784
|
+
for(var i = 0; i < len; ++i) {
|
16785
|
+
this.removeGroupChild(children[i]);
|
16786
|
+
}
|
16787
|
+
}
|
16788
|
+
};
|
16789
|
+
|
16790
|
+
|
16791
|
+
/** @public
|
16792
|
+
* @param {string} parentId Group id
|
16793
|
+
* @param {string} childId
|
16794
|
+
* @return {boolean}
|
16795
|
+
*/
|
16796
|
+
GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
|
16797
|
+
var groupDef = this._groupMap[parentId];
|
16798
|
+
|
16799
|
+
if(childId && groupDef) {
|
16800
|
+
var chdr = groupDef.children;
|
16801
|
+
if(chdr && chdr.indexOf(childId) < 0) {
|
16802
|
+
this.removeGroupChild(childId); // Remove previous parent
|
16803
|
+
// Add new child to group structures
|
16804
|
+
this._childToParent[childId] = parentId;
|
16805
|
+
var childDef = this._groupMap[childId];
|
16806
|
+
if(childDef) {
|
16807
|
+
childDef.parentId = parentId;
|
16808
|
+
}
|
16809
|
+
chdr.push(childId);
|
16810
|
+
return true;
|
16811
|
+
}
|
16812
|
+
}
|
16813
|
+
return false;
|
16814
|
+
};
|
16815
|
+
/** Remove the given child from its own parent (i.e., unset Parent of the given child).
|
16816
|
+
* @public
|
16817
|
+
* @param {string} childId
|
16818
|
+
* @return {boolean}
|
16819
|
+
*/
|
16820
|
+
GroupDefinitions.prototype.removeGroupChild = function (childId) {
|
16821
|
+
var parentId = this._childToParent[childId];
|
16822
|
+
if(!parentId) {
|
16823
|
+
return false;
|
16824
|
+
}
|
16825
|
+
this._childToParent[childId] = "";
|
16826
|
+
var childDef = this._groupMap[childId];
|
16827
|
+
if(childDef) {
|
16828
|
+
childDef.parentId = "";
|
16829
|
+
}
|
16830
|
+
var parentDef = this._groupMap[parentId];
|
16831
|
+
if(parentDef) {
|
16832
|
+
var chdr = parentDef.children;
|
16833
|
+
if(chdr.length) {
|
16834
|
+
var at = chdr.indexOf(childId);
|
16835
|
+
if (at >= 0) {
|
16836
|
+
chdr.splice(at, 1); // splice is slow
|
16837
|
+
}
|
16838
|
+
}
|
16839
|
+
}
|
16840
|
+
return true;
|
16841
|
+
};
|
16842
|
+
/** Remove all children from the specified group
|
16843
|
+
* @public
|
16844
|
+
* @param {string} groupId
|
16845
|
+
* @return {boolean}
|
16846
|
+
*/
|
16847
|
+
GroupDefinitions.prototype.removeAllChildren = function(groupId) {
|
16848
|
+
var grpDef = this._groupMap[groupId];
|
16849
|
+
if(grpDef) {
|
16850
|
+
var chdr = grpDef.children;
|
16851
|
+
var len = chdr.length;
|
16852
|
+
if(len) {
|
16853
|
+
grpDef.children = [];
|
16854
|
+
for(var i = 0; i < len; ++i) {
|
16855
|
+
var childId = chdr[i];
|
16856
|
+
if(this._childToParent[childId]) {
|
16857
|
+
this._childToParent[childId] = "";
|
16858
|
+
}
|
16859
|
+
var childDef = this._groupMap[childId];
|
16860
|
+
if(childDef) {
|
16861
|
+
childDef.parentId = "";
|
16862
|
+
}
|
16863
|
+
}
|
16864
|
+
return true;
|
16865
|
+
}
|
16866
|
+
}
|
16867
|
+
return false;
|
16868
|
+
};
|
16869
|
+
/** Replace and update existing group definition.
|
16870
|
+
* @public
|
16871
|
+
* @param {string} groupId
|
16872
|
+
* @param {Array.<string>} newChildList If null is given, all existing children in the group will be removed
|
16873
|
+
* @return {boolean}
|
16874
|
+
*/
|
16875
|
+
GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
|
16876
|
+
var groupDef = this._groupMap[groupId];
|
16877
|
+
if(groupDef) {
|
16878
|
+
if(Array.isArray(newChildList)) {
|
16879
|
+
var chdr = newChildList.slice();
|
16880
|
+
this._ungroupChildren(chdr);
|
16881
|
+
this.removeAllChildren(groupId);
|
16882
|
+
groupDef.children = chdr;
|
16883
|
+
|
16884
|
+
var parentId = groupDef.id;
|
16885
|
+
var len = chdr.length;
|
16886
|
+
for(var i = 0; i < len; ++i) {
|
16887
|
+
var childId = chdr[i];
|
16888
|
+
this._childToParent[childId] = parentId;
|
16889
|
+
var childDef = this._groupMap[childId];
|
16890
|
+
if(childDef) {
|
16891
|
+
childDef.parentId = parentId;
|
16892
|
+
}
|
16893
|
+
}
|
16894
|
+
|
16895
|
+
return true;
|
16896
|
+
} else if(!newChildList && groupDef.children.length) {
|
16897
|
+
this.removeAllChildren(groupId);
|
16898
|
+
return true;
|
16899
|
+
}
|
16900
|
+
}
|
16901
|
+
return false;
|
16902
|
+
};
|
16903
|
+
|
16904
|
+
/* harmony default export */ var es6_GroupDefinitions = (GroupDefinitions);
|
16905
|
+
|
16906
|
+
|
16356
16907
|
// CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/components/ElementWrapper.js
|
16357
16908
|
|
16358
16909
|
|
@@ -34184,6 +34735,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
34184
34735
|
|
34185
34736
|
// CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/Core.js
|
34186
34737
|
|
34738
|
+
// eslint-disable-line
|
34187
34739
|
|
34188
34740
|
// eslint-disable-line
|
34189
34741
|
|
@@ -34706,6 +35258,10 @@ Core.prototype._preserveGridSize = false;
|
|
34706
35258
|
* @private
|
34707
35259
|
*/
|
34708
35260
|
Core.prototype._rowHeightTimerId = 0;
|
35261
|
+
/** @type {GroupDefinitions}
|
35262
|
+
* @private
|
35263
|
+
*/
|
35264
|
+
Core.prototype._groupDefs = null;
|
34709
35265
|
//#region Public Methods
|
34710
35266
|
|
34711
35267
|
/**
|
@@ -34713,7 +35269,7 @@ Core.prototype._rowHeightTimerId = 0;
|
|
34713
35269
|
* @return {string}
|
34714
35270
|
*/
|
34715
35271
|
Core.getVersion = function () {
|
34716
|
-
return "5.1.
|
35272
|
+
return "5.1.33";
|
34717
35273
|
};
|
34718
35274
|
/** {@link ElementWrapper#dispose}
|
34719
35275
|
* @override
|
@@ -35841,7 +36397,7 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
35841
36397
|
vEnd = this._colVirtualizer.getLastIndexInView();
|
35842
36398
|
}
|
35843
36399
|
|
35844
|
-
var colId = this.
|
36400
|
+
var colId = this.getColumnId(fromCol);
|
35845
36401
|
this._layoutX.moveLane(fromCol, destCol);
|
35846
36402
|
var sectionCount = this._settings.length;
|
35847
36403
|
for (var i = 0; i < sectionCount; ++i) {
|
@@ -35961,6 +36517,11 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
35961
36517
|
// TODO: Load specific styles for each column type (e.g. "content", "title", "header")
|
35962
36518
|
|
35963
36519
|
var colDef = this._getColumnDef(index);
|
36520
|
+
var colId = jsonObj["id"];
|
36521
|
+
if(colId && typeof colId === "string") {
|
36522
|
+
colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
|
36523
|
+
}
|
36524
|
+
|
35964
36525
|
var value = jsonObj["dataColumnName"];
|
35965
36526
|
if (value != null) {
|
35966
36527
|
colDef["dataColumnName"] = value;
|
@@ -37404,14 +37965,19 @@ Core.prototype.getRelativePosition = function (obj, context) {
|
|
37404
37965
|
return ret_obj;
|
37405
37966
|
};
|
37406
37967
|
|
37407
|
-
/**
|
37408
|
-
* @
|
37409
|
-
* @
|
37968
|
+
/** Find column index by column id or data column name
|
37969
|
+
* @public
|
37970
|
+
* @param {string} str Column id or data column name
|
37971
|
+
* @return {number} Return negative value if there is no match
|
37410
37972
|
*/
|
37411
37973
|
Core.prototype.getColumnIndex = function (str) {
|
37412
|
-
|
37413
|
-
|
37414
|
-
|
37974
|
+
if(str) {
|
37975
|
+
var colCount = this.getColumnCount();
|
37976
|
+
for(var c = 0; c < colCount; ++c) {
|
37977
|
+
var colDef = this._getColumnDef(c);
|
37978
|
+
if(str === colDef["id"] || str === colDef["dataColumnName"]) {
|
37979
|
+
return c;
|
37980
|
+
}
|
37415
37981
|
}
|
37416
37982
|
}
|
37417
37983
|
return -1;
|
@@ -38296,6 +38862,37 @@ Core.prototype.normalizeConfig = function (configObj) {
|
|
38296
38862
|
|
38297
38863
|
return configObj;
|
38298
38864
|
};
|
38865
|
+
/** @public
|
38866
|
+
* @param {GroupDefinitions} groupDefs
|
38867
|
+
*/
|
38868
|
+
Core.prototype.setColumnGrouping = function (groupDefs) {
|
38869
|
+
this._groupDefs = groupDefs || null;
|
38870
|
+
};
|
38871
|
+
/** @public
|
38872
|
+
* @param {string|number} colRef
|
38873
|
+
* @return {string} Return group id of immediate group parent. Return empty string, if no parent is found.
|
38874
|
+
*/
|
38875
|
+
Core.prototype.getColumnGroupParentId = function (colRef) {
|
38876
|
+
if(this._groupDefs) {
|
38877
|
+
var colId = (typeof colRef === "number") ? this.getColumnId(colRef) : colRef;
|
38878
|
+
return this._groupDef.getParentId(colId);
|
38879
|
+
}
|
38880
|
+
return "";
|
38881
|
+
};
|
38882
|
+
|
38883
|
+
/** @public
|
38884
|
+
* @param {string} groupId
|
38885
|
+
* @return {Array.<string>} Return array of column id. Return null if the specified group has no child
|
38886
|
+
*/
|
38887
|
+
Core.prototype.getColumnGroupChildIds = function (groupId) {
|
38888
|
+
if(this._groupDefs) {
|
38889
|
+
var ary = this._groupDef.getLeafDescendants(colId);
|
38890
|
+
if(ary && ary.length > 0) {
|
38891
|
+
return ary;
|
38892
|
+
}
|
38893
|
+
}
|
38894
|
+
return null;
|
38895
|
+
};
|
38299
38896
|
//#endregion Public Methods
|
38300
38897
|
|
38301
38898
|
//#region Private Methods
|
@@ -38953,13 +39550,35 @@ Core.prototype._getNestedColumnDef = function (colIndex, firstLvl, secondLvl) {
|
|
38953
39550
|
}
|
38954
39551
|
return def;
|
38955
39552
|
};
|
39553
|
+
|
38956
39554
|
/** @public
|
39555
|
+
* @param {number} colIndex
|
39556
|
+
* @return {string} Return empty string if the specified column does not exist
|
39557
|
+
*/
|
39558
|
+
Core.prototype.getColumnId = function (colIndex) {
|
39559
|
+
if(colIndex >= 0 && colIndex < this.getColumnCount()) {
|
39560
|
+
return this._getColumnDef(colIndex)["id"] || "";
|
39561
|
+
}
|
39562
|
+
return "";
|
39563
|
+
};
|
39564
|
+
/** @deprecated
|
39565
|
+
* @public
|
39566
|
+
* @function
|
38957
39567
|
* @ignore
|
38958
39568
|
* @param {number} colIndex
|
38959
39569
|
* @return {string}
|
38960
39570
|
*/
|
38961
|
-
Core.prototype._getColumnId =
|
38962
|
-
|
39571
|
+
Core.prototype._getColumnId = Core.prototype.getColumnId;
|
39572
|
+
/** @public
|
39573
|
+
* @return {!Array.<string>} Return all column ids from existing column
|
39574
|
+
*/
|
39575
|
+
Core.prototype.getColumnIds = function () {
|
39576
|
+
var colCount = this.getColumnCount();
|
39577
|
+
var ary = new Array(colCount);
|
39578
|
+
for(var c = 0; c < colCount; ++c) {
|
39579
|
+
ary[c] = this._getColumnDef(c)["id"] || "";
|
39580
|
+
}
|
39581
|
+
return ary;
|
38963
39582
|
};
|
38964
39583
|
|
38965
39584
|
|
@@ -43312,7 +43931,9 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
43312
43931
|
// JET
|
43313
43932
|
if (this._subs) {
|
43314
43933
|
var realtimeFields = addedFields.filter(js_FieldDefinition.isRealTimeField);
|
43315
|
-
|
43934
|
+
if(realtimeFields.length > 0) {
|
43935
|
+
this._subs["addFields"](realtimeFields);
|
43936
|
+
}
|
43316
43937
|
}
|
43317
43938
|
|
43318
43939
|
this._dispatch(e.type, e);
|
@@ -43604,19 +44225,31 @@ Grid.prototype._setScrollbarParent = function (host) {
|
|
43604
44225
|
/**
|
43605
44226
|
* @private
|
43606
44227
|
* @param {string} field
|
43607
|
-
* @param {boolean} isRealTime
|
43608
44228
|
* @returns {boolean}
|
43609
44229
|
*/
|
43610
|
-
Grid.prototype._shouldLoadFieldInfo = function (field
|
43611
|
-
|
43612
|
-
|
43613
|
-
|
43614
|
-
|
43615
|
-
(this._RTK || window["JET"]) // have rtk instance or window jet sub
|
43616
|
-
) {
|
43617
|
-
return true;
|
44230
|
+
Grid.prototype._shouldLoadFieldInfo = function (field) {
|
44231
|
+
|
44232
|
+
var val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
|
44233
|
+
if(!val) {
|
44234
|
+
return false;
|
43618
44235
|
}
|
43619
|
-
|
44236
|
+
|
44237
|
+
// WARNING: If field caching is disabled, it shouldn't load field info
|
44238
|
+
if(!this._fieldCaching) {
|
44239
|
+
return false;
|
44240
|
+
}
|
44241
|
+
|
44242
|
+
val = js_FieldDefinition.hasFieldInfo(field);
|
44243
|
+
if(val) {
|
44244
|
+
return false;
|
44245
|
+
}
|
44246
|
+
|
44247
|
+
val = js_FieldDefinition.isAdc(field) || js_FieldDefinition.isRealTimeField(field);
|
44248
|
+
if(!val) {
|
44249
|
+
return false;
|
44250
|
+
}
|
44251
|
+
|
44252
|
+
return true;
|
43620
44253
|
};
|
43621
44254
|
/** Remove all existing columns and add new columns based on the given objects
|
43622
44255
|
* @public
|
@@ -43718,11 +44351,10 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
43718
44351
|
var fields = colDef.getAllFields();
|
43719
44352
|
var referrer = colDef.getId();
|
43720
44353
|
var len = fields.length;
|
43721
|
-
var field, dataType, prom,
|
44354
|
+
var field, dataType, prom, onLoaded;
|
43722
44355
|
for(i = 0; i < len; i++) {
|
43723
44356
|
field = fields[i];
|
43724
|
-
|
43725
|
-
if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
|
44357
|
+
if(this._shouldLoadFieldInfo(field)) {
|
43726
44358
|
if(field === colField) {
|
43727
44359
|
dataType = colDef.getDataType(); // Data-type from user's column options
|
43728
44360
|
} else { // Other required fields
|
@@ -43891,6 +44523,15 @@ Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
|
43891
44523
|
if(destIndex < 0) {
|
43892
44524
|
destIndex = colCount;
|
43893
44525
|
}
|
44526
|
+
return this._moveColumnByIndex(srcIndex, destIndex);
|
44527
|
+
};
|
44528
|
+
/** Move column without verification for better performance
|
44529
|
+
* @private
|
44530
|
+
* @param {number} srcIndex Column index
|
44531
|
+
* @param {number} destIndex Column index of the destination
|
44532
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
44533
|
+
*/
|
44534
|
+
Grid.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
43894
44535
|
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
43895
44536
|
--destIndex;
|
43896
44537
|
}
|
@@ -43912,23 +44553,31 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
|
43912
44553
|
var srcLen = colRefs.length;
|
43913
44554
|
if(srcLen > 1) {
|
43914
44555
|
var colIds = this.getColumnIds();
|
44556
|
+
var colCount = colIds.length;
|
43915
44557
|
var srcIds = [];
|
43916
44558
|
var invalidDest = false;
|
43917
|
-
var i;
|
44559
|
+
var i, srcId, srcIdx;
|
43918
44560
|
for(i = 0; i < srcLen; ++i) {
|
43919
44561
|
var colRef = colRefs[i];
|
43920
|
-
|
43921
|
-
|
44562
|
+
if(typeof colRef === "number") {
|
44563
|
+
srcIdx = colRef;
|
44564
|
+
srcId = colIds[colRef] || "";
|
44565
|
+
} else {
|
44566
|
+
srcId = colRef;
|
44567
|
+
srcIdx = colIds.indexOf(srcId);
|
44568
|
+
}
|
44569
|
+
if(srcId && srcIdx >= 0) {
|
43922
44570
|
srcIds.push(srcId);
|
43923
44571
|
if(destId === srcId) {
|
43924
44572
|
invalidDest = true; // Destination must not exist in source columns
|
43925
44573
|
}
|
43926
44574
|
}
|
43927
44575
|
}
|
44576
|
+
|
44577
|
+
var destIdx;
|
43928
44578
|
srcLen = srcIds.length;
|
43929
44579
|
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
43930
|
-
|
43931
|
-
var destIdx = this.getColumnIndex(destId);
|
44580
|
+
destIdx = this.getColumnIndex(destId);
|
43932
44581
|
if(destIdx >= 0) {
|
43933
44582
|
while(++destIdx < colCount) {
|
43934
44583
|
destId = colIds[destIdx];
|
@@ -43943,10 +44592,16 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
|
43943
44592
|
}
|
43944
44593
|
|
43945
44594
|
var dirty = 0;
|
43946
|
-
for(i =
|
43947
|
-
|
44595
|
+
for(i = srcLen; --i >= 0;) {
|
44596
|
+
srcId = srcIds[i]; // Only valid source columns are left at this point
|
44597
|
+
srcIdx = this.getColumnIndex(srcId);
|
44598
|
+
destIdx = this.getColumnIndex(destId);
|
44599
|
+
if(destIdx < 0) { // Insert to the back when id is not found
|
44600
|
+
destIdx = colCount;
|
44601
|
+
}
|
44602
|
+
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
44603
|
+
destId = srcId;
|
43948
44604
|
}
|
43949
|
-
// TODO: Handle the case where all columns stay in the same place
|
43950
44605
|
return dirty ? true : false;
|
43951
44606
|
} else {
|
43952
44607
|
return this.moveColumnById(colRefs[0], destId);
|
@@ -44023,11 +44678,10 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
|
|
44023
44678
|
|
44024
44679
|
var fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
|
44025
44680
|
var len = fields.length;
|
44026
|
-
var i, field, dataType, prom,
|
44681
|
+
var i, field, dataType, prom, onLoaded;
|
44027
44682
|
for(i = 0; i < len; i++) {
|
44028
44683
|
field = fields[i];
|
44029
|
-
|
44030
|
-
if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
|
44684
|
+
if(this._shouldLoadFieldInfo(field)) {
|
44031
44685
|
dataType = ColumnDefinition.getDataType(field);
|
44032
44686
|
prom = js_FieldDefinition.loadFieldInfo(field)
|
44033
44687
|
.catch(this._onFieldLoadedError);
|
@@ -44991,20 +45645,22 @@ Grid.prototype.getColumnIndex = function(colRef) {
|
|
44991
45645
|
return colRef;
|
44992
45646
|
}
|
44993
45647
|
|
44994
|
-
|
44995
|
-
|
44996
|
-
|
44997
|
-
|
44998
|
-
|
44999
|
-
|
45000
|
-
|
45648
|
+
if(colRef) {
|
45649
|
+
var colCount = this.getColumnCount();
|
45650
|
+
var i, colDef;
|
45651
|
+
if(colRef instanceof ColumnDefinition) {
|
45652
|
+
for(i = 0; i < colCount; ++i) {
|
45653
|
+
colDef = this.getColumnDefinition(i);
|
45654
|
+
if(colDef === colRef) {
|
45655
|
+
return i;
|
45656
|
+
}
|
45001
45657
|
}
|
45002
|
-
}
|
45003
|
-
|
45004
|
-
|
45005
|
-
|
45006
|
-
|
45007
|
-
|
45658
|
+
} else if(typeof colRef === "string") {
|
45659
|
+
for(i = 0; i < colCount; ++i) {
|
45660
|
+
colDef = this.getColumnDefinition(i);
|
45661
|
+
if(_hasFieldOrId(colDef, colRef)) {
|
45662
|
+
return i; // Return the first found field
|
45663
|
+
}
|
45008
45664
|
}
|
45009
45665
|
}
|
45010
45666
|
}
|