@truenas/ui-components 0.1.30 → 0.1.31
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 { ElementRef, OnDestroy, AfterViewInit, AfterContentInit, TemplateRef, Provider, ChangeDetectorRef, PipeTransform, OnInit, ViewContainerRef, AfterViewChecked } from '@angular/core';
|
|
2
|
+
import { ElementRef, OnDestroy, AfterViewInit, AfterContentInit, TemplateRef, Provider, ChangeDetectorRef, PipeTransform, OnInit, 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';
|
|
@@ -7,6 +7,7 @@ import { DataSource } from '@angular/cdk/collections';
|
|
|
7
7
|
import * as i1 from '@angular/cdk/tree';
|
|
8
8
|
import { CdkTree, FlatTreeControl, CdkTreeNode, CdkNestedTreeNode } from '@angular/cdk/tree';
|
|
9
9
|
export { FlatTreeControl } from '@angular/cdk/tree';
|
|
10
|
+
import * as rxjs from 'rxjs';
|
|
10
11
|
import { Observable } from 'rxjs';
|
|
11
12
|
import { Overlay } from '@angular/cdk/overlay';
|
|
12
13
|
import { DialogConfig, DialogRef } from '@angular/cdk/dialog';
|
|
@@ -4596,6 +4597,159 @@ interface EmptyHarnessFilters extends BaseHarnessFilters {
|
|
|
4596
4597
|
title?: string | RegExp;
|
|
4597
4598
|
}
|
|
4598
4599
|
|
|
4600
|
+
declare enum TnToastType {
|
|
4601
|
+
Info = "info",
|
|
4602
|
+
Success = "success",
|
|
4603
|
+
Warning = "warning",
|
|
4604
|
+
Error = "error"
|
|
4605
|
+
}
|
|
4606
|
+
declare enum TnToastPosition {
|
|
4607
|
+
Top = "top",
|
|
4608
|
+
Bottom = "bottom"
|
|
4609
|
+
}
|
|
4610
|
+
interface TnToastConfig {
|
|
4611
|
+
/** Auto-dismiss duration in milliseconds. Default: 4000. Set to 0 to disable. */
|
|
4612
|
+
duration?: number;
|
|
4613
|
+
/** Visual style of the toast. Default: TnToastType.Info. */
|
|
4614
|
+
type?: TnToastType;
|
|
4615
|
+
/** Vertical position. Default: TnToastPosition.Bottom. */
|
|
4616
|
+
position?: TnToastPosition;
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
declare class TnToastComponent {
|
|
4620
|
+
message: _angular_core.WritableSignal<string>;
|
|
4621
|
+
action: _angular_core.WritableSignal<string | null>;
|
|
4622
|
+
type: _angular_core.WritableSignal<TnToastType>;
|
|
4623
|
+
position: _angular_core.WritableSignal<TnToastPosition>;
|
|
4624
|
+
visible: _angular_core.WritableSignal<boolean>;
|
|
4625
|
+
icon: _angular_core.Signal<string>;
|
|
4626
|
+
onAction: () => void;
|
|
4627
|
+
onDismiss: () => void;
|
|
4628
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnToastComponent, never>;
|
|
4629
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnToastComponent, "tn-toast", never, {}, {}, never, never, true, never>;
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
declare class TnToastRef {
|
|
4633
|
+
private readonly _onAction;
|
|
4634
|
+
private readonly _afterDismissed;
|
|
4635
|
+
private _dismissed;
|
|
4636
|
+
/** @internal */
|
|
4637
|
+
_componentRef?: ComponentRef<TnToastComponent>;
|
|
4638
|
+
/** Observable that emits when the action button is clicked. */
|
|
4639
|
+
onAction(): rxjs.Observable<void>;
|
|
4640
|
+
/** Observable that emits when the toast is dismissed (by action, duration, or programmatically). */
|
|
4641
|
+
afterDismissed(): rxjs.Observable<void>;
|
|
4642
|
+
/** Programmatically dismiss the toast. */
|
|
4643
|
+
dismiss(): void;
|
|
4644
|
+
/** @internal */
|
|
4645
|
+
_triggerAction(): void;
|
|
4646
|
+
}
|
|
4647
|
+
declare class TnToastService {
|
|
4648
|
+
private appRef;
|
|
4649
|
+
private injector;
|
|
4650
|
+
private activeRef;
|
|
4651
|
+
/**
|
|
4652
|
+
* Opens a toast notification.
|
|
4653
|
+
*
|
|
4654
|
+
* @param message The message to display.
|
|
4655
|
+
* @param actionOrConfig Optional action button text, or config object.
|
|
4656
|
+
* @param config Optional config when action is provided as second arg.
|
|
4657
|
+
* @returns A TnToastRef that can be used to dismiss the toast or listen for events.
|
|
4658
|
+
*
|
|
4659
|
+
* @example
|
|
4660
|
+
* ```typescript
|
|
4661
|
+
* // Simple notification
|
|
4662
|
+
* this.toast.open('Changes saved');
|
|
4663
|
+
*
|
|
4664
|
+
* // With action button
|
|
4665
|
+
* const ref = this.toast.open('Item deleted', 'Undo');
|
|
4666
|
+
* ref.onAction().subscribe(() => this.undoDelete());
|
|
4667
|
+
*
|
|
4668
|
+
* // With config
|
|
4669
|
+
* this.toast.open('Error occurred', { type: 'error', duration: 6000 });
|
|
4670
|
+
*
|
|
4671
|
+
* // Action + config
|
|
4672
|
+
* this.toast.open('Failed to save', 'Retry', { type: 'error' });
|
|
4673
|
+
* ```
|
|
4674
|
+
*/
|
|
4675
|
+
open(message: string, actionOrConfig?: string | TnToastConfig, config?: TnToastConfig): TnToastRef;
|
|
4676
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnToastService, never>;
|
|
4677
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TnToastService>;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
/**
|
|
4681
|
+
* A recorded toast call for test assertions.
|
|
4682
|
+
*/
|
|
4683
|
+
interface TnToastCall {
|
|
4684
|
+
message: string;
|
|
4685
|
+
action?: string;
|
|
4686
|
+
config: TnToastConfig;
|
|
4687
|
+
ref: TnToastRef;
|
|
4688
|
+
}
|
|
4689
|
+
/**
|
|
4690
|
+
* A mock implementation of TnToastService for unit testing.
|
|
4691
|
+
*
|
|
4692
|
+
* Records all `open()` calls so tests can assert on toast messages,
|
|
4693
|
+
* types, and actions without rendering actual toast components.
|
|
4694
|
+
*
|
|
4695
|
+
* @example
|
|
4696
|
+
* ```typescript
|
|
4697
|
+
* import { TnToastTesting } from '@truenas/ui-components';
|
|
4698
|
+
*
|
|
4699
|
+
* let toastMock: TnToastMock;
|
|
4700
|
+
*
|
|
4701
|
+
* beforeEach(() => {
|
|
4702
|
+
* toastMock = new TnToastMock();
|
|
4703
|
+
* TestBed.configureTestingModule({
|
|
4704
|
+
* providers: [TnToastTesting.providers(toastMock)],
|
|
4705
|
+
* });
|
|
4706
|
+
* });
|
|
4707
|
+
*
|
|
4708
|
+
* it('should show success toast', () => {
|
|
4709
|
+
* // ... trigger action that opens a toast
|
|
4710
|
+
* expect(toastMock.calls.length).toBe(1);
|
|
4711
|
+
* expect(toastMock.lastCall?.message).toBe('Saved successfully');
|
|
4712
|
+
* expect(toastMock.lastCall?.config.type).toBe(TnToastType.Success);
|
|
4713
|
+
* });
|
|
4714
|
+
*
|
|
4715
|
+
* it('should handle action click', () => {
|
|
4716
|
+
* // ... trigger action that opens a toast with action
|
|
4717
|
+
* toastMock.lastCall?.ref._triggerAction();
|
|
4718
|
+
* // ... assert retry behavior
|
|
4719
|
+
* });
|
|
4720
|
+
* ```
|
|
4721
|
+
*/
|
|
4722
|
+
declare class TnToastMock {
|
|
4723
|
+
/** All recorded toast open() calls. */
|
|
4724
|
+
calls: TnToastCall[];
|
|
4725
|
+
/** The most recent toast call, or undefined if none. */
|
|
4726
|
+
get lastCall(): TnToastCall | undefined;
|
|
4727
|
+
/** Clears all recorded calls. */
|
|
4728
|
+
reset(): void;
|
|
4729
|
+
open(message: string, actionOrConfig?: string | TnToastConfig, config?: TnToastConfig): TnToastRef;
|
|
4730
|
+
}
|
|
4731
|
+
/**
|
|
4732
|
+
* Test utilities for TnToastService.
|
|
4733
|
+
*
|
|
4734
|
+
* Provides a mock that records toast calls without rendering components,
|
|
4735
|
+
* making tests fast and deterministic.
|
|
4736
|
+
*
|
|
4737
|
+
* @example
|
|
4738
|
+
* ```typescript
|
|
4739
|
+
* const toastMock = new TnToastMock();
|
|
4740
|
+
*
|
|
4741
|
+
* TestBed.configureTestingModule({
|
|
4742
|
+
* providers: [TnToastTesting.providers(toastMock)],
|
|
4743
|
+
* });
|
|
4744
|
+
* ```
|
|
4745
|
+
*/
|
|
4746
|
+
declare class TnToastTesting {
|
|
4747
|
+
/**
|
|
4748
|
+
* Returns providers that replace TnToastService with the given mock.
|
|
4749
|
+
*/
|
|
4750
|
+
static providers(mock: TnToastMock): Provider[];
|
|
4751
|
+
}
|
|
4752
|
+
|
|
4599
4753
|
interface KeyCombination {
|
|
4600
4754
|
ctrlKey: boolean;
|
|
4601
4755
|
altKey: boolean;
|
|
@@ -4879,5 +5033,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
|
|
|
4879
5033
|
*/
|
|
4880
5034
|
declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
|
|
4881
5035
|
|
|
4882
|
-
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, 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, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTabsHarness, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
|
|
4883
|
-
export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, CreateFolderEvent, DateRange, DialogHarnessFilters, EmptyHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };
|
|
5036
|
+
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, 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, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTabsHarness, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
|
|
5037
|
+
export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, CreateFolderEvent, DateRange, DialogHarnessFilters, EmptyHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };
|