@mk-kit/ui 0.43.0 → 0.45.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/README.md +11 -0
- package/fesm2022/mk-kit-ui-core.mjs +30 -13
- package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-data.mjs +1 -1
- package/fesm2022/mk-kit-ui-data.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-directives.mjs +27 -8
- package/fesm2022/mk-kit-ui-directives.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-dnd.mjs +43 -8
- package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-forms.mjs +1 -1
- package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-locales-pl.mjs +503 -0
- package/fesm2022/mk-kit-ui-locales-pl.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-media.mjs +1 -1
- package/fesm2022/mk-kit-ui-media.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-table.mjs +658 -22
- package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-testing.mjs +54 -0
- package/fesm2022/mk-kit-ui-testing.mjs.map +1 -1
- package/package.json +5 -1
- package/types/mk-kit-ui-core.d.ts +36 -10
- package/types/mk-kit-ui-directives.d.ts +12 -6
- package/types/mk-kit-ui-dnd.d.ts +32 -4
- package/types/mk-kit-ui-locales-pl.d.ts +42 -0
- package/types/mk-kit-ui-table.d.ts +234 -8
- package/types/mk-kit-ui-testing.d.ts +16 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
import { MkBlockEditorStrings, MkDateNames, MkI18nStrings, MkValidationStrings, MkI18nOverrides } from '@mk-kit/ui/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Picks the Polish plural form for a count: `one` for 1, `few` for 2–4
|
|
6
|
+
* (except 12–14), `many` otherwise — CLDR's `pl` rules for integers, which is
|
|
7
|
+
* all the library's counts ever are.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* mkPluralPl(1, 'wynik', 'wyniki', 'wyników'); // 'wynik'
|
|
11
|
+
* mkPluralPl(3, 'wynik', 'wyniki', 'wyników'); // 'wyniki'
|
|
12
|
+
* mkPluralPl(12, 'wynik', 'wyniki', 'wyników'); // 'wyników'
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare function mkPluralPl(count: number, one: string, few: string, many: string): string;
|
|
16
|
+
/** Polish month and weekday names (Sunday-first, lowercase as in `Intl`). */
|
|
17
|
+
declare const MK_PL_DATE_NAMES: MkDateNames;
|
|
18
|
+
/** Polish validation messages rendered by `mk-form-field`. */
|
|
19
|
+
declare const MK_PL_VALIDATION: MkValidationStrings;
|
|
20
|
+
/** Polish strings of the block editor's chrome. */
|
|
21
|
+
declare const MK_PL_BLOCK_EDITOR: MkBlockEditorStrings;
|
|
22
|
+
/**
|
|
23
|
+
* The complete Polish string map — every key of {@link MkI18nStrings},
|
|
24
|
+
* `locale: 'pl-PL'` and `currency: 'PLN'` for the formatting pipes.
|
|
25
|
+
* Provide it whole with {@link provideMkI18nPl}, or pass it as the base of
|
|
26
|
+
* `provideMkI18n(overrides, MK_PL_I18N)`.
|
|
27
|
+
*/
|
|
28
|
+
declare const MK_PL_I18N: MkI18nStrings;
|
|
29
|
+
/**
|
|
30
|
+
* Provides the Polish strings — {@link MK_PL_I18N} with any `overrides`
|
|
31
|
+
* merged on top (deep for `dateNames`, `blockEditor` and `validation`, like
|
|
32
|
+
* `provideMkI18n`).
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* bootstrapApplication(App, {
|
|
36
|
+
* providers: [provideMkI18nPl({ noData: 'Nic tu nie ma' })],
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function provideMkI18nPl(overrides?: MkI18nOverrides): Provider;
|
|
41
|
+
|
|
42
|
+
export { MK_PL_BLOCK_EDITOR, MK_PL_DATE_NAMES, MK_PL_I18N, MK_PL_VALIDATION, mkPluralPl, provideMkI18nPl };
|
|
@@ -92,6 +92,29 @@ type MkTableAlign = 'start' | 'center' | 'end';
|
|
|
92
92
|
type MkSortDirection = 'asc' | 'desc' | 'none';
|
|
93
93
|
/** Row vertical density. */
|
|
94
94
|
type MkTableDensity = 'comfortable' | 'compact';
|
|
95
|
+
/** Which control a column's header filter renders (see {@link MkTableColumn.filter}). */
|
|
96
|
+
type MkTableFilterKind = 'text' | 'select' | 'number' | 'date';
|
|
97
|
+
/** One option of a `select` header filter. */
|
|
98
|
+
interface MkTableFilterOption {
|
|
99
|
+
/** The value compared against the cell (by `String()` equality). */
|
|
100
|
+
value: unknown;
|
|
101
|
+
/** Visible option text. */
|
|
102
|
+
label: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* An inclusive range accepted as the value of a `number` or `date` filter
|
|
106
|
+
* (dates as `YYYY-MM-DD`, `Date` or a timestamp). Either bound may be omitted.
|
|
107
|
+
*/
|
|
108
|
+
interface MkTableFilterRange<V = number | string | Date> {
|
|
109
|
+
min?: V | null;
|
|
110
|
+
max?: V | null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Active header filters keyed by column key: a string for `text`, an option
|
|
114
|
+
* value for `select`, a number / date (`>=`) or a {@link MkTableFilterRange}
|
|
115
|
+
* for `number` and `date`. Empty strings and `null` mean "no filter".
|
|
116
|
+
*/
|
|
117
|
+
type MkTableFilters = Record<string, unknown>;
|
|
95
118
|
/** Column definition for {@link MkTable}. */
|
|
96
119
|
interface MkTableColumn<T = Record<string, unknown>> {
|
|
97
120
|
/** Property key on each row object supplying the cell value. */
|
|
@@ -131,6 +154,26 @@ interface MkTableColumn<T = Record<string, unknown>> {
|
|
|
131
154
|
* an expandable row detail already repeats.
|
|
132
155
|
*/
|
|
133
156
|
stack?: 'title' | 'footer' | 'hide';
|
|
157
|
+
/**
|
|
158
|
+
* The header-row filter control for this column (rendered when the table is
|
|
159
|
+
* {@link MkTable.filterable}). Omitted, a filterable table gives the column a
|
|
160
|
+
* text filter; `false` leaves its filter cell empty.
|
|
161
|
+
*
|
|
162
|
+
* - `'text'` — case-insensitive *contains* on the displayed (formatted) text.
|
|
163
|
+
* - `'select'` — equality against one of {@link filterOptions}; without
|
|
164
|
+
* options, the distinct values found in `data`.
|
|
165
|
+
* - `'number'` / `'date'` — the control keeps rows whose value is **≥** the
|
|
166
|
+
* entry. Set `{ min, max }` through {@link MkTable.filters} for an
|
|
167
|
+
* inclusive range. Dates compare by local calendar day.
|
|
168
|
+
*/
|
|
169
|
+
filter?: MkTableFilterKind | false;
|
|
170
|
+
/**
|
|
171
|
+
* Options of a `select` filter — strings / numbers, or `{ value, label }`.
|
|
172
|
+
* Omitted: every distinct value of the column in `data`, sorted.
|
|
173
|
+
*/
|
|
174
|
+
filterOptions?: readonly (string | number | MkTableFilterOption)[];
|
|
175
|
+
/** Placeholder of the filter control (text: `i18n.filter`; number / date: `i18n.filterMin`). */
|
|
176
|
+
filterPlaceholder?: string;
|
|
134
177
|
}
|
|
135
178
|
/** Payload emitted by {@link MkTable.sortChange}. */
|
|
136
179
|
interface MkSortChange {
|
|
@@ -204,6 +247,8 @@ interface MkTableExportOptions extends MkCsvExportOptions, MkTableExportRowsOpti
|
|
|
204
247
|
/** Start the browser download (default `true`); `false` just returns the text. */
|
|
205
248
|
download?: boolean;
|
|
206
249
|
}
|
|
250
|
+
/** Drop the empty entries of a filter map (`null` when nothing is left). */
|
|
251
|
+
declare function mkCompactFilters(filters: MkTableFilters | null | undefined): MkTableFilters | null;
|
|
207
252
|
/** One rendered tbody entry: either a group header or a data row. */
|
|
208
253
|
type MkTableItem<T> = {
|
|
209
254
|
kind: 'group';
|
|
@@ -236,8 +281,11 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
236
281
|
*/
|
|
237
282
|
protected readonly stacked: _angular_core.WritableSignal<boolean>;
|
|
238
283
|
constructor();
|
|
239
|
-
/**
|
|
240
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Measures the header row and the thead and exposes them as the sticky
|
|
286
|
+
* offsets of the filter row and of the group rows.
|
|
287
|
+
*/
|
|
288
|
+
private applyStickyOffsets;
|
|
241
289
|
/** Column definitions (order = display order). */
|
|
242
290
|
readonly columns: _angular_core.InputSignal<MkTableColumn<T>[]>;
|
|
243
291
|
/** Row objects to render. */
|
|
@@ -309,6 +357,50 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
309
357
|
readonly groupBy: _angular_core.InputSignal<string | ((row: T) => unknown) | null>;
|
|
310
358
|
/** Formats a group header label; defaults to `String(value)`. */
|
|
311
359
|
readonly groupLabel: _angular_core.InputSignal<((value: unknown, rows: T[]) => string) | null>;
|
|
360
|
+
/**
|
|
361
|
+
* Render only the rows in view (plus {@link overscan}) — for tables of
|
|
362
|
+
* thousands of rows. The `<table>` scrolls inside its own box sized by
|
|
363
|
+
* {@link height} / {@link maxHeight} (`max-height: 60vh` when neither is
|
|
364
|
+
* set) with the header pinned; spacer rows keep the scrollbar honest.
|
|
365
|
+
*
|
|
366
|
+
* Works with sorting, selection (select-all still covers every row), tree
|
|
367
|
+
* rows, grouping (group headers are rows too), expandable detail rows (their
|
|
368
|
+
* height is measured once rendered; an unmeasured detail counts as one row)
|
|
369
|
+
* and the header filter row. Falls back to the full render while stacked
|
|
370
|
+
* into cards. Export and select-all always see every row, not the window.
|
|
371
|
+
*/
|
|
372
|
+
readonly virtual: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
373
|
+
/**
|
|
374
|
+
* Height (px) of one row in virtual mode. Leave unset to have it measured
|
|
375
|
+
* from the first rendered row — which follows `density` and
|
|
376
|
+
* `data-mk-density` automatically — starting from 44 (comfortable).
|
|
377
|
+
*/
|
|
378
|
+
readonly rowHeight: _angular_core.InputSignalWithTransform<number | null, unknown>;
|
|
379
|
+
/** Rows rendered beyond each edge of the viewport in virtual mode. */
|
|
380
|
+
readonly overscan: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
381
|
+
/** Fixed height of the scroll box (CSS length, or px as a number). */
|
|
382
|
+
readonly height: _angular_core.InputSignal<string | number | null>;
|
|
383
|
+
/** Maximum height of the scroll box (CSS length, or px as a number). */
|
|
384
|
+
readonly maxHeight: _angular_core.InputSignal<string | number | null>;
|
|
385
|
+
/**
|
|
386
|
+
* Render a second header row with a filter control per column — a text
|
|
387
|
+
* box, a select, a number or a date field as the column's
|
|
388
|
+
* {@link MkTableColumn.filter} says. Values live in {@link filters}.
|
|
389
|
+
*/
|
|
390
|
+
readonly filterable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
391
|
+
/**
|
|
392
|
+
* The active filters, keyed by column key (`[(filters)]`; `filtersChange`
|
|
393
|
+
* emits the whole map on every edit). Text filters hold the typed string,
|
|
394
|
+
* select filters the chosen option value, number / date filters the lower
|
|
395
|
+
* bound or a `{ min, max }` range. Set programmatically to pre-filter.
|
|
396
|
+
*/
|
|
397
|
+
readonly filters: _angular_core.ModelSignal<MkTableFilters>;
|
|
398
|
+
/**
|
|
399
|
+
* Filter rows in the browser (default). Turn off when the server applies
|
|
400
|
+
* the filters — `MkTableDataSource.setFilters($event)` on `filtersChange` —
|
|
401
|
+
* so the page it returns is shown as-is.
|
|
402
|
+
*/
|
|
403
|
+
readonly clientFilter: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
312
404
|
/** Emitted when the sort column/direction changes. */
|
|
313
405
|
readonly sortChange: _angular_core.OutputEmitterRef<MkSortChange>;
|
|
314
406
|
/** Emitted when a row is clicked (enable via `clickableRows`). */
|
|
@@ -434,6 +526,52 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
434
526
|
*/
|
|
435
527
|
/** Data sorted by the active column, or the input order when unsorted. */
|
|
436
528
|
protected readonly sortedData: _angular_core.Signal<T[]>;
|
|
529
|
+
/** The filter control a column renders, or `null` for none. */
|
|
530
|
+
protected filterKind(col: MkTableColumn<T>): MkTableFilterKind | null;
|
|
531
|
+
/** One predicate per active filter, or `null` when nothing is filtered. */
|
|
532
|
+
private readonly rowPredicate;
|
|
533
|
+
/** Build the predicate for one column's filter value. */
|
|
534
|
+
private columnTest;
|
|
535
|
+
/**
|
|
536
|
+
* Tree mode: which rows survive the filters — a row is kept when it matches
|
|
537
|
+
* or any descendant does, so a matching child keeps its parents.
|
|
538
|
+
*/
|
|
539
|
+
private readonly treeKeep;
|
|
540
|
+
/** The input rows with the active filters applied (input order). */
|
|
541
|
+
private readonly filteredData;
|
|
542
|
+
/** The child rows of `row` that survive the filters (tree mode). */
|
|
543
|
+
private visibleChildrenOf;
|
|
544
|
+
/** Options of every `select` filter, keyed by column (derived when unset). */
|
|
545
|
+
private readonly selectOptions;
|
|
546
|
+
/** The options a column's select filter offers. */
|
|
547
|
+
protected filterOptionsFor(col: MkTableColumn<T>): MkTableFilterOption[];
|
|
548
|
+
/** Whether `option` is the column's current select-filter value. */
|
|
549
|
+
protected isFilterOption(col: MkTableColumn<T>, option: MkTableFilterOption): boolean;
|
|
550
|
+
/** Whether a column has an active filter. */
|
|
551
|
+
protected hasFilter(key: string): boolean;
|
|
552
|
+
/** The text a column's filter box shows (a range shows its lower bound). */
|
|
553
|
+
protected filterText(key: string): string;
|
|
554
|
+
/** Accessible name of a column's filter control. */
|
|
555
|
+
protected filterLabel(col: MkTableColumn<T>): string;
|
|
556
|
+
/** Placeholder of a column's filter control. */
|
|
557
|
+
protected filterPlaceholder(col: MkTableColumn<T>): string;
|
|
558
|
+
/**
|
|
559
|
+
* Set one column's filter (`null` / `''` clears it). Updates
|
|
560
|
+
* {@link filters} and emits `filtersChange`; a no-op when unchanged.
|
|
561
|
+
*/
|
|
562
|
+
setFilter(key: string, value: unknown): void;
|
|
563
|
+
/** Clear one column's filter. */
|
|
564
|
+
clearFilter(key: string): void;
|
|
565
|
+
/** Clear every filter. */
|
|
566
|
+
clearFilters(): void;
|
|
567
|
+
/** Text / number / date filter box input. */
|
|
568
|
+
protected onFilterInput(col: MkTableColumn<T>, event: Event): void;
|
|
569
|
+
/** Select filter change: map the option string back to its original value. */
|
|
570
|
+
protected onFilterSelect(col: MkTableColumn<T>, event: Event): void;
|
|
571
|
+
/** Escape in a filter box clears that filter (and stays in the box). */
|
|
572
|
+
protected onFilterKeydown(col: MkTableColumn<T>, event: KeyboardEvent): void;
|
|
573
|
+
/** Header rows above the body (for `aria-rowindex`). */
|
|
574
|
+
protected readonly headerRows: _angular_core.Signal<number>;
|
|
437
575
|
/** Sort one sibling group by the active column (input order when unsorted). */
|
|
438
576
|
private sortRows;
|
|
439
577
|
/** `aria-sort` value for a header cell. */
|
|
@@ -488,6 +626,75 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
488
626
|
private pushRows;
|
|
489
627
|
/** The child rows of `row` (tree mode), or an empty list. */
|
|
490
628
|
private childrenOf;
|
|
629
|
+
/** The scroll box around the table. */
|
|
630
|
+
private readonly scroller;
|
|
631
|
+
/** Virtual mode in force (cards always render in full). */
|
|
632
|
+
protected readonly isVirtual: _angular_core.Signal<boolean>;
|
|
633
|
+
/** Current scroll offset of the scroll box (virtual mode). */
|
|
634
|
+
private readonly scrollTop;
|
|
635
|
+
/** Measured height of the scroll box (0 until measured / on the server). */
|
|
636
|
+
private readonly viewportHeight;
|
|
637
|
+
/** Measured height of the thead — the sticky header hides that much of the top. */
|
|
638
|
+
private readonly headHeight;
|
|
639
|
+
/** Row height read back from the first rendered row. */
|
|
640
|
+
private readonly measuredRowHeight;
|
|
641
|
+
/** Measured heights of expanded detail rows, by row key. */
|
|
642
|
+
private readonly detailHeights;
|
|
643
|
+
/** The row height virtual mode lays rows out with. */
|
|
644
|
+
protected readonly effectiveRowHeight: _angular_core.Signal<number>;
|
|
645
|
+
private cssLength;
|
|
646
|
+
/** `height` of the scroll box. */
|
|
647
|
+
protected readonly scrollHeight: _angular_core.Signal<string | null>;
|
|
648
|
+
/** `max-height` of the scroll box (60vh in virtual mode with no size given). */
|
|
649
|
+
protected readonly scrollMaxHeight: _angular_core.Signal<string | null>;
|
|
650
|
+
/**
|
|
651
|
+
* Top offset of every display item, or `null` while every item is exactly
|
|
652
|
+
* one row tall (the common case — then offsets are plain multiplication).
|
|
653
|
+
* Only expanded detail rows make heights vary.
|
|
654
|
+
*/
|
|
655
|
+
private readonly itemOffsets;
|
|
656
|
+
/** Full height of the body, spacers included. */
|
|
657
|
+
private readonly totalHeight;
|
|
658
|
+
/** Top offset (px) of display item `index`. */
|
|
659
|
+
private offsetOf;
|
|
660
|
+
/** Index of the display item covering the body offset `y`. */
|
|
661
|
+
private indexAt;
|
|
662
|
+
/** The `[start, end)` slice of display items currently rendered. */
|
|
663
|
+
protected readonly windowRange: _angular_core.Signal<{
|
|
664
|
+
start: number;
|
|
665
|
+
end: number;
|
|
666
|
+
}>;
|
|
667
|
+
/** Display index of the first rendered item. */
|
|
668
|
+
protected readonly windowStart: _angular_core.Signal<number>;
|
|
669
|
+
/** The items the tbody renders: the window in virtual mode, else all. */
|
|
670
|
+
protected readonly renderedItems: _angular_core.Signal<MkTableItem<T>[]>;
|
|
671
|
+
/** Height (px) of the spacer above the window. */
|
|
672
|
+
protected readonly topSpace: _angular_core.Signal<number>;
|
|
673
|
+
/** Height (px) of the spacer below the window. */
|
|
674
|
+
protected readonly bottomSpace: _angular_core.Signal<number>;
|
|
675
|
+
/** Scroll box scrolled: move the window. */
|
|
676
|
+
protected onScroll(event: Event): void;
|
|
677
|
+
/**
|
|
678
|
+
* Read the viewport, thead, first-row and detail-row heights back from the
|
|
679
|
+
* DOM. Heights are accepted only when they move by more than a pixel:
|
|
680
|
+
* collapsed table borders make the same row measure 44 or 44.5 depending
|
|
681
|
+
* on where it sits, and letting that flip the row height would shift a
|
|
682
|
+
* 10,000-row body by thousands of pixels on every window change. A density
|
|
683
|
+
* change (44 → 36 or 52) still gets through.
|
|
684
|
+
*/
|
|
685
|
+
private measureViewport;
|
|
686
|
+
/**
|
|
687
|
+
* Scroll a row into view. A number is the row's **display index** — its
|
|
688
|
+
* position among the rendered rows, group headers included, after sorting,
|
|
689
|
+
* filtering and tree expansion; anything else is a row key (the `trackKey`
|
|
690
|
+
* value, or the row object when there is none). Pass `'key'` to look a
|
|
691
|
+
* numeric key up. Returns `false` when the row is not currently displayed
|
|
692
|
+
* (filtered out, under a collapsed parent or group).
|
|
693
|
+
*
|
|
694
|
+
* In virtual mode the row lands at the top of the viewport, just under the
|
|
695
|
+
* header; otherwise it is scrolled to the nearest edge.
|
|
696
|
+
*/
|
|
697
|
+
scrollToRow(target: unknown, by?: 'index' | 'key'): boolean;
|
|
491
698
|
/** Keys of parent rows whose children are shown. */
|
|
492
699
|
private readonly treeExpanded;
|
|
493
700
|
/** Whether a parent row's children are currently shown (tree mode). */
|
|
@@ -501,7 +708,8 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
501
708
|
/**
|
|
502
709
|
* The rows and columns an export writes — exactly what {@link exportCsv}
|
|
503
710
|
* serialises, for other formats (XLSX, PDF, the clipboard, …): rows in
|
|
504
|
-
* display order with the current sort
|
|
711
|
+
* display order with the current sort and header {@link filters} applied
|
|
712
|
+
* (every matching row, never just the virtual window) and tree children
|
|
505
713
|
* (`childrenKey`) flattened under their parent whether or not they are
|
|
506
714
|
* expanded, optionally only the selected ones; columns in the table's
|
|
507
715
|
* current order, restricted to `options.columns` when given, each carrying
|
|
@@ -517,8 +725,8 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
517
725
|
getExportRows(options?: MkTableExportRowsOptions): MkTableExportRows<T>;
|
|
518
726
|
/**
|
|
519
727
|
* The table's rows as CSV: current column order, column formatters applied,
|
|
520
|
-
* sorted the way they are shown, tree children flattened under
|
|
521
|
-
* whether or not they are expanded. Downloads the file (default name
|
|
728
|
+
* sorted and filtered the way they are shown, tree children flattened under
|
|
729
|
+
* their parent whether or not they are expanded. Downloads the file (default name
|
|
522
730
|
* `table.csv`) and returns the text. Built on {@link getExportRows}.
|
|
523
731
|
*/
|
|
524
732
|
exportCsv(options?: MkTableExportOptions): string;
|
|
@@ -546,7 +754,7 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
546
754
|
/** Toggle a row's detail panel, honouring `singleExpand`. */
|
|
547
755
|
protected toggleExpand(row: T, event?: Event): void;
|
|
548
756
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTable<any>, never>;
|
|
549
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTable<any>, "mk-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "zebra": { "alias": "zebra"; "required": false; "isSignal": true; }; "hover": { "alias": "hover"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "stackAt": { "alias": "stackAt"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "trackKey": { "alias": "trackKey"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "reorderableColumns": { "alias": "reorderableColumns"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "groupLabel": { "alias": "groupLabel"; "required": false; "isSignal": true; }; "childrenKey": { "alias": "childrenKey"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "sortChange": "sortChange"; "rowClick": "rowClick"; "selectionChange": "selectionChange"; "expandedChange": "expandedChange"; "columnResize": "columnResize"; "columnReorder": "columnReorder"; "cellEdit": "cellEdit"; "groupToggle": "groupToggle"; "treeToggle": "treeToggle"; }, ["rowDetail", "cellTemplates"], ["[mkTableEmpty]"], true, never>;
|
|
757
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTable<any>, "mk-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "zebra": { "alias": "zebra"; "required": false; "isSignal": true; }; "hover": { "alias": "hover"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "stackAt": { "alias": "stackAt"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "trackKey": { "alias": "trackKey"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "reorderableColumns": { "alias": "reorderableColumns"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "groupLabel": { "alias": "groupLabel"; "required": false; "isSignal": true; }; "virtual": { "alias": "virtual"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "clientFilter": { "alias": "clientFilter"; "required": false; "isSignal": true; }; "childrenKey": { "alias": "childrenKey"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "filters": "filtersChange"; "sortChange": "sortChange"; "rowClick": "rowClick"; "selectionChange": "selectionChange"; "expandedChange": "expandedChange"; "columnResize": "columnResize"; "columnReorder": "columnReorder"; "cellEdit": "cellEdit"; "groupToggle": "groupToggle"; "treeToggle": "treeToggle"; }, ["rowDetail", "cellTemplates"], ["[mkTableEmpty]"], true, never>;
|
|
550
758
|
}
|
|
551
759
|
|
|
552
760
|
/** Context handed to an `[mkTableCell]` template. */
|
|
@@ -697,6 +905,12 @@ interface MkDataRequest {
|
|
|
697
905
|
filter: string;
|
|
698
906
|
/** Structured filter from `mk-query-builder` (`null` = none). Compacted: no empty groups or unfinished rules. */
|
|
699
907
|
query: MkQueryGroup | null;
|
|
908
|
+
/**
|
|
909
|
+
* Per-column filters from `mk-table`'s header filter row (`null` = none),
|
|
910
|
+
* keyed by column key with empty entries dropped — see
|
|
911
|
+
* {@link MkTableDataSource.setFilters}.
|
|
912
|
+
*/
|
|
913
|
+
filters: MkTableFilters | null;
|
|
700
914
|
}
|
|
701
915
|
/** One page of server data returned by a {@link MkDataFetcher}. */
|
|
702
916
|
interface MkDataPage<T> {
|
|
@@ -810,6 +1024,7 @@ declare class MkTableDataSource<T> {
|
|
|
810
1024
|
private readonly _sort;
|
|
811
1025
|
private readonly _filter;
|
|
812
1026
|
private readonly _query;
|
|
1027
|
+
private readonly _filters;
|
|
813
1028
|
/** Rows of the current page (`[]` until the first load lands). */
|
|
814
1029
|
readonly rows: Signal<T[]>;
|
|
815
1030
|
/** Total row count across all pages (feed to `mk-pagination`'s `total`). */
|
|
@@ -828,6 +1043,8 @@ declare class MkTableDataSource<T> {
|
|
|
828
1043
|
readonly filter: Signal<string>;
|
|
829
1044
|
/** Current structured query, or `null`. */
|
|
830
1045
|
readonly query: Signal<MkQueryGroup | null>;
|
|
1046
|
+
/** Current per-column filters, or `null`. */
|
|
1047
|
+
readonly filters: Signal<MkTableFilters | null>;
|
|
831
1048
|
/** True when a settled load reported no rows at all. */
|
|
832
1049
|
readonly empty: Signal<boolean>;
|
|
833
1050
|
/** Monotonic request id — settles from older epochs are discarded. */
|
|
@@ -863,6 +1080,15 @@ declare class MkTableDataSource<T> {
|
|
|
863
1080
|
* with nothing left is sent as `null`. Resets to page 1 and loads at once.
|
|
864
1081
|
*/
|
|
865
1082
|
setQuery(query: MkQueryGroup | null): void;
|
|
1083
|
+
/**
|
|
1084
|
+
* Set (or clear with `null` / `{}`) the per-column filters from `mk-table`'s
|
|
1085
|
+
* header filter row — bind `(filtersChange)="ds.setFilters($event)"` and
|
|
1086
|
+
* turn the table's `clientFilter` off. Empty entries are dropped before the
|
|
1087
|
+
* request; nothing left is sent as `null`. Resets to page 1 and loads at
|
|
1088
|
+
* once (the table already debounces nothing, so debounce the fetcher if
|
|
1089
|
+
* your API needs it). A no-op when unchanged.
|
|
1090
|
+
*/
|
|
1091
|
+
setFilters(filters: MkTableFilters | null): void;
|
|
866
1092
|
/**
|
|
867
1093
|
* Re-run the current request immediately (e.g. after a mutation). Flushes a
|
|
868
1094
|
* pending debounced filter, since the request reads the live filter value.
|
|
@@ -892,5 +1118,5 @@ declare class MkTableDataSource<T> {
|
|
|
892
1118
|
private clearSub;
|
|
893
1119
|
}
|
|
894
1120
|
|
|
895
|
-
export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail, mkDownloadText, mkExportCsv, mkToCsv };
|
|
896
|
-
export type { MkCellEdit, MkColumnResize, MkCsvColumn, MkCsvExportOptions, MkCsvOptions, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableExportOptions, MkTableExportRows, MkTableExportRowsOptions, MkTableGroup, MkTreeToggle };
|
|
1121
|
+
export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail, mkCompactFilters, mkDownloadText, mkExportCsv, mkToCsv };
|
|
1122
|
+
export type { MkCellEdit, MkColumnResize, MkCsvColumn, MkCsvExportOptions, MkCsvOptions, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableExportOptions, MkTableExportRows, MkTableExportRowsOptions, MkTableFilterKind, MkTableFilterOption, MkTableFilterRange, MkTableFilters, MkTableGroup, MkTreeToggle };
|
|
@@ -306,6 +306,22 @@ declare class MkTableHarness extends MkHarness {
|
|
|
306
306
|
/** Toggle the header "select all" checkbox. */
|
|
307
307
|
toggleAll(): Promise<void>;
|
|
308
308
|
isEmpty(): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Set a header-row filter (table is `filterable`). `value` is typed into
|
|
311
|
+
* a text / number / date box, or picked from a select by option label or
|
|
312
|
+
* value; `''` clears that filter.
|
|
313
|
+
*/
|
|
314
|
+
setFilter(key: string, value: string): Promise<void>;
|
|
315
|
+
/** The current value of a header-row filter control (`''` when unset). */
|
|
316
|
+
filterValue(key: string): string;
|
|
317
|
+
/** Clear every header-row filter. */
|
|
318
|
+
clearFilters(): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Scroll a `virtual` table so the row at display `index` is at the top of
|
|
321
|
+
* the viewport (drives the scroll box, so only the rows around it render).
|
|
322
|
+
*/
|
|
323
|
+
scrollToRow(index: number): Promise<void>;
|
|
324
|
+
private filterControl;
|
|
309
325
|
private headerCells;
|
|
310
326
|
}
|
|
311
327
|
|