@scion/components 22.3.0 → 22.5.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/_index.scss +37 -18
- package/design/icons/_scion-icon-font.scss +2 -2
- package/fesm2022/scion-components-common.mjs +48 -2
- package/fesm2022/scion-components-common.mjs.map +1 -1
- package/fesm2022/scion-components-icon.mjs +3 -56
- package/fesm2022/scion-components-icon.mjs.map +1 -1
- package/fesm2022/scion-components-menu.mjs +4 -4
- package/fesm2022/scion-components-menu.mjs.map +1 -1
- package/fesm2022/scion-components-splitter.mjs +1 -1
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-table.mjs +513 -232
- package/fesm2022/scion-components-table.mjs.map +1 -1
- package/package.json +3 -3
- package/types/scion-components-common.d.ts +36 -2
- package/types/scion-components-icon.d.ts +3 -56
- package/types/scion-components-table.d.ts +457 -117
|
@@ -67,11 +67,11 @@ interface SciTableRowBindingFactory {
|
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
69
|
* ```scss
|
|
70
|
-
* sci-table::part(row\:even) {
|
|
70
|
+
* sci-table::part(row\:even row\:not\:selected) {
|
|
71
71
|
* background-color: lightgray;
|
|
72
72
|
* }
|
|
73
73
|
*
|
|
74
|
-
* sci-table::part(row\:active) {
|
|
74
|
+
* sci-table::part(row\:active row\:not\:selected) {
|
|
75
75
|
* background-color: green;
|
|
76
76
|
* }
|
|
77
77
|
* ```
|
|
@@ -86,7 +86,398 @@ interface SciTableRowBindings {
|
|
|
86
86
|
part: Signal<`row:${string}`[]>;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
interface SciTableColumnFactory<T> {
|
|
90
|
+
addStringColumn(header: Translatable, value: (item: T) => MaybeSignal<string | undefined>): this;
|
|
91
|
+
addStringColumn(value: (item: T) => MaybeSignal<string | undefined>): this;
|
|
92
|
+
addStringColumn(descriptor: SciStringColumnDescriptor<T>): this;
|
|
93
|
+
/**
|
|
94
|
+
* Adds a number column to the table for displaying numeric values.
|
|
95
|
+
*
|
|
96
|
+
* ### Tabular Figures
|
|
97
|
+
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
98
|
+
*
|
|
99
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
100
|
+
*
|
|
101
|
+
* To disable tabular figures using CSS:
|
|
102
|
+
*
|
|
103
|
+
* ```scss
|
|
104
|
+
* // Disable tabular figures for all number columns.
|
|
105
|
+
* sci-table::part(column\:number) {
|
|
106
|
+
* font-variant-numeric: normal;
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
110
|
+
* sci-table::part(column\:column-name) {
|
|
111
|
+
* font-variant-numeric: normal;
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
addNumberColumn(header: Translatable, value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
116
|
+
/**
|
|
117
|
+
* Adds a number column to the table for displaying numeric values.
|
|
118
|
+
*
|
|
119
|
+
* ### Tabular Figures
|
|
120
|
+
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
121
|
+
*
|
|
122
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
123
|
+
*
|
|
124
|
+
* To disable tabular figures using CSS:
|
|
125
|
+
*
|
|
126
|
+
* ```scss
|
|
127
|
+
* // Disable tabular figures for all number columns.
|
|
128
|
+
* sci-table::part(column\:number) {
|
|
129
|
+
* font-variant-numeric: normal;
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
133
|
+
* sci-table::part(column\:column-name) {
|
|
134
|
+
* font-variant-numeric: normal;
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
addNumberColumn(value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a number column to the table for displaying numeric values.
|
|
141
|
+
*
|
|
142
|
+
* ### Tabular Figures
|
|
143
|
+
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
144
|
+
*
|
|
145
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
146
|
+
*
|
|
147
|
+
* To disable tabular figures using CSS:
|
|
148
|
+
*
|
|
149
|
+
* ```scss
|
|
150
|
+
* // Disable tabular figures for all number columns.
|
|
151
|
+
* sci-table::part(column\:number) {
|
|
152
|
+
* font-variant-numeric: normal;
|
|
153
|
+
* }
|
|
154
|
+
*
|
|
155
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
156
|
+
* sci-table::part(column\:column-name) {
|
|
157
|
+
* font-variant-numeric: normal;
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
addNumberColumn(descriptor: SciNumberColumnDescriptor<T>): this;
|
|
162
|
+
addBooleanColumn(header: Translatable, value: (item: T) => MaybeSignal<boolean | undefined>): this;
|
|
163
|
+
addBooleanColumn(value: (item: T) => MaybeSignal<boolean | undefined>): this;
|
|
164
|
+
addBooleanColumn(descriptor: SciBooleanColumnDescriptor<T>): this;
|
|
165
|
+
/**
|
|
166
|
+
* Adds a temporal column to the table for displaying dates, times, or both.
|
|
167
|
+
*
|
|
168
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
169
|
+
*
|
|
170
|
+
* Dates are formatted using `mediumDate`, or as specified in {@link DATE_PIPE_DEFAULT_OPTIONS}.
|
|
171
|
+
*
|
|
172
|
+
* ### Tabular Figures
|
|
173
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
174
|
+
*
|
|
175
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
176
|
+
*
|
|
177
|
+
* To disable tabular figures using CSS:
|
|
178
|
+
*
|
|
179
|
+
* ```scss
|
|
180
|
+
* // Disable tabular figures for all date columns.
|
|
181
|
+
* sci-table::part(column\:date) {
|
|
182
|
+
* font-variant-numeric: normal;
|
|
183
|
+
* }
|
|
184
|
+
*
|
|
185
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
186
|
+
* sci-table::part(column\:column-name) {
|
|
187
|
+
* font-variant-numeric: normal;
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
addDateColumn(header: Translatable, value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
192
|
+
/**
|
|
193
|
+
* Adds a temporal column to the table for displaying dates, times, or both.
|
|
194
|
+
*
|
|
195
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
196
|
+
*
|
|
197
|
+
* Dates are formatted using `mediumDate`, or as specified in {@link DATE_PIPE_DEFAULT_OPTIONS}.
|
|
198
|
+
*
|
|
199
|
+
* ### Tabular Figures
|
|
200
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
201
|
+
*
|
|
202
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
203
|
+
*
|
|
204
|
+
* To disable tabular figures using CSS:
|
|
205
|
+
*
|
|
206
|
+
* ```scss
|
|
207
|
+
* // Disable tabular figures for all date columns.
|
|
208
|
+
* sci-table::part(column\:date) {
|
|
209
|
+
* font-variant-numeric: normal;
|
|
210
|
+
* }
|
|
211
|
+
*
|
|
212
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
213
|
+
* sci-table::part(column\:column-name) {
|
|
214
|
+
* font-variant-numeric: normal;
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
addDateColumn(value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
219
|
+
/**
|
|
220
|
+
* Adds a temporal column to the table for displaying dates, times, or both.
|
|
221
|
+
*
|
|
222
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
223
|
+
*
|
|
224
|
+
* Dates are formatted as specified in {@link SciDateColumnDescriptor.format}, {@link SciDateColumnDescriptor.locale}, and {@link SciDateColumnDescriptor.timezone}.
|
|
225
|
+
*
|
|
226
|
+
* ### Tabular Figures
|
|
227
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
228
|
+
*
|
|
229
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
230
|
+
*
|
|
231
|
+
* To disable tabular figures using CSS:
|
|
232
|
+
*
|
|
233
|
+
* ```scss
|
|
234
|
+
* // Disable tabular figures for all date columns.
|
|
235
|
+
* sci-table::part(column\:date) {
|
|
236
|
+
* font-variant-numeric: normal;
|
|
237
|
+
* }
|
|
238
|
+
*
|
|
239
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
240
|
+
* sci-table::part(column\:column-name) {
|
|
241
|
+
* font-variant-numeric: normal;
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
addDateColumn(descriptor: SciDateColumnDescriptor<T>): this;
|
|
246
|
+
addComponentColumn(descriptor: SciComponentColumnDescriptor<T>): this;
|
|
247
|
+
addTemplateColumn(descriptor: SciTemplateColumnDescriptor<T>): this;
|
|
248
|
+
}
|
|
249
|
+
interface SciTableColumnDescriptor {
|
|
250
|
+
name?: `column:${string}`;
|
|
251
|
+
header?: Translatable;
|
|
252
|
+
resizable?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Preferred column size.
|
|
255
|
+
* Value which can be used inside `grid-template-columns` definition. Defaults to 1fr.
|
|
256
|
+
* Examples: `1fr`, `max-content`, `100px`.
|
|
257
|
+
*/
|
|
258
|
+
width?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Min column width in px. Defaults to 100.
|
|
261
|
+
*/
|
|
262
|
+
minWidth?: number;
|
|
263
|
+
}
|
|
264
|
+
interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
265
|
+
value: (item: T) => MaybeSignal<string | undefined>;
|
|
266
|
+
sortable?: boolean | {
|
|
267
|
+
comparator: SciTableColumnSortComparatorFn<T, string>;
|
|
268
|
+
};
|
|
269
|
+
filterable?: boolean | {
|
|
270
|
+
matcher: SciTableColumnFilterMatcherFn<T, string>;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Configures a table column for displaying numeric values.
|
|
275
|
+
*/
|
|
276
|
+
interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
277
|
+
/**
|
|
278
|
+
* Specifies the number to display in this column.
|
|
279
|
+
*/
|
|
280
|
+
value: (item: T) => MaybeSignal<number | undefined>;
|
|
281
|
+
/**
|
|
282
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
283
|
+
*/
|
|
284
|
+
sortable?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
287
|
+
*/
|
|
288
|
+
filterable?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Specifies how to format numbers. Defaults to standard number formatting based on the active {@link locale}.
|
|
291
|
+
*
|
|
292
|
+
* ##### Grouping Separators
|
|
293
|
+
* Disable grouping separators (such as thousands separators) by setting {@link Intl.NumberFormatOptions.useGrouping} to `false`.
|
|
294
|
+
*
|
|
295
|
+
* ```ts
|
|
296
|
+
* import {table} from '@scion/components/table';
|
|
297
|
+
*
|
|
298
|
+
* table(data, table => table.addNumberColumn({
|
|
299
|
+
* value: item => item.numericValue,
|
|
300
|
+
* format: {useGrouping: false},
|
|
301
|
+
* }));
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* ##### Fraction Digits
|
|
305
|
+
* Control the number of decimal places using the {@link Intl.NumberFormatOptions.minimumFractionDigits} and {@link Intl.NumberFormatOptions.maximumFractionDigits} properties.
|
|
306
|
+
*
|
|
307
|
+
* ```ts
|
|
308
|
+
* import {table} from '@scion/components/table';
|
|
309
|
+
*
|
|
310
|
+
* table(data, table => table.addNumberColumn({
|
|
311
|
+
* value: item => item.numericValue,
|
|
312
|
+
* format: {
|
|
313
|
+
* minimumFractionDigits: 2,
|
|
314
|
+
* maximumFractionDigits: 2,
|
|
315
|
+
* },
|
|
316
|
+
* }));
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* ##### Currency
|
|
320
|
+
* To render numbers as currency, set {@link Intl.NumberFormatOptions.style} to `currency` and specify the currency code.
|
|
321
|
+
*
|
|
322
|
+
* The currency code defaults to {@link DEFAULT_CURRENCY_CODE}, or `USD` if not provided.
|
|
323
|
+
* To change the currency, set the {@link Intl.NumberFormatOptions.currency} property to a different [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code (e.g., `EUR`, `CHF`, `GBP`).
|
|
324
|
+
*
|
|
325
|
+
* ```ts
|
|
326
|
+
* import {table} from '@scion/components/table';
|
|
327
|
+
*
|
|
328
|
+
* table(data, table => table.addNumberColumn({
|
|
329
|
+
* value: item => item.numericValue,
|
|
330
|
+
* format: {
|
|
331
|
+
* style: 'currency',
|
|
332
|
+
* currency: 'EUR',
|
|
333
|
+
* },
|
|
334
|
+
* }));
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
* ##### Unit
|
|
338
|
+
* To render numbers with a specific unit (e.g., `kilogram`, `kilometer`, `kilometer-per-hour`, or `hour`), set {@link Intl.NumberFormatOptions.style} to `unit`
|
|
339
|
+
* and specify the unit from [Supported Unit Identifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#supported_unit_identifiers).
|
|
340
|
+
*
|
|
341
|
+
* ```ts
|
|
342
|
+
* import {table} from '@scion/components/table';
|
|
343
|
+
*
|
|
344
|
+
* table(data, table => table.addNumberColumn({
|
|
345
|
+
* value: item => item.numericValue,
|
|
346
|
+
* format: {
|
|
347
|
+
* style: 'unit',
|
|
348
|
+
* unit: 'kilometer-per-hour',
|
|
349
|
+
* },
|
|
350
|
+
* }));
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
354
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#supported_unit_identifiers
|
|
355
|
+
* @see https://en.wikipedia.org/wiki/ISO_4217
|
|
356
|
+
*/
|
|
357
|
+
format?: Intl.NumberFormatOptions;
|
|
358
|
+
/**
|
|
359
|
+
* Specifies the locale used to localize numbers.
|
|
360
|
+
*
|
|
361
|
+
* The locale determines group sizing and separators, decimal point characters, and other locale-specific formatting rules.
|
|
362
|
+
*
|
|
363
|
+
* Defaults to {@link SCI_LOCALE}, which initializes from {@link LOCALE_ID} (defaulting to `en-US`).
|
|
364
|
+
*
|
|
365
|
+
* See {@link SCI_LOCALE} for details on how to change the locale at runtime.
|
|
366
|
+
*/
|
|
367
|
+
locale?: MaybeSignal<string>;
|
|
368
|
+
}
|
|
369
|
+
interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
370
|
+
value: (item: T) => MaybeSignal<boolean | undefined>;
|
|
371
|
+
sortable?: boolean;
|
|
372
|
+
filterable?: boolean;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Configures a table column for displaying dates.
|
|
376
|
+
*/
|
|
377
|
+
interface SciDateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
378
|
+
/**
|
|
379
|
+
* Specifies the date value to display in this column.
|
|
380
|
+
*
|
|
381
|
+
* Can be an ISO 8601 date/time string (e.g., `2026-10-06`, `2026-10-06T14:30:15Z`, `T14:30:15`), milliseconds since the UTC epoch, or a `Date` object.
|
|
382
|
+
*/
|
|
383
|
+
value: (item: T) => MaybeSignal<SciDateLike | undefined>;
|
|
384
|
+
/**
|
|
385
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
386
|
+
*/
|
|
387
|
+
sortable?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
390
|
+
*/
|
|
391
|
+
filterable?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* Specifies how to format dates. Defaults to the format configured in {@link DATE_PIPE_DEFAULT_OPTIONS}, or `mediumDate` if not provided.
|
|
394
|
+
*
|
|
395
|
+
* Accepts a predefined Angular date format (e.g., `mediumDate`, `mediumTime`) or a custom format (e.g., `dd.MM.yyyy`, `HH:mm`).
|
|
396
|
+
* Formatting may vary depending on the active {@link locale}.
|
|
397
|
+
*
|
|
398
|
+
* Use a time-only format to display only the time component.
|
|
399
|
+
*
|
|
400
|
+
* @see https://angular.dev/api/common/DatePipe#pre-defined-format-options
|
|
401
|
+
* @see https://angular.dev/api/common/DatePipe#custom-format-options
|
|
402
|
+
*/
|
|
403
|
+
format?: 'shortDate' | 'mediumDate' | 'longDate' | 'fullDate' | 'shortTime' | 'mediumTime' | 'longTime' | 'fullTime' | 'short' | 'medium' | 'long' | 'full' | string;
|
|
404
|
+
/**
|
|
405
|
+
* Specifies the locale used to localize dates.
|
|
406
|
+
*
|
|
407
|
+
* The locale determines date/time patterns, month and weekday names, AM/PM indicators, and related formatting symbols.
|
|
408
|
+
*
|
|
409
|
+
* Defaults to {@link SCI_LOCALE}, which initializes from {@link LOCALE_ID} (defaulting to `en-US`).
|
|
410
|
+
*
|
|
411
|
+
* See {@link SCI_LOCALE} for details on how to change the locale at runtime.
|
|
412
|
+
*/
|
|
413
|
+
locale?: MaybeSignal<string>;
|
|
414
|
+
/**
|
|
415
|
+
* Specifies the timezone in which to render dates.
|
|
416
|
+
*
|
|
417
|
+
* Must be a UTC/GMT offset (e.g., `+0430` or `-0500`).
|
|
418
|
+
*
|
|
419
|
+
* Defaults to the timezone configured in {@link DATE_PIPE_DEFAULT_OPTIONS}, or the user's system timezone if not provided.
|
|
420
|
+
*/
|
|
421
|
+
timezone?: string;
|
|
422
|
+
}
|
|
423
|
+
interface SciComponentColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
424
|
+
component: (item: T) => SciComponentDescriptor;
|
|
425
|
+
sortable?: boolean | {
|
|
426
|
+
comparator: SciTableColumnSortComparatorFn<T, void>;
|
|
427
|
+
};
|
|
428
|
+
filterable?: boolean | {
|
|
429
|
+
matcher: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* Controls whether cell padding is applied. Set to `false` to let content fill the entire cell (render to cell bounds).
|
|
433
|
+
*
|
|
434
|
+
* Defaults to `true`.
|
|
435
|
+
*/
|
|
436
|
+
padding?: boolean;
|
|
437
|
+
}
|
|
438
|
+
interface SciTemplateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
439
|
+
template: (item: T) => SciTemplateDescriptor;
|
|
440
|
+
sortable?: boolean | {
|
|
441
|
+
comparator: SciTableColumnSortComparatorFn<T, void>;
|
|
442
|
+
};
|
|
443
|
+
filterable?: boolean | {
|
|
444
|
+
matcher: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Controls whether cell padding is applied. Set to `false` to let content fill the entire cell (render to cell bounds).
|
|
448
|
+
*
|
|
449
|
+
* Defaults to `true`.
|
|
450
|
+
*/
|
|
451
|
+
padding?: boolean;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Signature of a function used to configure a comparator for sorting a table column.
|
|
455
|
+
*/
|
|
456
|
+
type SciTableColumnSortComparatorFn<T = unknown, VALUE = unknown> = (a: SciTableCellContext<T, VALUE>, b: SciTableCellContext<T, VALUE>) => number;
|
|
457
|
+
/**
|
|
458
|
+
* Signature of a function used to configure a matcher for filtering a table column.
|
|
459
|
+
*/
|
|
460
|
+
type SciTableColumnFilterMatcherFn<T = unknown, VALUE = unknown, FILTER = VALUE> = (filter: FILTER, context: SciTableCellContext<T, VALUE>) => boolean;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Represents the internal value of {@link SciDateColumn}.
|
|
464
|
+
*/
|
|
465
|
+
interface SciDateValue {
|
|
466
|
+
/**
|
|
467
|
+
* Full ISO 8601 date/time string.
|
|
468
|
+
*/
|
|
469
|
+
isoString: string;
|
|
470
|
+
/**
|
|
471
|
+
* Milliseconds since UTC epoch.
|
|
472
|
+
*/
|
|
473
|
+
millis: number;
|
|
474
|
+
/**
|
|
475
|
+
* Human-readable formatted date and time string.
|
|
476
|
+
*/
|
|
477
|
+
formatted: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
type SciTableColumnType = 'string' | 'number' | 'boolean' | 'date' | 'component' | 'template';
|
|
90
481
|
type SciTableRowActionFactoryFn<T> = (toolbar: SciToolbarFactory, item: T, index: number) => void;
|
|
91
482
|
interface SciTableDescriptor<T> {
|
|
92
483
|
datasource: Signal<T[]>;
|
|
@@ -137,7 +528,7 @@ interface SciTableDescriptor<T> {
|
|
|
137
528
|
* ```
|
|
138
529
|
*
|
|
139
530
|
* ```scss
|
|
140
|
-
* sci-table::part(row\:even) {
|
|
531
|
+
* sci-table::part(row\:even row\:not\:selected) {
|
|
141
532
|
* background-color: lightgray;
|
|
142
533
|
* }
|
|
143
534
|
* ```
|
|
@@ -169,13 +560,12 @@ interface SciTable<T> {
|
|
|
169
560
|
readonly sortable: WritableSignal<boolean>;
|
|
170
561
|
readonly resizable: WritableSignal<boolean>;
|
|
171
562
|
readonly selectable: WritableSignal<'single' | 'multi' | false>;
|
|
563
|
+
/**
|
|
564
|
+
* Filters items cross-column, ignoring {@link SciTableDescriptor.filterable} and {@link SciTableColumnDescriptor.filterable} settings.
|
|
565
|
+
*/
|
|
172
566
|
filter(text: string | null): void;
|
|
173
567
|
}
|
|
174
|
-
interface
|
|
175
|
-
item: T;
|
|
176
|
-
value: VALUE;
|
|
177
|
-
}
|
|
178
|
-
interface SciTableColumn {
|
|
568
|
+
interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
179
569
|
type: SciTableColumnType;
|
|
180
570
|
name: `column:${string}`;
|
|
181
571
|
header: Signal<string>;
|
|
@@ -190,38 +580,47 @@ interface SciTableColumn {
|
|
|
190
580
|
x: number;
|
|
191
581
|
width: number;
|
|
192
582
|
};
|
|
583
|
+
compare: SciTableColumnSortComparatorFn<T, VALUE>;
|
|
584
|
+
matches: SciTableColumnFilterMatcherFn<T, VALUE, FILTER>;
|
|
193
585
|
}
|
|
194
|
-
interface SciStringColumn<T> extends SciTableColumn {
|
|
586
|
+
interface SciStringColumn<T = unknown> extends SciTableColumn<T, string> {
|
|
195
587
|
type: 'string';
|
|
196
|
-
value: (item: T) =>
|
|
197
|
-
|
|
198
|
-
|
|
588
|
+
value: (item: T) => Signal<string | undefined>;
|
|
589
|
+
compare: SciTableColumnSortComparatorFn<T, string>;
|
|
590
|
+
matches: SciTableColumnFilterMatcherFn<T, string>;
|
|
199
591
|
}
|
|
200
|
-
interface SciNumberColumn<T> extends SciTableColumn {
|
|
592
|
+
interface SciNumberColumn<T = unknown> extends SciTableColumn<T, number> {
|
|
201
593
|
type: 'number';
|
|
202
|
-
value: (item: T) =>
|
|
203
|
-
|
|
204
|
-
|
|
594
|
+
value: (item: T) => Signal<number | undefined>;
|
|
595
|
+
compare: SciTableColumnSortComparatorFn<T, number>;
|
|
596
|
+
matches: SciTableColumnFilterMatcherFn<T, number>;
|
|
597
|
+
format: Signal<Intl.NumberFormat>;
|
|
205
598
|
}
|
|
206
|
-
interface SciBooleanColumn<T> extends SciTableColumn {
|
|
599
|
+
interface SciBooleanColumn<T = unknown> extends SciTableColumn<T, boolean> {
|
|
207
600
|
type: 'boolean';
|
|
208
|
-
value: (item: T) =>
|
|
209
|
-
|
|
210
|
-
|
|
601
|
+
value: (item: T) => Signal<boolean | undefined>;
|
|
602
|
+
compare: SciTableColumnSortComparatorFn<T, boolean>;
|
|
603
|
+
matches: SciTableColumnFilterMatcherFn<T, boolean>;
|
|
604
|
+
}
|
|
605
|
+
interface SciDateColumn<T = unknown> extends SciTableColumn<T, SciDateValue, string> {
|
|
606
|
+
type: 'date';
|
|
607
|
+
value: (item: T) => Signal<SciDateValue | undefined>;
|
|
608
|
+
compare: SciTableColumnSortComparatorFn<T, SciDateValue>;
|
|
609
|
+
matches: SciTableColumnFilterMatcherFn<T, SciDateValue, string>;
|
|
211
610
|
}
|
|
212
|
-
interface SciComponentColumn<T> extends SciTableColumn {
|
|
611
|
+
interface SciComponentColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
213
612
|
type: 'component';
|
|
214
613
|
component: (item: T) => SciComponentDescriptor;
|
|
215
|
-
|
|
216
|
-
|
|
614
|
+
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
615
|
+
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
217
616
|
}
|
|
218
|
-
interface SciTemplateColumn<T> extends SciTableColumn {
|
|
617
|
+
interface SciTemplateColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
219
618
|
type: 'template';
|
|
220
619
|
template: (item: T) => SciTemplateDescriptor;
|
|
221
|
-
|
|
222
|
-
|
|
620
|
+
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
621
|
+
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
223
622
|
}
|
|
224
|
-
type SciTableColumnLike<T = unknown> = SciStringColumn<T> | SciNumberColumn<T> | SciBooleanColumn<T> | SciComponentColumn<T> | SciTemplateColumn<T>;
|
|
623
|
+
type SciTableColumnLike<T = unknown> = SciStringColumn<T> | SciNumberColumn<T> | SciBooleanColumn<T> | SciDateColumn<T> | SciComponentColumn<T> | SciTemplateColumn<T>;
|
|
225
624
|
/**
|
|
226
625
|
* Mapped row, used as display state.
|
|
227
626
|
*/
|
|
@@ -238,30 +637,39 @@ interface SciTableRow<T> {
|
|
|
238
637
|
}
|
|
239
638
|
interface SciStringCell {
|
|
240
639
|
type: 'string';
|
|
241
|
-
column:
|
|
242
|
-
value: Signal<string>;
|
|
640
|
+
column: SciStringColumn;
|
|
641
|
+
value: Signal<string | undefined>;
|
|
243
642
|
}
|
|
244
643
|
interface SciNumberCell {
|
|
245
644
|
type: 'number';
|
|
246
|
-
column:
|
|
247
|
-
value: Signal<number>;
|
|
645
|
+
column: SciNumberColumn;
|
|
646
|
+
value: Signal<number | undefined>;
|
|
248
647
|
}
|
|
249
648
|
interface SciBooleanCell {
|
|
250
649
|
type: 'boolean';
|
|
251
|
-
column:
|
|
252
|
-
value: Signal<boolean>;
|
|
650
|
+
column: SciBooleanColumn;
|
|
651
|
+
value: Signal<boolean | undefined>;
|
|
652
|
+
}
|
|
653
|
+
interface SciDateCell {
|
|
654
|
+
type: 'date';
|
|
655
|
+
column: SciDateColumn;
|
|
656
|
+
value: Signal<SciDateValue | undefined>;
|
|
253
657
|
}
|
|
254
658
|
interface SciComponentCell {
|
|
255
659
|
type: 'component';
|
|
256
|
-
column:
|
|
660
|
+
column: SciComponentColumn;
|
|
257
661
|
component: SciComponentDescriptor;
|
|
258
662
|
}
|
|
259
663
|
interface SciTemplateCell {
|
|
260
664
|
type: 'template';
|
|
261
|
-
column:
|
|
665
|
+
column: SciTemplateColumn;
|
|
262
666
|
template: SciTemplateDescriptor;
|
|
263
667
|
}
|
|
264
|
-
type SciTableCellLike = SciStringCell | SciNumberCell | SciBooleanCell | SciComponentCell | SciTemplateCell;
|
|
668
|
+
type SciTableCellLike = SciStringCell | SciNumberCell | SciBooleanCell | SciDateCell | SciComponentCell | SciTemplateCell;
|
|
669
|
+
interface SciTableCellContext<T = unknown, VALUE = unknown> {
|
|
670
|
+
item: T;
|
|
671
|
+
value: VALUE;
|
|
672
|
+
}
|
|
265
673
|
/**
|
|
266
674
|
* Represents an event emitted by {@link SciTableComponent}.
|
|
267
675
|
*/
|
|
@@ -275,84 +683,10 @@ interface SciTableEvent<T> {
|
|
|
275
683
|
*/
|
|
276
684
|
items: T[];
|
|
277
685
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
addStringColumn(descriptor: SciStringColumnDescriptor<T>): this;
|
|
283
|
-
addBooleanColumn(header: Translatable, value: (item: T) => boolean): this;
|
|
284
|
-
addBooleanColumn(value: (item: T) => boolean): this;
|
|
285
|
-
addBooleanColumn(descriptor: SciBooleanColumnDescriptor<T>): this;
|
|
286
|
-
addNumberColumn(header: Translatable, value: (item: T) => number): this;
|
|
287
|
-
addNumberColumn(value: (item: T) => number): this;
|
|
288
|
-
addNumberColumn(descriptor: SciNumberColumnDescriptor<T>): this;
|
|
289
|
-
addComponentColumn(descriptor: SciComponentColumnDescriptor<T>): this;
|
|
290
|
-
addTemplateColumn(descriptor: SciTemplateColumnDescriptor<T>): this;
|
|
291
|
-
}
|
|
292
|
-
interface SciTableColumnDescriptor {
|
|
293
|
-
name?: `column:${string}`;
|
|
294
|
-
header?: Translatable;
|
|
295
|
-
resizable?: boolean;
|
|
296
|
-
/**
|
|
297
|
-
* Preferred column size.
|
|
298
|
-
* Value which can be used inside `grid-template-columns` definition. Defaults to 1fr.
|
|
299
|
-
* Examples: `1fr`, `max-content`, `100px`.
|
|
300
|
-
*/
|
|
301
|
-
width?: string;
|
|
302
|
-
/**
|
|
303
|
-
* Min column width in px. Defaults to 100.
|
|
304
|
-
*/
|
|
305
|
-
minWidth?: number;
|
|
306
|
-
}
|
|
307
|
-
interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
308
|
-
value: (item: T) => MaybeSignal<string>;
|
|
309
|
-
sortable?: boolean | {
|
|
310
|
-
comparator: (a: SciTableCellContext<T, string>, b: SciTableCellContext<T, string>) => number;
|
|
311
|
-
};
|
|
312
|
-
filterable?: boolean | {
|
|
313
|
-
matcher: (text: string, context: SciTableCellContext<T, string>) => boolean;
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
317
|
-
value: (item: T) => MaybeSignal<number>;
|
|
318
|
-
sortable?: boolean;
|
|
319
|
-
filterable?: boolean;
|
|
320
|
-
}
|
|
321
|
-
interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
322
|
-
value: (item: T) => MaybeSignal<boolean>;
|
|
323
|
-
sortable?: boolean;
|
|
324
|
-
filterable?: boolean;
|
|
325
|
-
}
|
|
326
|
-
interface SciComponentColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
327
|
-
component: (item: T) => SciComponentDescriptor;
|
|
328
|
-
sortable?: boolean | {
|
|
329
|
-
comparator: (a: SciTableCellContext<T, void>, b: SciTableCellContext<T, void>) => number;
|
|
330
|
-
};
|
|
331
|
-
filterable?: boolean | {
|
|
332
|
-
matcher: (text: string, context: SciTableCellContext<T, void>) => boolean;
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* Controls whether cell padding is applied. Set to `false` to let content fill the entire cell (render to cell bounds).
|
|
336
|
-
*
|
|
337
|
-
* Defaults to `true`.
|
|
338
|
-
*/
|
|
339
|
-
padding?: boolean;
|
|
340
|
-
}
|
|
341
|
-
interface SciTemplateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
342
|
-
template: (item: T) => SciTemplateDescriptor;
|
|
343
|
-
sortable?: boolean | {
|
|
344
|
-
comparator: (a: SciTableCellContext<T, void>, b: SciTableCellContext<T, void>) => number;
|
|
345
|
-
};
|
|
346
|
-
filterable?: boolean | {
|
|
347
|
-
matcher: (text: string, context: SciTableCellContext<T, void>) => boolean;
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
* Controls whether cell padding is applied. Set to `false` to let content fill the entire cell (render to cell bounds).
|
|
351
|
-
*
|
|
352
|
-
* Defaults to `true`.
|
|
353
|
-
*/
|
|
354
|
-
padding?: boolean;
|
|
355
|
-
}
|
|
686
|
+
/**
|
|
687
|
+
* Represents an ISO 8601 date/time string, milliseconds since the UTC epoch, or a `Date` object.
|
|
688
|
+
*/
|
|
689
|
+
type SciDateLike = string | number | Date;
|
|
356
690
|
|
|
357
691
|
type SciTableColumnFactoryFn<T> = (table: SciTableColumnFactory<T>) => void;
|
|
358
692
|
/** @experimental since 22.3.0; API and behavior may change in any version without notice. */
|
|
@@ -393,6 +727,7 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
393
727
|
readonly sortCriteria: WritableSignal<SciTableSortCriterion[]>;
|
|
394
728
|
readonly filterCriteria: WritableSignal<SciTableColumnFilter[]>;
|
|
395
729
|
private readonly _cache;
|
|
730
|
+
private readonly _tableCellValuePreloader;
|
|
396
731
|
private readonly _tableFilter;
|
|
397
732
|
private readonly _selectedItems;
|
|
398
733
|
readonly totalCount: WritableSignal<number | undefined>;
|
|
@@ -458,6 +793,12 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
458
793
|
columnName: `column:${string}`;
|
|
459
794
|
}): void;
|
|
460
795
|
updateSelectedItems(updateFn: (ids: Map<unknown, T>) => Map<unknown, T>): void;
|
|
796
|
+
/**
|
|
797
|
+
* Indicates whether the built-in array datasource is used.
|
|
798
|
+
*
|
|
799
|
+
* Supports out-of-the-box filtering and sorting for built-in table columns.
|
|
800
|
+
*/
|
|
801
|
+
isArrayDatasource(): boolean;
|
|
461
802
|
reset(): void;
|
|
462
803
|
dispose(): void;
|
|
463
804
|
/**
|
|
@@ -468,7 +809,6 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
468
809
|
* Resets cache on criteria changes.
|
|
469
810
|
*/
|
|
470
811
|
private installCriteriaWatcher;
|
|
471
|
-
private initColumn;
|
|
472
812
|
private mapItemsToRow;
|
|
473
813
|
/**
|
|
474
814
|
* Creates a signal to read and write table user settings.
|
|
@@ -574,4 +914,4 @@ interface SciTableStorage {
|
|
|
574
914
|
declare function provideTableStorage(storage: Type<SciTableStorage>): EnvironmentProviders;
|
|
575
915
|
|
|
576
916
|
export { SciTableComponent, provideTableRowBinding, provideTableStorage, table, ɵillegaldatasource };
|
|
577
|
-
export type { SciBooleanColumnDescriptor, SciComponentColumnDescriptor, SciNumberColumnDescriptor, SciStringColumnDescriptor, SciTable, SciTableCellContext, SciTableColumnDescriptor, SciTableColumnFactory, SciTableColumnFactoryFn, SciTableColumnFilter, SciTableColumnType, SciTableDataLoaderFn, SciTableDescriptor, SciTableEvent, SciTablePageRequest, SciTablePageResponse, SciTableRowActionFactoryFn, SciTableRowBindingFactory, SciTableRowBindingFactoryFn, SciTableSortCriterion, SciTableStorage, SciTemplateColumnDescriptor };
|
|
917
|
+
export type { SciBooleanColumnDescriptor, SciComponentColumnDescriptor, SciDateColumnDescriptor, SciDateLike, SciNumberColumnDescriptor, SciStringColumnDescriptor, SciTable, SciTableCellContext, SciTableColumnDescriptor, SciTableColumnFactory, SciTableColumnFactoryFn, SciTableColumnFilter, SciTableColumnFilterMatcherFn, SciTableColumnSortComparatorFn, SciTableColumnType, SciTableDataLoaderFn, SciTableDescriptor, SciTableEvent, SciTablePageRequest, SciTablePageResponse, SciTableRowActionFactoryFn, SciTableRowBindingFactory, SciTableRowBindingFactoryFn, SciTableSortCriterion, SciTableStorage, SciTemplateColumnDescriptor };
|