@syncfusion/ej2-navigations 27.1.58 → 27.2.3

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.
@@ -3322,6 +3322,10 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3322
3322
  li = this.createItems(iitems).children[idx];
3323
3323
  var ul = this.isMenu ? select('.e-menu-parent', uls[navIdx.length]) : uls[navIdx.length];
3324
3324
  ul.insertBefore(li, ul.children[idx]);
3325
+ if (i === items.length - 1 && !this.isMenu && ul.style.display === 'block') {
3326
+ this.setPosition(null, ul, parseFloat(ul.style.top), parseFloat(ul.style.left));
3327
+ ul.style.display = 'block';
3328
+ }
3325
3329
  }
3326
3330
  }
3327
3331
  };
@@ -5039,9 +5043,9 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
5039
5043
  return;
5040
5044
  }
5041
5045
  var alignDiv = [];
5042
- alignDiv.push(this.createElement('div', { className: CLS_TBARLEFT }));
5043
- alignDiv.push(this.createElement('div', { className: CLS_TBARCENTER }));
5044
- alignDiv.push(this.createElement('div', { className: CLS_TBARRIGHT }));
5046
+ alignDiv.push(this.createElement('div', { className: CLS_TBARLEFT, attrs: { role: 'group' } }));
5047
+ alignDiv.push(this.createElement('div', { className: CLS_TBARCENTER, attrs: { role: 'group' } }));
5048
+ alignDiv.push(this.createElement('div', { className: CLS_TBARRIGHT, attrs: { role: 'group' } }));
5045
5049
  if (pos === 0 && item.align !== 'Left') {
5046
5050
  alignDiv.forEach(function (ele) {
5047
5051
  itemEle.appendChild(ele);
@@ -7924,6 +7928,20 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
7924
7928
  this.renderReactTemplates();
7925
7929
  }
7926
7930
  };
7931
+ /**
7932
+ * Reorganizes and adjusts the Tab headers to fit the available width without re-rendering the entire Tab component.
7933
+ *
7934
+ * This method is useful for optimizing the layout when:
7935
+ * - A hidden tab item becomes visible.
7936
+ * - The number of tab items changes dynamically.
7937
+ *
7938
+ * @returns {void} This method does not return a value.
7939
+ */
7940
+ Tab.prototype.refreshOverflow = function () {
7941
+ if (!isNullOrUndefined(this.tbObj)) {
7942
+ this.tbObj.refreshOverflow();
7943
+ }
7944
+ };
7927
7945
  /**
7928
7946
  * Initialize component
7929
7947
  *
@@ -7969,9 +7987,7 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
7969
7987
  this.initRender = false;
7970
7988
  if (this.isReact && this.portals && this.portals.length > 0) {
7971
7989
  this.renderReactTemplates(function () {
7972
- if (!isNullOrUndefined(_this.tbObj)) {
7973
- _this.tbObj.refreshOverflow();
7974
- }
7990
+ _this.refreshOverflow();
7975
7991
  _this.refreshActiveBorder();
7976
7992
  });
7977
7993
  }
@@ -8267,7 +8283,7 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
8267
8283
  else {
8268
8284
  trg.classList.remove(CLS_CLOSE_SHOW);
8269
8285
  }
8270
- this.tbObj.refreshOverflow();
8286
+ this.refreshOverflow();
8271
8287
  this.refreshActiveTabBorder();
8272
8288
  };
8273
8289
  Tab.prototype.prevCtnAnimation = function (prev, current) {
@@ -9386,11 +9402,13 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9386
9402
  else {
9387
9403
  _this.dragItem.querySelector('.' + CLS_WRAP).style.visibility = '';
9388
9404
  removeClass([_this.tbItems.querySelector('.' + CLS_INDICATOR)], CLS_HIDDEN$1);
9405
+ _this.droppedIndex = isNullOrUndefined(_this.droppedIndex) ? _this.getEleIndex(_this.dragItem) : _this.droppedIndex;
9389
9406
  _this.selectTab(_this.droppedIndex, null, true);
9390
9407
  }
9391
9408
  }
9392
9409
  });
9393
9410
  this.dragItem = null;
9411
+ this.droppedIndex = null;
9394
9412
  };
9395
9413
  /**
9396
9414
  * Enables or disables the specified Tab item. On passing value as `false`, the item will be disabled.
@@ -9650,8 +9668,8 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9650
9668
  if (!isNullOrUndefined(item.firstElementChild)) {
9651
9669
  item.firstElementChild.setAttribute('aria-hidden', '' + value);
9652
9670
  }
9653
- if (this.overflowMode === 'Popup' && this.tbObj) {
9654
- this.tbObj.refreshOverflow();
9671
+ if (this.overflowMode === 'Popup') {
9672
+ this.refreshOverflow();
9655
9673
  }
9656
9674
  };
9657
9675
  Tab.prototype.selectTab = function (args, event, isInteracted) {
@@ -10913,7 +10931,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
10913
10931
  if (this.showCheckBox) {
10914
10932
  var checkboxEle = createCheckBox(this.createElement, true, { cssClass: this.touchClass });
10915
10933
  checkboxEle.classList.add(CHECKBOXWRAP);
10916
- var icon = select('div.' + ICON, e.item);
10934
+ var icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, e.item);
10917
10935
  var id = e.item.getAttribute('data-uid');
10918
10936
  e.item.childNodes[0].insertBefore(checkboxEle, e.item.childNodes[0].childNodes[isNullOrUndefined(icon) ? 0 : 1]);
10919
10937
  var checkValue = getValue(e.fields.isChecked, e.curData);
@@ -11145,7 +11163,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11145
11163
  }
11146
11164
  count = childItems.length;
11147
11165
  }
11148
- if (this.autoCheck && this.showCheckBox) {
11166
+ if (this.autoCheck && this.showCheckBox && !(this.fields.dataSource instanceof DataManager)) {
11149
11167
  var selectedChildNodeDetails = this.getSelectedChildNodeDetails(dataUid_1);
11150
11168
  matchedChildNodes = selectedChildNodeDetails;
11151
11169
  oldChildCount = new DataManager(this.checkActionNodes)
@@ -11191,14 +11209,29 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11191
11209
  });
11192
11210
  };
11193
11211
  TreeView.prototype.ensureChildCheckState = function (element, e, isFromExpandAll) {
11212
+ var _this = this;
11194
11213
  if (!isNullOrUndefined(element)) {
11195
11214
  var childElement = select('.' + PARENTITEM, element);
11196
11215
  var checkBoxes = void 0;
11197
11216
  if (!isNullOrUndefined(childElement)) {
11217
+ var childCheck = Array.from(childElement.querySelectorAll('li'));
11198
11218
  checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
11219
+ if (this.isFilter) {
11220
+ checkBoxes = Array.from(checkBoxes).filter(function (checkbox) {
11221
+ var dataUID = checkbox.closest('li').getAttribute('data-uid');
11222
+ return dataUID !== null && _this.checkedNodes.indexOf(dataUID) !== -1;
11223
+ });
11224
+ childCheck = Array.from(childCheck).filter(function (li) {
11225
+ var childIds = li.getAttribute('data-uid');
11226
+ return childIds !== null && _this.checkedNodes.indexOf(childIds) !== -1;
11227
+ });
11228
+ if (checkBoxes.length === 0) {
11229
+ checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
11230
+ childCheck = Array.from(childElement.querySelectorAll('li'));
11231
+ }
11232
+ }
11199
11233
  var isChecked = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(CHECK);
11200
11234
  var parentCheck = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(INDETERMINATE);
11201
- var childCheck = childElement.querySelectorAll('li');
11202
11235
  var checkedState = void 0;
11203
11236
  for (var index = 0; index < checkBoxes.length; index++) {
11204
11237
  var childId = childCheck[parseInt(index.toString(), 10)].getAttribute('data-uid');
@@ -11261,7 +11294,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11261
11294
  ? nodes[parseInt(len.toString(), 10)].toString()
11262
11295
  : null;
11263
11296
  if (node !== '' && doCheck && node) {
11264
- this.setValidCheckedNode(node);
11297
+ this.setValidCheckedNode(node, nodes);
11265
11298
  this.dynamicCheckState(node, doCheck);
11266
11299
  }
11267
11300
  else if (this.checkedNodes.indexOf(node) !== -1 && node !== '' && !doCheck) {
@@ -12728,11 +12761,20 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12728
12761
  * @returns {void}
12729
12762
  */
12730
12763
  TreeView.prototype.ensureStateChange = function (li, doCheck) {
12764
+ var _this = this;
12731
12765
  var childElement = select('.' + PARENTITEM, li);
12732
12766
  var parentIndex = li.getAttribute('data-uid');
12733
12767
  var mapper = this.fields;
12734
12768
  if (this.dataType === 1 && this.autoCheck) {
12735
12769
  var resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.parentID, 'equal', parentIndex, true));
12770
+ var childMatchesCheckedNodes = resultData.filter(function (item) {
12771
+ return _this.checkedNodes.indexOf(item[mapper.id].toString()) !== -1;
12772
+ }, this);
12773
+ if (this.checkedNodes.indexOf(parentIndex) !== -1 && childMatchesCheckedNodes.length !== resultData.length && this.isFilter) {
12774
+ if (childMatchesCheckedNodes.length > 0) {
12775
+ resultData = childMatchesCheckedNodes;
12776
+ }
12777
+ }
12736
12778
  for (var i = 0; i < resultData.length; i++) {
12737
12779
  var resultId = resultData[parseInt(i.toString(), 10)][this.fields.id]
12738
12780
  ? resultData[parseInt(i.toString(), 10)][this.fields.id].toString()
@@ -12797,6 +12839,13 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12797
12839
  else {
12798
12840
  var childItems = this.getChildNodes(this.treeData, parentIndex);
12799
12841
  if (childItems) {
12842
+ var filteredChildItems = childItems.filter(function (item) {
12843
+ var itemValue = String(item[Object.keys(item)[0]]);
12844
+ return _this.checkedNodes.indexOf(itemValue) !== -1;
12845
+ });
12846
+ if (filteredChildItems.length > 0 && childItems.length && this.isFilter) {
12847
+ childItems = filteredChildItems;
12848
+ }
12800
12849
  this.childStateChange(childItems, parentIndex, childElement, doCheck);
12801
12850
  }
12802
12851
  }
@@ -12990,6 +13039,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12990
13039
  TreeView.prototype.getFocusedNode = function () {
12991
13040
  var selectedItem;
12992
13041
  var fNode = select('.' + LISTITEM + '[tabindex="0"]', this.element);
13042
+ if (!isNullOrUndefined(fNode)) {
13043
+ var ariaChecked = fNode.getAttribute('aria-checked');
13044
+ if (ariaChecked === 'mixed' || ariaChecked === 'false') {
13045
+ this.isFilter = false;
13046
+ }
13047
+ }
12993
13048
  if (isNullOrUndefined(fNode)) {
12994
13049
  selectedItem = select('.' + LISTITEM, this.element);
12995
13050
  }
@@ -13859,7 +13914,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13859
13914
  }
13860
13915
  };
13861
13916
  TreeView.prototype.expandParent = function (dropLi) {
13862
- var dropIcon = select('div.' + ICON, dropLi);
13917
+ var dropIcon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13863
13918
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && this.preventExpand !== true) {
13864
13919
  this.expandAction(dropLi, dropIcon, null);
13865
13920
  }
@@ -13878,7 +13933,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13878
13933
  if (isNullOrUndefined(dropIcon)) {
13879
13934
  ListBase.generateIcon(this.createElement, dropLi, EXPANDABLE, this.listBaseOption);
13880
13935
  }
13881
- var icon = select('div.' + ICON, dropLi);
13936
+ var icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13882
13937
  if (icon) {
13883
13938
  icon.classList.add('e-icon-expandable');
13884
13939
  }
@@ -13901,7 +13956,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13901
13956
  if (isNullOrUndefined(dropIcon)) {
13902
13957
  ListBase.generateIcon(this.createElement, dropLi, COLLAPSIBLE, this.listBaseOption);
13903
13958
  }
13904
- var icon = select('div.' + ICON, dropLi);
13959
+ var icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13905
13960
  if (icon) {
13906
13961
  removeClass([icon], EXPANDABLE);
13907
13962
  }
@@ -13915,6 +13970,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13915
13970
  this.addExpand(dropLi);
13916
13971
  this.trigger('nodeExpanded', this.getExpandEvent(dropLi, null));
13917
13972
  }
13973
+ var collapseIcon = select('div.' + COLLAPSIBLE, dropLi);
13974
+ if (!isNullOrUndefined(dropUl) && collapseIcon && this.preventExpand) {
13975
+ removeClass([collapseIcon], COLLAPSIBLE);
13976
+ dropLi.setAttribute('aria-expanded', 'false');
13977
+ addClass([collapseIcon], EXPANDABLE);
13978
+ }
13918
13979
  return dropUl;
13919
13980
  };
13920
13981
  TreeView.prototype.updateElement = function (dragParentUl, dragParentLi) {
@@ -14240,7 +14301,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14240
14301
  if (!isNullOrUndefined(dropLi)) {
14241
14302
  dropIcon1 = select('div.' + ICON, dropLi);
14242
14303
  }
14243
- if (this.dataType === 1 && dropIcon1 && dropIcon1.classList.contains(EXPANDABLE) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14304
+ if (this.dataType === 1 && dropIcon1 && dropIcon1.classList.contains(EXPANDABLE) && this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14244
14305
  this.preventExpand = true;
14245
14306
  }
14246
14307
  if (this.dataType !== 1) {
@@ -14261,7 +14322,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14261
14322
  for (var i = 0; i < li.length; i++) {
14262
14323
  dropUl.insertBefore(li[parseInt(i.toString(), 10)], refNode);
14263
14324
  }
14264
- if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14325
+ if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14265
14326
  this.preventExpand = false;
14266
14327
  var dropIcon = select('div.' + ICON, dropLi);
14267
14328
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name !== 'nodeExpanding')) {
@@ -14274,7 +14335,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14274
14335
  for (var i = 0; i < li.length; i++) {
14275
14336
  dropUl.insertBefore(li[parseInt(i.toString(), 10)], refNode);
14276
14337
  }
14277
- if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14338
+ if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
14278
14339
  this.preventExpand = false;
14279
14340
  var dropIcon = select('div.' + ICON, dropLi);
14280
14341
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name !== 'nodeExpanding')) {
@@ -14732,6 +14793,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14732
14793
  };
14733
14794
  TreeView.prototype.setCheckedNodes = function (nodes) {
14734
14795
  nodes = JSON.parse(JSON.stringify(nodes));
14796
+ if (nodes.length > 1 && typeof this.nodeChecked === 'function' && this.nodeChecked.length > 0) {
14797
+ this.isFilter = true;
14798
+ }
14735
14799
  this.uncheckAll(this.checkedNodes);
14736
14800
  this.setIndeterminate(nodes);
14737
14801
  if (nodes.length > 0) {
@@ -14742,15 +14806,17 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14742
14806
  * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel
14743
14807
  *
14744
14808
  * @param {string} node - The unique identifier of the node.
14809
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14745
14810
  * @returns {void}
14746
14811
  * @private
14747
14812
  */
14748
- TreeView.prototype.setValidCheckedNode = function (node) {
14813
+ TreeView.prototype.setValidCheckedNode = function (node, nodes) {
14814
+ if (nodes === void 0) { nodes = []; }
14749
14815
  if (this.dataType === 1) {
14750
14816
  var mapper = this.fields;
14751
14817
  var resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.id, 'equal', node, true));
14752
14818
  if (resultData[0]) {
14753
- this.setChildCheckState(resultData, node, resultData[0]);
14819
+ this.setChildCheckState(resultData, node, resultData[0], nodes);
14754
14820
  if (this.autoCheck) {
14755
14821
  var parent_4 = resultData[0][this.fields.parentID] ? resultData[0][this.fields.parentID].toString() : null;
14756
14822
  var childNodes = this.getChildNodes(this.treeData, parent_4);
@@ -14776,7 +14842,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14776
14842
  }
14777
14843
  var childItems = getValue(this.fields.child.toString(), this.treeData[parseInt(a.toString(), 10)]);
14778
14844
  if (childItems) {
14779
- this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)]);
14845
+ this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)], nodes);
14780
14846
  }
14781
14847
  }
14782
14848
  }
@@ -14790,7 +14856,18 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14790
14856
  * @returns {void}
14791
14857
  * @private
14792
14858
  */
14793
- TreeView.prototype.setChildCheckState = function (childItems, node, treeData) {
14859
+ /**
14860
+ * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel(for hierarchical DS)
14861
+ *
14862
+ * @param {Object[]} childItems - The child items to check.
14863
+ * @param {string} node - The node to set the check state for.
14864
+ * @param {Object} [treeData] - The optional tree data.
14865
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14866
+ * @returns {void}
14867
+ * @private
14868
+ */
14869
+ TreeView.prototype.setChildCheckState = function (childItems, node, treeData, nodes) {
14870
+ if (nodes === void 0) { nodes = []; }
14794
14871
  var checkedParent;
14795
14872
  var count = 0;
14796
14873
  if (this.dataType === 1) {
@@ -14810,7 +14887,8 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14810
14887
  this.checkDisabledState(node);
14811
14888
  }
14812
14889
  var subChildItems = this.getChildNodes(this.treeData, checkNode);
14813
- if (subChildItems) {
14890
+ var isParentNodeCheck = (nodes.length === 1 && nodes[0] === checkNode);
14891
+ if (subChildItems.length === node.length || isParentNodeCheck) {
14814
14892
  this.setChildCheckState(subChildItems, node, treeData);
14815
14893
  }
14816
14894
  }
@@ -14821,8 +14899,10 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14821
14899
  }
14822
14900
  for (var index = 0; index < childItems.length; index++) {
14823
14901
  var checkedChild = childItems[parseInt(index.toString(), 10)][this.fields.id] ? childItems[parseInt(index.toString(), 10)][this.fields.id].toString() : '';
14902
+ var isParentNodeCheck = ([node].length === 1 && nodes.length === 0);
14824
14903
  if (treeData && checkedParent && this.autoCheck) {
14825
- if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1) {
14904
+ if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1
14905
+ && (checkedChild === node || isParentNodeCheck)) {
14826
14906
  this.checkDisabledState(checkedChild, childItems[index]);
14827
14907
  }
14828
14908
  }
@@ -14844,7 +14924,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14844
14924
  };
14845
14925
  TreeView.prototype.setIndeterminate = function (nodes) {
14846
14926
  for (var i = 0; i < nodes.length; i++) {
14847
- this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)]);
14927
+ this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)], nodes);
14848
14928
  }
14849
14929
  };
14850
14930
  TreeView.prototype.updatePosition = function (id, newData, isRefreshChild, childValue) {