@tekus/design-system 5.29.2 → 5.31.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-action-group.mjs +69 -0
- package/fesm2022/tekus-design-system-components-action-group.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-card-list.mjs +1 -1
- package/fesm2022/tekus-design-system-components-card-list.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-card.mjs +22 -4
- package/fesm2022/tekus-design-system-components-card.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-multiselect.mjs +257 -22
- package/fesm2022/tekus-design-system-components-multiselect.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-select.mjs +1 -1
- package/fesm2022/tekus-design-system-components-select.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-stepper.mjs +115 -0
- package/fesm2022/tekus-design-system-components-stepper.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-table.mjs +173 -3
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-time-ago.mjs +154 -0
- package/fesm2022/tekus-design-system-components-time-ago.mjs.map +1 -0
- package/fesm2022/tekus-design-system-core-types.mjs +23 -0
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +23 -0
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/package.json +13 -1
- package/types/tekus-design-system-components-action-group.d.ts +55 -0
- package/types/tekus-design-system-components-card.d.ts +14 -1
- package/types/tekus-design-system-components-multiselect.d.ts +165 -12
- package/types/tekus-design-system-components-stepper.d.ts +117 -0
- package/types/tekus-design-system-components-table.d.ts +88 -1
- package/types/tekus-design-system-components-time-ago.d.ts +53 -0
|
@@ -1,13 +1,105 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
2
3
|
import { ControlValueAccessor, NgControl, FormControl } from '@angular/forms';
|
|
4
|
+
import { MultiSelect } from 'primeng/multiselect';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
3
6
|
|
|
4
7
|
interface MultiSelectOption {
|
|
5
8
|
name: string;
|
|
6
9
|
code: string;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Standard request object for fetching data from an asynchronous source.
|
|
14
|
+
* Aligned with PrimeNG LazyLoadEvent patterns.
|
|
15
|
+
*/
|
|
16
|
+
interface TkMultiSelectRequest {
|
|
17
|
+
filter: string;
|
|
18
|
+
page: number;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
sortField?: string;
|
|
21
|
+
sortOrder?: number;
|
|
22
|
+
params?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Interface representing the data source for the Multiselect manager.
|
|
26
|
+
*/
|
|
27
|
+
interface MultiSelectDataSource<T = MultiSelectOption> {
|
|
28
|
+
fetch(request: TkMultiSelectRequest): Observable<T[]>;
|
|
29
|
+
}
|
|
30
|
+
declare class TkMultiSelectManager<T = MultiSelectOption> {
|
|
31
|
+
/**
|
|
32
|
+
* Reactive signal for the current search query.
|
|
33
|
+
*/
|
|
34
|
+
searchQuery: _angular_core.WritableSignal<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Reactive signal for the current pagination page.
|
|
37
|
+
*/
|
|
38
|
+
page: _angular_core.WritableSignal<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Data source provider for fetching items.
|
|
41
|
+
*/
|
|
42
|
+
dataSource: MultiSelectDataSource<T> | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Additional parameters to send to the data source.
|
|
45
|
+
*/
|
|
46
|
+
fetchParams: _angular_core.WritableSignal<Record<string, unknown>>;
|
|
47
|
+
/**
|
|
48
|
+
* Sorting field.
|
|
49
|
+
*/
|
|
50
|
+
sortField: _angular_core.WritableSignal<string | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Sorting order (1 for ASC, -1 for DESC).
|
|
53
|
+
*/
|
|
54
|
+
sortOrder: _angular_core.WritableSignal<number | undefined>;
|
|
55
|
+
/**
|
|
56
|
+
* Reactive signal indicating if data is currently being fetched.
|
|
57
|
+
*/
|
|
58
|
+
loading: _angular_core.WritableSignal<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Reactive signal indicating if there are more items to fetch.
|
|
61
|
+
*/
|
|
62
|
+
hasMore: _angular_core.WritableSignal<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Number of items per page to detect the end of data.
|
|
65
|
+
*/
|
|
66
|
+
pageSize: number;
|
|
67
|
+
/**
|
|
68
|
+
* Final accumulated list of items exposed as a Signal.
|
|
69
|
+
*/
|
|
70
|
+
items: _angular_core.Signal<T[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Updates the search query and resets pagination.
|
|
73
|
+
* @param query - The new search string.
|
|
74
|
+
*/
|
|
75
|
+
updateSearch(query: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Increments the page to trigger the next data chunk.
|
|
78
|
+
*/
|
|
79
|
+
loadNextPage(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Configures the data provider for the manager.
|
|
82
|
+
* @param provider - Object implementing the MultiSelectDataSource interface.
|
|
83
|
+
*/
|
|
84
|
+
setDataSource(provider: MultiSelectDataSource<T>): void;
|
|
85
|
+
/**
|
|
86
|
+
* Updates additional fetch parameters and resets pagination.
|
|
87
|
+
* @param params - The new parameters object.
|
|
88
|
+
*/
|
|
89
|
+
updateParams(params: Record<string, unknown>): void;
|
|
90
|
+
/**
|
|
91
|
+
* Resets the manager state to its initial values.
|
|
92
|
+
*/
|
|
93
|
+
reset(): void;
|
|
94
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TkMultiSelectManager<any>, never>;
|
|
95
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TkMultiSelectManager<any>>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare class MultiselectComponent implements ControlValueAccessor, OnDestroy {
|
|
10
99
|
readonly ngControl: NgControl | null;
|
|
100
|
+
readonly manager: TkMultiSelectManager<any>;
|
|
101
|
+
/** PrimeNG MultiSelect instance */
|
|
102
|
+
readonly multiselectComponent: _angular_core.Signal<MultiSelect | undefined>;
|
|
11
103
|
constructor();
|
|
12
104
|
/**
|
|
13
105
|
* @property {Signal<MultiSelectOption[]>} selectionPool
|
|
@@ -21,6 +113,10 @@ declare class MultiselectComponent implements ControlValueAccessor {
|
|
|
21
113
|
* The model signal for two-way binding.
|
|
22
114
|
*/
|
|
23
115
|
readonly model: _angular_core.ModelSignal<MultiSelectOption[] | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Data source for asynchronous infinite scroll mode.
|
|
118
|
+
*/
|
|
119
|
+
readonly dataSource: _angular_core.ModelSignal<MultiSelectDataSource<MultiSelectOption> | undefined>;
|
|
24
120
|
/**
|
|
25
121
|
* @property {MultiSelectOption[]} options
|
|
26
122
|
* @description
|
|
@@ -96,17 +192,47 @@ declare class MultiselectComponent implements ControlValueAccessor {
|
|
|
96
192
|
*/
|
|
97
193
|
styleClass: _angular_core.InputSignal<string>;
|
|
98
194
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
195
|
+
* @property {InputSignal<string>} errorMessage
|
|
196
|
+
* @description
|
|
197
|
+
* Message to display when the control is invalid and touched.
|
|
198
|
+
*/
|
|
103
199
|
errorMessage: _angular_core.InputSignal<string>;
|
|
104
200
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
201
|
+
* @property {InputSignal<string>} hint
|
|
202
|
+
* @description
|
|
203
|
+
* Hint text to display below the input.
|
|
204
|
+
*/
|
|
109
205
|
hint: _angular_core.InputSignal<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Loading state for the dropdown.
|
|
208
|
+
*/
|
|
209
|
+
loading: _angular_core.InputSignal<boolean>;
|
|
210
|
+
/**
|
|
211
|
+
* Text to display when there are no options.
|
|
212
|
+
*/
|
|
213
|
+
emptyMessage: _angular_core.InputSignal<string>;
|
|
214
|
+
/**
|
|
215
|
+
* Additional parameters for the async data source.
|
|
216
|
+
* Useful for sending context like categoryId, parentId, etc.
|
|
217
|
+
*/
|
|
218
|
+
fetchParams: _angular_core.InputSignal<Record<string, unknown>>;
|
|
219
|
+
/**
|
|
220
|
+
* Field name to sort by in the async data source.
|
|
221
|
+
*/
|
|
222
|
+
sortField: _angular_core.InputSignal<string | undefined>;
|
|
223
|
+
/**
|
|
224
|
+
* Order to sort by (1 for ASC, -1 for DESC).
|
|
225
|
+
*/
|
|
226
|
+
sortOrder: _angular_core.InputSignal<number | undefined>;
|
|
227
|
+
/**
|
|
228
|
+
* Determines whether the select field is disabled.
|
|
229
|
+
* @default false
|
|
230
|
+
*/
|
|
231
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
232
|
+
/**
|
|
233
|
+
* Internal writable signal for the disabled state.
|
|
234
|
+
*/
|
|
235
|
+
readonly internalDisabled: _angular_core.WritableSignal<boolean>;
|
|
110
236
|
/**
|
|
111
237
|
* @event selectionChange
|
|
112
238
|
* @description
|
|
@@ -123,6 +249,8 @@ declare class MultiselectComponent implements ControlValueAccessor {
|
|
|
123
249
|
* Emits the filter text when the user types in the search input.
|
|
124
250
|
*/
|
|
125
251
|
readonly filterChange: _angular_core.OutputEmitterRef<string>;
|
|
252
|
+
private readonly scrollHandler;
|
|
253
|
+
private lastListContainer;
|
|
126
254
|
/**
|
|
127
255
|
* @property internalOptions
|
|
128
256
|
* @description
|
|
@@ -199,6 +327,31 @@ declare class MultiselectComponent implements ControlValueAccessor {
|
|
|
199
327
|
* @param fn - The callback function.
|
|
200
328
|
*/
|
|
201
329
|
registerOnTouched(fn: () => void): void;
|
|
330
|
+
/**
|
|
331
|
+
* Updates the disabled state of the control.
|
|
332
|
+
* @param isDisabled - Whether the component should be disabled.
|
|
333
|
+
*/
|
|
334
|
+
setDisabledState(isDisabled: boolean): void;
|
|
335
|
+
/**
|
|
336
|
+
* Adds a scroll listener to the PrimeNG multiselect list container when the panel opens.
|
|
337
|
+
*/
|
|
338
|
+
onPanelShow(): void;
|
|
339
|
+
/**
|
|
340
|
+
* Cleans up state, removes listeners and resets the manager when the panel closes.
|
|
341
|
+
*/
|
|
342
|
+
onPanelHide(): void;
|
|
343
|
+
/**
|
|
344
|
+
* Cleans up listeners on component destruction.
|
|
345
|
+
*/
|
|
346
|
+
ngOnDestroy(): void;
|
|
347
|
+
/**
|
|
348
|
+
* Safely removes the scroll event listener.
|
|
349
|
+
*/
|
|
350
|
+
private removeScrollListener;
|
|
351
|
+
/**
|
|
352
|
+
* Detects if the user has reached the bottom of the list.
|
|
353
|
+
*/
|
|
354
|
+
private handleScroll;
|
|
202
355
|
/**
|
|
203
356
|
* @method effectiveControl
|
|
204
357
|
* @description
|
|
@@ -207,8 +360,8 @@ declare class MultiselectComponent implements ControlValueAccessor {
|
|
|
207
360
|
*/
|
|
208
361
|
get effectiveControl(): FormControl | null;
|
|
209
362
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MultiselectComponent, never>;
|
|
210
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MultiselectComponent, "tk-multiselect", never, { "model": { "alias": "model"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "labelText": { "alias": "labelText"; "required": false; "isSignal": true; }; "display": { "alias": "display"; "required": false; "isSignal": true; }; "maxSelectedLabels": { "alias": "maxSelectedLabels"; "required": false; "isSignal": true; }; "selectedItemsLabel": { "alias": "selectedItemsLabel"; "required": false; "isSignal": true; }; "emptyFilterMessage": { "alias": "emptyFilterMessage"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "filterPlaceHolder": { "alias": "filterPlaceHolder"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "styleClass": { "alias": "styleClass"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; }, { "model": "modelChange"; "selectionChange": "selectionChange"; "filterChange": "filterChange"; }, never, never, true, never>;
|
|
363
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MultiselectComponent, "tk-multiselect", never, { "model": { "alias": "model"; "required": false; "isSignal": true; }; "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "labelText": { "alias": "labelText"; "required": false; "isSignal": true; }; "display": { "alias": "display"; "required": false; "isSignal": true; }; "maxSelectedLabels": { "alias": "maxSelectedLabels"; "required": false; "isSignal": true; }; "selectedItemsLabel": { "alias": "selectedItemsLabel"; "required": false; "isSignal": true; }; "emptyFilterMessage": { "alias": "emptyFilterMessage"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "filterPlaceHolder": { "alias": "filterPlaceHolder"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "styleClass": { "alias": "styleClass"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "fetchParams": { "alias": "fetchParams"; "required": false; "isSignal": true; }; "sortField": { "alias": "sortField"; "required": false; "isSignal": true; }; "sortOrder": { "alias": "sortOrder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "model": "modelChange"; "dataSource": "dataSourceChange"; "selectionChange": "selectionChange"; "filterChange": "filterChange"; }, never, never, true, never>;
|
|
211
364
|
}
|
|
212
365
|
|
|
213
|
-
export { MultiselectComponent };
|
|
214
|
-
export type { MultiSelectOption };
|
|
366
|
+
export { MultiselectComponent, TkMultiSelectManager };
|
|
367
|
+
export type { MultiSelectDataSource, MultiSelectOption, TkMultiSelectRequest };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing a button action in the stepper step's footer.
|
|
6
|
+
*/
|
|
7
|
+
interface StepAction {
|
|
8
|
+
/** Text label displayed on the button */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Action handler invoked when the button is clicked */
|
|
11
|
+
action: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Status of whether the action is disabled.
|
|
14
|
+
* Can be a static boolean or a callback function (useful to bind to form validity).
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean | (() => boolean);
|
|
17
|
+
/** Styled color severity for the button matching tk-button inputs */
|
|
18
|
+
severity?: 'primary' | 'secondary' | 'danger';
|
|
19
|
+
/** Button visual style variant matching tk-button inputs */
|
|
20
|
+
variant?: 'text' | 'outlined';
|
|
21
|
+
/** Optional icon to display on the button */
|
|
22
|
+
icon?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Interface representing data for each step configuration.
|
|
26
|
+
*/
|
|
27
|
+
interface StepData {
|
|
28
|
+
/** Optional identifier for the step */
|
|
29
|
+
id?: string;
|
|
30
|
+
/** Header label for the step */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Whether the step header is disabled */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Whether the step has been completed successfully */
|
|
35
|
+
completed?: boolean;
|
|
36
|
+
/** The TemplateRef containing the step content form or markup */
|
|
37
|
+
content: TemplateRef<unknown>;
|
|
38
|
+
/** Optional list of primary actions (displayed right/bottom) */
|
|
39
|
+
actionsPrimary?: StepAction[];
|
|
40
|
+
/** Optional list of secondary actions (displayed left/bottom) */
|
|
41
|
+
actionsSecondary?: StepAction[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @component StepperComponent
|
|
46
|
+
* @description
|
|
47
|
+
* Reusable stepper component that acts as a wrapper around PrimeNG's Stepper.
|
|
48
|
+
* Supports horizontal and vertical orientations, linear step completion rules,
|
|
49
|
+
* and automated footer action buttons.
|
|
50
|
+
*
|
|
51
|
+
* @usage
|
|
52
|
+
* ```html
|
|
53
|
+
* <tk-stepper
|
|
54
|
+
* [steps]="steps"
|
|
55
|
+
* [(activeStep)]="currentStep"
|
|
56
|
+
* [linear]="true"
|
|
57
|
+
* orientation="horizontal">
|
|
58
|
+
* </tk-stepper>
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare class StepperComponent {
|
|
62
|
+
/**
|
|
63
|
+
* @property {InputSignal<StepData[]>} steps
|
|
64
|
+
* @description Array of step configurations to display.
|
|
65
|
+
*/
|
|
66
|
+
steps: _angular_core.InputSignal<StepData[]>;
|
|
67
|
+
/**
|
|
68
|
+
* @property {ModelSignal<number>} activeStep
|
|
69
|
+
* @description The 0-based index of the currently active step. Supports two-way binding.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
activeStep: _angular_core.ModelSignal<number>;
|
|
73
|
+
/**
|
|
74
|
+
* @property {InputSignal<boolean>} linear
|
|
75
|
+
* @description If true, blocks navigation to steps ahead of the active step.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
linear: _angular_core.InputSignal<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* @property {InputSignal<'horizontal' | 'vertical'>} orientation
|
|
81
|
+
* @description Defines the layout orientation of the stepper.
|
|
82
|
+
* @default 'horizontal'
|
|
83
|
+
*/
|
|
84
|
+
orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
85
|
+
/**
|
|
86
|
+
* @property {InputSignal<boolean>} showFooter
|
|
87
|
+
* @description Whether to render the default footer action buttons for each step.
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
showFooter: _angular_core.InputSignal<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* @event stepChange
|
|
93
|
+
* @description Emitted when the active step changes.
|
|
94
|
+
*/
|
|
95
|
+
stepChange: _angular_core.OutputEmitterRef<{
|
|
96
|
+
index: number;
|
|
97
|
+
step: StepData;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Checks if a step header should be disabled.
|
|
101
|
+
* Steps ahead of the active index are disabled in linear mode.
|
|
102
|
+
*/
|
|
103
|
+
isStepDisabled(index: number): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Helper to evaluate button disabled states dynamically.
|
|
106
|
+
*/
|
|
107
|
+
evalDisabled(disabled: boolean | (() => boolean) | undefined): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Handles step transition events.
|
|
110
|
+
*/
|
|
111
|
+
onStepChange(index: number): void;
|
|
112
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepperComponent, never>;
|
|
113
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<StepperComponent, "tk-stepper", never, { "steps": { "alias": "steps"; "required": false; "isSignal": true; }; "activeStep": { "alias": "activeStep"; "required": false; "isSignal": true; }; "linear": { "alias": "linear"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; }, { "activeStep": "activeStepChange"; "stepChange": "stepChange"; }, never, never, true, never>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { StepperComponent };
|
|
117
|
+
export type { StepAction, StepData };
|
|
@@ -2,19 +2,29 @@ import * as _angular_core from '@angular/core';
|
|
|
2
2
|
import { Table } from 'primeng/table';
|
|
3
3
|
import { TagSeverity } from '@tekus/design-system/components/tag';
|
|
4
4
|
import { SortEvent } from 'primeng/api';
|
|
5
|
+
import { TkAction } from '@tekus/design-system/components/action-group';
|
|
5
6
|
|
|
6
|
-
type TableColumnType = 'text' | 'tag' | 'actions' | 'selection' | 'checkbox';
|
|
7
|
+
type TableColumnType = 'text' | 'tag' | 'actions' | 'selection' | 'checkbox' | 'action-group' | 'connection-status';
|
|
7
8
|
interface TableColumn<T = unknown> {
|
|
8
9
|
field?: string;
|
|
9
10
|
header: string;
|
|
10
11
|
sortable?: boolean;
|
|
12
|
+
filterable?: boolean;
|
|
11
13
|
type?: TableColumnType;
|
|
12
14
|
width?: string;
|
|
13
15
|
tagSeverity?: (row: T) => TagSeverity;
|
|
16
|
+
connectionStatusSeverity?: (row: T) => 'success' | 'warn' | 'danger' | 'gray';
|
|
17
|
+
connectionStatusTooltipText?: (row: T) => string;
|
|
14
18
|
actions?: Array<{
|
|
15
19
|
icon: string;
|
|
16
20
|
action?: (row: T) => void;
|
|
17
21
|
}>;
|
|
22
|
+
actionGroup?: Array<{
|
|
23
|
+
icon: string;
|
|
24
|
+
label: string;
|
|
25
|
+
action: (row: T) => void;
|
|
26
|
+
}>;
|
|
27
|
+
actionGroupMaxVisible?: number;
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
declare class TableComponent<T = unknown> {
|
|
@@ -77,6 +87,15 @@ declare class TableComponent<T = unknown> {
|
|
|
77
87
|
readonly initialData: _angular_core.WritableSignal<T[]>;
|
|
78
88
|
readonly internalData: _angular_core.WritableSignal<T[]>;
|
|
79
89
|
readonly isSorted: _angular_core.WritableSignal<boolean | null>;
|
|
90
|
+
/** Tracks which column's filter overlay is currently open */
|
|
91
|
+
readonly activeFilterColumn: _angular_core.WritableSignal<string | null>;
|
|
92
|
+
/** Stores the selected filter value per column field (null = no filter) */
|
|
93
|
+
readonly columnFilters: _angular_core.WritableSignal<Record<string, string | null>>;
|
|
94
|
+
/** Position of the filter overlay (fixed, relative to viewport) */
|
|
95
|
+
readonly filterOverlayPosition: _angular_core.WritableSignal<{
|
|
96
|
+
top: number;
|
|
97
|
+
left: number;
|
|
98
|
+
}>;
|
|
80
99
|
/**
|
|
81
100
|
* @computed isAllSelected
|
|
82
101
|
* @description
|
|
@@ -104,8 +123,76 @@ declare class TableComponent<T = unknown> {
|
|
|
104
123
|
* @param value {any[]}
|
|
105
124
|
*/
|
|
106
125
|
updateSelection(value: T[]): void;
|
|
126
|
+
private readonly actionGroupCache;
|
|
127
|
+
getActionGroup(actions: NonNullable<TableColumn<T>['actionGroup']>, row: T): TkAction[];
|
|
107
128
|
customSort(event: SortEvent): void;
|
|
108
129
|
sortTableData(event: SortEvent): void;
|
|
130
|
+
/**
|
|
131
|
+
* @method toggleFilterOverlay
|
|
132
|
+
* @description
|
|
133
|
+
* Opens or closes the filter overlay for a given column.
|
|
134
|
+
* Captures the trigger button position to render the overlay in fixed position.
|
|
135
|
+
*/
|
|
136
|
+
toggleFilterOverlay(field: string, event: MouseEvent): void;
|
|
137
|
+
/**
|
|
138
|
+
* @method closeFilterOverlay
|
|
139
|
+
* @description
|
|
140
|
+
* Closes the filter overlay.
|
|
141
|
+
*/
|
|
142
|
+
closeFilterOverlay(): void;
|
|
143
|
+
/**
|
|
144
|
+
* @method getUniqueColumnValues
|
|
145
|
+
* @description
|
|
146
|
+
* Returns the unique values for a given column, considering active filters
|
|
147
|
+
* on other columns. This ensures the list only shows values that exist
|
|
148
|
+
* in the currently filtered dataset.
|
|
149
|
+
*/
|
|
150
|
+
getUniqueColumnValues(field: string): string[];
|
|
151
|
+
/**
|
|
152
|
+
* @method selectFilterValue
|
|
153
|
+
* @description
|
|
154
|
+
* Selects a value from the filter list and applies the filter.
|
|
155
|
+
*/
|
|
156
|
+
selectFilterValue(field: string, value: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* @method clearFilter
|
|
159
|
+
* @description
|
|
160
|
+
* Clears the filter for a specific column and re-applies remaining filters.
|
|
161
|
+
*/
|
|
162
|
+
clearFilter(field: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* @method isColumnFiltered
|
|
165
|
+
* @description
|
|
166
|
+
* Returns whether a column currently has an active filter.
|
|
167
|
+
*/
|
|
168
|
+
isColumnFiltered(field: string): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* @method getActiveFilterValue
|
|
171
|
+
* @description
|
|
172
|
+
* Returns the currently selected filter value for a column, or null.
|
|
173
|
+
*/
|
|
174
|
+
getActiveFilterValue(field: string): string | null;
|
|
175
|
+
/**
|
|
176
|
+
* @method applyAllFilters
|
|
177
|
+
* @description
|
|
178
|
+
* Applies all active column filters to the initial data set.
|
|
179
|
+
*/
|
|
180
|
+
private applyAllFilters;
|
|
181
|
+
/**
|
|
182
|
+
* @method getFilteredData
|
|
183
|
+
* @description
|
|
184
|
+
* Returns the initial data filtered by all active column filters.
|
|
185
|
+
* Used by both applyAllFilters and customSort (reset) to ensure
|
|
186
|
+
* sorting never discards active filters.
|
|
187
|
+
*/
|
|
188
|
+
private getFilteredData;
|
|
189
|
+
/**
|
|
190
|
+
* @method cellToString
|
|
191
|
+
* @description
|
|
192
|
+
* Safely converts a cell value to its string representation.
|
|
193
|
+
* Handles primitives directly and avoids [object Object] for complex types.
|
|
194
|
+
*/
|
|
195
|
+
private cellToString;
|
|
109
196
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent<any>, never>;
|
|
110
197
|
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; }; }, { "selection": "selectionChange"; }, never, never, true, never>;
|
|
111
198
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type TimeAgoSeverity = 'success' | 'warn' | 'danger' | 'gray';
|
|
5
|
+
declare class TimeAgoComponent implements OnInit {
|
|
6
|
+
/**
|
|
7
|
+
* The date to calculate the relative time from.
|
|
8
|
+
* Can be a Date object, an ISO string, a timestamp number,
|
|
9
|
+
* or a custom string format like 'dd/MM/yyyy HH:mm:ss' / 'dd/MM/yyyy HH:mm'.
|
|
10
|
+
*/
|
|
11
|
+
dateTime: _angular_core.InputSignal<string | number | Date | null | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* The severity of the state, determining its dot and label colors.
|
|
14
|
+
* Options: 'success' | 'warn' | 'danger' | 'gray'
|
|
15
|
+
* @default 'success'
|
|
16
|
+
*/
|
|
17
|
+
severity: _angular_core.InputSignal<TimeAgoSeverity>;
|
|
18
|
+
/**
|
|
19
|
+
* Custom tooltip text to display instead of the formatted date.
|
|
20
|
+
*/
|
|
21
|
+
tooltipText: _angular_core.InputSignal<string | null | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Format pattern for the fallback tooltip date representation.
|
|
24
|
+
* @default 'dd/MM/yyyy h:mm a'
|
|
25
|
+
*/
|
|
26
|
+
tooltipFormat: _angular_core.InputSignal<string>;
|
|
27
|
+
private readonly destroyRef;
|
|
28
|
+
private readonly localeId;
|
|
29
|
+
private readonly datePipe;
|
|
30
|
+
private readonly nowSignal;
|
|
31
|
+
readonly parsedDate: _angular_core.Signal<Date | null>;
|
|
32
|
+
readonly relativeTime: _angular_core.Signal<string>;
|
|
33
|
+
readonly tooltipContent: _angular_core.Signal<string>;
|
|
34
|
+
ngOnInit(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if a date object represents a valid timestamp.
|
|
37
|
+
*/
|
|
38
|
+
private isValidDate;
|
|
39
|
+
/**
|
|
40
|
+
* Parses legacy custom format 'DD/MM/YYYY HH:mm:ss' or 'DD/MM/YYYY HH:mm'.
|
|
41
|
+
*/
|
|
42
|
+
private parseCustomFormat;
|
|
43
|
+
/**
|
|
44
|
+
* Robust date parser supporting Date, timestamp number, ISO strings,
|
|
45
|
+
* and custom DD/MM/YYYY formatting commonly used in the platform.
|
|
46
|
+
*/
|
|
47
|
+
private parseDate;
|
|
48
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TimeAgoComponent, never>;
|
|
49
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TimeAgoComponent, "tk-time-ago", never, { "dateTime": { "alias": "dateTime"; "required": false; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "tooltipText": { "alias": "tooltipText"; "required": false; "isSignal": true; }; "tooltipFormat": { "alias": "tooltipFormat"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { TimeAgoComponent };
|
|
53
|
+
export type { TimeAgoSeverity };
|