@syncfusion/ej2-navigations 29.1.41 → 29.2.5

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.
@@ -2375,8 +2375,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
2375
2375
  ul.style.left = left + px;
2376
2376
  }
2377
2377
  };
2378
- MenuBase.prototype.getMenuWidth = function (cmenu, width, isRtl) {
2379
- var caretIcon = cmenu.getElementsByClassName(CARET)[0];
2378
+ MenuBase.prototype.getMenuWidth = function (menuElement, width, isRtl) {
2379
+ var caretIcon = menuElement.getElementsByClassName(CARET)[0];
2380
2380
  if (caretIcon) {
2381
2381
  width += parseInt(getComputedStyle(caretIcon)[isRtl ? 'marginRight' : 'marginLeft'], 10);
2382
2382
  }
@@ -2456,7 +2456,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
2456
2456
  args.item.setAttribute('aria-expanded', 'false');
2457
2457
  args.item.classList.add('e-menu-caret-icon');
2458
2458
  }
2459
- if (_this.isMenu && _this.template) {
2459
+ if (_this.template) {
2460
2460
  args.item.setAttribute('id', args.curData[args.fields.id].toString());
2461
2461
  args.item.removeAttribute('data-uid');
2462
2462
  if (args.item.classList.contains('e-level-1')) {
@@ -5038,7 +5038,10 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
5038
5038
  };
5039
5039
  Toolbar.prototype.popupEleWidth = function (el) {
5040
5040
  el.style.position = 'absolute';
5041
- var elWidth = this.isVertical ? el.offsetHeight : el.offsetWidth;
5041
+ var style = window.getComputedStyle(el);
5042
+ var elWidth = this.isVertical
5043
+ ? el.offsetHeight
5044
+ : el.offsetWidth + parseFloat(style.marginLeft) + parseFloat(style.marginRight);
5042
5045
  var btnText = el.querySelector('.' + CLS_TBARBTNTEXT);
5043
5046
  if (el.classList.contains('e-tbtn-align') || el.classList.contains(CLS_TBARTEXT)) {
5044
5047
  var btn = el.children[0];
@@ -5676,6 +5679,10 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
5676
5679
  return isNullOrUndefined(ele.getAttribute('data-tabindex')) ? '-1' : ele.getAttribute('data-tabindex');
5677
5680
  };
5678
5681
  Toolbar.prototype.itemClick = function (e) {
5682
+ var itemClosest = !isNullOrUndefined(closest(e.currentTarget, '.' + CLS_TEMPLATE));
5683
+ if (itemClosest) {
5684
+ return;
5685
+ }
5679
5686
  this.activeEleSwitch(e.currentTarget);
5680
5687
  };
5681
5688
  Toolbar.prototype.activeEleSwitch = function (ele) {
@@ -12120,8 +12127,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12120
12127
  var rippleIcons = select('.' + ICON, li);
12121
12128
  this.removeHover();
12122
12129
  this.setFocusElement(li);
12123
- if (this.showCheckBox && !li.classList.contains('e-disable')) {
12124
- var checkWrapper = closest(target, '.' + CHECKBOXWRAP);
12130
+ var isExpandCollapseIcon = classList.contains(EXPANDABLE) || classList.contains(COLLAPSIBLE);
12131
+ if (this.showCheckBox && !li.classList.contains('e-disable') && !isExpandCollapseIcon) {
12132
+ var checkWrapper = this.checkOnClick ? select('.' + CHECKBOXWRAP, li) : closest(target, '.' + CHECKBOXWRAP);
12125
12133
  if (!isNullOrUndefined(checkWrapper)) {
12126
12134
  var checkElement = select('.' + CHECKBOXFRAME, checkWrapper);
12127
12135
  this.validateCheckNode(checkWrapper, checkElement.classList.contains(CHECK), li, event.originalEvent);
@@ -12683,6 +12691,15 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12683
12691
  TreeView.prototype.selectNode = function (li, e, multiSelect) {
12684
12692
  var _this = this;
12685
12693
  if (isNullOrUndefined(li) || (!this.allowMultiSelection && this.isActive(li) && !isNullOrUndefined(e))) {
12694
+ if (this.checkOnClick) {
12695
+ var checkboxElement = select(' .' + CHECKBOXFRAME, li);
12696
+ if (!isNullOrUndefined(checkboxElement) && checkboxElement.classList.contains(CHECK)) {
12697
+ addClass([li], ACTIVE);
12698
+ }
12699
+ else {
12700
+ removeClass([li], ACTIVE);
12701
+ }
12702
+ }
12686
12703
  this.setFocusElement(li);
12687
12704
  return;
12688
12705
  }
@@ -12870,6 +12887,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12870
12887
  else {
12871
12888
  this.isFirstRender = true;
12872
12889
  this.renderChildNodes(currLi, expandChild, callback, null, isFromExpandAll);
12890
+ if (isNullOrUndefined(this.expandChildren) || this.expandChildren.length === 0) {
12891
+ return;
12892
+ }
12873
12893
  var liEles = selectAll('.' + LISTITEM, currLi);
12874
12894
  for (var i = 0; i < liEles.length; i++) {
12875
12895
  var id = this.getId(liEles[parseInt(i.toString(), 10)]);
@@ -13053,6 +13073,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13053
13073
  }
13054
13074
  }
13055
13075
  this.changeState(checkWrap, isCheck ? 'uncheck' : 'check', e, true);
13076
+ this.updateActiveClass(li, isCheck);
13056
13077
  if (this.autoCheck) {
13057
13078
  this.ensureChildCheckState(li);
13058
13079
  this.updateOldCheckedData([this.getNodeData(li)]);
@@ -13068,6 +13089,17 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13068
13089
  }
13069
13090
  this.nodeCheckedEvent(checkWrap, isCheck, e);
13070
13091
  };
13092
+ TreeView.prototype.updateActiveClass = function (liElement, checkStatus) {
13093
+ if (this.showCheckBox && this.checkOnClick) {
13094
+ if (checkStatus === 'check' || checkStatus === false) {
13095
+ this.removeSelectAll();
13096
+ addClass([liElement], ACTIVE);
13097
+ }
13098
+ else if (checkStatus === 'uncheck' || checkStatus === 'indeterminate' || checkStatus === true) {
13099
+ removeClass([liElement], ACTIVE);
13100
+ }
13101
+ }
13102
+ };
13071
13103
  /**
13072
13104
  * Update checkedNodes when UI interaction happens before the child node renders in DOM
13073
13105
  *
@@ -13500,11 +13532,11 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13500
13532
  removeClass(hoveredNode, HOVER);
13501
13533
  }
13502
13534
  };
13503
- TreeView.prototype.getNodeData = function (currLi, fromDS) {
13535
+ TreeView.prototype.getNodeData = function (currLi, fromDS, dragData) {
13504
13536
  if (!isNullOrUndefined(currLi) && currLi.classList.contains(LISTITEM) &&
13505
13537
  !isNullOrUndefined(closest(currLi, '.' + CONTROL)) && closest(currLi, '.' + CONTROL).classList.contains(ROOT)) {
13506
13538
  var id = currLi.getAttribute('data-uid');
13507
- var text = this.getText(currLi, fromDS);
13539
+ var text = this.getText(currLi, fromDS, dragData);
13508
13540
  var pNode = closest(currLi.parentNode, '.' + LISTITEM);
13509
13541
  var pid = pNode ? pNode.getAttribute('data-uid') : null;
13510
13542
  var selected = currLi.classList.contains(ACTIVE);
@@ -13523,12 +13555,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13523
13555
  }
13524
13556
  return { id: '', text: '', parentID: '', selected: false, expanded: false, isChecked: '', hasChildren: false };
13525
13557
  };
13526
- TreeView.prototype.getText = function (currLi, fromDS) {
13558
+ TreeView.prototype.getText = function (currLi, fromDS, dragData) {
13527
13559
  if (fromDS) {
13528
- var nodeData = this.getNodeObject(currLi.getAttribute('data-uid'));
13560
+ var nodeData = !isNullOrUndefined(dragData) ? dragData : this.getNodeObject(currLi.getAttribute('data-uid'));
13529
13561
  var level = parseFloat(currLi.getAttribute('aria-level'));
13530
13562
  var nodeFields = this.getFields(this.fields, level, 1);
13531
- return getValue(nodeFields.text, nodeData);
13563
+ return !isNullOrUndefined(dragData) ? dragData.text : getValue(nodeFields.text, nodeData);
13532
13564
  }
13533
13565
  return select('.' + LISTTEXT, currLi).textContent;
13534
13566
  };
@@ -14084,8 +14116,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14084
14116
  if (this.fields.dataSource instanceof DataManager === false) {
14085
14117
  this.preventExpand = false;
14086
14118
  }
14119
+ var dragData = isNullOrUndefined(dragObj) ? null : dragObj.dragData;
14087
14120
  for (var i = 0; i < liArray.length; i++) {
14088
- nodeData.push(this.getNode(liArray[parseInt(i.toString(), 10)]));
14121
+ nodeData.push(this.getNodeData(this.getElement(liArray[parseInt(i.toString(), 10)]), true, dragData));
14089
14122
  }
14090
14123
  this.trigger('nodeDropped', this.getDragEvent(e.event, dragObj, dropTarget, e.target, e.dragData.draggedElement, null, level, drop));
14091
14124
  if (dragObj.element.id !== this.element.id) {
@@ -14200,7 +14233,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14200
14233
  var id = this.getId(dragLi);
14201
14234
  var removedData = dragObj.updateChildField(dragObj.treeData, dragObj.fields, id, null, null, true);
14202
14235
  var refId = this.getId(dropLi);
14203
- var index = this.getDataPos(this.treeData, this.fields, refId);
14236
+ var index = refId ? this.getDataPos(this.treeData, this.fields, refId) : null;
14204
14237
  var parentId = this.getId(dropParentLi);
14205
14238
  if (this.dataType === 1) {
14206
14239
  this.updateField(this.treeData, this.fields, parentId, 'hasChildren', true);
@@ -16128,6 +16161,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16128
16161
  __decorate$8([
16129
16162
  Property(false)
16130
16163
  ], TreeView.prototype, "showCheckBox", void 0);
16164
+ __decorate$8([
16165
+ Property(false)
16166
+ ], TreeView.prototype, "checkOnClick", void 0);
16131
16167
  __decorate$8([
16132
16168
  Property(true)
16133
16169
  ], TreeView.prototype, "autoCheck", void 0);