@truenas/ui-components 0.7.6 → 0.7.7
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
|
@@ -9713,6 +9713,36 @@ declare class TnTableComponent<T = unknown> implements OnInit {
|
|
|
9713
9713
|
* `rowKey = (row: Job) => row.id` on the host.
|
|
9714
9714
|
*/
|
|
9715
9715
|
expansionKey: _angular_core.InputSignal<((row: T) => unknown) | undefined>;
|
|
9716
|
+
/**
|
|
9717
|
+
* Test id for each ROW, as a function of the row and its index.
|
|
9718
|
+
*
|
|
9719
|
+
* The table writes no id on a `<tr>` of its own, and a cell body is free to be bare
|
|
9720
|
+
* interpolation — `{{ row.username }}` renders no element the consumer can bind to. A list
|
|
9721
|
+
* built that way is unaddressable: an automated suite that has to open, select or delete one
|
|
9722
|
+
* specific row has nothing to select it by but position or cell text, both of which change
|
|
9723
|
+
* under the test. Set this and every row carries `row-<base>` on the `<tr>`, and on its card
|
|
9724
|
+
* in card mode, through the same {@link TnTestIdDirective} as every other id the library
|
|
9725
|
+
* emits — so it honours {@link TN_TEST_ATTR} and is kebab-cased by {@link composeTestId}.
|
|
9726
|
+
*
|
|
9727
|
+
* Pass the base only, not the `row-` prefix, and identify the ROW rather than its position,
|
|
9728
|
+
* the way {@link selectionKey} and {@link expansionKey} do — an index-derived id renames every
|
|
9729
|
+
* row below the one that was deleted. The index is passed for the case where the data genuinely
|
|
9730
|
+
* has nothing unique in it.
|
|
9731
|
+
*
|
|
9732
|
+
* Bind a stable member rather than writing the function in the template, since Angular's
|
|
9733
|
+
* expression grammar has no arrow functions:
|
|
9734
|
+
* `[rowTestId]="rowTestId"` for a `rowTestId = (row: User) => row.username` on the host.
|
|
9735
|
+
*
|
|
9736
|
+
* ```html
|
|
9737
|
+
* <tn-table [dataSource]="users" [rowTestId]="rowTestId" />
|
|
9738
|
+
* <!-- <tr data-testid="row-jane-doe"> -->
|
|
9739
|
+
* ```
|
|
9740
|
+
*
|
|
9741
|
+
* Cells are not covered by this: a suite that has to read one cell of a row still needs an id
|
|
9742
|
+
* on the element that cell renders. Tagging the row is what makes the row itself reachable —
|
|
9743
|
+
* which is the part a consumer cannot add from the outside.
|
|
9744
|
+
*/
|
|
9745
|
+
rowTestId: _angular_core.InputSignal<((row: T, index: number) => TnTestIdValue) | undefined>;
|
|
9716
9746
|
emptyMessage: _angular_core.InputSignal<string>;
|
|
9717
9747
|
/**
|
|
9718
9748
|
* Optional second line under `emptyMessage`, for empty states that carry both a headline and an
|
|
@@ -9988,6 +10018,16 @@ declare class TnTableComponent<T = unknown> implements OnInit {
|
|
|
9988
10018
|
/** True when the layout should keep the table but pin edge columns and scroll. */
|
|
9989
10019
|
isScrollMode: Signal<boolean>;
|
|
9990
10020
|
data: Signal<T[]>;
|
|
10021
|
+
/**
|
|
10022
|
+
* The resolved base for each row, by index.
|
|
10023
|
+
*
|
|
10024
|
+
* Computed once per `data()` change rather than called per row per change-detection pass: a
|
|
10025
|
+
* base is usually an array, every call builds a new one, and a new reference restarts the
|
|
10026
|
+
* directive's effect — so binding the call directly would rewrite every row's attribute on
|
|
10027
|
+
* every pass. Recomputing here on the signal the rows are rendered from keeps the value
|
|
10028
|
+
* identical between passes, and correct after a reload hands back new row objects.
|
|
10029
|
+
*/
|
|
10030
|
+
protected readonly rowTestIds: Signal<TnTestIdValue[]>;
|
|
9991
10031
|
effectiveDisplayedColumns: Signal<string[]>;
|
|
9992
10032
|
/**
|
|
9993
10033
|
* Every column the table actually renders, including the trailing actions column, which
|
|
@@ -10286,7 +10326,7 @@ declare class TnTableComponent<T = unknown> implements OnInit {
|
|
|
10286
10326
|
getCardLabel(column: string): string;
|
|
10287
10327
|
getCellValue(row: T, column: string): unknown;
|
|
10288
10328
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnTableComponent<any>, never>;
|
|
10289
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnTableComponent<any>, "tn-table", never, { "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "selectionKey": { "alias": "selectionKey"; "required": false; "isSignal": true; }; "expansionKey": { "alias": "expansionKey"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "emptyDescription": { "alias": "emptyDescription"; "required": false; "isSignal": true; }; "emptyIcon": { "alias": "emptyIcon"; "required": false; "isSignal": true; }; "scrollRegionAriaLabel": { "alias": "scrollRegionAriaLabel"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "isRowExpandable": { "alias": "isRowExpandable"; "required": false; "isSignal": true; }; "activeRow": { "alias": "activeRow"; "required": false; "isSignal": true; }; "activeWhen": { "alias": "activeWhen"; "required": false; "isSignal": true; }; "activeBg": { "alias": "activeBg"; "required": false; "isSignal": true; }; "activeIndicator": { "alias": "activeIndicator"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingMessage": { "alias": "loadingMessage"; "required": false; "isSignal": true; }; "clickable": { "alias": "clickable"; "required": false; "isSignal": true; }; "expandOnRowClick": { "alias": "expandOnRowClick"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "fixedLayout": { "alias": "fixedLayout"; "required": false; "isSignal": true; }; "minColumnWidth": { "alias": "minColumnWidth"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "mobileLayout": { "alias": "mobileLayout"; "required": false; "isSignal": true; }; "cardBreakpoint": { "alias": "cardBreakpoint"; "required": false; "isSignal": true; }; "cardPrimaryCount": { "alias": "cardPrimaryCount"; "required": false; "isSignal": true; }; "sortColumn": { "alias": "sortColumn"; "required": false; "isSignal": true; }; "sortDirection": { "alias": "sortDirection"; "required": false; "isSignal": true; }; }, { "sortChange": "sortChange"; "selectionChange": "selectionChange"; "rowClick": "rowClick"; "rowDoubleClick": "rowDoubleClick"; "sortColumn": "sortColumnChange"; "sortDirection": "sortDirectionChange"; }, ["columnDefs", "detailRowDef", "rowActionsDef"], never, true, [{ directive: typeof TnTestIdDirective; inputs: { "tnTestId": "testId"; }; outputs: {}; }]>;
|
|
10329
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnTableComponent<any>, "tn-table", never, { "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "selectionKey": { "alias": "selectionKey"; "required": false; "isSignal": true; }; "expansionKey": { "alias": "expansionKey"; "required": false; "isSignal": true; }; "rowTestId": { "alias": "rowTestId"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "emptyDescription": { "alias": "emptyDescription"; "required": false; "isSignal": true; }; "emptyIcon": { "alias": "emptyIcon"; "required": false; "isSignal": true; }; "scrollRegionAriaLabel": { "alias": "scrollRegionAriaLabel"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "isRowExpandable": { "alias": "isRowExpandable"; "required": false; "isSignal": true; }; "activeRow": { "alias": "activeRow"; "required": false; "isSignal": true; }; "activeWhen": { "alias": "activeWhen"; "required": false; "isSignal": true; }; "activeBg": { "alias": "activeBg"; "required": false; "isSignal": true; }; "activeIndicator": { "alias": "activeIndicator"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingMessage": { "alias": "loadingMessage"; "required": false; "isSignal": true; }; "clickable": { "alias": "clickable"; "required": false; "isSignal": true; }; "expandOnRowClick": { "alias": "expandOnRowClick"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "fixedLayout": { "alias": "fixedLayout"; "required": false; "isSignal": true; }; "minColumnWidth": { "alias": "minColumnWidth"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "mobileLayout": { "alias": "mobileLayout"; "required": false; "isSignal": true; }; "cardBreakpoint": { "alias": "cardBreakpoint"; "required": false; "isSignal": true; }; "cardPrimaryCount": { "alias": "cardPrimaryCount"; "required": false; "isSignal": true; }; "sortColumn": { "alias": "sortColumn"; "required": false; "isSignal": true; }; "sortDirection": { "alias": "sortDirection"; "required": false; "isSignal": true; }; }, { "sortChange": "sortChange"; "selectionChange": "selectionChange"; "rowClick": "rowClick"; "rowDoubleClick": "rowDoubleClick"; "sortColumn": "sortColumnChange"; "sortDirection": "sortDirectionChange"; }, ["columnDefs", "detailRowDef", "rowActionsDef"], never, true, [{ directive: typeof TnTestIdDirective; inputs: { "tnTestId": "testId"; }; outputs: {}; }]>;
|
|
10290
10330
|
}
|
|
10291
10331
|
|
|
10292
10332
|
/**
|
|
@@ -10491,6 +10531,17 @@ declare class TnTableHarness extends ComponentHarness {
|
|
|
10491
10531
|
* @returns Promise resolving to true if the loading overlay is visible.
|
|
10492
10532
|
*/
|
|
10493
10533
|
isLoading(): Promise<boolean>;
|
|
10534
|
+
/**
|
|
10535
|
+
* Gets the test id written on a data row by `[rowTestId]`.
|
|
10536
|
+
*
|
|
10537
|
+
* Layout-aware, like the rest of the row queries: reads the card in the card layout, which
|
|
10538
|
+
* carries the same id. Reads `data-testid` first and falls through to `data-test`, so it
|
|
10539
|
+
* answers the same either way the consumer configured `TN_TEST_ATTR`.
|
|
10540
|
+
*
|
|
10541
|
+
* @param rowIndex Zero-based index of the data row (or card).
|
|
10542
|
+
* @returns Promise resolving to the row's test id, or null when `[rowTestId]` is unset.
|
|
10543
|
+
*/
|
|
10544
|
+
getRowTestId(rowIndex: number): Promise<string | null>;
|
|
10494
10545
|
/**
|
|
10495
10546
|
* Checks if a data row is currently marked active.
|
|
10496
10547
|
*
|