@mintplayer/web-components 2.2.0 → 2.3.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { unsafeCSS as x, LitElement as C, nothing as
|
|
2
|
-
import {
|
|
1
|
+
import { unsafeCSS as x, LitElement as C, nothing as d, html as c } from "lit";
|
|
2
|
+
import { L as R } from "./live-announcer-Bi0orG4n.mjs";
|
|
3
|
+
import { a as S, F as $ } from "./focus-restore-DxuP1Oe2.mjs";
|
|
4
|
+
import { H as I } from "./host-aria-WSGs7SPQ.mjs";
|
|
5
|
+
import { repeat as P } from "lit/directives/repeat.js";
|
|
3
6
|
import { styleMap as m } from "lit/directives/style-map.js";
|
|
4
|
-
import "./mp-pagination-
|
|
5
|
-
import "./mp-checkbox-
|
|
6
|
-
const
|
|
7
|
+
import "./mp-pagination-Dea75mD4.mjs";
|
|
8
|
+
import "./mp-checkbox-Ph2mMRGz.mjs";
|
|
9
|
+
const E = {
|
|
10
|
+
treeChevronColumn: "Expand or collapse",
|
|
11
|
+
deselectAll: "Deselect all",
|
|
12
|
+
selectAll: "Select all",
|
|
13
|
+
expandRow: "Expand row",
|
|
14
|
+
collapseRow: "Collapse row",
|
|
15
|
+
loading: "Loading",
|
|
16
|
+
rowsPerPage: "Rows per page",
|
|
17
|
+
resizeColumn: (l) => `Resize column ${l}`,
|
|
18
|
+
selectRow: (l) => `Select row ${l}`,
|
|
19
|
+
announceSorted: (l, e) => e === "none" ? `Sorting removed from ${l}` : `Sorted by ${l}, ${e}`,
|
|
20
|
+
announcePage: (l, e) => `Page ${l} of ${e}`,
|
|
21
|
+
announceSelection: (l) => l === 1 ? "1 row selected" : `${l} rows selected`,
|
|
22
|
+
announceLoaded: (l) => l === 1 ? "Loaded 1 row" : `Loaded ${l} rows`
|
|
23
|
+
}, M = x(`@charset "UTF-8";
|
|
7
24
|
:host {
|
|
8
25
|
display: block;
|
|
9
26
|
width: 100%;
|
|
@@ -117,6 +134,28 @@ thead th[data-sortable=true]:hover {
|
|
|
117
134
|
gap: 0.4rem;
|
|
118
135
|
}
|
|
119
136
|
|
|
137
|
+
button.header-sort {
|
|
138
|
+
border: 0;
|
|
139
|
+
padding: 0;
|
|
140
|
+
margin: 0;
|
|
141
|
+
background: none;
|
|
142
|
+
font: inherit;
|
|
143
|
+
color: inherit;
|
|
144
|
+
text-align: inherit;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.resize-handle:focus-visible,
|
|
149
|
+
button.header-sort:focus-visible {
|
|
150
|
+
outline: 2px solid var(--mp-datatable-resize-handle-color);
|
|
151
|
+
outline-offset: 1px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
tbody tr:focus-visible {
|
|
155
|
+
outline: 2px solid var(--mp-datatable-resize-handle-color);
|
|
156
|
+
outline-offset: -2px;
|
|
157
|
+
}
|
|
158
|
+
|
|
120
159
|
.sort-index {
|
|
121
160
|
position: absolute;
|
|
122
161
|
right: 0.1em;
|
|
@@ -256,7 +295,7 @@ tbody tr[data-placeholder=true] {
|
|
|
256
295
|
transition: none !important;
|
|
257
296
|
}
|
|
258
297
|
}`);
|
|
259
|
-
function
|
|
298
|
+
function K(l, e, t) {
|
|
260
299
|
if (t) {
|
|
261
300
|
const i = l.findIndex((a) => a.property === e);
|
|
262
301
|
return i === -1 ? [...l, { property: e, direction: "ascending" }] : l[i].direction === "ascending" ? l.map(
|
|
@@ -274,27 +313,36 @@ function I(l, e, t) {
|
|
|
274
313
|
function b(l, e) {
|
|
275
314
|
return e.length === 0 ? l.slice() : l.map((t, s) => ({ row: t, index: s })).sort((t, s) => {
|
|
276
315
|
for (const i of e) {
|
|
277
|
-
const a =
|
|
316
|
+
const a = w(t.row, i.property), r = w(s.row, i.property), o = z(a, r);
|
|
278
317
|
if (o !== 0)
|
|
279
318
|
return i.direction === "ascending" ? o : -o;
|
|
280
319
|
}
|
|
281
320
|
return t.index - s.index;
|
|
282
321
|
}).map(({ row: t }) => t);
|
|
283
322
|
}
|
|
284
|
-
function
|
|
323
|
+
function w(l, e) {
|
|
285
324
|
if (!(l == null || typeof l != "object"))
|
|
286
325
|
return l[e];
|
|
287
326
|
}
|
|
288
|
-
function
|
|
327
|
+
function z(l, e) {
|
|
289
328
|
return l === e ? 0 : l == null ? 1 : e == null ? -1 : typeof l == "number" && typeof e == "number" ? l - e : l instanceof Date && e instanceof Date ? l.getTime() - e.getTime() : String(l).localeCompare(String(e));
|
|
290
329
|
}
|
|
291
|
-
let
|
|
292
|
-
class
|
|
330
|
+
let L = 0;
|
|
331
|
+
class k extends C {
|
|
293
332
|
constructor() {
|
|
294
|
-
super(...arguments), this.instanceId = `mp-datatable-${++
|
|
333
|
+
super(...arguments), this.instanceId = `mp-datatable-${++L}`, this._caption = null, this._inputLabel = null, this.hostAria = new I(this, {
|
|
334
|
+
referenceTarget: () => this.renderRoot?.querySelector("table") ?? null
|
|
335
|
+
}), this.labels = void 0, this._columns = [], this._data = [], this._sortColumns = [], this._selectionMode = "none", this._selectedIds = /* @__PURE__ */ new Set(), this._cutIds = /* @__PURE__ */ new Set(), this._focusedRowKey = null, this.liveAnnouncer = new R(this), this.rowFocusRestore = new S(this, new $(
|
|
336
|
+
() => this.renderRoot ?? null,
|
|
337
|
+
{
|
|
338
|
+
selector: 'tbody tr[data-row-key]:not([data-placeholder="true"])',
|
|
339
|
+
keyOf: (e) => e.dataset.rowKey ?? null,
|
|
340
|
+
container: () => this.renderRoot?.querySelector("table") ?? null
|
|
341
|
+
}
|
|
342
|
+
)), this._rowKey = (e, t) => {
|
|
295
343
|
const s = e;
|
|
296
344
|
return s && s.id != null ? String(s.id) : `row-${t}`;
|
|
297
|
-
}, this._columnWidths = /* @__PURE__ */ new Map(), this._hasMeasuredInitial = !1, this._loading = !1, this._emptyMessage = "No data", this._pagination = !1, this._page = 1, this._perPage = 20, this._perPageOptions = [10, 20, 50], this._autoSort = !0, this._totalRecords = null, this._virtualScroll = !1, this._itemSize = 40, this._virtualBuffer = 10, this._virtualRange = { startIndex: 0, endIndex: 0 }, this._scrollElement = null, this._resizeObserver = null, this._scrollListener = null, this._viewportHeight = 0, this._tree = !1, this._idKey = null, this._childCountKey = null, this._treeIndent = 1.25, this._expandedIds = /* @__PURE__ */ new Set(), this._selectionStrategy = "flat", this._childCache = /* @__PURE__ */ new Map(), this._childTotals = /* @__PURE__ */ new Map(), this._pendingFetches = /* @__PURE__ */ new Set(), this._pageCache = /* @__PURE__ */ new Map(), this._pendingPageFetches = /* @__PURE__ */ new Set(), this._fetch = null, this._fetchGeneration = 0, this._initialFetchDone = !1, this._reloadScheduled = !1, this._lastReloadKey = null, this._cachedFlatList = null, this._cachedIndeterminateKeys = null, this._resizableColumns = !0, this.resizeState = null, this.onColumnResizeMove = (e) => {
|
|
345
|
+
}, this._columnWidths = /* @__PURE__ */ new Map(), this._hasMeasuredInitial = !1, this._loading = !1, this._emptyMessage = "No data", this._pagination = !1, this._page = 1, this._perPage = 20, this._perPageOptions = [10, 20, 50], this._autoSort = !0, this._totalRecords = null, this._virtualScroll = !1, this._itemSize = 40, this._virtualBuffer = 10, this._virtualRange = { startIndex: 0, endIndex: 0 }, this._scrollElement = null, this._resizeObserver = null, this._scrollListener = null, this._viewportHeight = 0, this._tree = !1, this._idKey = null, this._childCountKey = null, this._treeIndent = 1.25, this._expandedIds = /* @__PURE__ */ new Set(), this._selectionStrategy = "flat", this._childCache = /* @__PURE__ */ new Map(), this._childTotals = /* @__PURE__ */ new Map(), this._pendingFetches = /* @__PURE__ */ new Set(), this._pageCache = /* @__PURE__ */ new Map(), this._pendingPageFetches = /* @__PURE__ */ new Set(), this._fetch = null, this._fetchGeneration = 0, this._initialFetchDone = !1, this._reloadScheduled = !1, this._lastReloadKey = null, this._cachedFlatList = null, this._cachedIndeterminateKeys = null, this._resizableColumns = !0, this._selectionAnchorKey = null, this.resizeState = null, this.onColumnResizeMove = (e) => {
|
|
298
346
|
if (!this.resizeState) return;
|
|
299
347
|
const t = e.clientX - this.resizeState.startX, s = Math.max(40, this.resizeState.startWidth + t);
|
|
300
348
|
this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(this.resizeState.columnName, s), this.requestUpdate();
|
|
@@ -310,7 +358,7 @@ class E extends C {
|
|
|
310
358
|
};
|
|
311
359
|
}
|
|
312
360
|
static {
|
|
313
|
-
this.styles = [
|
|
361
|
+
this.styles = [M];
|
|
314
362
|
}
|
|
315
363
|
static get observedAttributes() {
|
|
316
364
|
return [
|
|
@@ -324,9 +372,43 @@ class E extends C {
|
|
|
324
372
|
"item-size",
|
|
325
373
|
"tree",
|
|
326
374
|
"tree-indent",
|
|
327
|
-
"selection-strategy"
|
|
375
|
+
"selection-strategy",
|
|
376
|
+
// Naming for the inner <table> (the role-bearing node): caption renders a
|
|
377
|
+
// real <caption>, the native, visible table name; aria-label / input-label
|
|
378
|
+
// are the invisible alternative and win in the accessible-name computation
|
|
379
|
+
// when both are present.
|
|
380
|
+
"caption",
|
|
381
|
+
"aria-label",
|
|
382
|
+
"input-label",
|
|
383
|
+
"aria-labelledby",
|
|
384
|
+
"aria-describedby"
|
|
328
385
|
];
|
|
329
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* Visible table caption, rendered as a real <caption> — the native way to name
|
|
389
|
+
* a table, and the only one sighted users benefit from too. For an invisible
|
|
390
|
+
* name use aria-label / input-label instead (they win over the caption in the
|
|
391
|
+
* accessible-name computation when both are set).
|
|
392
|
+
*/
|
|
393
|
+
get caption() {
|
|
394
|
+
return this._caption;
|
|
395
|
+
}
|
|
396
|
+
set caption(e) {
|
|
397
|
+
const t = e ?? null;
|
|
398
|
+
this._caption !== t && (this._caption = t, this.requestUpdate());
|
|
399
|
+
}
|
|
400
|
+
/** Merged view of labels — consumer keys over the English defaults. */
|
|
401
|
+
get mergedLabels() {
|
|
402
|
+
return { ...E, ...this.labels ?? {} };
|
|
403
|
+
}
|
|
404
|
+
/** Optional invisible accessible name for the <table>. Host aria-label wins. */
|
|
405
|
+
get inputLabel() {
|
|
406
|
+
return this._inputLabel;
|
|
407
|
+
}
|
|
408
|
+
set inputLabel(e) {
|
|
409
|
+
const t = e ?? null;
|
|
410
|
+
this._inputLabel !== t && (this._inputLabel = t, this.requestUpdate());
|
|
411
|
+
}
|
|
330
412
|
/** When true, the WC sorts `data` itself using `sortRows`. Set `false` if the consumer sorts externally. */
|
|
331
413
|
get autoSort() {
|
|
332
414
|
return this._autoSort;
|
|
@@ -485,7 +567,8 @@ class E extends C {
|
|
|
485
567
|
return this._loading;
|
|
486
568
|
}
|
|
487
569
|
set loading(e) {
|
|
488
|
-
|
|
570
|
+
const t = this._loading;
|
|
571
|
+
this._loading = !!e, t && !this._loading && this.liveAnnouncer.announce(this.mergedLabels.announceLoaded(this._data.length)), this.requestUpdate();
|
|
489
572
|
}
|
|
490
573
|
get emptyMessage() {
|
|
491
574
|
return this._emptyMessage;
|
|
@@ -543,7 +626,15 @@ class E extends C {
|
|
|
543
626
|
return this._virtualScroll && this.isExternallyPaged();
|
|
544
627
|
}
|
|
545
628
|
attributeChangedCallback(e, t, s) {
|
|
546
|
-
if (super.attributeChangedCallback(e, t, s), e === "
|
|
629
|
+
if (super.attributeChangedCallback(e, t, s), e === "caption")
|
|
630
|
+
this._caption = s, this.requestUpdate();
|
|
631
|
+
else if (e === "input-label")
|
|
632
|
+
this._inputLabel = s, this.requestUpdate();
|
|
633
|
+
else if (e === "aria-label")
|
|
634
|
+
this.requestUpdate();
|
|
635
|
+
else if (e === "aria-labelledby" || e === "aria-describedby")
|
|
636
|
+
this.hostAria.syncReferences();
|
|
637
|
+
else if (e === "selection-mode") {
|
|
547
638
|
const i = s;
|
|
548
639
|
(i === "none" || i === "single" || i === "multiple") && (this.selectionMode = i);
|
|
549
640
|
} else if (e === "pagination")
|
|
@@ -576,13 +667,18 @@ class E extends C {
|
|
|
576
667
|
super.connectedCallback();
|
|
577
668
|
}
|
|
578
669
|
firstUpdated() {
|
|
579
|
-
this._scrollElement = this.shadowRoot?.querySelector(".datatable-scroll"), this._scrollElement && (this._scrollListener = () => this.refreshVirtualRange(), this._scrollElement.addEventListener("scroll", this._scrollListener, { passive: !0 }), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver(() => this.refreshVirtualRange()), this._resizeObserver.observe(this._scrollElement))), this.refreshVirtualRange();
|
|
670
|
+
this._scrollElement = this.shadowRoot?.querySelector(".datatable-scroll"), this._scrollElement && (this._scrollListener = () => this.refreshVirtualRange(), this._scrollElement.addEventListener("scroll", this._scrollListener, { passive: !0 }), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver(() => this.refreshVirtualRange()), this._resizeObserver.observe(this._scrollElement))), this.refreshVirtualRange(), this.hostAria.syncReferences();
|
|
580
671
|
}
|
|
581
672
|
willUpdate(e) {
|
|
582
673
|
super.willUpdate(e), this._cachedFlatList = null, this._cachedIndeterminateKeys = null;
|
|
583
674
|
}
|
|
584
675
|
updated(e) {
|
|
585
676
|
super.updated(e), this.refreshVirtualRange(), this.maybeMeasureInitialColumnWidths();
|
|
677
|
+
const t = this.renderRoot?.querySelectorAll(".resize-handle:not([aria-valuenow])") ?? [];
|
|
678
|
+
for (const s of t) {
|
|
679
|
+
const i = s.closest("th");
|
|
680
|
+
i && s.setAttribute("aria-valuenow", String(Math.round(i.getBoundingClientRect().width)));
|
|
681
|
+
}
|
|
586
682
|
}
|
|
587
683
|
/**
|
|
588
684
|
* Run the auto-size-once pass after the first batch of rows lands in the
|
|
@@ -654,44 +750,49 @@ class E extends C {
|
|
|
654
750
|
}
|
|
655
751
|
render() {
|
|
656
752
|
const e = this.computeVisibleRows(), t = this._totalRecords ?? this._data.length, s = this.pagination && !this._tree ? Math.max(1, Math.ceil(t / this._perPage)) : 1, i = this._selectionMode === "multiple", a = this._columns.length + (i ? 1 : 0) + (this._tree ? 1 : 0), r = this.getVirtualSpacerHeights(), o = (this._tree || this.isRootWindowed() ? this.getFlatList().length : this._data.length) + 1;
|
|
657
|
-
return
|
|
753
|
+
return c`
|
|
754
|
+
${this.liveAnnouncer.template()}
|
|
658
755
|
<div class="datatable-shell">
|
|
659
756
|
<div class="datatable-scroll ${this._virtualScroll ? "datatable-virtual" : ""}" role="presentation">
|
|
660
757
|
<table
|
|
661
|
-
role=${this._tree ? "treegrid" : "grid"}
|
|
758
|
+
role=${this._tree ? "treegrid" : this._selectionMode !== "none" ? "grid" : d}
|
|
662
759
|
aria-rowcount=${o}
|
|
760
|
+
aria-colcount=${a}
|
|
761
|
+
aria-busy=${this._loading ? "true" : d}
|
|
762
|
+
aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? d}
|
|
663
763
|
class=${this._hasMeasuredInitial ? "measured" : ""}
|
|
664
764
|
>
|
|
765
|
+
${this._caption ? c`<caption>${this._caption}</caption>` : d}
|
|
665
766
|
<thead>
|
|
666
767
|
<tr role="row" aria-rowindex="1">
|
|
667
|
-
${this._tree ?
|
|
668
|
-
${i ?
|
|
768
|
+
${this._tree ? c`<th class="tree-chevron-cell" scope="col" aria-label=${this.mergedLabels.treeChevronColumn}></th>` : d}
|
|
769
|
+
${i ? c`<th class="checkbox-cell" scope="col">
|
|
669
770
|
<mp-checkbox
|
|
670
|
-
aria-label
|
|
671
|
-
aria-hidden=${this._selectedIds.size === 0 ? "true" :
|
|
771
|
+
aria-label=${this.mergedLabels.deselectAll}
|
|
772
|
+
aria-hidden=${this._selectedIds.size === 0 ? "true" : d}
|
|
672
773
|
style=${m({ visibility: this._selectedIds.size > 0 ? "visible" : "hidden" })}
|
|
673
774
|
.checked=${!1}
|
|
674
775
|
.indeterminate=${this._selectedIds.size > 0}
|
|
675
776
|
@change=${this.onDeselectAll}
|
|
676
777
|
></mp-checkbox>
|
|
677
|
-
</th>` :
|
|
778
|
+
</th>` : d}
|
|
678
779
|
${this._columns.map((n, h) => this.renderHeader(n, h))}
|
|
679
780
|
</tr>
|
|
680
781
|
</thead>
|
|
681
782
|
<tbody>
|
|
682
|
-
${this._loading ?
|
|
683
|
-
${r.top > 0 ?
|
|
684
|
-
${
|
|
783
|
+
${this._loading ? c`<tr><td colspan=${a} class="loading-state">Loading…</td></tr>` : e.length === 0 ? c`<tr><td colspan=${a} class="empty-state">${this._emptyMessage}</td></tr>` : c`
|
|
784
|
+
${r.top > 0 ? c`<tr class="virtual-spacer" aria-hidden="true"><td colspan=${a} style=${m({ height: `${r.top}px`, padding: "0", border: "0" })}></td></tr>` : d}
|
|
785
|
+
${P(
|
|
685
786
|
e,
|
|
686
787
|
({ key: n }) => n,
|
|
687
|
-
({ key: n, rowIndex: h, flat:
|
|
788
|
+
({ key: n, rowIndex: h, flat: f }) => this.renderRow(f, n, h, i)
|
|
688
789
|
)}
|
|
689
|
-
${r.bottom > 0 ?
|
|
790
|
+
${r.bottom > 0 ? c`<tr class="virtual-spacer" aria-hidden="true"><td colspan=${a} style=${m({ height: `${r.bottom}px`, padding: "0", border: "0" })}></td></tr>` : d}
|
|
690
791
|
`}
|
|
691
792
|
</tbody>
|
|
692
793
|
</table>
|
|
693
794
|
</div>
|
|
694
|
-
${this._pagination && !this._tree ? this.renderFooter(s) :
|
|
795
|
+
${this._pagination && !this._tree ? this.renderFooter(s) : d}
|
|
695
796
|
</div>
|
|
696
797
|
`;
|
|
697
798
|
}
|
|
@@ -705,78 +806,91 @@ class E extends C {
|
|
|
705
806
|
}
|
|
706
807
|
renderHeader(e, t) {
|
|
707
808
|
const s = e.sortable ?? !0, i = this._sortColumns.findIndex((h) => h.property === e.name), a = i >= 0 ? this._sortColumns[i].direction : null, r = this._columnWidths.get(e.name) ?? e.width, o = e.headerRenderer ? e.headerRenderer(e) : e.label ?? e.name, n = {};
|
|
708
|
-
return typeof r == "number" && (n.width = `${r}px`, n.minWidth = `${r}px`),
|
|
809
|
+
return typeof r == "number" && (n.width = `${r}px`, n.minWidth = `${r}px`), c`
|
|
709
810
|
<th
|
|
710
811
|
scope="col"
|
|
711
812
|
data-column=${e.name}
|
|
712
813
|
data-sortable=${s ? "true" : "false"}
|
|
713
814
|
aria-sort=${a ? a === "ascending" ? "ascending" : "descending" : "none"}
|
|
714
815
|
style=${m(n)}
|
|
715
|
-
@click=${(h) => this.onHeaderClick(e, h)}
|
|
716
816
|
>
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
817
|
+
${s ? c`<button
|
|
818
|
+
type="button"
|
|
819
|
+
class="header-cell header-sort"
|
|
820
|
+
@click=${(h) => this.onHeaderClick(e, h)}
|
|
821
|
+
>
|
|
822
|
+
<span>${y(o)}</span>
|
|
823
|
+
${i >= 0 && this._sortColumns.length > 1 ? c`<span class="sort-index">${i + 1}</span>` : d}
|
|
824
|
+
</button>` : c`<span class="header-cell">
|
|
825
|
+
<span>${y(o)}</span>
|
|
826
|
+
</span>`}
|
|
827
|
+
${this._resizableColumns ? c`<span
|
|
722
828
|
class="resize-handle"
|
|
723
829
|
role="separator"
|
|
830
|
+
tabindex="0"
|
|
724
831
|
aria-orientation="vertical"
|
|
725
|
-
aria-label
|
|
832
|
+
aria-label=${this.mergedLabels.resizeColumn(e.label ?? e.name)}
|
|
833
|
+
aria-valuemin="40"
|
|
834
|
+
aria-valuenow=${Math.round(r ?? 0) || d}
|
|
726
835
|
@pointerdown=${(h) => this.startColumnResize(e, h)}
|
|
727
|
-
|
|
836
|
+
@keydown=${(h) => this.onResizeHandleKeydown(e, h)}
|
|
837
|
+
></span>` : d}
|
|
728
838
|
</th>
|
|
729
839
|
`;
|
|
730
840
|
}
|
|
731
841
|
renderRow(e, t, s, i) {
|
|
732
|
-
const { row: a, depth: r, isExpanded: o, isPlaceholder: n } = e, h = !n && this._selectedIds.has(t),
|
|
733
|
-
return
|
|
842
|
+
const { row: a, depth: r, isExpanded: o, isPlaceholder: n } = e, h = !n && this._selectedIds.has(t), f = !n && this._cutIds.has(t), u = !n && this._focusedRowKey === t, p = n ? 0 : this.extractChildCount(a), _ = this._tree && !n && p > 0, v = !n && a != null && this.isParentIndeterminate(a);
|
|
843
|
+
return c`
|
|
734
844
|
<tr
|
|
735
845
|
role="row"
|
|
736
846
|
aria-rowindex=${s + 2}
|
|
737
|
-
aria-level=${this._tree ? r + 1 :
|
|
738
|
-
aria-expanded=${this._tree &&
|
|
739
|
-
aria-busy=${n ? "true" :
|
|
740
|
-
aria-selected=${!n && this._selectionMode !== "none" ? h ? "true" : "false" :
|
|
847
|
+
aria-level=${this._tree ? r + 1 : d}
|
|
848
|
+
aria-expanded=${this._tree && p > 0 ? o ? "true" : "false" : d}
|
|
849
|
+
aria-busy=${n ? "true" : d}
|
|
850
|
+
aria-selected=${!n && this._selectionMode !== "none" ? h ? "true" : "false" : d}
|
|
741
851
|
data-row-key=${t}
|
|
742
852
|
data-selected=${h ? "true" : "false"}
|
|
743
|
-
data-cut=${
|
|
744
|
-
data-focused=${
|
|
853
|
+
data-cut=${f ? "true" : "false"}
|
|
854
|
+
data-focused=${u ? "true" : "false"}
|
|
745
855
|
data-placeholder=${n ? "true" : "false"}
|
|
746
|
-
data-depth=${this._tree ? String(r) :
|
|
856
|
+
data-depth=${this._tree ? String(r) : d}
|
|
747
857
|
data-clickable=${!n && (this._selectionMode !== "none" || this.hasRowClickListeners()) ? "true" : "false"}
|
|
748
|
-
|
|
749
|
-
@
|
|
750
|
-
|
|
751
|
-
|
|
858
|
+
tabindex=${!n && (this._selectionMode !== "none" || this._tree) ? this._focusedRowKey === t || this._focusedRowKey === null && s === 0 ? "0" : "-1" : d}
|
|
859
|
+
@focus=${n ? null : () => {
|
|
860
|
+
this._focusedRowKey = t, this.requestUpdate();
|
|
861
|
+
}}
|
|
862
|
+
@click=${n ? null : (g) => this.onRowClick(a, t, s, g)}
|
|
863
|
+
@dblclick=${n ? null : (g) => this.onRowDblClick(a, t, s, g)}
|
|
864
|
+
@contextmenu=${n ? null : (g) => this.onRowContextMenu(a, t, s, g)}
|
|
865
|
+
@keydown=${n ? null : (g) => this.onRowKeydown(a, t, s, e.parentId, r, o, p, g)}
|
|
752
866
|
>
|
|
753
|
-
${this._tree ?
|
|
754
|
-
${
|
|
867
|
+
${this._tree ? c`<td class="tree-chevron-cell" style=${m({ paddingInlineStart: `${r * this._treeIndent}rem` })}>
|
|
868
|
+
${_ ? c`<button
|
|
755
869
|
type="button"
|
|
756
870
|
class="tree-chevron"
|
|
757
|
-
aria-label=${o ?
|
|
871
|
+
aria-label=${o ? this.mergedLabels.collapseRow : this.mergedLabels.expandRow}
|
|
758
872
|
aria-expanded=${o ? "true" : "false"}
|
|
759
873
|
data-expanded=${o ? "true" : "false"}
|
|
760
|
-
@click=${(
|
|
761
|
-
>${o ? "▾" : "▸"}</button>` :
|
|
762
|
-
</td>` :
|
|
763
|
-
${i ?
|
|
764
|
-
${n ?
|
|
765
|
-
aria-label=${
|
|
874
|
+
@click=${(g) => this.toggleExpand(a, e.parentId, r, g)}
|
|
875
|
+
>${o ? "▾" : "▸"}</button>` : d}
|
|
876
|
+
</td>` : d}
|
|
877
|
+
${i ? c`<td class="checkbox-cell" @click=${(g) => g.stopPropagation()}>
|
|
878
|
+
${n ? d : c`<mp-checkbox
|
|
879
|
+
aria-label=${this.mergedLabels.selectRow(s + 1)}
|
|
766
880
|
.checked=${h}
|
|
767
881
|
.indeterminate=${v}
|
|
768
|
-
@change=${(
|
|
882
|
+
@change=${(g) => this.onRowCheckboxToggle(a, t, s, g)}
|
|
769
883
|
></mp-checkbox>`}
|
|
770
|
-
</td>` :
|
|
771
|
-
${this._rowRenderer ? this.renderRowFromRenderer(a, s, { depth: r, isExpanded: o, isPlaceholder: n }) : n ?
|
|
884
|
+
</td>` : d}
|
|
885
|
+
${this._rowRenderer ? this.renderRowFromRenderer(a, s, { depth: r, isExpanded: o, isPlaceholder: n }) : n ? c`<td colspan=${this._columns.length} class="tree-placeholder-cell" aria-label=${this.mergedLabels.loading}>…</td>` : this._columns.map((g) => this.renderCell(a, g, s))}
|
|
772
886
|
</tr>
|
|
773
887
|
`;
|
|
774
888
|
}
|
|
775
889
|
renderRowFromRenderer(e, t, s) {
|
|
776
890
|
const i = this._rowRenderer(e, t, s);
|
|
777
891
|
if (i == null)
|
|
778
|
-
return s.isPlaceholder ?
|
|
779
|
-
if (Array.isArray(i) ||
|
|
892
|
+
return s.isPlaceholder ? c`<td colspan=${this._columns.length} class="tree-placeholder-cell" aria-label=${this.mergedLabels.loading}>…</td>` : this._columns.map((a) => this.renderCell(e, a, t));
|
|
893
|
+
if (Array.isArray(i) || F(i)) {
|
|
780
894
|
const a = [];
|
|
781
895
|
for (const r of i) a.push(r);
|
|
782
896
|
return a;
|
|
@@ -784,16 +898,16 @@ class E extends C {
|
|
|
784
898
|
return i;
|
|
785
899
|
}
|
|
786
900
|
renderCell(e, t, s) {
|
|
787
|
-
const i = t.cellRenderer ? t.cellRenderer(e, t, s) :
|
|
788
|
-
return
|
|
901
|
+
const i = t.cellRenderer ? t.cellRenderer(e, t, s) : A(e, t);
|
|
902
|
+
return c`<td class=${t.cellClass ?? ""} data-column=${t.name}>${y(i)}</td>`;
|
|
789
903
|
}
|
|
790
904
|
renderFooter(e) {
|
|
791
905
|
const t = Array.from({ length: e }, (s, i) => i + 1);
|
|
792
|
-
return
|
|
906
|
+
return c`
|
|
793
907
|
<div class="datatable-footer">
|
|
794
908
|
<mp-pagination
|
|
795
909
|
class="datatable-per-page"
|
|
796
|
-
aria-label
|
|
910
|
+
aria-label=${this.mergedLabels.rowsPerPage}
|
|
797
911
|
.pageNumbers=${this._perPageOptions}
|
|
798
912
|
.selectedPageNumber=${this._perPage}
|
|
799
913
|
.showArrows=${!1}
|
|
@@ -851,8 +965,8 @@ class E extends C {
|
|
|
851
965
|
if (this.isRootWindowed()) {
|
|
852
966
|
const r = this._totalRecords ?? this._data.length, o = Math.max(1, this._perPage), n = new Array(r);
|
|
853
967
|
for (let h = 0; h < r; h++) {
|
|
854
|
-
const
|
|
855
|
-
n[h] =
|
|
968
|
+
const f = Math.floor(h / o) + 1, u = h % o, p = f === 1 ? this._data[u] : this._pageCache.get(f)?.[u];
|
|
969
|
+
n[h] = p !== void 0 ? { row: p, key: this._rowKey(p, h), depth: 0, parentId: null, isExpanded: !1, isPlaceholder: !1 } : { row: void 0, key: `__placeholder-flat-${h}`, depth: 0, parentId: null, page: f, isExpanded: !1, isPlaceholder: !0 };
|
|
856
970
|
}
|
|
857
971
|
return this._cachedFlatList = n;
|
|
858
972
|
}
|
|
@@ -874,17 +988,17 @@ class E extends C {
|
|
|
874
988
|
}));
|
|
875
989
|
}
|
|
876
990
|
const e = [], t = Math.max(1, this._perPage), s = (a) => this._autoSort && this._sortColumns.length > 0 ? b(a, this._sortColumns) : a, i = (a, r, o) => {
|
|
877
|
-
const n = this.extractId(a), h = n != null && this._expandedIds.has(n),
|
|
878
|
-
if (e.push({ row: a, key: this._rowKey(a, e.length), depth: r, parentId: o, isExpanded: h, isPlaceholder: !1 }), !h ||
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
881
|
-
for (const
|
|
882
|
-
const
|
|
883
|
-
for (let
|
|
884
|
-
e.push({ row: void 0, key: `__placeholder-${String(n)}-${
|
|
991
|
+
const n = this.extractId(a), h = n != null && this._expandedIds.has(n), f = this.extractChildCount(a);
|
|
992
|
+
if (e.push({ row: a, key: this._rowKey(a, e.length), depth: r, parentId: o, isExpanded: h, isPlaceholder: !1 }), !h || f === 0 || n == null) return;
|
|
993
|
+
const u = this._childCache.get(n);
|
|
994
|
+
if (u && u.length > 0) {
|
|
995
|
+
for (const _ of s(u)) i(_, r + 1, n);
|
|
996
|
+
const p = this._childTotals.get(n) ?? u.length;
|
|
997
|
+
for (let _ = 0; _ < Math.max(0, p - u.length); _++)
|
|
998
|
+
e.push({ row: void 0, key: `__placeholder-${String(n)}-${u.length + _}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
|
|
885
999
|
} else
|
|
886
|
-
for (let
|
|
887
|
-
e.push({ row: void 0, key: `__placeholder-${String(n)}-${
|
|
1000
|
+
for (let p = 0; p < f; p++)
|
|
1001
|
+
e.push({ row: void 0, key: `__placeholder-${String(n)}-${p}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
|
|
888
1002
|
};
|
|
889
1003
|
if (this.isRootWindowed()) {
|
|
890
1004
|
const a = this._totalRecords ?? this._data.length;
|
|
@@ -954,8 +1068,8 @@ class E extends C {
|
|
|
954
1068
|
if (!a || a.length === 0) return { selected: 0, total: 0 };
|
|
955
1069
|
let r = 0, o = 0;
|
|
956
1070
|
for (const n of a) {
|
|
957
|
-
const h = this._rowKey(n, -1),
|
|
958
|
-
r +=
|
|
1071
|
+
const h = this._rowKey(n, -1), f = this._selectedIds.has(h) ? 1 : 0, u = t(n);
|
|
1072
|
+
r += f + u.selected, o += 1 + u.total;
|
|
959
1073
|
}
|
|
960
1074
|
return o > 0 && r > 0 && r < o && e.add(this._rowKey(s, -1)), { selected: r, total: o };
|
|
961
1075
|
};
|
|
@@ -1071,16 +1185,53 @@ class E extends C {
|
|
|
1071
1185
|
}));
|
|
1072
1186
|
}
|
|
1073
1187
|
/** Keyboard handling on a tree-mode row. Arrow keys + Enter/Space toggle expansion. */
|
|
1074
|
-
onRowKeydown(e, t, s, i, a, r) {
|
|
1075
|
-
|
|
1188
|
+
onRowKeydown(e, t, s, i, a, r, o, n) {
|
|
1189
|
+
if (!n.altKey && n.composedPath()[0] === n.currentTarget) {
|
|
1190
|
+
if (n.key === "ArrowDown" || n.key === "ArrowUp") {
|
|
1191
|
+
n.preventDefault();
|
|
1192
|
+
const h = Array.from(
|
|
1193
|
+
this.renderRoot.querySelectorAll("tbody tr[data-row-key]")
|
|
1194
|
+
), f = h.findIndex((p) => p.dataset.rowKey === t), u = h[f + (n.key === "ArrowDown" ? 1 : -1)];
|
|
1195
|
+
u && u.focus();
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
if (this._tree) {
|
|
1199
|
+
if (n.key === "ArrowRight" && o > 0 && !r) {
|
|
1200
|
+
this.toggleExpand(e, i, a, n);
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
if (n.key === "ArrowLeft" && r) {
|
|
1204
|
+
this.toggleExpand(e, i, a, n);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
if ((n.key === "Enter" || n.key === " ") && o > 0) {
|
|
1208
|
+
this.toggleExpand(e, i, a, n);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
(n.key === "Enter" || n.key === " ") && this._selectionMode !== "none" && (n.preventDefault(), this._focusedRowKey = t, this.handleSelectionOnClick(t, n), this.requestUpdate(), this.dispatchEvent(
|
|
1213
|
+
new CustomEvent("mp-datatable-row-click", {
|
|
1214
|
+
detail: { row: e, rowIndex: s, rowKey: t, originalEvent: n },
|
|
1215
|
+
bubbles: !0,
|
|
1216
|
+
composed: !0
|
|
1217
|
+
})
|
|
1218
|
+
));
|
|
1219
|
+
}
|
|
1076
1220
|
}
|
|
1077
1221
|
hasRowClickListeners() {
|
|
1078
1222
|
return !0;
|
|
1079
1223
|
}
|
|
1080
1224
|
onHeaderClick(e, t) {
|
|
1081
1225
|
if (!(e.sortable ?? !0) || t.target.closest(".resize-handle")) return;
|
|
1082
|
-
const a =
|
|
1083
|
-
this._sortColumns = a, this._page = 1
|
|
1226
|
+
const a = K(this._sortColumns, e.name, t.shiftKey);
|
|
1227
|
+
this._sortColumns = a, this._page = 1;
|
|
1228
|
+
const r = a.find((o) => o.property === e.name);
|
|
1229
|
+
this.liveAnnouncer.announce(
|
|
1230
|
+
this.mergedLabels.announceSorted(
|
|
1231
|
+
e.label ?? e.name,
|
|
1232
|
+
r ? r.direction === "ascending" ? "ascending" : "descending" : "none"
|
|
1233
|
+
)
|
|
1234
|
+
), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
|
|
1084
1235
|
new CustomEvent("mp-datatable-sort-change", {
|
|
1085
1236
|
detail: { sortColumns: a },
|
|
1086
1237
|
bubbles: !0,
|
|
@@ -1150,8 +1301,8 @@ class E extends C {
|
|
|
1150
1301
|
this._selectedIds = /* @__PURE__ */ new Set([e]), this.emitSelectionChange();
|
|
1151
1302
|
return;
|
|
1152
1303
|
}
|
|
1153
|
-
if (t.shiftKey && this.
|
|
1154
|
-
const s = this.computeVisibleRows(), i = s.findIndex((r) => r.key === this.
|
|
1304
|
+
if (t.shiftKey && this._selectionAnchorKey && this._selectionAnchorKey !== e) {
|
|
1305
|
+
const s = this.computeVisibleRows(), i = s.findIndex((r) => r.key === this._selectionAnchorKey), a = s.findIndex((r) => r.key === e);
|
|
1155
1306
|
if (i >= 0 && a >= 0) {
|
|
1156
1307
|
const [r, o] = i < a ? [i, a] : [a, i], n = s.slice(r, o + 1).map((h) => h.key);
|
|
1157
1308
|
this._selectedIds = /* @__PURE__ */ new Set([...this._selectedIds, ...n]), this.emitSelectionChange();
|
|
@@ -1160,15 +1311,15 @@ class E extends C {
|
|
|
1160
1311
|
}
|
|
1161
1312
|
if (t.ctrlKey || t.metaKey) {
|
|
1162
1313
|
const s = new Set(this._selectedIds);
|
|
1163
|
-
s.has(e) ? s.delete(e) : s.add(e), this._selectedIds = s, this.emitSelectionChange();
|
|
1314
|
+
s.has(e) ? s.delete(e) : s.add(e), this._selectedIds = s, this._selectionAnchorKey = e, this.emitSelectionChange();
|
|
1164
1315
|
return;
|
|
1165
1316
|
}
|
|
1166
|
-
this._selectedIds = /* @__PURE__ */ new Set([e]), this.emitSelectionChange();
|
|
1317
|
+
this._selectedIds = /* @__PURE__ */ new Set([e]), this._selectionAnchorKey = e, this.emitSelectionChange();
|
|
1167
1318
|
}
|
|
1168
1319
|
}
|
|
1169
1320
|
emitSelectionChange() {
|
|
1170
1321
|
const e = [...this._selectedIds];
|
|
1171
|
-
this.dispatchEvent(
|
|
1322
|
+
this.liveAnnouncer.announce(this.mergedLabels.announceSelection(e.length)), this.dispatchEvent(
|
|
1172
1323
|
new CustomEvent("mp-datatable-selection-change", {
|
|
1173
1324
|
detail: { selectedIds: e, selectedRows: this.resolveRows(e) },
|
|
1174
1325
|
bubbles: !0,
|
|
@@ -1193,7 +1344,7 @@ class E extends C {
|
|
|
1193
1344
|
}
|
|
1194
1345
|
gotoPage(e) {
|
|
1195
1346
|
const t = this._totalRecords ?? this._data.length, s = Math.max(1, Math.ceil(t / this._perPage));
|
|
1196
|
-
this._page = Math.max(1, Math.min(s, e)), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
|
|
1347
|
+
this._page = Math.max(1, Math.min(s, e)), this.liveAnnouncer.announce(this.mergedLabels.announcePage(this._page, s)), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
|
|
1197
1348
|
new CustomEvent("mp-datatable-page-change", {
|
|
1198
1349
|
detail: { page: this._page },
|
|
1199
1350
|
bubbles: !0,
|
|
@@ -1201,6 +1352,17 @@ class E extends C {
|
|
|
1201
1352
|
})
|
|
1202
1353
|
);
|
|
1203
1354
|
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Keyboard column resize — the same ±px model as the pointer path, same 40px
|
|
1357
|
+
* floor. The handle is a focusable role="separator"; without this it was the
|
|
1358
|
+
* audit's pointer-only finding for the datatable.
|
|
1359
|
+
*/
|
|
1360
|
+
onResizeHandleKeydown(e, t) {
|
|
1361
|
+
if (!this._resizableColumns || t.key !== "ArrowLeft" && t.key !== "ArrowRight") return;
|
|
1362
|
+
t.preventDefault(), t.stopPropagation();
|
|
1363
|
+
const i = t.currentTarget.closest("th"), a = this._columnWidths.get(e.name) ?? i?.getBoundingClientRect().width ?? 100, r = Math.max(40, a + (t.key === "ArrowRight" ? 10 : -10));
|
|
1364
|
+
this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(e.name, r), this.requestUpdate();
|
|
1365
|
+
}
|
|
1204
1366
|
startColumnResize(e, t) {
|
|
1205
1367
|
if (!this._resizableColumns) return;
|
|
1206
1368
|
t.preventDefault(), t.stopPropagation();
|
|
@@ -1210,21 +1372,21 @@ class E extends C {
|
|
|
1210
1372
|
this.resizeState = { columnName: e.name, startX: t.clientX, startWidth: a, handle: s }, s.classList.add("active"), s.setPointerCapture(t.pointerId), s.addEventListener("pointermove", this.onColumnResizeMove), s.addEventListener("pointerup", this.onColumnResizeEnd), s.addEventListener("pointercancel", this.onColumnResizeEnd);
|
|
1211
1373
|
}
|
|
1212
1374
|
}
|
|
1213
|
-
function
|
|
1375
|
+
function A(l, e) {
|
|
1214
1376
|
if (l == null || typeof l != "object") return "";
|
|
1215
1377
|
const t = l[e.name];
|
|
1216
1378
|
return t == null ? "" : String(t);
|
|
1217
1379
|
}
|
|
1218
|
-
function
|
|
1380
|
+
function F(l) {
|
|
1219
1381
|
return l != null && typeof l != "string" && typeof l[Symbol.iterator] == "function";
|
|
1220
1382
|
}
|
|
1221
|
-
function
|
|
1222
|
-
return l == null || l === !1 ?
|
|
1383
|
+
function y(l) {
|
|
1384
|
+
return l == null || l === !1 ? d : (l instanceof Node || typeof l == "object" && "_$litType$" in l, l);
|
|
1223
1385
|
}
|
|
1224
|
-
typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable",
|
|
1386
|
+
typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable", k);
|
|
1225
1387
|
export {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1388
|
+
k as M,
|
|
1389
|
+
K as c,
|
|
1390
|
+
M as d,
|
|
1229
1391
|
b as s
|
|
1230
1392
|
};
|