@truenas/ui-components 0.1.58 → 0.1.59
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,15 +1,15 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { ElementRef, OnDestroy, AfterViewInit, AfterContentInit, TemplateRef, Provider, ChangeDetectorRef, OnInit, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef
|
|
2
|
+
import { ElementRef, OnDestroy, AfterViewInit, AfterContentInit, TemplateRef, Provider, ChangeDetectorRef, OnInit, 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';
|
|
6
6
|
import { ComponentFixture } from '@angular/core/testing';
|
|
7
7
|
import { SelectionModel, DataSource } from '@angular/cdk/collections';
|
|
8
|
+
import * as rxjs from 'rxjs';
|
|
9
|
+
import { Observable } from 'rxjs';
|
|
8
10
|
import * as i1 from '@angular/cdk/tree';
|
|
9
11
|
import { CdkTree, FlatTreeControl, CdkTreeNode, CdkNestedTreeNode } from '@angular/cdk/tree';
|
|
10
12
|
export { FlatTreeControl } from '@angular/cdk/tree';
|
|
11
|
-
import * as rxjs from 'rxjs';
|
|
12
|
-
import { Observable } from 'rxjs';
|
|
13
13
|
import { Overlay } from '@angular/cdk/overlay';
|
|
14
14
|
import { DialogConfig, DialogRef } from '@angular/cdk/dialog';
|
|
15
15
|
import { ComponentType } from '@angular/cdk/portal';
|
|
@@ -2933,40 +2933,141 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor {
|
|
|
2933
2933
|
options: _angular_core.InputSignal<TnSelectOption<T>[]>;
|
|
2934
2934
|
optionGroups: _angular_core.InputSignal<TnSelectOptionGroup<T>[]>;
|
|
2935
2935
|
placeholder: _angular_core.InputSignal<string>;
|
|
2936
|
+
/**
|
|
2937
|
+
* Accessible label for the select trigger. When set, this is used as the
|
|
2938
|
+
* trigger's `aria-label` instead of the visible `placeholder` — useful in
|
|
2939
|
+
* contexts (e.g. a pager's page-size dropdown) where the placeholder text
|
|
2940
|
+
* doesn't accurately describe the field's purpose to screen readers.
|
|
2941
|
+
*/
|
|
2942
|
+
ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
2943
|
+
/**
|
|
2944
|
+
* Message shown inside the dropdown when no options (and no option groups)
|
|
2945
|
+
* are available. Defaults to the English `'No options available'`; consumers
|
|
2946
|
+
* with i18n requirements can pass a translated string.
|
|
2947
|
+
*/
|
|
2948
|
+
noOptionsLabel: _angular_core.InputSignal<string>;
|
|
2936
2949
|
disabled: _angular_core.InputSignal<boolean>;
|
|
2937
2950
|
testId: _angular_core.InputSignal<string>;
|
|
2938
2951
|
multiple: _angular_core.InputSignal<boolean>;
|
|
2952
|
+
/**
|
|
2953
|
+
* Custom comparator for matching option values against the selected value(s).
|
|
2954
|
+
*
|
|
2955
|
+
* When the option values are objects, **provide this** — the built-in
|
|
2956
|
+
* fallback uses `JSON.stringify`, which is key-order dependent and can
|
|
2957
|
+
* produce false negatives for structurally equal objects. For primitives the
|
|
2958
|
+
* default identity check is fine.
|
|
2959
|
+
*/
|
|
2939
2960
|
compareWith: _angular_core.InputSignal<((a: T | null, b: T | null) => boolean) | undefined>;
|
|
2940
2961
|
selectionChange: _angular_core.OutputEmitterRef<T>;
|
|
2941
2962
|
/** Emits the full array of selected values after each toggle in multiple mode. */
|
|
2942
2963
|
multiSelectionChange: _angular_core.OutputEmitterRef<T[]>;
|
|
2943
2964
|
protected isOpen: _angular_core.WritableSignal<boolean>;
|
|
2965
|
+
protected dropdownPosition: _angular_core.WritableSignal<"above" | "below">;
|
|
2944
2966
|
protected selectedValue: _angular_core.WritableSignal<T | null>;
|
|
2945
2967
|
protected selectedValues: _angular_core.WritableSignal<T[]>;
|
|
2968
|
+
/** Index into `flatOptions` of the keyboard-focused row (-1 when none). */
|
|
2969
|
+
protected focusedIndex: _angular_core.WritableSignal<number>;
|
|
2946
2970
|
private formDisabled;
|
|
2971
|
+
private static readonly DROPDOWN_MAX_HEIGHT_VAR;
|
|
2972
|
+
private static readonly DROPDOWN_MAX_HEIGHT_FALLBACK;
|
|
2973
|
+
private readonly fallbackId;
|
|
2974
|
+
protected uniqueId: _angular_core.Signal<string>;
|
|
2947
2975
|
isDisabled: _angular_core.Signal<boolean>;
|
|
2976
|
+
/**
|
|
2977
|
+
* Flattened option list (ungrouped + grouped, in render order). The keyboard
|
|
2978
|
+
* navigation walks this list — entries from disabled groups are kept but
|
|
2979
|
+
* marked disabled so the cursor skips over them correctly.
|
|
2980
|
+
*/
|
|
2981
|
+
protected flatOptions: _angular_core.Signal<TnSelectOption<T>[]>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Starting flat-index of each option group, used by the template to
|
|
2984
|
+
* translate a (group, option) pair into the matching `flatOptions` index.
|
|
2985
|
+
*/
|
|
2986
|
+
protected groupOffsets: _angular_core.Signal<number[]>;
|
|
2987
|
+
/** `aria-activedescendant` id for the focused option (or null). */
|
|
2988
|
+
protected activeOptionId: _angular_core.Signal<string | null>;
|
|
2948
2989
|
private onChange;
|
|
2949
2990
|
private onTouched;
|
|
2950
2991
|
private elementRef;
|
|
2951
2992
|
private cdr;
|
|
2993
|
+
protected triggerEl: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
|
|
2952
2994
|
constructor();
|
|
2953
2995
|
writeValue(value: T | T[] | null): void;
|
|
2954
2996
|
registerOnChange(fn: (value: T | T[] | null) => void): void;
|
|
2955
2997
|
registerOnTouched(fn: () => void): void;
|
|
2956
2998
|
setDisabledState(isDisabled: boolean): void;
|
|
2957
2999
|
toggleDropdown(): void;
|
|
2958
|
-
|
|
3000
|
+
/**
|
|
3001
|
+
* Open the dropdown, seed the keyboard cursor on the currently-selected
|
|
3002
|
+
* option (or the first focusable one), and decide whether to flip up.
|
|
3003
|
+
*/
|
|
3004
|
+
private openDropdown;
|
|
3005
|
+
/**
|
|
3006
|
+
* Close the dropdown.
|
|
3007
|
+
*
|
|
3008
|
+
* @param restoreFocus When `true` (default), return focus to the trigger so
|
|
3009
|
+
* keyboard users land somewhere sensible. Pass `false` for click-outside
|
|
3010
|
+
* so we don't steal focus from the element the user just navigated to.
|
|
3011
|
+
*/
|
|
3012
|
+
closeDropdown(options?: {
|
|
3013
|
+
restoreFocus?: boolean;
|
|
3014
|
+
}): void;
|
|
3015
|
+
/** Picks the initial focused-row index when the dropdown opens. */
|
|
3016
|
+
private initialFocusIndex;
|
|
3017
|
+
/**
|
|
3018
|
+
* Decide whether the dropdown should open above or below the trigger.
|
|
3019
|
+
* Opens above when there isn't enough space below the trigger AND there is
|
|
3020
|
+
* more space above — otherwise stays below. Falls back to `'below'` when no
|
|
3021
|
+
* trigger element is found yet.
|
|
3022
|
+
*/
|
|
3023
|
+
private computeDropdownPosition;
|
|
3024
|
+
/**
|
|
3025
|
+
* Reads the dropdown's max-height from the CSS custom property set in
|
|
3026
|
+
* select.component.scss. Single source of truth for the flip-up threshold —
|
|
3027
|
+
* if the stylesheet changes, the heuristic follows automatically.
|
|
3028
|
+
*/
|
|
3029
|
+
private readDropdownMaxHeight;
|
|
2959
3030
|
onOptionClick(option: TnSelectOption<T>, groupDisabled?: boolean): void;
|
|
2960
3031
|
selectOption(option: TnSelectOption<T>): void;
|
|
2961
3032
|
private toggleOption;
|
|
2962
3033
|
isOptionSelected(option: TnSelectOption<T>): boolean;
|
|
2963
|
-
|
|
3034
|
+
/** Build a stable DOM id for the option at `index` for aria-activedescendant. */
|
|
3035
|
+
protected optionId(index: number): string;
|
|
3036
|
+
protected displayText: _angular_core.Signal<string>;
|
|
2964
3037
|
private findOptionByValue;
|
|
2965
|
-
|
|
3038
|
+
protected anyOptionsPresent: _angular_core.Signal<boolean>;
|
|
3039
|
+
/**
|
|
3040
|
+
* Compares two option values for equality. Uses `compareWith` if provided,
|
|
3041
|
+
* otherwise identity (`===`). For object values it falls back to
|
|
3042
|
+
* `JSON.stringify`, which is key-order dependent — consumers with object
|
|
3043
|
+
* values should provide `compareWith` to avoid subtle bugs.
|
|
3044
|
+
*/
|
|
2966
3045
|
private compareValues;
|
|
3046
|
+
/**
|
|
3047
|
+
* Keyboard handling on the trigger (focus stays on the trigger while the
|
|
3048
|
+
* dropdown is open — options use mousedown-preventDefault to avoid stealing
|
|
3049
|
+
* it). Implements the WAI-ARIA combobox pattern subset we need:
|
|
3050
|
+
*
|
|
3051
|
+
* - **Enter / Space**: open closed dropdown, or select the focused row
|
|
3052
|
+
* (toggle in multi-mode).
|
|
3053
|
+
* - **ArrowDown / ArrowUp**: move the focused row; opens the dropdown first
|
|
3054
|
+
* if it's closed.
|
|
3055
|
+
* - **Home / End**: jump to first / last focusable row (when open).
|
|
3056
|
+
* - **Escape**: close and restore focus to the trigger.
|
|
3057
|
+
* - **Tab**: close without preventing default so focus moves to the next
|
|
3058
|
+
* element naturally.
|
|
3059
|
+
*/
|
|
2967
3060
|
onKeydown(event: KeyboardEvent): void;
|
|
3061
|
+
/** Step the focused row by ±1 (or more), skipping disabled options. */
|
|
3062
|
+
private moveFocus;
|
|
3063
|
+
/** Move focus to a specific index, scanning forward/backward to skip disabled. */
|
|
3064
|
+
private moveFocusTo;
|
|
3065
|
+
/** Select (or toggle, in multi-mode) the currently keyboard-focused row. */
|
|
3066
|
+
private selectFocused;
|
|
3067
|
+
/** Scrolls the keyboard-focused option into view if it's outside the dropdown's viewport. */
|
|
3068
|
+
private scrollFocusedIntoView;
|
|
2968
3069
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnSelectComponent<any>, never>;
|
|
2969
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSelectComponent<any>, "tn-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionGroups": { "alias": "optionGroups"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; "multiSelectionChange": "multiSelectionChange"; }, never, never, true, never>;
|
|
3070
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnSelectComponent<any>, "tn-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionGroups": { "alias": "optionGroups"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "noOptionsLabel": { "alias": "noOptionsLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; "multiSelectionChange": "multiSelectionChange"; }, never, never, true, never>;
|
|
2970
3071
|
}
|
|
2971
3072
|
|
|
2972
3073
|
/**
|
|
@@ -3943,6 +4044,238 @@ declare class TnTableHarness extends ComponentHarness {
|
|
|
3943
4044
|
interface TnTableHarnessFilters extends BaseHarnessFilters {
|
|
3944
4045
|
}
|
|
3945
4046
|
|
|
4047
|
+
/**
|
|
4048
|
+
* Default labels rendered inside `tn-table-pager`. Consumers can override any
|
|
4049
|
+
* subset of these at the app root by providing a value for the
|
|
4050
|
+
* `TN_TABLE_PAGER_LABELS` token — typically wired up to an i18n service so the
|
|
4051
|
+
* pager picks up translated copy without each call site having to bind six
|
|
4052
|
+
* label inputs. Inputs on `<tn-table-pager>` still win when explicitly set.
|
|
4053
|
+
*/
|
|
4054
|
+
interface TnTablePagerLabels {
|
|
4055
|
+
itemsPerPage: string;
|
|
4056
|
+
of: string;
|
|
4057
|
+
firstPage: string;
|
|
4058
|
+
previousPage: string;
|
|
4059
|
+
nextPage: string;
|
|
4060
|
+
lastPage: string;
|
|
4061
|
+
/** Accessible label applied to the pager's `navigation` landmark. */
|
|
4062
|
+
tablePagination: string;
|
|
4063
|
+
}
|
|
4064
|
+
/** English defaults used when no `TN_TABLE_PAGER_LABELS` provider is registered. */
|
|
4065
|
+
declare const TN_TABLE_PAGER_DEFAULT_LABELS: TnTablePagerLabels;
|
|
4066
|
+
/**
|
|
4067
|
+
* DI token for app-wide default labels. Provide either a static object or a
|
|
4068
|
+
* `Signal<TnTablePagerLabels>` — the latter lets the pager react to language
|
|
4069
|
+
* changes when the consumer wires it up to an i18n service.
|
|
4070
|
+
*
|
|
4071
|
+
* Explicit input bindings on `<tn-table-pager>` still win over these defaults.
|
|
4072
|
+
*/
|
|
4073
|
+
declare const TN_TABLE_PAGER_LABELS: InjectionToken<TnTablePagerLabels | Signal<TnTablePagerLabels>>;
|
|
4074
|
+
/** Pagination state shared between `tn-table-pager` and an arbitrary data layer. */
|
|
4075
|
+
interface TnTablePagination {
|
|
4076
|
+
pageNumber: number | null;
|
|
4077
|
+
pageSize: number | null;
|
|
4078
|
+
}
|
|
4079
|
+
/**
|
|
4080
|
+
* Minimal contract a data layer must implement to be driven by `tn-table-pager`
|
|
4081
|
+
* via the `dataProvider` input. Designed to match the shape of NAS's
|
|
4082
|
+
* `ix-table` `DataProvider<T>` so existing wrappers can be removed — but the
|
|
4083
|
+
* library itself only depends on this slim interface, not on any consumer code.
|
|
4084
|
+
*/
|
|
4085
|
+
interface TnTableDataProvider {
|
|
4086
|
+
/** Total number of rows the data layer is aware of, across all pages. */
|
|
4087
|
+
totalRows: number;
|
|
4088
|
+
/** The data layer's current pagination state. */
|
|
4089
|
+
pagination: TnTablePagination;
|
|
4090
|
+
/**
|
|
4091
|
+
* Emits whenever the data layer's state changes in a way the pager should
|
|
4092
|
+
* react to. The emitted value itself isn't read — it's purely a "something
|
|
4093
|
+
* changed, re-read me" notification.
|
|
4094
|
+
*
|
|
4095
|
+
* **Implementations must emit on**:
|
|
4096
|
+
* - page-number changes (the canonical case),
|
|
4097
|
+
* - page-size changes the data layer applies on its own, and
|
|
4098
|
+
* - **`totalRows` changes** (e.g. after a filter/refresh).
|
|
4099
|
+
*
|
|
4100
|
+
* The pager reads `totalRows` imperatively inside its sync handler, so a
|
|
4101
|
+
* provider that only emits on `pageNumber` won't surface row-count updates
|
|
4102
|
+
* to the displayed range.
|
|
4103
|
+
*
|
|
4104
|
+
* Any stream type (`Subject`, `BehaviorSubject`, `ReplaySubject`, …) works —
|
|
4105
|
+
* the pager guards against feedback loops by remembering the last pagination
|
|
4106
|
+
* it pushed and treating a matching emission as its own echo. Replay
|
|
4107
|
+
* semantics are therefore harmless but not required.
|
|
4108
|
+
*/
|
|
4109
|
+
currentPage$: Observable<unknown>;
|
|
4110
|
+
/** Pushes new pagination to the data layer; typically triggers a data refresh. */
|
|
4111
|
+
setPagination(pagination: TnTablePagination): void;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Pagination control for the `tn-table` (or any list view that paginates).
|
|
4115
|
+
*
|
|
4116
|
+
* Works in two modes:
|
|
4117
|
+
*
|
|
4118
|
+
* 1. **Dumb mode** — bind `[currentPage]`, `[pageSize]`, `[totalItems]` and listen
|
|
4119
|
+
* to `pageChange` / `pageSizeChange`. The component owns no provider state.
|
|
4120
|
+
* 2. **Data-provider mode** — bind `[dataProvider]` and the component drives
|
|
4121
|
+
* `setPagination()` on the provider, mirrors `totalRows`, and reacts to
|
|
4122
|
+
* `currentPage$` changes (with an internal guard against feedback loops).
|
|
4123
|
+
*
|
|
4124
|
+
* @example Dumb mode
|
|
4125
|
+
* ```html
|
|
4126
|
+
* <tn-table-pager
|
|
4127
|
+
* [(currentPage)]="page"
|
|
4128
|
+
* [(pageSize)]="size"
|
|
4129
|
+
* [totalItems]="total()"
|
|
4130
|
+
* (pageChange)="loadPage($event)" />
|
|
4131
|
+
* ```
|
|
4132
|
+
*
|
|
4133
|
+
* @example Data-provider mode (replaces the typical ix-table-pager wrapper)
|
|
4134
|
+
* ```html
|
|
4135
|
+
* <tn-table-pager
|
|
4136
|
+
* [dataProvider]="dataProvider()"
|
|
4137
|
+
* [pageSize]="dataProvider().pagination.pageSize ?? 50"
|
|
4138
|
+
* [currentPage]="dataProvider().pagination.pageNumber ?? 1"
|
|
4139
|
+
* [itemsPerPageLabel]="'Items per page' | translate" />
|
|
4140
|
+
* ```
|
|
4141
|
+
*/
|
|
4142
|
+
declare class TnTablePagerComponent {
|
|
4143
|
+
private destroyRef;
|
|
4144
|
+
/**
|
|
4145
|
+
* Normalize the injected token into a Signal so consumers can supply either
|
|
4146
|
+
* a plain object or a reactive signal (e.g. derived from a TranslateService's
|
|
4147
|
+
* onLangChange) and the pager re-renders when labels change.
|
|
4148
|
+
*/
|
|
4149
|
+
private readonly defaultLabels;
|
|
4150
|
+
/** 1-based index of the currently displayed page. */
|
|
4151
|
+
currentPage: _angular_core.ModelSignal<number>;
|
|
4152
|
+
/** Number of items per page. */
|
|
4153
|
+
pageSize: _angular_core.ModelSignal<number>;
|
|
4154
|
+
/** Selectable page-size values rendered in the dropdown. */
|
|
4155
|
+
pageSizeOptions: _angular_core.InputSignal<number[]>;
|
|
4156
|
+
/**
|
|
4157
|
+
* Total item count across all pages — drives `totalPages` and the range
|
|
4158
|
+
* labels. Ignored when `dataProvider` is set (the provider's `totalRows`
|
|
4159
|
+
* wins, so consumers don't have to keep both in sync).
|
|
4160
|
+
*/
|
|
4161
|
+
totalItems: _angular_core.InputSignal<number>;
|
|
4162
|
+
/**
|
|
4163
|
+
* Optional data-provider integration. When supplied, the pager initializes
|
|
4164
|
+
* the provider's pagination on the first effect run, mirrors `totalRows`
|
|
4165
|
+
* into the displayed total, and listens to `currentPage$` to sync external
|
|
4166
|
+
* page changes. Page/size changes from user input are pushed back via
|
|
4167
|
+
* `setPagination()`.
|
|
4168
|
+
*/
|
|
4169
|
+
dataProvider: _angular_core.InputSignal<TnTableDataProvider | undefined>;
|
|
4170
|
+
/**
|
|
4171
|
+
* Label inputs are nullable on purpose: the template reads the resolved
|
|
4172
|
+
* `*Label` computed signals below, which fall back to the DI-provided default
|
|
4173
|
+
* (a signal — so language changes propagate live). An explicit input binding
|
|
4174
|
+
* always wins.
|
|
4175
|
+
*/
|
|
4176
|
+
itemsPerPageLabel: _angular_core.InputSignal<string | undefined>;
|
|
4177
|
+
ofLabel: _angular_core.InputSignal<string | undefined>;
|
|
4178
|
+
firstPageLabel: _angular_core.InputSignal<string | undefined>;
|
|
4179
|
+
previousPageLabel: _angular_core.InputSignal<string | undefined>;
|
|
4180
|
+
nextPageLabel: _angular_core.InputSignal<string | undefined>;
|
|
4181
|
+
lastPageLabel: _angular_core.InputSignal<string | undefined>;
|
|
4182
|
+
tablePaginationLabel: _angular_core.InputSignal<string | undefined>;
|
|
4183
|
+
/** Resolved labels: explicit input takes precedence over the DI default. */
|
|
4184
|
+
protected resolvedItemsPerPageLabel: Signal<string>;
|
|
4185
|
+
protected resolvedOfLabel: Signal<string>;
|
|
4186
|
+
protected resolvedFirstPageLabel: Signal<string>;
|
|
4187
|
+
protected resolvedPreviousPageLabel: Signal<string>;
|
|
4188
|
+
protected resolvedNextPageLabel: Signal<string>;
|
|
4189
|
+
protected resolvedLastPageLabel: Signal<string>;
|
|
4190
|
+
protected resolvedTablePaginationLabel: Signal<string>;
|
|
4191
|
+
/** Emits the new 1-based page number whenever the user navigates. */
|
|
4192
|
+
pageChange: _angular_core.OutputEmitterRef<number>;
|
|
4193
|
+
/** Emits the new page-size value when the dropdown changes. */
|
|
4194
|
+
pageSizeChange: _angular_core.OutputEmitterRef<number>;
|
|
4195
|
+
/**
|
|
4196
|
+
* Total items reported by the data provider (when one is bound). Falls back
|
|
4197
|
+
* to `totalItems` input otherwise — see `effectiveTotalItems`.
|
|
4198
|
+
*/
|
|
4199
|
+
private providerTotalItems;
|
|
4200
|
+
/** The provider reference we're currently bound to (used to detect swaps). */
|
|
4201
|
+
private currentProvider;
|
|
4202
|
+
/** Subscription to the current provider's `currentPage$` — torn down on swap. */
|
|
4203
|
+
private providerSub;
|
|
4204
|
+
/**
|
|
4205
|
+
* Last pagination value we pushed to the provider. Used to recognize the
|
|
4206
|
+
* provider's resulting emission as our own echo and break the feedback loop
|
|
4207
|
+
* (setPagination → provider emits → syncFromProvider → setPagination …)
|
|
4208
|
+
* regardless of whether the provider emits synchronously or asynchronously,
|
|
4209
|
+
* and regardless of whether its stream replays on subscribe.
|
|
4210
|
+
*/
|
|
4211
|
+
private lastPushedPagination;
|
|
4212
|
+
protected effectiveTotalItems: Signal<number>;
|
|
4213
|
+
protected totalPages: Signal<number>;
|
|
4214
|
+
protected firstItemOnPage: Signal<number>;
|
|
4215
|
+
protected lastItemOnPage: Signal<number>;
|
|
4216
|
+
protected isFirstPageDisabled: Signal<boolean>;
|
|
4217
|
+
protected isLastPageDisabled: Signal<boolean>;
|
|
4218
|
+
protected pageSizeSelectOptions: Signal<TnSelectOption<number>[]>;
|
|
4219
|
+
constructor();
|
|
4220
|
+
private syncFromProvider;
|
|
4221
|
+
/**
|
|
4222
|
+
* Public navigation API: jump to a specific 1-based page. Used both by the
|
|
4223
|
+
* template (first/last buttons) and by consumers who want to drive the pager
|
|
4224
|
+
* programmatically. Out-of-range values and no-op transitions are silently
|
|
4225
|
+
* ignored. Sibling helpers `previousPage` / `nextPage` are template-only and
|
|
4226
|
+
* therefore `protected` — `goToPage` is intentionally part of the public API.
|
|
4227
|
+
*/
|
|
4228
|
+
goToPage(pageNumber: number): void;
|
|
4229
|
+
protected previousPage(): void;
|
|
4230
|
+
protected nextPage(): void;
|
|
4231
|
+
protected onPageSizeChange(value: number): void;
|
|
4232
|
+
/** Forwards the current page/size to the data provider, if one is bound. */
|
|
4233
|
+
private pushToProvider;
|
|
4234
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnTablePagerComponent, never>;
|
|
4235
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnTablePagerComponent, "tn-table-pager", never, { "currentPage": { "alias": "currentPage"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "totalItems": { "alias": "totalItems"; "required": false; "isSignal": true; }; "dataProvider": { "alias": "dataProvider"; "required": false; "isSignal": true; }; "itemsPerPageLabel": { "alias": "itemsPerPageLabel"; "required": false; "isSignal": true; }; "ofLabel": { "alias": "ofLabel"; "required": false; "isSignal": true; }; "firstPageLabel": { "alias": "firstPageLabel"; "required": false; "isSignal": true; }; "previousPageLabel": { "alias": "previousPageLabel"; "required": false; "isSignal": true; }; "nextPageLabel": { "alias": "nextPageLabel"; "required": false; "isSignal": true; }; "lastPageLabel": { "alias": "lastPageLabel"; "required": false; "isSignal": true; }; "tablePaginationLabel": { "alias": "tablePaginationLabel"; "required": false; "isSignal": true; }; }, { "currentPage": "currentPageChange"; "pageSize": "pageSizeChange"; "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, never, never, true, [{ directive: typeof TnTestIdDirective; inputs: { "tnTestId": "testId"; }; outputs: {}; }]>;
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
/**
|
|
4239
|
+
* Harness for interacting with `tn-table-pager` in tests.
|
|
4240
|
+
*
|
|
4241
|
+
* @example
|
|
4242
|
+
* ```ts
|
|
4243
|
+
* const pager = await loader.getHarness(TnTablePagerHarness);
|
|
4244
|
+
* await pager.nextPage();
|
|
4245
|
+
* expect(await pager.getRangeText()).toBe('21 – 40 of 47');
|
|
4246
|
+
* ```
|
|
4247
|
+
*/
|
|
4248
|
+
declare class TnTablePagerHarness extends ComponentHarness {
|
|
4249
|
+
static hostSelector: string;
|
|
4250
|
+
static with(options?: TnTablePagerHarnessFilters): HarnessPredicate<TnTablePagerHarness>;
|
|
4251
|
+
private firstButton;
|
|
4252
|
+
private previousButton;
|
|
4253
|
+
private nextButton;
|
|
4254
|
+
private lastButton;
|
|
4255
|
+
private pageSizeSelect;
|
|
4256
|
+
private rangeEl;
|
|
4257
|
+
/**
|
|
4258
|
+
* Returns the rendered range text (e.g. `"1 – 20 of 47"`).
|
|
4259
|
+
*/
|
|
4260
|
+
getRangeText(): Promise<string>;
|
|
4261
|
+
/** Clicks the "first page" button. */
|
|
4262
|
+
goToFirstPage(): Promise<void>;
|
|
4263
|
+
/** Clicks the "previous page" button. */
|
|
4264
|
+
previousPage(): Promise<void>;
|
|
4265
|
+
/** Clicks the "next page" button. */
|
|
4266
|
+
nextPage(): Promise<void>;
|
|
4267
|
+
/** Clicks the "last page" button. */
|
|
4268
|
+
goToLastPage(): Promise<void>;
|
|
4269
|
+
isFirstButtonDisabled(): Promise<boolean>;
|
|
4270
|
+
isPreviousButtonDisabled(): Promise<boolean>;
|
|
4271
|
+
isNextButtonDisabled(): Promise<boolean>;
|
|
4272
|
+
isLastButtonDisabled(): Promise<boolean>;
|
|
4273
|
+
/** Returns the harness for the underlying page-size `tn-select`. */
|
|
4274
|
+
getPageSizeSelect(): Promise<TnSelectHarness>;
|
|
4275
|
+
}
|
|
4276
|
+
interface TnTablePagerHarnessFilters extends BaseHarnessFilters {
|
|
4277
|
+
}
|
|
4278
|
+
|
|
3946
4279
|
/** Flat node with expandable and level information */
|
|
3947
4280
|
interface TnFlatTreeNode<T = unknown> {
|
|
3948
4281
|
data: T;
|
|
@@ -6343,5 +6676,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
|
|
|
6343
6676
|
*/
|
|
6344
6677
|
declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
|
|
6345
6678
|
|
|
6346
|
-
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, 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, 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, TnTabsComponent, TnTabsHarness, TnTestIdDirective, 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 };
|
|
6347
|
-
export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataSource, TnTableHarnessFilters, TnTestAttrName, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };
|
|
6679
|
+
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, 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, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, 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, 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, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
|
|
6680
|
+
export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnThemeDefinition, TnToastCall, TnToastConfig, TooltipPosition, YearCell };
|