@mintplayer/web-components 2.15.0 → 2.17.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/accordion/index.mjs +5 -5
- package/calendar/index.mjs +1 -1
- package/carousel/index.mjs +57 -143
- package/charts/core/index.mjs +30 -20
- package/charts/core/src/attributes.d.ts +18 -0
- package/charts/core/src/index.d.ts +2 -0
- package/charts/core/src/view-window.d.ts +46 -0
- package/charts/hierarchy/index.mjs +245 -256
- package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
- package/charts/sparkline/index.mjs +27 -26
- package/charts/trend/index.mjs +21 -20
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +1 -0
- package/chunks/attributes-L3eKsbdy.mjs +16 -0
- package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
- package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
- package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
- package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
- package/chunks/mp-datatable-eRpl7-2V.mjs +2238 -0
- package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
- package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
- package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
- package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
- package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
- package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
- package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
- package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
- package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-BHDagokg.mjs} +130 -70
- package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
- package/chunks/view-window-DGvFiDnW.mjs +263 -0
- package/code-snippet/index.mjs +70 -66
- package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
- package/custom-elements.json +65750 -0
- package/datatable/index.mjs +6 -5
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/mp-datatable.d.ts +206 -1
- package/datatable/src/index.d.ts +3 -1
- package/datatable/src/types/column-def.d.ts +61 -0
- package/datatable/src/types/filter.d.ts +138 -0
- package/datatable/src/types/index.d.ts +3 -2
- package/datatable/src/types/labels.d.ts +58 -0
- package/datepicker/index.mjs +10 -9
- package/datetime-picker/index.mjs +1 -1
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
- package/dock/index.mjs +430 -463
- package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
- package/dock/src/core/resize.d.ts +60 -0
- package/dropdown-menu/index.mjs +4 -2
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
- package/dropdown-menu/src/index.d.ts +1 -1
- package/dropdown-menu/src/types/dropdown.d.ts +14 -1
- package/dropdown-menu/src/types/index.d.ts +1 -1
- package/file-manager/index.mjs +63 -61
- package/file-manager/src/components/mp-file-manager.d.ts +4 -3
- package/multi-range/index.mjs +56 -50
- package/multi-range/src/mint-multi-range.element.d.ts +4 -10
- package/multi-range/src/pointer-geometry.d.ts +31 -0
- package/navbar/index.mjs +89 -439
- package/overlay/index.mjs +5 -2
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +27 -14
- package/overlay/src/overlay-portal.d.ts +53 -0
- package/overlay/src/placement.d.ts +48 -0
- package/package.json +7 -1
- package/pagination/index.mjs +1 -1
- package/phone-input/index.mjs +44 -40
- package/phone-input/src/components/stack.d.ts +8 -0
- package/query-builder/index.mjs +418 -466
- package/query-builder/src/dnd/drag-controller.d.ts +12 -8
- package/query-builder/src/mp-query-builder.element.d.ts +5 -1
- package/query-builder/src/mp-query-condition.element.d.ts +1 -0
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +1 -1
- package/ribbon/index.mjs +477 -498
- package/ribbon/src/core/band-text-color.d.ts +10 -0
- package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
- package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
- package/ribbon/src/mp-ribbon.element.d.ts +0 -27
- package/scheduler/index.mjs +726 -711
- package/scheduler/src/components/mp-scheduler.d.ts +19 -3
- package/scheduler/src/drag/drag-manager.d.ts +1 -9
- package/scheduler/src/input/input-handler.d.ts +12 -2
- package/scheduler/src/utils/geometry.d.ts +39 -0
- package/scheduler/src/views/timeline-view.d.ts +0 -1
- package/scheduler-core/index.mjs +84 -71
- package/scheduler-core/src/services/resource.service.d.ts +0 -12
- package/scheduler-core/src/services/timeline.service.d.ts +0 -9
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +1 -0
- package/signature-pad/index.mjs +21 -23
- package/signature-pad/src/canvas-point.d.ts +26 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +16 -0
- package/splitter/src/managers/index.d.ts +1 -0
- package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
- package/swiper-core/index.mjs +2 -2
- package/theming/bs-theme-preboot.js +1 -0
- package/theming/color-mode.css +36 -0
- package/theming/index.d.ts +1 -0
- package/theming/index.mjs +327 -0
- package/theming/src/components/mp-theme-toggle.d.ts +71 -0
- package/theming/src/cookie.d.ts +31 -0
- package/theming/src/index.d.ts +5 -0
- package/theming/src/preboot.d.ts +1 -0
- package/theming/src/resolve.d.ts +36 -0
- package/theming/src/store.d.ts +27 -0
- package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
- package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
- package/theming/src/toggle-modes.d.ts +23 -0
- package/tile-manager/index.mjs +252 -211
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
- package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
- package/timeline/index.mjs +156 -164
- package/timeline/src/components/mp-timeline.d.ts +41 -7
- package/timepicker/index.mjs +7 -4
- package/timepicker/src/mp-time-list.element.d.ts +26 -0
- package/timepicker/src/mp-timepicker.element.d.ts +3 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +21 -9
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +6 -4
- package/chunks/color-DIeST-IS.mjs +0 -224
- package/chunks/mp-datatable-UJI8E73X.mjs +0 -1400
- package/datatable/src/styles/datatable.styles.d.ts +0 -2
- package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
package/datatable/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as s, M as e, c as o, d as A, s as L } from "../chunks/mp-datatable-eRpl7-2V.mjs";
|
|
2
2
|
export {
|
|
3
|
-
s as
|
|
4
|
-
e as
|
|
5
|
-
o as
|
|
6
|
-
|
|
3
|
+
s as DEFAULT_DATATABLE_LABELS,
|
|
4
|
+
e as MpDatatable,
|
|
5
|
+
o as computeNextSort,
|
|
6
|
+
A as datatableLightStyles,
|
|
7
|
+
L as sortRows
|
|
7
8
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Narrowest width, in px, a column can be resized to — by pointer or by keyboard. */
|
|
2
|
+
export declare const MIN_COLUMN_WIDTH = 40;
|
|
3
|
+
/** Width change, in px, of one ArrowLeft/ArrowRight press on a resize handle. */
|
|
4
|
+
export declare const KEYBOARD_RESIZE_STEP = 10;
|
|
5
|
+
/**
|
|
6
|
+
* The width a column takes after being resized by `delta` px from
|
|
7
|
+
* `startWidth`, clamped to the shared floor. One function for both input
|
|
8
|
+
* paths, so a pointer drag and a keyboard press can never disagree about the
|
|
9
|
+
* floor.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resizedColumnWidth(startWidth: number, delta: number): number;
|
|
@@ -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;
|
|
@@ -111,6 +111,19 @@ export declare class MpDatatable extends LitElement {
|
|
|
111
111
|
private _resizeObserver;
|
|
112
112
|
private _scrollListener;
|
|
113
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;
|
|
114
127
|
private _tree;
|
|
115
128
|
private _idKey;
|
|
116
129
|
private _childCountKey;
|
|
@@ -161,6 +174,18 @@ export declare class MpDatatable extends LitElement {
|
|
|
161
174
|
set virtualBuffer(value: number);
|
|
162
175
|
get columns(): DatatableColumnDef[];
|
|
163
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;
|
|
164
189
|
get data(): unknown[];
|
|
165
190
|
set data(value: unknown[]);
|
|
166
191
|
/**
|
|
@@ -171,6 +196,15 @@ export declare class MpDatatable extends LitElement {
|
|
|
171
196
|
*/
|
|
172
197
|
get fetch(): DatatableFetch | null;
|
|
173
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);
|
|
174
208
|
get sortColumns(): SortColumn[];
|
|
175
209
|
set sortColumns(value: SortColumn[]);
|
|
176
210
|
get selectionMode(): DatatableSelectionMode;
|
|
@@ -245,6 +279,12 @@ export declare class MpDatatable extends LitElement {
|
|
|
245
279
|
protected firstUpdated(): void;
|
|
246
280
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
247
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;
|
|
248
288
|
/**
|
|
249
289
|
* Run the auto-size-once pass after the first batch of rows lands in the
|
|
250
290
|
* DOM. Columns with an explicit `col.width` are pinned to that value
|
|
@@ -273,6 +313,166 @@ export declare class MpDatatable extends LitElement {
|
|
|
273
313
|
private maybeFetchPagesInViewport;
|
|
274
314
|
render(): TemplateResult;
|
|
275
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;
|
|
276
476
|
private renderHeader;
|
|
277
477
|
private renderRow;
|
|
278
478
|
private renderRowFromRenderer;
|
|
@@ -340,10 +540,15 @@ export declare class MpDatatable extends LitElement {
|
|
|
340
540
|
/** Keyboard handling on a tree-mode row. Arrow keys + Enter/Space toggle expansion. */
|
|
341
541
|
private onRowKeydown;
|
|
342
542
|
private hasRowClickListeners;
|
|
543
|
+
/**
|
|
544
|
+
* Bound only to the sort <button>, which renders only for sortable columns;
|
|
545
|
+
* the resize handle is the button's sibling, so its clicks never land here.
|
|
546
|
+
*/
|
|
343
547
|
private onHeaderClick;
|
|
344
548
|
private onRowClick;
|
|
345
549
|
private onRowDblClick;
|
|
346
550
|
private onRowContextMenu;
|
|
551
|
+
/** Row checkboxes render only in `'multiple'` mode, so this is multi-select toggling. */
|
|
347
552
|
private onRowCheckboxToggle;
|
|
348
553
|
/**
|
|
349
554
|
* Clears the entire selection. The header checkbox is only rendered when
|
package/datatable/src/index.d.ts
CHANGED
|
@@ -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
8
|
export { datatableLightStyles } from './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;
|
package/datepicker/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { html as d, unsafeCSS as
|
|
1
|
+
import { html as d, unsafeCSS as p, LitElement as u, nothing as c } from "lit";
|
|
2
2
|
import { query as a } from "lit/decorators.js";
|
|
3
|
-
import { O as h } from "../chunks/overlay-controller-
|
|
3
|
+
import { O as h } from "../chunks/overlay-controller-BHDagokg.mjs";
|
|
4
4
|
import "lit/directives/ref.js";
|
|
5
5
|
import { H as b } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
6
|
-
import "../chunks/mp-calendar.element-
|
|
6
|
+
import "../chunks/mp-calendar.element-BIHS9SZZ.mjs";
|
|
7
7
|
d`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
|
|
8
8
|
target emits a \`styles\` export from the sibling .scss. -->`;
|
|
9
|
-
const g =
|
|
9
|
+
const g = p(`:host {
|
|
10
10
|
display: inline-block;
|
|
11
11
|
position: relative;
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -104,7 +104,7 @@ var m = Object.defineProperty, o = (s, e, t, v) => {
|
|
|
104
104
|
};
|
|
105
105
|
const f = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z"/></svg>';
|
|
106
106
|
let y = 0;
|
|
107
|
-
class i extends
|
|
107
|
+
class i extends u {
|
|
108
108
|
constructor() {
|
|
109
109
|
super(...arguments), this.selectedDate = null, this.currentMonth = null, this.disableDateFn = null, this.min = null, this.max = null, this.firstDayOfWeek = 1, this.locale = void 0, this.disabled = !1, this.placeholder = "", this.triggerLabel = "Choose date", this.inputLabel = "Selected date", this.ariaLabelForRender = null, this.ariaLabelledByForSync = null, this.ariaDescribedByForSync = null, this.instanceId = `mp-dp-${++y}`, this.popupId = `${this.instanceId}-popup`, this.hostAria = new b(this, {
|
|
110
110
|
referenceTarget: () => this.displayInputEl ?? null
|
|
@@ -128,7 +128,7 @@ class i extends p {
|
|
|
128
128
|
this.disabled || (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.overlay.isOpen || await this.overlay.open());
|
|
129
129
|
}, this.onSelectedDateChange = (e) => {
|
|
130
130
|
const t = e.detail;
|
|
131
|
-
t instanceof Date && (this.selectedDate = t, this.requestUpdate(), this.dispatchEvent(
|
|
131
|
+
t instanceof Date && (e.stopPropagation(), this.selectedDate = t, this.requestUpdate(), this.dispatchEvent(
|
|
132
132
|
new CustomEvent("selected-date-change", {
|
|
133
133
|
detail: new Date(t.getFullYear(), t.getMonth(), t.getDate()),
|
|
134
134
|
bubbles: !0,
|
|
@@ -137,7 +137,7 @@ class i extends p {
|
|
|
137
137
|
), this.overlay.close());
|
|
138
138
|
}, this.onCurrentMonthChange = (e) => {
|
|
139
139
|
const t = e.detail;
|
|
140
|
-
t instanceof Date && (this.currentMonth = t, this.requestUpdate(), this.dispatchEvent(
|
|
140
|
+
t instanceof Date && (e.stopPropagation(), this.currentMonth = t, this.requestUpdate(), this.dispatchEvent(
|
|
141
141
|
new CustomEvent("current-month-change", {
|
|
142
142
|
detail: new Date(t.getFullYear(), t.getMonth(), 1),
|
|
143
143
|
bubbles: !0,
|
|
@@ -225,6 +225,9 @@ class i extends p {
|
|
|
225
225
|
role="dialog"
|
|
226
226
|
aria-label="${this.triggerLabel}"
|
|
227
227
|
>
|
|
228
|
+
<!-- The one listener for both the default calendar (fallback content is a
|
|
229
|
+
child of the slot) and a slotted consumer calendar. The inner event
|
|
230
|
+
is stopped here and re-emitted once from the host. -->
|
|
228
231
|
<slot name="calendar"
|
|
229
232
|
@selected-date-change="${this.onSelectedDateChange}"
|
|
230
233
|
@current-month-change="${this.onCurrentMonthChange}"
|
|
@@ -237,8 +240,6 @@ class i extends p {
|
|
|
237
240
|
.max="${this.max}"
|
|
238
241
|
.firstDayOfWeek="${this.firstDayOfWeek}"
|
|
239
242
|
.locale="${this.locale}"
|
|
240
|
-
@selected-date-change="${this.onSelectedDateChange}"
|
|
241
|
-
@current-month-change="${this.onCurrentMonthChange}"
|
|
242
243
|
></mp-calendar>
|
|
243
244
|
</slot>
|
|
244
245
|
</div>
|