@nyx-ds/treeview 0.1.1 → 0.1.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.
@@ -24,6 +24,7 @@ export declare function getNextLoadRootIds(index: IndexedTreeNode[], loadedIds:
24
24
  export declare function hasMoreRootsToLoad(index: IndexedTreeNode[], loadedIds: ReadonlySet<string | number>): boolean;
25
25
  export declare function hasMoreNodesToLoad(index: IndexedTreeNode[], loadedIds: ReadonlySet<string | number>): boolean;
26
26
  export declare function hasUnloadedDescendants(nodeId: string | number, index: IndexedTreeNode[], loadedIds: ReadonlySet<string | number>): boolean;
27
+ export declare function hasUnloadedDirectChildren(nodeId: string | number, index: IndexedTreeNode[], loadedIds: ReadonlySet<string | number>): boolean;
27
28
  /** Root id (depth 0) for a flat row — used to prioritize lazy loads on scroll. */
28
29
  export declare function getRootIdForFlatRow(row: FlatTreeRow | undefined, indexById: Map<string | number, IndexedTreeNode>): string | number | undefined;
29
30
  /**
@@ -32,6 +33,8 @@ export declare function getRootIdForFlatRow(row: FlatTreeRow | undefined, indexB
32
33
  */
33
34
  export declare function getNextLoadPriorityRootId(flatRows: FlatTreeRow[], lastVisibleIndex: number, expandedIds: ReadonlySet<string | number>, index: IndexedTreeNode[], loadedIds: ReadonlySet<string | number>, indexById: Map<string | number, IndexedTreeNode>): string | number | undefined;
34
35
  export declare function getAncestorIds(id: string | number, indexById: Map<string | number, IndexedTreeNode>): (string | number)[];
36
+ export declare function getExpandedLevelLoadIds(index: IndexedTreeNode[], rootIds: Iterable<string | number>, targetLevel: number): (string | number)[];
37
+ export declare function getExpandedLevelExpandedIds(index: IndexedTreeNode[], rootIds: Iterable<string | number>, targetLevel: number): (string | number)[];
35
38
  /**
36
39
  * Loads the next page of node ids (global BFS order), optionally prioritizing
37
40
  * descendants of `priorityRootId` when a folder is expanded.
@@ -3,6 +3,7 @@ import { EventDispatcher } from "./event";
3
3
  import "@lit-labs/virtualizer";
4
4
  import "@nyx-ds/input";
5
5
  import "@nyx-ds/checkbox";
6
+ import "@nyx-ds/radio";
6
7
  import "@nyx-ds/icon";
7
8
  import "@nyx-ds/button";
8
9
  /**
@@ -129,6 +130,11 @@ export interface ITreeViewOptions {
129
130
  * Without columns: toggles `selected` on the row and its descendants.
130
131
  */
131
132
  showRowSelection?: boolean;
133
+ /**
134
+ * When `true` and `showRowSelection` is enabled, renders the row selector as
135
+ * a radio and keeps a single selected tree item through `node.selected`.
136
+ */
137
+ uniqueSelection?: boolean;
132
138
  /**
133
139
  * Shows header icons and per-row permission checkboxes on the right.
134
140
  * Defaults to `true` when `columns` has at least one entry.
@@ -201,6 +207,8 @@ export interface ITreeViewOptions {
201
207
  * @cssproperty [--treeview-expander-hover-background=var(--nyx-color-brand-background-softer-hover)] - Background of expander on hover.
202
208
  */
203
209
  export declare class NyxTreeview extends LitElement {
210
+ private static _nextTreeviewId;
211
+ private readonly _rowSelectionRadioName;
204
212
  /**
205
213
  * Configuration object for the Treeview.
206
214
  *
@@ -240,16 +248,15 @@ export declare class NyxTreeview extends LitElement {
240
248
  private _getLazyPageSize;
241
249
  private _hasColumnPermissions;
242
250
  private _showRowSelection;
251
+ private _usesUniqueRowSelection;
243
252
  private _showNodeIcons;
244
253
  private _usesSimpleRowSelection;
245
254
  private _applyItemsFromOptions;
255
+ private _applyUniqueSelectionConstraint;
246
256
  private _applyOptionsChange;
247
257
  private _initLazyState;
248
- /**
249
- * Expands only nodes already present in the materialized tree.
250
- * Further rows appear as lazy load + scroll bring more ids into `_items`.
251
- */
252
- private _applyLazyInitialExpansion;
258
+ private _loadDefaultExpandedLevelForRoots;
259
+ private _applyLazyDefaultExpansion;
253
260
  private _rebuildMaterializedItems;
254
261
  private _selectionRoots;
255
262
  /** Full source node for selection UI/state (lazy materialized nodes may omit children). */
@@ -313,6 +320,7 @@ export declare class NyxTreeview extends LitElement {
313
320
  private _updateSimpleRowParents;
314
321
  private _isRowCheckboxChecked;
315
322
  private _isRowCheckboxIndeterminate;
323
+ private _setUniqueRowSelected;
316
324
  private _handleRowCheck;
317
325
  private _applyRowColumnsToNode;
318
326
  private _toggleRowRecursively;