@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.
@@ -1376,6 +1376,9 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1376
1376
  this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
1377
1377
  EventHandler.add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
1378
1378
  EventHandler.add(document, 'mousedown', this.delegateMouseDownHandler, this);
1379
+ if (!this.isMenu && !this.target) {
1380
+ EventHandler.add(document, 'scroll', this.scrollHandler, this);
1381
+ }
1379
1382
  }
1380
1383
  this.delegateClickHandler = this.clickHandler.bind(this);
1381
1384
  EventHandler.add(document, 'click', this.delegateClickHandler, this);
@@ -1741,7 +1744,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1741
1744
  _this.afterCloseMenu(e);
1742
1745
  }
1743
1746
  else if (isOpen && !_this.hamburgerMode && closedLi && !trgtLi && _this.keyType !== 'left' && (_this.navIdx.length || !_this.isMenu && _this.navIdx.length === 0)) {
1744
- var ele = (e && (e.target.classList.contains('e-vscroll') || e.target.classList.contains('e-scroll-nav')))
1747
+ var ele = (e && e.target.classList && (e.target.classList.contains('e-vscroll') || e.target.classList.contains('e-scroll-nav')))
1745
1748
  ? closest(e.target, '.e-menu-wrapper') : null;
1746
1749
  if (ele) {
1747
1750
  ele = ele.querySelector('.e-menu-item');
@@ -1750,7 +1753,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1750
1753
  }
1751
1754
  }
1752
1755
  else {
1753
- if (!(e && e.target.classList.contains('e-nav-arrow'))) {
1756
+ if (!(e && e.target.classList && e.target.classList.contains('e-nav-arrow'))) {
1754
1757
  _this.closeMenu(_this.navIdx[_this.navIdx.length - 1], e);
1755
1758
  }
1756
1759
  }
@@ -2963,6 +2966,9 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
2963
2966
  if (!Browser.isDevice) {
2964
2967
  EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
2965
2968
  EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
2969
+ if (!this.isMenu && !this.target) {
2970
+ EventHandler.remove(document, 'scroll', this.scrollHandler);
2971
+ }
2966
2972
  }
2967
2973
  EventHandler.remove(document, 'click', this.delegateClickHandler);
2968
2974
  this.unWireKeyboardEvent(wrapper);
@@ -9427,6 +9433,11 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9427
9433
  var _this = this;
9428
9434
  var addArgs = { addedItems: items, cancel: false };
9429
9435
  if (!this.isReplace) {
9436
+ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
9437
+ var item = items_1[_i];
9438
+ item.disabled = item.disabled || false;
9439
+ item.visible = item.visible || true;
9440
+ }
9430
9441
  this.trigger('adding', addArgs, function (tabAddingArgs) {
9431
9442
  if (!tabAddingArgs.cancel) {
9432
9443
  _this.addingTabContent(items, index);
@@ -9632,6 +9643,10 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9632
9643
  }
9633
9644
  }
9634
9645
  this.setActiveBorder();
9646
+ if (!isNullOrUndefined(this.items[index])) {
9647
+ this.items[index].visible = !value;
9648
+ this.dataBind();
9649
+ }
9635
9650
  if (!isNullOrUndefined(item.firstElementChild)) {
9636
9651
  item.firstElementChild.setAttribute('aria-hidden', '' + value);
9637
9652
  }
@@ -11095,13 +11110,31 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11095
11110
  var checkBoxEle = element.getElementsByClassName(CHECKBOXWRAP)[0];
11096
11111
  var count = nodes.length;
11097
11112
  var checkedCount = checkedNodes.length;
11113
+ var matchedChildNodes = [];
11114
+ var oldChildCount = [];
11098
11115
  var dataUid_1 = element.getAttribute('data-uid');
11116
+ var rootNodeChecked_1 = true;
11117
+ var childNodeChecked_1 = false;
11118
+ nodes.forEach(function (childNode) {
11119
+ if (childNode instanceof HTMLElement) {
11120
+ var ariaChecked = childNode.getAttribute('aria-checked');
11121
+ if (ariaChecked === 'true') {
11122
+ childNodeChecked_1 = true;
11123
+ }
11124
+ else {
11125
+ rootNodeChecked_1 = false;
11126
+ }
11127
+ }
11128
+ });
11129
+ var parentNodeChecked = false;
11099
11130
  if (this.element.classList.contains('e-filtering')) {
11100
11131
  var oldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', dataUid_1, true));
11101
11132
  checkedCount = oldCheckedNodes.length;
11102
11133
  var parentNode = new DataManager(this.OldCheckedData).executeLocal(new Query().where('hasChildren', 'equal', true, true));
11103
- if ((parentNode.length > 0) && (this.OldCheckedData.some(function (oldNode) { return oldNode.id === dataUid_1; }))) {
11134
+ if (parentNode.length > 0
11135
+ && (this.OldCheckedData.some(function (oldNode) { return oldNode.id === dataUid_1; }) && childNodeChecked_1)) {
11104
11136
  checkedCount = parentNode.length;
11137
+ parentNodeChecked = true;
11105
11138
  }
11106
11139
  var childItems = [];
11107
11140
  if (this.dataType === 1) {
@@ -11112,12 +11145,23 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11112
11145
  }
11113
11146
  count = childItems.length;
11114
11147
  }
11148
+ if (this.autoCheck && this.showCheckBox) {
11149
+ var selectedChildNodeDetails = this.getSelectedChildNodeDetails(dataUid_1);
11150
+ matchedChildNodes = selectedChildNodeDetails;
11151
+ oldChildCount = new DataManager(this.checkActionNodes)
11152
+ .executeLocal(new Query().where('parentID', 'equal', dataUid_1, true));
11153
+ }
11115
11154
  if (count === 0 && checkedCount === 0) {
11116
11155
  return;
11117
11156
  }
11118
- else if (count === checkedCount) {
11157
+ else if (count === checkedCount || ((parentNodeChecked && count > 0) && (oldChildCount.length === matchedChildNodes.length)
11158
+ && (oldChildCount.length !== 0 && matchedChildNodes.length !== 0) && rootNodeChecked_1
11159
+ && (this.autoCheck && this.showCheckBox))) {
11119
11160
  this.changeState(checkBoxEle, 'check', null, true, true);
11120
11161
  }
11162
+ else if ((checkedCount > 0 && !parentNodeChecked && (this.autoCheck && this.showCheckBox))) {
11163
+ this.changeState(checkBoxEle, 'indeterminate', null, true, true);
11164
+ }
11121
11165
  else if (checkedCount > 0 || indeterminateNodes.length > 0) {
11122
11166
  this.changeState(checkBoxEle, 'indeterminate', null, true, true);
11123
11167
  }
@@ -11131,6 +11175,21 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11131
11175
  }
11132
11176
  }
11133
11177
  };
11178
+ TreeView.prototype.getSelectedChildNodeDetails = function (dataUid) {
11179
+ var _this = this;
11180
+ return this.checkedNodes
11181
+ .map(function (checkedNodeId) {
11182
+ return new DataManager(_this.DDTTreeData)
11183
+ .executeLocal(new Query().where('id', 'equal', checkedNodeId, true))[0];
11184
+ })
11185
+ .filter(function (childNode) {
11186
+ if (childNode && typeof childNode === 'object' && 'pid' in childNode) {
11187
+ var childNodePid = childNode.pid;
11188
+ return childNodePid.toString() === dataUid;
11189
+ }
11190
+ return false;
11191
+ });
11192
+ };
11134
11193
  TreeView.prototype.ensureChildCheckState = function (element, e, isFromExpandAll) {
11135
11194
  if (!isNullOrUndefined(element)) {
11136
11195
  var childElement = select('.' + PARENTITEM, element);
@@ -11762,6 +11821,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11762
11821
  this.trigger('nodeChecked', eventArgs);
11763
11822
  };
11764
11823
  TreeView.prototype.updateOldCheckedData = function (data) {
11824
+ var _this = this;
11765
11825
  var dataManager = new DataManager(data);
11766
11826
  var childItems = dataManager.executeLocal(new Query().where('isChecked', 'equal', 'true', true));
11767
11827
  var uncheckedItems = dataManager.executeLocal(new Query().where('isChecked', 'equal', 'false', true));
@@ -11769,6 +11829,15 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11769
11829
  var index = this.OldCheckedData.findIndex(function (e) { return e['id'] === uncheckedItems[0]['id']; });
11770
11830
  if (index !== -1) {
11771
11831
  this.OldCheckedData.splice(index, 1);
11832
+ var childNodes = this.OldCheckedData.filter(function (e) { return e['parentID'] === uncheckedItems[0]['id']; });
11833
+ if (childNodes.length > 0) {
11834
+ childNodes.forEach(function (child) {
11835
+ var childIndex = _this.OldCheckedData.findIndex(function (e) { return e['id'] === child.id; });
11836
+ if (childIndex !== -1) {
11837
+ _this.OldCheckedData.splice(childIndex, 1);
11838
+ }
11839
+ });
11840
+ }
11772
11841
  return;
11773
11842
  }
11774
11843
  }
@@ -15188,6 +15257,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
15188
15257
  for (var i = 0; i < nodes.length; i++) {
15189
15258
  var pid = getValue(this.fields.parentID, nodes[parseInt(i.toString(), 10)]);
15190
15259
  dropLi = pid ? this.getElement(pid.toString()) : pid;
15260
+ if (!isNullOrUndefined(pid) && isNullOrUndefined(dropLi)) {
15261
+ this.preventExpand = false;
15262
+ this.ensureVisible(pid);
15263
+ this.preventExpand = preventTargetExpand;
15264
+ dropLi = this.getElement(pid.toString());
15265
+ }
15191
15266
  this.addGivenNodes([nodes[parseInt(i.toString(), 10)]], dropLi, index);
15192
15267
  }
15193
15268
  }
@@ -15419,6 +15494,15 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
15419
15494
  * @param {string | Element} target - Specifies the ID of TreeView node or TreeView node as target element.
15420
15495
  * @param {Object[]} newData - Specifies the new data of TreeView node.
15421
15496
  * @returns {void}
15497
+ * ```typescript
15498
+ * var treeObj = document.getElementById("treeview").ej2_instances[0];
15499
+ * var data = treeObj.getTreeData("01");
15500
+ * var newData = {
15501
+ * id: data[0].id,
15502
+ * name: "new Text",
15503
+ * };
15504
+ * treeObj.refreshNode("01", [newData]);
15505
+ * ```
15422
15506
  */
15423
15507
  TreeView.prototype.refreshNode = function (target, newData) {
15424
15508
  if (isNullOrUndefined(target) || isNullOrUndefined(newData)) {
@@ -15534,7 +15618,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
15534
15618
  }
15535
15619
  };
15536
15620
  /**
15537
- * Replaces the text of the TreeView node with the given text.
15621
+ * Replaces the text of the TreeView node with the given text only when the `allowEditing` property is enabled.
15538
15622
  *
15539
15623
  * @param {string | Element} target - Specifies ID of TreeView node/TreeView node as target element.
15540
15624
  * @param {string} newText - Specifies the new text of TreeView node.
@@ -16119,6 +16203,9 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
16119
16203
  }
16120
16204
  };
16121
16205
  Sidebar.prototype.resize = function () {
16206
+ if (!isNullOrUndefined(this.width) && this.width !== 'auto' && typeof this.width === 'string' && !this.width.includes('px')) {
16207
+ this.setType(this.type);
16208
+ }
16122
16209
  if (this.type === 'Auto') {
16123
16210
  if (Browser.isDevice) {
16124
16211
  addClass([this.element], OVER);
@@ -17855,7 +17942,8 @@ var Carousel = /** @__PURE__ @class */ (function (_super) {
17855
17942
  this.applySlideInterval();
17856
17943
  };
17857
17944
  Carousel.prototype.autoSlideChange = function () {
17858
- var activeSlide = this.element.querySelector("." + CLS_ACTIVE$2);
17945
+ var activeSlide = this.element.querySelector("." + CLS_ITEM$3 + "." + CLS_ACTIVE$2)
17946
+ || this.element.querySelector("." + CLS_INDICATORS + " ." + CLS_ACTIVE$2);
17859
17947
  if (isNullOrUndefined(activeSlide)) {
17860
17948
  return;
17861
17949
  }