@tekus/design-system 5.41.0 → 5.42.0
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/fesm2022/tekus-design-system-components-carousel.mjs +17 -3
- package/fesm2022/tekus-design-system-components-carousel.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-checkbox.mjs +2 -2
- package/fesm2022/tekus-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-color-picker.mjs +119 -71
- package/fesm2022/tekus-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-column-picker.mjs +210 -0
- package/fesm2022/tekus-design-system-components-column-picker.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-dropdown.mjs +1 -1
- package/fesm2022/tekus-design-system-components-dropdown.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-icon.mjs +10 -0
- package/fesm2022/tekus-design-system-components-icon.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-link-group.mjs +74 -0
- package/fesm2022/tekus-design-system-components-link-group.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-panel.mjs +1 -1
- package/fesm2022/tekus-design-system-components-panel.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-skeleton.mjs +79 -0
- package/fesm2022/tekus-design-system-components-skeleton.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-table.mjs +234 -11
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toolbar.mjs +33 -3
- package/fesm2022/tekus-design-system-components-toolbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tooltip.mjs +16 -3
- package/fesm2022/tekus-design-system-components-tooltip.mjs.map +1 -1
- package/package.json +13 -1
- package/types/tekus-design-system-components-carousel.d.ts +8 -1
- package/types/tekus-design-system-components-color-picker.d.ts +41 -7
- package/types/tekus-design-system-components-column-picker.d.ts +116 -0
- package/types/tekus-design-system-components-link-group.d.ts +119 -0
- package/types/tekus-design-system-components-skeleton.d.ts +68 -0
- package/types/tekus-design-system-components-table.d.ts +186 -10
- package/types/tekus-design-system-components-toolbar.d.ts +37 -2
- package/types/tekus-design-system-components-tooltip.d.ts +12 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Popover } from 'primeng/popover';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A column listed in `tk-column-picker`.
|
|
6
|
+
* `key` must match the `field` of the `tk-table` column it controls.
|
|
7
|
+
*/
|
|
8
|
+
interface TkColumnPickerColumn {
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
/** Always visible: rendered checked and disabled, and never hidden even if preloaded as hidden. */
|
|
12
|
+
locked?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @component ColumnPickerComponent
|
|
17
|
+
* @description
|
|
18
|
+
* Icon button that opens a list of checkboxes to show or hide table columns:
|
|
19
|
+
* a popover on desktop and a bottom drawer on mobile. Changes stay temporary
|
|
20
|
+
* until "Aplicar". The consumer owns the selection: `[(hiddenColumns)]`
|
|
21
|
+
* preloads a stored preference and `(appliedColumns)` emits it to be saved.
|
|
22
|
+
*
|
|
23
|
+
* @usage
|
|
24
|
+
* ```html
|
|
25
|
+
* <tk-column-picker [columns]="columnOptions" [(hiddenColumns)]="hidden" />
|
|
26
|
+
* <tk-table [columns]="columns" [hiddenColumns]="hidden()" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class ColumnPickerComponent {
|
|
30
|
+
private readonly breakpointObserver;
|
|
31
|
+
/** Responsive flag: drawer instead of popover below 768px */
|
|
32
|
+
readonly isMobile: _angular_core.Signal<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Columns listed in the picker. `key` must match the `tk-table` column `field`.
|
|
35
|
+
* @default []
|
|
36
|
+
*/
|
|
37
|
+
readonly columns: _angular_core.InputSignal<TkColumnPickerColumn[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Two-way bindable list of hidden column keys. Its initial value preloads a
|
|
40
|
+
* saved selection; unknown keys are ignored. Locked keys are removed right
|
|
41
|
+
* after the first change detection, so a bound tk-table could hide a locked
|
|
42
|
+
* column for that first frame: do not preload locked keys.
|
|
43
|
+
* @default []
|
|
44
|
+
*/
|
|
45
|
+
readonly hiddenColumns: _angular_core.ModelSignal<string[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Picker title, button tooltip and accessible name.
|
|
48
|
+
* @default 'Columnas'
|
|
49
|
+
*/
|
|
50
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Label for the button that shows every column again.
|
|
53
|
+
* @default 'Restablecer'
|
|
54
|
+
*/
|
|
55
|
+
readonly resetLabel: _angular_core.InputSignal<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Label for the button that applies the selection.
|
|
58
|
+
* @default 'Aplicar'
|
|
59
|
+
*/
|
|
60
|
+
readonly applyLabel: _angular_core.InputSignal<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Accessible name of the popover close button.
|
|
63
|
+
* @default 'Cerrar'
|
|
64
|
+
*/
|
|
65
|
+
readonly closeLabel: _angular_core.InputSignal<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Emits the hidden column keys when the user applies the selection,
|
|
68
|
+
* so the consumer can store it and preload it next time.
|
|
69
|
+
*/
|
|
70
|
+
readonly appliedColumns: _angular_core.OutputEmitterRef<string[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Temporary hidden column keys held before the user clicks "Aplicar".
|
|
73
|
+
* Follows `hiddenColumns` (so `apply()` never starts from an empty list)
|
|
74
|
+
* and stays writable while the user checks/unchecks options.
|
|
75
|
+
*/
|
|
76
|
+
readonly tempHiddenColumns: _angular_core.WritableSignal<string[]>;
|
|
77
|
+
/** Lookup of the temporary hidden keys, used once per option on each render */
|
|
78
|
+
private readonly tempHiddenSet;
|
|
79
|
+
/** Controls visibility of the mobile drawer */
|
|
80
|
+
readonly showDrawer: _angular_core.WritableSignal<boolean>;
|
|
81
|
+
readonly popover: _angular_core.Signal<Popover | undefined>;
|
|
82
|
+
/** Options shown before the list scrolls (limits the view, not the columns) */
|
|
83
|
+
private readonly maxVisibleOptions;
|
|
84
|
+
private readonly list;
|
|
85
|
+
/**
|
|
86
|
+
* Max height of the scrollable body, measured from the rendered options so
|
|
87
|
+
* exactly 8 fit whatever the theme, font or 2-line names. Null when all fit.
|
|
88
|
+
*/
|
|
89
|
+
readonly bodyMaxHeight: _angular_core.WritableSignal<number | null>;
|
|
90
|
+
/** Keys of the columns the user can hide (not locked) */
|
|
91
|
+
private readonly hideableColumnKeys;
|
|
92
|
+
/** Locked column keys present in `hiddenColumns` (e.g. from a preload); they get removed */
|
|
93
|
+
private readonly lockedHiddenColumnKeys;
|
|
94
|
+
/** Whether any existing, hideable column is currently hidden */
|
|
95
|
+
readonly hasHiddenColumns: _angular_core.Signal<boolean>;
|
|
96
|
+
/** "Aplicar" requires at least one visible column in the temporary selection */
|
|
97
|
+
readonly canApply: _angular_core.Signal<boolean>;
|
|
98
|
+
constructor();
|
|
99
|
+
/** Bottom of the last visible option relative to the first one, or null when all fit */
|
|
100
|
+
private calculateBodyMaxHeight;
|
|
101
|
+
/** Toggles the picker and copies the applied selection into temporary state */
|
|
102
|
+
open(event: Event): void;
|
|
103
|
+
/** Whether a column is checked (visible) in the temporary selection */
|
|
104
|
+
isTempColumnVisible(column: TkColumnPickerColumn): boolean;
|
|
105
|
+
/** Checks/unchecks a column in the temporary selection */
|
|
106
|
+
onTempColumnChange(column: TkColumnPickerColumn, visible: boolean): void;
|
|
107
|
+
/** Shows every column in the temporary selection */
|
|
108
|
+
reset(): void;
|
|
109
|
+
/** Saves the temporary selection and emits it for the consumer to store */
|
|
110
|
+
apply(): void;
|
|
111
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ColumnPickerComponent, never>;
|
|
112
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ColumnPickerComponent, "tk-column-picker", never, { "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "hiddenColumns": { "alias": "hiddenColumns"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "resetLabel": { "alias": "resetLabel"; "required": false; "isSignal": true; }; "applyLabel": { "alias": "applyLabel"; "required": false; "isSignal": true; }; "closeLabel": { "alias": "closeLabel"; "required": false; "isSignal": true; }; }, { "hiddenColumns": "hiddenColumnsChange"; "appliedColumns": "appliedColumns"; }, never, never, true, never>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { ColumnPickerComponent };
|
|
116
|
+
export type { TkColumnPickerColumn };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { IconColors } from '@tekus/design-system/components/icon';
|
|
3
|
+
|
|
4
|
+
/** Maximum number of links `tk-link-group` renders. Extra items are ignored. */
|
|
5
|
+
declare const TK_LINK_GROUP_MAX_LINKS = 2;
|
|
6
|
+
/**
|
|
7
|
+
* Optional icon rendered before the label. `prefixIconSeverity` and
|
|
8
|
+
* `iconTooltip` are only allowed together with `prefixIcon`.
|
|
9
|
+
*/
|
|
10
|
+
type TkLinkIcon = {
|
|
11
|
+
/** Icon name from the design system's IconCatalog (same as `tk-icon`). */
|
|
12
|
+
prefixIcon: string;
|
|
13
|
+
/** Color of the icon. Falls back to the link color. */
|
|
14
|
+
prefixIconSeverity?: IconColors;
|
|
15
|
+
/** Tooltip shown on hover of the icon. Also its accessible name. */
|
|
16
|
+
iconTooltip?: string;
|
|
17
|
+
} | {
|
|
18
|
+
prefixIcon?: never;
|
|
19
|
+
prefixIconSeverity?: never;
|
|
20
|
+
iconTooltip?: never;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* What the item does: navigate (`url` or `routerLink`), run a callback
|
|
24
|
+
* (`action`), or navigate and run the callback. `url` and `routerLink` are
|
|
25
|
+
* mutually exclusive. With none of them the item is plain text.
|
|
26
|
+
*/
|
|
27
|
+
type TkLinkTarget = {
|
|
28
|
+
/** Destination outside the Angular router (full page load). Renders an `<a href>`. */
|
|
29
|
+
url: string;
|
|
30
|
+
routerLink?: never;
|
|
31
|
+
/** Where to open the link. `_blank` adds `rel="noopener noreferrer"`. */
|
|
32
|
+
target?: '_self' | '_blank';
|
|
33
|
+
/** Also called on click, e.g. for tracking. Navigation still happens. */
|
|
34
|
+
action?: () => void;
|
|
35
|
+
} | {
|
|
36
|
+
url?: never;
|
|
37
|
+
/** In-app route, navigated with Angular's `RouterLink` (no page reload). Requires the router. */
|
|
38
|
+
routerLink: string | readonly unknown[];
|
|
39
|
+
/** Where to open the link. `_blank` adds `rel="noopener noreferrer"`. */
|
|
40
|
+
target?: '_self' | '_blank';
|
|
41
|
+
/** Also called on click, e.g. for tracking. Navigation still happens. */
|
|
42
|
+
action?: () => void;
|
|
43
|
+
} | {
|
|
44
|
+
url?: never;
|
|
45
|
+
routerLink?: never;
|
|
46
|
+
target?: never;
|
|
47
|
+
/** Called on click. The link renders as a `<button type="button">`. */
|
|
48
|
+
action: () => void;
|
|
49
|
+
} | {
|
|
50
|
+
/** Plain text item (e.g. "Sin lista"): not a link, not focusable. */
|
|
51
|
+
url?: never;
|
|
52
|
+
routerLink?: never;
|
|
53
|
+
target?: never;
|
|
54
|
+
action?: never;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* An item rendered by `tk-link-group`: a label plus a `url` or `routerLink`,
|
|
58
|
+
* an `action`, or both (or none, for plain text), and an optional prefix icon
|
|
59
|
+
* with its own color and tooltip.
|
|
60
|
+
*/
|
|
61
|
+
type TkLinkItem = {
|
|
62
|
+
/** Visible text. Truncated with an ellipsis (and a tooltip) when it does not fit. */
|
|
63
|
+
label: string;
|
|
64
|
+
/**
|
|
65
|
+
* Shows the link but does not navigate nor run `action`, and takes it out of
|
|
66
|
+
* the tab order. The icon and its tooltip stay available (e.g. to explain why).
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
} & TkLinkIcon & TkLinkTarget;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @component LinkGroupComponent
|
|
73
|
+
* @description
|
|
74
|
+
* Renders one or two links separated by "/". Each link has a label plus a
|
|
75
|
+
* `url` (`<a href>`) or a `routerLink` (in-app route, no reload), an `action`
|
|
76
|
+
* (rendered as a button) or both; with none of them it is plain text,
|
|
77
|
+
* and an optional prefix icon with its own color and tooltip.
|
|
78
|
+
*
|
|
79
|
+
* Responsive in at most 2 lines: both links share a line when they fit;
|
|
80
|
+
* otherwise the second one moves to the next line, keeping the "/" at the end
|
|
81
|
+
* of the first. A label that does not fit its own line ends with an ellipsis
|
|
82
|
+
* and shows its full text in a tooltip.
|
|
83
|
+
*
|
|
84
|
+
* @usage
|
|
85
|
+
* ```html
|
|
86
|
+
* <tk-link-group [links]="[
|
|
87
|
+
* { label: 'Promociones septiembre', routerLink: ['/playlists', 12], prefixIcon: 'video' },
|
|
88
|
+
* { label: 'Música ambiente', routerLink: ['/audiolists', 7], prefixIcon: 'list-music' }
|
|
89
|
+
* ]" />
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare class LinkGroupComponent {
|
|
93
|
+
/**
|
|
94
|
+
* @property {TkLinkItem[]} links
|
|
95
|
+
* @description
|
|
96
|
+
* Links to render. Only the first two are shown.
|
|
97
|
+
*
|
|
98
|
+
* @required
|
|
99
|
+
*/
|
|
100
|
+
readonly links: _angular_core.InputSignal<TkLinkItem[]>;
|
|
101
|
+
/**
|
|
102
|
+
* @computed visibleLinks
|
|
103
|
+
* @description The first {@link TK_LINK_GROUP_MAX_LINKS} links.
|
|
104
|
+
*/
|
|
105
|
+
readonly visibleLinks: _angular_core.Signal<TkLinkItem[]>;
|
|
106
|
+
/**
|
|
107
|
+
* @method onLinkClick
|
|
108
|
+
* @description
|
|
109
|
+
* Runs the link's `action`, if any. A link with `url` still navigates.
|
|
110
|
+
* Does nothing for a disabled link.
|
|
111
|
+
* @param link {TkLinkItem} - The clicked link.
|
|
112
|
+
*/
|
|
113
|
+
onLinkClick(link: TkLinkItem): void;
|
|
114
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LinkGroupComponent, never>;
|
|
115
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<LinkGroupComponent, "tk-link-group", never, { "links": { "alias": "links"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { LinkGroupComponent, TK_LINK_GROUP_MAX_LINKS };
|
|
119
|
+
export type { TkLinkItem };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
|
|
3
|
+
type SkeletonShape = 'rectangle' | 'circle';
|
|
4
|
+
type SkeletonAnimation = 'wave' | 'none';
|
|
5
|
+
/**
|
|
6
|
+
* @component SkeletonComponent
|
|
7
|
+
* @description
|
|
8
|
+
* Placeholder shown while content loads, wrapping PrimeNG's `p-skeleton`
|
|
9
|
+
* with its wave animation (disabled when the user prefers reduced motion).
|
|
10
|
+
*
|
|
11
|
+
* Decorative by default. Set `ariaLabel` when the skeleton is the only sign
|
|
12
|
+
* that something is loading: it is rendered as visually hidden text, read by
|
|
13
|
+
* screen readers when they reach the skeleton. It is not a live region, so
|
|
14
|
+
* many skeletons at once do not flood the screen reader.
|
|
15
|
+
*
|
|
16
|
+
* @usage
|
|
17
|
+
* ```html
|
|
18
|
+
* <tk-skeleton width="40px" height="40px" ariaLabel="Cargando imagen" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare class SkeletonComponent {
|
|
22
|
+
/**
|
|
23
|
+
* @property {string} width
|
|
24
|
+
* @description Width of the placeholder (any CSS length).
|
|
25
|
+
* @default '100%'
|
|
26
|
+
*/
|
|
27
|
+
readonly width: _angular_core.InputSignal<string>;
|
|
28
|
+
/**
|
|
29
|
+
* @property {string} height
|
|
30
|
+
* @description Height of the placeholder (any CSS length).
|
|
31
|
+
* @default '1rem'
|
|
32
|
+
*/
|
|
33
|
+
readonly height: _angular_core.InputSignal<string>;
|
|
34
|
+
/**
|
|
35
|
+
* @property {SkeletonShape} shape
|
|
36
|
+
* @description `circle` uses `size` for both dimensions when it is set.
|
|
37
|
+
* @default 'rectangle'
|
|
38
|
+
*/
|
|
39
|
+
readonly shape: _angular_core.InputSignal<SkeletonShape>;
|
|
40
|
+
/**
|
|
41
|
+
* @property {string | undefined} size
|
|
42
|
+
* @description Width and height at once (e.g. for circles). Overrides both.
|
|
43
|
+
*/
|
|
44
|
+
readonly size: _angular_core.InputSignal<string | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* @property {string | undefined} borderRadius
|
|
47
|
+
* @description Corner radius. Defaults to the theme's skeleton radius.
|
|
48
|
+
*/
|
|
49
|
+
readonly borderRadius: _angular_core.InputSignal<string | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* @property {SkeletonAnimation} animation
|
|
52
|
+
* @description `none` renders a static placeholder.
|
|
53
|
+
* @default 'wave'
|
|
54
|
+
*/
|
|
55
|
+
readonly animation: _angular_core.InputSignal<SkeletonAnimation>;
|
|
56
|
+
/**
|
|
57
|
+
* @property {string | undefined} ariaLabel
|
|
58
|
+
* @description
|
|
59
|
+
* Loading message for screen readers, rendered as visually hidden text.
|
|
60
|
+
* Without it the skeleton is decorative.
|
|
61
|
+
*/
|
|
62
|
+
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
63
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkeletonComponent, never>;
|
|
64
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkeletonComponent, "tk-skeleton", never, { "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "shape": { "alias": "shape"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "borderRadius": { "alias": "borderRadius"; "required": false; "isSignal": true; }; "animation": { "alias": "animation"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { SkeletonComponent };
|
|
68
|
+
export type { SkeletonAnimation, SkeletonShape };
|
|
@@ -3,10 +3,18 @@ import { Table } from 'primeng/table';
|
|
|
3
3
|
import { TagSeverity } from '@tekus/design-system/components/tag';
|
|
4
4
|
import { BadgeSeverity } from '@tekus/design-system/components/badge';
|
|
5
5
|
import { IconColors } from '@tekus/design-system/components/icon';
|
|
6
|
+
import { TkLinkItem } from '@tekus/design-system/components/link-group';
|
|
6
7
|
import { SortEvent } from 'primeng/api';
|
|
7
8
|
import { TkAction } from '@tekus/design-system/components/action-group';
|
|
8
9
|
|
|
9
|
-
type TableColumnType = 'text' | 'tag' | 'actions' | 'selection' | 'checkbox' | 'action-group' | 'connection-status' | 'image' | 'counter' | 'toggle';
|
|
10
|
+
type TableColumnType = 'text' | 'tag' | 'actions' | 'selection' | 'checkbox' | 'action-group' | 'connection-status' | 'image' | 'counter' | 'toggle' | 'links';
|
|
11
|
+
/**
|
|
12
|
+
* State of an `'image'` cell:
|
|
13
|
+
* - `default`: the image (with a skeleton while it downloads).
|
|
14
|
+
* - `loading`: an animated skeleton, e.g. while a screenshot task runs.
|
|
15
|
+
* - `error`: the error placeholder, with `imageErrorTooltip` as its tooltip.
|
|
16
|
+
*/
|
|
17
|
+
type TableImageState = 'default' | 'loading' | 'error';
|
|
10
18
|
interface TableColumn<T = unknown> {
|
|
11
19
|
field?: string;
|
|
12
20
|
header: string;
|
|
@@ -50,7 +58,10 @@ interface TableColumn<T = unknown> {
|
|
|
50
58
|
/**
|
|
51
59
|
* Total number of images available for the row (e.g. multiple evidence shots
|
|
52
60
|
* behind one thumbnail). When it resolves to more than 1, the cell overlays
|
|
53
|
-
* a `tk-badge` on the top-right corner of the thumbnail showing the count
|
|
61
|
+
* a `tk-badge` on the top-right corner of the thumbnail showing the count,
|
|
62
|
+
* in any state: in `error` it means only the preview failed and the other
|
|
63
|
+
* images are still available (the placeholder then runs `imageAction`).
|
|
64
|
+
* Return 0 or 1 when there is nothing else to show, e.g. the request failed.
|
|
54
65
|
*/
|
|
55
66
|
imageCount?: (row: T) => number;
|
|
56
67
|
/**
|
|
@@ -58,6 +69,28 @@ interface TableColumn<T = unknown> {
|
|
|
58
69
|
* @default 'primary'
|
|
59
70
|
*/
|
|
60
71
|
imageCountSeverity?: (row: T) => BadgeSeverity;
|
|
72
|
+
/**
|
|
73
|
+
* State of the cell, controlled by the consumer. An image that fails to
|
|
74
|
+
* load (and its `imageFallback`, if any) switches to `error` by itself;
|
|
75
|
+
* returning `loading` (or `error`), or passing a new row object, clears that
|
|
76
|
+
* failure so the image is retried. Failures are tracked per row.
|
|
77
|
+
* @default 'default'
|
|
78
|
+
*/
|
|
79
|
+
imageState?: (row: T) => TableImageState;
|
|
80
|
+
/**
|
|
81
|
+
* Tooltip of the error placeholder (e.g. the failure reason), in the app's
|
|
82
|
+
* language. Also what screen readers read; without it they read `imageAlt`.
|
|
83
|
+
*/
|
|
84
|
+
imageErrorTooltip?: (row: T) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Links of a `'links'` cell, rendered by `tk-link-group`: one or two per row,
|
|
87
|
+
* separated by "/", each with a `url`, an `action` or both, and an optional
|
|
88
|
+
* prefix icon with its own color and tooltip. Only the first two are shown.
|
|
89
|
+
* They link the entities related to the row (e.g. the playlist and the audio
|
|
90
|
+
* list of a screen); row actions belong in the `actions` column. Return a
|
|
91
|
+
* single link when the row has no second entity: no separator is rendered.
|
|
92
|
+
*/
|
|
93
|
+
links?: (row: T) => TkLinkItem[];
|
|
61
94
|
counterMin?: number;
|
|
62
95
|
counterMax?: number;
|
|
63
96
|
counterStep?: number;
|
|
@@ -85,13 +118,19 @@ interface TableColumn<T = unknown> {
|
|
|
85
118
|
*/
|
|
86
119
|
toggleTooltip?: (row: T, value: boolean) => string;
|
|
87
120
|
}
|
|
121
|
+
interface TableRowReorderEvent<T = unknown> {
|
|
122
|
+
dragIndex: number;
|
|
123
|
+
dropIndex: number;
|
|
124
|
+
data: T[];
|
|
125
|
+
}
|
|
88
126
|
|
|
89
127
|
declare class TableComponent<T = unknown> {
|
|
90
128
|
/**
|
|
91
|
-
* @property {
|
|
129
|
+
* @property {ModelSignal<T[]>} data
|
|
92
130
|
* @description
|
|
93
131
|
* Array of data objects to display in the table rows.
|
|
94
132
|
* Each object corresponds to one row; properties are mapped to columns via the `columns` input.
|
|
133
|
+
* Supports two-way binding `[(data)]` to synchronize row reordering.
|
|
95
134
|
*
|
|
96
135
|
* @default []
|
|
97
136
|
*
|
|
@@ -101,7 +140,7 @@ declare class TableComponent<T = unknown> {
|
|
|
101
140
|
* { id: 2, name: 'Jane', status: 'inactive' }
|
|
102
141
|
* ]"
|
|
103
142
|
*/
|
|
104
|
-
data: _angular_core.
|
|
143
|
+
readonly data: _angular_core.ModelSignal<T[]>;
|
|
105
144
|
/**
|
|
106
145
|
* @property {viewChild} tableRef
|
|
107
146
|
* @description
|
|
@@ -125,6 +164,46 @@ declare class TableComponent<T = unknown> {
|
|
|
125
164
|
* ]"
|
|
126
165
|
*/
|
|
127
166
|
columns: _angular_core.InputSignal<TableColumn<T>[]>;
|
|
167
|
+
/**
|
|
168
|
+
* @property {InputSignal<boolean>} reorderableRows
|
|
169
|
+
* @description
|
|
170
|
+
* Whether row reordering is enabled.
|
|
171
|
+
* When true, an extra leading column with a `grip-vertical` handle is rendered for each row.
|
|
172
|
+
* Rows are moved by dragging the handle, or with ArrowUp / ArrowDown while it is focused.
|
|
173
|
+
* Reordering is paused (handle disabled) while a sort or a column filter is active,
|
|
174
|
+
* because the visible order would not match the underlying `data` order.
|
|
175
|
+
* Set it before the rows render: PrimeNG binds the drag listeners when each row is created.
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
178
|
+
readonly reorderableRows: _angular_core.InputSignal<boolean>;
|
|
179
|
+
/**
|
|
180
|
+
* @property {InputSignal<string>} reorderHandleLabel
|
|
181
|
+
* @description
|
|
182
|
+
* Accessible name of the row reorder handle and of its column header.
|
|
183
|
+
* @default 'Reordenar fila'
|
|
184
|
+
*/
|
|
185
|
+
readonly reorderHandleLabel: _angular_core.InputSignal<string>;
|
|
186
|
+
/**
|
|
187
|
+
* @property {InputSignal<string>} reorderMovedLabel
|
|
188
|
+
* @description
|
|
189
|
+
* Screen reader announcement after a row is moved.
|
|
190
|
+
* `{0}` is replaced by the new position and `{1}` by the total of rows.
|
|
191
|
+
* @default 'Fila movida a la posición {0} de {1}'
|
|
192
|
+
*/
|
|
193
|
+
readonly reorderMovedLabel: _angular_core.InputSignal<string>;
|
|
194
|
+
/**
|
|
195
|
+
* @property {InputSignal<string | undefined>} imageLoadingLabel
|
|
196
|
+
* @description
|
|
197
|
+
* Optional screen reader text of an image cell in `loading` state, in the
|
|
198
|
+
* app's language. Without it the loading skeleton is decorative.
|
|
199
|
+
*/
|
|
200
|
+
readonly imageLoadingLabel: _angular_core.InputSignal<string | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* @property {OutputEmitterRef<TableRowReorderEvent<T>>} rowReorder
|
|
203
|
+
* @description
|
|
204
|
+
* Emitted when a row is moved, by drag-and-drop or keyboard.
|
|
205
|
+
*/
|
|
206
|
+
readonly rowReorder: _angular_core.OutputEmitterRef<TableRowReorderEvent<T>>;
|
|
128
207
|
/**
|
|
129
208
|
* @property {InputSignal<'single' | 'multiple' | undefined>} selectionMode
|
|
130
209
|
* @description
|
|
@@ -143,6 +222,23 @@ declare class TableComponent<T = unknown> {
|
|
|
143
222
|
* Property name to uniquely identify a row.
|
|
144
223
|
*/
|
|
145
224
|
dataKey: _angular_core.InputSignal<string | undefined>;
|
|
225
|
+
/**
|
|
226
|
+
* @property {InputSignal<string[]>} hiddenColumns
|
|
227
|
+
* @description
|
|
228
|
+
* Optional. `field` of the columns to hide. The consumer owns this list
|
|
229
|
+
* (e.g. bound to `tk-toolbar`'s `[(hiddenColumns)]` and preloaded from a saved
|
|
230
|
+
* preference). Fields that do not match a column are ignored, and columns
|
|
231
|
+
* without `field` (selection, actions) are always shown.
|
|
232
|
+
* Hiding a column does not clear its active filter.
|
|
233
|
+
* @default []
|
|
234
|
+
*/
|
|
235
|
+
readonly hiddenColumns: _angular_core.InputSignal<string[]>;
|
|
236
|
+
/**
|
|
237
|
+
* @computed visibleColumns
|
|
238
|
+
* @description
|
|
239
|
+
* Columns actually rendered: `columns` minus `hiddenColumns`.
|
|
240
|
+
*/
|
|
241
|
+
readonly visibleColumns: _angular_core.Signal<TableColumn<T>[]>;
|
|
146
242
|
/**
|
|
147
243
|
* @property {InputSignal<string | null>} minTableWidth
|
|
148
244
|
* @description
|
|
@@ -152,10 +248,26 @@ declare class TableComponent<T = unknown> {
|
|
|
152
248
|
* horizontal overflow.
|
|
153
249
|
* @default '60rem'
|
|
154
250
|
*/
|
|
155
|
-
minTableWidth: _angular_core.InputSignal<string | null>;
|
|
251
|
+
readonly minTableWidth: _angular_core.InputSignal<string | null>;
|
|
156
252
|
readonly initialData: _angular_core.WritableSignal<T[]>;
|
|
253
|
+
/**
|
|
254
|
+
* @property imageStatuses
|
|
255
|
+
* @description
|
|
256
|
+
* Load outcome of each image cell, per row object and column field. Keyed by
|
|
257
|
+
* the row (not the src) so rows sharing an image URL keep their own state,
|
|
258
|
+
* and a new row object always gets a fresh attempt.
|
|
259
|
+
*/
|
|
260
|
+
private readonly imageStatuses;
|
|
261
|
+
/** Bumped on every image load/error so the template re-reads the statuses */
|
|
262
|
+
private readonly imageStatusVersion;
|
|
157
263
|
readonly internalData: _angular_core.WritableSignal<T[]>;
|
|
158
264
|
readonly isSorted: _angular_core.WritableSignal<boolean | null>;
|
|
265
|
+
/** Text of the polite live region announced after a row is moved */
|
|
266
|
+
readonly reorderAnnouncement: _angular_core.WritableSignal<string>;
|
|
267
|
+
/** Row offset applied by each reorder handle key */
|
|
268
|
+
private readonly reorderKeyDelta;
|
|
269
|
+
private readonly host;
|
|
270
|
+
private readonly injector;
|
|
159
271
|
/** Tracks which column's filter overlay is currently open */
|
|
160
272
|
readonly activeFilterColumn: _angular_core.WritableSignal<string | null>;
|
|
161
273
|
/** Stores the selected filter value per column field (null = no filter) */
|
|
@@ -181,6 +293,14 @@ declare class TableComponent<T = unknown> {
|
|
|
181
293
|
* Returns true if some but not all rows are selected.
|
|
182
294
|
*/
|
|
183
295
|
isPartiallySelected: _angular_core.Signal<boolean>;
|
|
296
|
+
/**
|
|
297
|
+
* @computed canReorderRows
|
|
298
|
+
* @description
|
|
299
|
+
* Rows can only be moved while the visible order matches `data`: reordering
|
|
300
|
+
* a sorted or filtered view would drop the hidden rows from the model or be
|
|
301
|
+
* undone by the next sort pass.
|
|
302
|
+
*/
|
|
303
|
+
readonly canReorderRows: _angular_core.Signal<boolean>;
|
|
184
304
|
constructor();
|
|
185
305
|
/**
|
|
186
306
|
* @method toggleAll
|
|
@@ -196,6 +316,28 @@ declare class TableComponent<T = unknown> {
|
|
|
196
316
|
* @param value {any[]}
|
|
197
317
|
*/
|
|
198
318
|
updateSelection(value: T[]): void;
|
|
319
|
+
/**
|
|
320
|
+
* @method onRowReorder
|
|
321
|
+
* @description
|
|
322
|
+
* Handles row reorder event from PrimeNG Table and synchronizes data.
|
|
323
|
+
* @param event {{ dragIndex?: number; dropIndex?: number }}
|
|
324
|
+
*/
|
|
325
|
+
onRowReorder(event: {
|
|
326
|
+
dragIndex?: number;
|
|
327
|
+
dropIndex?: number;
|
|
328
|
+
}): void;
|
|
329
|
+
/**
|
|
330
|
+
* @method onReorderHandleKeydown
|
|
331
|
+
* @description
|
|
332
|
+
* Moves the row one position with ArrowUp / ArrowDown and keeps focus on its handle.
|
|
333
|
+
* Stops propagation so PrimeNG's selectable row does not treat the keys as row navigation or selection.
|
|
334
|
+
*/
|
|
335
|
+
onReorderHandleKeydown(event: KeyboardEvent, rowIndex: number): void;
|
|
336
|
+
/**
|
|
337
|
+
* Moves a row inside `data` (not the PrimeNG-mutated `internalData`), syncs the
|
|
338
|
+
* model and emits `rowReorder`. Returns false when the move is not allowed.
|
|
339
|
+
*/
|
|
340
|
+
private moveRow;
|
|
199
341
|
private readonly actionGroupCache;
|
|
200
342
|
getActionGroup(actions: NonNullable<TableColumn<T>['actionGroup']>, row: T): TkAction[];
|
|
201
343
|
customSort(event: SortEvent): void;
|
|
@@ -331,15 +473,49 @@ declare class TableComponent<T = unknown> {
|
|
|
331
473
|
/**
|
|
332
474
|
* @method onImageError
|
|
333
475
|
* @description
|
|
334
|
-
* Handles image load errors
|
|
476
|
+
* Handles image load errors: switches to the column's `imageFallback` once;
|
|
477
|
+
* if there is none, or it fails too, the cell shows the error placeholder.
|
|
335
478
|
* Called from the template's (error) binding on image-type columns.
|
|
336
479
|
* @param event {Event} - The native error event from the <img> element.
|
|
337
|
-
* @param
|
|
480
|
+
* @param col {TableColumn<T>} - The image column definition.
|
|
481
|
+
* @param row {T} - The data row being rendered.
|
|
482
|
+
*/
|
|
483
|
+
onImageError(event: Event, col: TableColumn<T>, row: T): void;
|
|
484
|
+
/**
|
|
485
|
+
* @method onImageLoad
|
|
486
|
+
* @description
|
|
487
|
+
* Marks an image cell as loaded so its skeleton is removed.
|
|
488
|
+
* @param col {TableColumn<T>} - The image column definition.
|
|
489
|
+
* @param row {T} - The data row being rendered.
|
|
490
|
+
*/
|
|
491
|
+
onImageLoad(col: TableColumn<T>, row: T): void;
|
|
492
|
+
/**
|
|
493
|
+
* @method getImageState
|
|
494
|
+
* @description
|
|
495
|
+
* State of an image cell: the column's `imageState` when it is `loading` or
|
|
496
|
+
* `error`; otherwise `error` if the image failed to load, else `default`.
|
|
497
|
+
* A `loading` or `error` state from the column clears the load outcome, so
|
|
498
|
+
* the image is retried (with a skeleton) when the cell goes back to `default`.
|
|
499
|
+
* @param col {TableColumn<T>} - The image column definition.
|
|
500
|
+
* @param row {T} - The data row being rendered.
|
|
501
|
+
*/
|
|
502
|
+
getImageState(col: TableColumn<T>, row: T): TableImageState;
|
|
503
|
+
/**
|
|
504
|
+
* @method isImageLoaded
|
|
505
|
+
* @description
|
|
506
|
+
* Whether the image of a cell finished loading. A cell without src counts
|
|
507
|
+
* as loaded, so it never shows an endless skeleton.
|
|
508
|
+
* @param col {TableColumn<T>} - The image column definition.
|
|
509
|
+
* @param row {T} - The data row being rendered.
|
|
338
510
|
*/
|
|
339
|
-
|
|
511
|
+
isImageLoaded(col: TableColumn<T>, row: T): boolean;
|
|
512
|
+
private getImageSrc;
|
|
513
|
+
private getImageStatus;
|
|
514
|
+
private setImageStatus;
|
|
515
|
+
private clearImageStatus;
|
|
340
516
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent<any>, never>;
|
|
341
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent<any>, "tk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "minTableWidth": { "alias": "minTableWidth"; "required": false; "isSignal": true; }; "columnFilters": { "alias": "columnFilters"; "required": false; "isSignal": true; }; "sortField": { "alias": "sortField"; "required": false; "isSignal": true; }; "sortOrder": { "alias": "sortOrder"; "required": false; "isSignal": true; }; }, { "selection": "selectionChange"; "columnFilters": "columnFiltersChange"; "sortField": "sortFieldChange"; "sortOrder": "sortOrderChange"; }, never, never, true, never>;
|
|
517
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent<any>, "tk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "reorderableRows": { "alias": "reorderableRows"; "required": false; "isSignal": true; }; "reorderHandleLabel": { "alias": "reorderHandleLabel"; "required": false; "isSignal": true; }; "reorderMovedLabel": { "alias": "reorderMovedLabel"; "required": false; "isSignal": true; }; "imageLoadingLabel": { "alias": "imageLoadingLabel"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "hiddenColumns": { "alias": "hiddenColumns"; "required": false; "isSignal": true; }; "minTableWidth": { "alias": "minTableWidth"; "required": false; "isSignal": true; }; "columnFilters": { "alias": "columnFilters"; "required": false; "isSignal": true; }; "sortField": { "alias": "sortField"; "required": false; "isSignal": true; }; "sortOrder": { "alias": "sortOrder"; "required": false; "isSignal": true; }; }, { "data": "dataChange"; "rowReorder": "rowReorder"; "selection": "selectionChange"; "columnFilters": "columnFiltersChange"; "sortField": "sortFieldChange"; "sortOrder": "sortOrderChange"; }, never, never, true, never>;
|
|
342
518
|
}
|
|
343
519
|
|
|
344
520
|
export { TableComponent };
|
|
345
|
-
export type { TableColumn, TableColumnType };
|
|
521
|
+
export type { TableColumn, TableColumnType, TableImageState, TableRowReorderEvent };
|