@syncfusion/ej2-navigations 27.1.56 → 27.1.57

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.
@@ -10764,13 +10764,31 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10764
10764
  const checkBoxEle = element.getElementsByClassName(CHECKBOXWRAP)[0];
10765
10765
  let count = nodes.length;
10766
10766
  let checkedCount = checkedNodes.length;
10767
+ let matchedChildNodes = [];
10768
+ let oldChildCount = [];
10767
10769
  const dataUid = element.getAttribute('data-uid');
10770
+ let rootNodeChecked = true;
10771
+ let childNodeChecked = false;
10772
+ nodes.forEach((childNode) => {
10773
+ if (childNode instanceof HTMLElement) {
10774
+ const ariaChecked = childNode.getAttribute('aria-checked');
10775
+ if (ariaChecked === 'true') {
10776
+ childNodeChecked = true;
10777
+ }
10778
+ else {
10779
+ rootNodeChecked = false;
10780
+ }
10781
+ }
10782
+ });
10783
+ let parentNodeChecked = false;
10768
10784
  if (this.element.classList.contains('e-filtering')) {
10769
10785
  const oldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', dataUid, true));
10770
10786
  checkedCount = oldCheckedNodes.length;
10771
10787
  const parentNode = new DataManager(this.OldCheckedData).executeLocal(new Query().where('hasChildren', 'equal', true, true));
10772
- if ((parentNode.length > 0) && (this.OldCheckedData.some((oldNode) => oldNode.id === dataUid))) {
10788
+ if (parentNode.length > 0
10789
+ && (this.OldCheckedData.some((oldNode) => oldNode.id === dataUid) && childNodeChecked)) {
10773
10790
  checkedCount = parentNode.length;
10791
+ parentNodeChecked = true;
10774
10792
  }
10775
10793
  let childItems = [];
10776
10794
  if (this.dataType === 1) {
@@ -10781,12 +10799,23 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10781
10799
  }
10782
10800
  count = childItems.length;
10783
10801
  }
10802
+ if (this.autoCheck && this.showCheckBox) {
10803
+ const selectedChildNodeDetails = this.getSelectedChildNodeDetails(dataUid);
10804
+ matchedChildNodes = selectedChildNodeDetails;
10805
+ oldChildCount = new DataManager(this.checkActionNodes)
10806
+ .executeLocal(new Query().where('parentID', 'equal', dataUid, true));
10807
+ }
10784
10808
  if (count === 0 && checkedCount === 0) {
10785
10809
  return;
10786
10810
  }
10787
- else if (count === checkedCount) {
10811
+ else if (count === checkedCount || ((parentNodeChecked && count > 0) && (oldChildCount.length === matchedChildNodes.length)
10812
+ && (oldChildCount.length !== 0 && matchedChildNodes.length !== 0) && rootNodeChecked
10813
+ && (this.autoCheck && this.showCheckBox))) {
10788
10814
  this.changeState(checkBoxEle, 'check', null, true, true);
10789
10815
  }
10816
+ else if ((checkedCount > 0 && !parentNodeChecked && (this.autoCheck && this.showCheckBox))) {
10817
+ this.changeState(checkBoxEle, 'indeterminate', null, true, true);
10818
+ }
10790
10819
  else if (checkedCount > 0 || indeterminateNodes.length > 0) {
10791
10820
  this.changeState(checkBoxEle, 'indeterminate', null, true, true);
10792
10821
  }
@@ -10800,6 +10829,20 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10800
10829
  }
10801
10830
  }
10802
10831
  }
10832
+ getSelectedChildNodeDetails(dataUid) {
10833
+ return this.checkedNodes
10834
+ .map((checkedNodeId) => {
10835
+ return new DataManager(this.DDTTreeData)
10836
+ .executeLocal(new Query().where('id', 'equal', checkedNodeId, true))[0];
10837
+ })
10838
+ .filter((childNode) => {
10839
+ if (childNode && typeof childNode === 'object' && 'pid' in childNode) {
10840
+ const childNodePid = childNode.pid;
10841
+ return childNodePid.toString() === dataUid;
10842
+ }
10843
+ return false;
10844
+ });
10845
+ }
10803
10846
  ensureChildCheckState(element, e, isFromExpandAll) {
10804
10847
  if (!isNullOrUndefined(element)) {
10805
10848
  const childElement = select('.' + PARENTITEM, element);
@@ -11435,6 +11478,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11435
11478
  const index = this.OldCheckedData.findIndex((e) => e['id'] === uncheckedItems[0]['id']);
11436
11479
  if (index !== -1) {
11437
11480
  this.OldCheckedData.splice(index, 1);
11481
+ const childNodes = this.OldCheckedData.filter((e) => e['parentID'] === uncheckedItems[0]['id']);
11482
+ if (childNodes.length > 0) {
11483
+ childNodes.forEach((child) => {
11484
+ const childIndex = this.OldCheckedData.findIndex((e) => e['id'] === child.id);
11485
+ if (childIndex !== -1) {
11486
+ this.OldCheckedData.splice(childIndex, 1);
11487
+ }
11488
+ });
11489
+ }
11438
11490
  return;
11439
11491
  }
11440
11492
  }
@@ -14819,6 +14871,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14819
14871
  for (let i = 0; i < nodes.length; i++) {
14820
14872
  const pid = getValue(this.fields.parentID, nodes[parseInt(i.toString(), 10)]);
14821
14873
  dropLi = pid ? this.getElement(pid.toString()) : pid;
14874
+ if (!isNullOrUndefined(pid) && isNullOrUndefined(dropLi)) {
14875
+ this.preventExpand = false;
14876
+ this.ensureVisible(pid);
14877
+ this.preventExpand = preventTargetExpand;
14878
+ dropLi = this.getElement(pid.toString());
14879
+ }
14822
14880
  this.addGivenNodes([nodes[parseInt(i.toString(), 10)]], dropLi, index);
14823
14881
  }
14824
14882
  }
@@ -15050,6 +15108,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
15050
15108
  * @param {string | Element} target - Specifies the ID of TreeView node or TreeView node as target element.
15051
15109
  * @param {Object[]} newData - Specifies the new data of TreeView node.
15052
15110
  * @returns {void}
15111
+ * ```typescript
15112
+ * var treeObj = document.getElementById("treeview").ej2_instances[0];
15113
+ * var data = treeObj.getTreeData("01");
15114
+ * var newData = {
15115
+ * id: data[0].id,
15116
+ * name: "new Text",
15117
+ * };
15118
+ * treeObj.refreshNode("01", [newData]);
15119
+ * ```
15053
15120
  */
15054
15121
  refreshNode(target, newData) {
15055
15122
  if (isNullOrUndefined(target) || isNullOrUndefined(newData)) {
@@ -15165,7 +15232,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
15165
15232
  }
15166
15233
  }
15167
15234
  /**
15168
- * Replaces the text of the TreeView node with the given text.
15235
+ * Replaces the text of the TreeView node with the given text only when the `allowEditing` property is enabled.
15169
15236
  *
15170
15237
  * @param {string | Element} target - Specifies ID of TreeView node/TreeView node as target element.
15171
15238
  * @param {string} newText - Specifies the new text of TreeView node.
@@ -15730,6 +15797,9 @@ let Sidebar = class Sidebar extends Component {
15730
15797
  }
15731
15798
  }
15732
15799
  resize() {
15800
+ if (!isNullOrUndefined(this.width) && this.width !== 'auto' && typeof this.width === 'string' && !this.width.includes('px')) {
15801
+ this.setType(this.type);
15802
+ }
15733
15803
  if (this.type === 'Auto') {
15734
15804
  if (Browser.isDevice) {
15735
15805
  addClass([this.element], OVER);
@@ -17413,7 +17483,8 @@ let Carousel = class Carousel extends Component {
17413
17483
  this.applySlideInterval();
17414
17484
  }
17415
17485
  autoSlideChange() {
17416
- const activeSlide = this.element.querySelector(`.${CLS_ACTIVE$2}`);
17486
+ const activeSlide = this.element.querySelector(`.${CLS_ITEM$3}.${CLS_ACTIVE$2}`)
17487
+ || this.element.querySelector(`.${CLS_INDICATORS} .${CLS_ACTIVE$2}`);
17417
17488
  if (isNullOrUndefined(activeSlide)) {
17418
17489
  return;
17419
17490
  }