ngx-com 0.0.19 → 0.0.20
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/ngx-com-components-alert.mjs +346 -0
- package/fesm2022/ngx-com-components-alert.mjs.map +1 -0
- package/fesm2022/ngx-com-components-button.mjs +1 -1
- package/fesm2022/ngx-com-components-button.mjs.map +1 -1
- package/fesm2022/ngx-com-components-calendar.mjs +29 -36
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-card.mjs +1 -1
- package/fesm2022/ngx-com-components-card.mjs.map +1 -1
- package/fesm2022/ngx-com-components-carousel.mjs +708 -0
- package/fesm2022/ngx-com-components-carousel.mjs.map +1 -0
- package/fesm2022/ngx-com-components-checkbox.mjs +1 -1
- package/fesm2022/ngx-com-components-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-com-components-code-block.mjs +158 -0
- package/fesm2022/ngx-com-components-code-block.mjs.map +1 -0
- package/fesm2022/ngx-com-components-collapsible.mjs +1 -1
- package/fesm2022/ngx-com-components-collapsible.mjs.map +1 -1
- package/fesm2022/ngx-com-components-confirm.mjs +3 -3
- package/fesm2022/ngx-com-components-confirm.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dialog.mjs +703 -0
- package/fesm2022/ngx-com-components-dialog.mjs.map +1 -0
- package/fesm2022/ngx-com-components-dropdown.mjs +18 -21
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-item.mjs +1 -1
- package/fesm2022/ngx-com-components-item.mjs.map +1 -1
- package/fesm2022/ngx-com-components-paginator.mjs +3 -3
- package/fesm2022/ngx-com-components-paginator.mjs.map +1 -1
- package/fesm2022/ngx-com-components-radio.mjs +1 -1
- package/fesm2022/ngx-com-components-radio.mjs.map +1 -1
- package/fesm2022/ngx-com-components-segmented-control.mjs +1 -1
- package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -1
- package/fesm2022/ngx-com-components-switch.mjs +258 -0
- package/fesm2022/ngx-com-components-switch.mjs.map +1 -0
- package/fesm2022/ngx-com-components-table.mjs +631 -0
- package/fesm2022/ngx-com-components-table.mjs.map +1 -0
- package/fesm2022/ngx-com-components-tabs.mjs +2 -2
- package/fesm2022/ngx-com-components-tabs.mjs.map +1 -1
- package/fesm2022/ngx-com-components-toast.mjs +783 -0
- package/fesm2022/ngx-com-components-toast.mjs.map +1 -0
- package/package.json +29 -1
- package/types/ngx-com-components-alert.d.ts +166 -0
- package/types/ngx-com-components-carousel.d.ts +281 -0
- package/types/ngx-com-components-code-block.d.ts +66 -0
- package/types/ngx-com-components-confirm.d.ts +2 -2
- package/types/ngx-com-components-dialog.d.ts +264 -0
- package/types/ngx-com-components-switch.d.ts +110 -0
- package/types/ngx-com-components-table.d.ts +377 -0
- package/types/ngx-com-components-toast.d.ts +217 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { TemplateRef, InputSignal, Signal, InputSignalWithTransform, TrackByFunction } from '@angular/core';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Structural directive that captures the template for a header cell.
|
|
7
|
+
*
|
|
8
|
+
* Use with the star syntax inside a `comColumnDef` container.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <ng-container comColumnDef="name">
|
|
13
|
+
* <th *comHeaderCellDef>Name</th>
|
|
14
|
+
* <td *comCellDef="let row">{{ row.name }}</td>
|
|
15
|
+
* </ng-container>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare class ComHeaderCellDef {
|
|
19
|
+
readonly templateRef: TemplateRef<void>;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComHeaderCellDef, never>;
|
|
21
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComHeaderCellDef, "[comHeaderCellDef]", never, {}, {}, never, never, true, never>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Template context for body cell definitions. */
|
|
25
|
+
interface CellDefContext<T> {
|
|
26
|
+
$implicit: T;
|
|
27
|
+
index: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Structural directive that captures the template for a body cell.
|
|
32
|
+
*
|
|
33
|
+
* Use with the star syntax inside a `comColumnDef` container.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```html
|
|
37
|
+
* <ng-container comColumnDef="name">
|
|
38
|
+
* <th *comHeaderCellDef>Name</th>
|
|
39
|
+
* <td *comCellDef="let row">{{ row.name }}</td>
|
|
40
|
+
* </ng-container>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare class ComCellDef<T = unknown> {
|
|
44
|
+
readonly templateRef: TemplateRef<CellDefContext<T>>;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComCellDef<any>, never>;
|
|
46
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCellDef<any>, "[comCellDef]", never, {}, {}, never, never, true, never>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Structural directive that captures the template for a footer cell.
|
|
51
|
+
*
|
|
52
|
+
* Use with the star syntax inside a `comColumnDef` container.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```html
|
|
56
|
+
* <ng-container comColumnDef="amount">
|
|
57
|
+
* <th *comHeaderCellDef>Amount</th>
|
|
58
|
+
* <td *comCellDef="let row">{{ row.amount | currency }}</td>
|
|
59
|
+
* <td *comFooterCellDef>{{ total() | currency }}</td>
|
|
60
|
+
* </ng-container>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare class ComFooterCellDef {
|
|
64
|
+
readonly templateRef: TemplateRef<void>;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComFooterCellDef, never>;
|
|
66
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComFooterCellDef, "[comFooterCellDef]", never, {}, {}, never, never, true, never>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Defines a single column in a `com-table`.
|
|
71
|
+
*
|
|
72
|
+
* Contains a header cell template, a body cell template, and an optional footer cell template.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```html
|
|
76
|
+
* <ng-container comColumnDef="name">
|
|
77
|
+
* <th *comHeaderCellDef>Name</th>
|
|
78
|
+
* <td *comCellDef="let row">{{ row.name }}</td>
|
|
79
|
+
* </ng-container>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare class ComColumnDef {
|
|
83
|
+
/** The column name — used to match header/row column lists. */
|
|
84
|
+
readonly name: InputSignal<string>;
|
|
85
|
+
/** @internal Header cell template for this column. */
|
|
86
|
+
readonly headerCellDef: Signal<ComHeaderCellDef | undefined>;
|
|
87
|
+
/** @internal Body cell template for this column. */
|
|
88
|
+
readonly cellDef: Signal<ComCellDef | undefined>;
|
|
89
|
+
/** @internal Optional footer cell template for this column. */
|
|
90
|
+
readonly footerCellDef: Signal<ComFooterCellDef | undefined>;
|
|
91
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComColumnDef, never>;
|
|
92
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComColumnDef, "[comColumnDef]", ["comColumnDef"], { "name": { "alias": "comColumnDef"; "required": true; "isSignal": true; }; }, {}, ["headerCellDef", "cellDef", "footerCellDef"], never, true, never>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Defines which columns appear in the header row and their order.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```html
|
|
100
|
+
* <tr comHeaderRowDef="['name', 'email', 'role']"></tr>
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @example Sticky header row
|
|
104
|
+
* ```html
|
|
105
|
+
* <tr comHeaderRowDef="['name', 'email']" comHeaderRowDefSticky></tr>
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare class ComHeaderRowDef {
|
|
109
|
+
/** Ordered list of column names to display. */
|
|
110
|
+
readonly columns: InputSignal<string[]>;
|
|
111
|
+
/** Makes this header row sticky (alternative to table-level `stickyHeader`). */
|
|
112
|
+
readonly sticky: InputSignalWithTransform<boolean, unknown>;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComHeaderRowDef, never>;
|
|
114
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComHeaderRowDef, "[comHeaderRowDef]", never, { "columns": { "alias": "comHeaderRowDef"; "required": true; "isSignal": true; }; "sticky": { "alias": "comHeaderRowDefSticky"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Defines which columns appear in each body row and their order.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```html
|
|
122
|
+
* <tr comRowDef [comRowDefColumns]="['name', 'email', 'role']"></tr>
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare class ComRowDef {
|
|
126
|
+
/** Ordered list of column names to display per body row. */
|
|
127
|
+
readonly columns: InputSignal<string[]>;
|
|
128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComRowDef, never>;
|
|
129
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComRowDef, "[comRowDef]", never, { "columns": { "alias": "comRowDefColumns"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Defines which columns appear in the footer row and their order.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```html
|
|
137
|
+
* <tr comFooterRowDef="['description', 'amount']"></tr>
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare class ComFooterRowDef {
|
|
141
|
+
/** Ordered list of column names in the footer. */
|
|
142
|
+
readonly columns: InputSignal<string[]>;
|
|
143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComFooterRowDef, never>;
|
|
144
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComFooterRowDef, "[comFooterRowDef]", never, { "columns": { "alias": "comFooterRowDef"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Structural directive for the empty-state row shown when the data source is empty.
|
|
149
|
+
*
|
|
150
|
+
* Place inside `com-table`. The template receives the column count for colspan.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```html
|
|
154
|
+
* <com-table [dataSource]="data()">
|
|
155
|
+
* <!-- column defs... -->
|
|
156
|
+
*
|
|
157
|
+
* <ng-template comNoDataRow>
|
|
158
|
+
* <td [attr.colspan]="displayedColumns().length" class="text-center py-8">
|
|
159
|
+
* No results found.
|
|
160
|
+
* </td>
|
|
161
|
+
* </ng-template>
|
|
162
|
+
* </com-table>
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare class ComNoDataRow {
|
|
166
|
+
readonly templateRef: TemplateRef<void>;
|
|
167
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComNoDataRow, never>;
|
|
168
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComNoDataRow, "[comNoDataRow]", never, {}, {}, never, never, true, never>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Abstract data source for ComTable.
|
|
173
|
+
*
|
|
174
|
+
* Implement `connect()` to provide a signal of data, and `disconnect()` to clean up.
|
|
175
|
+
* The table calls `connect()` on init and `disconnect()` on destroy.
|
|
176
|
+
*
|
|
177
|
+
* @example Signal-based data source
|
|
178
|
+
* ```typescript
|
|
179
|
+
* class MyDataSource extends ComDataSource<User> {
|
|
180
|
+
* private readonly data = signal<User[]>([]);
|
|
181
|
+
*
|
|
182
|
+
* connect(): Signal<readonly User[]> {
|
|
183
|
+
* return this.data.asReadonly();
|
|
184
|
+
* }
|
|
185
|
+
*
|
|
186
|
+
* disconnect(): void {
|
|
187
|
+
* // cleanup if needed
|
|
188
|
+
* }
|
|
189
|
+
*
|
|
190
|
+
* setData(users: User[]): void {
|
|
191
|
+
* this.data.set(users);
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare abstract class ComDataSource<T> {
|
|
197
|
+
/** Returns a signal of the current data set. Called once when the table initializes. */
|
|
198
|
+
abstract connect(): Signal<readonly T[]>;
|
|
199
|
+
/** Cleanup resources. Called when the table is destroyed. */
|
|
200
|
+
abstract disconnect(): void;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Simple array-backed data source.
|
|
204
|
+
*
|
|
205
|
+
* Wraps a plain array in a writable signal so it can be used with ComTable's DataSource API.
|
|
206
|
+
*/
|
|
207
|
+
declare class ComArrayDataSource<T> extends ComDataSource<T> {
|
|
208
|
+
private readonly data;
|
|
209
|
+
constructor(initialData?: T[]);
|
|
210
|
+
connect(): Signal<readonly T[]>;
|
|
211
|
+
disconnect(): void;
|
|
212
|
+
/** Replace the entire data set. */
|
|
213
|
+
setData(data: T[]): void;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Type guard to check if a value is a ComDataSource instance.
|
|
217
|
+
*/
|
|
218
|
+
declare function isDataSource<T>(value: unknown): value is ComDataSource<T>;
|
|
219
|
+
/** The types that ComTable accepts for its dataSource input. */
|
|
220
|
+
type ComTableDataSourceInput<T> = T[] | ComDataSource<T>;
|
|
221
|
+
|
|
222
|
+
type TableVariant = 'default' | 'striped';
|
|
223
|
+
type TableDensity = 'compact' | 'default' | 'comfortable';
|
|
224
|
+
/**
|
|
225
|
+
* CVA variants for the table container wrapper.
|
|
226
|
+
*/
|
|
227
|
+
declare const tableContainerVariants: (props?: Record<string, never>) => string;
|
|
228
|
+
type TableContainerVariants = VariantProps<typeof tableContainerVariants>;
|
|
229
|
+
/**
|
|
230
|
+
* CVA variants for the `<table>` element.
|
|
231
|
+
*
|
|
232
|
+
* @tokens `--color-foreground`
|
|
233
|
+
*/
|
|
234
|
+
declare const tableVariants: (props?: Record<string, never>) => string;
|
|
235
|
+
type TableVariants = VariantProps<typeof tableVariants>;
|
|
236
|
+
/**
|
|
237
|
+
* CVA variants for the `<thead>` element.
|
|
238
|
+
*
|
|
239
|
+
* @tokens `--color-background`
|
|
240
|
+
*/
|
|
241
|
+
declare const tableHeaderVariants: (props?: {
|
|
242
|
+
sticky?: boolean;
|
|
243
|
+
}) => string;
|
|
244
|
+
type TableHeaderVariants = VariantProps<typeof tableHeaderVariants>;
|
|
245
|
+
/**
|
|
246
|
+
* CVA variants for `<th>` header cells.
|
|
247
|
+
*
|
|
248
|
+
* @tokens `--color-muted-foreground`
|
|
249
|
+
*/
|
|
250
|
+
declare const tableHeaderCellVariants: (props?: {
|
|
251
|
+
density?: TableDensity;
|
|
252
|
+
}) => string;
|
|
253
|
+
type TableHeaderCellVariants = VariantProps<typeof tableHeaderCellVariants>;
|
|
254
|
+
/**
|
|
255
|
+
* CVA variants for `<tbody> <tr>` rows.
|
|
256
|
+
*
|
|
257
|
+
* @tokens `--color-border-subtle`, `--color-muted`, `--color-muted-hover`
|
|
258
|
+
*/
|
|
259
|
+
declare const tableRowVariants: (props?: {
|
|
260
|
+
variant?: TableVariant;
|
|
261
|
+
}) => string;
|
|
262
|
+
type TableRowVariants = VariantProps<typeof tableRowVariants>;
|
|
263
|
+
/**
|
|
264
|
+
* CVA variants for `<td>` body cells.
|
|
265
|
+
*/
|
|
266
|
+
declare const tableBodyCellVariants: (props?: {
|
|
267
|
+
density?: TableDensity;
|
|
268
|
+
}) => string;
|
|
269
|
+
type TableBodyCellVariants = VariantProps<typeof tableBodyCellVariants>;
|
|
270
|
+
/**
|
|
271
|
+
* CVA variants for `<tfoot> <td>` footer cells.
|
|
272
|
+
*
|
|
273
|
+
* @tokens `--color-foreground`, `--color-border`
|
|
274
|
+
*/
|
|
275
|
+
declare const tableFooterCellVariants: (props?: {
|
|
276
|
+
density?: TableDensity;
|
|
277
|
+
}) => string;
|
|
278
|
+
type TableFooterCellVariants = VariantProps<typeof tableFooterCellVariants>;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Declarative data table component using native HTML `<table>` semantics.
|
|
282
|
+
*
|
|
283
|
+
* Define columns via `comColumnDef` with `*comHeaderCellDef` and `*comCellDef`,
|
|
284
|
+
* then declare row structure via `comHeaderRowDef` and `comRowDef`.
|
|
285
|
+
*
|
|
286
|
+
* Accepts either a plain `T[]` or a `ComDataSource<T>` for the data source.
|
|
287
|
+
*
|
|
288
|
+
* @tokens `--color-background`, `--color-foreground`, `--color-muted`, `--color-muted-foreground`,
|
|
289
|
+
* `--color-muted-hover`, `--color-border`, `--color-border-subtle`
|
|
290
|
+
*
|
|
291
|
+
* @example Basic table
|
|
292
|
+
* ```html
|
|
293
|
+
* <com-table [dataSource]="users()">
|
|
294
|
+
* <ng-container comColumnDef="name">
|
|
295
|
+
* <th *comHeaderCellDef>Name</th>
|
|
296
|
+
* <td *comCellDef="let row">{{ row.name }}</td>
|
|
297
|
+
* </ng-container>
|
|
298
|
+
*
|
|
299
|
+
* <ng-container comColumnDef="email">
|
|
300
|
+
* <th *comHeaderCellDef>Email</th>
|
|
301
|
+
* <td *comCellDef="let row">{{ row.email }}</td>
|
|
302
|
+
* </ng-container>
|
|
303
|
+
*
|
|
304
|
+
* <tr comHeaderRowDef="['name', 'email']"></tr>
|
|
305
|
+
* <tr comRowDef [comRowDefColumns]="['name', 'email']"></tr>
|
|
306
|
+
* </com-table>
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @example With DataSource
|
|
310
|
+
* ```typescript
|
|
311
|
+
* class UserDataSource extends ComDataSource<User> {
|
|
312
|
+
* private data = signal<User[]>([]);
|
|
313
|
+
* connect() { return this.data.asReadonly(); }
|
|
314
|
+
* disconnect() {}
|
|
315
|
+
* setData(users: User[]) { this.data.set(users); }
|
|
316
|
+
* }
|
|
317
|
+
* ```
|
|
318
|
+
* ```html
|
|
319
|
+
* <com-table [dataSource]="userDataSource">
|
|
320
|
+
* ...
|
|
321
|
+
* </com-table>
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
declare class ComTable<T> {
|
|
325
|
+
private readonly destroyRef;
|
|
326
|
+
/** The data to render — accepts a plain array or a ComDataSource. */
|
|
327
|
+
readonly dataSource: InputSignal<ComTableDataSourceInput<T>>;
|
|
328
|
+
/** Track function for `@for`. Defaults to tracking by index. */
|
|
329
|
+
readonly trackByFn: InputSignal<TrackByFunction<T>>;
|
|
330
|
+
/** Visual treatment of body rows. */
|
|
331
|
+
readonly variant: InputSignal<TableVariant>;
|
|
332
|
+
/** Row height / cell padding. */
|
|
333
|
+
readonly density: InputSignal<TableDensity>;
|
|
334
|
+
/** Whether the header row sticks on scroll. */
|
|
335
|
+
readonly stickyHeader: InputSignalWithTransform<boolean, unknown>;
|
|
336
|
+
/** Shows a loading overlay with spinner. */
|
|
337
|
+
readonly loading: InputSignalWithTransform<boolean, unknown>;
|
|
338
|
+
/** Accessible label for the table element. */
|
|
339
|
+
readonly ariaLabel: InputSignal<string | undefined>;
|
|
340
|
+
/** @internal All column definitions projected into the table. */
|
|
341
|
+
readonly columnDefs: Signal<readonly ComColumnDef[]>;
|
|
342
|
+
/** @internal Header row definition. */
|
|
343
|
+
readonly headerRowDef: Signal<ComHeaderRowDef | undefined>;
|
|
344
|
+
/** @internal Body row definition. */
|
|
345
|
+
readonly rowDef: Signal<ComRowDef | undefined>;
|
|
346
|
+
/** @internal Optional footer row definition. */
|
|
347
|
+
readonly footerRowDef: Signal<ComFooterRowDef | undefined>;
|
|
348
|
+
/** @internal Optional no-data row template. */
|
|
349
|
+
readonly noDataRow: Signal<ComNoDataRow | undefined>;
|
|
350
|
+
/** @internal Map of column name → column definition for O(1) lookup. */
|
|
351
|
+
protected readonly columnDefMap: Signal<Map<string, ComColumnDef>>;
|
|
352
|
+
/** @internal Resolved render data — handles both array and DataSource inputs. */
|
|
353
|
+
private readonly dataSourceSignal;
|
|
354
|
+
/** @internal The actual data array to render. */
|
|
355
|
+
readonly renderData: Signal<readonly T[]>;
|
|
356
|
+
/** @internal Header column names. */
|
|
357
|
+
protected readonly headerColumns: Signal<string[]>;
|
|
358
|
+
/** @internal Body column names. */
|
|
359
|
+
protected readonly bodyColumns: Signal<string[]>;
|
|
360
|
+
/** @internal Footer column names. */
|
|
361
|
+
protected readonly footerColumns: Signal<string[]>;
|
|
362
|
+
/** @internal Whether the header should be sticky. */
|
|
363
|
+
private readonly isSticky;
|
|
364
|
+
protected readonly containerClasses: Signal<string>;
|
|
365
|
+
protected readonly tableClasses: Signal<string>;
|
|
366
|
+
protected readonly theadClasses: Signal<string>;
|
|
367
|
+
protected readonly thClasses: Signal<string>;
|
|
368
|
+
protected readonly trClasses: Signal<string>;
|
|
369
|
+
protected readonly tdClasses: Signal<string>;
|
|
370
|
+
protected readonly tfootTdClasses: Signal<string>;
|
|
371
|
+
constructor();
|
|
372
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComTable<any>, never>;
|
|
373
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComTable<any>, "com-table", ["comTable"], { "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "trackByFn": { "alias": "trackByFn"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, ["columnDefs", "headerRowDef", "rowDef", "footerRowDef", "noDataRow"], never, true, never>;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export { ComArrayDataSource, ComCellDef, ComColumnDef, ComDataSource, ComFooterCellDef, ComFooterRowDef, ComHeaderCellDef, ComHeaderRowDef, ComNoDataRow, ComRowDef, ComTable, isDataSource, tableBodyCellVariants, tableContainerVariants, tableFooterCellVariants, tableHeaderCellVariants, tableHeaderVariants, tableRowVariants, tableVariants };
|
|
377
|
+
export type { CellDefContext, ComTableDataSourceInput, TableBodyCellVariants, TableContainerVariants, TableDensity, TableFooterCellVariants, TableHeaderCellVariants, TableHeaderVariants, TableRowVariants, TableVariant, TableVariants };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { TemplateRef, InjectionToken, Provider } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Toast notification type.
|
|
7
|
+
*/
|
|
8
|
+
type ComToastType = 'success' | 'warn' | 'error' | 'info';
|
|
9
|
+
/**
|
|
10
|
+
* Toast container position on screen.
|
|
11
|
+
*/
|
|
12
|
+
type ComToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
13
|
+
/**
|
|
14
|
+
* Reason a toast was dismissed.
|
|
15
|
+
*/
|
|
16
|
+
type ComToastDismissReason = 'auto' | 'manual' | 'action' | 'limit';
|
|
17
|
+
/**
|
|
18
|
+
* Event emitted when a toast is dismissed.
|
|
19
|
+
*/
|
|
20
|
+
interface ComToastDismissEvent {
|
|
21
|
+
/** The reason the toast was dismissed. */
|
|
22
|
+
reason: ComToastDismissReason;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Global toast configuration. Provide via `provideComToastConfig()`.
|
|
26
|
+
*/
|
|
27
|
+
interface ComToastConfig {
|
|
28
|
+
/** Screen position of the toast container. Default: `'bottom-right'` */
|
|
29
|
+
position?: ComToastPosition;
|
|
30
|
+
/** Auto-dismiss duration in milliseconds. `0` = no auto-dismiss. Default: `5000` */
|
|
31
|
+
duration?: number;
|
|
32
|
+
/** Maximum visible toasts. Default: `5` */
|
|
33
|
+
maxVisible?: number;
|
|
34
|
+
/** Pause auto-dismiss timer on hover. Default: `true` */
|
|
35
|
+
pauseOnHover?: boolean;
|
|
36
|
+
/** Show progress bar for auto-dismissing toasts. Default: `true` */
|
|
37
|
+
showProgress?: boolean;
|
|
38
|
+
/** Show close button. Default: `true` */
|
|
39
|
+
showClose?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Data for an individual toast notification.
|
|
43
|
+
*/
|
|
44
|
+
interface ComToastData {
|
|
45
|
+
/** Toast type. Default: `'info'` */
|
|
46
|
+
type?: ComToastType;
|
|
47
|
+
/** Optional title displayed above the message. */
|
|
48
|
+
title?: string;
|
|
49
|
+
/** The toast message. */
|
|
50
|
+
message: string;
|
|
51
|
+
/** Optional action button. */
|
|
52
|
+
action?: {
|
|
53
|
+
label: string;
|
|
54
|
+
};
|
|
55
|
+
/** Lucide icon name override. */
|
|
56
|
+
icon?: string;
|
|
57
|
+
/** Per-toast auto-dismiss duration override (ms). */
|
|
58
|
+
duration?: number;
|
|
59
|
+
/** Per-toast progress bar visibility override. */
|
|
60
|
+
showProgress?: boolean;
|
|
61
|
+
/** Per-toast close button visibility override. */
|
|
62
|
+
showClose?: boolean;
|
|
63
|
+
/** Custom template for the toast content. */
|
|
64
|
+
customTemplate?: TemplateRef<ComToastTemplateContext>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Context provided to custom toast templates.
|
|
68
|
+
*/
|
|
69
|
+
interface ComToastTemplateContext {
|
|
70
|
+
/** The toast data. */
|
|
71
|
+
$implicit: ComToastData;
|
|
72
|
+
/** Function to dismiss the toast. */
|
|
73
|
+
dismiss: () => void;
|
|
74
|
+
/** Function to trigger the action. */
|
|
75
|
+
action: () => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Reference to an active toast notification.
|
|
80
|
+
* Returned by `ComToastService` methods for programmatic control.
|
|
81
|
+
*/
|
|
82
|
+
declare class ComToastRef {
|
|
83
|
+
private readonly dismissSubject;
|
|
84
|
+
private readonly actionSubject;
|
|
85
|
+
private readonly dismissFn;
|
|
86
|
+
private dismissed;
|
|
87
|
+
constructor(dismissFn: () => void);
|
|
88
|
+
/** Programmatically dismiss the toast. */
|
|
89
|
+
dismiss(): void;
|
|
90
|
+
/** Emits once when the toast is dismissed (for any reason). */
|
|
91
|
+
afterDismissed(): Observable<ComToastDismissEvent>;
|
|
92
|
+
/** Emits when the action button is clicked. */
|
|
93
|
+
afterAction(): Observable<void>;
|
|
94
|
+
/** @internal */
|
|
95
|
+
_notifyDismissed(event: ComToastDismissEvent): void;
|
|
96
|
+
/** @internal */
|
|
97
|
+
_notifyAction(): void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Service for creating toast notifications imperatively.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const toast = inject(ComToastService);
|
|
106
|
+
* toast.success('File uploaded successfully.');
|
|
107
|
+
* toast.error('Failed to save.', 'Error');
|
|
108
|
+
*
|
|
109
|
+
* const ref = toast.show({ type: 'info', message: 'Item deleted.', action: { label: 'Undo' } });
|
|
110
|
+
* ref.afterAction().subscribe(() => undoDelete());
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare class ComToastService {
|
|
114
|
+
private readonly overlay;
|
|
115
|
+
private readonly injector;
|
|
116
|
+
private readonly destroyRef;
|
|
117
|
+
private readonly platformId;
|
|
118
|
+
private readonly document;
|
|
119
|
+
private readonly globalConfig;
|
|
120
|
+
private overlayRef;
|
|
121
|
+
private readonly toasts;
|
|
122
|
+
private readonly position;
|
|
123
|
+
private readonly timers;
|
|
124
|
+
private readonly refs;
|
|
125
|
+
private readonly animationFallbacks;
|
|
126
|
+
private readonly dismissReasons;
|
|
127
|
+
private rafHandle;
|
|
128
|
+
private readonly config;
|
|
129
|
+
constructor();
|
|
130
|
+
/**
|
|
131
|
+
* Show a toast notification with full configuration.
|
|
132
|
+
*/
|
|
133
|
+
show(data: ComToastData): ComToastRef;
|
|
134
|
+
/** Show a success toast. */
|
|
135
|
+
success(message: string, title?: string): ComToastRef;
|
|
136
|
+
/** Show a warning toast. */
|
|
137
|
+
warn(message: string, title?: string): ComToastRef;
|
|
138
|
+
/** Show an error toast. */
|
|
139
|
+
error(message: string, title?: string): ComToastRef;
|
|
140
|
+
/** Show an info toast. */
|
|
141
|
+
info(message: string, title?: string): ComToastRef;
|
|
142
|
+
/** Dismiss all active toasts. */
|
|
143
|
+
dismissAll(): void;
|
|
144
|
+
private showByType;
|
|
145
|
+
private ensureContainer;
|
|
146
|
+
private buildPositionStrategy;
|
|
147
|
+
private dismiss;
|
|
148
|
+
private removeToast;
|
|
149
|
+
private handleAction;
|
|
150
|
+
private dismissLatest;
|
|
151
|
+
private enforceMaxVisible;
|
|
152
|
+
private startTimer;
|
|
153
|
+
private ensureRafLoop;
|
|
154
|
+
private pauseTimer;
|
|
155
|
+
private resumeTimer;
|
|
156
|
+
private clearTimer;
|
|
157
|
+
private now;
|
|
158
|
+
private updateToast;
|
|
159
|
+
private disposeOverlay;
|
|
160
|
+
private dispose;
|
|
161
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComToastService, never>;
|
|
162
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ComToastService>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Injection token for global toast configuration.
|
|
167
|
+
*/
|
|
168
|
+
declare const COM_TOAST_CONFIG: InjectionToken<ComToastConfig>;
|
|
169
|
+
/**
|
|
170
|
+
* Provides global toast configuration.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* bootstrapApplication(AppComponent, {
|
|
175
|
+
* providers: [
|
|
176
|
+
* provideComToastConfig({ position: 'top-center', duration: 3000 }),
|
|
177
|
+
* ],
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
declare function provideComToastConfig(config: ComToastConfig): Provider;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* CVA variants for an individual toast card.
|
|
185
|
+
*
|
|
186
|
+
* @tokens `--color-success`, `--color-success-foreground`,
|
|
187
|
+
* `--color-warn`, `--color-warn-foreground`,
|
|
188
|
+
* `--color-warn-subtle`, `--color-warn-subtle-foreground`,
|
|
189
|
+
* `--color-primary-subtle`, `--color-primary-subtle-foreground`,
|
|
190
|
+
* `--color-border`, `--shadow-lg`, `--radius-card`
|
|
191
|
+
*/
|
|
192
|
+
declare const toastVariants: (props?: {
|
|
193
|
+
type?: ComToastType;
|
|
194
|
+
}) => string;
|
|
195
|
+
/**
|
|
196
|
+
* CVA variants for the toast container positioning.
|
|
197
|
+
*/
|
|
198
|
+
declare const toastContainerVariants: (props?: {
|
|
199
|
+
position?: ComToastPosition;
|
|
200
|
+
}) => string;
|
|
201
|
+
/**
|
|
202
|
+
* CVA variants for the toast progress bar.
|
|
203
|
+
*/
|
|
204
|
+
declare const toastProgressVariants: (props?: {
|
|
205
|
+
type?: ComToastType;
|
|
206
|
+
}) => string;
|
|
207
|
+
/**
|
|
208
|
+
* CVA variants for the toast close button.
|
|
209
|
+
*
|
|
210
|
+
* @tokens `--color-ring`, `--radius-card`
|
|
211
|
+
*/
|
|
212
|
+
declare const toastCloseButtonVariants: (props?: {
|
|
213
|
+
type?: ComToastType;
|
|
214
|
+
}) => string;
|
|
215
|
+
|
|
216
|
+
export { COM_TOAST_CONFIG, ComToastRef, ComToastService, provideComToastConfig, toastCloseButtonVariants, toastContainerVariants, toastProgressVariants, toastVariants };
|
|
217
|
+
export type { ComToastConfig, ComToastData, ComToastDismissEvent, ComToastDismissReason, ComToastPosition, ComToastTemplateContext, ComToastType };
|