@truenas/ui-components 0.8.15 → 0.8.17

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.8.15",
3
+ "version": "0.8.17",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -15,7 +15,7 @@
15
15
  * which is the whole promise being made here — that a mock goes in.
16
16
  */
17
17
  import * as i0 from "@angular/core";
18
- import { AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectorRef, ComponentRef, DoCheck, ElementRef, InjectionToken, OnChanges, OnDestroy, OnInit, PipeTransform, Provider, Renderer2, Signal, SimpleChanges, TemplateRef, TrackByFunction, ViewContainerRef } from "@angular/core";
18
+ import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ComponentRef, DoCheck, ElementRef, InjectionToken, OnChanges, OnDestroy, OnInit, PipeTransform, Provider, Renderer2, Signal, SimpleChanges, TemplateRef, TrackByFunction, ViewContainerRef } from "@angular/core";
19
19
  import { AbstractControl, ControlValueAccessor, NgControl, ValidationErrors } from "@angular/forms";
20
20
  import { BehaviorSubject, Observable } from "rxjs";
21
21
  import { BaseHarnessFilters, ComponentHarness, HarnessLoader, HarnessPredicate, ModifierKeys as ModifierKeys$1, TestKey } from "@angular/cdk/testing";
@@ -18362,6 +18362,11 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18362
18362
  * path to the popup.
18363
18363
  */
18364
18364
  openOnClick: import("@angular/core").InputSignal<boolean>;
18365
+ /**
18366
+ * Left at its English default, the input shows
18367
+ * `TN_FILE_PICKER_LABELS.placeholder` instead, so an app-root labels
18368
+ * provider translates it; any other value is shown as given.
18369
+ */
18365
18370
  placeholder: import("@angular/core").InputSignal<string>;
18366
18371
  disabled: import("@angular/core").InputSignal<boolean>;
18367
18372
  /**
@@ -18446,6 +18451,8 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18446
18451
  * on disk after it was listed.
18447
18452
  */
18448
18453
  private listedItems;
18454
+ protected readonly labels: import("@angular/core").Signal<import("@truenas/ui-components").TnFilePickerLabels>;
18455
+ protected readonly resolvedPlaceholder: import("@angular/core").Signal<string>;
18449
18456
  isDisabled: import("@angular/core").Signal<boolean>;
18450
18457
  private effectiveCallbacks;
18451
18458
  private effectiveStartPath;
@@ -18696,6 +18703,70 @@ export declare class TnFilePickerComponent implements ControlValueAccessor, OnIn
18696
18703
  "error": "error";
18697
18704
  }, never, never, true, never>;
18698
18705
  }
18706
+ /**
18707
+ * Every string `tn-file-picker` and its popup render or announce. Consumers
18708
+ * translate them once at the app root by providing `TN_FILE_PICKER_LABELS` —
18709
+ * typically wired to an i18n service — instead of per call site. A
18710
+ * `placeholder` input bound to anything but its English default wins over
18711
+ * `placeholder` here.
18712
+ *
18713
+ * Strings that carry a value (a count, a path, a name) are functions, so the
18714
+ * consumer decides how to place it: a word order, an ICU plural, a translated
18715
+ * template — the library imposes no placeholder syntax.
18716
+ */
18717
+ export interface TnFilePickerLabels {
18718
+ /** Empty path input. */
18719
+ placeholder: string;
18720
+ /** Accessible name of the folder button that opens the popup. */
18721
+ openPicker: string;
18722
+ /** Accessible name of the breadcrumb `nav`. */
18723
+ breadcrumb: string;
18724
+ /** Accessible name of a collapsed (`…`) or nameless breadcrumb segment. */
18725
+ navigateTo: (path: string) => string;
18726
+ loading: string;
18727
+ /** The listing's empty state. */
18728
+ noItems: string;
18729
+ /** Visually hidden header of the multi-select checkbox column. */
18730
+ selectColumn: string;
18731
+ /** Accessible name of an item's multi-select checkbox. */
18732
+ selectItem: (name: string) => string;
18733
+ /** Accessible name and tooltip of a directory's open (chevron) button. */
18734
+ openItem: (name: string) => string;
18735
+ nameColumn: string;
18736
+ sizeColumn: string;
18737
+ modifiedColumn: string;
18738
+ /** Footer, while items are picked. */
18739
+ itemsSelected: (count: number) => string;
18740
+ /** Footer, when the browsed directory itself would be picked. */
18741
+ currentDirectorySelected: string;
18742
+ /** Footer, when nothing is picked and the directory cannot be. */
18743
+ noItemsSelected: string;
18744
+ clearSelection: string;
18745
+ /** The footer button that applies the selection. */
18746
+ select: string;
18747
+ /** Accessible name of the inline creation row's input, from the action's label. */
18748
+ inlineCreateName: (actionLabel: string) => string;
18749
+ /** Inline creation row, when the `create` callback rejects with something other than an Error. */
18750
+ inlineCreateFailed: string;
18751
+ /** Modified column, for an item changed today / yesterday; `time` is already formatted. */
18752
+ today: (time: string) => string;
18753
+ yesterday: (time: string) => string;
18754
+ /** Error messages — shown in the popup and carried by the `error` output. */
18755
+ pathOutsideRoot: (rootPath: string) => string;
18756
+ invalidPath: (path: string) => string;
18757
+ pathValidationFailed: string;
18758
+ loadFailed: string;
18759
+ createFailed: string;
18760
+ createdOutsideRoot: (rootPath: string) => string;
18761
+ }
18762
+ /** English defaults used when no `TN_FILE_PICKER_LABELS` provider is registered. */
18763
+ export declare const TN_FILE_PICKER_DEFAULT_LABELS: TnFilePickerLabels;
18764
+ /**
18765
+ * DI token for app-wide file picker labels. Provide either a static object or a
18766
+ * `Signal<TnFilePickerLabels>` — the latter lets an open picker follow a
18767
+ * language change.
18768
+ */
18769
+ export declare const TN_FILE_PICKER_LABELS: InjectionToken<TnFilePickerLabels | Signal<TnFilePickerLabels>>;
18699
18770
  /**
18700
18771
  * Harness for interacting with tn-file-picker in tests.
18701
18772
  *
@@ -18988,7 +19059,7 @@ interface DisplayedFileItem extends FileSystemItem {
18988
19059
  /** Marks the synthetic first row hosting the inline creation input. */
18989
19060
  inlineCreate?: boolean;
18990
19061
  }
18991
- export declare class TnFilePickerPopupComponent implements AfterViewChecked {
19062
+ export declare class TnFilePickerPopupComponent {
18992
19063
  /**
18993
19064
  * What can be selected: a single mode, or an explicit list of selectable
18994
19065
  * item types, e.g. ['folder', 'dataset'].
@@ -19022,26 +19093,19 @@ export declare class TnFilePickerPopupComponent implements AfterViewChecked {
19022
19093
  * one popup can be open at a time.
19023
19094
  */
19024
19095
  testIdBase: import("@angular/core").InputSignal<TnTestIdValue>;
19096
+ protected readonly labels: import("@angular/core").Signal<import("@truenas/ui-components").TnFilePickerLabels>;
19025
19097
  private iconRegistry;
19026
19098
  private elementRef;
19027
19099
  constructor();
19028
19100
  /**
19029
- * Requests a focus of the inline creation input on the next view check.
19101
+ * Requests a focus of the inline creation input after the next render.
19030
19102
  * Set when the row opens and when a failed attempt re-enables the input —
19031
19103
  * the two moments the input either just entered the DOM or just lost focus
19032
- * to the `disabled` attribute. Cleared once the focus is scheduled, so
19033
- * focus is NOT permanently forced back: after an error the user can still
19034
- * click elsewhere without being trapped in the input.
19035
- */
19036
- private pendingCreationFocus;
19037
- /**
19038
- * Focus runs here rather than at the call sites because the input may not
19039
- * be in the DOM (or may still be disabled) until a later view check, and a
19040
- * re-render can replace the element after focus() was scheduled — render
19041
- * scheduling differs between hosts. So the request keeps retrying on each
19042
- * check and is cleared only once the input actually holds focus.
19104
+ * to the `disabled` attribute. Cleared once focus is applied, so focus is
19105
+ * NOT permanently forced back: after an error the user can still click
19106
+ * elsewhere without being trapped in the input.
19043
19107
  */
19044
- ngAfterViewChecked(): void;
19108
+ private readonly creationFocusRequested;
19045
19109
  itemClick: import("@angular/core").OutputEmitterRef<FileSystemItem>;
19046
19110
  itemDoubleClick: import("@angular/core").OutputEmitterRef<FileSystemItem>;
19047
19111
  pathNavigate: import("@angular/core").OutputEmitterRef<string>;
@@ -19054,6 +19118,12 @@ export declare class TnFilePickerPopupComponent implements AfterViewChecked {
19054
19118
  submit: import("@angular/core").OutputEmitterRef<void>;
19055
19119
  cancel: import("@angular/core").OutputEmitterRef<void>;
19056
19120
  displayedColumns: string[];
19121
+ /**
19122
+ * The empty directory is the table's own empty state, worded for a listing —
19123
+ * a second empty-state block here would render under it, so the popup only
19124
+ * words and decorates the table's.
19125
+ */
19126
+ protected readonly emptyIcon: string;
19057
19127
  /**
19058
19128
  * Whether an empty selection stands for the directory being browsed: true
19059
19129
  * whenever the selectable types include a directory-like type. The footer