@syncfusion/ej2-navigations 27.2.2 → 27.2.4

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
  };
@@ -9398,11 +9402,13 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9398
9402
  else {
9399
9403
  _this.dragItem.querySelector('.' + CLS_WRAP).style.visibility = '';
9400
9404
  removeClass([_this.tbItems.querySelector('.' + CLS_INDICATOR)], CLS_HIDDEN$1);
9405
+ _this.droppedIndex = isNullOrUndefined(_this.droppedIndex) ? _this.getEleIndex(_this.dragItem) : _this.droppedIndex;
9401
9406
  _this.selectTab(_this.droppedIndex, null, true);
9402
9407
  }
9403
9408
  }
9404
9409
  });
9405
9410
  this.dragItem = null;
9411
+ this.droppedIndex = null;
9406
9412
  };
9407
9413
  /**
9408
9414
  * Enables or disables the specified Tab item. On passing value as `false`, the item will be disabled.
@@ -11197,20 +11203,37 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11197
11203
  .filter(function (childNode) {
11198
11204
  if (childNode && typeof childNode === 'object' && 'pid' in childNode) {
11199
11205
  var childNodePid = childNode.pid;
11200
- return childNodePid.toString() === dataUid;
11206
+ if (!isNullOrUndefined(childNodePid)) {
11207
+ return childNodePid.toString() === dataUid;
11208
+ }
11201
11209
  }
11202
11210
  return false;
11203
11211
  });
11204
11212
  };
11205
11213
  TreeView.prototype.ensureChildCheckState = function (element, e, isFromExpandAll) {
11214
+ var _this = this;
11206
11215
  if (!isNullOrUndefined(element)) {
11207
11216
  var childElement = select('.' + PARENTITEM, element);
11208
11217
  var checkBoxes = void 0;
11209
11218
  if (!isNullOrUndefined(childElement)) {
11219
+ var childCheck = Array.from(childElement.querySelectorAll('li'));
11210
11220
  checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
11221
+ if (this.isFilter) {
11222
+ checkBoxes = Array.from(checkBoxes).filter(function (checkbox) {
11223
+ var dataUID = checkbox.closest('li').getAttribute('data-uid');
11224
+ return dataUID !== null && _this.checkedNodes.indexOf(dataUID) !== -1;
11225
+ });
11226
+ childCheck = Array.from(childCheck).filter(function (li) {
11227
+ var childIds = li.getAttribute('data-uid');
11228
+ return childIds !== null && _this.checkedNodes.indexOf(childIds) !== -1;
11229
+ });
11230
+ if (checkBoxes.length === 0) {
11231
+ checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
11232
+ childCheck = Array.from(childElement.querySelectorAll('li'));
11233
+ }
11234
+ }
11211
11235
  var isChecked = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(CHECK);
11212
11236
  var parentCheck = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(INDETERMINATE);
11213
- var childCheck = childElement.querySelectorAll('li');
11214
11237
  var checkedState = void 0;
11215
11238
  for (var index = 0; index < checkBoxes.length; index++) {
11216
11239
  var childId = childCheck[parseInt(index.toString(), 10)].getAttribute('data-uid');
@@ -11273,7 +11296,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11273
11296
  ? nodes[parseInt(len.toString(), 10)].toString()
11274
11297
  : null;
11275
11298
  if (node !== '' && doCheck && node) {
11276
- this.setValidCheckedNode(node);
11299
+ this.setValidCheckedNode(node, nodes);
11277
11300
  this.dynamicCheckState(node, doCheck);
11278
11301
  }
11279
11302
  else if (this.checkedNodes.indexOf(node) !== -1 && node !== '' && !doCheck) {
@@ -12740,11 +12763,20 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12740
12763
  * @returns {void}
12741
12764
  */
12742
12765
  TreeView.prototype.ensureStateChange = function (li, doCheck) {
12766
+ var _this = this;
12743
12767
  var childElement = select('.' + PARENTITEM, li);
12744
12768
  var parentIndex = li.getAttribute('data-uid');
12745
12769
  var mapper = this.fields;
12746
12770
  if (this.dataType === 1 && this.autoCheck) {
12747
12771
  var resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.parentID, 'equal', parentIndex, true));
12772
+ var childMatchesCheckedNodes = resultData.filter(function (item) {
12773
+ return _this.checkedNodes.indexOf(item[mapper.id].toString()) !== -1;
12774
+ }, this);
12775
+ if (this.checkedNodes.indexOf(parentIndex) !== -1 && childMatchesCheckedNodes.length !== resultData.length && this.isFilter) {
12776
+ if (childMatchesCheckedNodes.length > 0) {
12777
+ resultData = childMatchesCheckedNodes;
12778
+ }
12779
+ }
12748
12780
  for (var i = 0; i < resultData.length; i++) {
12749
12781
  var resultId = resultData[parseInt(i.toString(), 10)][this.fields.id]
12750
12782
  ? resultData[parseInt(i.toString(), 10)][this.fields.id].toString()
@@ -12809,6 +12841,13 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12809
12841
  else {
12810
12842
  var childItems = this.getChildNodes(this.treeData, parentIndex);
12811
12843
  if (childItems) {
12844
+ var filteredChildItems = childItems.filter(function (item) {
12845
+ var itemValue = String(item[Object.keys(item)[0]]);
12846
+ return _this.checkedNodes.indexOf(itemValue) !== -1;
12847
+ });
12848
+ if (filteredChildItems.length > 0 && childItems.length && this.isFilter) {
12849
+ childItems = filteredChildItems;
12850
+ }
12812
12851
  this.childStateChange(childItems, parentIndex, childElement, doCheck);
12813
12852
  }
12814
12853
  }
@@ -13002,6 +13041,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13002
13041
  TreeView.prototype.getFocusedNode = function () {
13003
13042
  var selectedItem;
13004
13043
  var fNode = select('.' + LISTITEM + '[tabindex="0"]', this.element);
13044
+ if (!isNullOrUndefined(fNode)) {
13045
+ var ariaChecked = fNode.getAttribute('aria-checked');
13046
+ if (ariaChecked === 'mixed' || ariaChecked === 'false') {
13047
+ this.isFilter = false;
13048
+ }
13049
+ }
13005
13050
  if (isNullOrUndefined(fNode)) {
13006
13051
  selectedItem = select('.' + LISTITEM, this.element);
13007
13052
  }
@@ -13871,7 +13916,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13871
13916
  }
13872
13917
  };
13873
13918
  TreeView.prototype.expandParent = function (dropLi) {
13874
- var dropIcon = select('div.' + ICON, dropLi);
13919
+ var dropIcon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13875
13920
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && this.preventExpand !== true) {
13876
13921
  this.expandAction(dropLi, dropIcon, null);
13877
13922
  }
@@ -14750,6 +14795,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14750
14795
  };
14751
14796
  TreeView.prototype.setCheckedNodes = function (nodes) {
14752
14797
  nodes = JSON.parse(JSON.stringify(nodes));
14798
+ if (nodes.length > 1 && typeof this.nodeChecked === 'function' && this.nodeChecked.length > 0) {
14799
+ this.isFilter = true;
14800
+ }
14753
14801
  this.uncheckAll(this.checkedNodes);
14754
14802
  this.setIndeterminate(nodes);
14755
14803
  if (nodes.length > 0) {
@@ -14760,15 +14808,17 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14760
14808
  * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel
14761
14809
  *
14762
14810
  * @param {string} node - The unique identifier of the node.
14811
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14763
14812
  * @returns {void}
14764
14813
  * @private
14765
14814
  */
14766
- TreeView.prototype.setValidCheckedNode = function (node) {
14815
+ TreeView.prototype.setValidCheckedNode = function (node, nodes) {
14816
+ if (nodes === void 0) { nodes = []; }
14767
14817
  if (this.dataType === 1) {
14768
14818
  var mapper = this.fields;
14769
14819
  var resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.id, 'equal', node, true));
14770
14820
  if (resultData[0]) {
14771
- this.setChildCheckState(resultData, node, resultData[0]);
14821
+ this.setChildCheckState(resultData, node, resultData[0], nodes);
14772
14822
  if (this.autoCheck) {
14773
14823
  var parent_4 = resultData[0][this.fields.parentID] ? resultData[0][this.fields.parentID].toString() : null;
14774
14824
  var childNodes = this.getChildNodes(this.treeData, parent_4);
@@ -14794,7 +14844,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14794
14844
  }
14795
14845
  var childItems = getValue(this.fields.child.toString(), this.treeData[parseInt(a.toString(), 10)]);
14796
14846
  if (childItems) {
14797
- this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)]);
14847
+ this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)], nodes);
14798
14848
  }
14799
14849
  }
14800
14850
  }
@@ -14808,7 +14858,18 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14808
14858
  * @returns {void}
14809
14859
  * @private
14810
14860
  */
14811
- TreeView.prototype.setChildCheckState = function (childItems, node, treeData) {
14861
+ /**
14862
+ * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel(for hierarchical DS)
14863
+ *
14864
+ * @param {Object[]} childItems - The child items to check.
14865
+ * @param {string} node - The node to set the check state for.
14866
+ * @param {Object} [treeData] - The optional tree data.
14867
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14868
+ * @returns {void}
14869
+ * @private
14870
+ */
14871
+ TreeView.prototype.setChildCheckState = function (childItems, node, treeData, nodes) {
14872
+ if (nodes === void 0) { nodes = []; }
14812
14873
  var checkedParent;
14813
14874
  var count = 0;
14814
14875
  if (this.dataType === 1) {
@@ -14828,7 +14889,8 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14828
14889
  this.checkDisabledState(node);
14829
14890
  }
14830
14891
  var subChildItems = this.getChildNodes(this.treeData, checkNode);
14831
- if (subChildItems) {
14892
+ var isParentNodeCheck = (nodes.length === 1 && nodes[0] === checkNode);
14893
+ if (subChildItems.length === node.length || isParentNodeCheck) {
14832
14894
  this.setChildCheckState(subChildItems, node, treeData);
14833
14895
  }
14834
14896
  }
@@ -14839,8 +14901,10 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14839
14901
  }
14840
14902
  for (var index = 0; index < childItems.length; index++) {
14841
14903
  var checkedChild = childItems[parseInt(index.toString(), 10)][this.fields.id] ? childItems[parseInt(index.toString(), 10)][this.fields.id].toString() : '';
14904
+ var isParentNodeCheck = ([node].length === 1 && nodes.length === 0);
14842
14905
  if (treeData && checkedParent && this.autoCheck) {
14843
- if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1) {
14906
+ if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1
14907
+ && (checkedChild === node || isParentNodeCheck)) {
14844
14908
  this.checkDisabledState(checkedChild, childItems[index]);
14845
14909
  }
14846
14910
  }
@@ -14862,7 +14926,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14862
14926
  };
14863
14927
  TreeView.prototype.setIndeterminate = function (nodes) {
14864
14928
  for (var i = 0; i < nodes.length; i++) {
14865
- this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)]);
14929
+ this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)], nodes);
14866
14930
  }
14867
14931
  };
14868
14932
  TreeView.prototype.updatePosition = function (id, newData, isRefreshChild, childValue) {