@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.
@@ -2285,8 +2285,8 @@ let MenuBase = class MenuBase extends Component {
2285
2285
  ul.style.left = left + px;
2286
2286
  }
2287
2287
  }
2288
- getMenuWidth(cmenu, width, isRtl) {
2289
- const caretIcon = cmenu.getElementsByClassName(CARET)[0];
2288
+ getMenuWidth(menuElement, width, isRtl) {
2289
+ const caretIcon = menuElement.getElementsByClassName(CARET)[0];
2290
2290
  if (caretIcon) {
2291
2291
  width += parseInt(getComputedStyle(caretIcon)[isRtl ? 'marginRight' : 'marginLeft'], 10);
2292
2292
  }
@@ -2364,7 +2364,7 @@ let MenuBase = class MenuBase extends Component {
2364
2364
  args.item.setAttribute('aria-expanded', 'false');
2365
2365
  args.item.classList.add('e-menu-caret-icon');
2366
2366
  }
2367
- if (this.isMenu && this.template) {
2367
+ if (this.template) {
2368
2368
  args.item.setAttribute('id', args.curData[args.fields.id].toString());
2369
2369
  args.item.removeAttribute('data-uid');
2370
2370
  if (args.item.classList.contains('e-level-1')) {
@@ -4895,7 +4895,10 @@ let Toolbar = class Toolbar extends Component {
4895
4895
  }
4896
4896
  popupEleWidth(el) {
4897
4897
  el.style.position = 'absolute';
4898
- let elWidth = this.isVertical ? el.offsetHeight : el.offsetWidth;
4898
+ const style = window.getComputedStyle(el);
4899
+ let elWidth = this.isVertical
4900
+ ? el.offsetHeight
4901
+ : el.offsetWidth + parseFloat(style.marginLeft) + parseFloat(style.marginRight);
4899
4902
  const btnText = el.querySelector('.' + CLS_TBARBTNTEXT);
4900
4903
  if (el.classList.contains('e-tbtn-align') || el.classList.contains(CLS_TBARTEXT)) {
4901
4904
  const btn = el.children[0];
@@ -5521,6 +5524,10 @@ let Toolbar = class Toolbar extends Component {
5521
5524
  return isNullOrUndefined(ele.getAttribute('data-tabindex')) ? '-1' : ele.getAttribute('data-tabindex');
5522
5525
  }
5523
5526
  itemClick(e) {
5527
+ const itemClosest = !isNullOrUndefined(closest(e.currentTarget, '.' + CLS_TEMPLATE));
5528
+ if (itemClosest) {
5529
+ return;
5530
+ }
5524
5531
  this.activeEleSwitch(e.currentTarget);
5525
5532
  }
5526
5533
  activeEleSwitch(ele) {
@@ -11782,8 +11789,9 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11782
11789
  const rippleIcons = select('.' + ICON, li);
11783
11790
  this.removeHover();
11784
11791
  this.setFocusElement(li);
11785
- if (this.showCheckBox && !li.classList.contains('e-disable')) {
11786
- const checkWrapper = closest(target, '.' + CHECKBOXWRAP);
11792
+ const isExpandCollapseIcon = classList.contains(EXPANDABLE) || classList.contains(COLLAPSIBLE);
11793
+ if (this.showCheckBox && !li.classList.contains('e-disable') && !isExpandCollapseIcon) {
11794
+ const checkWrapper = this.checkOnClick ? select('.' + CHECKBOXWRAP, li) : closest(target, '.' + CHECKBOXWRAP);
11787
11795
  if (!isNullOrUndefined(checkWrapper)) {
11788
11796
  const checkElement = select('.' + CHECKBOXFRAME, checkWrapper);
11789
11797
  this.validateCheckNode(checkWrapper, checkElement.classList.contains(CHECK), li, event.originalEvent);
@@ -12332,6 +12340,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12332
12340
  }
12333
12341
  selectNode(li, e, multiSelect) {
12334
12342
  if (isNullOrUndefined(li) || (!this.allowMultiSelection && this.isActive(li) && !isNullOrUndefined(e))) {
12343
+ if (this.checkOnClick) {
12344
+ const checkboxElement = select(' .' + CHECKBOXFRAME, li);
12345
+ if (!isNullOrUndefined(checkboxElement) && checkboxElement.classList.contains(CHECK)) {
12346
+ addClass([li], ACTIVE);
12347
+ }
12348
+ else {
12349
+ removeClass([li], ACTIVE);
12350
+ }
12351
+ }
12335
12352
  this.setFocusElement(li);
12336
12353
  return;
12337
12354
  }
@@ -12516,6 +12533,9 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12516
12533
  else {
12517
12534
  this.isFirstRender = true;
12518
12535
  this.renderChildNodes(currLi, expandChild, callback, null, isFromExpandAll);
12536
+ if (isNullOrUndefined(this.expandChildren) || this.expandChildren.length === 0) {
12537
+ return;
12538
+ }
12519
12539
  const liEles = selectAll('.' + LISTITEM, currLi);
12520
12540
  for (let i = 0; i < liEles.length; i++) {
12521
12541
  const id = this.getId(liEles[parseInt(i.toString(), 10)]);
@@ -12697,6 +12717,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12697
12717
  }
12698
12718
  }
12699
12719
  this.changeState(checkWrap, isCheck ? 'uncheck' : 'check', e, true);
12720
+ this.updateActiveClass(li, isCheck);
12700
12721
  if (this.autoCheck) {
12701
12722
  this.ensureChildCheckState(li);
12702
12723
  this.updateOldCheckedData([this.getNodeData(li)]);
@@ -12712,6 +12733,17 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12712
12733
  }
12713
12734
  this.nodeCheckedEvent(checkWrap, isCheck, e);
12714
12735
  }
12736
+ updateActiveClass(liElement, checkStatus) {
12737
+ if (this.showCheckBox && this.checkOnClick) {
12738
+ if (checkStatus === 'check' || checkStatus === false) {
12739
+ this.removeSelectAll();
12740
+ addClass([liElement], ACTIVE);
12741
+ }
12742
+ else if (checkStatus === 'uncheck' || checkStatus === 'indeterminate' || checkStatus === true) {
12743
+ removeClass([liElement], ACTIVE);
12744
+ }
12745
+ }
12746
+ }
12715
12747
  /**
12716
12748
  * Update checkedNodes when UI interaction happens before the child node renders in DOM
12717
12749
  *
@@ -13143,11 +13175,11 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13143
13175
  removeClass(hoveredNode, HOVER);
13144
13176
  }
13145
13177
  }
13146
- getNodeData(currLi, fromDS) {
13178
+ getNodeData(currLi, fromDS, dragData) {
13147
13179
  if (!isNullOrUndefined(currLi) && currLi.classList.contains(LISTITEM) &&
13148
13180
  !isNullOrUndefined(closest(currLi, '.' + CONTROL)) && closest(currLi, '.' + CONTROL).classList.contains(ROOT)) {
13149
13181
  const id = currLi.getAttribute('data-uid');
13150
- const text = this.getText(currLi, fromDS);
13182
+ const text = this.getText(currLi, fromDS, dragData);
13151
13183
  const pNode = closest(currLi.parentNode, '.' + LISTITEM);
13152
13184
  const pid = pNode ? pNode.getAttribute('data-uid') : null;
13153
13185
  const selected = currLi.classList.contains(ACTIVE);
@@ -13166,12 +13198,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13166
13198
  }
13167
13199
  return { id: '', text: '', parentID: '', selected: false, expanded: false, isChecked: '', hasChildren: false };
13168
13200
  }
13169
- getText(currLi, fromDS) {
13201
+ getText(currLi, fromDS, dragData) {
13170
13202
  if (fromDS) {
13171
- const nodeData = this.getNodeObject(currLi.getAttribute('data-uid'));
13203
+ const nodeData = !isNullOrUndefined(dragData) ? dragData : this.getNodeObject(currLi.getAttribute('data-uid'));
13172
13204
  const level = parseFloat(currLi.getAttribute('aria-level'));
13173
13205
  const nodeFields = this.getFields(this.fields, level, 1);
13174
- return getValue(nodeFields.text, nodeData);
13206
+ return !isNullOrUndefined(dragData) ? dragData.text : getValue(nodeFields.text, nodeData);
13175
13207
  }
13176
13208
  return select('.' + LISTTEXT, currLi).textContent;
13177
13209
  }
@@ -13724,8 +13756,9 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13724
13756
  if (this.fields.dataSource instanceof DataManager === false) {
13725
13757
  this.preventExpand = false;
13726
13758
  }
13759
+ const dragData = isNullOrUndefined(dragObj) ? null : dragObj.dragData;
13727
13760
  for (let i = 0; i < liArray.length; i++) {
13728
- nodeData.push(this.getNode(liArray[parseInt(i.toString(), 10)]));
13761
+ nodeData.push(this.getNodeData(this.getElement(liArray[parseInt(i.toString(), 10)]), true, dragData));
13729
13762
  }
13730
13763
  this.trigger('nodeDropped', this.getDragEvent(e.event, dragObj, dropTarget, e.target, e.dragData.draggedElement, null, level, drop));
13731
13764
  if (dragObj.element.id !== this.element.id) {
@@ -13840,7 +13873,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13840
13873
  const id = this.getId(dragLi);
13841
13874
  const removedData = dragObj.updateChildField(dragObj.treeData, dragObj.fields, id, null, null, true);
13842
13875
  const refId = this.getId(dropLi);
13843
- const index = this.getDataPos(this.treeData, this.fields, refId);
13876
+ const index = refId ? this.getDataPos(this.treeData, this.fields, refId) : null;
13844
13877
  const parentId = this.getId(dropParentLi);
13845
13878
  if (this.dataType === 1) {
13846
13879
  this.updateField(this.treeData, this.fields, parentId, 'hasChildren', true);
@@ -15750,6 +15783,9 @@ __decorate$8([
15750
15783
  __decorate$8([
15751
15784
  Property(false)
15752
15785
  ], TreeView.prototype, "showCheckBox", void 0);
15786
+ __decorate$8([
15787
+ Property(false)
15788
+ ], TreeView.prototype, "checkOnClick", void 0);
15753
15789
  __decorate$8([
15754
15790
  Property(true)
15755
15791
  ], TreeView.prototype, "autoCheck", void 0);