@scion/components 22.4.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/fesm2022/scion-components-common.mjs +48 -2
- package/fesm2022/scion-components-common.mjs.map +1 -1
- package/fesm2022/scion-components-menu.mjs +3 -9
- 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 +260 -51
- package/fesm2022/scion-components-table.mjs.map +1 -1
- package/package.json +2 -2
- package/types/scion-components-common.d.ts +36 -2
- package/types/scion-components-table.d.ts +359 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scion/components",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.0",
|
|
4
4
|
"description": "Provides a collection of Angular components and directives primarily for use in SCION libraries such as `@scion/workbench` and `@scion/microfrontend-platform`. This library is not a comprehensive component library as its focus is on SCION requirements.",
|
|
5
5
|
"license": "EPL-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@angular/common": "^22.0.0",
|
|
79
79
|
"@angular/animations": "^22.0.0",
|
|
80
80
|
"@angular/cdk": "^22.0.0",
|
|
81
|
-
"@scion/toolkit": "^2.
|
|
81
|
+
"@scion/toolkit": "^2.3.0",
|
|
82
82
|
"rxjs": "^7.8.0"
|
|
83
83
|
},
|
|
84
84
|
"repository": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Signal, Injector, Provider, DestroyableInjector, Binding, Type, TemplateRef } from '@angular/core';
|
|
2
|
+
import { Signal, Injector, Provider, DestroyableInjector, Binding, Type, TemplateRef, InjectionToken, WritableSignal } from '@angular/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { ComponentType } from '@angular/cdk/portal';
|
|
5
5
|
|
|
@@ -181,5 +181,39 @@ interface SciTemplateDescriptor {
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
/**
|
|
185
|
+
* DI token providing the current locale to SCION components for localizing dates and numbers.
|
|
186
|
+
*
|
|
187
|
+
* Defaults to {@link LOCALE_ID}. Changing the locale updates formatting in SCION components, unless overridden at the component level.
|
|
188
|
+
*
|
|
189
|
+
* Change the locale at runtime as follows:
|
|
190
|
+
* ```ts
|
|
191
|
+
* inject(SCI_LOCALE).set('de-CH');
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* Angular includes only `en-US` by default. Register other locales via `registerLocaleData()`, typically in an environment initializer at app startup:
|
|
195
|
+
*
|
|
196
|
+
* ```ts
|
|
197
|
+
* import {bootstrapApplication} from '@angular/platform-browser';
|
|
198
|
+
* import {provideEnvironmentInitializer} from '@angular/core';
|
|
199
|
+
* import {registerLocaleData} from '@angular/common';
|
|
200
|
+
*
|
|
201
|
+
* import localeDeCH from '@angular/common/locales/de-CH';
|
|
202
|
+
* import localeFrCH from '@angular/common/locales/fr-CH';
|
|
203
|
+
* import localeItCH from '@angular/common/locales/it-CH';
|
|
204
|
+
*
|
|
205
|
+
* bootstrapApplication(AppComponent, {
|
|
206
|
+
* providers: [
|
|
207
|
+
* provideEnvironmentInitializer(() => {
|
|
208
|
+
* registerLocaleData(localeDeCH);
|
|
209
|
+
* registerLocaleData(localeFrCH);
|
|
210
|
+
* registerLocaleData(localeItCH);
|
|
211
|
+
* }),
|
|
212
|
+
* ],
|
|
213
|
+
* });
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare const SCI_LOCALE: InjectionToken<WritableSignal<string>>;
|
|
217
|
+
|
|
218
|
+
export { SCI_LOCALE, SciAttributesDirective, SciComponentOutletDirective, assertInInjectionContext, coerceSignal, createDestroyableInjector, toLazyObservable };
|
|
185
219
|
export type { MaybeSignal, SciComponentDescriptor, SciTemplateDescriptor };
|
|
@@ -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
|
* ```
|
|
@@ -87,15 +87,162 @@ interface SciTableRowBindings {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
interface SciTableColumnFactory<T> {
|
|
90
|
-
addStringColumn(header: Translatable, value: (item: T) => string): this;
|
|
91
|
-
addStringColumn(value: (item: T) => string): this;
|
|
90
|
+
addStringColumn(header: Translatable, value: (item: T) => MaybeSignal<string | undefined>): this;
|
|
91
|
+
addStringColumn(value: (item: T) => MaybeSignal<string | undefined>): this;
|
|
92
92
|
addStringColumn(descriptor: SciStringColumnDescriptor<T>): this;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
+
*/
|
|
98
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;
|
|
99
246
|
addComponentColumn(descriptor: SciComponentColumnDescriptor<T>): this;
|
|
100
247
|
addTemplateColumn(descriptor: SciTemplateColumnDescriptor<T>): this;
|
|
101
248
|
}
|
|
@@ -115,7 +262,7 @@ interface SciTableColumnDescriptor {
|
|
|
115
262
|
minWidth?: number;
|
|
116
263
|
}
|
|
117
264
|
interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
118
|
-
value: (item: T) => MaybeSignal<string>;
|
|
265
|
+
value: (item: T) => MaybeSignal<string | undefined>;
|
|
119
266
|
sortable?: boolean | {
|
|
120
267
|
comparator: SciTableColumnSortComparatorFn<T, string>;
|
|
121
268
|
};
|
|
@@ -123,16 +270,156 @@ interface SciStringColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
|
123
270
|
matcher: SciTableColumnFilterMatcherFn<T, string>;
|
|
124
271
|
};
|
|
125
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Configures a table column for displaying numeric values.
|
|
275
|
+
*/
|
|
126
276
|
interface SciNumberColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
127
|
-
|
|
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
|
+
*/
|
|
128
284
|
sortable?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Controls whether the user can filter this column. Defaults to `true`.
|
|
287
|
+
*/
|
|
129
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>;
|
|
130
368
|
}
|
|
131
369
|
interface SciBooleanColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
132
|
-
value: (item: T) => MaybeSignal<boolean>;
|
|
370
|
+
value: (item: T) => MaybeSignal<boolean | undefined>;
|
|
133
371
|
sortable?: boolean;
|
|
134
372
|
filterable?: boolean;
|
|
135
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
|
+
}
|
|
136
423
|
interface SciComponentColumnDescriptor<T> extends SciTableColumnDescriptor {
|
|
137
424
|
component: (item: T) => SciComponentDescriptor;
|
|
138
425
|
sortable?: boolean | {
|
|
@@ -172,7 +459,25 @@ type SciTableColumnSortComparatorFn<T = unknown, VALUE = unknown> = (a: SciTable
|
|
|
172
459
|
*/
|
|
173
460
|
type SciTableColumnFilterMatcherFn<T = unknown, VALUE = unknown, FILTER = VALUE> = (filter: FILTER, context: SciTableCellContext<T, VALUE>) => boolean;
|
|
174
461
|
|
|
175
|
-
|
|
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';
|
|
176
481
|
type SciTableRowActionFactoryFn<T> = (toolbar: SciToolbarFactory, item: T, index: number) => void;
|
|
177
482
|
interface SciTableDescriptor<T> {
|
|
178
483
|
datasource: Signal<T[]>;
|
|
@@ -223,7 +528,7 @@ interface SciTableDescriptor<T> {
|
|
|
223
528
|
* ```
|
|
224
529
|
*
|
|
225
530
|
* ```scss
|
|
226
|
-
* sci-table::part(row\:even) {
|
|
531
|
+
* sci-table::part(row\:even row\:not\:selected) {
|
|
227
532
|
* background-color: lightgray;
|
|
228
533
|
* }
|
|
229
534
|
* ```
|
|
@@ -260,10 +565,6 @@ interface SciTable<T> {
|
|
|
260
565
|
*/
|
|
261
566
|
filter(text: string | null): void;
|
|
262
567
|
}
|
|
263
|
-
interface SciTableCellContext<T = unknown, VALUE = unknown> {
|
|
264
|
-
item: T;
|
|
265
|
-
value: VALUE;
|
|
266
|
-
}
|
|
267
568
|
interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
268
569
|
type: SciTableColumnType;
|
|
269
570
|
name: `column:${string}`;
|
|
@@ -282,37 +583,44 @@ interface SciTableColumn<T = unknown, VALUE = unknown, FILTER = VALUE> {
|
|
|
282
583
|
compare: SciTableColumnSortComparatorFn<T, VALUE>;
|
|
283
584
|
matches: SciTableColumnFilterMatcherFn<T, VALUE, FILTER>;
|
|
284
585
|
}
|
|
285
|
-
interface SciStringColumn<T> extends SciTableColumn<T, string> {
|
|
586
|
+
interface SciStringColumn<T = unknown> extends SciTableColumn<T, string> {
|
|
286
587
|
type: 'string';
|
|
287
|
-
value: (item: T) =>
|
|
588
|
+
value: (item: T) => Signal<string | undefined>;
|
|
288
589
|
compare: SciTableColumnSortComparatorFn<T, string>;
|
|
289
590
|
matches: SciTableColumnFilterMatcherFn<T, string>;
|
|
290
591
|
}
|
|
291
|
-
interface SciNumberColumn<T> extends SciTableColumn<T, number> {
|
|
592
|
+
interface SciNumberColumn<T = unknown> extends SciTableColumn<T, number> {
|
|
292
593
|
type: 'number';
|
|
293
|
-
value: (item: T) =>
|
|
594
|
+
value: (item: T) => Signal<number | undefined>;
|
|
294
595
|
compare: SciTableColumnSortComparatorFn<T, number>;
|
|
295
596
|
matches: SciTableColumnFilterMatcherFn<T, number>;
|
|
597
|
+
format: Signal<Intl.NumberFormat>;
|
|
296
598
|
}
|
|
297
|
-
interface SciBooleanColumn<T> extends SciTableColumn<T, boolean> {
|
|
599
|
+
interface SciBooleanColumn<T = unknown> extends SciTableColumn<T, boolean> {
|
|
298
600
|
type: 'boolean';
|
|
299
|
-
value: (item: T) =>
|
|
601
|
+
value: (item: T) => Signal<boolean | undefined>;
|
|
300
602
|
compare: SciTableColumnSortComparatorFn<T, boolean>;
|
|
301
603
|
matches: SciTableColumnFilterMatcherFn<T, boolean>;
|
|
302
604
|
}
|
|
303
|
-
interface
|
|
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>;
|
|
610
|
+
}
|
|
611
|
+
interface SciComponentColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
304
612
|
type: 'component';
|
|
305
613
|
component: (item: T) => SciComponentDescriptor;
|
|
306
614
|
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
307
615
|
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
308
616
|
}
|
|
309
|
-
interface SciTemplateColumn<T> extends SciTableColumn<T, void, string> {
|
|
617
|
+
interface SciTemplateColumn<T = unknown> extends SciTableColumn<T, void, string> {
|
|
310
618
|
type: 'template';
|
|
311
619
|
template: (item: T) => SciTemplateDescriptor;
|
|
312
620
|
compare: SciTableColumnSortComparatorFn<T, void>;
|
|
313
621
|
matches: SciTableColumnFilterMatcherFn<T, void, string>;
|
|
314
622
|
}
|
|
315
|
-
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>;
|
|
316
624
|
/**
|
|
317
625
|
* Mapped row, used as display state.
|
|
318
626
|
*/
|
|
@@ -329,30 +637,39 @@ interface SciTableRow<T> {
|
|
|
329
637
|
}
|
|
330
638
|
interface SciStringCell {
|
|
331
639
|
type: 'string';
|
|
332
|
-
column:
|
|
333
|
-
value: Signal<string>;
|
|
640
|
+
column: SciStringColumn;
|
|
641
|
+
value: Signal<string | undefined>;
|
|
334
642
|
}
|
|
335
643
|
interface SciNumberCell {
|
|
336
644
|
type: 'number';
|
|
337
|
-
column:
|
|
338
|
-
value: Signal<number>;
|
|
645
|
+
column: SciNumberColumn;
|
|
646
|
+
value: Signal<number | undefined>;
|
|
339
647
|
}
|
|
340
648
|
interface SciBooleanCell {
|
|
341
649
|
type: 'boolean';
|
|
342
|
-
column:
|
|
343
|
-
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>;
|
|
344
657
|
}
|
|
345
658
|
interface SciComponentCell {
|
|
346
659
|
type: 'component';
|
|
347
|
-
column:
|
|
660
|
+
column: SciComponentColumn;
|
|
348
661
|
component: SciComponentDescriptor;
|
|
349
662
|
}
|
|
350
663
|
interface SciTemplateCell {
|
|
351
664
|
type: 'template';
|
|
352
|
-
column:
|
|
665
|
+
column: SciTemplateColumn;
|
|
353
666
|
template: SciTemplateDescriptor;
|
|
354
667
|
}
|
|
355
|
-
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
|
+
}
|
|
356
673
|
/**
|
|
357
674
|
* Represents an event emitted by {@link SciTableComponent}.
|
|
358
675
|
*/
|
|
@@ -366,6 +683,10 @@ interface SciTableEvent<T> {
|
|
|
366
683
|
*/
|
|
367
684
|
items: T[];
|
|
368
685
|
}
|
|
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;
|
|
369
690
|
|
|
370
691
|
type SciTableColumnFactoryFn<T> = (table: SciTableColumnFactory<T>) => void;
|
|
371
692
|
/** @experimental since 22.3.0; API and behavior may change in any version without notice. */
|
|
@@ -406,6 +727,7 @@ declare class ɵSciTable<T = unknown> implements SciTable<T> {
|
|
|
406
727
|
readonly sortCriteria: WritableSignal<SciTableSortCriterion[]>;
|
|
407
728
|
readonly filterCriteria: WritableSignal<SciTableColumnFilter[]>;
|
|
408
729
|
private readonly _cache;
|
|
730
|
+
private readonly _tableCellValuePreloader;
|
|
409
731
|
private readonly _tableFilter;
|
|
410
732
|
private readonly _selectedItems;
|
|
411
733
|
readonly totalCount: WritableSignal<number | undefined>;
|
|
@@ -592,4 +914,4 @@ interface SciTableStorage {
|
|
|
592
914
|
declare function provideTableStorage(storage: Type<SciTableStorage>): EnvironmentProviders;
|
|
593
915
|
|
|
594
916
|
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 };
|
|
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 };
|