@syncfusion/ej2-navigations 27.2.2 → 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
  };
@@ -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.
@@ -11203,14 +11209,29 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11203
11209
  });
11204
11210
  };
11205
11211
  TreeView.prototype.ensureChildCheckState = function (element, e, isFromExpandAll) {
11212
+ var _this = this;
11206
11213
  if (!isNullOrUndefined(element)) {
11207
11214
  var childElement = select('.' + PARENTITEM, element);
11208
11215
  var checkBoxes = void 0;
11209
11216
  if (!isNullOrUndefined(childElement)) {
11217
+ var childCheck = Array.from(childElement.querySelectorAll('li'));
11210
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
+ }
11211
11233
  var isChecked = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(CHECK);
11212
11234
  var parentCheck = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(INDETERMINATE);
11213
- var childCheck = childElement.querySelectorAll('li');
11214
11235
  var checkedState = void 0;
11215
11236
  for (var index = 0; index < checkBoxes.length; index++) {
11216
11237
  var childId = childCheck[parseInt(index.toString(), 10)].getAttribute('data-uid');
@@ -11273,7 +11294,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11273
11294
  ? nodes[parseInt(len.toString(), 10)].toString()
11274
11295
  : null;
11275
11296
  if (node !== '' && doCheck && node) {
11276
- this.setValidCheckedNode(node);
11297
+ this.setValidCheckedNode(node, nodes);
11277
11298
  this.dynamicCheckState(node, doCheck);
11278
11299
  }
11279
11300
  else if (this.checkedNodes.indexOf(node) !== -1 && node !== '' && !doCheck) {
@@ -12740,11 +12761,20 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12740
12761
  * @returns {void}
12741
12762
  */
12742
12763
  TreeView.prototype.ensureStateChange = function (li, doCheck) {
12764
+ var _this = this;
12743
12765
  var childElement = select('.' + PARENTITEM, li);
12744
12766
  var parentIndex = li.getAttribute('data-uid');
12745
12767
  var mapper = this.fields;
12746
12768
  if (this.dataType === 1 && this.autoCheck) {
12747
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
+ }
12748
12778
  for (var i = 0; i < resultData.length; i++) {
12749
12779
  var resultId = resultData[parseInt(i.toString(), 10)][this.fields.id]
12750
12780
  ? resultData[parseInt(i.toString(), 10)][this.fields.id].toString()
@@ -12809,6 +12839,13 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12809
12839
  else {
12810
12840
  var childItems = this.getChildNodes(this.treeData, parentIndex);
12811
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
+ }
12812
12849
  this.childStateChange(childItems, parentIndex, childElement, doCheck);
12813
12850
  }
12814
12851
  }
@@ -13002,6 +13039,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13002
13039
  TreeView.prototype.getFocusedNode = function () {
13003
13040
  var selectedItem;
13004
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
+ }
13005
13048
  if (isNullOrUndefined(fNode)) {
13006
13049
  selectedItem = select('.' + LISTITEM, this.element);
13007
13050
  }
@@ -13871,7 +13914,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13871
13914
  }
13872
13915
  };
13873
13916
  TreeView.prototype.expandParent = function (dropLi) {
13874
- var dropIcon = select('div.' + ICON, dropLi);
13917
+ var dropIcon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13875
13918
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && this.preventExpand !== true) {
13876
13919
  this.expandAction(dropLi, dropIcon, null);
13877
13920
  }
@@ -14750,6 +14793,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14750
14793
  };
14751
14794
  TreeView.prototype.setCheckedNodes = function (nodes) {
14752
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
+ }
14753
14799
  this.uncheckAll(this.checkedNodes);
14754
14800
  this.setIndeterminate(nodes);
14755
14801
  if (nodes.length > 0) {
@@ -14760,15 +14806,17 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14760
14806
  * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel
14761
14807
  *
14762
14808
  * @param {string} node - The unique identifier of the node.
14809
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14763
14810
  * @returns {void}
14764
14811
  * @private
14765
14812
  */
14766
- TreeView.prototype.setValidCheckedNode = function (node) {
14813
+ TreeView.prototype.setValidCheckedNode = function (node, nodes) {
14814
+ if (nodes === void 0) { nodes = []; }
14767
14815
  if (this.dataType === 1) {
14768
14816
  var mapper = this.fields;
14769
14817
  var resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.id, 'equal', node, true));
14770
14818
  if (resultData[0]) {
14771
- this.setChildCheckState(resultData, node, resultData[0]);
14819
+ this.setChildCheckState(resultData, node, resultData[0], nodes);
14772
14820
  if (this.autoCheck) {
14773
14821
  var parent_4 = resultData[0][this.fields.parentID] ? resultData[0][this.fields.parentID].toString() : null;
14774
14822
  var childNodes = this.getChildNodes(this.treeData, parent_4);
@@ -14794,7 +14842,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14794
14842
  }
14795
14843
  var childItems = getValue(this.fields.child.toString(), this.treeData[parseInt(a.toString(), 10)]);
14796
14844
  if (childItems) {
14797
- this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)]);
14845
+ this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)], nodes);
14798
14846
  }
14799
14847
  }
14800
14848
  }
@@ -14808,7 +14856,18 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14808
14856
  * @returns {void}
14809
14857
  * @private
14810
14858
  */
14811
- 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 = []; }
14812
14871
  var checkedParent;
14813
14872
  var count = 0;
14814
14873
  if (this.dataType === 1) {
@@ -14828,7 +14887,8 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14828
14887
  this.checkDisabledState(node);
14829
14888
  }
14830
14889
  var subChildItems = this.getChildNodes(this.treeData, checkNode);
14831
- if (subChildItems) {
14890
+ var isParentNodeCheck = (nodes.length === 1 && nodes[0] === checkNode);
14891
+ if (subChildItems.length === node.length || isParentNodeCheck) {
14832
14892
  this.setChildCheckState(subChildItems, node, treeData);
14833
14893
  }
14834
14894
  }
@@ -14839,8 +14899,10 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14839
14899
  }
14840
14900
  for (var index = 0; index < childItems.length; index++) {
14841
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);
14842
14903
  if (treeData && checkedParent && this.autoCheck) {
14843
- 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)) {
14844
14906
  this.checkDisabledState(checkedChild, childItems[index]);
14845
14907
  }
14846
14908
  }
@@ -14862,7 +14924,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14862
14924
  };
14863
14925
  TreeView.prototype.setIndeterminate = function (nodes) {
14864
14926
  for (var i = 0; i < nodes.length; i++) {
14865
- this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)]);
14927
+ this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)], nodes);
14866
14928
  }
14867
14929
  };
14868
14930
  TreeView.prototype.updatePosition = function (id, newData, isRefreshChild, childValue) {