@truenas/ui-components 0.3.24 → 0.3.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenas/ui-components",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -6515,7 +6515,7 @@ declare class TnTreeFlattener<T, F> {
6515
6515
  * (and call `filter(query)`) and/or `sortComparer`. Both are opt-in; when unset
6516
6516
  * the datasource behaves exactly as before.
6517
6517
  */
6518
- declare class TnTreeFlatDataSource<T, F> extends DataSource<F> {
6518
+ declare class TnTreeFlatDataSource<T, F, K = F> extends DataSource<F> {
6519
6519
  private _treeControl;
6520
6520
  private _treeFlattener;
6521
6521
  /** When set, `filter(query)` re-renders the tree from `filterPredicate(data, query)`. */
@@ -6528,17 +6528,23 @@ declare class TnTreeFlatDataSource<T, F> extends DataSource<F> {
6528
6528
  private _filteredData;
6529
6529
  private filterValue;
6530
6530
  private readonly filterChanged$;
6531
- private readonly disconnect$;
6532
- constructor(_treeControl: TnTreeExpansion<F>, _treeFlattener: TnTreeFlattener<T, F>);
6531
+ constructor(_treeControl: TnTreeExpansion<F, K>, _treeFlattener: TnTreeFlattener<T, F>);
6533
6532
  get data(): T[];
6534
6533
  set data(value: T[]);
6535
- /** The currently filtered (unflattened) data; equals `data` until `filter()` is used. */
6534
+ /** The currently filtered (unflattened) data; equals `data` while no filter query is active. */
6536
6535
  get filteredData(): T[];
6537
6536
  connect(): Observable<F[]>;
6538
6537
  disconnect(): void;
6539
6538
  /** Filters the tree using `filterPredicate` (debounced). No-op until `filterPredicate` is set. */
6540
6539
  filter(query: string): void;
6541
6540
  private flattenData;
6541
+ /**
6542
+ * Deliberately NOT torn down in `disconnect()`: CdkTree disconnects the
6543
+ * datasource when the tree is destroyed, but the same instance may be
6544
+ * reconnected (e.g. a tree behind an `@if`), and filtering must survive that.
6545
+ * The pipeline only references the datasource's own subjects, so it holds no
6546
+ * external resources and is collected with the instance.
6547
+ */
6542
6548
  private detectFilterChanges;
6543
6549
  private _getExpandedNodesWithLevel;
6544
6550
  }
@@ -6566,15 +6572,27 @@ declare class TnNestedTreeNodeComponent<T, K = T> extends CdkNestedTreeNode<T, K
6566
6572
  * defaults to the previous hardcoded value.
6567
6573
  */
6568
6574
  readonly toggleAriaLabel: _angular_core.InputSignal<string>;
6569
- /** Semantic test-id base applied to the built-in toggle button (`button-` prefixed). */
6575
+ /**
6576
+ * Semantic test-id base applied to the built-in toggle button (`button-`
6577
+ * prefixed). When unset, derives from the node's own `testId` — a row with
6578
+ * `[testId]="['vdev', guid]"` gets `button-toggle-vdev-<guid>` — so every
6579
+ * identified row has an addressable expand control without repeating the id.
6580
+ */
6570
6581
  readonly toggleTestId: _angular_core.InputSignal<TnTestIdValue>;
6571
6582
  /**
6572
6583
  * Suppresses the built-in toggle button (and its alignment spacer) so the
6573
6584
  * consumer can render a fully custom toggle in the projected content.
6585
+ *
6586
+ * The built-in button is the only keyboard/AT-operable expand control this
6587
+ * component guarantees — when hiding it, the projected replacement must be
6588
+ * an accessible control (a real button with an aria-label, not a bare icon).
6574
6589
  */
6575
6590
  readonly hideToggle: _angular_core.InputSignalWithTransform<boolean, unknown>;
6576
6591
  private readonly changeDetectorRef;
6592
+ private readonly hostTestId;
6577
6593
  private destroyed;
6594
+ /** Explicit `toggleTestId` wins; otherwise `toggle`-scoped from the node's `testId`. */
6595
+ protected readonly resolvedToggleTestId: _angular_core.Signal<TnTestIdValue>;
6578
6596
  constructor();
6579
6597
  /** The tree node's level in the tree */
6580
6598
  get level(): number;
@@ -6619,13 +6637,20 @@ declare class TnNestedTreeDataSource<T extends {
6619
6637
  }> extends DataSource<T> {
6620
6638
  /** When set, `filter(query)` re-renders the tree from `filterPredicate(data, query)`. */
6621
6639
  filterPredicate?: (data: T[], query: string) => T[];
6622
- /** When set, incoming `data` is sorted recursively before rendering. */
6640
+ /**
6641
+ * When set, incoming `data` is sorted recursively before rendering.
6642
+ *
6643
+ * Note: sorting REWRITES `children` arrays on the caller's node objects
6644
+ * (a new sorted array is assigned per node). Node object identity is
6645
+ * preserved — deliberately, since tree controls track expansion state by
6646
+ * node identity — but don't pass an object graph that is shared with code
6647
+ * relying on the original child order.
6648
+ */
6623
6649
  sortComparer?: (a: T, b: T) => number;
6624
6650
  private filterValue;
6625
6651
  private readonly filterChanged$;
6626
6652
  private readonly _data;
6627
6653
  private readonly _filteredData;
6628
- private readonly disconnect$;
6629
6654
  get data(): T[];
6630
6655
  set data(value: T[]);
6631
6656
  constructor(initialData?: T[]);
@@ -6633,6 +6658,13 @@ declare class TnNestedTreeDataSource<T extends {
6633
6658
  disconnect(): void;
6634
6659
  /** Filters the tree using `filterPredicate` (debounced). No-op until `filterPredicate` is set. */
6635
6660
  filter(query: string): void;
6661
+ /**
6662
+ * Deliberately NOT torn down in `disconnect()`: CdkTree disconnects the
6663
+ * datasource when the tree is destroyed, but the same instance may be
6664
+ * reconnected (e.g. a tree behind an `@if`), and filtering must survive that.
6665
+ * The pipeline only references the datasource's own subjects, so it holds no
6666
+ * external resources and is collected with the instance.
6667
+ */
6636
6668
  private detectFilterChanges;
6637
6669
  private sort;
6638
6670
  }
@@ -6720,8 +6752,6 @@ interface TnTreeNodeHarnessFilters extends BaseHarnessFilters {
6720
6752
  /** Only find nodes at the given 0-based level (root nodes are 0). */
6721
6753
  level?: number;
6722
6754
  }
6723
- /** Filters for finding `TnTreeHarness` instances. */
6724
- type TnTreeHarnessFilters = BaseHarnessFilters;
6725
6755
  /**
6726
6756
  * Harness for interacting with a single `tn-tree-node` or `tn-nested-tree-node`.
6727
6757
  *
@@ -6777,6 +6807,10 @@ declare class TnTreeNodeHarness extends ComponentHarness {
6777
6807
  /**
6778
6808
  * Toggles the node together with all of its descendants (Alt+click on the
6779
6809
  * built-in nested-node toggle).
6810
+ *
6811
+ * Only nested nodes honor the Alt modifier — on a flat node the row's
6812
+ * `cdkTreeNodeToggle` is not Alt-aware, so this degrades to a plain
6813
+ * single-level toggle.
6780
6814
  */
6781
6815
  toggleWithDescendants(): Promise<void>;
6782
6816
  /**
@@ -6789,6 +6823,9 @@ declare class TnTreeNodeHarness extends ComponentHarness {
6789
6823
  collapse(): Promise<void>;
6790
6824
  private getToggle;
6791
6825
  }
6826
+
6827
+ /** Filters for finding `TnTreeHarness` instances. */
6828
+ type TnTreeHarnessFilters = BaseHarnessFilters;
6792
6829
  /**
6793
6830
  * Harness for interacting with `tn-tree` in tests.
6794
6831
  *