@syncfusion/ej2-navigations 27.1.58 → 27.2.3

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.
@@ -3208,6 +3208,10 @@ let MenuBase = class MenuBase extends Component {
3208
3208
  li = this.createItems(iitems).children[idx];
3209
3209
  const ul = this.isMenu ? select('.e-menu-parent', uls[navIdx.length]) : uls[navIdx.length];
3210
3210
  ul.insertBefore(li, ul.children[idx]);
3211
+ if (i === items.length - 1 && !this.isMenu && ul.style.display === 'block') {
3212
+ this.setPosition(null, ul, parseFloat(ul.style.top), parseFloat(ul.style.left));
3213
+ ul.style.display = 'block';
3214
+ }
3211
3215
  }
3212
3216
  }
3213
3217
  }
@@ -4888,9 +4892,9 @@ let Toolbar = class Toolbar extends Component {
4888
4892
  return;
4889
4893
  }
4890
4894
  const alignDiv = [];
4891
- alignDiv.push(this.createElement('div', { className: CLS_TBARLEFT }));
4892
- alignDiv.push(this.createElement('div', { className: CLS_TBARCENTER }));
4893
- alignDiv.push(this.createElement('div', { className: CLS_TBARRIGHT }));
4895
+ alignDiv.push(this.createElement('div', { className: CLS_TBARLEFT, attrs: { role: 'group' } }));
4896
+ alignDiv.push(this.createElement('div', { className: CLS_TBARCENTER, attrs: { role: 'group' } }));
4897
+ alignDiv.push(this.createElement('div', { className: CLS_TBARRIGHT, attrs: { role: 'group' } }));
4894
4898
  if (pos === 0 && item.align !== 'Left') {
4895
4899
  alignDiv.forEach((ele) => {
4896
4900
  itemEle.appendChild(ele);
@@ -7655,6 +7659,20 @@ let Tab = class Tab extends Component {
7655
7659
  this.renderReactTemplates();
7656
7660
  }
7657
7661
  }
7662
+ /**
7663
+ * Reorganizes and adjusts the Tab headers to fit the available width without re-rendering the entire Tab component.
7664
+ *
7665
+ * This method is useful for optimizing the layout when:
7666
+ * - A hidden tab item becomes visible.
7667
+ * - The number of tab items changes dynamically.
7668
+ *
7669
+ * @returns {void} This method does not return a value.
7670
+ */
7671
+ refreshOverflow() {
7672
+ if (!isNullOrUndefined(this.tbObj)) {
7673
+ this.tbObj.refreshOverflow();
7674
+ }
7675
+ }
7658
7676
  /**
7659
7677
  * Initialize component
7660
7678
  *
@@ -7699,9 +7717,7 @@ let Tab = class Tab extends Component {
7699
7717
  this.initRender = false;
7700
7718
  if (this.isReact && this.portals && this.portals.length > 0) {
7701
7719
  this.renderReactTemplates(() => {
7702
- if (!isNullOrUndefined(this.tbObj)) {
7703
- this.tbObj.refreshOverflow();
7704
- }
7720
+ this.refreshOverflow();
7705
7721
  this.refreshActiveBorder();
7706
7722
  });
7707
7723
  }
@@ -7995,7 +8011,7 @@ let Tab = class Tab extends Component {
7995
8011
  else {
7996
8012
  trg.classList.remove(CLS_CLOSE_SHOW);
7997
8013
  }
7998
- this.tbObj.refreshOverflow();
8014
+ this.refreshOverflow();
7999
8015
  this.refreshActiveTabBorder();
8000
8016
  }
8001
8017
  prevCtnAnimation(prev, current) {
@@ -9103,11 +9119,13 @@ let Tab = class Tab extends Component {
9103
9119
  else {
9104
9120
  this.dragItem.querySelector('.' + CLS_WRAP).style.visibility = '';
9105
9121
  removeClass([this.tbItems.querySelector('.' + CLS_INDICATOR)], CLS_HIDDEN$1);
9122
+ this.droppedIndex = isNullOrUndefined(this.droppedIndex) ? this.getEleIndex(this.dragItem) : this.droppedIndex;
9106
9123
  this.selectTab(this.droppedIndex, null, true);
9107
9124
  }
9108
9125
  }
9109
9126
  });
9110
9127
  this.dragItem = null;
9128
+ this.droppedIndex = null;
9111
9129
  }
9112
9130
  /**
9113
9131
  * Enables or disables the specified Tab item. On passing value as `false`, the item will be disabled.
@@ -9363,8 +9381,8 @@ let Tab = class Tab extends Component {
9363
9381
  if (!isNullOrUndefined(item.firstElementChild)) {
9364
9382
  item.firstElementChild.setAttribute('aria-hidden', '' + value);
9365
9383
  }
9366
- if (this.overflowMode === 'Popup' && this.tbObj) {
9367
- this.tbObj.refreshOverflow();
9384
+ if (this.overflowMode === 'Popup') {
9385
+ this.refreshOverflow();
9368
9386
  }
9369
9387
  }
9370
9388
  selectTab(args, event = null, isInteracted = false) {
@@ -10582,7 +10600,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10582
10600
  if (this.showCheckBox) {
10583
10601
  const checkboxEle = createCheckBox(this.createElement, true, { cssClass: this.touchClass });
10584
10602
  checkboxEle.classList.add(CHECKBOXWRAP);
10585
- const icon = select('div.' + ICON, e.item);
10603
+ const icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, e.item);
10586
10604
  const id = e.item.getAttribute('data-uid');
10587
10605
  e.item.childNodes[0].insertBefore(checkboxEle, e.item.childNodes[0].childNodes[isNullOrUndefined(icon) ? 0 : 1]);
10588
10606
  const checkValue = getValue(e.fields.isChecked, e.curData);
@@ -10813,7 +10831,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10813
10831
  }
10814
10832
  count = childItems.length;
10815
10833
  }
10816
- if (this.autoCheck && this.showCheckBox) {
10834
+ if (this.autoCheck && this.showCheckBox && !(this.fields.dataSource instanceof DataManager)) {
10817
10835
  const selectedChildNodeDetails = this.getSelectedChildNodeDetails(dataUid);
10818
10836
  matchedChildNodes = selectedChildNodeDetails;
10819
10837
  oldChildCount = new DataManager(this.checkActionNodes)
@@ -10862,10 +10880,24 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10862
10880
  const childElement = select('.' + PARENTITEM, element);
10863
10881
  let checkBoxes;
10864
10882
  if (!isNullOrUndefined(childElement)) {
10883
+ let childCheck = Array.from(childElement.querySelectorAll('li'));
10865
10884
  checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
10885
+ if (this.isFilter) {
10886
+ checkBoxes = Array.from(checkBoxes).filter((checkbox) => {
10887
+ const dataUID = checkbox.closest('li').getAttribute('data-uid');
10888
+ return dataUID !== null && this.checkedNodes.indexOf(dataUID) !== -1;
10889
+ });
10890
+ childCheck = Array.from(childCheck).filter((li) => {
10891
+ const childIds = li.getAttribute('data-uid');
10892
+ return childIds !== null && this.checkedNodes.indexOf(childIds) !== -1;
10893
+ });
10894
+ if (checkBoxes.length === 0) {
10895
+ checkBoxes = selectAll('.' + CHECKBOXWRAP, childElement);
10896
+ childCheck = Array.from(childElement.querySelectorAll('li'));
10897
+ }
10898
+ }
10866
10899
  const isChecked = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(CHECK);
10867
10900
  const parentCheck = element.getElementsByClassName(CHECKBOXFRAME)[0].classList.contains(INDETERMINATE);
10868
- const childCheck = childElement.querySelectorAll('li');
10869
10901
  let checkedState;
10870
10902
  for (let index = 0; index < checkBoxes.length; index++) {
10871
10903
  const childId = childCheck[parseInt(index.toString(), 10)].getAttribute('data-uid');
@@ -10928,7 +10960,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10928
10960
  ? nodes[parseInt(len.toString(), 10)].toString()
10929
10961
  : null;
10930
10962
  if (node !== '' && doCheck && node) {
10931
- this.setValidCheckedNode(node);
10963
+ this.setValidCheckedNode(node, nodes);
10932
10964
  this.dynamicCheckState(node, doCheck);
10933
10965
  }
10934
10966
  else if (this.checkedNodes.indexOf(node) !== -1 && node !== '' && !doCheck) {
@@ -12378,7 +12410,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12378
12410
  const parentIndex = li.getAttribute('data-uid');
12379
12411
  const mapper = this.fields;
12380
12412
  if (this.dataType === 1 && this.autoCheck) {
12381
- const resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.parentID, 'equal', parentIndex, true));
12413
+ let resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.parentID, 'equal', parentIndex, true));
12414
+ const childMatchesCheckedNodes = resultData.filter((item) => {
12415
+ return this.checkedNodes.indexOf(item[mapper.id].toString()) !== -1;
12416
+ }, this);
12417
+ if (this.checkedNodes.indexOf(parentIndex) !== -1 && childMatchesCheckedNodes.length !== resultData.length && this.isFilter) {
12418
+ if (childMatchesCheckedNodes.length > 0) {
12419
+ resultData = childMatchesCheckedNodes;
12420
+ }
12421
+ }
12382
12422
  for (let i = 0; i < resultData.length; i++) {
12383
12423
  const resultId = resultData[parseInt(i.toString(), 10)][this.fields.id]
12384
12424
  ? resultData[parseInt(i.toString(), 10)][this.fields.id].toString()
@@ -12441,8 +12481,15 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12441
12481
  }
12442
12482
  }
12443
12483
  else {
12444
- const childItems = this.getChildNodes(this.treeData, parentIndex);
12484
+ let childItems = this.getChildNodes(this.treeData, parentIndex);
12445
12485
  if (childItems) {
12486
+ const filteredChildItems = childItems.filter((item) => {
12487
+ const itemValue = String(item[Object.keys(item)[0]]);
12488
+ return this.checkedNodes.indexOf(itemValue) !== -1;
12489
+ });
12490
+ if (filteredChildItems.length > 0 && childItems.length && this.isFilter) {
12491
+ childItems = filteredChildItems;
12492
+ }
12446
12493
  this.childStateChange(childItems, parentIndex, childElement, doCheck);
12447
12494
  }
12448
12495
  }
@@ -12636,6 +12683,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12636
12683
  getFocusedNode() {
12637
12684
  let selectedItem;
12638
12685
  const fNode = select('.' + LISTITEM + '[tabindex="0"]', this.element);
12686
+ if (!isNullOrUndefined(fNode)) {
12687
+ const ariaChecked = fNode.getAttribute('aria-checked');
12688
+ if (ariaChecked === 'mixed' || ariaChecked === 'false') {
12689
+ this.isFilter = false;
12690
+ }
12691
+ }
12639
12692
  if (isNullOrUndefined(fNode)) {
12640
12693
  selectedItem = select('.' + LISTITEM, this.element);
12641
12694
  }
@@ -13502,7 +13555,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13502
13555
  }
13503
13556
  }
13504
13557
  expandParent(dropLi) {
13505
- const dropIcon = select('div.' + ICON, dropLi);
13558
+ const dropIcon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13506
13559
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && this.preventExpand !== true) {
13507
13560
  this.expandAction(dropLi, dropIcon, null);
13508
13561
  }
@@ -13521,7 +13574,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13521
13574
  if (isNullOrUndefined(dropIcon)) {
13522
13575
  ListBase.generateIcon(this.createElement, dropLi, EXPANDABLE, this.listBaseOption);
13523
13576
  }
13524
- const icon = select('div.' + ICON, dropLi);
13577
+ const icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13525
13578
  if (icon) {
13526
13579
  icon.classList.add('e-icon-expandable');
13527
13580
  }
@@ -13544,7 +13597,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13544
13597
  if (isNullOrUndefined(dropIcon)) {
13545
13598
  ListBase.generateIcon(this.createElement, dropLi, COLLAPSIBLE, this.listBaseOption);
13546
13599
  }
13547
- let icon = select('div.' + ICON, dropLi);
13600
+ let icon = select('div.' + EXPANDABLE + ', div.' + COLLAPSIBLE, dropLi);
13548
13601
  if (icon) {
13549
13602
  removeClass([icon], EXPANDABLE);
13550
13603
  }
@@ -13558,6 +13611,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13558
13611
  this.addExpand(dropLi);
13559
13612
  this.trigger('nodeExpanded', this.getExpandEvent(dropLi, null));
13560
13613
  }
13614
+ const collapseIcon = select('div.' + COLLAPSIBLE, dropLi);
13615
+ if (!isNullOrUndefined(dropUl) && collapseIcon && this.preventExpand) {
13616
+ removeClass([collapseIcon], COLLAPSIBLE);
13617
+ dropLi.setAttribute('aria-expanded', 'false');
13618
+ addClass([collapseIcon], EXPANDABLE);
13619
+ }
13561
13620
  return dropUl;
13562
13621
  }
13563
13622
  updateElement(dragParentUl, dragParentLi) {
@@ -13880,7 +13939,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13880
13939
  if (!isNullOrUndefined(dropLi)) {
13881
13940
  dropIcon1 = select('div.' + ICON, dropLi);
13882
13941
  }
13883
- if (this.dataType === 1 && dropIcon1 && dropIcon1.classList.contains(EXPANDABLE) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13942
+ if (this.dataType === 1 && dropIcon1 && dropIcon1.classList.contains(EXPANDABLE) && this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13884
13943
  this.preventExpand = true;
13885
13944
  }
13886
13945
  if (this.dataType !== 1) {
@@ -13901,7 +13960,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13901
13960
  for (let i = 0; i < li.length; i++) {
13902
13961
  dropUl.insertBefore(li[parseInt(i.toString(), 10)], refNode);
13903
13962
  }
13904
- if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13963
+ if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13905
13964
  this.preventExpand = false;
13906
13965
  const dropIcon = select('div.' + ICON, dropLi);
13907
13966
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name !== 'nodeExpanding')) {
@@ -13914,7 +13973,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13914
13973
  for (let i = 0; i < li.length; i++) {
13915
13974
  dropUl.insertBefore(li[parseInt(i.toString(), 10)], refNode);
13916
13975
  }
13917
- if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13976
+ if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !this.preventExpand && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13918
13977
  this.preventExpand = false;
13919
13978
  const dropIcon = select('div.' + ICON, dropLi);
13920
13979
  if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name !== 'nodeExpanding')) {
@@ -14368,6 +14427,9 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14368
14427
  }
14369
14428
  setCheckedNodes(nodes) {
14370
14429
  nodes = JSON.parse(JSON.stringify(nodes));
14430
+ if (nodes.length > 1 && typeof this.nodeChecked === 'function' && this.nodeChecked.length > 0) {
14431
+ this.isFilter = true;
14432
+ }
14371
14433
  this.uncheckAll(this.checkedNodes);
14372
14434
  this.setIndeterminate(nodes);
14373
14435
  if (nodes.length > 0) {
@@ -14378,15 +14440,16 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14378
14440
  * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel
14379
14441
  *
14380
14442
  * @param {string} node - The unique identifier of the node.
14443
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14381
14444
  * @returns {void}
14382
14445
  * @private
14383
14446
  */
14384
- setValidCheckedNode(node) {
14447
+ setValidCheckedNode(node, nodes = []) {
14385
14448
  if (this.dataType === 1) {
14386
14449
  const mapper = this.fields;
14387
14450
  const resultData = new DataManager(this.treeData).executeLocal(new Query().where(mapper.id, 'equal', node, true));
14388
14451
  if (resultData[0]) {
14389
- this.setChildCheckState(resultData, node, resultData[0]);
14452
+ this.setChildCheckState(resultData, node, resultData[0], nodes);
14390
14453
  if (this.autoCheck) {
14391
14454
  const parent = resultData[0][this.fields.parentID] ? resultData[0][this.fields.parentID].toString() : null;
14392
14455
  const childNodes = this.getChildNodes(this.treeData, parent);
@@ -14412,7 +14475,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14412
14475
  }
14413
14476
  const childItems = getValue(this.fields.child.toString(), this.treeData[parseInt(a.toString(), 10)]);
14414
14477
  if (childItems) {
14415
- this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)]);
14478
+ this.setChildCheckState(childItems, node, this.treeData[parseInt(a.toString(), 10)], nodes);
14416
14479
  }
14417
14480
  }
14418
14481
  }
@@ -14426,7 +14489,17 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14426
14489
  * @returns {void}
14427
14490
  * @private
14428
14491
  */
14429
- setChildCheckState(childItems, node, treeData) {
14492
+ /**
14493
+ * Checks whether the checkedNodes entered are valid and sets the valid checkedNodes while changing via setmodel(for hierarchical DS)
14494
+ *
14495
+ * @param {Object[]} childItems - The child items to check.
14496
+ * @param {string} node - The node to set the check state for.
14497
+ * @param {Object} [treeData] - The optional tree data.
14498
+ * @param {string[]} [nodes=[]] - The list of node IDs to check.
14499
+ * @returns {void}
14500
+ * @private
14501
+ */
14502
+ setChildCheckState(childItems, node, treeData, nodes = []) {
14430
14503
  let checkedParent;
14431
14504
  let count = 0;
14432
14505
  if (this.dataType === 1) {
@@ -14446,7 +14519,8 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14446
14519
  this.checkDisabledState(node);
14447
14520
  }
14448
14521
  const subChildItems = this.getChildNodes(this.treeData, checkNode);
14449
- if (subChildItems) {
14522
+ const isParentNodeCheck = (nodes.length === 1 && nodes[0] === checkNode);
14523
+ if (subChildItems.length === node.length || isParentNodeCheck) {
14450
14524
  this.setChildCheckState(subChildItems, node, treeData);
14451
14525
  }
14452
14526
  }
@@ -14457,8 +14531,10 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14457
14531
  }
14458
14532
  for (let index = 0; index < childItems.length; index++) {
14459
14533
  const checkedChild = childItems[parseInt(index.toString(), 10)][this.fields.id] ? childItems[parseInt(index.toString(), 10)][this.fields.id].toString() : '';
14534
+ const isParentNodeCheck = ([node].length === 1 && nodes.length === 0);
14460
14535
  if (treeData && checkedParent && this.autoCheck) {
14461
- if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1) {
14536
+ if (this.checkedNodes.indexOf(checkedParent) !== -1 && this.checkedNodes.indexOf(checkedChild) === -1
14537
+ && (checkedChild === node || isParentNodeCheck)) {
14462
14538
  this.checkDisabledState(checkedChild, childItems[index]);
14463
14539
  }
14464
14540
  }
@@ -14480,7 +14556,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
14480
14556
  }
14481
14557
  setIndeterminate(nodes) {
14482
14558
  for (let i = 0; i < nodes.length; i++) {
14483
- this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)]);
14559
+ this.setValidCheckedNode(nodes[parseInt(i.toString(), 10)], nodes);
14484
14560
  }
14485
14561
  }
14486
14562
  updatePosition(id, newData, isRefreshChild, childValue) {