@mintplayer/web-components 2.14.0 → 2.16.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.
Files changed (63) hide show
  1. package/README.md +15 -0
  2. package/badge/src/styles/badge.styles.d.ts +2 -0
  3. package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
  4. package/chunks/mp-datatable-B7st6G-I.mjs +2238 -0
  5. package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-DsWA1AFs.mjs} +2 -2
  6. package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-CwaAAOcm.mjs} +1 -1
  7. package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
  8. package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-DifgO6jT.mjs} +103 -47
  9. package/datatable/index.mjs +6 -5
  10. package/datatable/src/components/mp-datatable.d.ts +210 -2
  11. package/datatable/src/index.d.ts +4 -2
  12. package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
  13. package/datatable/src/styles/index.d.ts +1 -1
  14. package/datatable/src/types/column-def.d.ts +61 -0
  15. package/datatable/src/types/filter.d.ts +138 -0
  16. package/datatable/src/types/index.d.ts +3 -2
  17. package/datatable/src/types/labels.d.ts +58 -0
  18. package/datepicker/index.mjs +1 -1
  19. package/datetime-picker/index.mjs +1 -1
  20. package/dock/index.mjs +477 -492
  21. package/dock/src/components/mint-dock-manager.element.d.ts +10 -8
  22. package/dock/src/core/index.d.ts +1 -0
  23. package/dock/src/core/intersection-sizing.d.ts +83 -0
  24. package/dock/src/core/layout-tree.d.ts +23 -2
  25. package/dock/src/core/types.d.ts +14 -0
  26. package/file-manager/index.mjs +30 -29
  27. package/file-manager/src/components/mp-file-manager.d.ts +2 -0
  28. package/light-dom/index.d.ts +1 -0
  29. package/light-dom/index.mjs +11 -0
  30. package/light-dom/src/index.d.ts +2 -0
  31. package/light-dom/src/install-light-styles.d.ts +25 -0
  32. package/light-dom/src/scoped-html.d.ts +26 -0
  33. package/navbar/index.mjs +1 -1
  34. package/overlay/index.mjs +5 -2
  35. package/overlay/src/index.d.ts +2 -0
  36. package/overlay/src/overlay-controller.d.ts +27 -0
  37. package/overlay/src/overlay-portal.d.ts +53 -0
  38. package/package.json +5 -1
  39. package/query-builder/index.mjs +1472 -2651
  40. package/query-builder/src/index.d.ts +4 -0
  41. package/query-builder/src/mp-query-builder.element.d.ts +1 -1
  42. package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
  43. package/query-builder/src/mp-query-condition.element.d.ts +1 -1
  44. package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
  45. package/query-builder/src/mp-query-group.element.d.ts +1 -1
  46. package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
  47. package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
  48. package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
  49. package/ribbon/index.mjs +1 -1
  50. package/scheduler/index.mjs +2 -2
  51. package/timepicker/index.mjs +1 -1
  52. package/tree-select/index.mjs +60 -58
  53. package/tree-select/src/components/mp-tree-select.d.ts +1 -1
  54. package/tree-select/src/index.d.ts +1 -1
  55. package/tree-select/src/styles/index.d.ts +1 -1
  56. package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
  57. package/treeview/index.mjs +3 -3
  58. package/treeview/src/components/mp-treeview.d.ts +1 -1
  59. package/treeview/src/index.d.ts +1 -1
  60. package/treeview/src/styles/index.d.ts +1 -1
  61. package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
  62. package/chunks/mp-datatable-GmKqaN8y.mjs +0 -1392
  63. package/datatable/src/styles/datatable.styles.d.ts +0 -2
@@ -1,7 +1,7 @@
1
1
  import { LitElement, TemplateResult } from 'lit';
2
2
  import { DatatableLabels } from '../types/labels';
3
3
  import { SortColumn } from '../sort';
4
- import { DatatableColumnDef, RowKey, RowRenderer, DatatableFetch, TreeIdKey, TreeSelectionStrategy } from '../types';
4
+ import { DatatableColumnDef, RowKey, RowRenderer, DatatableFetch, DatatableDistincts, TreeIdKey, TreeSelectionStrategy } from '../types';
5
5
  export type DatatableSelectionMode = 'none' | 'single' | 'multiple';
6
6
  export interface RowEventDetail<T = unknown> {
7
7
  row: T;
@@ -37,7 +37,15 @@ export interface SelectionChangeEventDetail<T = unknown> {
37
37
  * - Column resize via a 6px handle at the right edge of each header.
38
38
  */
39
39
  export declare class MpDatatable extends LitElement {
40
- static styles: import('lit').CSSResult[];
40
+ /**
41
+ * Light DOM. Consumer-authored row/cell/header content is mounted here by the
42
+ * render callbacks, and inside a shadow root the page's stylesheets — the
43
+ * consumer's own component CSS and Bootstrap's utilities alike — cannot reach
44
+ * it (issue #408). Rendering in the document tree is what makes that content
45
+ * style correctly; encapsulation is preserved by the build-time rescoping
46
+ * instead of by the boundary.
47
+ */
48
+ protected createRenderRoot(): HTMLElement;
41
49
  static get observedAttributes(): string[];
42
50
  private readonly instanceId;
43
51
  private _caption;
@@ -103,6 +111,19 @@ export declare class MpDatatable extends LitElement {
103
111
  private _resizeObserver;
104
112
  private _scrollListener;
105
113
  private _viewportHeight;
114
+ /** Name of the column whose filter panel is open, or null. Only ever one. */
115
+ private _openFilterColumn;
116
+ /** Column whose consumer content is currently mounted in the panel. Guards
117
+ * against re-mounting on every render, which would destroy focus. */
118
+ private _mountedFilterColumn;
119
+ /** Whether the mounted panel is the consumer's node rather than the built-in one. */
120
+ private _consumerMountedFilter;
121
+ /** Unique per instance so several datatables on a page cannot collide on IDREFs. */
122
+ private readonly _filterUid;
123
+ /** Consumer-supplied distinct-value source; null = compute locally when possible. */
124
+ private _distincts;
125
+ /** Per-column filter panel state, keyed by `DatatableColumnDef.name`. */
126
+ private readonly _filterStates;
106
127
  private _tree;
107
128
  private _idKey;
108
129
  private _childCountKey;
@@ -153,6 +174,18 @@ export declare class MpDatatable extends LitElement {
153
174
  set virtualBuffer(value: number);
154
175
  get columns(): DatatableColumnDef[];
155
176
  set columns(value: DatatableColumnDef[]);
177
+ /**
178
+ * Drops state for columns that are gone and seeds state for new ones from
179
+ * `filterSelection`.
180
+ *
181
+ * An existing column keeps its state: the Angular wrapper rebuilds the whole
182
+ * column array on every change detection, so treating a re-assignment as
183
+ * "new columns" would wipe the user's selection on any unrelated input change.
184
+ * A column whose `filterSelection` reference actually changed is re-seeded —
185
+ * that is the consumer restoring a filter, and it is why the input is a
186
+ * reference and not a value.
187
+ */
188
+ private syncFilterStates;
156
189
  get data(): unknown[];
157
190
  set data(value: unknown[]);
158
191
  /**
@@ -163,6 +196,15 @@ export declare class MpDatatable extends LitElement {
163
196
  */
164
197
  get fetch(): DatatableFetch | null;
165
198
  set fetch(value: DatatableFetch | null);
199
+ /**
200
+ * Consumer-supplied source of distinct values for the filter panels.
201
+ * Property-only (it holds a function), mirroring `fetch` and `labels`.
202
+ *
203
+ * A source that resolves `null` for a column means "compute that column
204
+ * locally", so one table can mix server-backed and local filter columns.
205
+ */
206
+ get distincts(): DatatableDistincts | null;
207
+ set distincts(value: DatatableDistincts | null);
166
208
  get sortColumns(): SortColumn[];
167
209
  set sortColumns(value: SortColumn[]);
168
210
  get selectionMode(): DatatableSelectionMode;
@@ -237,6 +279,12 @@ export declare class MpDatatable extends LitElement {
237
279
  protected firstUpdated(): void;
238
280
  protected willUpdate(changedProperties: Map<string, unknown>): void;
239
281
  protected updated(changedProperties: Map<string, unknown>): void;
282
+ /**
283
+ * Publish header row 1's height as `--mp-datatable-header-height` for the
284
+ * filter row's sticky offset. Cheap and idempotent: it writes only on change,
285
+ * so it cannot feed back into the render loop.
286
+ */
287
+ private publishHeaderHeight;
240
288
  /**
241
289
  * Run the auto-size-once pass after the first batch of rows lands in the
242
290
  * DOM. Columns with an explicit `col.width` are pinned to that value
@@ -265,6 +313,166 @@ export declare class MpDatatable extends LitElement {
265
313
  private maybeFetchPagesInViewport;
266
314
  render(): TemplateResult;
267
315
  private getVirtualSpacerHeights;
316
+ /** True when any column opted in. No column opts in, no second row, no cost. */
317
+ private get hasFilterRow();
318
+ private get filterPanelId();
319
+ private filterTriggerId;
320
+ private createFilterState;
321
+ /** State for a filterable column, created on demand. */
322
+ private filterState;
323
+ private notifyFilterListeners;
324
+ private abortFilterRequest;
325
+ /**
326
+ * Replaces a column's selection and emits the one event the component owns.
327
+ *
328
+ * The component never filters `_data` itself — what a selection means, and
329
+ * whether it is applied here or on a server, belongs to the consumer. All it
330
+ * does locally is snapshot the value list the first time a selection becomes
331
+ * non-empty, so the list cannot collapse to the selection.
332
+ */
333
+ private applyFilter;
334
+ /** The column's mode, defaulting to a checkbox list of distinct values. */
335
+ private filterModeOf;
336
+ private clearFilter;
337
+ /**
338
+ * Comparison mode's counterpart to `applyFilter`.
339
+ *
340
+ * It keeps the same contract: the component records what the user asked for
341
+ * and emits it, and never filters `_data`. An empty operand is a cleared
342
+ * filter, not a comparison against the empty string — otherwise every column
343
+ * would filter everything away the moment its panel opened.
344
+ */
345
+ private applyComparison;
346
+ /**
347
+ * An empty input, and a `'number'` input holding something unparseable, both
348
+ * mean "no filter" rather than a comparison against `NaN` — which would be
349
+ * false for every row and silently empty the table.
350
+ */
351
+ private parseOperand;
352
+ private setFilterSearch;
353
+ /**
354
+ * Loads (or recomputes) one column's value list.
355
+ *
356
+ * Called on every panel open — there is no cross-open cache, because the data
357
+ * behind a list can change while the panel is closed and a stale list is worse
358
+ * than a re-query. The source is asked first; a source resolving `null` means
359
+ * it cannot answer for this column, and the local path takes over.
360
+ */
361
+ private loadDistincts;
362
+ /**
363
+ * Recomputes the OPEN column's list when it is locally derived and the rows
364
+ * changed under it.
365
+ *
366
+ * This is what makes the `remaining` bucket work at all. A consumer applies a
367
+ * filter by rebinding `data` to the subset; if the list were not recomputed,
368
+ * `loaded` would still describe the pre-filter rows, every snapshot value
369
+ * would still look present, and nothing would ever be marked as having left
370
+ * the data.
371
+ *
372
+ * Only the open column, and only the local path: a closed panel reloads when
373
+ * it opens, and a consumer-supplied source owns its own freshness — re-asking
374
+ * it on every `data` assignment would be a request per keystroke of whatever
375
+ * the consumer's own filtering does.
376
+ */
377
+ private refreshLocalDistincts;
378
+ /**
379
+ * The value list computed from the rows this element holds — but only when it
380
+ * holds all of them.
381
+ *
382
+ * With a `fetch` callback, external paging, or loaded tree children, `_data`
383
+ * is a window onto a larger set, and a list built from a window silently omits
384
+ * values. There is no partial answer worth giving there: the column reports
385
+ * that it has no values and the consumer is expected to supply `distincts`.
386
+ */
387
+ private localDistincts;
388
+ /**
389
+ * Re-derives `matching` / `remaining` from the snapshot and the search term.
390
+ *
391
+ * `remaining` holds snapshot values the current list no longer contains: they
392
+ * stay listed (dimmed) so a selection can be widened. Search is applied to
393
+ * both buckets client-side — the debounced re-query above is the exception,
394
+ * not the rule.
395
+ */
396
+ private rebucket;
397
+ /** The open column's trigger button, or null. Re-queried on every call. */
398
+ private openFilterTrigger;
399
+ /**
400
+ * The filter panel is portalled to the document root, because an in-flow
401
+ * panel opened from a header cell is clipped by `.datatable-scroll` — on the
402
+ * right in paged mode, and on both axes in virtual mode, measured in three
403
+ * engines. Positioning stays the controller's job; only DOM ownership moves.
404
+ *
405
+ * No local scroll listener is needed. `scroll` does not compose, so a
406
+ * component whose scroller lives in a shadow root must re-dispatch it (see
407
+ * `mp-scheduler`) — but `.datatable-scroll` is in the LIGHT DOM, so the
408
+ * controller's document-level capture listener already sees it and
409
+ * `scrollStrategy: 'reposition'` works as-is. Do not copy the scheduler's
410
+ * workaround here; it would be redundant.
411
+ */
412
+ private readonly filterOverlay;
413
+ private onFilterTriggerClick;
414
+ /**
415
+ * Renders the open panel into the overlay pane, with a render root of its
416
+ * own. The panel is NOT part of this element's template: relocating a node
417
+ * lit rendered is unsupported, so the pane gets its own `render()` call
418
+ * whose container happens to live in `document.body`.
419
+ *
420
+ * The consumer's node is appended AFTER the template has been stamped —
421
+ * `stampScope` recurses, so stamping a subtree that already holds consumer
422
+ * DOM would brand it with our scope and let our rules match their content.
423
+ *
424
+ * ### Why this dialog is deliberately NOT `aria-modal` (#416)
425
+ *
426
+ * Tab is contained and Escape closes, but the rest of the page stays
427
+ * available to assistive tech — and it must. A column filter is anchored to
428
+ * its trigger, dismissible, and does not own the page.
429
+ *
430
+ * `aria-modal="true"` would tell a screen reader that everything outside the
431
+ * panel is unavailable while a virtual cursor could still walk into the table
432
+ * behind it. The honest way to keep that promise — marking the table `inert`
433
+ * while the panel is open — would hide the very rows whose values the user is
434
+ * picking from, which is worse than the inconsistency it fixes.
435
+ *
436
+ * So it is a non-modal dialog: the wrong claim removed rather than an
437
+ * unfinished one completed. `OverlayController` is right to refuse to guess
438
+ * whether its host is a dialog or a menu; the call belongs here, where the
439
+ * component knows what it is.
440
+ */
441
+ private renderFilterPanel;
442
+ /**
443
+ * The built-in panel: clear, search, invert, checkbox list.
444
+ *
445
+ * Rendered with a `render()` of its own into the panel body, for the same
446
+ * reason the panel itself is: this is not part of the element's template, and
447
+ * lit must own the container it diffs. The checkbox list is keyed on `value`
448
+ * so a repaint after a re-query moves rows instead of rebuilding them — an
449
+ * unkeyed list would rebuild the input the user is interacting with.
450
+ */
451
+ private renderDefaultFilterPanel;
452
+ /**
453
+ * The `'comparison'` panel: an operator and one operand.
454
+ *
455
+ * It deliberately does NOT load distinct values — the whole point of this mode
456
+ * is that the column's values are a quantity rather than a set worth listing,
457
+ * so asking the source for them would be a round trip whose answer is never
458
+ * displayed.
459
+ */
460
+ private renderComparisonFilterPanel;
461
+ private onFilterToggle;
462
+ private onFilterClear;
463
+ /**
464
+ * The second `<thead>` row. One cell per column in the SAME order as row 1,
465
+ * gutters included — alignment is structural, not a CSS problem, and the
466
+ * empty cells for non-filterable columns are what keeps it that way.
467
+ *
468
+ * The cells deliberately carry no width. Widths live on row 1's `<th>`, and
469
+ * `table-layout: fixed` resolves columns from the first row only, so this row
470
+ * cannot perturb geometry once the measure pass has run. Before it runs the
471
+ * table is `auto`, where the row is only harmless because `.filter-trigger`
472
+ * is width-neutral — see the note on that rule in `datatable.light.scss`.
473
+ */
474
+ private renderFilterRow;
475
+ private renderFilterCell;
268
476
  private renderHeader;
269
477
  private renderRow;
270
478
  private renderRowFromRenderer;
@@ -1,6 +1,8 @@
1
1
  export { MpDatatable } from './components';
2
2
  export type { DatatableSelectionMode, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, } from './components';
3
- export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, RowRenderContext, TreeIdKey, TreeSelectionStrategy, DatatableFetchRequest, DatatableFetchResponse, DatatableFetch, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, } from './types';
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
+ export type { DatatableLabels } from './types';
5
+ export { DEFAULT_DATATABLE_LABELS } from './types';
4
6
  export type { SortColumn, SortDirection } from './sort';
5
7
  export { computeNextSort, sortRows } from './sort';
6
- export { datatableStyles } from './styles';
8
+ export { datatableLightStyles } from './styles';
@@ -0,0 +1,2 @@
1
+ export declare const datatableLightStyles: import('lit').CSSResult;
2
+ export default datatableLightStyles;
@@ -1 +1 @@
1
- export { datatableStyles } from './datatable.styles';
1
+ export { datatableLightStyles } from './datatable.light.styles';
@@ -1,4 +1,5 @@
1
1
  import { TemplateResult } from 'lit';
2
+ import { FilterContext, FilterInputType, FilterMode, FilterOperator, FilterSelection } from './filter';
2
3
  export type CellContent = string | number | boolean | null | undefined | TemplateResult | Node;
3
4
  export type CellRenderer<T = unknown> = (row: T, column: DatatableColumnDef<T>, rowIndex: number) => CellContent;
4
5
  export type HeaderRenderer<T = unknown> = (column: DatatableColumnDef<T>) => CellContent;
@@ -23,6 +24,20 @@ export interface RowRenderContext {
23
24
  * into the WC's shadow DOM via EmbeddedViewRef-managed nodes.
24
25
  */
25
26
  export type RowRenderer<T = unknown> = (row: T | undefined, rowIndex: number, context?: RowRenderContext) => ReadonlyArray<Node> | Node | undefined;
27
+ /**
28
+ * Contents of a column's filter panel. Like every other renderer here, it is a
29
+ * plain function returning a DOM `Node` — the component appends it and never
30
+ * asks where it came from, so React/Vue pass one directly and the Angular
31
+ * wrapper bridges an `ng-template` through an `EmbeddedViewRef`.
32
+ *
33
+ * Returning `null` means "use the built-in panel" — that is what a wrapper
34
+ * returns when the consumer declared no override, and it is why a wrapper can
35
+ * install this unconditionally instead of deciding up front.
36
+ *
37
+ * The returned node is the CONSUMER's DOM: it is never stamped with this
38
+ * component's style scope, and none of its rules reach inside.
39
+ */
40
+ export type FilterRenderer<T = unknown> = (column: DatatableColumnDef<T>, context: FilterContext) => Node | null;
26
41
  export interface DatatableColumnDef<T = unknown> {
27
42
  /** Data property name + sort key. */
28
43
  name: string;
@@ -38,4 +53,50 @@ export interface DatatableColumnDef<T = unknown> {
38
53
  headerRenderer?: HeaderRenderer<T>;
39
54
  /** Forwarded to the cell as `class` attribute. */
40
55
  cellClass?: string;
56
+ /**
57
+ * Opt this column into the filter row. Default `false` — deliberately the
58
+ * opposite of `sortable`, because adding the row is a visible change to the
59
+ * table. The row itself is emitted only when at least one column sets this.
60
+ */
61
+ filterable?: boolean;
62
+ /**
63
+ * Contents of this column's filter panel. Ignored unless `filterable`.
64
+ * Absent — or present and returning `null` — renders the built-in panel.
65
+ */
66
+ filterRenderer?: FilterRenderer<T>;
67
+ /**
68
+ * Purely visual: marks the trigger as "this column has an active filter".
69
+ * The component attaches no meaning to it — what counts as active, and when,
70
+ * belongs to the consumer.
71
+ */
72
+ filterActive?: boolean;
73
+ /**
74
+ * Short description of the active filter, rendered on the trigger and folded
75
+ * into its accessible name. Also consumer-owned: the component never derives
76
+ * it from a selection, because only the consumer knows what it filtered on.
77
+ */
78
+ filterSummary?: string;
79
+ /**
80
+ * Initial (or externally restored) selection for this column's panel. Read
81
+ * when `columns` is set; the component then owns the selection until the next
82
+ * `columns` assignment, so this is a seed, not a binding.
83
+ */
84
+ filterSelection?: FilterSelection;
85
+ /**
86
+ * Which question the built-in panel asks: a checkbox list of distinct values
87
+ * (default) or an operator plus one operand. Ignored when `filterRenderer`
88
+ * returns a node, which replaces the panel entirely.
89
+ */
90
+ filterMode?: FilterMode;
91
+ /**
92
+ * `type` of the operand input in `'comparison'` mode. Default `'number'`,
93
+ * and it also decides how the operand is parsed back out. There is no text
94
+ * option -- a free-text filter is a nest-your-own case, see FilterInputType.
95
+ */
96
+ filterInputType?: FilterInputType;
97
+ /**
98
+ * Operators offered in `'comparison'` mode, in the order shown. Defaults to
99
+ * all six; narrow it when only some make sense (equality alone for an id).
100
+ */
101
+ filterOperators?: FilterOperator[];
41
102
  }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Types for the distinct-value filter panel.
3
+ *
4
+ * The component owns the *panel*, never the *filtering*: it collects a
5
+ * selection and emits it. Which rows that selection removes, and whether the
6
+ * removal happens client-side or on a server, belongs to the consumer.
7
+ */
8
+ /**
9
+ * One selectable entry in the filter panel's checkbox list.
10
+ *
11
+ * `value` is the raw cell value and is what a consumer matches on; `label` is
12
+ * what the user reads. Identity across re-queries is `value` under SameValueZero
13
+ * (so `NaN` matches itself), never `label` — two rows can render the same text.
14
+ */
15
+ export interface DistinctValue {
16
+ value: unknown;
17
+ label: string;
18
+ }
19
+ /**
20
+ * The value list backing one column's panel, split into the two buckets the
21
+ * panel renders differently.
22
+ *
23
+ * `matching` are values present in the data as currently filtered. `remaining`
24
+ * are values that were present when the column's filter was first applied but
25
+ * are not any more — they stay listed (dimmed) so a user can widen a selection
26
+ * without first clearing it. `hasMore` reports that the source truncated the
27
+ * list, which is what drives a re-query as the user types.
28
+ */
29
+ export interface DistinctValues {
30
+ matching: DistinctValue[];
31
+ remaining: DistinctValue[];
32
+ hasMore: boolean;
33
+ }
34
+ /** One request for a column's distinct values. */
35
+ export interface DistinctsRequest {
36
+ /** `DatatableColumnDef.name` of the column whose panel is open. */
37
+ column: string;
38
+ /** Current search term; `''` when the user has typed nothing. */
39
+ search: string;
40
+ /** Aborted when the panel closes or a newer request supersedes this one. */
41
+ signal: AbortSignal;
42
+ }
43
+ /**
44
+ * Consumer-supplied source of distinct values.
45
+ *
46
+ * Resolving `null` means "I have nothing for this column" and the component
47
+ * falls back to computing the list locally from the rows it holds — which it
48
+ * can only do when it holds all of them (no `fetch`, not externally paged, no
49
+ * tree children). A source that returns `null` for a column it cannot answer is
50
+ * therefore the correct way to mix server-backed and local columns in one table.
51
+ */
52
+ export type DatatableDistincts = (request: DistinctsRequest) => Promise<DistinctValues | null>;
53
+ /**
54
+ * How a column's built-in panel asks the question.
55
+ *
56
+ * `'values'` lists the column's distinct values as checkboxes. `'comparison'`
57
+ * offers an operator and a single operand — the right shape for a quantity,
58
+ * where ticking forty individual years is a poor way to say "after 1990".
59
+ *
60
+ * The consumer picks this per column and the component never infers it: a
61
+ * numeric column is often an enum (a year, in a five-row table) and a string
62
+ * column is often ordinal, so any guess would be wrong about half the time.
63
+ */
64
+ export type FilterMode = 'values' | 'comparison';
65
+ /** The comparison a `'comparison'` panel applies. */
66
+ export type FilterOperator = 'eq' | 'neq' | 'lt' | 'lte' | 'gt' | 'gte';
67
+ /**
68
+ * The `type` of the operand input in a `'comparison'` panel.
69
+ *
70
+ * Quantities only, and deliberately no `'text'`. A comparison against a string
71
+ * is either exact-match — which `'values'` already does better, with a list —
72
+ * or a lexicographic `>`, which is almost never what someone means by
73
+ * "filter this column". **A free-text filter is a nest-your-own case**: supply a
74
+ * `filterRenderer` (Angular: `*bsDatatableFilterPanel`) and drive it from the
75
+ * same `FilterContext` the built-in panels use. There is no `contains` operator
76
+ * for the same reason.
77
+ */
78
+ export type FilterInputType = 'number' | 'date';
79
+ /** A column's current filter selection. */
80
+ export interface FilterSelection {
81
+ values: DistinctValue[];
82
+ /** `true` = exclude the selected values instead of including them. */
83
+ inverse: boolean;
84
+ /** Comparison-mode operator. Ignored in `'values'` mode. */
85
+ operator?: FilterOperator;
86
+ /**
87
+ * Comparison-mode operand: a `number` for `filterInputType: 'number'`, an
88
+ * ISO `yyyy-mm-dd` string for `'date'`, otherwise the raw text. `null` means
89
+ * the user has not entered one, and no filter is active.
90
+ */
91
+ operand?: string | number | null;
92
+ }
93
+ /**
94
+ * Handed to `FilterRenderer` so a consumer's own panel can drive the same
95
+ * machinery the default panel uses — the value list, the search re-query and
96
+ * the change event are the component's, whatever renders them.
97
+ *
98
+ * `values()` and `loading()` are plain getters, not signals: the WC core is
99
+ * framework-agnostic. Re-render on `onChange`.
100
+ */
101
+ export interface FilterContext {
102
+ /** The current list, or `null` while nothing has loaded (or nothing can). */
103
+ values(): DistinctValues | null;
104
+ /** `true` while a source request for this column is in flight. */
105
+ loading(): boolean;
106
+ /** Set the search term. Debounced; re-queries the source only when needed. */
107
+ search(term: string): void;
108
+ /** Replace the selection and emit the change event. */
109
+ apply(values: DistinctValue[], inverse: boolean): void;
110
+ /** Clear the selection, reset `inverse`, and emit the change event. */
111
+ clear(): void;
112
+ /** Subscribe to value-list and selection changes. Returns an unsubscribe. */
113
+ onChange(callback: () => void): () => void;
114
+ }
115
+ /**
116
+ * Detail of the `mp-datatable-filter-change` event.
117
+ *
118
+ * A discriminated union on `mode`, not one flat shape with half its fields
119
+ * unset: a consumer switching on `mode` cannot then read a field the other mode
120
+ * never fills, which is the mistake a single optional-everything interface
121
+ * invites. Clearing fires the shape of the column's own mode, emptied.
122
+ */
123
+ export type FilterChangeDetail = ValuesFilterChangeDetail | ComparisonFilterChangeDetail;
124
+ export interface ValuesFilterChangeDetail {
125
+ mode: 'values';
126
+ /** `DatatableColumnDef.name` of the column whose selection changed. */
127
+ column: string;
128
+ /** Empty when the user cleared the filter. */
129
+ selected: DistinctValue[];
130
+ inverse: boolean;
131
+ }
132
+ export interface ComparisonFilterChangeDetail {
133
+ mode: 'comparison';
134
+ column: string;
135
+ operator: FilterOperator;
136
+ /** `null` when the user cleared the filter or emptied the input. */
137
+ operand: string | number | null;
138
+ }
@@ -1,4 +1,5 @@
1
- export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, RowKey, RowRenderer, RowRenderContext, } from './column-def';
1
+ export type { DatatableColumnDef, CellContent, CellRenderer, HeaderRenderer, FilterRenderer, RowKey, RowRenderer, RowRenderContext, } from './column-def';
2
+ export type { DistinctValue, DistinctValues, DistinctsRequest, DatatableDistincts, FilterSelection, FilterContext, FilterChangeDetail, ValuesFilterChangeDetail, ComparisonFilterChangeDetail, FilterMode, FilterOperator, FilterInputType, } from './filter';
2
3
  export type { DatatableFetchRequest, DatatableFetchResponse, DatatableFetch, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, TreeIdKey, TreeSelectionStrategy, } from './tree';
3
- export { DEFAULT_DATATABLE_LABELS } from './labels';
4
+ export { DEFAULT_DATATABLE_LABELS, FILTER_OPERATOR_SYMBOLS, DEFAULT_FILTER_OPERATORS } from './labels';
4
5
  export type { DatatableLabels } from './labels';
@@ -1,3 +1,4 @@
1
+ import { FilterOperator } from './filter';
1
2
  /**
2
3
  * User-visible strings rendered by `<mp-datatable>`. Consumers override via the
3
4
  * `labels` property; merge semantics are partial — any key the consumer omits
@@ -21,10 +22,67 @@ export interface DatatableLabels {
21
22
  rowsPerPage: string;
22
23
  resizeColumn: (column: string) => string;
23
24
  selectRow: (rowNumber: number) => string;
25
+ /** Accessible name of a column's filter trigger in the filter row. */
26
+ filterColumn: (column: string) => string;
27
+ /**
28
+ * Accessible name of a filter trigger whose column is filtered. `summary` is
29
+ * the column's `filterSummary` when it set one — a formatter, not a suffix,
30
+ * because a translation may need it first.
31
+ */
32
+ filterColumnActive: (column: string, summary?: string) => string;
33
+ /** The filter panel's Clear button. */
34
+ filterClear: (column: string) => string;
35
+ /** The filter panel's search box. */
36
+ filterSearch: string;
37
+ /** The filter panel's include/exclude toggle. */
38
+ filterInvert: string;
39
+ /** Accessible name of the filter panel's checkbox list. */
40
+ filterGroup: (column: string) => string;
41
+ /** Shown when the source truncated the value list. */
42
+ filterHasMore: string;
43
+ /** Shown when no value list could be produced for this column. */
44
+ filterNoValues: string;
45
+ /**
46
+ * Renders one distinct value as a checkbox label.
47
+ *
48
+ * The default implementation reads `filterNone` / `filterEmpty` /
49
+ * `filterTrue` / `filterFalse` off `this`, so it is invoked as a METHOD on
50
+ * the merged label set and a consumer translating only those four keys gets
51
+ * them. A consumer who replaces `filterValue` outright owns all four cases.
52
+ */
53
+ filterValue: (this: DatatableLabels, value: unknown) => string;
54
+ /** `filterValue`'s rendering of `null` / `undefined`. */
55
+ filterNone: string;
56
+ /** `filterValue`'s rendering of the empty string. */
57
+ filterEmpty: string;
58
+ /** `filterValue`'s rendering of `true`. */
59
+ filterTrue: string;
60
+ /** `filterValue`'s rendering of `false`. */
61
+ filterFalse: string;
62
+ /** Announced when a column's filter selection changes. */
63
+ announceFilter: (column: string, count: number) => string;
64
+ /** Accessible name of the operator selector in a comparison panel. */
65
+ filterOperator: string;
66
+ /** Accessible name of the operand input in a comparison panel. */
67
+ filterOperand: string;
68
+ /**
69
+ * Visible text of each operator option.
70
+ *
71
+ * Words, not bare glyphs: `<` and `>` are read as "less than sign" by some
72
+ * screen readers and not at all by others, and the symbol is carried
73
+ * separately so the option still reads as a symbol to sighted users.
74
+ */
75
+ filterOperatorLabel: (operator: FilterOperator) => string;
76
+ /** Announced when a comparison filter changes. */
77
+ announceComparisonFilter: (column: string, operator: string, operand: string) => string;
24
78
  /** Live-region announcements (Phase E). */
25
79
  announceSorted: (column: string, direction: 'ascending' | 'descending' | 'none') => string;
26
80
  announcePage: (page: number, totalPages: number) => string;
27
81
  announceSelection: (count: number) => string;
28
82
  announceLoaded: (rows: number) => string;
29
83
  }
84
+ /** The symbol shown alongside each operator's words. */
85
+ export declare const FILTER_OPERATOR_SYMBOLS: Record<FilterOperator, string>;
86
+ /** Every operator, in the order a panel offers them when a column names none. */
87
+ export declare const DEFAULT_FILTER_OPERATORS: FilterOperator[];
30
88
  export declare const DEFAULT_DATATABLE_LABELS: DatatableLabels;
@@ -1,6 +1,6 @@
1
1
  import { html as d, unsafeCSS as u, LitElement as p, nothing as c } from "lit";
2
2
  import { query as a } from "lit/decorators.js";
3
- import { O as h } from "../chunks/overlay-controller-D6agzzOI.mjs";
3
+ import { O as h } from "../chunks/overlay-controller-DifgO6jT.mjs";
4
4
  import "lit/directives/ref.js";
5
5
  import { H as b } from "../chunks/host-aria-WSGs7SPQ.mjs";
6
6
  import "../chunks/mp-calendar.element-CJ8-t-Zn.mjs";
@@ -1,4 +1,4 @@
1
- import { M as m } from "../chunks/mp-datetime-picker.element-D1CiLbHm.mjs";
1
+ import { M as m } from "../chunks/mp-datetime-picker.element-DsWA1AFs.mjs";
2
2
  export {
3
3
  m as MpDatetimePickerElement
4
4
  };