@truenas/ui-components 0.1.66 → 0.1.68
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,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OnDestroy, ElementRef, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, InjectionToken, Signal, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
|
|
3
3
|
import { ControlValueAccessor, NgControl } from '@angular/forms';
|
|
4
4
|
import { ComponentHarness, BaseHarnessFilters, HarnessPredicate, HarnessLoader } from '@angular/cdk/testing';
|
|
5
5
|
import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
|
@@ -14,8 +14,10 @@ import { Overlay } from '@angular/cdk/overlay';
|
|
|
14
14
|
import { DialogConfig, DialogRef } from '@angular/cdk/dialog';
|
|
15
15
|
import { ComponentType } from '@angular/cdk/portal';
|
|
16
16
|
|
|
17
|
-
declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccessor {
|
|
17
|
+
declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccessor, OnDestroy {
|
|
18
18
|
private readonly elementRef;
|
|
19
|
+
private readonly overlay;
|
|
20
|
+
private readonly viewContainerRef;
|
|
19
21
|
/** Unique instance ID for ARIA linkage */
|
|
20
22
|
protected readonly uid: string;
|
|
21
23
|
/** All available options */
|
|
@@ -32,14 +34,31 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
|
|
|
32
34
|
filterFn: _angular_core.InputSignal<((option: T, searchTerm: string) => boolean) | undefined>;
|
|
33
35
|
/** Text shown when no options match the search */
|
|
34
36
|
noResultsText: _angular_core.InputSignal<string>;
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Maximum number of options to render.
|
|
39
|
+
*
|
|
40
|
+
* Defaults to `Infinity` so browsing the open dropdown without a search term
|
|
41
|
+
* never silently truncates a long list. Pass an explicit cap if you want to
|
|
42
|
+
* limit how many filtered results are rendered at once.
|
|
43
|
+
*/
|
|
36
44
|
maxResults: _angular_core.InputSignal<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Max height of the dropdown panel before it scrolls. Accepts a number
|
|
47
|
+
* (interpreted as `px`) or any CSS length string (e.g. `'320px'`,
|
|
48
|
+
* `'min(320px, 40vh)'`). Surfaced as the `--tn-autocomplete-panel-max-height`
|
|
49
|
+
* custom property so it can also be themed in CSS.
|
|
50
|
+
*/
|
|
51
|
+
panelMaxHeight: _angular_core.InputSignal<string | number>;
|
|
37
52
|
/** Test ID attribute */
|
|
38
53
|
testId: _angular_core.InputSignal<string>;
|
|
39
54
|
/** Emits when an option is selected */
|
|
40
55
|
optionSelected: _angular_core.OutputEmitterRef<T>;
|
|
41
56
|
/** Reference to the input element */
|
|
42
57
|
inputEl: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
58
|
+
/** Template for the dropdown panel, portaled into a CDK overlay on open. */
|
|
59
|
+
private dropdownTemplate;
|
|
60
|
+
/** Normalized panel max-height as a CSS length string. */
|
|
61
|
+
protected panelMaxHeightValue: _angular_core.Signal<string>;
|
|
43
62
|
/** Current search term typed by the user */
|
|
44
63
|
protected searchTerm: _angular_core.WritableSignal<string>;
|
|
45
64
|
/** Whether the dropdown is open */
|
|
@@ -58,7 +77,11 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
|
|
|
58
77
|
protected hasResults: _angular_core.Signal<boolean>;
|
|
59
78
|
private onChange;
|
|
60
79
|
private onTouched;
|
|
61
|
-
|
|
80
|
+
/** Live overlay holding the dropdown panel, or undefined when closed. */
|
|
81
|
+
private overlayRef?;
|
|
82
|
+
/** Subscriptions tied to the current overlay; torn down on close. */
|
|
83
|
+
private overlaySubs;
|
|
84
|
+
ngOnDestroy(): void;
|
|
62
85
|
writeValue(value: T | null): void;
|
|
63
86
|
registerOnChange(fn: (value: T | null) => void): void;
|
|
64
87
|
registerOnTouched(fn: () => void): void;
|
|
@@ -69,10 +92,22 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
|
|
|
69
92
|
onOptionClick(option: T): void;
|
|
70
93
|
onKeydown(event: KeyboardEvent): void;
|
|
71
94
|
private selectOption;
|
|
95
|
+
private open;
|
|
72
96
|
private close;
|
|
97
|
+
/**
|
|
98
|
+
* Attach the dropdown panel as a CDK overlay anchored to the input.
|
|
99
|
+
*
|
|
100
|
+
* Why an overlay (vs. an inline absolutely-positioned panel): the panel is
|
|
101
|
+
* appended to the overlay container on `document.body`, so it can never be
|
|
102
|
+
* clipped by an ancestor's `overflow: hidden`/`auto` (e.g. a surrounding
|
|
103
|
+
* card). CDK also flips the panel above the input near the viewport edge and
|
|
104
|
+
* matches its width to the input. Mirrors TnSelectComponent's approach.
|
|
105
|
+
*/
|
|
106
|
+
private attachOverlay;
|
|
107
|
+
private detachOverlay;
|
|
73
108
|
private scrollToHighlighted;
|
|
74
109
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnAutocompleteComponent<any>, never>;
|
|
75
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "requireSelection": { "alias": "requireSelection"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "noResultsText": { "alias": "noResultsText"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; }, never, never, true, never>;
|
|
110
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "requireSelection": { "alias": "requireSelection"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "noResultsText": { "alias": "noResultsText"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "panelMaxHeight": { "alias": "panelMaxHeight"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; }, never, never, true, never>;
|
|
76
111
|
}
|
|
77
112
|
|
|
78
113
|
/**
|
|
@@ -1491,16 +1526,20 @@ declare class TnMenuItemComponent {
|
|
|
1491
1526
|
}
|
|
1492
1527
|
|
|
1493
1528
|
/**
|
|
1494
|
-
* Activates CDK menu hover-to-open behavior
|
|
1529
|
+
* Activates CDK menu hover-to-open behavior — and keyboard focus entry — for a
|
|
1530
|
+
* root menu opened via a custom overlay instead of CDK's own `CdkMenuTrigger`.
|
|
1495
1531
|
*
|
|
1496
1532
|
* CDK's hover-to-open for submenu triggers is guarded by `!menuStack.isEmpty()`.
|
|
1497
|
-
* When a CdkMenu is opened via TnMenuTriggerDirective (custom overlay)
|
|
1498
|
-
*
|
|
1499
|
-
* with the stack, disabling hover for its submenu triggers
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1533
|
+
* When a `CdkMenu` is opened via `TnMenuTriggerDirective` (custom overlay)
|
|
1534
|
+
* rather than `CdkMenuTrigger`, the menu is considered "inline" and doesn't
|
|
1535
|
+
* register with the stack, disabling hover for its submenu triggers and leaving
|
|
1536
|
+
* keyboard focus outside the panel.
|
|
1537
|
+
*
|
|
1538
|
+
* This directive pushes that root menu onto its own stack and moves focus to
|
|
1539
|
+
* the first (or selected) item so arrow-key navigation works immediately.
|
|
1540
|
+
* Submenus — opened by `CdkMenuTrigger` — already push themselves and are
|
|
1541
|
+
* focused by CDK, so for them this directive only installs the skip-disabled
|
|
1542
|
+
* predicate and otherwise stays out of the way.
|
|
1504
1543
|
*/
|
|
1505
1544
|
declare class TnMenuActivateHoverDirective implements AfterContentInit {
|
|
1506
1545
|
private cdkMenu;
|
|
@@ -1509,6 +1548,7 @@ declare class TnMenuActivateHoverDirective implements AfterContentInit {
|
|
|
1509
1548
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnMenuActivateHoverDirective, never>;
|
|
1510
1549
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnMenuActivateHoverDirective, "[tnMenuActivateHover]", never, {}, {}, never, never, true, never>;
|
|
1511
1550
|
}
|
|
1551
|
+
|
|
1512
1552
|
interface TnMenuItem {
|
|
1513
1553
|
id: string;
|
|
1514
1554
|
label: string;
|
|
@@ -1558,7 +1598,6 @@ declare class TnMenuComponent implements OnDestroy {
|
|
|
1558
1598
|
private closeContextMenu;
|
|
1559
1599
|
ngOnDestroy(): void;
|
|
1560
1600
|
onContextMenu(event: MouseEvent): void;
|
|
1561
|
-
trackByItemId(index: number, item: TnMenuItem): string;
|
|
1562
1601
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnMenuComponent, never>;
|
|
1563
1602
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnMenuComponent, "tn-menu", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "contextMenu": { "alias": "contextMenu"; "required": false; "isSignal": true; }; }, { "menuItemClick": "menuItemClick"; "menuOpen": "menuOpen"; "menuClose": "menuClose"; }, ["contentItems"], ["*"], true, never>;
|
|
1564
1603
|
}
|
|
@@ -2284,7 +2323,7 @@ declare class TnTabsComponent implements AfterContentInit, AfterViewInit, OnDest
|
|
|
2284
2323
|
tabHeader: _angular_core.Signal<ElementRef<HTMLElement>>;
|
|
2285
2324
|
selectedIndex: _angular_core.InputSignal<number>;
|
|
2286
2325
|
orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
2287
|
-
highlightPosition: _angular_core.InputSignal<"
|
|
2326
|
+
highlightPosition: _angular_core.InputSignal<"bottom" | "top" | "left" | "right">;
|
|
2288
2327
|
/**
|
|
2289
2328
|
* Test-id applied to the tablist root element. Rendered under whichever attribute name
|
|
2290
2329
|
* is configured via `TN_TEST_ATTR` (default `data-testid`).
|