@syncfusion/ej2-navigations 34.1.31 → 34.2.2

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 34.1.31
3
+ * version : 34.2.2
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-navigations",
3
- "version": "34.1.31",
3
+ "version": "34.2.2",
4
4
  "description": "A package of Essential JS 2 navigation components such as Tree-view, Tab, Toolbar, Context-menu, and Accordion which is used to navigate from one page to another",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,12 +8,13 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-navigations.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.1.30",
12
- "@syncfusion/ej2-buttons": "~34.1.30",
13
- "@syncfusion/ej2-data": "~34.1.29",
14
- "@syncfusion/ej2-inputs": "~34.1.30",
15
- "@syncfusion/ej2-lists": "~34.1.30",
16
- "@syncfusion/ej2-popups": "~34.1.29"
11
+ "@syncfusion/ej2-base": "~34.2.2",
12
+ "@syncfusion/ej2-buttons": "~34.2.2",
13
+ "@syncfusion/ej2-data": "~34.2.2",
14
+ "@syncfusion/ej2-inputs": "~34.2.2",
15
+ "@syncfusion/ej2-lists": "~34.2.2",
16
+ "@syncfusion/ej2-notifications": "~34.2.2",
17
+ "@syncfusion/ej2-popups": "~34.2.2"
17
18
  },
18
19
  "devDependencies": {},
19
20
  "keywords": [
@@ -1,4 +1,4 @@
1
- import { Component, EmitType, isUndefined, Browser, compile, isNullOrUndefined, SanitizeHtmlHelper, animationMode } from '@syncfusion/ej2-base';import { Property, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, Complex } from '@syncfusion/ej2-base';import { Event, EventHandler, KeyboardEvents, KeyboardEventArgs } from '@syncfusion/ej2-base';import { rippleEffect, Effect, Animation, AnimationOptions, RippleOptions, remove } from '@syncfusion/ej2-base';import { Draggable, DragEventArgs, Droppable, DropEventArgs } from '@syncfusion/ej2-base';import { getElement } from '@syncfusion/ej2-base';import { addClass, removeClass, closest, matches, detach, select, selectAll, isVisible, append } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { isNullOrUndefined as isNOU, Touch, TapEventArgs, getValue, setValue, extend, merge, attributes } from '@syncfusion/ej2-base';import { ListBase, ListBaseOptions, AriaAttributesMapping, FieldsMapping } from '@syncfusion/ej2-lists';import { createCheckBox, rippleMouseHandler } from '@syncfusion/ej2-buttons';import { Input, InputObject } from '@syncfusion/ej2-inputs';import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
1
+ import { Component, EmitType, isUndefined, Browser, compile, isNullOrUndefined, SanitizeHtmlHelper, animationMode } from '@syncfusion/ej2-base';import { Property, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, Complex } from '@syncfusion/ej2-base';import { Event, EventHandler, KeyboardEvents, KeyboardEventArgs } from '@syncfusion/ej2-base';import { rippleEffect, Effect, Animation, AnimationOptions, RippleOptions, remove } from '@syncfusion/ej2-base';import { Draggable, DragEventArgs, Droppable, DropEventArgs } from '@syncfusion/ej2-base';import { getElement } from '@syncfusion/ej2-base';import { addClass, removeClass, closest, matches, detach, select, selectAll, isVisible, append } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { isNullOrUndefined as isNOU, Touch, TapEventArgs, getValue, setValue, extend, merge, attributes } from '@syncfusion/ej2-base';import { ListBase, ListBaseOptions, AriaAttributesMapping, FieldsMapping } from '@syncfusion/ej2-lists';import { createCheckBox, rippleMouseHandler } from '@syncfusion/ej2-buttons';import { Input, InputObject } from '@syncfusion/ej2-inputs';import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { Skeleton } from '@syncfusion/ej2-notifications';
2
2
  import {ExpandOnSettings,SortOrder,FailureEventArgs,DataBoundEventArgs,DataSourceChangedEventArgs,DrawNodeEventArgs,NodeKeyPressEventArgs,NodeCheckEventArgs,NodeClickEventArgs,NodeExpandEventArgs,DragAndDropEventArgs,NodeEditEventArgs,NodeSelectEventArgs} from "./treeview";
3
3
  import {ComponentModel} from '@syncfusion/ej2-base';
4
4
 
@@ -200,6 +200,31 @@ export interface TreeViewModel extends ComponentModel{
200
200
  */
201
201
  allowTextWrap?: boolean;
202
202
 
203
+ /**
204
+ * Enables virtual rendering mode for the TreeView, where only the nodes visible in the viewport are rendered in the DOM.
205
+ * This significantly improves rendering performance when working with large datasets (thousands of nodes).
206
+ *
207
+ * When set to `true`, you must also set the `height` property to a fixed pixel value so the component can calculate
208
+ * the visible window and the total scrollable height.
209
+ *
210
+ * @default false
211
+ * @remarks
212
+ * - Requires `height` to be set to a positive pixel value (e.g. `'400px'` or `400`).
213
+ * - Animations on expand/collapse are suppressed in virtual mode to avoid layout artifacts.
214
+ * - Drag-and-drop and editing work normally; the DOM is refreshed after each interaction.
215
+ * - `ensureVisible()` is augmented to first scroll the virtualized container before attempting DOM access.
216
+ */
217
+ enableVirtualization?: boolean;
218
+
219
+ /**
220
+ * Specifies the fixed height of the TreeView container when `enableVirtualization` is `true`.
221
+ * Accepts a pixel string (e.g. `'400px'`) or a numeric pixel value (e.g. `400`).
222
+ * This value is used to calculate the virtual viewport and the total scrollable height.
223
+ *
224
+ * @default undefined
225
+ */
226
+ height?: string | number;
227
+
203
228
  /**
204
229
  * Specifies the type of animation applied on expanding and collapsing the nodes along with duration.
205
230
  *
@@ -553,6 +553,54 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
553
553
  private OldCheckedData;
554
554
  private isHiddenItem;
555
555
  private nodeIndex;
556
+ /** Flat ordered list of all currently-visible (non-collapsed) tree nodes. */
557
+ private virtualFlatNodes;
558
+ /** Maps node id → index in virtualFlatNodes for O(1) lookups. */
559
+ private virtualNodeMap;
560
+ /** Set of expanded node IDs for O(1) lookup performance during flattening (avoids array indexOf). */
561
+ private virtualExpandedNodesSet;
562
+ /** Set of checked node IDs for O(1) lookup performance during flattening. */
563
+ private virtualCheckedNodesSet;
564
+ /** Set of indeterminate node IDs — persists across flattenVisibleNodes() rebuilds. */
565
+ private virtualIndeterminateNodesSet;
566
+ /** Set of selected node IDs for O(1) lookup performance during flattening. */
567
+ private virtualSelectedNodesSet;
568
+ /** Row height in pixels, measured from the first rendered item or set to 40 as a default. */
569
+ private virtualItemHeight;
570
+ /** Height of the scrollable container in pixels. */
571
+ private virtualViewportHeight;
572
+ /** scrollTop captured during the previous scroll handler invocation. */
573
+ private virtualPrevScrollTop;
574
+ /** Index of the first rendered row in the current window. */
575
+ private virtualStartIndex;
576
+ /** Index one past the last rendered row in the current window. */
577
+ private virtualEndIndex;
578
+ /** Extra rows rendered above and below the visible window to smooth scrolling. */
579
+ private virtualOverscanCount;
580
+ /** RequestAnimationFrame handle used for throttling scroll events. */
581
+ private virtualScrollRAF;
582
+ /** The `.e-mask-parent` overlay element shown during fast scroll. */
583
+ private virtualMaskElement;
584
+ /** Bound scroll handler stored for later removeEventListener. */
585
+ private virtualScrollBound;
586
+ /** Skeleton component instances inside the mask overlay. */
587
+ private skeletonInstances;
588
+ /** Set to true whenever the flat node list must be rebuilt on next render. */
589
+ private virtualTreeDirty;
590
+ /** The data-uid of the currently keyboard-focused node in virtual mode (persists across re-renders). */
591
+ private virtualFocusedId;
592
+ /**
593
+ * Set to true by the document-level `keydown` handler when the user presses
594
+ * the Tab key. The browser will auto-scroll the focused element into view
595
+ * immediately after focus, which fires a `scroll` event on the TreeView
596
+ * container. We want to skip the re-render that the virtual scroll handler
597
+ * would otherwise trigger, because the element being focused is already
598
+ * rendered (it is the single `<li tabindex="0">` of the current window) and
599
+ * re-rendering would tear down the DOM element that is currently holding
600
+ * focus. The flag is consumed (reset to `false`) inside `onVirtualScroll`
601
+ * after the auto-scroll has been handled.
602
+ */
603
+ private virtualSkipNextScrollRender;
556
604
  /**
557
605
  * Indicates whether the TreeView allows drag and drop of nodes. To drag and drop a node in
558
606
  * desktop, hold the mouse on the node, drag it to the target node and drop the node by releasing
@@ -593,6 +641,29 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
593
641
  * @default false
594
642
  */
595
643
  allowTextWrap: boolean;
644
+ /**
645
+ * Enables virtual rendering mode for the TreeView, where only the nodes visible in the viewport are rendered in the DOM.
646
+ * This significantly improves rendering performance when working with large datasets (thousands of nodes).
647
+ *
648
+ * When set to `true`, you must also set the `height` property to a fixed pixel value so the component can calculate
649
+ * the visible window and the total scrollable height.
650
+ *
651
+ * @default false
652
+ * @remarks
653
+ * - Requires `height` to be set to a positive pixel value (e.g. `'400px'` or `400`).
654
+ * - Animations on expand/collapse are suppressed in virtual mode to avoid layout artifacts.
655
+ * - Drag-and-drop and editing work normally; the DOM is refreshed after each interaction.
656
+ * - `ensureVisible()` is augmented to first scroll the virtualized container before attempting DOM access.
657
+ */
658
+ enableVirtualization: boolean;
659
+ /**
660
+ * Specifies the fixed height of the TreeView container when `enableVirtualization` is `true`.
661
+ * Accepts a pixel string (e.g. `'400px'`) or a numeric pixel value (e.g. `400`).
662
+ * This value is used to calculate the virtual viewport and the total scrollable height.
663
+ *
664
+ * @default undefined
665
+ */
666
+ height: string | number;
596
667
  /**
597
668
  * Specifies the type of animation applied on expanding and collapsing the nodes along with duration.
598
669
  *
@@ -1127,6 +1198,18 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
1127
1198
  private nodeCheckAction;
1128
1199
  private addCheck;
1129
1200
  private removeCheck;
1201
+ /**
1202
+ * Recursively sets the `isChecked` state of all descendants of the node with
1203
+ * `parentId` in `virtualFlatNodes`, keeping `checkedNodes` and
1204
+ * `virtualCheckedNodesSet` in sync. Used in virtual mode to honor the
1205
+ * `autoCheck` cascade when a parent checkbox is toggled.
1206
+ *
1207
+ * @param {string} parentId - The `data-uid` of the parent whose descendants should be updated.
1208
+ * @param {boolean} isChecked - The new state to apply to every descendant.
1209
+ * @returns {void}
1210
+ * @private
1211
+ */
1212
+ private setVirtualChildCheckState;
1130
1213
  private getCheckEvent;
1131
1214
  private finalize;
1132
1215
  private setTextWrap;
@@ -1353,6 +1436,212 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
1353
1436
  private dmFailure;
1354
1437
  private updatePreviousText;
1355
1438
  private getHierarchicalParentId;
1439
+ /**
1440
+ * Parses the `height` property (string like '400px' or number) to a pixel value.
1441
+ * Returns 0 if the value cannot be determined.
1442
+ *
1443
+ * @returns {number} Pixel height.
1444
+ * @private
1445
+ */
1446
+ private parseHeightToPixels;
1447
+ /**
1448
+ * Measures the height of the first rendered list item so subsequent calculations
1449
+ * use real layout values. Falls back to the stored `virtualItemHeight` default (40).
1450
+ *
1451
+ * @returns {number} Row height in pixels.
1452
+ * @private
1453
+ */
1454
+ private measureVirtualItemHeight;
1455
+ /**
1456
+ * Rebuilds the cached Sets for checked/selected nodes to enable O(1) lookup
1457
+ * during the flatten operation instead of O(n) array indexOf calls.
1458
+ *
1459
+ * @returns {void}
1460
+ * @private
1461
+ */
1462
+ private rebuildVirtualCheckCache;
1463
+ /**
1464
+ * Recursively walks the treeData (or groupedData for flat lists) and builds
1465
+ * `virtualFlatNodes` — an ordered list of every node that is currently visible
1466
+ * (i.e. its ancestors are all expanded). Uses cached Sets for O(1) state lookups.
1467
+ *
1468
+ * @returns {VirtualNodeData[]} Ordered flat list of visible nodes.
1469
+ * @private
1470
+ */
1471
+ private flattenVisibleNodes;
1472
+ /**
1473
+ * Recursive helper for `flattenVisibleNodes`.
1474
+ *
1475
+ * @param {Object[]} nodes - Array of raw data objects at this level.
1476
+ * @param {number} level - 1-based depth level.
1477
+ * @param {string | null} parentId - The parent node id, or null for root.
1478
+ * @param {VirtualNodeData[]} result - Accumulator array.
1479
+ * @returns {void}
1480
+ * @private
1481
+ */
1482
+ private flattenNodeRecursive;
1483
+ /**
1484
+ * Checks whether a raw datasource node has child records.
1485
+ *
1486
+ * @param {Object} raw - Raw datasource object.
1487
+ * @returns {boolean} True if children exist.
1488
+ * @private
1489
+ */
1490
+ private hasChildRecords;
1491
+ /**
1492
+ * Rebuilds `virtualNodeMap` (id → index) from the current `virtualFlatNodes`.
1493
+ *
1494
+ * @returns {void}
1495
+ * @private
1496
+ */
1497
+ private rebuildVirtualNodeMap;
1498
+ private getVirtualWindow;
1499
+ private getVirtualWindowAt;
1500
+ private getVirtualPadding;
1501
+ /**
1502
+ * Renders the virtual window into a **nested** `<ul>/<li>` hierarchy identical to
1503
+ * the non-virtualized DOM structure.
1504
+ *
1505
+ * ## Scroll math
1506
+ * The flat-index ↔ pixel mapping stays unchanged: every entry in
1507
+ * `virtualFlatNodes` represents exactly one `itemHeight` row.
1508
+ * `paddingTop = startIndex * itemHeight` and
1509
+ * `paddingBottom = (total - endIndex) * itemHeight` keep the scrollbar
1510
+ * thumb in the correct position.
1511
+ *
1512
+ * ## Ancestor injection
1513
+ * When `startIndex` points at a child node whose ancestor(s) have already
1514
+ * scrolled above the viewport (their flat indices are < startIndex), the
1515
+ * ancestors would normally be missing from the DOM, forcing the children to
1516
+ * fall back to the root `<ul>` as flat siblings — producing wrong HTML.
1517
+ *
1518
+ * To fix this, before rendering the window we walk the ancestor chain of the
1519
+ * first visible node and collect every ancestor that lies **outside** the
1520
+ * window. Those ancestors are injected as real `<li>` containers at the
1521
+ * very top of the root `<ul>`. To compensate for their presence, `paddingTop`
1522
+ * is reduced by `injectedCount * itemHeight` so the total scroll height
1523
+ * remains the same.
1524
+ *
1525
+ * Once the ancestors are in the DOM they are registered in `renderedParentMap`
1526
+ * so the normal window-rendering loop can nest children inside them exactly
1527
+ * as it does when both parent and child are in the same window.
1528
+ *
1529
+ * @returns {void}
1530
+ * @private
1531
+ */
1532
+ private renderVirtualItems;
1533
+ /**
1534
+ * Creates a single `<li>` element for the virtual window representing `node`.
1535
+ *
1536
+ * @param {VirtualNodeData} node - The node data.
1537
+ * @param {boolean} _isFirst - True if this is the first rendered item (unused here but kept for potential override).
1538
+ * @returns {HTMLElement} The constructed `<li>` element.
1539
+ * @private
1540
+ */
1541
+ private createVirtualListItem;
1542
+ /**
1543
+ * Initialises the virtual-scrolling layout:
1544
+ * 1. Adds the `e-virtualization` CSS class and applies a fixed `height` + `overflow-y`.
1545
+ * 2. Flattens all visible nodes into `virtualFlatNodes`.
1546
+ * 3. Measures item height and viewport height.
1547
+ * 4. Computes the initial window and renders it.
1548
+ * 5. Wires the scroll event handler.
1549
+ *
1550
+ * @returns {void}
1551
+ * @private
1552
+ */
1553
+ private initVirtualization;
1554
+ /**
1555
+ * Wires the scroll event listener on the TreeView element.
1556
+ *
1557
+ * @returns {void}
1558
+ * @private
1559
+ */
1560
+ private wireVirtualScrollEvents;
1561
+ /**
1562
+ * Removes the scroll event listener previously wired by `wireVirtualScrollEvents`.
1563
+ *
1564
+ * @returns {void}
1565
+ * @private
1566
+ */
1567
+ private unwireVirtualScrollEvents;
1568
+ /**
1569
+ * Scroll handler for the virtual TreeView. Throttled via `requestAnimationFrame`.
1570
+ * Shows the loading mask during fast scrolls, re-renders the window, then hides the mask.
1571
+ *
1572
+ * @returns {void}
1573
+ * @private
1574
+ */
1575
+ private onVirtualScroll;
1576
+ /**
1577
+ * Creates the skeleton mask overlay used to indicate loading during fast scrolls.
1578
+ * Skeleton instances are stored in `skeletonInstances` for later disposal.
1579
+ *
1580
+ * @returns {void}
1581
+ * @private
1582
+ */
1583
+ private createVirtualMask;
1584
+ /**
1585
+ * Refreshes the mask position so it always overlays the TreeView's viewport.
1586
+ * Called on every show / scroll, since `position:fixed` is relative to the
1587
+ * page viewport, not to the TreeView scroll container.
1588
+ *
1589
+ * @returns {void}
1590
+ * @private
1591
+ */
1592
+ private updateMaskPosition;
1593
+ /**
1594
+ * Destroys all skeleton instances and removes the mask overlay from the DOM.
1595
+ *
1596
+ * @returns {void}
1597
+ * @private
1598
+ */
1599
+ private destroyVirtualMask;
1600
+ /**
1601
+ * Positions and shows the skeleton mask at the current `scrollTop` position.
1602
+ *
1603
+ * @param {number} _scrollTop - Current scrollTop of the container.
1604
+ * @returns {void}
1605
+ * @private
1606
+ */
1607
+ private showVirtualMask;
1608
+ /**
1609
+ * Hides the skeleton mask overlay after the virtual window has been rendered.
1610
+ *
1611
+ * @returns {void}
1612
+ * @private
1613
+ */
1614
+ private hideVirtualMask;
1615
+ /**
1616
+ * Ensures the node identified by `id` is scrolled into view inside the virtual container.
1617
+ * If the node falls outside the rendered window, the container's `scrollTop` is adjusted so
1618
+ * that the node becomes visible, the window is re-computed and `renderVirtualItems` is called.
1619
+ *
1620
+ * @param {string} id - The `data-uid` of the target node.
1621
+ * @returns {void}
1622
+ * @private
1623
+ */
1624
+ private ensureVirtualNodeVisible;
1625
+ private handleVirtualExpand;
1626
+ private handleVirtualCollapse;
1627
+ /**
1628
+ * Updates the selected state of a node in `virtualFlatNodes` and re-renders the window.
1629
+ *
1630
+ * @param {string} id - The `data-uid` of the target node.
1631
+ * @param {boolean} isSelected - Whether the node is now selected.
1632
+ * @returns {void}
1633
+ * @private
1634
+ */
1635
+ private updateVirtualNodeSelection;
1636
+ /**
1637
+ * Updates the checkbox state of a node in `virtualFlatNodes` and re-renders the window.
1638
+ *
1639
+ * @param {string} id - The `data-uid` of the target node.
1640
+ * @param {'check' | 'uncheck' | 'indeterminate'} state - The new check state.
1641
+ * @returns {void}
1642
+ * @private
1643
+ */
1644
+ private updateVirtualNodeCheckState;
1356
1645
  /**
1357
1646
  * Called internally if any of the property value changed.
1358
1647
  *