@refinitiv-ui/efx-grid 6.0.24 → 6.0.26

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.
Files changed (43) hide show
  1. package/lib/core/dist/core.css +1 -1
  2. package/lib/core/dist/core.js +1331 -145
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/grid/Core.d.ts +11 -0
  5. package/lib/core/es6/grid/Core.js +81 -10
  6. package/lib/core/es6/grid/util/ElementFrameWork.js +1 -1
  7. package/lib/core/es6/tr-grid-theme.js +1 -1
  8. package/lib/grid/index.js +1 -1
  9. package/lib/rt-grid/dist/rt-grid.js +768 -53
  10. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  11. package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
  12. package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
  13. package/lib/rt-grid/es6/FieldDefinition.js +13 -2
  14. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  15. package/lib/rt-grid/es6/Grid.js +83 -39
  16. package/lib/rt-grid/es6/RowDefinition.d.ts +14 -1
  17. package/lib/rt-grid/es6/RowDefinition.js +54 -2
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
  19. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +314 -566
  20. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +13 -11
  21. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +233 -81
  22. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -3
  23. package/lib/tr-grid-column-stack/es6/ColumnStack.js +50 -56
  24. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +21 -9
  25. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +18 -9
  26. package/lib/tr-grid-range-bar/es6/RangeBar.js +318 -139
  27. package/lib/tr-grid-util/es6/GridPlugin.d.ts +1 -1
  28. package/lib/tr-grid-util/es6/GridPlugin.js +13 -15
  29. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +58 -0
  30. package/lib/tr-grid-util/es6/GroupDefinitions.js +538 -0
  31. package/lib/tr-grid-util/es6/Popup.js +1 -1
  32. package/lib/tr-grid-util/es6/index.d.ts +2 -0
  33. package/lib/tr-grid-util/es6/index.js +3 -0
  34. package/lib/types/es6/ColumnGrouping.d.ts +3 -2
  35. package/lib/types/es6/ColumnSelection.d.ts +13 -11
  36. package/lib/types/es6/ColumnStack.d.ts +3 -3
  37. package/lib/types/es6/Core/grid/Core.d.ts +11 -0
  38. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
  39. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  40. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +14 -1
  41. package/lib/types/es6/index.d.ts +1 -1
  42. package/lib/versions.json +6 -6
  43. package/package.json +1 -1
@@ -13060,12 +13060,34 @@ DataTable._proto = DataTable.prototype;
13060
13060
  * @property {boolean=} hidden=true When this row is hidden
13061
13061
  */
13062
13062
 
13063
+ /** @typedef {Object} RowDefinition~RowTypes
13064
+ * @property {string} CONTENT="CONTENT"
13065
+ * @property {string} CHAIN="CHAIN"
13066
+ * @property {string} CONSTITUENT="CONSTITUENT"
13067
+ * @property {string} GROUP_HEADER="GROUP_HEADER"
13068
+ * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER"
13069
+ * @property {string} GROUP_MEMBER="GROUP_MEMBER"
13070
+ */
13071
+
13063
13072
  /** @type {string}
13064
13073
  * @public
13065
13074
  * @const
13066
13075
  */
13067
13076
  var ROW_DEF = "ROW_DEF";
13068
13077
 
13078
+ /** @type {RowDefinition~RowTypes}
13079
+ * @public
13080
+ * @const
13081
+ */
13082
+ var ROW_TYPES = {
13083
+ CONTENT: "CONTENT",
13084
+ CHAIN: "CHAIN",
13085
+ CONSTITUENT: "CONSTITUENT",
13086
+ GROUP_HEADER: "GROUP_HEADER",
13087
+ SUBGROUP_HEADER: "SUBGROUP_HEADER",
13088
+ GROUP_MEMBER: "GROUP_MEMBER"
13089
+ };
13090
+
13069
13091
  /** @constructor
13070
13092
  * @param {RowDefinition~Options=} rowOptions
13071
13093
  */
@@ -13438,7 +13460,37 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13438
13460
  RowDefinition.prototype.getDataId = function() {
13439
13461
  return this._dataId;
13440
13462
  };
13441
-
13463
+ /** @public
13464
+ * @return {string}
13465
+ */
13466
+ RowDefinition.prototype.getType = function() {
13467
+ if(this._isChain) {
13468
+ return ROW_TYPES.CHAIN;
13469
+ } else if(this._parent) {
13470
+ return ROW_TYPES.CONSTITUENT;
13471
+ } else {
13472
+ var dv = this._view;
13473
+ if(dv) {
13474
+ var rid = this.getRowId();
13475
+ var separator = dv.isSegmentSeparator(rid);
13476
+ var level = dv.getSegmentLevel(rid);
13477
+ if(separator) {
13478
+ if(level === 1) {
13479
+ return ROW_TYPES.GROUP_HEADER;
13480
+ } else {
13481
+ return ROW_TYPES.SUBGROUP_HEADER;
13482
+ }
13483
+ } else {
13484
+ if(dv.getSegmentParentRowId(rid)) {
13485
+ return ROW_TYPES.GROUP_MEMBER;
13486
+ }
13487
+ }
13488
+ } else {
13489
+ return "";
13490
+ }
13491
+ }
13492
+ return ROW_TYPES.CONTENT;
13493
+ };
13442
13494
  /** This method should always be called right after the initialization
13443
13495
  * @public
13444
13496
  * @param {DataCache} dataSource
@@ -14343,6 +14395,17 @@ FieldDefinition.get = function(field) {
14343
14395
  }
14344
14396
  return null;
14345
14397
  };
14398
+
14399
+ /** @public
14400
+ * @function
14401
+ * @param {string} field
14402
+ * @return {boolean}
14403
+ */
14404
+ FieldDefinition.hasFieldInfo = function(field) {
14405
+ var val = FieldDefinition.get(field);
14406
+ return val && val.field; // Already preventing an error caused by accessing a property on a null value
14407
+ };
14408
+
14346
14409
  /** @public
14347
14410
  * @function
14348
14411
  * @param {string} field
@@ -14505,8 +14568,8 @@ FieldDefinition.loadFieldInfo = function (field) {
14505
14568
  defer.resolve(null);
14506
14569
  }
14507
14570
  // already have field definition then return
14508
- else if (FieldDefinition._defs[field]) {
14509
- defer.resolve(FieldDefinition._defs[field]);
14571
+ else if (FieldDefinition.hasFieldInfo(field)) {
14572
+ defer.resolve(FieldDefinition.get(field));
14510
14573
  }
14511
14574
  // in debug using mock data instead
14512
14575
  else if (synapse.debug) {
@@ -14765,7 +14828,7 @@ PredefinedFormula.remove = function(field) {
14765
14828
  * @property {string=} headerAlignment="" Text alignment for column header. This will override `textAlign` option for column header.
14766
14829
  * @property {string=} titleAlignment="" Alias to `headerAlignment`
14767
14830
  * @property {boolean=} hidden=false
14768
- * @property {string=} id Id for unique identifier
14831
+ * @property {string=} id A unique identifier for the column
14769
14832
  * @property {boolean=} textSelect=false If enabled, user can select text in this column
14770
14833
  * @property {boolean=} keepModel If enabled, initial column's options will be kept
14771
14834
  * @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 +16416,546 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
16353
16416
 
16354
16417
  /* harmony default export */ var js_SnapshotFiller = (SnapshotFiller);
16355
16418
 
16419
+ // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/GroupDefinitions.js
16420
+
16421
+
16422
+ /** @constructor
16423
+ */
16424
+ var GroupDefinitions = function () {
16425
+ this._groupMap = {};
16426
+ this._childToParent = {};
16427
+ };
16428
+
16429
+ /** @type {!Object.<string, Object>}
16430
+ * @description A map of group id to group defintion
16431
+ * @private
16432
+ */
16433
+ GroupDefinitions.prototype._groupMap;
16434
+ /** @type {!Object.<string, string>}
16435
+ * @description A map of child id to parent id
16436
+ * @private
16437
+ */
16438
+ GroupDefinitions.prototype._childToParent;
16439
+
16440
+
16441
+ /** @public
16442
+ * @function
16443
+ * @param {Object} groupDef
16444
+ * @return {string}
16445
+ */
16446
+ GroupDefinitions.getGroupId = function(groupDef) {
16447
+ if(groupDef) {
16448
+ return groupDef.id || "";
16449
+ }
16450
+ return "";
16451
+ };
16452
+ /** @public
16453
+ * @param {Object.<string, Object>} groupMap
16454
+ * @param {Object} groupDef
16455
+ * @return {number} Return total number of parents. Return 0 if there is no parent.
16456
+ */
16457
+ GroupDefinitions.calcTreeDepth = function (groupMap, groupDef) {
16458
+ var curDepth = -1;
16459
+ var curNode = groupDef;
16460
+ while(curNode) { // WARNING: infinite loop could occured, if parentId is cycle back to one of the child group
16461
+ if(++curDepth > 15) {
16462
+ console.log("WARNING: Infinite loop detected during column group creation");
16463
+ break;
16464
+ }
16465
+ var parentId = curNode.parentId;
16466
+ curNode = groupMap[parentId];
16467
+ }
16468
+ return curDepth;
16469
+ };
16470
+ /** @public
16471
+ * @param {Object.<string, Object>} groupMap
16472
+ * @param {string} groupId
16473
+ * @return {Array.<string>}
16474
+ */
16475
+ GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
16476
+ var groupDef = groupMap[groupId];
16477
+ if(!groupDef) {
16478
+ return null;
16479
+ }
16480
+
16481
+ var leaves = [];
16482
+ var unvisitedGroups = [groupDef];
16483
+ var visitedCount = 0;
16484
+ var visitedMap = {};
16485
+ while(visitedCount < unvisitedGroups.length) {
16486
+ groupDef = unvisitedGroups[visitedCount++];
16487
+ visitedMap[groupDef.id] = true;
16488
+ var chdr = groupDef.children;
16489
+ var len = chdr.length;
16490
+ for(var i = 0; i < len; ++i) {
16491
+ var childId = chdr[i];
16492
+ groupDef = groupMap[childId];
16493
+ if(groupDef) {
16494
+ if(!visitedMap[groupDef.id]) { // Prevent infinite loop
16495
+ unvisitedGroups.push(groupDef);
16496
+ }
16497
+ } else {
16498
+ leaves.push(childId);
16499
+ }
16500
+ }
16501
+ }
16502
+ return leaves;
16503
+ };
16504
+
16505
+
16506
+ /** @private
16507
+ * @function
16508
+ * @param {Object} obj
16509
+ * @return {Object}
16510
+ */
16511
+ GroupDefinitions._cloneObject = function(obj) {
16512
+ var newObj = Object(Util["b" /* cloneObject */])(obj);
16513
+ if(Array.isArray(newObj.children)) {
16514
+ newObj.children = newObj.children;
16515
+ } else {
16516
+ newObj.children = [];
16517
+ }
16518
+ return newObj;
16519
+ };
16520
+ /** @private
16521
+ * @param {Object} groupMap
16522
+ * @return {!Object}
16523
+ */
16524
+ GroupDefinitions._cloneGroupMap = function (groupMap) {
16525
+ var outMap = {};
16526
+ for(var groupId in groupMap) {
16527
+ var groupDef = groupMap[groupId];
16528
+ var obj = GroupDefinitions._cloneObject(groupDef);
16529
+ obj.children = groupDef.children.slice();
16530
+ outMap[groupId] = obj;
16531
+ }
16532
+ return outMap;
16533
+ };
16534
+
16535
+ /** @private
16536
+ * @function
16537
+ * @param {Array.<string>|Object} obj
16538
+ * @param {string=} groupId
16539
+ * @return {Object}
16540
+ */
16541
+ GroupDefinitions._toGroupDefinition = function(obj, groupId) {
16542
+ var groupDef = null;
16543
+ if(obj) {
16544
+ if(Array.isArray(obj)) {
16545
+ groupDef = {
16546
+ children: obj
16547
+ };
16548
+ } else {
16549
+ groupDef = GroupDefinitions._cloneObject(obj);
16550
+ }
16551
+ if(groupId) {
16552
+ if(!groupDef.id) {
16553
+ groupDef.name = groupId;
16554
+ }
16555
+ groupDef.id = groupId;
16556
+ }
16557
+ }
16558
+ return groupDef;
16559
+ };
16560
+
16561
+ /** @public
16562
+ * @return {string}
16563
+ */
16564
+ GroupDefinitions.prototype.toString = function() {
16565
+ var groupMap = this._groupMap;
16566
+ var lines = [];
16567
+ lines.push("=== groupDefs ===");
16568
+ for(var key in groupMap) {
16569
+ var group = groupMap[key];
16570
+ lines.push(key + ": " + JSON.stringify(group, ["id", "parentId", "children"]));
16571
+ }
16572
+
16573
+ lines.push("=== childToParent ===");
16574
+ lines.push(JSON.stringify(this._childToParent, null, 2));
16575
+ lines.push("");
16576
+
16577
+ return lines.join("\n");
16578
+ };
16579
+
16580
+ /** Get group definition object. This method can be used to check whether the given id is a group id or not (i.e., isGroupId).
16581
+ * @public
16582
+ * @param {string} groupId
16583
+ * @return {Object}
16584
+ */
16585
+ GroupDefinitions.prototype.getGroup = function (groupId) {
16586
+ if(groupId) {
16587
+ return this._groupMap[groupId] || null;
16588
+ }
16589
+ return null;
16590
+ };
16591
+ /** @public
16592
+ * @function
16593
+ * @param {string} groupId
16594
+ * @return {Object}
16595
+ */
16596
+ GroupDefinitions.prototype.getDefinition = GroupDefinitions.prototype.getGroup;
16597
+ /** Get array of all existing group definitions
16598
+ * @public
16599
+ * @return {!Array.<Object>}
16600
+ */
16601
+ GroupDefinitions.prototype.getGroups = function () {
16602
+ var groupDefs = [];
16603
+ var groupMap = this._groupMap;
16604
+ for(var key in groupMap) {
16605
+ groupDefs.push(groupMap[key]);
16606
+ }
16607
+ return groupDefs;
16608
+ };
16609
+ /** @public
16610
+ * @return {!Object.<string, Object>}
16611
+ */
16612
+ GroupDefinitions.prototype.getGroupMap = function () {
16613
+ return this._groupMap; // WARNING: Allow access to private member
16614
+ };
16615
+ /** @public
16616
+ * @return {!Object.<string, Object>}
16617
+ */
16618
+ GroupDefinitions.prototype.cloneGroupMap = function () {
16619
+ return GroupDefinitions._cloneGroupMap(this._groupMap);
16620
+ };
16621
+
16622
+ /** Get immediate child ids of the specified group. The returned array can contain both child ids and group ids
16623
+ * @public
16624
+ * @param {string} groupId
16625
+ * @return {Array.<string>}
16626
+ */
16627
+ GroupDefinitions.prototype.getGroupChildren = function (groupId) {
16628
+ var groupDef = this._groupMap[groupId];
16629
+ return groupDef ? groupDef.children : null;
16630
+ };
16631
+ /** Get all non-group descendants of the given group id.
16632
+ * @public
16633
+ * @param {string} groupId
16634
+ * @return {Array.<string>}
16635
+ */
16636
+ GroupDefinitions.prototype.getLeafDescendants = function (groupId) {
16637
+ return GroupDefinitions.getLeafDescendants(this._groupMap, groupId);
16638
+ };
16639
+ /** @public
16640
+ * @param {string} groupId
16641
+ * @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
16642
+ */
16643
+ GroupDefinitions.prototype.getGroupLevel = function (groupId) {
16644
+ return GroupDefinitions.calcTreeDepth(this._groupMap, this._groupMap[groupId]);
16645
+ };
16646
+ /** @public
16647
+ * @param {string} groupId
16648
+ * @return {Object}
16649
+ */
16650
+ GroupDefinitions.prototype.getRootGroup = function (groupId) {
16651
+ if (!groupId) {
16652
+ return null;
16653
+ }
16654
+ var groupMap = this._groupMap;
16655
+ var groupDef = groupMap[groupId] || null;
16656
+ // TODO: Support column id
16657
+ if(groupDef) {
16658
+ while (groupDef.parentId) {
16659
+ var parentDef = groupMap[groupDef.parentId];
16660
+ if(parentDef) {
16661
+ groupDef = parentDef;
16662
+ } else {
16663
+ break;
16664
+ }
16665
+ }
16666
+ }
16667
+ return groupDef;
16668
+ };
16669
+ /** @public
16670
+ * @param {string} childId
16671
+ * @return {Object}
16672
+ */
16673
+ GroupDefinitions.prototype.getParentGroup = function (childId) {
16674
+ return this.getGroup(this._childToParent[childId]);
16675
+ };
16676
+ /** @public
16677
+ * @param {string} childId
16678
+ * @return {Array.<string>}
16679
+ */
16680
+ GroupDefinitions.prototype.getParentIds = function(childId) {
16681
+ if (childId && typeof childId === "string") {
16682
+ var groupId = this._childToParent[childId];
16683
+ if (groupId) {
16684
+ var groupIds = [groupId];
16685
+ var group = this._groupMap[groupId];
16686
+ while (group && group.parentId) {
16687
+ group = this._groupMap[group.parentId];
16688
+ if (group) {
16689
+ groupIds.push(group.id);
16690
+ }
16691
+ }
16692
+ return groupIds;
16693
+ }
16694
+ }
16695
+ return null;
16696
+ };
16697
+ /** @public
16698
+ * @param {string} childId
16699
+ * @param {number=} groupLevel
16700
+ * @return {string}
16701
+ */
16702
+ GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
16703
+ var parentId = this._childToParent[childId];
16704
+ if(groupLevel != null) {
16705
+ var currentLevel = this.getGroupLevel(parentId);
16706
+ while(currentLevel > groupLevel && parentId){
16707
+ parentId = this._childToParent[parentId];
16708
+ currentLevel--;
16709
+ }
16710
+ }
16711
+
16712
+ return parentId || "";
16713
+ };
16714
+
16715
+
16716
+ /** Remove all existing group definitions and replace them with the given definitions.
16717
+ * @public
16718
+ * @param {Array.<Object>=} groupDefs Use null or empty array to remove all existing groups
16719
+ */
16720
+ GroupDefinitions.prototype.setGroups = function (groupDefs) {
16721
+ // Clear existing group structure
16722
+ var groupMap = this._groupMap = {};
16723
+ var childToParent = this._childToParent = {};
16724
+
16725
+ // Create group map
16726
+ var i;
16727
+ var grpCount = groupDefs ? groupDefs.length : 0;
16728
+ var groupId = "";
16729
+ for (i = 0; i < grpCount; i++) {
16730
+ var groupDef = groupDefs[i];
16731
+ groupId = groupDef.id;
16732
+ if(groupId) {
16733
+ groupMap[groupId] = groupDef;
16734
+ }
16735
+ }
16736
+
16737
+ // Create child to parent map
16738
+ var groupIds = Object.keys(groupMap);
16739
+ grpCount = groupIds.length;
16740
+ for(i = 0; i < grpCount; ++i) {
16741
+ groupId = groupIds[i];
16742
+ var children = groupMap[groupId].children;
16743
+ var childCount = children.length;
16744
+ for (var j = 0; j < childCount; j++) {
16745
+ childToParent[children[j]] = groupId;
16746
+ }
16747
+ }
16748
+
16749
+ // Apply a parent id to group definition to make it easier to find depth
16750
+ for(i = 0; i < grpCount; ++i) {
16751
+ groupId = groupIds[i];
16752
+ var parentId = childToParent[groupId];
16753
+ if(parentId) {
16754
+ groupMap[groupId].parentId = parentId;
16755
+ }
16756
+ }
16757
+ };
16758
+ /** Add new group definition to existing group structure. Existing group with the same id will be replaced.
16759
+ * @public
16760
+ * @param {Object} groupDef Group definition object
16761
+ * @return {string} Return group ID
16762
+ */
16763
+ GroupDefinitions.prototype.addGroup = function (groupDef) {
16764
+ var groupId = GroupDefinitions.getGroupId(groupDef);
16765
+ if(groupId) {
16766
+ return this.setGroup(groupId, groupDef);
16767
+ }
16768
+ return groupId;
16769
+ };
16770
+ /** @public
16771
+ * @param {string} groupId
16772
+ * @return {boolean}
16773
+ */
16774
+ GroupDefinitions.prototype.removeGroup = function (groupId) {
16775
+ var curDef = this._groupMap[groupId];
16776
+ if(curDef) {
16777
+ this.removeAllChildren(groupId);
16778
+ this.removeGroupChild(groupId);
16779
+ delete this._groupMap[groupId];
16780
+
16781
+ return true;
16782
+ }
16783
+ return false;
16784
+ };
16785
+ /** 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.
16786
+ * @public
16787
+ * @param {string} groupId
16788
+ * @param {Array.<string>|Object=} groupDef
16789
+ * @return {string} Return group Id. Return empty string if nothing has been changed.
16790
+ */
16791
+ GroupDefinitions.prototype.setGroup = function (groupId, groupDef) {
16792
+ if(!groupId) {
16793
+ return "";
16794
+ }
16795
+
16796
+ if(groupDef) {
16797
+ var newDef = GroupDefinitions._toGroupDefinition(groupDef, groupId);
16798
+ this._ungroupChildren(newDef.children);
16799
+
16800
+ var curDef = this._groupMap[groupId];
16801
+ if(curDef) { // Replace
16802
+ this.removeAllChildren(groupId);
16803
+ }
16804
+ var parentDef = this._childToParent[groupId];
16805
+ if(parentDef) {
16806
+ newDef.parentId = parentDef.id;
16807
+ }
16808
+ this._groupMap[groupId] = newDef;
16809
+
16810
+ var chdr = newDef.children;
16811
+ var len = chdr.length;
16812
+ for(var i = 0; i < len; ++i) {
16813
+ var childId = chdr[i];
16814
+ this._childToParent[childId] = groupId;
16815
+ var childDef = this._groupMap[childId];
16816
+ if(childDef) {
16817
+ childDef.parentId = groupId;
16818
+ }
16819
+ }
16820
+ } else { // Remove
16821
+ if(!this.removeGroup(groupId)) {
16822
+ return "";
16823
+ }
16824
+ }
16825
+
16826
+ return groupId;
16827
+ };
16828
+
16829
+ /** Remove each child from any group
16830
+ * @private
16831
+ * @param {Array.<string>} children
16832
+ */
16833
+ GroupDefinitions.prototype._ungroupChildren = function(children) {
16834
+ if (Array.isArray(children)) {
16835
+ var len = children.length;
16836
+ for(var i = 0; i < len; ++i) {
16837
+ this.removeGroupChild(children[i]);
16838
+ }
16839
+ }
16840
+ };
16841
+
16842
+
16843
+ /** @public
16844
+ * @param {string} parentId Group id
16845
+ * @param {string} childId
16846
+ * @return {boolean}
16847
+ */
16848
+ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
16849
+ var groupDef = this._groupMap[parentId];
16850
+
16851
+ if(childId && groupDef) {
16852
+ var chdr = groupDef.children;
16853
+ if(chdr && chdr.indexOf(childId) < 0) {
16854
+ this.removeGroupChild(childId); // Remove previous parent
16855
+ // Add new child to group structures
16856
+ this._childToParent[childId] = parentId;
16857
+ var childDef = this._groupMap[childId];
16858
+ if(childDef) {
16859
+ childDef.parentId = parentId;
16860
+ }
16861
+ chdr.push(childId);
16862
+ return true;
16863
+ }
16864
+ }
16865
+ return false;
16866
+ };
16867
+ /** Remove the given child from its own parent (i.e., unset Parent of the given child).
16868
+ * @public
16869
+ * @param {string} childId
16870
+ * @return {boolean}
16871
+ */
16872
+ GroupDefinitions.prototype.removeGroupChild = function (childId) {
16873
+ var parentId = this._childToParent[childId];
16874
+ if(!parentId) {
16875
+ return false;
16876
+ }
16877
+ this._childToParent[childId] = "";
16878
+ var childDef = this._groupMap[childId];
16879
+ if(childDef) {
16880
+ childDef.parentId = "";
16881
+ }
16882
+ var parentDef = this._groupMap[parentId];
16883
+ if(parentDef) {
16884
+ var chdr = parentDef.children;
16885
+ if(chdr.length) {
16886
+ var at = chdr.indexOf(childId);
16887
+ if (at >= 0) {
16888
+ chdr.splice(at, 1); // splice is slow
16889
+ }
16890
+ }
16891
+ }
16892
+ return true;
16893
+ };
16894
+ /** Remove all children from the specified group
16895
+ * @public
16896
+ * @param {string} groupId
16897
+ * @return {boolean}
16898
+ */
16899
+ GroupDefinitions.prototype.removeAllChildren = function(groupId) {
16900
+ var grpDef = this._groupMap[groupId];
16901
+ if(grpDef) {
16902
+ var chdr = grpDef.children;
16903
+ var len = chdr.length;
16904
+ if(len) {
16905
+ grpDef.children = [];
16906
+ for(var i = 0; i < len; ++i) {
16907
+ var childId = chdr[i];
16908
+ if(this._childToParent[childId]) {
16909
+ this._childToParent[childId] = "";
16910
+ }
16911
+ var childDef = this._groupMap[childId];
16912
+ if(childDef) {
16913
+ childDef.parentId = "";
16914
+ }
16915
+ }
16916
+ return true;
16917
+ }
16918
+ }
16919
+ return false;
16920
+ };
16921
+ /** Replace and update existing group definition.
16922
+ * @public
16923
+ * @param {string} groupId
16924
+ * @param {Array.<string>} newChildList If null is given, all existing children in the group will be removed
16925
+ * @return {boolean}
16926
+ */
16927
+ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
16928
+ var groupDef = this._groupMap[groupId];
16929
+ if(groupDef) {
16930
+ if(Array.isArray(newChildList)) {
16931
+ var chdr = newChildList.slice();
16932
+ this._ungroupChildren(chdr);
16933
+ this.removeAllChildren(groupId);
16934
+ groupDef.children = chdr;
16935
+
16936
+ var parentId = groupDef.id;
16937
+ var len = chdr.length;
16938
+ for(var i = 0; i < len; ++i) {
16939
+ var childId = chdr[i];
16940
+ this._childToParent[childId] = parentId;
16941
+ var childDef = this._groupMap[childId];
16942
+ if(childDef) {
16943
+ childDef.parentId = parentId;
16944
+ }
16945
+ }
16946
+
16947
+ return true;
16948
+ } else if(!newChildList && groupDef.children.length) {
16949
+ this.removeAllChildren(groupId);
16950
+ return true;
16951
+ }
16952
+ }
16953
+ return false;
16954
+ };
16955
+
16956
+ /* harmony default export */ var es6_GroupDefinitions = (GroupDefinitions);
16957
+
16958
+
16356
16959
  // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/components/ElementWrapper.js
16357
16960
 
16358
16961
 
@@ -34184,6 +34787,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
34184
34787
 
34185
34788
  // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/Core.js
34186
34789
 
34790
+ // eslint-disable-line
34187
34791
 
34188
34792
  // eslint-disable-line
34189
34793
 
@@ -34706,6 +35310,10 @@ Core.prototype._preserveGridSize = false;
34706
35310
  * @private
34707
35311
  */
34708
35312
  Core.prototype._rowHeightTimerId = 0;
35313
+ /** @type {GroupDefinitions}
35314
+ * @private
35315
+ */
35316
+ Core.prototype._groupDefs = null;
34709
35317
  //#region Public Methods
34710
35318
 
34711
35319
  /**
@@ -34713,7 +35321,7 @@ Core.prototype._rowHeightTimerId = 0;
34713
35321
  * @return {string}
34714
35322
  */
34715
35323
  Core.getVersion = function () {
34716
- return "5.1.32";
35324
+ return "5.1.33";
34717
35325
  };
34718
35326
  /** {@link ElementWrapper#dispose}
34719
35327
  * @override
@@ -35841,7 +36449,7 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
35841
36449
  vEnd = this._colVirtualizer.getLastIndexInView();
35842
36450
  }
35843
36451
 
35844
- var colId = this._getColumnId(fromCol);
36452
+ var colId = this.getColumnId(fromCol);
35845
36453
  this._layoutX.moveLane(fromCol, destCol);
35846
36454
  var sectionCount = this._settings.length;
35847
36455
  for (var i = 0; i < sectionCount; ++i) {
@@ -35961,6 +36569,11 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
35961
36569
  // TODO: Load specific styles for each column type (e.g. "content", "title", "header")
35962
36570
 
35963
36571
  var colDef = this._getColumnDef(index);
36572
+ var colId = jsonObj["id"];
36573
+ if(colId && typeof colId === "string") {
36574
+ colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
36575
+ }
36576
+
35964
36577
  var value = jsonObj["dataColumnName"];
35965
36578
  if (value != null) {
35966
36579
  colDef["dataColumnName"] = value;
@@ -37404,14 +38017,19 @@ Core.prototype.getRelativePosition = function (obj, context) {
37404
38017
  return ret_obj;
37405
38018
  };
37406
38019
 
37407
- /** @public
37408
- * @param {string} str data column name
37409
- * @return {number} Return negative if the mouse is not hit
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
37410
38024
  */
37411
38025
  Core.prototype.getColumnIndex = function (str) {
37412
- for(var c = this.getColumnCount(); --c >= 0;) {
37413
- if(str === this.getDataColumnName(c)) {
37414
- return c;
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
+ }
37415
38033
  }
37416
38034
  }
37417
38035
  return -1;
@@ -38296,6 +38914,37 @@ Core.prototype.normalizeConfig = function (configObj) {
38296
38914
 
38297
38915
  return configObj;
38298
38916
  };
38917
+ /** @public
38918
+ * @param {GroupDefinitions} groupDefs
38919
+ */
38920
+ Core.prototype.setColumnGrouping = function (groupDefs) {
38921
+ this._groupDefs = groupDefs || null;
38922
+ };
38923
+ /** @public
38924
+ * @param {string|number} colRef
38925
+ * @return {string} Return group id of immediate group parent. Return empty string, if no parent is found.
38926
+ */
38927
+ Core.prototype.getColumnGroupParentId = function (colRef) {
38928
+ if(this._groupDefs) {
38929
+ var colId = (typeof colRef === "number") ? this.getColumnId(colRef) : colRef;
38930
+ return this._groupDef.getParentId(colId);
38931
+ }
38932
+ return "";
38933
+ };
38934
+
38935
+ /** @public
38936
+ * @param {string} groupId
38937
+ * @return {Array.<string>} Return array of column id. Return null if the specified group has no child
38938
+ */
38939
+ Core.prototype.getColumnGroupChildIds = function (groupId) {
38940
+ if(this._groupDefs) {
38941
+ var ary = this._groupDef.getLeafDescendants(colId);
38942
+ if(ary && ary.length > 0) {
38943
+ return ary;
38944
+ }
38945
+ }
38946
+ return null;
38947
+ };
38299
38948
  //#endregion Public Methods
38300
38949
 
38301
38950
  //#region Private Methods
@@ -38953,13 +39602,35 @@ Core.prototype._getNestedColumnDef = function (colIndex, firstLvl, secondLvl) {
38953
39602
  }
38954
39603
  return def;
38955
39604
  };
39605
+
38956
39606
  /** @public
39607
+ * @param {number} colIndex
39608
+ * @return {string} Return empty string if the specified column does not exist
39609
+ */
39610
+ Core.prototype.getColumnId = function (colIndex) {
39611
+ if(colIndex >= 0 && colIndex < this.getColumnCount()) {
39612
+ return this._getColumnDef(colIndex)["id"] || "";
39613
+ }
39614
+ return "";
39615
+ };
39616
+ /** @deprecated
39617
+ * @public
39618
+ * @function
38957
39619
  * @ignore
38958
39620
  * @param {number} colIndex
38959
39621
  * @return {string}
38960
39622
  */
38961
- Core.prototype._getColumnId = function (colIndex) {
38962
- return this._getColumnDef(colIndex)["id"];
39623
+ Core.prototype._getColumnId = Core.prototype.getColumnId;
39624
+ /** @public
39625
+ * @return {!Array.<string>} Return all column ids from existing column
39626
+ */
39627
+ Core.prototype.getColumnIds = function () {
39628
+ var colCount = this.getColumnCount();
39629
+ var ary = new Array(colCount);
39630
+ for(var c = 0; c < colCount; ++c) {
39631
+ ary[c] = this._getColumnDef(c)["id"] || "";
39632
+ }
39633
+ return ary;
38963
39634
  };
38964
39635
 
38965
39636
 
@@ -43312,7 +43983,9 @@ Grid.prototype._onFieldAdded = function(e) {
43312
43983
  // JET
43313
43984
  if (this._subs) {
43314
43985
  var realtimeFields = addedFields.filter(js_FieldDefinition.isRealTimeField);
43315
- this._subs["addFields"](realtimeFields);
43986
+ if(realtimeFields.length > 0) {
43987
+ this._subs["addFields"](realtimeFields);
43988
+ }
43316
43989
  }
43317
43990
 
43318
43991
  this._dispatch(e.type, e);
@@ -43604,19 +44277,31 @@ Grid.prototype._setScrollbarParent = function (host) {
43604
44277
  /**
43605
44278
  * @private
43606
44279
  * @param {string} field
43607
- * @param {boolean} isRealTime
43608
44280
  * @returns {boolean}
43609
44281
  */
43610
- Grid.prototype._shouldLoadFieldInfo = function (field, isRealTime) {
43611
- var fieldDef = js_FieldDefinition.get(field);
43612
- if (!fieldDef &&
43613
- field !== 'X_RIC_NAME' && // ignore X_RIC_NAME
43614
- (isRealTime || js_FieldDefinition.isAdc(field)) && // realtime field or adc field (Without static field)
43615
- (this._RTK || window["JET"]) // have rtk instance or window jet sub
43616
- ) {
43617
- return true;
44282
+ Grid.prototype._shouldLoadFieldInfo = function (field) {
44283
+
44284
+ var val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
44285
+ if(!val) {
44286
+ return false;
43618
44287
  }
43619
- return false;
44288
+
44289
+ // WARNING: If field caching is disabled, it shouldn't load field info
44290
+ if(!this._fieldCaching) {
44291
+ return false;
44292
+ }
44293
+
44294
+ val = js_FieldDefinition.hasFieldInfo(field);
44295
+ if(val) {
44296
+ return false;
44297
+ }
44298
+
44299
+ val = js_FieldDefinition.isAdc(field) || js_FieldDefinition.isRealTimeField(field);
44300
+ if(!val) {
44301
+ return false;
44302
+ }
44303
+
44304
+ return true;
43620
44305
  };
43621
44306
  /** Remove all existing columns and add new columns based on the given objects
43622
44307
  * @public
@@ -43718,11 +44403,10 @@ Grid.prototype._onColumnAdded = function(e) {
43718
44403
  var fields = colDef.getAllFields();
43719
44404
  var referrer = colDef.getId();
43720
44405
  var len = fields.length;
43721
- var field, dataType, prom, isRealTimeField, onLoaded;
44406
+ var field, dataType, prom, onLoaded;
43722
44407
  for(i = 0; i < len; i++) {
43723
44408
  field = fields[i];
43724
- isRealTimeField = js_FieldDefinition.isRealTimeField(field);
43725
- if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
44409
+ if(this._shouldLoadFieldInfo(field)) {
43726
44410
  if(field === colField) {
43727
44411
  dataType = colDef.getDataType(); // Data-type from user's column options
43728
44412
  } else { // Other required fields
@@ -43891,6 +44575,15 @@ Grid.prototype.moveColumnById = function (srcCol, destCol) {
43891
44575
  if(destIndex < 0) {
43892
44576
  destIndex = colCount;
43893
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) {
43894
44587
  if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
43895
44588
  --destIndex;
43896
44589
  }
@@ -43912,23 +44605,31 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
43912
44605
  var srcLen = colRefs.length;
43913
44606
  if(srcLen > 1) {
43914
44607
  var colIds = this.getColumnIds();
44608
+ var colCount = colIds.length;
43915
44609
  var srcIds = [];
43916
44610
  var invalidDest = false;
43917
- var i;
44611
+ var i, srcId, srcIdx;
43918
44612
  for(i = 0; i < srcLen; ++i) {
43919
44613
  var colRef = colRefs[i];
43920
- var srcId = (typeof colRef === "number") ? colIds[colRef] : colRef;
43921
- if(srcId) {
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) {
43922
44622
  srcIds.push(srcId);
43923
44623
  if(destId === srcId) {
43924
44624
  invalidDest = true; // Destination must not exist in source columns
43925
44625
  }
43926
44626
  }
43927
44627
  }
44628
+
44629
+ var destIdx;
43928
44630
  srcLen = srcIds.length;
43929
44631
  if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
43930
- var colCount = colIds.length;
43931
- var destIdx = this.getColumnIndex(destId);
44632
+ destIdx = this.getColumnIndex(destId);
43932
44633
  if(destIdx >= 0) {
43933
44634
  while(++destIdx < colCount) {
43934
44635
  destId = colIds[destIdx];
@@ -43943,10 +44644,16 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
43943
44644
  }
43944
44645
 
43945
44646
  var dirty = 0;
43946
- for(i = 0; i < srcLen; ++i) {
43947
- dirty |= this.moveColumnById(srcIds[i], destId);
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;
43948
44656
  }
43949
- // TODO: Handle the case where all columns stay in the same place
43950
44657
  return dirty ? true : false;
43951
44658
  } else {
43952
44659
  return this.moveColumnById(colRefs[0], destId);
@@ -44023,11 +44730,10 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
44023
44730
 
44024
44731
  var fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
44025
44732
  var len = fields.length;
44026
- var i, field, dataType, prom, isRealTimeField, onLoaded;
44733
+ var i, field, dataType, prom, onLoaded;
44027
44734
  for(i = 0; i < len; i++) {
44028
44735
  field = fields[i];
44029
- isRealTimeField = js_FieldDefinition.isRealTimeField(field);
44030
- if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
44736
+ if(this._shouldLoadFieldInfo(field)) {
44031
44737
  dataType = ColumnDefinition.getDataType(field);
44032
44738
  prom = js_FieldDefinition.loadFieldInfo(field)
44033
44739
  .catch(this._onFieldLoadedError);
@@ -44801,7 +45507,14 @@ Grid.prototype._getColumnDefinition = function(colRef) {
44801
45507
  }
44802
45508
  return null;
44803
45509
  };
44804
-
45510
+ /** @public
45511
+ * @param {number|string} rowRef Row index as shown in the view or row id (string)
45512
+ * @return {string}
45513
+ */
45514
+ Grid.prototype.getRowType = function(rowRef) {
45515
+ var rowDef = this.getRowDefinition(rowRef);
45516
+ return rowDef ? rowDef.getType() : "";
45517
+ };
44805
45518
  /** @public
44806
45519
  * @param {number|string} rowRef Row index as shown in the view or row id (string)
44807
45520
  * @return {RowDefinition}
@@ -44991,20 +45704,22 @@ Grid.prototype.getColumnIndex = function(colRef) {
44991
45704
  return colRef;
44992
45705
  }
44993
45706
 
44994
- var colCount = this.getColumnCount();
44995
- var i, colDef;
44996
- if(colRef instanceof ColumnDefinition) {
44997
- for(i = 0; i < colCount; ++i) {
44998
- colDef = this.getColumnDefinition(i);
44999
- if(colDef === colRef) {
45000
- return i;
45707
+ if(colRef) {
45708
+ var colCount = this.getColumnCount();
45709
+ var i, colDef;
45710
+ if(colRef instanceof ColumnDefinition) {
45711
+ for(i = 0; i < colCount; ++i) {
45712
+ colDef = this.getColumnDefinition(i);
45713
+ if(colDef === colRef) {
45714
+ return i;
45715
+ }
45001
45716
  }
45002
- }
45003
- } else if(typeof colRef === "string") {
45004
- for(i = 0; i < colCount; ++i) {
45005
- colDef = this.getColumnDefinition(i);
45006
- if(_hasFieldOrId(colDef, colRef)) {
45007
- return i; // Return the first found field
45717
+ } else if(typeof colRef === "string") {
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
+ }
45008
45723
  }
45009
45724
  }
45010
45725
  }