@mintplayer/web-components 2.16.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-B7st6G-I.mjs → mp-datatable-eRpl7-2V.mjs} +173 -173
- package/chunks/{mp-datetime-picker.element-DsWA1AFs.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-CwaAAOcm.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-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
- 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 +1 -1
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/mp-datatable.d.ts +5 -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 +1 -1
- package/overlay/src/overlay-controller.d.ts +0 -14
- 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/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { O as
|
|
3
|
-
import { s as
|
|
4
|
-
import { L as
|
|
5
|
-
import { a as
|
|
6
|
-
import { H as
|
|
7
|
-
import { repeat as
|
|
8
|
-
import { live as
|
|
9
|
-
import { classMap as
|
|
1
|
+
import { unsafeCSS as L, LitElement as P, nothing as u, render as v } from "lit";
|
|
2
|
+
import { O as M } from "./overlay-controller-BHDagokg.mjs";
|
|
3
|
+
import { s as k, i as z } from "./install-light-styles-DbCAGFOC.mjs";
|
|
4
|
+
import { L as q } from "./live-announcer-Bi0orG4n.mjs";
|
|
5
|
+
import { a as K, F as A } from "./focus-restore-DxuP1Oe2.mjs";
|
|
6
|
+
import { H as U } from "./host-aria-WSGs7SPQ.mjs";
|
|
7
|
+
import { repeat as C } from "lit/directives/repeat.js";
|
|
8
|
+
import { live as T } from "lit/directives/live.js";
|
|
9
|
+
import { classMap as x } from "lit/directives/class-map.js";
|
|
10
10
|
import { styleMap as _ } from "lit/directives/style-map.js";
|
|
11
|
-
import "./mp-pagination-
|
|
12
|
-
import "./mp-checkbox-
|
|
13
|
-
const
|
|
11
|
+
import "./mp-pagination-hGy4dL7p.mjs";
|
|
12
|
+
import "./mp-checkbox-zV83gILn.mjs";
|
|
13
|
+
const O = {
|
|
14
14
|
eq: "equals",
|
|
15
15
|
neq: "does not equal",
|
|
16
16
|
lt: "is less than",
|
|
17
17
|
lte: "is at most",
|
|
18
18
|
gt: "is greater than",
|
|
19
19
|
gte: "is at least"
|
|
20
|
-
},
|
|
20
|
+
}, D = {
|
|
21
21
|
eq: "=",
|
|
22
22
|
neq: "≠",
|
|
23
23
|
lt: "<",
|
|
24
24
|
lte: "≤",
|
|
25
25
|
gt: ">",
|
|
26
26
|
gte: "≥"
|
|
27
|
-
},
|
|
27
|
+
}, N = ["eq", "neq", "lt", "lte", "gt", "gte"], W = {
|
|
28
28
|
treeChevronColumn: "Expand or collapse",
|
|
29
29
|
deselectAll: "Deselect all",
|
|
30
30
|
selectAll: "Select all",
|
|
@@ -32,39 +32,39 @@ const A = {
|
|
|
32
32
|
collapseRow: "Collapse row",
|
|
33
33
|
loading: "Loading",
|
|
34
34
|
rowsPerPage: "Rows per page",
|
|
35
|
-
resizeColumn: (
|
|
36
|
-
selectRow: (
|
|
37
|
-
filterColumn: (
|
|
38
|
-
filterColumnActive: (
|
|
39
|
-
filterClear: (
|
|
35
|
+
resizeColumn: (l) => `Resize column ${l}`,
|
|
36
|
+
selectRow: (l) => `Select row ${l}`,
|
|
37
|
+
filterColumn: (l) => `Filter ${l}`,
|
|
38
|
+
filterColumnActive: (l, e) => e ? `Filter ${l}, filtered by ${e}` : `Filter ${l}, filtered`,
|
|
39
|
+
filterClear: (l) => `Clear the filter on ${l}`,
|
|
40
40
|
filterSearch: "Search values",
|
|
41
41
|
filterInvert: "Exclude the selected values",
|
|
42
|
-
filterGroup: (
|
|
42
|
+
filterGroup: (l) => `Values of ${l}`,
|
|
43
43
|
filterHasMore: "More values exist — refine the search to see them",
|
|
44
44
|
filterNoValues: "No values available",
|
|
45
|
-
filterValue(
|
|
46
|
-
return
|
|
45
|
+
filterValue(l) {
|
|
46
|
+
return l == null ? this.filterNone : l === "" ? this.filterEmpty : l === !0 ? this.filterTrue : l === !1 ? this.filterFalse : l instanceof Date ? l.toLocaleDateString() : String(l);
|
|
47
47
|
},
|
|
48
48
|
filterNone: "(none)",
|
|
49
49
|
filterEmpty: "(empty)",
|
|
50
50
|
filterTrue: "Yes",
|
|
51
51
|
filterFalse: "No",
|
|
52
|
-
announceFilter: (
|
|
52
|
+
announceFilter: (l, e) => e === 0 ? `Filter cleared on ${l}` : e === 1 ? `1 value selected in ${l}` : `${e} values selected in ${l}`,
|
|
53
53
|
filterOperator: "Comparison",
|
|
54
54
|
filterOperand: "Value to compare with",
|
|
55
|
-
filterOperatorLabel: (
|
|
56
|
-
announceComparisonFilter: (
|
|
57
|
-
announceSorted: (
|
|
58
|
-
announcePage: (
|
|
59
|
-
announceSelection: (
|
|
60
|
-
announceLoaded: (
|
|
61
|
-
},
|
|
55
|
+
filterOperatorLabel: (l) => O[l],
|
|
56
|
+
announceComparisonFilter: (l, e, t) => t === "" ? `Filter cleared on ${l}` : `${l} ${e} ${t}`,
|
|
57
|
+
announceSorted: (l, e) => e === "none" ? `Sorting removed from ${l}` : `Sorted by ${l}, ${e}`,
|
|
58
|
+
announcePage: (l, e) => `Page ${l} of ${e}`,
|
|
59
|
+
announceSelection: (l) => l === 1 ? "1 row selected" : `${l} rows selected`,
|
|
60
|
+
announceLoaded: (l) => l === 1 ? "Loaded 1 row" : `Loaded ${l} rows`
|
|
61
|
+
}, H = L(`@charset "UTF-8";
|
|
62
62
|
mp-datatable {
|
|
63
63
|
display: block;
|
|
64
64
|
width: 100%;
|
|
65
65
|
position: relative;
|
|
66
66
|
--mp-datatable-border-color: var(--bs-border-color, rgba(0, 0, 0, 0.125));
|
|
67
|
-
--mp-datatable-row-hover-bg: var(--bs-table-hover-bg, rgba(
|
|
67
|
+
--mp-datatable-row-hover-bg: var(--bs-table-hover-bg, rgba(var(--bs-emphasis-color-rgb), 0.04));
|
|
68
68
|
--mp-datatable-row-selected-bg: var(--bs-list-group-active-bg, var(--bs-primary, #0d6efd));
|
|
69
69
|
--mp-datatable-row-selected-color: var(--bs-list-group-active-color, #fff);
|
|
70
70
|
--mp-datatable-cut-opacity: 0.55;
|
|
@@ -358,7 +358,7 @@ tr.filter-row[data-mps=datatable] th[data-mps=datatable] {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
.filter-trigger:hover[data-mps=datatable] {
|
|
361
|
-
background-color: var(--mp-datatable-row-hover-bg, rgba(
|
|
361
|
+
background-color: var(--mp-datatable-row-hover-bg, rgba(var(--bs-emphasis-color-rgb), 0.04));
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
.filter-trigger:focus-visible[data-mps=datatable] {
|
|
@@ -367,7 +367,7 @@ tr.filter-row[data-mps=datatable] th[data-mps=datatable] {
|
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
.filter-trigger[aria-expanded=true][data-mps=datatable] {
|
|
370
|
-
background-color: var(--mp-datatable-row-hover-bg, rgba(
|
|
370
|
+
background-color: var(--mp-datatable-row-hover-bg, rgba(var(--bs-emphasis-color-rgb), 0.04));
|
|
371
371
|
border-color: var(--mp-datatable-border-color);
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -514,7 +514,7 @@ tr.filter-row[data-mps=datatable] th[data-mps=datatable] {
|
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
.filter-option:hover[data-mps=datatable] {
|
|
517
|
-
background-color: var(--mp-datatable-row-hover-bg, rgba(
|
|
517
|
+
background-color: var(--mp-datatable-row-hover-bg, rgba(var(--bs-emphasis-color-rgb), 0.04));
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
.filter-remaining[data-mps=datatable] {
|
|
@@ -544,52 +544,56 @@ tr.filter-row[data-mps=datatable] th[data-mps=datatable] {
|
|
|
544
544
|
transition: none !important;
|
|
545
545
|
}
|
|
546
546
|
}`);
|
|
547
|
-
function
|
|
547
|
+
function B(l, e, t) {
|
|
548
548
|
if (t) {
|
|
549
|
-
const i =
|
|
550
|
-
return i === -1 ? [...
|
|
549
|
+
const i = l.findIndex((s) => s.property === e);
|
|
550
|
+
return i === -1 ? [...l, { property: e, direction: "ascending" }] : l[i].direction === "ascending" ? l.map(
|
|
551
551
|
(s, r) => r === i ? { ...s, direction: "descending" } : s
|
|
552
|
-
) :
|
|
552
|
+
) : l.filter((s, r) => r !== i);
|
|
553
553
|
}
|
|
554
|
-
const a =
|
|
554
|
+
const a = l.length === 1 && l[0].property === e;
|
|
555
555
|
return [
|
|
556
556
|
{
|
|
557
557
|
property: e,
|
|
558
|
-
direction: a &&
|
|
558
|
+
direction: a && l[0].direction === "ascending" ? "descending" : "ascending"
|
|
559
559
|
}
|
|
560
560
|
];
|
|
561
561
|
}
|
|
562
|
-
function y(
|
|
563
|
-
return e.length === 0 ?
|
|
562
|
+
function y(l, e) {
|
|
563
|
+
return e.length === 0 ? l.slice() : l.map((t, a) => ({ row: t, index: a })).sort((t, a) => {
|
|
564
564
|
for (const i of e) {
|
|
565
|
-
const s = S(t.row, i.property), r = S(a.row, i.property), o =
|
|
565
|
+
const s = S(t.row, i.property), r = S(a.row, i.property), o = V(s, r);
|
|
566
566
|
if (o !== 0)
|
|
567
567
|
return i.direction === "ascending" ? o : -o;
|
|
568
568
|
}
|
|
569
569
|
return t.index - a.index;
|
|
570
570
|
}).map(({ row: t }) => t);
|
|
571
571
|
}
|
|
572
|
-
function S(
|
|
573
|
-
if (!(
|
|
574
|
-
return
|
|
572
|
+
function S(l, e) {
|
|
573
|
+
if (!(l == null || typeof l != "object"))
|
|
574
|
+
return l[e];
|
|
575
575
|
}
|
|
576
|
-
function
|
|
577
|
-
return
|
|
576
|
+
function V(l, e) {
|
|
577
|
+
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));
|
|
578
578
|
}
|
|
579
|
-
const
|
|
580
|
-
function
|
|
581
|
-
return
|
|
579
|
+
const F = 40, $ = 10;
|
|
580
|
+
function R(l, e) {
|
|
581
|
+
return Math.max(F, l + e);
|
|
582
582
|
}
|
|
583
|
-
|
|
584
|
-
|
|
583
|
+
const h = k("datatable");
|
|
584
|
+
function E(l, e) {
|
|
585
|
+
return l === e || l !== l && e !== e;
|
|
585
586
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
587
|
+
function g(l, e) {
|
|
588
|
+
return l.some((t) => E(t.value, e));
|
|
589
|
+
}
|
|
590
|
+
const G = 250;
|
|
591
|
+
let j = 0;
|
|
592
|
+
class X extends P {
|
|
589
593
|
constructor() {
|
|
590
|
-
super(...arguments), this.instanceId = `mp-datatable-${++
|
|
594
|
+
super(...arguments), this.instanceId = `mp-datatable-${++j}`, this._caption = null, this._inputLabel = null, this.hostAria = new U(this, {
|
|
591
595
|
referenceTarget: () => this.renderRoot?.querySelector("table") ?? null
|
|
592
|
-
}), 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
|
|
596
|
+
}), 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 q(this), this.rowFocusRestore = new K(this, new A(
|
|
593
597
|
() => this.renderRoot ?? null,
|
|
594
598
|
{
|
|
595
599
|
selector: 'tbody tr[data-row-key]:not([data-placeholder="true"])',
|
|
@@ -599,7 +603,7 @@ class V extends E {
|
|
|
599
603
|
)), this._rowKey = (e, t) => {
|
|
600
604
|
const a = e;
|
|
601
605
|
return a && a.id != null ? String(a.id) : `row-${t}`;
|
|
602
|
-
}, 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._openFilterColumn = null, this._mountedFilterColumn = null, this._consumerMountedFilter = !1, this._filterUid = `mp-dt-${Math.random().toString(36).slice(2, 9)}`, this._distincts = null, this._filterStates = /* @__PURE__ */ new Map(), 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.filterOverlay = new
|
|
606
|
+
}, 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._openFilterColumn = null, this._mountedFilterColumn = null, this._consumerMountedFilter = !1, this._filterUid = `mp-dt-${Math.random().toString(36).slice(2, 9)}`, this._distincts = null, this._filterStates = /* @__PURE__ */ new Map(), 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.filterOverlay = new M(this, {
|
|
603
607
|
portal: !0,
|
|
604
608
|
modal: !0,
|
|
605
609
|
scrollStrategy: "reposition",
|
|
@@ -632,8 +636,8 @@ class V extends E {
|
|
|
632
636
|
}
|
|
633
637
|
}), this._selectionAnchorKey = null, this.resizeState = null, this.onColumnResizeMove = (e) => {
|
|
634
638
|
if (!this.resizeState) return;
|
|
635
|
-
const t =
|
|
636
|
-
this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(this.resizeState.columnName,
|
|
639
|
+
const t = R(this.resizeState.startWidth, e.clientX - this.resizeState.startX);
|
|
640
|
+
this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(this.resizeState.columnName, t), this.requestUpdate();
|
|
637
641
|
}, this.onColumnResizeEnd = (e) => {
|
|
638
642
|
if (this.resizeState) {
|
|
639
643
|
this.resizeState.handle.classList.remove("active"), this.resizeState.handle.removeEventListener("pointermove", this.onColumnResizeMove), this.resizeState.handle.removeEventListener("pointerup", this.onColumnResizeEnd), this.resizeState.handle.removeEventListener("pointercancel", this.onColumnResizeEnd);
|
|
@@ -695,7 +699,7 @@ class V extends E {
|
|
|
695
699
|
}
|
|
696
700
|
/** Merged view of labels — consumer keys over the English defaults. */
|
|
697
701
|
get mergedLabels() {
|
|
698
|
-
return { ...
|
|
702
|
+
return { ...W, ...this.labels ?? {} };
|
|
699
703
|
}
|
|
700
704
|
/** Optional invisible accessible name for the <table>. Host aria-label wins. */
|
|
701
705
|
get inputLabel() {
|
|
@@ -736,7 +740,7 @@ class V extends E {
|
|
|
736
740
|
return this._itemSize;
|
|
737
741
|
}
|
|
738
742
|
set itemSize(e) {
|
|
739
|
-
const t = Math.max(1, Math.floor(e
|
|
743
|
+
const t = Number.isFinite(e) && e > 0 ? Math.max(1, Math.floor(e)) : 40;
|
|
740
744
|
this._itemSize !== t && (this._itemSize = t, this.requestUpdate());
|
|
741
745
|
}
|
|
742
746
|
/** Off-screen row buffer (each side) for virtual scrolling. */
|
|
@@ -979,12 +983,12 @@ class V extends E {
|
|
|
979
983
|
else if (e === "aria-labelledby" || e === "aria-describedby")
|
|
980
984
|
this.hostAria.syncReferences();
|
|
981
985
|
else if (e === "selection-mode") {
|
|
982
|
-
const i = a;
|
|
986
|
+
const i = a ?? "none";
|
|
983
987
|
(i === "none" || i === "single" || i === "multiple") && (this.selectionMode = i);
|
|
984
988
|
} else if (e === "pagination")
|
|
985
989
|
this.pagination = a !== null;
|
|
986
990
|
else if (e === "resizable-columns")
|
|
987
|
-
this.resizableColumns = a !==
|
|
991
|
+
this.resizableColumns = a !== "false";
|
|
988
992
|
else if (e === "auto-sort")
|
|
989
993
|
this.autoSort = a !== "false";
|
|
990
994
|
else if (e === "empty-message")
|
|
@@ -997,7 +1001,7 @@ class V extends E {
|
|
|
997
1001
|
} else if (e === "tree")
|
|
998
1002
|
this.tree = a !== null;
|
|
999
1003
|
else if (e === "tree-indent") {
|
|
1000
|
-
const i = Number(a);
|
|
1004
|
+
const i = a === null ? 1.25 : Number(a);
|
|
1001
1005
|
Number.isFinite(i) && (this.treeIndent = i);
|
|
1002
1006
|
} else e === "selection-strategy" && (this.selectionStrategy = a === "cascading" ? "cascading" : "flat");
|
|
1003
1007
|
}
|
|
@@ -1087,8 +1091,8 @@ class V extends E {
|
|
|
1087
1091
|
maybeFetchPlaceholdersInViewport() {
|
|
1088
1092
|
const e = this.getFlatList(), { startIndex: t, endIndex: a } = this._virtualRange, i = this._virtualScroll ? t : 0, s = this._virtualScroll ? a : e.length, r = /* @__PURE__ */ new Set();
|
|
1089
1093
|
for (let o = i; o < s; o++) {
|
|
1090
|
-
const
|
|
1091
|
-
!
|
|
1094
|
+
const n = e[o];
|
|
1095
|
+
!n.isPlaceholder || n.parentId == null || this._childCache.has(n.parentId) || this._pendingFetches.has(n.parentId) || r.add(n.parentId);
|
|
1092
1096
|
}
|
|
1093
1097
|
for (const o of r) this.fetchChildren(o);
|
|
1094
1098
|
}
|
|
@@ -1102,20 +1106,20 @@ class V extends E {
|
|
|
1102
1106
|
maybeFetchPagesInViewport() {
|
|
1103
1107
|
const e = this.getFlatList(), { startIndex: t, endIndex: a } = this._virtualRange, i = this._virtualScroll ? t : 0, s = this._virtualScroll ? a : e.length, r = /* @__PURE__ */ new Set();
|
|
1104
1108
|
for (let o = i; o < s; o++) {
|
|
1105
|
-
const
|
|
1106
|
-
!
|
|
1109
|
+
const n = e[o];
|
|
1110
|
+
!n.isPlaceholder || n.page == null || n.page <= 1 || this._pageCache.has(n.page) || this._pendingPageFetches.has(n.page) || r.add(n.page);
|
|
1107
1111
|
}
|
|
1108
1112
|
for (const o of r) this.fetchWindowPage(o);
|
|
1109
1113
|
}
|
|
1110
1114
|
render() {
|
|
1111
|
-
const e = this.computeVisibleRows(), t = this._totalRecords ?? this._data.length, a = this.pagination && !this._tree ? Math.max(1, Math.ceil(t / this._perPage)) : 1, i = this._selectionMode === "multiple", s = this._columns.length + (i ? 1 : 0) + (this._tree ? 1 : 0), r = this.getVirtualSpacerHeights(), o = this.hasFilterRow ? 2 : 1,
|
|
1115
|
+
const e = this.computeVisibleRows(), t = this._totalRecords ?? this._data.length, a = this.pagination && !this._tree ? Math.max(1, Math.ceil(t / this._perPage)) : 1, i = this._selectionMode === "multiple", s = this._columns.length + (i ? 1 : 0) + (this._tree ? 1 : 0), r = this.getVirtualSpacerHeights(), o = this.hasFilterRow ? 2 : 1, n = (this._tree || this.isRootWindowed() ? this.getFlatList().length : this._data.length) + o;
|
|
1112
1116
|
return h`
|
|
1113
1117
|
${this.liveAnnouncer.template()}
|
|
1114
1118
|
<div class="datatable-shell">
|
|
1115
1119
|
<div class="datatable-scroll ${this._virtualScroll ? "datatable-virtual" : ""}" role="presentation">
|
|
1116
1120
|
<table
|
|
1117
1121
|
role=${this._tree ? "treegrid" : this._selectionMode !== "none" ? "grid" : u}
|
|
1118
|
-
aria-rowcount=${
|
|
1122
|
+
aria-rowcount=${n}
|
|
1119
1123
|
aria-colcount=${s}
|
|
1120
1124
|
aria-busy=${this._loading ? "true" : u}
|
|
1121
1125
|
aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? u}
|
|
@@ -1142,7 +1146,7 @@ class V extends E {
|
|
|
1142
1146
|
<tbody>
|
|
1143
1147
|
${this._loading ? h`<tr><td colspan=${s} class="loading-state">Loading…</td></tr>` : e.length === 0 ? h`<tr><td colspan=${s} class="empty-state">${this._emptyMessage}</td></tr>` : h`
|
|
1144
1148
|
${r.top > 0 ? h`<tr class="virtual-spacer" aria-hidden="true"><td colspan=${s} style=${_({ height: `${r.top}px`, padding: "0", border: "0" })}></td></tr>` : u}
|
|
1145
|
-
${
|
|
1149
|
+
${C(
|
|
1146
1150
|
e,
|
|
1147
1151
|
({ key: d }) => d,
|
|
1148
1152
|
({ key: d, rowIndex: c, flat: p }) => this.renderRow(p, d, c, i)
|
|
@@ -1274,7 +1278,7 @@ class V extends E {
|
|
|
1274
1278
|
applyComparison(e, t, a) {
|
|
1275
1279
|
const i = this.filterState(e);
|
|
1276
1280
|
if (!i) return;
|
|
1277
|
-
const s = this._columns.find((
|
|
1281
|
+
const s = this._columns.find((n) => n.name === e), r = this.parseOperand(a, s?.filterInputType);
|
|
1278
1282
|
i.operandText = a, i.selection = { ...i.selection, operator: t, operand: r }, this.notifyFilterListeners(i);
|
|
1279
1283
|
const o = this.mergedLabels;
|
|
1280
1284
|
this.liveAnnouncer.announce(
|
|
@@ -1309,7 +1313,7 @@ class V extends E {
|
|
|
1309
1313
|
const i = a.loadedTerm ?? "";
|
|
1310
1314
|
(a.loaded?.hasMore || !t.startsWith(i)) && (a.debounce != null && clearTimeout(a.debounce), a.debounce = setTimeout(() => {
|
|
1311
1315
|
a.debounce = null, this.loadDistincts(e, t);
|
|
1312
|
-
},
|
|
1316
|
+
}, G));
|
|
1313
1317
|
}
|
|
1314
1318
|
/**
|
|
1315
1319
|
* Loads (or recomputes) one column's value list.
|
|
@@ -1490,7 +1494,7 @@ class V extends E {
|
|
|
1490
1494
|
this.renderComparisonFilterPanel(e, t, a);
|
|
1491
1495
|
return;
|
|
1492
1496
|
}
|
|
1493
|
-
const i = this.mergedLabels, s = e.label ?? e.name, r = t.view, o = t.selection.values,
|
|
1497
|
+
const i = this.mergedLabels, s = e.label ?? e.name, r = t.view, o = t.selection.values, n = [
|
|
1494
1498
|
...o,
|
|
1495
1499
|
...(r?.matching ?? []).filter((c) => !g(o, c.value)),
|
|
1496
1500
|
...(r?.remaining ?? []).filter((c) => !g(o, c.value))
|
|
@@ -1522,11 +1526,11 @@ class V extends E {
|
|
|
1522
1526
|
</button>
|
|
1523
1527
|
<div class="filter-options" role="group" aria-label=${i.filterGroup(s)}>
|
|
1524
1528
|
${t.loading ? h`<span class="filter-loading">${i.loading}</span>` : u}
|
|
1525
|
-
${
|
|
1526
|
-
|
|
1529
|
+
${C(
|
|
1530
|
+
n,
|
|
1527
1531
|
(c) => c.value,
|
|
1528
1532
|
(c) => h`
|
|
1529
|
-
<label class=${
|
|
1533
|
+
<label class=${x({ "filter-option": !0, "filter-remaining": d(c.value) })}>
|
|
1530
1534
|
<input
|
|
1531
1535
|
type="checkbox"
|
|
1532
1536
|
.checked=${g(o, c.value)}
|
|
@@ -1536,7 +1540,7 @@ class V extends E {
|
|
|
1536
1540
|
</label>
|
|
1537
1541
|
`
|
|
1538
1542
|
)}
|
|
1539
|
-
${
|
|
1543
|
+
${n.length === 0 && !t.loading ? h`<span class="filter-no-values">${i.filterNoValues}</span>` : u}
|
|
1540
1544
|
</div>
|
|
1541
1545
|
${r?.hasMore ? h`<span class="filter-has-more">${i.filterHasMore}</span>` : u}
|
|
1542
1546
|
`,
|
|
@@ -1552,13 +1556,13 @@ class V extends E {
|
|
|
1552
1556
|
* displayed.
|
|
1553
1557
|
*/
|
|
1554
1558
|
renderComparisonFilterPanel(e, t, a) {
|
|
1555
|
-
const i = this.mergedLabels, s = e.label ?? e.name, r = e.filterOperators?.length ? e.filterOperators :
|
|
1559
|
+
const i = this.mergedLabels, s = e.label ?? e.name, r = e.filterOperators?.length ? e.filterOperators : N, o = t.selection.operator ?? r[0], n = t.selection.operand, d = e.filterInputType ?? "number", c = () => a.querySelector(".filter-operand")?.value ?? "", p = () => a.querySelector(".filter-operator")?.value ?? o;
|
|
1556
1560
|
v(
|
|
1557
1561
|
h`
|
|
1558
1562
|
<button
|
|
1559
1563
|
type="button"
|
|
1560
1564
|
class="filter-clear"
|
|
1561
|
-
?disabled=${
|
|
1565
|
+
?disabled=${n == null}
|
|
1562
1566
|
@click=${() => this.onFilterClear(e.name)}
|
|
1563
1567
|
>
|
|
1564
1568
|
${i.filterClear(s)}
|
|
@@ -1572,7 +1576,7 @@ class V extends E {
|
|
|
1572
1576
|
${r.map(
|
|
1573
1577
|
(f) => h`
|
|
1574
1578
|
<option value=${f} ?selected=${f === o}>
|
|
1575
|
-
${
|
|
1579
|
+
${D[f]} ${i.filterOperatorLabel(f)}
|
|
1576
1580
|
</option>
|
|
1577
1581
|
`
|
|
1578
1582
|
)}
|
|
@@ -1580,7 +1584,7 @@ class V extends E {
|
|
|
1580
1584
|
<input
|
|
1581
1585
|
class="filter-operand"
|
|
1582
1586
|
type=${d}
|
|
1583
|
-
.value=${
|
|
1587
|
+
.value=${T(t.operandText)}
|
|
1584
1588
|
aria-label=${i.filterOperand}
|
|
1585
1589
|
@input=${() => this.applyComparison(e.name, p(), c())}
|
|
1586
1590
|
/>
|
|
@@ -1592,7 +1596,7 @@ class V extends E {
|
|
|
1592
1596
|
onFilterToggle(e, t, a) {
|
|
1593
1597
|
const i = this.filterState(e);
|
|
1594
1598
|
if (!i) return;
|
|
1595
|
-
const s = a ? [...i.selection.values, t] : i.selection.values.filter((r) =>
|
|
1599
|
+
const s = a ? [...i.selection.values, t] : i.selection.values.filter((r) => !E(r.value, t.value));
|
|
1596
1600
|
i.ctx.apply(s, i.selection.inverse);
|
|
1597
1601
|
}
|
|
1598
1602
|
onFilterClear(e) {
|
|
@@ -1627,7 +1631,7 @@ class V extends E {
|
|
|
1627
1631
|
<th class="filter-cell p-0" data-column=${e.name} scope="col">
|
|
1628
1632
|
<button
|
|
1629
1633
|
type="button"
|
|
1630
|
-
class=${
|
|
1634
|
+
class=${x({
|
|
1631
1635
|
"filter-trigger": !0,
|
|
1632
1636
|
"p-2": !0,
|
|
1633
1637
|
"rounded-0": !0,
|
|
@@ -1649,14 +1653,14 @@ class V extends E {
|
|
|
1649
1653
|
`;
|
|
1650
1654
|
}
|
|
1651
1655
|
renderHeader(e, t) {
|
|
1652
|
-
const a = e.sortable ?? !0, i = this._sortColumns.findIndex((d) => d.property === e.name), s = 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,
|
|
1653
|
-
return typeof r == "number" && (
|
|
1656
|
+
const a = e.sortable ?? !0, i = this._sortColumns.findIndex((d) => d.property === e.name), s = 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 = {};
|
|
1657
|
+
return typeof r == "number" && (n.width = `${r}px`, n.minWidth = `${r}px`), h`
|
|
1654
1658
|
<th
|
|
1655
1659
|
scope="col"
|
|
1656
1660
|
data-column=${e.name}
|
|
1657
1661
|
data-sortable=${a ? "true" : "false"}
|
|
1658
1662
|
aria-sort=${s ? s === "ascending" ? "ascending" : "descending" : "none"}
|
|
1659
|
-
style=${_(
|
|
1663
|
+
style=${_(n)}
|
|
1660
1664
|
>
|
|
1661
1665
|
${a ? h`<button
|
|
1662
1666
|
type="button"
|
|
@@ -1674,7 +1678,7 @@ class V extends E {
|
|
|
1674
1678
|
tabindex="0"
|
|
1675
1679
|
aria-orientation="vertical"
|
|
1676
1680
|
aria-label=${this.mergedLabels.resizeColumn(e.label ?? e.name)}
|
|
1677
|
-
aria-valuemin
|
|
1681
|
+
aria-valuemin=${F}
|
|
1678
1682
|
aria-valuenow=${Math.round(r ?? 0) || u}
|
|
1679
1683
|
@pointerdown=${(d) => this.startColumnResize(e, d)}
|
|
1680
1684
|
@keydown=${(d) => this.onResizeHandleKeydown(e, d)}
|
|
@@ -1683,30 +1687,30 @@ class V extends E {
|
|
|
1683
1687
|
`;
|
|
1684
1688
|
}
|
|
1685
1689
|
renderRow(e, t, a, i) {
|
|
1686
|
-
const { row: s, depth: r, isExpanded: o, isPlaceholder:
|
|
1690
|
+
const { row: s, depth: r, isExpanded: o, isPlaceholder: n } = e, d = !n && this._selectedIds.has(t), c = !n && this._cutIds.has(t), p = !n && this._focusedRowKey === t, f = n ? 0 : this.extractChildCount(s), b = this._tree && !n && f > 0, I = !n && s != null && this.isParentIndeterminate(s);
|
|
1687
1691
|
return h`
|
|
1688
1692
|
<tr
|
|
1689
1693
|
role="row"
|
|
1690
1694
|
aria-rowindex=${a + 1 + (this.hasFilterRow ? 2 : 1)}
|
|
1691
1695
|
aria-level=${this._tree ? r + 1 : u}
|
|
1692
1696
|
aria-expanded=${this._tree && f > 0 ? o ? "true" : "false" : u}
|
|
1693
|
-
aria-busy=${
|
|
1694
|
-
aria-selected=${!
|
|
1697
|
+
aria-busy=${n ? "true" : u}
|
|
1698
|
+
aria-selected=${!n && this._selectionMode !== "none" ? d ? "true" : "false" : u}
|
|
1695
1699
|
data-row-key=${t}
|
|
1696
1700
|
data-selected=${d ? "true" : "false"}
|
|
1697
1701
|
data-cut=${c ? "true" : "false"}
|
|
1698
1702
|
data-focused=${p ? "true" : "false"}
|
|
1699
|
-
data-placeholder=${
|
|
1703
|
+
data-placeholder=${n ? "true" : "false"}
|
|
1700
1704
|
data-depth=${this._tree ? String(r) : u}
|
|
1701
|
-
data-clickable=${!
|
|
1702
|
-
tabindex=${!
|
|
1703
|
-
@focus=${
|
|
1705
|
+
data-clickable=${!n && (this._selectionMode !== "none" || this.hasRowClickListeners()) ? "true" : "false"}
|
|
1706
|
+
tabindex=${!n && (this._selectionMode !== "none" || this._tree) ? this._focusedRowKey === t || this._focusedRowKey === null && a === 0 ? "0" : "-1" : u}
|
|
1707
|
+
@focus=${n ? null : () => {
|
|
1704
1708
|
this._focusedRowKey = t, this.requestUpdate();
|
|
1705
1709
|
}}
|
|
1706
|
-
@click=${
|
|
1707
|
-
@dblclick=${
|
|
1708
|
-
@contextmenu=${
|
|
1709
|
-
@keydown=${
|
|
1710
|
+
@click=${n ? null : (m) => this.onRowClick(s, t, a, m)}
|
|
1711
|
+
@dblclick=${n ? null : (m) => this.onRowDblClick(s, t, a, m)}
|
|
1712
|
+
@contextmenu=${n ? null : (m) => this.onRowContextMenu(s, t, a, m)}
|
|
1713
|
+
@keydown=${n ? null : (m) => this.onRowKeydown(s, t, a, e.parentId, r, o, f, m)}
|
|
1710
1714
|
>
|
|
1711
1715
|
${this._tree ? h`<td class="tree-chevron-cell" style=${_({ paddingInlineStart: `${r * this._treeIndent}rem` })}>
|
|
1712
1716
|
${b ? h`<button
|
|
@@ -1719,14 +1723,14 @@ class V extends E {
|
|
|
1719
1723
|
>${o ? "▾" : "▸"}</button>` : u}
|
|
1720
1724
|
</td>` : u}
|
|
1721
1725
|
${i ? h`<td class="checkbox-cell" @click=${(m) => m.stopPropagation()}>
|
|
1722
|
-
${
|
|
1726
|
+
${n ? u : h`<mp-checkbox
|
|
1723
1727
|
aria-label=${this.mergedLabels.selectRow(a + 1)}
|
|
1724
1728
|
.checked=${d}
|
|
1725
|
-
.indeterminate=${
|
|
1726
|
-
@change=${(
|
|
1729
|
+
.indeterminate=${I}
|
|
1730
|
+
@change=${() => this.onRowCheckboxToggle(s, t)}
|
|
1727
1731
|
></mp-checkbox>`}
|
|
1728
1732
|
</td>` : u}
|
|
1729
|
-
${this._rowRenderer ? this.renderRowFromRenderer(s, a, { depth: r, isExpanded: o, isPlaceholder:
|
|
1733
|
+
${this._rowRenderer ? this.renderRowFromRenderer(s, a, { depth: r, isExpanded: o, isPlaceholder: n }) : n ? h`<td colspan=${this._columns.length} class="tree-placeholder-cell" aria-label=${this.mergedLabels.loading}>…</td>` : this._columns.map((m) => this.renderCell(s, m, a))}
|
|
1730
1734
|
</tr>
|
|
1731
1735
|
`;
|
|
1732
1736
|
}
|
|
@@ -1734,7 +1738,7 @@ class V extends E {
|
|
|
1734
1738
|
const i = this._rowRenderer(e, t, a);
|
|
1735
1739
|
if (i == null)
|
|
1736
1740
|
return a.isPlaceholder ? h`<td colspan=${this._columns.length} class="tree-placeholder-cell" aria-label=${this.mergedLabels.loading}>…</td>` : this._columns.map((s) => this.renderCell(e, s, t));
|
|
1737
|
-
if (Array.isArray(i) ||
|
|
1741
|
+
if (Array.isArray(i) || J(i)) {
|
|
1738
1742
|
const s = [];
|
|
1739
1743
|
for (const r of i) s.push(r);
|
|
1740
1744
|
return s;
|
|
@@ -1742,7 +1746,7 @@ class V extends E {
|
|
|
1742
1746
|
return i;
|
|
1743
1747
|
}
|
|
1744
1748
|
renderCell(e, t, a) {
|
|
1745
|
-
const i = t.cellRenderer ? t.cellRenderer(e, t, a) :
|
|
1749
|
+
const i = t.cellRenderer ? t.cellRenderer(e, t, a) : Y(e, t);
|
|
1746
1750
|
return h`<td class=${t.cellClass ?? ""} data-column=${t.name}>${w(i)}</td>`;
|
|
1747
1751
|
}
|
|
1748
1752
|
renderFooter(e) {
|
|
@@ -1807,12 +1811,12 @@ class V extends E {
|
|
|
1807
1811
|
if (this._cachedFlatList !== null) return this._cachedFlatList;
|
|
1808
1812
|
if (!this._tree) {
|
|
1809
1813
|
if (this.isRootWindowed()) {
|
|
1810
|
-
const r = this._totalRecords ?? this._data.length, o = Math.max(1, this._perPage),
|
|
1814
|
+
const r = this._totalRecords ?? this._data.length, o = Math.max(1, this._perPage), n = new Array(r);
|
|
1811
1815
|
for (let d = 0; d < r; d++) {
|
|
1812
1816
|
const c = Math.floor(d / o) + 1, p = d % o, f = c === 1 ? this._data[p] : this._pageCache.get(c)?.[p];
|
|
1813
|
-
|
|
1817
|
+
n[d] = f !== void 0 ? { row: f, key: this._rowKey(f, d), depth: 0, parentId: null, isExpanded: !1, isPlaceholder: !1 } : { row: void 0, key: `__placeholder-flat-${d}`, depth: 0, parentId: null, page: c, isExpanded: !1, isPlaceholder: !0 };
|
|
1814
1818
|
}
|
|
1815
|
-
return this._cachedFlatList =
|
|
1819
|
+
return this._cachedFlatList = n;
|
|
1816
1820
|
}
|
|
1817
1821
|
const s = (() => {
|
|
1818
1822
|
let r = this._data;
|
|
@@ -1832,22 +1836,22 @@ class V extends E {
|
|
|
1832
1836
|
}));
|
|
1833
1837
|
}
|
|
1834
1838
|
const e = [], t = Math.max(1, this._perPage), a = (s) => this._autoSort && this._sortColumns.length > 0 ? y(s, this._sortColumns) : s, i = (s, r, o) => {
|
|
1835
|
-
const
|
|
1836
|
-
if (e.push({ row: s, key: this._rowKey(s, e.length), depth: r, parentId: o, isExpanded: d, isPlaceholder: !1 }), !d || c === 0 ||
|
|
1837
|
-
const p = this._childCache.get(
|
|
1839
|
+
const n = this.extractId(s), d = n != null && this._expandedIds.has(n), c = this.extractChildCount(s);
|
|
1840
|
+
if (e.push({ row: s, key: this._rowKey(s, e.length), depth: r, parentId: o, isExpanded: d, isPlaceholder: !1 }), !d || c === 0 || n == null) return;
|
|
1841
|
+
const p = this._childCache.get(n);
|
|
1838
1842
|
if (p && p.length > 0) {
|
|
1839
|
-
for (const b of a(p)) i(b, r + 1,
|
|
1840
|
-
const f = this._childTotals.get(
|
|
1843
|
+
for (const b of a(p)) i(b, r + 1, n);
|
|
1844
|
+
const f = this._childTotals.get(n) ?? p.length;
|
|
1841
1845
|
for (let b = 0; b < Math.max(0, f - p.length); b++)
|
|
1842
|
-
e.push({ row: void 0, key: `__placeholder-${String(
|
|
1846
|
+
e.push({ row: void 0, key: `__placeholder-${String(n)}-${p.length + b}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
|
|
1843
1847
|
} else
|
|
1844
1848
|
for (let f = 0; f < c; f++)
|
|
1845
|
-
e.push({ row: void 0, key: `__placeholder-${String(
|
|
1849
|
+
e.push({ row: void 0, key: `__placeholder-${String(n)}-${f}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
|
|
1846
1850
|
};
|
|
1847
1851
|
if (this.isRootWindowed()) {
|
|
1848
1852
|
const s = this._totalRecords ?? this._data.length;
|
|
1849
1853
|
for (let r = 0; r < s; r++) {
|
|
1850
|
-
const o = Math.floor(r / t) + 1,
|
|
1854
|
+
const o = Math.floor(r / t) + 1, n = r % t, d = o === 1 ? this._data[n] : this._pageCache.get(o)?.[n];
|
|
1851
1855
|
d === void 0 ? e.push({ row: void 0, key: `__placeholder-root-${r}`, depth: 0, parentId: null, page: o, isExpanded: !1, isPlaceholder: !0 }) : i(d, 0, null);
|
|
1852
1856
|
}
|
|
1853
1857
|
} else {
|
|
@@ -1911,8 +1915,8 @@ class V extends E {
|
|
|
1911
1915
|
const s = this._childCache.get(i);
|
|
1912
1916
|
if (!s || s.length === 0) return { selected: 0, total: 0 };
|
|
1913
1917
|
let r = 0, o = 0;
|
|
1914
|
-
for (const
|
|
1915
|
-
const d = this._rowKey(
|
|
1918
|
+
for (const n of s) {
|
|
1919
|
+
const d = this._rowKey(n, -1), c = this._selectedIds.has(d) ? 1 : 0, p = t(n);
|
|
1916
1920
|
r += c + p.selected, o += 1 + p.total;
|
|
1917
1921
|
}
|
|
1918
1922
|
return o > 0 && r > 0 && r < o && e.add(this._rowKey(a, -1)), { selected: r, total: o };
|
|
@@ -2029,33 +2033,33 @@ class V extends E {
|
|
|
2029
2033
|
}));
|
|
2030
2034
|
}
|
|
2031
2035
|
/** Keyboard handling on a tree-mode row. Arrow keys + Enter/Space toggle expansion. */
|
|
2032
|
-
onRowKeydown(e, t, a, i, s, r, o,
|
|
2033
|
-
if (!
|
|
2034
|
-
if (
|
|
2035
|
-
|
|
2036
|
+
onRowKeydown(e, t, a, i, s, r, o, n) {
|
|
2037
|
+
if (!n.altKey && n.composedPath()[0] === n.currentTarget) {
|
|
2038
|
+
if (n.key === "ArrowDown" || n.key === "ArrowUp") {
|
|
2039
|
+
n.preventDefault();
|
|
2036
2040
|
const d = Array.from(
|
|
2037
2041
|
this.renderRoot.querySelectorAll("tbody tr[data-row-key]")
|
|
2038
|
-
), c = d.findIndex((f) => f.dataset.rowKey === t), p = d[c + (
|
|
2042
|
+
), c = d.findIndex((f) => f.dataset.rowKey === t), p = d[c + (n.key === "ArrowDown" ? 1 : -1)];
|
|
2039
2043
|
p && p.focus();
|
|
2040
2044
|
return;
|
|
2041
2045
|
}
|
|
2042
2046
|
if (this._tree) {
|
|
2043
|
-
if (
|
|
2044
|
-
this.toggleExpand(e, i, s,
|
|
2047
|
+
if (n.key === "ArrowRight" && o > 0 && !r) {
|
|
2048
|
+
this.toggleExpand(e, i, s, n);
|
|
2045
2049
|
return;
|
|
2046
2050
|
}
|
|
2047
|
-
if (
|
|
2048
|
-
this.toggleExpand(e, i, s,
|
|
2051
|
+
if (n.key === "ArrowLeft" && r) {
|
|
2052
|
+
this.toggleExpand(e, i, s, n);
|
|
2049
2053
|
return;
|
|
2050
2054
|
}
|
|
2051
|
-
if ((
|
|
2052
|
-
this.toggleExpand(e, i, s,
|
|
2055
|
+
if ((n.key === "Enter" || n.key === " ") && o > 0) {
|
|
2056
|
+
this.toggleExpand(e, i, s, n);
|
|
2053
2057
|
return;
|
|
2054
2058
|
}
|
|
2055
2059
|
}
|
|
2056
|
-
(
|
|
2060
|
+
(n.key === "Enter" || n.key === " ") && this._selectionMode !== "none" && (n.preventDefault(), this._focusedRowKey = t, this.handleSelectionOnClick(t, n), this.requestUpdate(), this.dispatchEvent(
|
|
2057
2061
|
new CustomEvent("mp-datatable-row-click", {
|
|
2058
|
-
detail: { row: e, rowIndex: a, rowKey: t, originalEvent:
|
|
2062
|
+
detail: { row: e, rowIndex: a, rowKey: t, originalEvent: n },
|
|
2059
2063
|
bubbles: !0,
|
|
2060
2064
|
composed: !0
|
|
2061
2065
|
})
|
|
@@ -2065,19 +2069,22 @@ class V extends E {
|
|
|
2065
2069
|
hasRowClickListeners() {
|
|
2066
2070
|
return !0;
|
|
2067
2071
|
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Bound only to the sort <button>, which renders only for sortable columns;
|
|
2074
|
+
* the resize handle is the button's sibling, so its clicks never land here.
|
|
2075
|
+
*/
|
|
2068
2076
|
onHeaderClick(e, t) {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
const r = s.find((o) => o.property === e.name);
|
|
2077
|
+
const a = B(this._sortColumns, e.name, t.shiftKey);
|
|
2078
|
+
this._sortColumns = a, this._page = 1;
|
|
2079
|
+
const i = a.find((s) => s.property === e.name);
|
|
2073
2080
|
this.liveAnnouncer.announce(
|
|
2074
2081
|
this.mergedLabels.announceSorted(
|
|
2075
2082
|
e.label ?? e.name,
|
|
2076
|
-
|
|
2083
|
+
i ? i.direction === "ascending" ? "ascending" : "descending" : "none"
|
|
2077
2084
|
)
|
|
2078
2085
|
), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
|
|
2079
2086
|
new CustomEvent("mp-datatable-sort-change", {
|
|
2080
|
-
detail: { sortColumns:
|
|
2087
|
+
detail: { sortColumns: a },
|
|
2081
2088
|
bubbles: !0,
|
|
2082
2089
|
composed: !0
|
|
2083
2090
|
})
|
|
@@ -2109,25 +2116,15 @@ class V extends E {
|
|
|
2109
2116
|
composed: !0,
|
|
2110
2117
|
cancelable: !0
|
|
2111
2118
|
})
|
|
2112
|
-
);
|
|
2119
|
+
) || i.preventDefault();
|
|
2113
2120
|
}
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
const o = this.collectDescendantKeys(e);
|
|
2122
|
-
if (r)
|
|
2123
|
-
for (const l of o) s.add(l);
|
|
2124
|
-
else
|
|
2125
|
-
for (const l of o) s.delete(l);
|
|
2126
|
-
}
|
|
2127
|
-
this._selectedIds = s;
|
|
2128
|
-
}
|
|
2129
|
-
this.emitSelectionChange(), this.requestUpdate();
|
|
2130
|
-
}
|
|
2121
|
+
/** Row checkboxes render only in `'multiple'` mode, so this is multi-select toggling. */
|
|
2122
|
+
onRowCheckboxToggle(e, t) {
|
|
2123
|
+
const a = !this._selectedIds.has(t), i = /* @__PURE__ */ new Set([
|
|
2124
|
+
t,
|
|
2125
|
+
...this._tree && this._selectionStrategy === "cascading" ? this.collectDescendantKeys(e) : []
|
|
2126
|
+
]);
|
|
2127
|
+
this._selectedIds = a ? /* @__PURE__ */ new Set([...this._selectedIds, ...i]) : new Set([...this._selectedIds].filter((s) => !i.has(s))), this.emitSelectionChange(), this.requestUpdate();
|
|
2131
2128
|
}
|
|
2132
2129
|
/**
|
|
2133
2130
|
* Clears the entire selection. The header checkbox is only rendered when
|
|
@@ -2148,8 +2145,8 @@ class V extends E {
|
|
|
2148
2145
|
if (t.shiftKey && this._selectionAnchorKey && this._selectionAnchorKey !== e) {
|
|
2149
2146
|
const a = this.computeVisibleRows(), i = a.findIndex((r) => r.key === this._selectionAnchorKey), s = a.findIndex((r) => r.key === e);
|
|
2150
2147
|
if (i >= 0 && s >= 0) {
|
|
2151
|
-
const [r, o] = i < s ? [i, s] : [s, i],
|
|
2152
|
-
this._selectedIds = /* @__PURE__ */ new Set([...this._selectedIds, ...
|
|
2148
|
+
const [r, o] = i < s ? [i, s] : [s, i], n = a.slice(r, o + 1).map((d) => d.key);
|
|
2149
|
+
this._selectedIds = /* @__PURE__ */ new Set([...this._selectedIds, ...n]), this.emitSelectionChange();
|
|
2153
2150
|
return;
|
|
2154
2151
|
}
|
|
2155
2152
|
}
|
|
@@ -2204,7 +2201,10 @@ class V extends E {
|
|
|
2204
2201
|
onResizeHandleKeydown(e, t) {
|
|
2205
2202
|
if (!this._resizableColumns || t.key !== "ArrowLeft" && t.key !== "ArrowRight") return;
|
|
2206
2203
|
t.preventDefault(), t.stopPropagation();
|
|
2207
|
-
const i = t.currentTarget.closest("th"), s = this._columnWidths.get(e.name) ?? i?.getBoundingClientRect().width ?? 100, r =
|
|
2204
|
+
const i = t.currentTarget.closest("th"), s = this._columnWidths.get(e.name) ?? i?.getBoundingClientRect().width ?? 100, r = R(
|
|
2205
|
+
s,
|
|
2206
|
+
t.key === "ArrowRight" ? $ : -$
|
|
2207
|
+
);
|
|
2208
2208
|
this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(e.name, r), this.requestUpdate();
|
|
2209
2209
|
}
|
|
2210
2210
|
startColumnResize(e, t) {
|
|
@@ -2216,23 +2216,23 @@ class V extends E {
|
|
|
2216
2216
|
this.resizeState = { columnName: e.name, startX: t.clientX, startWidth: s, handle: a }, a.classList.add("active"), a.setPointerCapture(t.pointerId), a.addEventListener("pointermove", this.onColumnResizeMove), a.addEventListener("pointerup", this.onColumnResizeEnd), a.addEventListener("pointercancel", this.onColumnResizeEnd);
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
|
-
function
|
|
2220
|
-
if (
|
|
2221
|
-
const t =
|
|
2219
|
+
function Y(l, e) {
|
|
2220
|
+
if (l == null || typeof l != "object") return "";
|
|
2221
|
+
const t = l[e.name];
|
|
2222
2222
|
return t == null ? "" : String(t);
|
|
2223
2223
|
}
|
|
2224
|
-
function
|
|
2225
|
-
return
|
|
2224
|
+
function J(l) {
|
|
2225
|
+
return l != null && typeof l != "string" && typeof l[Symbol.iterator] == "function";
|
|
2226
2226
|
}
|
|
2227
|
-
function w(
|
|
2228
|
-
return
|
|
2227
|
+
function w(l) {
|
|
2228
|
+
return l == null || l === !1 ? u : (l instanceof Node || typeof l == "object" && "_$litType$" in l, l);
|
|
2229
2229
|
}
|
|
2230
|
-
|
|
2231
|
-
typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable",
|
|
2230
|
+
z("datatable", H);
|
|
2231
|
+
typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable", X);
|
|
2232
2232
|
export {
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2233
|
+
W as D,
|
|
2234
|
+
X as M,
|
|
2235
|
+
B as c,
|
|
2236
|
+
H as d,
|
|
2237
2237
|
y as s
|
|
2238
2238
|
};
|