@syncfusion/ej2-navigations 27.1.56 → 27.1.58

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.
@@ -1300,6 +1300,9 @@ let MenuBase = class MenuBase extends Component {
1300
1300
  this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
1301
1301
  EventHandler.add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
1302
1302
  EventHandler.add(document, 'mousedown', this.delegateMouseDownHandler, this);
1303
+ if (!this.isMenu && !this.target) {
1304
+ EventHandler.add(document, 'scroll', this.scrollHandler, this);
1305
+ }
1303
1306
  }
1304
1307
  this.delegateClickHandler = this.clickHandler.bind(this);
1305
1308
  EventHandler.add(document, 'click', this.delegateClickHandler, this);
@@ -1660,7 +1663,7 @@ let MenuBase = class MenuBase extends Component {
1660
1663
  this.afterCloseMenu(e);
1661
1664
  }
1662
1665
  else if (isOpen && !this.hamburgerMode && closedLi && !trgtLi && this.keyType !== 'left' && (this.navIdx.length || !this.isMenu && this.navIdx.length === 0)) {
1663
- let ele = (e && (e.target.classList.contains('e-vscroll') || e.target.classList.contains('e-scroll-nav')))
1666
+ let ele = (e && e.target.classList && (e.target.classList.contains('e-vscroll') || e.target.classList.contains('e-scroll-nav')))
1664
1667
  ? closest(e.target, '.e-menu-wrapper') : null;
1665
1668
  if (ele) {
1666
1669
  ele = ele.querySelector('.e-menu-item');
@@ -1669,7 +1672,7 @@ let MenuBase = class MenuBase extends Component {
1669
1672
  }
1670
1673
  }
1671
1674
  else {
1672
- if (!(e && e.target.classList.contains('e-nav-arrow'))) {
1675
+ if (!(e && e.target.classList && e.target.classList.contains('e-nav-arrow'))) {
1673
1676
  this.closeMenu(this.navIdx[this.navIdx.length - 1], e);
1674
1677
  }
1675
1678
  }
@@ -2857,6 +2860,9 @@ let MenuBase = class MenuBase extends Component {
2857
2860
  if (!Browser.isDevice) {
2858
2861
  EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
2859
2862
  EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
2863
+ if (!this.isMenu && !this.target) {
2864
+ EventHandler.remove(document, 'scroll', this.scrollHandler);
2865
+ }
2860
2866
  }
2861
2867
  EventHandler.remove(document, 'click', this.delegateClickHandler);
2862
2868
  this.unWireKeyboardEvent(wrapper);
@@ -9143,6 +9149,10 @@ let Tab = class Tab extends Component {
9143
9149
  addTab(items, index) {
9144
9150
  const addArgs = { addedItems: items, cancel: false };
9145
9151
  if (!this.isReplace) {
9152
+ for (const item of items) {
9153
+ item.disabled = item.disabled || false;
9154
+ item.visible = item.visible || true;
9155
+ }
9146
9156
  this.trigger('adding', addArgs, (tabAddingArgs) => {
9147
9157
  if (!tabAddingArgs.cancel) {
9148
9158
  this.addingTabContent(items, index);
@@ -9346,6 +9356,10 @@ let Tab = class Tab extends Component {
9346
9356
  }
9347
9357
  }
9348
9358
  this.setActiveBorder();
9359
+ if (!isNullOrUndefined(this.items[index])) {
9360
+ this.items[index].visible = !value;
9361
+ this.dataBind();
9362
+ }
9349
9363
  if (!isNullOrUndefined(item.firstElementChild)) {
9350
9364
  item.firstElementChild.setAttribute('aria-hidden', '' + value);
9351
9365
  }
@@ -10764,13 +10778,31 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10764
10778
  const checkBoxEle = element.getElementsByClassName(CHECKBOXWRAP)[0];
10765
10779
  let count = nodes.length;
10766
10780
  let checkedCount = checkedNodes.length;
10781
+ let matchedChildNodes = [];
10782
+ let oldChildCount = [];
10767
10783
  const dataUid = element.getAttribute('data-uid');
10784
+ let rootNodeChecked = true;
10785
+ let childNodeChecked = false;
10786
+ nodes.forEach((childNode) => {
10787
+ if (childNode instanceof HTMLElement) {
10788
+ const ariaChecked = childNode.getAttribute('aria-checked');
10789
+ if (ariaChecked === 'true') {
10790
+ childNodeChecked = true;
10791
+ }
10792
+ else {
10793
+ rootNodeChecked = false;
10794
+ }
10795
+ }
10796
+ });
10797
+ let parentNodeChecked = false;
10768
10798
  if (this.element.classList.contains('e-filtering')) {
10769
10799
  const oldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', dataUid, true));
10770
10800
  checkedCount = oldCheckedNodes.length;
10771
10801
  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))) {
10802
+ if (parentNode.length > 0
10803
+ && (this.OldCheckedData.some((oldNode) => oldNode.id === dataUid) && childNodeChecked)) {
10773
10804
  checkedCount = parentNode.length;
10805
+ parentNodeChecked = true;
10774
10806
  }
10775
10807
  let childItems = [];
10776
10808
  if (this.dataType === 1) {
@@ -10781,12 +10813,23 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10781
10813
  }
10782
10814
  count = childItems.length;
10783
10815
  }
10816
+ if (this.autoCheck && this.showCheckBox) {
10817
+ const selectedChildNodeDetails = this.getSelectedChildNodeDetails(dataUid);
10818
+ matchedChildNodes = selectedChildNodeDetails;
10819
+ oldChildCount = new DataManager(this.checkActionNodes)
10820
+ .executeLocal(new Query().where('parentID', 'equal', dataUid, true));
10821
+ }
10784
10822
  if (count === 0 && checkedCount === 0) {
10785
10823
  return;
10786
10824
  }
10787
- else if (count === checkedCount) {
10825
+ else if (count === checkedCount || ((parentNodeChecked && count > 0) && (oldChildCount.length === matchedChildNodes.length)
10826
+ && (oldChildCount.length !== 0 && matchedChildNodes.length !== 0) && rootNodeChecked
10827
+ && (this.autoCheck && this.showCheckBox))) {
10788
10828
  this.changeState(checkBoxEle, 'check', null, true, true);
10789
10829
  }
10830
+ else if ((checkedCount > 0 && !parentNodeChecked && (this.autoCheck && this.showCheckBox))) {
10831
+ this.changeState(checkBoxEle, 'indeterminate', null, true, true);
10832
+ }
10790
10833
  else if (checkedCount > 0 || indeterminateNodes.length > 0) {
10791
10834
  this.changeState(checkBoxEle, 'indeterminate', null, true, true);
10792
10835
  }
@@ -10800,6 +10843,20 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10800
10843
  }
10801
10844
  }
10802
10845
  }
10846
+ getSelectedChildNodeDetails(dataUid) {
10847
+ return this.checkedNodes
10848
+ .map((checkedNodeId) => {
10849
+ return new DataManager(this.DDTTreeData)
10850
+ .executeLocal(new Query().where('id', 'equal', checkedNodeId, true))[0];
10851
+ })
10852
+ .filter((childNode) => {
10853
+ if (childNode && typeof childNode === 'object' && 'pid' in childNode) {
10854
+ const childNodePid = childNode.pid;
10855
+ return childNodePid.toString() === dataUid;
10856
+ }
10857
+ return false;
10858
+ });
10859
+ }
10803
10860
  ensureChildCheckState(element, e, isFromExpandAll) {
10804
10861
  if (!isNullOrUndefined(element)) {
10805
10862
  const childElement = select('.' + PARENTITEM, element);
@@ -11435,6 +11492,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11435
11492
  const index = this.OldCheckedData.findIndex((e) => e['id'] === uncheckedItems[0]['id']);
11436
11493
  if (index !== -1) {
11437
11494
  this.OldCheckedData.splice(index, 1);
11495
+ const childNodes = this.OldCheckedData.filter((e) => e['parentID'] === uncheckedItems[0]['id']);
11496
+ if (childNodes.length > 0) {
11497
+ childNodes.forEach((child) => {
11498
+ const childIndex = this.OldCheckedData.findIndex((e) => e['id'] === child.id);
11499
+ if (childIndex !== -1) {
11500
+ this.OldCheckedData.splice(childIndex, 1);
11501
+ }
11502
+ });
11503
+ }
11438
11504
  return;
11439
11505
  }
11440
11506
  }
@@ -14819,6 +14885,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14819
14885
  for (let i = 0; i < nodes.length; i++) {
14820
14886
  const pid = getValue(this.fields.parentID, nodes[parseInt(i.toString(), 10)]);
14821
14887
  dropLi = pid ? this.getElement(pid.toString()) : pid;
14888
+ if (!isNullOrUndefined(pid) && isNullOrUndefined(dropLi)) {
14889
+ this.preventExpand = false;
14890
+ this.ensureVisible(pid);
14891
+ this.preventExpand = preventTargetExpand;
14892
+ dropLi = this.getElement(pid.toString());
14893
+ }
14822
14894
  this.addGivenNodes([nodes[parseInt(i.toString(), 10)]], dropLi, index);
14823
14895
  }
14824
14896
  }
@@ -15050,6 +15122,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
15050
15122
  * @param {string | Element} target - Specifies the ID of TreeView node or TreeView node as target element.
15051
15123
  * @param {Object[]} newData - Specifies the new data of TreeView node.
15052
15124
  * @returns {void}
15125
+ * ```typescript
15126
+ * var treeObj = document.getElementById("treeview").ej2_instances[0];
15127
+ * var data = treeObj.getTreeData("01");
15128
+ * var newData = {
15129
+ * id: data[0].id,
15130
+ * name: "new Text",
15131
+ * };
15132
+ * treeObj.refreshNode("01", [newData]);
15133
+ * ```
15053
15134
  */
15054
15135
  refreshNode(target, newData) {
15055
15136
  if (isNullOrUndefined(target) || isNullOrUndefined(newData)) {
@@ -15165,7 +15246,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
15165
15246
  }
15166
15247
  }
15167
15248
  /**
15168
- * Replaces the text of the TreeView node with the given text.
15249
+ * Replaces the text of the TreeView node with the given text only when the `allowEditing` property is enabled.
15169
15250
  *
15170
15251
  * @param {string | Element} target - Specifies ID of TreeView node/TreeView node as target element.
15171
15252
  * @param {string} newText - Specifies the new text of TreeView node.
@@ -15730,6 +15811,9 @@ let Sidebar = class Sidebar extends Component {
15730
15811
  }
15731
15812
  }
15732
15813
  resize() {
15814
+ if (!isNullOrUndefined(this.width) && this.width !== 'auto' && typeof this.width === 'string' && !this.width.includes('px')) {
15815
+ this.setType(this.type);
15816
+ }
15733
15817
  if (this.type === 'Auto') {
15734
15818
  if (Browser.isDevice) {
15735
15819
  addClass([this.element], OVER);
@@ -17413,7 +17497,8 @@ let Carousel = class Carousel extends Component {
17413
17497
  this.applySlideInterval();
17414
17498
  }
17415
17499
  autoSlideChange() {
17416
- const activeSlide = this.element.querySelector(`.${CLS_ACTIVE$2}`);
17500
+ const activeSlide = this.element.querySelector(`.${CLS_ITEM$3}.${CLS_ACTIVE$2}`)
17501
+ || this.element.querySelector(`.${CLS_INDICATORS} .${CLS_ACTIVE$2}`);
17417
17502
  if (isNullOrUndefined(activeSlide)) {
17418
17503
  return;
17419
17504
  }