@scion/components 22.4.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 +179 -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 +61 -60
- 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 +2 -2
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-table.mjs +584 -182
- 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 +125 -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 +772 -69
- 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,61 +47,355 @@ 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
|
*
|
|
69
107
|
* ```scss
|
|
70
|
-
* sci-table::part(row\:even) {
|
|
108
|
+
* sci-table::part(row\:even row\:not\:selected) {
|
|
71
109
|
* background-color: lightgray;
|
|
72
110
|
* }
|
|
73
111
|
*
|
|
74
|
-
* sci-table::part(row\:active) {
|
|
112
|
+
* sci-table::part(row\:active row\:not\:selected) {
|
|
75
113
|
* background-color: green;
|
|
76
114
|
* }
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Adds a column to the table for displaying numeric values.
|
|
181
|
+
*
|
|
182
|
+
* ### Tabular Figures
|
|
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.
|
|
184
|
+
*
|
|
185
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
186
|
+
*
|
|
187
|
+
* To disable tabular figures using CSS:
|
|
188
|
+
*
|
|
189
|
+
* ```scss
|
|
190
|
+
* // Disable tabular figures for all number columns.
|
|
191
|
+
* sci-table::part(column\:number) {
|
|
192
|
+
* font-variant-numeric: normal;
|
|
193
|
+
* }
|
|
194
|
+
*
|
|
195
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
196
|
+
* sci-table::part(column\:column-name) {
|
|
197
|
+
* font-variant-numeric: normal;
|
|
198
|
+
* }
|
|
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}.
|
|
204
|
+
*/
|
|
205
|
+
addNumberColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
206
|
+
/**
|
|
207
|
+
* Adds a column to the table for displaying numeric values.
|
|
208
|
+
*
|
|
209
|
+
* ### Tabular Figures
|
|
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.
|
|
211
|
+
*
|
|
212
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
213
|
+
*
|
|
214
|
+
* To disable tabular figures using CSS:
|
|
215
|
+
*
|
|
216
|
+
* ```scss
|
|
217
|
+
* // Disable tabular figures for all number columns.
|
|
218
|
+
* sci-table::part(column\:number) {
|
|
219
|
+
* font-variant-numeric: normal;
|
|
220
|
+
* }
|
|
221
|
+
*
|
|
222
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
223
|
+
* sci-table::part(column\:column-name) {
|
|
224
|
+
* font-variant-numeric: normal;
|
|
225
|
+
* }
|
|
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}.
|
|
231
|
+
*/
|
|
232
|
+
addNumberColumn(value: (item: T) => MaybeSignal<number | undefined>): this;
|
|
233
|
+
/**
|
|
234
|
+
* Adds a column to the table for displaying numeric values.
|
|
235
|
+
*
|
|
236
|
+
* ### Tabular Figures
|
|
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.
|
|
238
|
+
*
|
|
239
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
240
|
+
*
|
|
241
|
+
* To disable tabular figures using CSS:
|
|
242
|
+
*
|
|
243
|
+
* ```scss
|
|
244
|
+
* // Disable tabular figures for all number columns.
|
|
245
|
+
* sci-table::part(column\:number) {
|
|
246
|
+
* font-variant-numeric: normal;
|
|
247
|
+
* }
|
|
248
|
+
*
|
|
249
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
250
|
+
* sci-table::part(column\:column-name) {
|
|
251
|
+
* font-variant-numeric: normal;
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
98
255
|
addNumberColumn(descriptor: SciNumberColumnDescriptor<T>): this;
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
284
|
+
addBooleanColumn(descriptor: SciBooleanColumnDescriptor<T>): this;
|
|
285
|
+
/**
|
|
286
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
287
|
+
*
|
|
288
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
289
|
+
*
|
|
290
|
+
* Dates are formatted using `mediumDate`, or as specified in {@link DATE_PIPE_DEFAULT_OPTIONS}.
|
|
291
|
+
*
|
|
292
|
+
* ### Tabular Figures
|
|
293
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
294
|
+
*
|
|
295
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
296
|
+
*
|
|
297
|
+
* To disable tabular figures using CSS:
|
|
298
|
+
*
|
|
299
|
+
* ```scss
|
|
300
|
+
* // Disable tabular figures for all date columns.
|
|
301
|
+
* sci-table::part(column\:date) {
|
|
302
|
+
* font-variant-numeric: normal;
|
|
303
|
+
* }
|
|
304
|
+
*
|
|
305
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
306
|
+
* sci-table::part(column\:column-name) {
|
|
307
|
+
* font-variant-numeric: normal;
|
|
308
|
+
* }
|
|
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}.
|
|
314
|
+
*/
|
|
315
|
+
addDateColumn(header: SciColumnHeaderLike, value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
316
|
+
/**
|
|
317
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
318
|
+
*
|
|
319
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
320
|
+
*
|
|
321
|
+
* Dates are formatted using `mediumDate`, or as specified in {@link DATE_PIPE_DEFAULT_OPTIONS}.
|
|
322
|
+
*
|
|
323
|
+
* ### Tabular Figures
|
|
324
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
325
|
+
*
|
|
326
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
327
|
+
*
|
|
328
|
+
* To disable tabular figures using CSS:
|
|
329
|
+
*
|
|
330
|
+
* ```scss
|
|
331
|
+
* // Disable tabular figures for all date columns.
|
|
332
|
+
* sci-table::part(column\:date) {
|
|
333
|
+
* font-variant-numeric: normal;
|
|
334
|
+
* }
|
|
335
|
+
*
|
|
336
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
337
|
+
* sci-table::part(column\:column-name) {
|
|
338
|
+
* font-variant-numeric: normal;
|
|
339
|
+
* }
|
|
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}.
|
|
345
|
+
*/
|
|
346
|
+
addDateColumn(value: (item: T) => MaybeSignal<SciDateLike | undefined>): this;
|
|
347
|
+
/**
|
|
348
|
+
* Adds a column to the table for displaying dates, times, or both.
|
|
349
|
+
*
|
|
350
|
+
* Supports ISO 8601 date/time strings, milliseconds since the UTC epoch, and `Date` objects.
|
|
351
|
+
*
|
|
352
|
+
* Dates are formatted as specified in {@link SciDateColumnDescriptor.format}, {@link SciDateColumnDescriptor.locale}, and {@link SciDateColumnDescriptor.timezone}.
|
|
353
|
+
*
|
|
354
|
+
* ### Tabular Figures
|
|
355
|
+
* Dates are rendered using tabular (fixed-width) figures to align digits vertically in fonts with varying character widths. Has no effect on monospaced fonts.
|
|
356
|
+
*
|
|
357
|
+
* Tabular figures include digits (0-9), basic math symbols, and punctuations/spaces.
|
|
358
|
+
*
|
|
359
|
+
* To disable tabular figures using CSS:
|
|
360
|
+
*
|
|
361
|
+
* ```scss
|
|
362
|
+
* // Disable tabular figures for all date columns.
|
|
363
|
+
* sci-table::part(column\:date) {
|
|
364
|
+
* font-variant-numeric: normal;
|
|
365
|
+
* }
|
|
366
|
+
*
|
|
367
|
+
* // Disable tabular figures for a specific column (replace `column-name` with the column's name).
|
|
368
|
+
* sci-table::part(column\:column-name) {
|
|
369
|
+
* font-variant-numeric: normal;
|
|
370
|
+
* }
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
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
|
+
*/
|
|
99
390
|
addComponentColumn(descriptor: SciComponentColumnDescriptor<T>): this;
|
|
391
|
+
/**
|
|
392
|
+
* Adds a column to the table for displaying custom content using a template.
|
|
393
|
+
*/
|
|
100
394
|
addTemplateColumn(descriptor: SciTemplateColumnDescriptor<T>): this;
|
|
101
395
|
}
|
|
102
396
|
interface SciTableColumnDescriptor {
|
|
103
397
|
name?: `column:${string}`;
|
|
104
|
-
header?:
|
|
398
|
+
header?: SciColumnHeaderLike;
|
|
105
399
|
resizable?: boolean;
|
|
106
400
|
/**
|
|
107
401
|
* Preferred column size.
|
|
@@ -114,8 +408,22 @@ interface SciTableColumnDescriptor {
|
|
|
114
408
|
*/
|
|
115
409
|
minWidth?: number;
|
|
116
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Configures a table column for displaying text.
|
|
413
|
+
*/
|
|
117
414
|
interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
118
|
-
|
|
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>;
|
|
119
427
|
sortable?: boolean | {
|
|
120
428
|
comparator: SciTableColumnSortComparatorFn<T, string>;
|
|
121
429
|
};
|
|
@@ -123,15 +431,270 @@ interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
123
431
|
matcher: SciTableColumnFilterMatcherFn<T, string>;
|
|
124
432
|
};
|
|
125
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Configures a table column for displaying numeric values.
|
|
436
|
+
*/
|
|
126
437
|
interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
127
|
-
|
|
438
|
+
/**
|
|
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}.
|
|
444
|
+
*/
|
|
445
|
+
value: (item: T) => MaybeSignal<number | undefined>;
|
|
446
|
+
/**
|
|
447
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
448
|
+
*/
|
|
128
449
|
sortable?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
452
|
+
*/
|
|
129
453
|
filterable?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Specifies how to format numbers. Defaults to standard number formatting based on the active {@link locale}.
|
|
456
|
+
*
|
|
457
|
+
* ##### Grouping Separators
|
|
458
|
+
* Disable grouping separators (such as thousands separators) by setting {@link Intl.NumberFormatOptions.useGrouping} to `false`.
|
|
459
|
+
*
|
|
460
|
+
* ```ts
|
|
461
|
+
* import {table} from '@scion/components/table';
|
|
462
|
+
*
|
|
463
|
+
* table(data, table => table.addNumberColumn({
|
|
464
|
+
* value: item => item.numericValue,
|
|
465
|
+
* format: {useGrouping: false},
|
|
466
|
+
* }));
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* ##### Fraction Digits
|
|
470
|
+
* Control the number of decimal places using the {@link Intl.NumberFormatOptions.minimumFractionDigits} and {@link Intl.NumberFormatOptions.maximumFractionDigits} properties.
|
|
471
|
+
*
|
|
472
|
+
* ```ts
|
|
473
|
+
* import {table} from '@scion/components/table';
|
|
474
|
+
*
|
|
475
|
+
* table(data, table => table.addNumberColumn({
|
|
476
|
+
* value: item => item.numericValue,
|
|
477
|
+
* format: {
|
|
478
|
+
* minimumFractionDigits: 2,
|
|
479
|
+
* maximumFractionDigits: 2,
|
|
480
|
+
* },
|
|
481
|
+
* }));
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* ##### Currency
|
|
485
|
+
* To render numbers as currency, set {@link Intl.NumberFormatOptions.style} to `currency` and specify the currency code.
|
|
486
|
+
*
|
|
487
|
+
* The currency code defaults to {@link DEFAULT_CURRENCY_CODE}, or `USD` if not provided.
|
|
488
|
+
* 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`).
|
|
489
|
+
*
|
|
490
|
+
* ```ts
|
|
491
|
+
* import {table} from '@scion/components/table';
|
|
492
|
+
*
|
|
493
|
+
* table(data, table => table.addNumberColumn({
|
|
494
|
+
* value: item => item.numericValue,
|
|
495
|
+
* format: {
|
|
496
|
+
* style: 'currency',
|
|
497
|
+
* currency: 'EUR',
|
|
498
|
+
* },
|
|
499
|
+
* }));
|
|
500
|
+
* ```
|
|
501
|
+
*
|
|
502
|
+
* ##### Unit
|
|
503
|
+
* To render numbers with a specific unit (e.g., `kilogram`, `kilometer`, `kilometer-per-hour`, or `hour`), set {@link Intl.NumberFormatOptions.style} to `unit`
|
|
504
|
+
* 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).
|
|
505
|
+
*
|
|
506
|
+
* ```ts
|
|
507
|
+
* import {table} from '@scion/components/table';
|
|
508
|
+
*
|
|
509
|
+
* table(data, table => table.addNumberColumn({
|
|
510
|
+
* value: item => item.numericValue,
|
|
511
|
+
* format: {
|
|
512
|
+
* style: 'unit',
|
|
513
|
+
* unit: 'kilometer-per-hour',
|
|
514
|
+
* },
|
|
515
|
+
* }));
|
|
516
|
+
* ```
|
|
517
|
+
*
|
|
518
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
519
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#supported_unit_identifiers
|
|
520
|
+
* @see https://en.wikipedia.org/wiki/ISO_4217
|
|
521
|
+
*/
|
|
522
|
+
format?: Intl.NumberFormatOptions;
|
|
523
|
+
/**
|
|
524
|
+
* Specifies the locale used to localize numbers.
|
|
525
|
+
*
|
|
526
|
+
* The locale determines group sizing and separators, decimal point characters, and other locale-specific formatting rules.
|
|
527
|
+
*
|
|
528
|
+
* Defaults to {@link SCI_LOCALE}, which initializes from {@link LOCALE_ID} (defaulting to `en-US`).
|
|
529
|
+
*
|
|
530
|
+
* See {@link SCI_LOCALE} for details on how to change the locale at runtime.
|
|
531
|
+
*/
|
|
532
|
+
locale?: MaybeSignal<string>;
|
|
130
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Configures a table column for displaying boolean values.
|
|
536
|
+
*/
|
|
131
537
|
interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
132
|
-
|
|
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
|
+
*/
|
|
548
|
+
value: (item: T) => MaybeSignal<boolean | undefined>;
|
|
549
|
+
/**
|
|
550
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
551
|
+
*/
|
|
552
|
+
sortable?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
555
|
+
*/
|
|
556
|
+
filterable?: boolean;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Configures a table column for displaying dates.
|
|
560
|
+
*/
|
|
561
|
+
interface SciDateColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
562
|
+
/**
|
|
563
|
+
* Specifies the date value to display for an item.
|
|
564
|
+
*
|
|
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}.
|
|
570
|
+
*/
|
|
571
|
+
value: (item: T) => MaybeSignal<SciDateLike | undefined>;
|
|
572
|
+
/**
|
|
573
|
+
* Controls whether the user can sort this column. Defaults to `true`.
|
|
574
|
+
*/
|
|
133
575
|
sortable?: boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
578
|
+
*/
|
|
134
579
|
filterable?: boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Specifies how to format dates. Defaults to the format configured in {@link DATE_PIPE_DEFAULT_OPTIONS}, or `mediumDate` if not provided.
|
|
582
|
+
*
|
|
583
|
+
* Accepts a predefined Angular date format (e.g., `mediumDate`, `mediumTime`) or a custom format (e.g., `dd.MM.yyyy`, `HH:mm`).
|
|
584
|
+
* Formatting may vary depending on the active {@link locale}.
|
|
585
|
+
*
|
|
586
|
+
* Use a time-only format to display only the time component.
|
|
587
|
+
*
|
|
588
|
+
* @see https://angular.dev/api/common/DatePipe#pre-defined-format-options
|
|
589
|
+
* @see https://angular.dev/api/common/DatePipe#custom-format-options
|
|
590
|
+
*/
|
|
591
|
+
format?: 'shortDate' | 'mediumDate' | 'longDate' | 'fullDate' | 'shortTime' | 'mediumTime' | 'longTime' | 'fullTime' | 'short' | 'medium' | 'long' | 'full' | string;
|
|
592
|
+
/**
|
|
593
|
+
* Specifies the locale used to localize dates.
|
|
594
|
+
*
|
|
595
|
+
* The locale determines date/time patterns, month and weekday names, AM/PM indicators, and related formatting symbols.
|
|
596
|
+
*
|
|
597
|
+
* Defaults to {@link SCI_LOCALE}, which initializes from {@link LOCALE_ID} (defaulting to `en-US`).
|
|
598
|
+
*
|
|
599
|
+
* See {@link SCI_LOCALE} for details on how to change the locale at runtime.
|
|
600
|
+
*/
|
|
601
|
+
locale?: MaybeSignal<string>;
|
|
602
|
+
/**
|
|
603
|
+
* Specifies the timezone in which to render dates.
|
|
604
|
+
*
|
|
605
|
+
* Must be a UTC/GMT offset (e.g., `+0430` or `-0500`).
|
|
606
|
+
*
|
|
607
|
+
* Defaults to the timezone configured in {@link DATE_PIPE_DEFAULT_OPTIONS}, or the user's system timezone if not provided.
|
|
608
|
+
*/
|
|
609
|
+
timezone?: string;
|
|
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;
|
|
135
698
|
}
|
|
136
699
|
interface SciComponentColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
137
700
|
component: (item: T) => SciComponentDescriptor;
|
|
@@ -172,8 +735,40 @@ type SciTableColumnSortComparatorFn<T = unknown, VALUE = unknown> = (a: SciTable
|
|
|
172
735
|
*/
|
|
173
736
|
type SciTableColumnFilterMatcherFn<T = unknown, VALUE = unknown, FILTER = VALUE> = (filter: FILTER, context: SciTableCellContext<T, VALUE>) => boolean;
|
|
174
737
|
|
|
175
|
-
|
|
176
|
-
|
|
738
|
+
/**
|
|
739
|
+
* Represents the internal value of {@link SciDateColumn}.
|
|
740
|
+
*/
|
|
741
|
+
interface SciDateValue {
|
|
742
|
+
/**
|
|
743
|
+
* Full ISO 8601 date/time string.
|
|
744
|
+
*/
|
|
745
|
+
isoString: string;
|
|
746
|
+
/**
|
|
747
|
+
* Milliseconds since UTC epoch.
|
|
748
|
+
*/
|
|
749
|
+
millis: number;
|
|
750
|
+
/**
|
|
751
|
+
* Human-readable formatted date and time string.
|
|
752
|
+
*/
|
|
753
|
+
formatted: string;
|
|
754
|
+
}
|
|
755
|
+
|
|
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';
|
|
177
772
|
interface SciTableDescriptor<T> {
|
|
178
773
|
datasource: Signal<T[]>;
|
|
179
774
|
/**
|
|
@@ -185,7 +780,7 @@ interface SciTableDescriptor<T> {
|
|
|
185
780
|
sortable?: boolean;
|
|
186
781
|
resizable?: boolean;
|
|
187
782
|
filterable?: boolean;
|
|
188
|
-
selectable?:
|
|
783
|
+
selectable?: 'single' | 'multi' | false;
|
|
189
784
|
showHeader?: boolean;
|
|
190
785
|
/**
|
|
191
786
|
* Defaults to false.
|
|
@@ -194,39 +789,62 @@ interface SciTableDescriptor<T> {
|
|
|
194
789
|
/**
|
|
195
790
|
* Configures actions to show when hovering over a row.
|
|
196
791
|
*
|
|
197
|
-
*
|
|
792
|
+
* @example
|
|
198
793
|
* ```ts
|
|
794
|
+
* import {table} from '@scion/components/table';
|
|
795
|
+
*
|
|
199
796
|
* table({
|
|
200
797
|
* datasource: data,
|
|
798
|
+
* columns: table => ...,
|
|
201
799
|
* rowActions: (toolbar, item) => toolbar.addToolbarButton({
|
|
202
800
|
* icon: 'delete',
|
|
203
801
|
* onSelect: () => ...,
|
|
204
802
|
* }),
|
|
205
|
-
* columns: table => ...,
|
|
206
803
|
* });
|
|
207
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.
|
|
208
810
|
*/
|
|
209
811
|
rowActions?: SciTableRowActionFactoryFn<T>;
|
|
210
812
|
/**
|
|
211
|
-
*
|
|
813
|
+
* Configures row bindings for table rows.
|
|
212
814
|
*
|
|
213
|
-
*
|
|
815
|
+
* Row bindings enable associating metadata and icons with a row. Metadata includes CSS shadow parts, CSS classes, and HTML attributes.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
214
818
|
* ```ts
|
|
819
|
+
* import {table} from '@scion/components/table';
|
|
820
|
+
*
|
|
215
821
|
* table({
|
|
216
822
|
* datasource: data,
|
|
823
|
+
* columns: table => ...,
|
|
217
824
|
* rowBindings: (bindings, item, index) => bindings
|
|
825
|
+
* .addIconBinding('account_circle')
|
|
218
826
|
* .addPartBinding(index % 2 === 0 ? 'row:even' : 'row:odd')
|
|
219
827
|
* .addAttributeBinding('data-id', item.id)
|
|
220
828
|
* .addClassBinding(item.inactive ? 'inactive' : undefined),
|
|
221
|
-
* columns: table => ...,
|
|
222
829
|
* });
|
|
223
830
|
* ```
|
|
224
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
|
+
*
|
|
225
834
|
* ```scss
|
|
226
|
-
* sci-table::part(row\:even) {
|
|
835
|
+
* sci-table::part(row\:even row\:not\:selected) {
|
|
227
836
|
* background-color: lightgray;
|
|
228
837
|
* }
|
|
229
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.
|
|
230
848
|
*/
|
|
231
849
|
rowBindings?: SciTableRowBindingFactoryFn<T>;
|
|
232
850
|
/**
|
|
@@ -260,14 +878,14 @@ interface SciTable<T> {
|
|
|
260
878
|
*/
|
|
261
879
|
filter(text: string | null): void;
|
|
262
880
|
}
|
|
263
|
-
interface SciTableCellContext<T = unknown, VALUE = unknown> {
|
|
264
|
-
item: T;
|
|
265
|
-
value: VALUE;
|
|
266
|
-
}
|
|
267
881
|
interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
268
882
|
type: SciTableColumnType;
|
|
269
883
|
name: `column:${string}`;
|
|
270
|
-
header:
|
|
884
|
+
header: {
|
|
885
|
+
icon: string | undefined;
|
|
886
|
+
label: Signal<string> | undefined;
|
|
887
|
+
tooltip: Signal<string> | undefined;
|
|
888
|
+
};
|
|
271
889
|
sortable: Signal<boolean>;
|
|
272
890
|
filterable: Signal<boolean>;
|
|
273
891
|
resizable: Signal<boolean>;
|
|
@@ -282,37 +900,42 @@ interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
|
282
900
|
compare: SciTableColumnSortComparatorFn<T, VALUE>;
|
|
283
901
|
matches: SciTableColumnFilterMatcherFn<T, VALUE, FILTER>;
|
|
284
902
|
}
|
|
285
|
-
interface SciStringColumn<T> extends SciTableColumn<T, string> {
|
|
903
|
+
interface SciStringColumn<T = unknown> extends SciTableColumn<T, string> {
|
|
286
904
|
type: 'string';
|
|
287
|
-
value: (item: T) =>
|
|
288
|
-
compare: SciTableColumnSortComparatorFn<T, string>;
|
|
289
|
-
matches: SciTableColumnFilterMatcherFn<T, string>;
|
|
905
|
+
value: (item: T) => Signal<string | undefined>;
|
|
290
906
|
}
|
|
291
|
-
interface SciNumberColumn<T> extends SciTableColumn<T, number> {
|
|
907
|
+
interface SciNumberColumn<T = unknown> extends SciTableColumn<T, number> {
|
|
292
908
|
type: 'number';
|
|
293
|
-
value: (item: T) =>
|
|
294
|
-
|
|
295
|
-
matches: SciTableColumnFilterMatcherFn<T, number>;
|
|
909
|
+
value: (item: T) => Signal<number | undefined>;
|
|
910
|
+
format: Signal<Intl.NumberFormat>;
|
|
296
911
|
}
|
|
297
|
-
interface
|
|
298
|
-
type: '
|
|
299
|
-
value: (item: T) =>
|
|
300
|
-
compare: SciTableColumnSortComparatorFn<T, boolean>;
|
|
301
|
-
matches: SciTableColumnFilterMatcherFn<T, boolean>;
|
|
912
|
+
interface SciDateColumn<T = unknown> extends SciTableColumn<T, SciDateValue, string> {
|
|
913
|
+
type: 'date';
|
|
914
|
+
value: (item: T) => Signal<SciDateValue | undefined>;
|
|
302
915
|
}
|
|
303
|
-
interface
|
|
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;
|
|
929
|
+
}
|
|
930
|
+
interface SciComponentColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
304
931
|
type: 'component';
|
|
305
932
|
component: (item: T) => SciComponentDescriptor;
|
|
306
|
-
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
307
|
-
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
308
933
|
}
|
|
309
|
-
interface SciTemplateColumn<T> extends SciTableColumn<T, void, string> {
|
|
934
|
+
interface SciTemplateColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
310
935
|
type: 'template';
|
|
311
936
|
template: (item: T) => SciTemplateDescriptor;
|
|
312
|
-
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
313
|
-
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
314
937
|
}
|
|
315
|
-
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>;
|
|
316
939
|
/**
|
|
317
940
|
* Mapped row, used as display state.
|
|
318
941
|
*/
|
|
@@ -329,30 +952,49 @@ interface SciTableRow<T> {
|
|
|
329
952
|
}
|
|
330
953
|
interface SciStringCell {
|
|
331
954
|
type: 'string';
|
|
332
|
-
column:
|
|
333
|
-
value: Signal<string>;
|
|
955
|
+
column: SciStringColumn;
|
|
956
|
+
value: Signal<string | undefined>;
|
|
334
957
|
}
|
|
335
958
|
interface SciNumberCell {
|
|
336
959
|
type: 'number';
|
|
337
|
-
column:
|
|
338
|
-
value: Signal<number>;
|
|
960
|
+
column: SciNumberColumn;
|
|
961
|
+
value: Signal<number | undefined>;
|
|
962
|
+
}
|
|
963
|
+
interface SciDateCell {
|
|
964
|
+
type: 'date';
|
|
965
|
+
column: SciDateColumn;
|
|
966
|
+
value: Signal<SciDateValue | undefined>;
|
|
339
967
|
}
|
|
340
|
-
interface
|
|
341
|
-
type: '
|
|
342
|
-
column:
|
|
343
|
-
value: Signal<
|
|
968
|
+
interface SciEnumCell {
|
|
969
|
+
type: 'enum';
|
|
970
|
+
column: SciEnumColumn;
|
|
971
|
+
value: Signal<SciEnumValue | undefined>;
|
|
344
972
|
}
|
|
345
973
|
interface SciComponentCell {
|
|
346
974
|
type: 'component';
|
|
347
|
-
column:
|
|
975
|
+
column: SciComponentColumn;
|
|
348
976
|
component: SciComponentDescriptor;
|
|
349
977
|
}
|
|
350
978
|
interface SciTemplateCell {
|
|
351
979
|
type: 'template';
|
|
352
|
-
column:
|
|
980
|
+
column: SciTemplateColumn;
|
|
353
981
|
template: SciTemplateDescriptor;
|
|
354
982
|
}
|
|
355
|
-
type SciTableCellLike = SciStringCell | SciNumberCell |
|
|
983
|
+
type SciTableCellLike = SciStringCell | SciNumberCell | SciDateCell | SciEnumCell | SciComponentCell | SciTemplateCell;
|
|
984
|
+
interface SciTableCellContext<T = unknown, VALUE = unknown> {
|
|
985
|
+
item: T;
|
|
986
|
+
value: VALUE;
|
|
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;
|
|
356
998
|
/**
|
|
357
999
|
* Represents an event emitted by {@link SciTableComponent}.
|
|
358
1000
|
*/
|
|
@@ -366,6 +1008,66 @@ interface SciTableEvent<T> {
|
|
|
366
1008
|
*/
|
|
367
1009
|
items: T[];
|
|
368
1010
|
}
|
|
1011
|
+
/**
|
|
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.
|
|
1029
|
+
*/
|
|
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
|
+
}[];
|
|
369
1071
|
|
|
370
1072
|
type SciTableColumnFactoryFn<T> = (table: SciTableColumnFactory<T>) => void;
|
|
371
1073
|
/** @experimental since 22.3.0; API and behavior may change in any version without notice. */
|
|
@@ -406,6 +1108,7 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
406
1108
|
readonly sortCriteria: WritableSignal<SciTableSortCriterion[]>;
|
|
407
1109
|
readonly filterCriteria: WritableSignal<SciTableColumnFilter[]>;
|
|
408
1110
|
private readonly _cache;
|
|
1111
|
+
private readonly _tableCellValuePreloader;
|
|
409
1112
|
private readonly _tableFilter;
|
|
410
1113
|
private readonly _selectedItems;
|
|
411
1114
|
readonly totalCount: WritableSignal<number | undefined>;
|
|
@@ -467,7 +1170,7 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
467
1170
|
* Applies a filter, either via global filter or on a specific column.
|
|
468
1171
|
*/
|
|
469
1172
|
filter(text: string | null): void;
|
|
470
|
-
filter(text: string | number | boolean | null, options: {
|
|
1173
|
+
filter(text: string | number | boolean | SciEnumValueLike | SciEnumValueLike[] | null, options: {
|
|
471
1174
|
columnName: `column:${string}`;
|
|
472
1175
|
}): void;
|
|
473
1176
|
updateSelectedItems(updateFn: (ids: Map<unknown, T>) => Map<unknown, T>): void;
|
|
@@ -592,4 +1295,4 @@ interface SciTableStorage {
|
|
|
592
1295
|
declare function provideTableStorage(storage: Type<SciTableStorage>): EnvironmentProviders;
|
|
593
1296
|
|
|
594
1297
|
export { SciTableComponent, provideTableRowBinding, provideTableStorage, table, ɵillegaldatasource };
|
|
595
|
-
export type { SciBooleanColumnDescriptor, SciComponentColumnDescriptor, 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 };
|