@mintplayer/web-components 2.17.0 → 2.18.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/chunks/{mp-datatable-eRpl7-2V.mjs → mp-datatable-CEpSxlkd.mjs} +683 -380
- package/custom-elements.json +13063 -12620
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/index.d.ts +1 -1
- package/datatable/src/components/mp-datatable.d.ts +260 -21
- package/datatable/src/index.d.ts +1 -1
- package/datatable/src/types/labels.d.ts +11 -0
- package/file-manager/index.mjs +1 -1
- package/package.json +1 -1
package/datatable/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MpDatatable } from './mp-datatable';
|
|
2
|
-
export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, } from './mp-datatable';
|
|
2
|
+
export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, DatatableFetchState, DatatableReloadOptions, } from './mp-datatable';
|
|
@@ -2,26 +2,58 @@ import { LitElement, TemplateResult } from 'lit';
|
|
|
2
2
|
import { DatatableLabels } from '../types/labels';
|
|
3
3
|
import { SortColumn } from '../sort';
|
|
4
4
|
import { DatatableColumnDef, RowKey, RowRenderer, DatatableFetch, DatatableDistincts, TreeIdKey, TreeSelectionStrategy } from '../types';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* - `'none'`: rows are not selectable.
|
|
7
|
+
* - `'single'`: a row click or Enter/Space selects that one row.
|
|
8
|
+
* - `'multiple'`: a row click selects (Ctrl/Cmd toggles, Shift selects a range),
|
|
9
|
+
* and a checkbox column toggles rows individually.
|
|
10
|
+
* - `'checkbox'`: multi-select through the checkbox column ONLY. A row click and
|
|
11
|
+
* Enter emit `mp-datatable-row-click` without selecting, so a row can open
|
|
12
|
+
* something; Space toggles the focused row's checkbox.
|
|
13
|
+
*/
|
|
14
|
+
export type DatatableSelectionMode = 'none' | 'single' | 'multiple' | 'checkbox';
|
|
6
15
|
export interface RowEventDetail<T = unknown> {
|
|
7
16
|
row: T;
|
|
8
17
|
rowIndex: number;
|
|
9
18
|
rowKey: string;
|
|
10
19
|
originalEvent: Event;
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The fetch-driving state `applyFetchState` applies as one change. Every field
|
|
23
|
+
* is optional; see that method for the absent-field rules.
|
|
24
|
+
*/
|
|
25
|
+
export interface DatatableFetchState {
|
|
26
|
+
fetch?: DatatableFetch | null;
|
|
27
|
+
sortColumns?: SortColumn[];
|
|
28
|
+
page?: number;
|
|
29
|
+
perPage?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Options for `reload()`. */
|
|
32
|
+
export interface DatatableReloadOptions {
|
|
33
|
+
/** Return to page 1 before re-fetching. Default `false`. */
|
|
34
|
+
resetPage?: boolean;
|
|
35
|
+
}
|
|
12
36
|
export interface SortChangeEventDetail {
|
|
13
37
|
sortColumns: SortColumn[];
|
|
14
38
|
}
|
|
15
39
|
export interface SelectionChangeEventDetail<T = unknown> {
|
|
16
|
-
selectedIds: string[];
|
|
17
40
|
/**
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
* consumers can't resolve ids → rows themselves — this is how a consumer gets
|
|
21
|
-
* the actual selected records. An id whose row isn't currently loaded is
|
|
22
|
-
* omitted (shouldn't happen: you can only select a row you can see).
|
|
41
|
+
* The selection, authoritative. Act on this: it holds every selected key,
|
|
42
|
+
* including keys whose rows are on another page or were never loaded.
|
|
23
43
|
*/
|
|
24
|
-
|
|
44
|
+
selectedIds: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Index-aligned with `selectedIds`: `selectedRows[i]` is the row of
|
|
47
|
+
* `selectedIds[i]`. Render from this.
|
|
48
|
+
*
|
|
49
|
+
* A row is resolved from the loaded data first (page 1, fetched windows,
|
|
50
|
+
* tree children), so a re-fetched row object wins; otherwise from the rows
|
|
51
|
+
* the element remembered when they were selected, which is what keeps a row
|
|
52
|
+
* that has paged, sorted or re-fetched out of view. `undefined` marks a key
|
|
53
|
+
* whose row the element has never seen (a host seeded the key without its
|
|
54
|
+
* row). Nothing is dropped, so the two arrays always pair positionally.
|
|
55
|
+
*/
|
|
56
|
+
selectedRows: (T | undefined)[];
|
|
25
57
|
}
|
|
26
58
|
/**
|
|
27
59
|
* `<mp-datatable>` — property-driven data grid.
|
|
@@ -29,8 +61,8 @@ export interface SelectionChangeEventDetail<T = unknown> {
|
|
|
29
61
|
* - Columns are declared programmatically via `DatatableColumnDef[]`.
|
|
30
62
|
* Each column supplies a name (sort key) + optional `cellRenderer`.
|
|
31
63
|
* - Sort algorithm extracted into the pure `computeNextSort` helper.
|
|
32
|
-
* - Selection model: `'none' | 'single' | 'multiple'` with checkbox column
|
|
33
|
-
*
|
|
64
|
+
* - Selection model: `'none' | 'single' | 'multiple' | 'checkbox'` with a checkbox column
|
|
65
|
+
* in the multi-select modes (see `DatatableSelectionMode`).
|
|
34
66
|
* - Row events: `mp-datatable-row-click`, `mp-datatable-row-dblclick`,
|
|
35
67
|
* `mp-datatable-row-contextmenu` — all carry `RowEventDetail`.
|
|
36
68
|
* - Pagination footer when `pagination` enabled.
|
|
@@ -62,9 +94,14 @@ export declare class MpDatatable extends LitElement {
|
|
|
62
94
|
set caption(value: string | null);
|
|
63
95
|
/**
|
|
64
96
|
* User-visible strings, overridable per key for localisation
|
|
65
|
-
* (see DatatableLabels). Property-only: it holds functions.
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
* (see DatatableLabels). Property-only: it holds functions. Re-renders on
|
|
98
|
+
* assignment, so switching language on a mounted table renames every
|
|
99
|
+
* control (row-checkbox names included) without waiting for an unrelated
|
|
100
|
+
* update.
|
|
101
|
+
*/
|
|
102
|
+
get labels(): Partial<DatatableLabels> | undefined;
|
|
103
|
+
set labels(value: Partial<DatatableLabels> | undefined);
|
|
104
|
+
private _labels;
|
|
68
105
|
/** Merged view of labels — consumer keys over the English defaults. */
|
|
69
106
|
private get mergedLabels();
|
|
70
107
|
/** Optional invisible accessible name for the <table>. Host aria-label wins. */
|
|
@@ -75,6 +112,14 @@ export declare class MpDatatable extends LitElement {
|
|
|
75
112
|
private _sortColumns;
|
|
76
113
|
private _selectionMode;
|
|
77
114
|
private _selectedIds;
|
|
115
|
+
/**
|
|
116
|
+
* The row of each selected key, remembered when it was selected (or seeded
|
|
117
|
+
* via `selectedRows`). Loaded data is replaced on every page change, sort and
|
|
118
|
+
* re-fetch, so without this a selected row that leaves the loaded set could
|
|
119
|
+
* no longer be reported. Keys ⊆ `_selectedIds`: every path that deselects
|
|
120
|
+
* prunes it, so it holds the selection's own rows and never mirrors the data.
|
|
121
|
+
*/
|
|
122
|
+
private _selectedRowCache;
|
|
78
123
|
private _cutIds;
|
|
79
124
|
private _focusedRowKey;
|
|
80
125
|
/** Polite announcements for async/derived state changes (sort, page,
|
|
@@ -89,7 +134,24 @@ export declare class MpDatatable extends LitElement {
|
|
|
89
134
|
* focus is elsewhere never steal it.
|
|
90
135
|
*/
|
|
91
136
|
private readonly rowFocusRestore;
|
|
137
|
+
/**
|
|
138
|
+
* The default key: the row's `id`, else its position. A positional key names
|
|
139
|
+
* a different row after every re-fetch, sort or tree expansion, so it cannot
|
|
140
|
+
* carry a selection across them — hence the one-time warning below.
|
|
141
|
+
*
|
|
142
|
+
* Worse, a row that is NOT loaded (an off-page selected row, a child of a
|
|
143
|
+
* collapsed parent) has no index at all and is keyed `rowKey(row, -1)`, so
|
|
144
|
+
* every id-less off-page row collapses onto the one key `row--1` and the
|
|
145
|
+
* selection can no longer tell them apart. A stable, id-based `rowKey` is
|
|
146
|
+
* therefore required for selection with `fetch` or pagination.
|
|
147
|
+
*/
|
|
92
148
|
private _rowKey;
|
|
149
|
+
private _warnedPositionalKey;
|
|
150
|
+
/**
|
|
151
|
+
* Warn rather than throw: a static table without ids keeps working, and only
|
|
152
|
+
* a fetched or selectable one is actually harmed by a positional key.
|
|
153
|
+
*/
|
|
154
|
+
private warnPositionalKeyOnce;
|
|
93
155
|
private _columnWidths;
|
|
94
156
|
/** Becomes `true` after the first measure-once pass locks column widths. Drives the `.measured` class on the table (→ `table-layout: fixed`). */
|
|
95
157
|
private _hasMeasuredInitial;
|
|
@@ -143,7 +205,7 @@ export declare class MpDatatable extends LitElement {
|
|
|
143
205
|
private _fetch;
|
|
144
206
|
/** Bumped on invalidation; in-flight responses from an older generation are dropped. */
|
|
145
207
|
private _fetchGeneration;
|
|
146
|
-
/** Guards the one-time initial page-1 load. Reset
|
|
208
|
+
/** Guards the one-time initial page-1 load. Reset when the callback changes. */
|
|
147
209
|
private _initialFetchDone;
|
|
148
210
|
/** Coalesces multiple setter calls in one flush into a single reload. */
|
|
149
211
|
private _reloadScheduled;
|
|
@@ -193,9 +255,19 @@ export declare class MpDatatable extends LitElement {
|
|
|
193
255
|
* loop and the consumer provides nothing else — no page-1 seeding via `data`,
|
|
194
256
|
* no separate `totalRecords`, no event bridge. Works with any framework or
|
|
195
257
|
* none (`el.fetch = fn`). Setting it kicks off the initial page-1 load.
|
|
258
|
+
*
|
|
259
|
+
* Pass a STABLE function. Assigning the same function again is a no-op, but
|
|
260
|
+
* a new closure on every render is a new callback, and each one reloads. To
|
|
261
|
+
* re-query with an unchanged callback, call `reload()`.
|
|
196
262
|
*/
|
|
197
263
|
get fetch(): DatatableFetch | null;
|
|
198
264
|
set fetch(value: DatatableFetch | null);
|
|
265
|
+
/**
|
|
266
|
+
* Assigns the callback without scheduling a load; true when a load is due.
|
|
267
|
+
* Shared by the setter and `applyFetchState`, which schedules once for all
|
|
268
|
+
* of its fields.
|
|
269
|
+
*/
|
|
270
|
+
private assignFetch;
|
|
199
271
|
/**
|
|
200
272
|
* Consumer-supplied source of distinct values for the filter panels.
|
|
201
273
|
* Property-only (it holds a function), mirroring `fetch` and `labels`.
|
|
@@ -207,14 +279,85 @@ export declare class MpDatatable extends LitElement {
|
|
|
207
279
|
set distincts(value: DatatableDistincts | null);
|
|
208
280
|
get sortColumns(): SortColumn[];
|
|
209
281
|
set sortColumns(value: SortColumn[]);
|
|
282
|
+
/**
|
|
283
|
+
* Assigns without scheduling; false when the value is structurally equal. A
|
|
284
|
+
* wrapper echoing back the array it was just given is not a sort change, and
|
|
285
|
+
* must not cost a re-render or a request (#407).
|
|
286
|
+
*/
|
|
287
|
+
private assignSortColumns;
|
|
288
|
+
/**
|
|
289
|
+
* Re-queries the `fetch` callback for the current sort, page and page size,
|
|
290
|
+
* even though none of them changed (the server data did). One request,
|
|
291
|
+
* coalesced with any change already pending in the same task.
|
|
292
|
+
*
|
|
293
|
+
* The loaded windows and tree children are dropped, because they may be
|
|
294
|
+
* stale. The selection is NOT: every selected key and its remembered row
|
|
295
|
+
* survive, so a re-fetched row simply replaces the remembered one.
|
|
296
|
+
*
|
|
297
|
+
* `resetPage: true` also returns to page 1 (and emits
|
|
298
|
+
* `mp-datatable-page-change` when that moves the page). A no-op without a
|
|
299
|
+
* `fetch` callback, apart from the page reset.
|
|
300
|
+
*/
|
|
301
|
+
reload({ resetPage }?: DatatableReloadOptions): void;
|
|
302
|
+
/**
|
|
303
|
+
* Applies any of `fetch`, `sortColumns`, `page` and `perPage` as ONE change:
|
|
304
|
+
* every provided field is assigned first, then exactly one reload is
|
|
305
|
+
* scheduled. Assigning them one by one through the setters can split across
|
|
306
|
+
* ticks and cost two requests; this cannot (#407). Framework wrappers that
|
|
307
|
+
* forward several of these inputs should call this rather than the setters.
|
|
308
|
+
*
|
|
309
|
+
* A field that is absent (or `undefined`) is left alone, except `fetch`: a
|
|
310
|
+
* present `fetch` key is always assigned, so `{ fetch: null }` removes the
|
|
311
|
+
* callback. `perPage` returns to page 1 unless `page` is also given.
|
|
312
|
+
* Unchanged values cost nothing, as with the setters.
|
|
313
|
+
*
|
|
314
|
+
* When `perPage` changes and the given `page` would lie past the last page
|
|
315
|
+
* of the known row count (20 → 50 per page while on page 5 of 100 rows), the
|
|
316
|
+
* page is clamped to the last page and `mp-datatable-page-change` reports
|
|
317
|
+
* it, so a wrapper's page state follows. With no known count (a fetch table
|
|
318
|
+
* before its first response, or a new `fetch` in the same call) the page is
|
|
319
|
+
* kept as given.
|
|
320
|
+
*/
|
|
321
|
+
applyFetchState(state: DatatableFetchState): void;
|
|
210
322
|
get selectionMode(): DatatableSelectionMode;
|
|
211
323
|
set selectionMode(value: DatatableSelectionMode);
|
|
324
|
+
/** Modes that select many rows and render the checkbox column. */
|
|
325
|
+
private get isMulti();
|
|
212
326
|
get selectedIds(): string[];
|
|
213
327
|
set selectedIds(value: string[] | ReadonlyArray<string>);
|
|
328
|
+
/**
|
|
329
|
+
* The selected rows, index-aligned with `selectedIds` (`undefined` for a key
|
|
330
|
+
* whose row the element has never seen). See `SelectionChangeEventDetail`.
|
|
331
|
+
*
|
|
332
|
+
* Setting it REPLACES the selection: the keys are derived through `rowKey`,
|
|
333
|
+
* and the rows are remembered, so a host that owns row objects (the Angular
|
|
334
|
+
* wrapper's `selection` model) can seed rows that are not loaded here — they
|
|
335
|
+
* are reported back in `selectedRows` even while off-page.
|
|
336
|
+
*/
|
|
337
|
+
get selectedRows(): unknown[];
|
|
338
|
+
set selectedRows(value: unknown[] | ReadonlyArray<unknown>);
|
|
214
339
|
get cutIds(): string[];
|
|
215
340
|
set cutIds(value: string[] | ReadonlyArray<string>);
|
|
216
341
|
get focusedRowKey(): string | null;
|
|
217
342
|
set focusedRowKey(value: string | null);
|
|
343
|
+
private _rowLabel;
|
|
344
|
+
/**
|
|
345
|
+
* Names a row for its selection checkbox ("Select {label}"). Property-only (it
|
|
346
|
+
* holds a function). When unset, or when it returns an empty string, the
|
|
347
|
+
* trimmed text of the row's first data cell is used, and when that is empty
|
|
348
|
+
* too, the row number ("Select row N").
|
|
349
|
+
*
|
|
350
|
+
* The name is a string handed to the checkbox: an `aria-labelledby` pointing
|
|
351
|
+
* at the cell could not cross the checkbox's shadow boundary.
|
|
352
|
+
*/
|
|
353
|
+
get rowLabel(): ((row: unknown) => string) | null;
|
|
354
|
+
set rowLabel(value: ((row: unknown) => string) | null);
|
|
355
|
+
/**
|
|
356
|
+
* Row identity: selection, focus and row-view reuse are keyed by it. It must
|
|
357
|
+
* be stable, and derived from the row rather than its index: a row that is
|
|
358
|
+
* not loaded is keyed `rowKey(row, -1)`, so an index-based key maps every
|
|
359
|
+
* off-page row onto `row--1`. Required with `fetch`.
|
|
360
|
+
*/
|
|
218
361
|
get rowKey(): RowKey;
|
|
219
362
|
set rowKey(value: RowKey);
|
|
220
363
|
/** Enable tree mode (chevron column, nested expansion, lazy children). */
|
|
@@ -250,8 +393,18 @@ export declare class MpDatatable extends LitElement {
|
|
|
250
393
|
set pagination(value: boolean);
|
|
251
394
|
get page(): number;
|
|
252
395
|
set page(value: number);
|
|
396
|
+
/** Assigns without scheduling; true when the page changed. */
|
|
397
|
+
private assignPage;
|
|
253
398
|
get perPage(): number;
|
|
254
399
|
set perPage(value: number);
|
|
400
|
+
/**
|
|
401
|
+
* Moves a page past the end back to the last page, when the row count is
|
|
402
|
+
* known: the server's `totalRecords` with `fetch`, the data length without.
|
|
403
|
+
* Reported through `mp-datatable-page-change` when it moves the page.
|
|
404
|
+
*/
|
|
405
|
+
private clampPageToKnownTotal;
|
|
406
|
+
/** Assigns without scheduling (and returns to page 1); true when it changed. */
|
|
407
|
+
private assignPerPage;
|
|
255
408
|
get perPageOptions(): number[];
|
|
256
409
|
set perPageOptions(value: number[]);
|
|
257
410
|
/**
|
|
@@ -475,6 +628,17 @@ export declare class MpDatatable extends LitElement {
|
|
|
475
628
|
private renderFilterCell;
|
|
476
629
|
private renderHeader;
|
|
477
630
|
private renderRow;
|
|
631
|
+
/**
|
|
632
|
+
* Names every rendered row checkbox (D14): `rowLabel(row)`, else the trimmed
|
|
633
|
+
* text of the row's first data cell, else the row number.
|
|
634
|
+
*
|
|
635
|
+
* Runs after each render rather than in the template because the cell text
|
|
636
|
+
* only exists once the cell is rendered — and it may be consumer DOM from a
|
|
637
|
+
* `cellRenderer` or `rowRenderer` — so a re-rendered cell renames its
|
|
638
|
+
* checkbox on the same update. The attribute is written only when it
|
|
639
|
+
* changes, so an unchanged name costs no mutation.
|
|
640
|
+
*/
|
|
641
|
+
private nameRowCheckboxes;
|
|
478
642
|
private renderRowFromRenderer;
|
|
479
643
|
private renderCell;
|
|
480
644
|
private renderFooter;
|
|
@@ -490,11 +654,40 @@ export declare class MpDatatable extends LitElement {
|
|
|
490
654
|
* `getVirtualSpacerHeights`, aria-rowcount) share one computation.
|
|
491
655
|
*/
|
|
492
656
|
private getFlatList;
|
|
657
|
+
/** `_data` in display order: client-sorted when the WC owns sorting. */
|
|
658
|
+
private localSortedRows;
|
|
659
|
+
/**
|
|
660
|
+
* Drops the flat-list memo. It is otherwise reset only in `willUpdate`, so a
|
|
661
|
+
* path that runs between a data change and the next render (a programmatic
|
|
662
|
+
* setter, an event fired before the re-render) would read the old rows.
|
|
663
|
+
*/
|
|
664
|
+
private freshFlatList;
|
|
665
|
+
/**
|
|
666
|
+
* Every loaded row that has a renderer-assigned key, as `[key, row]`. The keys
|
|
667
|
+
* are the ones the renderer uses (K1): a positional fallback key only means
|
|
668
|
+
* anything at the row's rendered index. With local pagination every page is
|
|
669
|
+
* loaded, so rows of the other pages are keyed by their global index too.
|
|
670
|
+
*/
|
|
671
|
+
private liveRowEntries;
|
|
672
|
+
private _keyByRowMemo;
|
|
673
|
+
/**
|
|
674
|
+
* The key the renderer gives a row object. A row outside the live entries (a
|
|
675
|
+
* child of a collapsed parent, a row only the host knows) has no rendered
|
|
676
|
+
* index, so it falls back to an index-free `rowKey` call — exact for any
|
|
677
|
+
* id-based key, and a positional key is already warned about.
|
|
678
|
+
*/
|
|
679
|
+
private keyOfRow;
|
|
680
|
+
/** `keyOfRow` against the current data, for paths that may run before a re-render. */
|
|
681
|
+
private rowKeyLookup;
|
|
493
682
|
private computeVisibleRows;
|
|
494
683
|
private extractId;
|
|
495
684
|
private extractChildCount;
|
|
496
|
-
/**
|
|
497
|
-
|
|
685
|
+
/**
|
|
686
|
+
* Walks the loaded subtree of `row` and returns `[key, row]` for every
|
|
687
|
+
* descendant — the row too, because a cascade selects it and the selection
|
|
688
|
+
* remembers the rows it selected.
|
|
689
|
+
*/
|
|
690
|
+
private collectDescendants;
|
|
498
691
|
/** Some-but-not-all loaded descendants selected → indeterminate parent checkbox. */
|
|
499
692
|
private isParentIndeterminate;
|
|
500
693
|
/**
|
|
@@ -537,7 +730,13 @@ export declare class MpDatatable extends LitElement {
|
|
|
537
730
|
* change anything.
|
|
538
731
|
*/
|
|
539
732
|
private scheduleFetchReload;
|
|
540
|
-
/**
|
|
733
|
+
/**
|
|
734
|
+
* Row keymap, the same in every mode: ArrowUp/Down move, ArrowRight/Left
|
|
735
|
+
* expand/collapse a tree row, Enter opens (row-click), Space selects.
|
|
736
|
+
* 'single'/'multiple': Enter and Space both select with the click modifiers
|
|
737
|
+
* and emit row-click. 'checkbox': Enter only emits row-click, Space only
|
|
738
|
+
* toggles the row's checkbox.
|
|
739
|
+
*/
|
|
541
740
|
private onRowKeydown;
|
|
542
741
|
private hasRowClickListeners;
|
|
543
742
|
/**
|
|
@@ -548,7 +747,22 @@ export declare class MpDatatable extends LitElement {
|
|
|
548
747
|
private onRowClick;
|
|
549
748
|
private onRowDblClick;
|
|
550
749
|
private onRowContextMenu;
|
|
551
|
-
/**
|
|
750
|
+
/**
|
|
751
|
+
* A click anywhere in the checkbox cell, in every mode. The cell is
|
|
752
|
+
* selection-only, so neither its click nor its double-click reaches the row
|
|
753
|
+
* (D12: a double-click on a checkbox used to open the row).
|
|
754
|
+
*
|
|
755
|
+
* In 'checkbox' mode the whole cell is the hit target, not just the 20px box.
|
|
756
|
+
* A click that went through the checkbox's own shadow root is the checkbox
|
|
757
|
+
* operating itself (its change handler toggles), so it is left alone; every
|
|
758
|
+
* other click toggles here. `closest('mp-checkbox')` cannot tell the two
|
|
759
|
+
* apart: a click on the checkbox host's padding is retargeted to the host yet
|
|
760
|
+
* fires no change, so it would be swallowed (spike S1). No focus() and no
|
|
761
|
+
* preventDefault(): the browser focuses the row natively, which keeps Enter,
|
|
762
|
+
* Space and the arrow keys working from there (spike S4).
|
|
763
|
+
*/
|
|
764
|
+
private onCheckboxCellClick;
|
|
765
|
+
/** Row checkboxes render only in the multi-select modes, so this is multi-select toggling. */
|
|
552
766
|
private onRowCheckboxToggle;
|
|
553
767
|
/**
|
|
554
768
|
* Clears the entire selection. The header checkbox is only rendered when
|
|
@@ -568,11 +782,36 @@ export declare class MpDatatable extends LitElement {
|
|
|
568
782
|
*/
|
|
569
783
|
private _selectionAnchorKey;
|
|
570
784
|
private handleSelectionOnClick;
|
|
785
|
+
/**
|
|
786
|
+
* The one write path for a user-driven selection change. `rows` supplies the
|
|
787
|
+
* row of each key being selected; the remembered rows are then pruned to the
|
|
788
|
+
* new keys, so a deselected row is forgotten in the same step.
|
|
789
|
+
*/
|
|
790
|
+
private commitSelection;
|
|
791
|
+
/**
|
|
792
|
+
* Every row the element holds right now, by key: the loaded rows (keyed as
|
|
793
|
+
* the renderer keys them, K1) plus the fetched children of collapsed parents
|
|
794
|
+
* (through `keyOfRow`'s index-free fallback).
|
|
795
|
+
*/
|
|
796
|
+
private liveRowMap;
|
|
797
|
+
/** Remembers the loaded row of every selected key (a loaded row always wins, D2). */
|
|
798
|
+
private rememberLiveSelectedRows;
|
|
799
|
+
/**
|
|
800
|
+
* True when `pairs` is exactly the current selection: the same keys in the
|
|
801
|
+
* same order, each with the row object the element would report for it.
|
|
802
|
+
*/
|
|
803
|
+
private isSameSelectedRows;
|
|
804
|
+
/** Forgets the rows of keys that left the selection. One pass, deletes in place. */
|
|
805
|
+
private pruneSelectedRowCache;
|
|
571
806
|
private emitSelectionChange;
|
|
572
807
|
/**
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
808
|
+
* Resolves keys to rows, index-aligned with `ids` (D3): the loaded row if
|
|
809
|
+
* there is one, else the row remembered at selection time, else `undefined`.
|
|
810
|
+
*
|
|
811
|
+
* A loaded row also refreshes the remembered one, so a re-fetched row object
|
|
812
|
+
* always wins over a stale copy. Loaded rows are keyed exactly as the
|
|
813
|
+
* renderer keys them (K1); children of collapsed parents have no rendered
|
|
814
|
+
* index and go through `keyOfRow`'s index-free fallback.
|
|
576
815
|
*/
|
|
577
816
|
private resolveRows;
|
|
578
817
|
private gotoPage;
|
package/datatable/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MpDatatable } from './components';
|
|
2
|
-
export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, } from './components';
|
|
2
|
+
export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, DatatableFetchState, DatatableReloadOptions, } from './components';
|
|
3
3
|
export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, FilterRenderer, RowKey, RowRenderer, RowRenderContext, TreeIdKey, TreeSelectionStrategy, DatatableFetchRequest, DatatableFetchResponse, DatatableFetch, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, DistinctValue, DistinctValues, DistinctsRequest, DatatableDistincts, FilterSelection, FilterContext, FilterChangeDetail, ValuesFilterChangeDetail, ComparisonFilterChangeDetail, FilterMode, FilterOperator, FilterInputType, } from './types';
|
|
4
4
|
export type { DatatableLabels } from './types';
|
|
5
5
|
export { DEFAULT_DATATABLE_LABELS } from './types';
|
|
@@ -21,7 +21,13 @@ export interface DatatableLabels {
|
|
|
21
21
|
loading: string;
|
|
22
22
|
rowsPerPage: string;
|
|
23
23
|
resizeColumn: (column: string) => string;
|
|
24
|
+
/** A row checkbox's name when the row yields no text (see `selectRowNamed`). */
|
|
24
25
|
selectRow: (rowNumber: number) => string;
|
|
26
|
+
/**
|
|
27
|
+
* A row checkbox's name, from the datatable's `rowLabel` callback or else the
|
|
28
|
+
* text of the row's first data cell.
|
|
29
|
+
*/
|
|
30
|
+
selectRowNamed: (label: string) => string;
|
|
25
31
|
/** Accessible name of a column's filter trigger in the filter row. */
|
|
26
32
|
filterColumn: (column: string) => string;
|
|
27
33
|
/**
|
|
@@ -80,6 +86,11 @@ export interface DatatableLabels {
|
|
|
80
86
|
announcePage: (page: number, totalPages: number) => string;
|
|
81
87
|
announceSelection: (count: number) => string;
|
|
82
88
|
announceLoaded: (rows: number) => string;
|
|
89
|
+
/**
|
|
90
|
+
* Announced when a Shift range is refused because rows inside it have not
|
|
91
|
+
* loaded yet. The selection is left unchanged.
|
|
92
|
+
*/
|
|
93
|
+
rangeIncomplete: string;
|
|
83
94
|
}
|
|
84
95
|
/** The symbol shown alongside each operator's words. */
|
|
85
96
|
export declare const FILTER_OPERATOR_SYMBOLS: Record<FilterOperator, string>;
|
package/file-manager/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { createRef as C, ref as k } from "lit/directives/ref.js";
|
|
|
9
9
|
import { styleMap as E } from "lit/directives/style-map.js";
|
|
10
10
|
import "../chunks/mp-splitter-DLehrw3Y.mjs";
|
|
11
11
|
import "../chunks/mp-treeview-CaMTDrvY.mjs";
|
|
12
|
-
import "../chunks/mp-datatable-
|
|
12
|
+
import "../chunks/mp-datatable-CEpSxlkd.mjs";
|
|
13
13
|
const M = _(`:host {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|