@syncfusion/ej2-navigations 34.2.2 → 34.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.
Files changed (79) hide show
  1. package/dist/ej2-navigations.min.js +2 -2
  2. package/dist/ej2-navigations.umd.min.js +2 -2
  3. package/dist/ej2-navigations.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-navigations.es2015.js +121 -32
  5. package/dist/es6/ej2-navigations.es2015.js.map +1 -1
  6. package/dist/es6/ej2-navigations.es5.js +121 -32
  7. package/dist/es6/ej2-navigations.es5.js.map +1 -1
  8. package/dist/global/ej2-navigations.min.js +2 -2
  9. package/dist/global/ej2-navigations.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +2 -2
  12. package/src/common/menu-base.js +14 -6
  13. package/src/treeview/treeview-model.d.ts +1 -0
  14. package/src/treeview/treeview.d.ts +14 -1
  15. package/src/treeview/treeview.js +107 -26
  16. package/styles/bds-lite.css +3 -0
  17. package/styles/bds.css +3 -0
  18. package/styles/bootstrap-dark-lite.css +3 -0
  19. package/styles/bootstrap-dark.css +3 -0
  20. package/styles/bootstrap-lite.css +3 -0
  21. package/styles/bootstrap.css +3 -0
  22. package/styles/bootstrap4-lite.css +3 -0
  23. package/styles/bootstrap4.css +3 -0
  24. package/styles/bootstrap5-dark-lite.css +3 -0
  25. package/styles/bootstrap5-dark.css +3 -0
  26. package/styles/bootstrap5-lite.css +3 -0
  27. package/styles/bootstrap5.3-lite.css +3 -0
  28. package/styles/bootstrap5.3.css +3 -0
  29. package/styles/bootstrap5.css +3 -0
  30. package/styles/fabric-dark-lite.css +3 -0
  31. package/styles/fabric-dark.css +3 -0
  32. package/styles/fabric-lite.css +3 -0
  33. package/styles/fabric.css +3 -0
  34. package/styles/fluent-dark-lite.css +3 -0
  35. package/styles/fluent-dark.css +3 -0
  36. package/styles/fluent-lite.css +3 -0
  37. package/styles/fluent.css +3 -0
  38. package/styles/fluent2-lite.css +3 -0
  39. package/styles/fluent2.css +3 -0
  40. package/styles/highcontrast-light-lite.css +3 -0
  41. package/styles/highcontrast-light.css +3 -0
  42. package/styles/highcontrast-lite.css +3 -0
  43. package/styles/highcontrast.css +3 -0
  44. package/styles/material-dark-lite.css +3 -0
  45. package/styles/material-dark.css +3 -0
  46. package/styles/material-lite.css +3 -0
  47. package/styles/material.css +3 -0
  48. package/styles/material3-dark-lite.css +3 -0
  49. package/styles/material3-dark.css +3 -0
  50. package/styles/material3-lite.css +3 -0
  51. package/styles/material3.css +3 -0
  52. package/styles/tailwind-dark-lite.css +3 -0
  53. package/styles/tailwind-dark.css +3 -0
  54. package/styles/tailwind-lite.css +3 -0
  55. package/styles/tailwind.css +3 -0
  56. package/styles/tailwind3-lite.css +3 -0
  57. package/styles/tailwind3.css +3 -0
  58. package/styles/toolbar/_layout.scss +4 -0
  59. package/styles/toolbar/bds.css +3 -0
  60. package/styles/toolbar/bootstrap-dark.css +3 -0
  61. package/styles/toolbar/bootstrap.css +3 -0
  62. package/styles/toolbar/bootstrap4.css +3 -0
  63. package/styles/toolbar/bootstrap5-dark.css +3 -0
  64. package/styles/toolbar/bootstrap5.3.css +3 -0
  65. package/styles/toolbar/bootstrap5.css +3 -0
  66. package/styles/toolbar/fabric-dark.css +3 -0
  67. package/styles/toolbar/fabric.css +3 -0
  68. package/styles/toolbar/fluent-dark.css +3 -0
  69. package/styles/toolbar/fluent.css +3 -0
  70. package/styles/toolbar/fluent2.css +3 -0
  71. package/styles/toolbar/highcontrast-light.css +3 -0
  72. package/styles/toolbar/highcontrast.css +3 -0
  73. package/styles/toolbar/material-dark.css +3 -0
  74. package/styles/toolbar/material.css +3 -0
  75. package/styles/toolbar/material3-dark.css +3 -0
  76. package/styles/toolbar/material3.css +3 -0
  77. package/styles/toolbar/tailwind-dark.css +3 -0
  78. package/styles/toolbar/tailwind.css +3 -0
  79. package/styles/toolbar/tailwind3.css +3 -0
@@ -1506,8 +1506,10 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1506
1506
  if (!active) {
1507
1507
  return;
1508
1508
  }
1509
+ var isInputElement = active.tagName === 'INPUT' || active.tagName === 'TEXTAREA' ||
1510
+ active.contentEditable === 'true';
1509
1511
  var expanded = active.getAttribute('aria-expanded') === 'true';
1510
- if (!expanded) {
1512
+ if (!expanded || isInputElement) {
1511
1513
  return;
1512
1514
  }
1513
1515
  var ul = this.element;
@@ -1621,13 +1623,19 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1621
1623
  var cli = cul.children[fliIdx];
1622
1624
  fliIdx = this.isValidLI(cli, fliIdx, e.action);
1623
1625
  cul.children[fliIdx].classList.add(FOCUSED);
1624
- cul.children[fliIdx].focus();
1626
+ var liToFocus = cul.children[fliIdx];
1625
1627
  if (closest(this.element, '.e-popup')) {
1626
- var focusedLiItem = cul.children[fliIdx];
1627
- var focusableChild = focusedLiItem.querySelector('[tabindex], span[tabindex], a, button, [tabindex]:not([tabindex="-1"])');
1628
- if (!focusableChild) {
1629
- cul.focus();
1628
+ var focusableChild = liToFocus.querySelector('[tabindex], span[tabindex], a, button, [tabindex]:not([tabindex="-1"])');
1629
+ var isSpreadsheet = this.element.id.includes('_cf_menu') && this.element.parentElement.classList.contains('e-cf-menu');
1630
+ if (focusableChild && !isSpreadsheet) {
1631
+ focusableChild.focus();
1630
1632
  }
1633
+ else {
1634
+ liToFocus.focus();
1635
+ }
1636
+ }
1637
+ else {
1638
+ liToFocus.focus();
1631
1639
  }
1632
1640
  };
1633
1641
  MenuBase.prototype.isValidLI = function (cli, index, action) {
@@ -12495,7 +12503,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12495
12503
  this.virtualIndeterminateNodesSet.delete(id);
12496
12504
  this.virtualCheckedNodesSet.delete(id);
12497
12505
  this.virtualFlatNodes[parseInt(actualIndex.toString(), 10)].isChecked = false;
12498
- this.treeData[parseInt(id.toString(), 10) - 1].isChecked = false;
12506
+ if (this.treeData && this.fields && this.fields.isChecked) {
12507
+ setValue(this.fields.isChecked, false, this.treeData[parseInt(id.toString(), 10) - 1]);
12508
+ }
12499
12509
  if (this.autoCheck && this.virtualFlatNodes[parseInt(actualIndex.toString(), 10)].hasChildren) {
12500
12510
  this.setVirtualChildCheckState(id, false);
12501
12511
  }
@@ -13444,6 +13454,13 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13444
13454
  if (!isNullOrUndefined(id) && this.selectedNodes.indexOf(id) === -1) {
13445
13455
  this.selectedNodes.push(id);
13446
13456
  }
13457
+ if (this.enableVirtualization && !isNullOrUndefined(this.height)) {
13458
+ this.virtualSelectedNodesSet.add(id);
13459
+ var actualIndex = this.virtualNodeMap.get(id);
13460
+ if (actualIndex && actualIndex > -1) {
13461
+ this.virtualFlatNodes[parseInt(actualIndex.toString(), 10)].selected = true;
13462
+ }
13463
+ }
13447
13464
  };
13448
13465
  TreeView.prototype.removeSelect = function (liEle) {
13449
13466
  if (this.allowMultiSelection) {
@@ -13457,6 +13474,14 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13457
13474
  if (index > -1) {
13458
13475
  this.selectedNodes.splice(index, 1);
13459
13476
  }
13477
+ if (this.enableVirtualization && !isNullOrUndefined(this.height)) {
13478
+ var id = liEle.getAttribute('data-uid');
13479
+ this.virtualSelectedNodesSet.delete(id);
13480
+ var actualIndex = this.virtualNodeMap.get(id);
13481
+ if (actualIndex && actualIndex > -1) {
13482
+ this.virtualFlatNodes[parseInt(actualIndex.toString(), 10)].selected = false;
13483
+ }
13484
+ }
13460
13485
  };
13461
13486
  TreeView.prototype.removeSelectAll = function () {
13462
13487
  var selectedLI = this.element.querySelectorAll('.' + ACTIVE);
@@ -13471,6 +13496,15 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13471
13496
  }
13472
13497
  removeClass(selectedLI, ACTIVE);
13473
13498
  this.setProperties({ selectedNodes: [] }, true);
13499
+ if (this.enableVirtualization && !isNullOrUndefined(this.height)) {
13500
+ this.virtualSelectedNodesSet.clear();
13501
+ for (var i = 0; i < this.virtualFlatNodes.length; i++) {
13502
+ var node = this.virtualFlatNodes[parseInt(i.toString(), 10)];
13503
+ if (node.selected) {
13504
+ node.selected = false;
13505
+ }
13506
+ }
13507
+ }
13474
13508
  };
13475
13509
  TreeView.prototype.getSelectEvent = function (currLi, action, e) {
13476
13510
  var nodeData = this.getNodeData(currLi);
@@ -16453,6 +16487,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16453
16487
  var imageUrlFieldName = this.fields.imageUrl;
16454
16488
  var idFieldName = this.fields.id;
16455
16489
  var textFieldName = this.fields.text;
16490
+ var selectedFieldName = this.fields.selected;
16456
16491
  var needsSorting = this.sortOrder !== 'None';
16457
16492
  var isDataTypeFlat = this.dataType === 1;
16458
16493
  var enableVirtualization = this.enableVirtualization;
@@ -16463,7 +16498,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16463
16498
  // Use expandedNodes as the single source of truth.
16464
16499
  var inExpandedNodes = this.virtualExpandedNodesSet.has(id);
16465
16500
  var rawExpanded = !inExpandedNodes && getValue(expandedFieldName, raw) === true;
16466
- var isExpanded = inExpandedNodes || rawExpanded;
16501
+ var expanded = inExpandedNodes || rawExpanded;
16467
16502
  if (rawExpanded && id) {
16468
16503
  this.expandedNodes.push(id);
16469
16504
  this.virtualExpandedNodesSet.add(id);
@@ -16490,24 +16525,32 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16490
16525
  }
16491
16526
  }
16492
16527
  }
16528
+ if (this.initialRender && enableVirtualization && id && selectedFieldName && !this.virtualSelectedNodesSet.has(id)) {
16529
+ var rawSelected = getValue(selectedFieldName, raw);
16530
+ if (!isNullOrUndefined(rawSelected) && rawSelected.toString() === 'true') {
16531
+ this.virtualSelectedNodesSet.add(id);
16532
+ if (this.selectedNodes && this.selectedNodes.indexOf(id) === -1) {
16533
+ this.selectedNodes.push(id);
16534
+ }
16535
+ }
16536
+ }
16493
16537
  // Use cached Sets for O(1) lookup
16494
- var isSelected = this.virtualSelectedNodesSet.has(id);
16538
+ var selected = this.virtualSelectedNodesSet.has(id);
16495
16539
  // Resolve checkbox state: indeterminate takes precedence over the checked set,
16496
16540
  // because a node can be in the indeterminate state without being in checkedNodes.
16497
16541
  var isChecked = (enableVirtualization && this.virtualIndeterminateNodesSet.has(id))
16498
16542
  ? 'indeterminate'
16499
16543
  : this.virtualCheckedNodesSet.has(id);
16500
- var isDisabled = false; // TODO: Check if any per-node disabled field exists
16501
16544
  var iconCssVal = raw[iconCssFieldName];
16502
16545
  var iconCss = isNullOrUndefined(iconCssVal) ? '' : iconCssVal.toString();
16503
16546
  var imageUrlVal = raw[imageUrlFieldName];
16504
16547
  var imageUrl = isNullOrUndefined(imageUrlVal) ? '' : imageUrlVal.toString();
16505
16548
  var node = {
16506
- id: id, text: text, level: level, parentId: parentId, hasChildren: hasChildren, isExpanded: isExpanded,
16507
- isSelected: isSelected, isChecked: isChecked, isDisabled: isDisabled, iconCss: iconCss, imageUrl: imageUrl, rawData: raw
16549
+ id: id, text: text, level: level, parentId: parentId, hasChildren: hasChildren, expanded: expanded,
16550
+ selected: selected, isChecked: isChecked, iconCss: iconCss, imageUrl: imageUrl
16508
16551
  };
16509
16552
  result.push(node);
16510
- if (isExpanded && hasChildren) {
16553
+ if (expanded && hasChildren) {
16511
16554
  // Determine children list
16512
16555
  var children = [];
16513
16556
  if (isDataTypeFlat) {
@@ -16717,7 +16760,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16717
16760
  targetUl.appendChild(li);
16718
16761
  liListBuf.push(li);
16719
16762
  // Register this node so its children in the same window can nest under it
16720
- if (node.isExpanded && node.hasChildren) {
16763
+ if (node.expanded && node.hasChildren) {
16721
16764
  renderedParentMap.set(node.id, { li: li, childUl: null });
16722
16765
  }
16723
16766
  }
@@ -16812,7 +16855,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16812
16855
  // Expand/collapse icon
16813
16856
  if (node.hasChildren) {
16814
16857
  var iconSpan = this.createElement('div', {
16815
- className: ICON + ' ' + (node.isExpanded ? COLLAPSIBLE : EXPANDABLE)
16858
+ className: ICON + ' ' + (node.expanded ? COLLAPSIBLE : EXPANDABLE)
16816
16859
  });
16817
16860
  textWrap.appendChild(iconSpan);
16818
16861
  }
@@ -16851,8 +16894,16 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16851
16894
  });
16852
16895
  textWrap.appendChild(anchor);
16853
16896
  li.appendChild(textWrap);
16897
+ // nodeTemplate
16898
+ if (!isNullOrUndefined(this.nodeTemplateFn)) {
16899
+ var rawData = this.findNodeInTreeData(node.id);
16900
+ if (!isNullOrUndefined(rawData)) {
16901
+ anchor.innerHTML = '';
16902
+ this.renderNodeTemplate(rawData, anchor, node.id);
16903
+ }
16904
+ }
16854
16905
  // State classes
16855
- if (node.isExpanded) {
16906
+ if (node.expanded) {
16856
16907
  li.classList.add(EXPANDED);
16857
16908
  li.setAttribute('aria-expanded', 'true');
16858
16909
  }
@@ -16860,14 +16911,10 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
16860
16911
  li.classList.add(NODECOLLAPSED);
16861
16912
  li.setAttribute('aria-expanded', 'false');
16862
16913
  }
16863
- if (node.isSelected) {
16914
+ if (node.selected) {
16864
16915
  li.classList.add(ACTIVE);
16865
16916
  li.setAttribute('aria-selected', 'true');
16866
16917
  }
16867
- if (node.isDisabled) {
16868
- li.classList.add(DISABLED$1);
16869
- li.setAttribute('aria-disabled', 'true');
16870
- }
16871
16918
  if (node.hasChildren) {
16872
16919
  li.classList.add(CHILD);
16873
16920
  }
@@ -17170,6 +17217,44 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17170
17217
  this.virtualEndIndex = win.endIndex;
17171
17218
  this.renderVirtualItems();
17172
17219
  };
17220
+ /**
17221
+ * Recursively walks the treeData (and any nested `childFieldName` arrays) to
17222
+ * find the node whose `idFieldName` matches the given `id` (compared as
17223
+ * strings). Used by the virtual-mode expand/collapse handlers so they can
17224
+ * locate nodes at any depth — not just the root level — before writing the
17225
+ * `expanded` flag back to the datasource.
17226
+ *
17227
+ * @param {string} id - The id (as a string) of the node to locate.
17228
+ * @returns {Object | null} The matching raw datasource node, or null if not found.
17229
+ * @private
17230
+ */
17231
+ TreeView.prototype.findNodeInTreeData = function (id) {
17232
+ if (!this.treeData) {
17233
+ return null;
17234
+ }
17235
+ var idFieldName = this.fields.id.toString();
17236
+ var childFieldName = this.fields.child.toString();
17237
+ var findRecursive = function (nodes) {
17238
+ if (!nodes || nodes.length === 0) {
17239
+ return null;
17240
+ }
17241
+ for (var i = 0; i < nodes.length; i++) {
17242
+ var node = nodes[i];
17243
+ if (node[idFieldName] && node[idFieldName].toString() === id) {
17244
+ return node;
17245
+ }
17246
+ var children = getValue(childFieldName, node);
17247
+ if (children && Array.isArray(children)) {
17248
+ var found = findRecursive(children);
17249
+ if (found) {
17250
+ return found;
17251
+ }
17252
+ }
17253
+ }
17254
+ return null;
17255
+ };
17256
+ return findRecursive(this.treeData);
17257
+ };
17173
17258
  TreeView.prototype.handleVirtualExpand = function (id, isKeyboardNav) {
17174
17259
  // ── Cancel any pending scroll RAF ─────────────────────────────────────────
17175
17260
  // A scroll RAF queued before the expand click would run asynchronously after
@@ -17187,9 +17272,11 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17187
17272
  if (this.virtualExpandedNodesSet) {
17188
17273
  this.virtualExpandedNodesSet.add(id);
17189
17274
  }
17190
- if (this.rootData) {
17191
- var acutalRootData = this.rootData.find(function (item) { return item.id === parseInt(id, 10); });
17192
- acutalRootData.isExpanded = true;
17275
+ if (this.treeData) {
17276
+ var acutalRootData = this.findNodeInTreeData(id);
17277
+ if (acutalRootData && this.fields && this.fields.expanded) {
17278
+ setValue(this.fields.expanded, true, acutalRootData);
17279
+ }
17193
17280
  }
17194
17281
  // ── Fix: Pin focused ID to the expanding node for keyboard navigation ──
17195
17282
  // When keyboard-triggered, the expanded node IS definitively the focused node
@@ -17268,9 +17355,11 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17268
17355
  if (this.virtualExpandedNodesSet) {
17269
17356
  this.virtualExpandedNodesSet.delete(id);
17270
17357
  }
17271
- if (this.rootData) {
17272
- var acutalRootData = this.rootData.find(function (item) { return item.id === parseInt(id, 10); });
17273
- acutalRootData.isExpanded = false;
17358
+ if (this.treeData) {
17359
+ var acutalRootData = this.findNodeInTreeData(id);
17360
+ if (acutalRootData && this.fields && this.fields.expanded) {
17361
+ setValue(this.fields.expanded, false, acutalRootData);
17362
+ }
17274
17363
  }
17275
17364
  // ── Fix: Pin focused ID to the collapsing node for keyboard navigation ──
17276
17365
  // Same reasoning as handleVirtualExpand: when keyboard-triggered, `id` is
@@ -17324,14 +17413,14 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17324
17413
  * Updates the selected state of a node in `virtualFlatNodes` and re-renders the window.
17325
17414
  *
17326
17415
  * @param {string} id - The `data-uid` of the target node.
17327
- * @param {boolean} isSelected - Whether the node is now selected.
17416
+ * @param {boolean} selected - Whether the node is now selected.
17328
17417
  * @returns {void}
17329
17418
  * @private
17330
17419
  */
17331
- TreeView.prototype.updateVirtualNodeSelection = function (id, isSelected) {
17420
+ TreeView.prototype.updateVirtualNodeSelection = function (id, selected) {
17332
17421
  var idx = this.virtualNodeMap.get(id);
17333
17422
  if (!isNullOrUndefined(idx)) {
17334
- this.virtualFlatNodes[parseInt(idx.toString(), 10)].isSelected = isSelected;
17423
+ this.virtualFlatNodes[parseInt(idx.toString(), 10)].selected = selected;
17335
17424
  this.renderVirtualItems();
17336
17425
  }
17337
17426
  };
@@ -17699,7 +17788,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17699
17788
  }
17700
17789
  for (var i = 0; i < nodes.length; i++) {
17701
17790
  var node = nodes[parseInt(i.toString(), 10)];
17702
- node['isExpanded'] = false;
17791
+ node['expanded'] = false;
17703
17792
  var children = getValue(_this.fields.child.toString(), node);
17704
17793
  if (children && Array.isArray(children)) {
17705
17794
  setAllCollapsed_1(children);
@@ -17799,7 +17888,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
17799
17888
  var nodeId = getValue(idFieldName_1, node);
17800
17889
  if (node.hasChild) {
17801
17890
  allParentIds_1.push(nodeId);
17802
- node.isExpanded = true;
17891
+ node.expanded = true;
17803
17892
  }
17804
17893
  }
17805
17894
  };