@scion/components 22.5.0 → 22.6.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 +32 -88
- package/fesm2022/scion-components-common.mjs +133 -5
- package/fesm2022/scion-components-common.mjs.map +1 -1
- package/fesm2022/scion-components-dimension.mjs +3 -3
- package/fesm2022/scion-components-dimension.mjs.map +1 -1
- package/fesm2022/scion-components-icon.mjs +134 -98
- package/fesm2022/scion-components-icon.mjs.map +1 -1
- package/fesm2022/scion-components-menu.mjs +58 -51
- package/fesm2022/scion-components-menu.mjs.map +1 -1
- package/fesm2022/scion-components-sashbox.mjs +1 -1
- package/fesm2022/scion-components-sashbox.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 +352 -159
- package/fesm2022/scion-components-table.mjs.map +1 -1
- package/fesm2022/scion-components-text.mjs +83 -40
- package/fesm2022/scion-components-text.mjs.map +1 -1
- package/fesm2022/scion-components-throbber.mjs +1 -1
- package/fesm2022/scion-components-throbber.mjs.map +1 -1
- package/fesm2022/scion-components-viewport.mjs +31 -18
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/package.json +2 -2
- package/types/scion-components-common.d.ts +91 -4
- package/types/scion-components-icon.d.ts +42 -15
- package/types/scion-components-menu.d.ts +7 -2
- package/types/scion-components-sashbox.d.ts +1 -1
- package/types/scion-components-splitter.d.ts +1 -1
- package/types/scion-components-table.d.ts +440 -59
- package/types/scion-components-text.d.ts +6 -5
- package/types/scion-components-throbber.d.ts +1 -1
- package/types/scion-components-viewport.d.ts +20 -11
- package/viewport/scrollbar/_scrollbar.scss +12 -0
- package/design/icons/_scion-icon-font.scss +0 -50
|
@@ -9,7 +9,7 @@ type MaybeAsync<T> = T | Promise<T> | Observable<T>;
|
|
|
9
9
|
|
|
10
10
|
interface SciTableColumnFilter {
|
|
11
11
|
columnName: `column:${string}`;
|
|
12
|
-
text: string | boolean |
|
|
12
|
+
text: string | number | boolean | SciEnumValueLike | SciEnumValueLike[];
|
|
13
13
|
}
|
|
14
14
|
interface SciTableSortCriterion {
|
|
15
15
|
columnName: `column:${string}`;
|
|
@@ -47,22 +47,60 @@ type SciTableDataLoaderFn<T> = (request: SciTablePageRequest) => MaybeAsync<SciT
|
|
|
47
47
|
*/
|
|
48
48
|
declare function ɵillegaldatasource<T>(): Signal<T[]>;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Provides row bindings to tables in the scope of the injector providing the bindings.
|
|
52
|
+
*
|
|
53
|
+
* Multiple providers can be registered. Providers at different injector tree levels form a hierarchy.
|
|
54
|
+
*/
|
|
55
|
+
declare function provideTableRowBinding<T = unknown>(bindings: SciTableRowBindingFactoryFn<T>): Provider[];
|
|
56
|
+
/**
|
|
57
|
+
* Signature of a function to configure row bindings.
|
|
58
|
+
*
|
|
59
|
+
* Called per item with a {@link SciTableRowBindingFactory} to register bindings.
|
|
60
|
+
*
|
|
61
|
+
* The function:
|
|
62
|
+
* - Runs in a reactive context and re-evaluates when tracked signals change.
|
|
63
|
+
* - Can call `inject` to get required dependencies.
|
|
64
|
+
*/
|
|
65
|
+
type SciTableRowBindingFactoryFn<T> = (row: SciTableRowBindingFactory, item: T, index: number) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Factory for configuring row bindings.
|
|
68
|
+
*
|
|
69
|
+
* Row bindings enable associating metadata and icons with a row. Metadata includes CSS shadow parts, CSS classes, and HTML attributes.
|
|
70
|
+
*/
|
|
52
71
|
interface SciTableRowBindingFactory {
|
|
53
|
-
addAttributeBinding(name: string, value: unknown | undefined): this;
|
|
54
|
-
addClassBinding(name: string | undefined): this;
|
|
55
72
|
/**
|
|
56
|
-
*
|
|
73
|
+
* Binds an icon to the row, displayed in the first column.
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* import {table} from '@scion/components/table';
|
|
77
|
+
*
|
|
78
|
+
* table({
|
|
79
|
+
* datasource: data,
|
|
80
|
+
* columns: table => ...,
|
|
81
|
+
* rowBindings: bindings => bindings.addIconBinding('account_circle'),
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
|
|
86
|
+
*
|
|
87
|
+
* Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
|
|
88
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
89
|
+
*/
|
|
90
|
+
addIconBinding(icon: string): this;
|
|
91
|
+
/**
|
|
92
|
+
* Binds a CSS shadow part to the row for custom row/cell styling using the `::part()` CSS pseudo-element selector.
|
|
57
93
|
*
|
|
58
94
|
* Example usage:
|
|
59
95
|
* ```ts
|
|
96
|
+
* import {table} from '@scion/components/table';
|
|
97
|
+
*
|
|
60
98
|
* table({
|
|
61
99
|
* datasource: data,
|
|
100
|
+
* columns: table => ...,
|
|
62
101
|
* rowBindings: (bindings, item, index) => bindings
|
|
63
102
|
* .addPartBinding(index % 2 === 0 ? 'row:even' : 'row:odd')
|
|
64
103
|
* .addPartBinding(item.active ? 'row:active' : undefined),
|
|
65
|
-
* columns: table => ...,
|
|
66
104
|
* });
|
|
67
105
|
* ```
|
|
68
106
|
*
|
|
@@ -77,21 +115,69 @@ interface SciTableRowBindingFactory {
|
|
|
77
115
|
* ```
|
|
78
116
|
*/
|
|
79
117
|
addPartBinding(name: `row:${string}` | undefined): this;
|
|
118
|
+
/**
|
|
119
|
+
* Binds an HTML attribute to the row.
|
|
120
|
+
*
|
|
121
|
+
* Useful for end-to-end testing, such as associating a row with an item's primary key.
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* import {table} from '@scion/components/table';
|
|
125
|
+
*
|
|
126
|
+
* table({
|
|
127
|
+
* datasource: data,
|
|
128
|
+
* columns: table => ...,
|
|
129
|
+
* rowBindings: (bindings, item) => bindings.addAttributeBinding('data-id', item.id),
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
addAttributeBinding(name: string, value: unknown | undefined): this;
|
|
134
|
+
/**
|
|
135
|
+
* Binds a CSS class to the row.
|
|
136
|
+
*/
|
|
137
|
+
addClassBinding(name: string | undefined): this;
|
|
80
138
|
}
|
|
81
139
|
interface SciTableRowBindings {
|
|
82
|
-
|
|
140
|
+
icons: Signal<string[]>;
|
|
141
|
+
parts: Signal<`row:${string}`[]>;
|
|
83
142
|
attributes: Signal<{
|
|
84
143
|
[name: string]: unknown;
|
|
85
144
|
}>;
|
|
86
|
-
|
|
145
|
+
classes: Signal<string[]>;
|
|
87
146
|
}
|
|
88
147
|
|
|
89
148
|
interface SciTableColumnFactory<T> {
|
|
90
|
-
|
|
91
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Adds a column to the table for displaying text.
|
|
151
|
+
*
|
|
152
|
+
* The value can be plain text or a translation key. A translation key starts with the percent symbol (`%`)
|
|
153
|
+
* and may include parameters in matrix notation for text interpolation.
|
|
154
|
+
*
|
|
155
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
156
|
+
*
|
|
157
|
+
* The function:
|
|
158
|
+
* - Can call `inject` to get required dependencies.
|
|
159
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
160
|
+
*/
|
|
161
|
+
addStringColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<Translatable | undefined>): this;
|
|
162
|
+
/**
|
|
163
|
+
* Adds a column to the table for displaying text.
|
|
164
|
+
*
|
|
165
|
+
* The value can be plain text or a translation key. A translation key starts with the percent symbol (`%`)
|
|
166
|
+
* and may include parameters in matrix notation for text interpolation.
|
|
167
|
+
*
|
|
168
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
169
|
+
*
|
|
170
|
+
* The function:
|
|
171
|
+
* - Can call `inject` to get required dependencies.
|
|
172
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
173
|
+
*/
|
|
174
|
+
addStringColumn(value: (item: T) => MaybeSignal<Translatable | undefined>): this;
|
|
175
|
+
/**
|
|
176
|
+
* Adds a column to the table for displaying text.
|
|
177
|
+
*/
|
|
92
178
|
addStringColumn(descriptor: SciStringColumnDescriptor<T>): this;
|
|
93
179
|
/**
|
|
94
|
-
* Adds a
|
|
180
|
+
* Adds a column to the table for displaying numeric values.
|
|
95
181
|
*
|
|
96
182
|
* ### Tabular Figures
|
|
97
183
|
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
@@ -111,10 +197,14 @@ interface SciTableColumnFactory<T> {
|
|
|
111
197
|
* font-variant-numeric: normal;
|
|
112
198
|
* }
|
|
113
199
|
* ```
|
|
200
|
+
*
|
|
201
|
+
* The function:
|
|
202
|
+
* - Can call `inject` to get required dependencies.
|
|
203
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
114
204
|
*/
|
|
115
|
-
addNumberColumn(header:
|
|
205
|
+
addNumberColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
116
206
|
/**
|
|
117
|
-
* Adds a
|
|
207
|
+
* Adds a column to the table for displaying numeric values.
|
|
118
208
|
*
|
|
119
209
|
* ### Tabular Figures
|
|
120
210
|
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
@@ -134,10 +224,14 @@ interface SciTableColumnFactory<T> {
|
|
|
134
224
|
* font-variant-numeric: normal;
|
|
135
225
|
* }
|
|
136
226
|
* ```
|
|
227
|
+
*
|
|
228
|
+
* The function:
|
|
229
|
+
* - Can call `inject` to get required dependencies.
|
|
230
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
137
231
|
*/
|
|
138
232
|
addNumberColumn(value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
139
233
|
/**
|
|
140
|
-
* Adds a
|
|
234
|
+
* Adds a column to the table for displaying numeric values.
|
|
141
235
|
*
|
|
142
236
|
* ### Tabular Figures
|
|
143
237
|
* Numbers are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
@@ -159,11 +253,37 @@ interface SciTableColumnFactory<T> {
|
|
|
159
253
|
* ```
|
|
160
254
|
*/
|
|
161
255
|
addNumberColumn(descriptor: SciNumberColumnDescriptor<T>): this;
|
|
162
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Adds a column to the table for displaying boolean values.
|
|
258
|
+
*
|
|
259
|
+
* Cells display `true` as a checkmark and `false` as an 'X'. Filter options are labeled as 'Yes'/'No'.
|
|
260
|
+
* For custom display or filter options, use {@link addEnumColumn} instead.
|
|
261
|
+
*
|
|
262
|
+
* The function:
|
|
263
|
+
* - Can call `inject` to get required dependencies.
|
|
264
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
265
|
+
*/
|
|
266
|
+
addBooleanColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<boolean | undefined>): this;
|
|
267
|
+
/**
|
|
268
|
+
* Adds a column to the table for displaying boolean values.
|
|
269
|
+
*
|
|
270
|
+
* Cells display `true` as a checkmark and `false` as an 'X'. Filter options are labeled as 'Yes'/'No'.
|
|
271
|
+
* For custom display or filter options, use {@link addEnumColumn} instead.
|
|
272
|
+
*
|
|
273
|
+
* The function:
|
|
274
|
+
* - Can call `inject` to get required dependencies.
|
|
275
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
276
|
+
*/
|
|
163
277
|
addBooleanColumn(value: (item: T) => MaybeSignal<boolean | undefined>): this;
|
|
278
|
+
/**
|
|
279
|
+
* Adds a column to the table for displaying boolean values.
|
|
280
|
+
*
|
|
281
|
+
* Cells display `true` as a checkmark and `false` as an 'X'. Filter options are labeled as 'Yes'/'No'.
|
|
282
|
+
* For custom display or filter options, use {@link addEnumColumn} instead.
|
|
283
|
+
*/
|
|
164
284
|
addBooleanColumn(descriptor: SciBooleanColumnDescriptor<T>): this;
|
|
165
285
|
/**
|
|
166
|
-
* Adds a
|
|
286
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
167
287
|
*
|
|
168
288
|
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
169
289
|
*
|
|
@@ -187,10 +307,14 @@ interface SciTableColumnFactory<T> {
|
|
|
187
307
|
* font-variant-numeric: normal;
|
|
188
308
|
* }
|
|
189
309
|
* ```
|
|
310
|
+
*
|
|
311
|
+
* The function:
|
|
312
|
+
* - Can call `inject` to get required dependencies.
|
|
313
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
190
314
|
*/
|
|
191
|
-
addDateColumn(header:
|
|
315
|
+
addDateColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
192
316
|
/**
|
|
193
|
-
* Adds a
|
|
317
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
194
318
|
*
|
|
195
319
|
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
196
320
|
*
|
|
@@ -214,10 +338,14 @@ interface SciTableColumnFactory<T> {
|
|
|
214
338
|
* font-variant-numeric: normal;
|
|
215
339
|
* }
|
|
216
340
|
* ```
|
|
341
|
+
*
|
|
342
|
+
* The function:
|
|
343
|
+
* - Can call `inject` to get required dependencies.
|
|
344
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
217
345
|
*/
|
|
218
346
|
addDateColumn(value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
219
347
|
/**
|
|
220
|
-
* Adds a
|
|
348
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
221
349
|
*
|
|
222
350
|
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
223
351
|
*
|
|
@@ -243,12 +371,31 @@ interface SciTableColumnFactory<T> {
|
|
|
243
371
|
* ```
|
|
244
372
|
*/
|
|
245
373
|
addDateColumn(descriptor: SciDateColumnDescriptor<T>): this;
|
|
374
|
+
/**
|
|
375
|
+
* Adds a column to the table for displaying values of an enumeration.
|
|
376
|
+
*
|
|
377
|
+
* An enumeration defines a fixed set of values, each with a label and an optional icon and tooltip.
|
|
378
|
+
*/
|
|
379
|
+
addEnumColumn(descriptor: SciEnumColumnDescriptor<T>): this;
|
|
380
|
+
/**
|
|
381
|
+
* Adds a column to the table for displaying icons.
|
|
382
|
+
*
|
|
383
|
+
* An icon column is a standardized enum column for displaying icons. If configured with only a header icon and no label,
|
|
384
|
+
* it defaults to non-resizable and sizes to fit the icon.
|
|
385
|
+
*/
|
|
386
|
+
addIconColumn(descriptor: SciIconColumnDescriptor<T>): this;
|
|
387
|
+
/**
|
|
388
|
+
* Adds a column to the table for displaying custom content using a component.
|
|
389
|
+
*/
|
|
246
390
|
addComponentColumn(descriptor: SciComponentColumnDescriptor<T>): this;
|
|
391
|
+
/**
|
|
392
|
+
* Adds a column to the table for displaying custom content using a template.
|
|
393
|
+
*/
|
|
247
394
|
addTemplateColumn(descriptor: SciTemplateColumnDescriptor<T>): this;
|
|
248
395
|
}
|
|
249
396
|
interface SciTableColumnDescriptor {
|
|
250
397
|
name?: `column:${string}`;
|
|
251
|
-
header?:
|
|
398
|
+
header?: SciColumnHeaderLike;
|
|
252
399
|
resizable?: boolean;
|
|
253
400
|
/**
|
|
254
401
|
* Preferred column size.
|
|
@@ -261,8 +408,22 @@ interface SciTableColumnDescriptor {
|
|
|
261
408
|
*/
|
|
262
409
|
minWidth?: number;
|
|
263
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Configures a table column for displaying text.
|
|
413
|
+
*/
|
|
264
414
|
interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
265
|
-
|
|
415
|
+
/**
|
|
416
|
+
* Specifies the text to display for an item.
|
|
417
|
+
*
|
|
418
|
+
* Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
|
|
419
|
+
*
|
|
420
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
421
|
+
*
|
|
422
|
+
* The function:
|
|
423
|
+
* - Can call `inject` to get required dependencies.
|
|
424
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
425
|
+
*/
|
|
426
|
+
value: (item: T) => MaybeSignal<Translatable | undefined>;
|
|
266
427
|
sortable?: boolean | {
|
|
267
428
|
comparator: SciTableColumnSortComparatorFn<T, string>;
|
|
268
429
|
};
|
|
@@ -275,7 +436,11 @@ interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
275
436
|
*/
|
|
276
437
|
interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
277
438
|
/**
|
|
278
|
-
* Specifies the number to display
|
|
439
|
+
* Specifies the number to display for an item.
|
|
440
|
+
*
|
|
441
|
+
* The function:
|
|
442
|
+
* - Can call `inject` to get required dependencies.
|
|
443
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
279
444
|
*/
|
|
280
445
|
value: (item: T) => MaybeSignal<number | undefined>;
|
|
281
446
|
/**
|
|
@@ -366,9 +531,28 @@ interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
366
531
|
*/
|
|
367
532
|
locale?: MaybeSignal<string>;
|
|
368
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Configures a table column for displaying boolean values.
|
|
536
|
+
*/
|
|
369
537
|
interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
538
|
+
/**
|
|
539
|
+
* Specifies the boolean value to display for an item.
|
|
540
|
+
*
|
|
541
|
+
* Cells display `true` as a checkmark and `false` as an 'X'. Filter options are labeled as 'Yes'/'No'.
|
|
542
|
+
* For custom display or filter options, use {@link addEnumColumn} instead.
|
|
543
|
+
*
|
|
544
|
+
* The function:
|
|
545
|
+
* - Can call `inject` to get required dependencies.
|
|
546
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
547
|
+
*/
|
|
370
548
|
value: (item: T) => MaybeSignal<boolean | undefined>;
|
|
549
|
+
/**
|
|
550
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
551
|
+
*/
|
|
371
552
|
sortable?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
555
|
+
*/
|
|
372
556
|
filterable?: boolean;
|
|
373
557
|
}
|
|
374
558
|
/**
|
|
@@ -376,9 +560,13 @@ interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
376
560
|
*/
|
|
377
561
|
interface SciDateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
378
562
|
/**
|
|
379
|
-
* Specifies the date value to display
|
|
563
|
+
* Specifies the date value to display for an item.
|
|
380
564
|
*
|
|
381
565
|
* 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.
|
|
566
|
+
*
|
|
567
|
+
* The function:
|
|
568
|
+
* - Can call `inject` to get required dependencies.
|
|
569
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
382
570
|
*/
|
|
383
571
|
value: (item: T) => MaybeSignal<SciDateLike | undefined>;
|
|
384
572
|
/**
|
|
@@ -420,6 +608,94 @@ interface SciDateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
420
608
|
*/
|
|
421
609
|
timezone?: string;
|
|
422
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* Configures a table column for displaying values of an enumeration.
|
|
613
|
+
*
|
|
614
|
+
* An enumeration defines a fixed set of values, each with a label and an optional icon and tooltip.
|
|
615
|
+
*/
|
|
616
|
+
interface SciEnumColumnDescriptor<T = unknown> extends SciTableColumnDescriptor {
|
|
617
|
+
/**
|
|
618
|
+
* Specifies the enumeration value to display for an item. Must be a value of an entry defined in {@link values}.
|
|
619
|
+
*
|
|
620
|
+
* The function:
|
|
621
|
+
* - Can call `inject` to get required dependencies.
|
|
622
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
623
|
+
*/
|
|
624
|
+
value: (item: T) => MaybeSignal<SciEnumValueLike | undefined>;
|
|
625
|
+
/**
|
|
626
|
+
* Specifies the enumeration entries.
|
|
627
|
+
*
|
|
628
|
+
* The array order determines the sort order of the enumeration.
|
|
629
|
+
*/
|
|
630
|
+
values: MaybeSignal<SciEnumColumnValues>;
|
|
631
|
+
/**
|
|
632
|
+
* Configures the display of enumeration values.
|
|
633
|
+
*
|
|
634
|
+
* Defaults to displaying the label in cells, and both icon and label in the column filter menu. Defaults are unset when using a custom format.
|
|
635
|
+
*/
|
|
636
|
+
format?: {
|
|
637
|
+
/**
|
|
638
|
+
* Controls whether to display the icon in cells.
|
|
639
|
+
*/
|
|
640
|
+
icon?: true;
|
|
641
|
+
/**
|
|
642
|
+
* Controls whether to display the label in cells.
|
|
643
|
+
*/
|
|
644
|
+
label?: true;
|
|
645
|
+
/**
|
|
646
|
+
* Configures the display of entries in the column filter menu.
|
|
647
|
+
*/
|
|
648
|
+
filter?: {
|
|
649
|
+
/**
|
|
650
|
+
* Controls whether to display the icon in the column filter menu.
|
|
651
|
+
*/
|
|
652
|
+
icon?: true;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
657
|
+
*/
|
|
658
|
+
sortable?: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* Controls whether the user can filter this column. Defaults to `multi`.
|
|
661
|
+
*/
|
|
662
|
+
filterable?: 'single' | 'multi' | false;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Configures a table column for displaying icons.
|
|
666
|
+
*
|
|
667
|
+
* An icon column is a standardized enum column for displaying icons. If configured with only a header icon and no label,
|
|
668
|
+
* it defaults to non-resizable and sizes to fit the icon.
|
|
669
|
+
*/
|
|
670
|
+
interface SciIconColumnDescriptor<T = unknown> extends SciTableColumnDescriptor {
|
|
671
|
+
/**
|
|
672
|
+
* Specifies the icon to display for an item.
|
|
673
|
+
*
|
|
674
|
+
* SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
|
|
675
|
+
*
|
|
676
|
+
* Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
|
|
677
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
678
|
+
*
|
|
679
|
+
* The function:
|
|
680
|
+
* - Can call `inject` to get required dependencies.
|
|
681
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
682
|
+
*/
|
|
683
|
+
value: (item: T) => MaybeSignal<string | number | boolean | undefined>;
|
|
684
|
+
/**
|
|
685
|
+
* Specifies the icons displayed in this column.
|
|
686
|
+
*
|
|
687
|
+
* The array order determines the sort order.
|
|
688
|
+
*/
|
|
689
|
+
values: MaybeSignal<SciIconColumnValues>;
|
|
690
|
+
/**
|
|
691
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
692
|
+
*/
|
|
693
|
+
sortable?: boolean;
|
|
694
|
+
/**
|
|
695
|
+
* Controls whether the user can filter this column. Defaults to `multi`.
|
|
696
|
+
*/
|
|
697
|
+
filterable?: 'single' | 'multi' | false;
|
|
698
|
+
}
|
|
423
699
|
interface SciComponentColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
424
700
|
component: (item: T) => SciComponentDescriptor;
|
|
425
701
|
sortable?: boolean | {
|
|
@@ -477,8 +753,22 @@ interface SciDateValue {
|
|
|
477
753
|
formatted: string;
|
|
478
754
|
}
|
|
479
755
|
|
|
480
|
-
|
|
481
|
-
|
|
756
|
+
/**
|
|
757
|
+
* Represents the internal value of {@link SciEnumColumn}.
|
|
758
|
+
*/
|
|
759
|
+
interface SciEnumValue {
|
|
760
|
+
value: SciEnumValueLike;
|
|
761
|
+
/** localized text */
|
|
762
|
+
label: string;
|
|
763
|
+
/** localized tooltip */
|
|
764
|
+
tooltip?: string;
|
|
765
|
+
icon?: string;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Represents supported column types of {@link SciTableComponent}.
|
|
770
|
+
*/
|
|
771
|
+
type SciTableColumnType = 'string' | 'number' | 'boolean' | 'date' | 'icon' | 'enum' | 'component' | 'template';
|
|
482
772
|
interface SciTableDescriptor<T> {
|
|
483
773
|
datasource: Signal<T[]>;
|
|
484
774
|
/**
|
|
@@ -490,7 +780,7 @@ interface SciTableDescriptor<T> {
|
|
|
490
780
|
sortable?: boolean;
|
|
491
781
|
resizable?: boolean;
|
|
492
782
|
filterable?: boolean;
|
|
493
|
-
selectable?:
|
|
783
|
+
selectable?: 'single' | 'multi' | false;
|
|
494
784
|
showHeader?: boolean;
|
|
495
785
|
/**
|
|
496
786
|
* Defaults to false.
|
|
@@ -499,39 +789,62 @@ interface SciTableDescriptor<T> {
|
|
|
499
789
|
/**
|
|
500
790
|
* Configures actions to show when hovering over a row.
|
|
501
791
|
*
|
|
502
|
-
*
|
|
792
|
+
* @example
|
|
503
793
|
* ```ts
|
|
794
|
+
* import {table} from '@scion/components/table';
|
|
795
|
+
*
|
|
504
796
|
* table({
|
|
505
797
|
* datasource: data,
|
|
798
|
+
* columns: table => ...,
|
|
506
799
|
* rowActions: (toolbar, item) => toolbar.addToolbarButton({
|
|
507
800
|
* icon: 'delete',
|
|
508
801
|
* onSelect: () => ...,
|
|
509
802
|
* }),
|
|
510
|
-
* columns: table => ...,
|
|
511
803
|
* });
|
|
512
804
|
* ```
|
|
805
|
+
*
|
|
806
|
+
* The function:
|
|
807
|
+
* - Is called per item with a {@link SciToolbarFactory} to contribute actions.
|
|
808
|
+
* - Runs in a reactive context and re-evaluates when tracked signals change.
|
|
809
|
+
* - Can call `inject` to get required dependencies.
|
|
513
810
|
*/
|
|
514
811
|
rowActions?: SciTableRowActionFactoryFn<T>;
|
|
515
812
|
/**
|
|
516
|
-
*
|
|
813
|
+
* Configures row bindings for table rows.
|
|
517
814
|
*
|
|
518
|
-
*
|
|
815
|
+
* Row bindings enable associating metadata and icons with a row. Metadata includes CSS shadow parts, CSS classes, and HTML attributes.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
519
818
|
* ```ts
|
|
819
|
+
* import {table} from '@scion/components/table';
|
|
820
|
+
*
|
|
520
821
|
* table({
|
|
521
822
|
* datasource: data,
|
|
823
|
+
* columns: table => ...,
|
|
522
824
|
* rowBindings: (bindings, item, index) => bindings
|
|
825
|
+
* .addIconBinding('account_circle')
|
|
523
826
|
* .addPartBinding(index % 2 === 0 ? 'row:even' : 'row:odd')
|
|
524
827
|
* .addAttributeBinding('data-id', item.id)
|
|
525
828
|
* .addClassBinding(item.inactive ? 'inactive' : undefined),
|
|
526
|
-
* columns: table => ...,
|
|
527
829
|
* });
|
|
528
830
|
* ```
|
|
529
831
|
*
|
|
832
|
+
* Part attribute bindings make a row stylable by associating its cells with one or more HTML part attributes that can be referenced in CSS using the `::part()` CSS pseudo-element selector.
|
|
833
|
+
*
|
|
530
834
|
* ```scss
|
|
531
835
|
* sci-table::part(row\:even row\:not\:selected) {
|
|
532
836
|
* background-color: lightgray;
|
|
533
837
|
* }
|
|
534
838
|
* ```
|
|
839
|
+
*
|
|
840
|
+
* The function:
|
|
841
|
+
* - Is called per item with a {@link SciTableRowBindingFactory} to register bindings.
|
|
842
|
+
* - Runs in a reactive context and re-evaluates when tracked signals change.
|
|
843
|
+
* - Can call `inject` to get required dependencies.
|
|
844
|
+
*
|
|
845
|
+
* @param bindings - Factory providing methods to register row bindings.
|
|
846
|
+
* @param item - Item associated with the row.
|
|
847
|
+
* @param index - Index of the row, zero-based.
|
|
535
848
|
*/
|
|
536
849
|
rowBindings?: SciTableRowBindingFactoryFn<T>;
|
|
537
850
|
/**
|
|
@@ -568,7 +881,11 @@ interface SciTable<T> {
|
|
|
568
881
|
interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
569
882
|
type: SciTableColumnType;
|
|
570
883
|
name: `column:${string}`;
|
|
571
|
-
header:
|
|
884
|
+
header: {
|
|
885
|
+
icon: string | undefined;
|
|
886
|
+
label: Signal<string> | undefined;
|
|
887
|
+
tooltip: Signal<string> | undefined;
|
|
888
|
+
};
|
|
572
889
|
sortable: Signal<boolean>;
|
|
573
890
|
filterable: Signal<boolean>;
|
|
574
891
|
resizable: Signal<boolean>;
|
|
@@ -586,41 +903,39 @@ interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
|
586
903
|
interface SciStringColumn<T = unknown> extends SciTableColumn<T, string> {
|
|
587
904
|
type: 'string';
|
|
588
905
|
value: (item: T) => Signal<string | undefined>;
|
|
589
|
-
compare: SciTableColumnSortComparatorFn<T, string>;
|
|
590
|
-
matches: SciTableColumnFilterMatcherFn<T, string>;
|
|
591
906
|
}
|
|
592
907
|
interface SciNumberColumn<T = unknown> extends SciTableColumn<T, number> {
|
|
593
908
|
type: 'number';
|
|
594
909
|
value: (item: T) => Signal<number | undefined>;
|
|
595
|
-
compare: SciTableColumnSortComparatorFn<T, number>;
|
|
596
|
-
matches: SciTableColumnFilterMatcherFn<T, number>;
|
|
597
910
|
format: Signal<Intl.NumberFormat>;
|
|
598
911
|
}
|
|
599
|
-
interface SciBooleanColumn<T = unknown> extends SciTableColumn<T, boolean> {
|
|
600
|
-
type: 'boolean';
|
|
601
|
-
value: (item: T) => Signal<boolean | undefined>;
|
|
602
|
-
compare: SciTableColumnSortComparatorFn<T, boolean>;
|
|
603
|
-
matches: SciTableColumnFilterMatcherFn<T, boolean>;
|
|
604
|
-
}
|
|
605
912
|
interface SciDateColumn<T = unknown> extends SciTableColumn<T, SciDateValue, string> {
|
|
606
913
|
type: 'date';
|
|
607
914
|
value: (item: T) => Signal<SciDateValue | undefined>;
|
|
608
|
-
|
|
609
|
-
|
|
915
|
+
}
|
|
916
|
+
interface SciEnumColumn<T = unknown> extends Omit<SciTableColumn<T, SciEnumValue, SciEnumValueLike[] | string>, 'filterable'> {
|
|
917
|
+
type: 'enum';
|
|
918
|
+
value: (item: T) => Signal<SciEnumValue | undefined>;
|
|
919
|
+
filterable: Signal<'single' | 'multi' | false>;
|
|
920
|
+
enumeration: Signal<SciEnumColumnValues>;
|
|
921
|
+
format: {
|
|
922
|
+
icon: boolean;
|
|
923
|
+
label: boolean;
|
|
924
|
+
filter: {
|
|
925
|
+
icon: boolean;
|
|
926
|
+
};
|
|
927
|
+
};
|
|
928
|
+
referenceType: SciTableColumnType | undefined;
|
|
610
929
|
}
|
|
611
930
|
interface SciComponentColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
612
931
|
type: 'component';
|
|
613
932
|
component: (item: T) => SciComponentDescriptor;
|
|
614
|
-
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
615
|
-
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
616
933
|
}
|
|
617
934
|
interface SciTemplateColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
618
935
|
type: 'template';
|
|
619
936
|
template: (item: T) => SciTemplateDescriptor;
|
|
620
|
-
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
621
|
-
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
622
937
|
}
|
|
623
|
-
type SciTableColumnLike<T = unknown> = SciStringColumn<T> | SciNumberColumn<T> |
|
|
938
|
+
type SciTableColumnLike<T = unknown> = SciStringColumn<T> | SciNumberColumn<T> | SciDateColumn<T> | SciEnumColumn<T> | SciComponentColumn<T> | SciTemplateColumn<T>;
|
|
624
939
|
/**
|
|
625
940
|
* Mapped row, used as display state.
|
|
626
941
|
*/
|
|
@@ -645,16 +960,16 @@ interface SciNumberCell {
|
|
|
645
960
|
column: SciNumberColumn;
|
|
646
961
|
value: Signal<number | undefined>;
|
|
647
962
|
}
|
|
648
|
-
interface SciBooleanCell {
|
|
649
|
-
type: 'boolean';
|
|
650
|
-
column: SciBooleanColumn;
|
|
651
|
-
value: Signal<boolean | undefined>;
|
|
652
|
-
}
|
|
653
963
|
interface SciDateCell {
|
|
654
964
|
type: 'date';
|
|
655
965
|
column: SciDateColumn;
|
|
656
966
|
value: Signal<SciDateValue | undefined>;
|
|
657
967
|
}
|
|
968
|
+
interface SciEnumCell {
|
|
969
|
+
type: 'enum';
|
|
970
|
+
column: SciEnumColumn;
|
|
971
|
+
value: Signal<SciEnumValue | undefined>;
|
|
972
|
+
}
|
|
658
973
|
interface SciComponentCell {
|
|
659
974
|
type: 'component';
|
|
660
975
|
column: SciComponentColumn;
|
|
@@ -665,11 +980,21 @@ interface SciTemplateCell {
|
|
|
665
980
|
column: SciTemplateColumn;
|
|
666
981
|
template: SciTemplateDescriptor;
|
|
667
982
|
}
|
|
668
|
-
type SciTableCellLike = SciStringCell | SciNumberCell |
|
|
983
|
+
type SciTableCellLike = SciStringCell | SciNumberCell | SciDateCell | SciEnumCell | SciComponentCell | SciTemplateCell;
|
|
669
984
|
interface SciTableCellContext<T = unknown, VALUE = unknown> {
|
|
670
985
|
item: T;
|
|
671
986
|
value: VALUE;
|
|
672
987
|
}
|
|
988
|
+
/**
|
|
989
|
+
* Signature of a function to contribute row actions.
|
|
990
|
+
*
|
|
991
|
+
* Called per item with a {@link SciToolbarFactory} to contribute actions.
|
|
992
|
+
*
|
|
993
|
+
* The function:
|
|
994
|
+
* - Runs in a reactive context and re-evaluates when tracked signals change.
|
|
995
|
+
* - Can call `inject` to get required dependencies.
|
|
996
|
+
*/
|
|
997
|
+
type SciTableRowActionFactoryFn<T> = (toolbar: SciToolbarFactory, item: T, index: number) => void;
|
|
673
998
|
/**
|
|
674
999
|
* Represents an event emitted by {@link SciTableComponent}.
|
|
675
1000
|
*/
|
|
@@ -684,9 +1009,65 @@ interface SciTableEvent<T> {
|
|
|
684
1009
|
items: T[];
|
|
685
1010
|
}
|
|
686
1011
|
/**
|
|
687
|
-
* Represents
|
|
1012
|
+
* Represents the header of a table column, defined as a {@link Translatable} or an object with an optional icon, label, and tooltip.
|
|
1013
|
+
*
|
|
1014
|
+
* The label can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
|
|
1015
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
1016
|
+
*
|
|
1017
|
+
* SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
|
|
1018
|
+
*
|
|
1019
|
+
* Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
|
|
1020
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
1021
|
+
*/
|
|
1022
|
+
type SciColumnHeaderLike = Translatable | {
|
|
1023
|
+
icon?: string;
|
|
1024
|
+
label?: Translatable;
|
|
1025
|
+
tooltip?: Translatable;
|
|
1026
|
+
};
|
|
1027
|
+
/**
|
|
1028
|
+
* An ISO 8601 date/time string, milliseconds since the UTC epoch, or a {@link Date} object.
|
|
688
1029
|
*/
|
|
689
1030
|
type SciDateLike = string | number | Date;
|
|
1031
|
+
/**
|
|
1032
|
+
* Supported data types for enumeration values used in an enum column.
|
|
1033
|
+
*/
|
|
1034
|
+
type SciEnumValueLike = string | number | boolean;
|
|
1035
|
+
/**
|
|
1036
|
+
* Defines the enumeration entries of an enum column.
|
|
1037
|
+
*
|
|
1038
|
+
* The array order determines the sort order of the enumeration.
|
|
1039
|
+
*
|
|
1040
|
+
* A label can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
|
|
1041
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
1042
|
+
*
|
|
1043
|
+
* SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
|
|
1044
|
+
* Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
|
|
1045
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
1046
|
+
*/
|
|
1047
|
+
type SciEnumColumnValues = {
|
|
1048
|
+
value: SciEnumValueLike;
|
|
1049
|
+
label: Translatable;
|
|
1050
|
+
icon?: string;
|
|
1051
|
+
tooltip?: Translatable | null;
|
|
1052
|
+
}[];
|
|
1053
|
+
/**
|
|
1054
|
+
* Defines icons of an icon column.
|
|
1055
|
+
*
|
|
1056
|
+
* The array order determines the sort order.
|
|
1057
|
+
*
|
|
1058
|
+
* A label can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
|
|
1059
|
+
* SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
|
|
1060
|
+
*
|
|
1061
|
+
* SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
|
|
1062
|
+
* Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
|
|
1063
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
1064
|
+
*/
|
|
1065
|
+
type SciIconColumnValues = {
|
|
1066
|
+
value: string | number | boolean;
|
|
1067
|
+
label: Translatable;
|
|
1068
|
+
icon: string;
|
|
1069
|
+
tooltip?: Translatable | null;
|
|
1070
|
+
}[];
|
|
690
1071
|
|
|
691
1072
|
type SciTableColumnFactoryFn<T> = (table: SciTableColumnFactory<T>) => void;
|
|
692
1073
|
/** @experimental since 22.3.0; API and behavior may change in any version without notice. */
|
|
@@ -789,7 +1170,7 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
789
1170
|
* Applies a filter, either via global filter or on a specific column.
|
|
790
1171
|
*/
|
|
791
1172
|
filter(text: string | null): void;
|
|
792
|
-
filter(text: string | number | boolean | null, options: {
|
|
1173
|
+
filter(text: string | number | boolean | SciEnumValueLike | SciEnumValueLike[] | null, options: {
|
|
793
1174
|
columnName: `column:${string}`;
|
|
794
1175
|
}): void;
|
|
795
1176
|
updateSelectedItems(updateFn: (ids: Map<unknown, T>) => Map<unknown, T>): void;
|
|
@@ -914,4 +1295,4 @@ interface SciTableStorage {
|
|
|
914
1295
|
declare function provideTableStorage(storage: Type<SciTableStorage>): EnvironmentProviders;
|
|
915
1296
|
|
|
916
1297
|
export { SciTableComponent, provideTableRowBinding, provideTableStorage, table, ɵillegaldatasource };
|
|
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 };
|
|
1298
|
+
export type { SciBooleanColumnDescriptor, SciColumnHeaderLike, SciComponentColumnDescriptor, SciDateColumnDescriptor, SciDateLike, SciEnumColumnDescriptor, SciEnumColumnValues, SciEnumValueLike, SciIconColumnDescriptor, SciIconColumnValues, SciNumberColumnDescriptor, SciStringColumnDescriptor, SciTable, SciTableCellContext, SciTableColumnDescriptor, SciTableColumnFactory, SciTableColumnFactoryFn, SciTableColumnFilter, SciTableColumnFilterMatcherFn, SciTableColumnSortComparatorFn, SciTableColumnType, SciTableDataLoaderFn, SciTableDescriptor, SciTableEvent, SciTablePageRequest, SciTablePageResponse, SciTableRowActionFactoryFn, SciTableRowBindingFactory, SciTableRowBindingFactoryFn, SciTableSortCriterion, SciTableStorage, SciTemplateColumnDescriptor };
|