@truenas/ui-components 0.3.14 → 0.3.15
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 { InjectionToken, Renderer2, OnDestroy, ElementRef, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef,
|
|
2
|
+
import { Signal, InjectionToken, Renderer2, OnDestroy, ElementRef, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
|
|
3
3
|
import { ControlValueAccessor, NgControl, AbstractControl } from '@angular/forms';
|
|
4
4
|
import { ComponentHarness, BaseHarnessFilters, HarnessPredicate, TestKey, HarnessLoader } from '@angular/cdk/testing';
|
|
5
5
|
import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
|
@@ -82,6 +82,42 @@ declare function scopeTestId(base: TnTestIdValue, ...suffix: (string | number |
|
|
|
82
82
|
*/
|
|
83
83
|
declare function composeTestId(type: string | null | undefined, value: TnTestIdValue): string;
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Resolve a form control's test-id base, falling back to the bound control's
|
|
87
|
+
* name (`formControlName`, a named `[formControl]`, or `ngModel`) when the
|
|
88
|
+
* consumer provides no explicit `testId`.
|
|
89
|
+
*
|
|
90
|
+
* Call from a form control's field initializer and bind the result on the
|
|
91
|
+
* element that represents the control:
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* protected resolvedTestId = controlTestId(this.testId);
|
|
95
|
+
* ```
|
|
96
|
+
* ```html
|
|
97
|
+
* <input tnTestIdType="input" [tnTestId]="resolvedTestId()" />
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* The element-type prefix (`tnTestIdType`) still applies, so a
|
|
101
|
+
* `<tn-input formControlName="sshPort">` with no `testId` emits
|
|
102
|
+
* `input-ssh-port` — exactly what a consumer would otherwise hand-write as
|
|
103
|
+
* `testId="ssh-port"`. An explicit `testId` always wins.
|
|
104
|
+
*
|
|
105
|
+
* Two deliberate constraints make this safe inside a `ControlValueAccessor`:
|
|
106
|
+
*
|
|
107
|
+
* - **`self`-scoped**: the lookup reads only the `NgControl` on the component's
|
|
108
|
+
* OWN host element, never an ancestor's. A composite control whose template
|
|
109
|
+
* embeds child controls therefore can't leak its own name onto those children
|
|
110
|
+
* (which would make their ids collide).
|
|
111
|
+
* - **lazy**: the `NgControl` is resolved on first read, not in the injection
|
|
112
|
+
* context. Eagerly injecting `NgControl` into a component that provides
|
|
113
|
+
* `NG_VALUE_ACCESSOR` is circular (the control needs the value accessor, the
|
|
114
|
+
* accessor would need the control); reading it after construction is not.
|
|
115
|
+
*
|
|
116
|
+
* Must be called within an injection context (a field initializer or
|
|
117
|
+
* constructor).
|
|
118
|
+
*/
|
|
119
|
+
declare function controlTestId(testId: Signal<TnTestIdValue>): Signal<TnTestIdValue>;
|
|
120
|
+
|
|
85
121
|
/**
|
|
86
122
|
* Test-id attribute names supported by the library.
|
|
87
123
|
*
|
|
@@ -118,6 +154,10 @@ declare const TN_TEST_ATTR: InjectionToken<TnTestAttrName>;
|
|
|
118
154
|
* {@link composeTestId}). When no `tnTestIdType` is set the value is written
|
|
119
155
|
* verbatim, so existing call sites are unaffected.
|
|
120
156
|
*
|
|
157
|
+
* Form controls derive an unset base from the bound control's name via
|
|
158
|
+
* {@link controlTestId} before passing it here, so a control stays targetable by
|
|
159
|
+
* automation without the consumer repeating the name as a `testId`.
|
|
160
|
+
*
|
|
121
161
|
* @example
|
|
122
162
|
* ```html
|
|
123
163
|
* <!-- component-owned prefix: emits data-testid="button-save" -->
|
|
@@ -200,6 +240,8 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
|
|
|
200
240
|
emptyLabel: _angular_core.InputSignal<string>;
|
|
201
241
|
disabled: _angular_core.InputSignal<boolean>;
|
|
202
242
|
testId: _angular_core.InputSignal<TnTestIdValue>;
|
|
243
|
+
/** Test-id base, falling back to the bound control name when `testId` is unset. */
|
|
244
|
+
protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
|
|
203
245
|
multiple: _angular_core.InputSignal<boolean>;
|
|
204
246
|
/**
|
|
205
247
|
* Optional extractor for the per-option test-id discriminator. Defaults to
|
|
@@ -245,8 +287,9 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
|
|
|
245
287
|
private instanceId;
|
|
246
288
|
/**
|
|
247
289
|
* Id namespace used by all DOM ids the template emits (dropdown panel,
|
|
248
|
-
* option rows, group labels). Prefers
|
|
249
|
-
*
|
|
290
|
+
* option rows, group labels). Prefers the resolved test-id base (explicit
|
|
291
|
+
* `testId`, else the bound control name) so tests can target specific
|
|
292
|
+
* instances; otherwise falls back to a per-instance counter so two
|
|
250
293
|
* `<tn-select>`s on the same page never collide on `aria-controls`/group ids.
|
|
251
294
|
*/
|
|
252
295
|
protected idNamespace: _angular_core.Signal<string>;
|
|
@@ -279,11 +322,11 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
|
|
|
279
322
|
isOptionFocused(option: TnSelectOption<T>): boolean;
|
|
280
323
|
/**
|
|
281
324
|
* Test-id segments for an option row, consumed by `[tnTestId]` with
|
|
282
|
-
* `tnTestIdType="option"`. The select's
|
|
283
|
-
*
|
|
284
|
-
* `
|
|
285
|
-
* comes from `optionTestIdKey` when
|
|
286
|
-
* `value`, else its `label`.
|
|
325
|
+
* `tnTestIdType="option"`. The select's resolved base (explicit `testId`, else
|
|
326
|
+
* the bound control name) scopes each option so ids stay unique across selects:
|
|
327
|
+
* base `quick-filters` + option value `ssd` → `option-quick-filters-ssd`; with
|
|
328
|
+
* no base → `option-ssd`. The discriminator comes from `optionTestIdKey` when
|
|
329
|
+
* provided, else the option's primitive `value`, else its `label`.
|
|
287
330
|
*/
|
|
288
331
|
protected optionTestIdParts(option: TnSelectOption<T>): (string | number | null | undefined)[];
|
|
289
332
|
private onChange;
|
|
@@ -1608,6 +1651,8 @@ declare class TnInputComponent implements AfterViewInit, OnDestroy, ControlValue
|
|
|
1608
1651
|
inputType: _angular_core.InputSignal<InputType>;
|
|
1609
1652
|
placeholder: _angular_core.InputSignal<string>;
|
|
1610
1653
|
testId: _angular_core.InputSignal<TnTestIdValue>;
|
|
1654
|
+
/** Test-id base, falling back to the bound control name when `testId` is unset. */
|
|
1655
|
+
protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
|
|
1611
1656
|
disabled: _angular_core.InputSignal<boolean>;
|
|
1612
1657
|
multiline: _angular_core.InputSignal<boolean>;
|
|
1613
1658
|
rows: _angular_core.InputSignal<number>;
|
|
@@ -3240,6 +3285,8 @@ declare class TnCheckboxComponent implements AfterViewInit, OnDestroy, ControlVa
|
|
|
3240
3285
|
required: _angular_core.InputSignal<boolean>;
|
|
3241
3286
|
indeterminate: _angular_core.InputSignal<boolean>;
|
|
3242
3287
|
testId: _angular_core.InputSignal<TnTestIdValue>;
|
|
3288
|
+
/** Test-id base, falling back to the bound control name when `testId` is unset. */
|
|
3289
|
+
protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
|
|
3243
3290
|
error: _angular_core.InputSignal<string | null>;
|
|
3244
3291
|
checked: _angular_core.InputSignal<boolean>;
|
|
3245
3292
|
change: _angular_core.OutputEmitterRef<boolean>;
|
|
@@ -3449,6 +3496,8 @@ declare class TnRadioComponent implements AfterViewInit, OnDestroy, ControlValue
|
|
|
3449
3496
|
disabled: _angular_core.InputSignal<boolean>;
|
|
3450
3497
|
required: _angular_core.InputSignal<boolean>;
|
|
3451
3498
|
testId: _angular_core.InputSignal<TnTestIdValue>;
|
|
3499
|
+
/** Test-id base, falling back to the bound control name when `testId` is unset. */
|
|
3500
|
+
protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
|
|
3452
3501
|
error: _angular_core.InputSignal<string | null>;
|
|
3453
3502
|
change: _angular_core.OutputEmitterRef<unknown>;
|
|
3454
3503
|
id: string;
|
|
@@ -3592,6 +3641,8 @@ declare class TnSlideToggleComponent implements AfterViewInit, OnDestroy, Contro
|
|
|
3592
3641
|
required: _angular_core.InputSignal<boolean>;
|
|
3593
3642
|
color: _angular_core.InputSignal<SlideToggleColor>;
|
|
3594
3643
|
testId: _angular_core.InputSignal<TnTestIdValue>;
|
|
3644
|
+
/** Test-id base, falling back to the bound control name when `testId` is unset. */
|
|
3645
|
+
protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
|
|
3595
3646
|
ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
3596
3647
|
ariaLabelledby: _angular_core.InputSignal<string | undefined>;
|
|
3597
3648
|
checked: _angular_core.InputSignal<boolean>;
|
|
@@ -8678,5 +8729,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
|
|
|
8678
8729
|
*/
|
|
8679
8730
|
declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
|
|
8680
8731
|
|
|
8681
|
-
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFileInputComponent, TnFileInputHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
|
|
8732
|
+
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFileInputComponent, TnFileInputHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, controlTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
|
|
8682
8733
|
export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, ChipHarnessFilters, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FileInputHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, FormSectionHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelMarkupSegment, LabelMarkupSegmentType, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SizeStandard, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnAutocompleteOption, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnChipInputHarnessFilters, TnChipInputOption, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnFormFieldErrorMessage, TnFormFieldErrorMessages, TnFormFieldErrorResolver, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnTestIdValue, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };
|