@mintplayer/web-components 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +15 -0
  2. package/badge/src/styles/badge.styles.d.ts +2 -0
  3. package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
  4. package/chunks/{mp-datatable-GmKqaN8y.mjs → mp-datatable-UJI8E73X.mjs} +484 -476
  5. package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
  6. package/datatable/index.mjs +2 -2
  7. package/datatable/src/components/mp-datatable.d.ts +9 -1
  8. package/datatable/src/index.d.ts +1 -1
  9. package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
  10. package/datatable/src/styles/index.d.ts +1 -1
  11. package/dock/index.mjs +477 -492
  12. package/dock/src/components/mint-dock-manager.element.d.ts +10 -8
  13. package/dock/src/core/index.d.ts +1 -0
  14. package/dock/src/core/intersection-sizing.d.ts +83 -0
  15. package/dock/src/core/layout-tree.d.ts +23 -2
  16. package/dock/src/core/types.d.ts +14 -0
  17. package/file-manager/index.mjs +30 -29
  18. package/file-manager/src/components/mp-file-manager.d.ts +2 -0
  19. package/light-dom/index.d.ts +1 -0
  20. package/light-dom/index.mjs +11 -0
  21. package/light-dom/src/index.d.ts +2 -0
  22. package/light-dom/src/install-light-styles.d.ts +25 -0
  23. package/light-dom/src/scoped-html.d.ts +26 -0
  24. package/package.json +5 -1
  25. package/query-builder/index.mjs +1472 -2651
  26. package/query-builder/src/index.d.ts +4 -0
  27. package/query-builder/src/mp-query-builder.element.d.ts +1 -1
  28. package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
  29. package/query-builder/src/mp-query-condition.element.d.ts +1 -1
  30. package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
  31. package/query-builder/src/mp-query-group.element.d.ts +1 -1
  32. package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
  33. package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
  34. package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
  35. package/tree-select/index.mjs +60 -58
  36. package/tree-select/src/components/mp-tree-select.d.ts +1 -1
  37. package/tree-select/src/index.d.ts +1 -1
  38. package/tree-select/src/styles/index.d.ts +1 -1
  39. package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
  40. package/treeview/index.mjs +3 -3
  41. package/treeview/src/components/mp-treeview.d.ts +1 -1
  42. package/treeview/src/index.d.ts +1 -1
  43. package/treeview/src/styles/index.d.ts +1 -1
  44. package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
@@ -1,12 +1,13 @@
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";
6
- import { styleMap as m } from "lit/directives/style-map.js";
1
+ import { unsafeCSS as x, LitElement as C, nothing as h } from "lit";
2
+ import { s as R, i as S } from "./install-light-styles-DbCAGFOC.mjs";
3
+ import { L as $ } from "./live-announcer-Bi0orG4n.mjs";
4
+ import { a as I, F as P } from "./focus-restore-DxuP1Oe2.mjs";
5
+ import { H as E } from "./host-aria-WSGs7SPQ.mjs";
6
+ import { repeat as M } from "lit/directives/repeat.js";
7
+ import { styleMap as b } from "lit/directives/style-map.js";
7
8
  import "./mp-pagination-Dea75mD4.mjs";
8
9
  import "./mp-checkbox-CzwS7Y_t.mjs";
9
- const E = {
10
+ const K = {
10
11
  treeChevronColumn: "Expand or collapse",
11
12
  deselectAll: "Deselect all",
12
13
  selectAll: "Select all",
@@ -16,12 +17,12 @@ const E = {
16
17
  rowsPerPage: "Rows per page",
17
18
  resizeColumn: (l) => `Resize column ${l}`,
18
19
  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}`,
20
+ announceSorted: (l, t) => t === "none" ? `Sorting removed from ${l}` : `Sorted by ${l}, ${t}`,
21
+ announcePage: (l, t) => `Page ${l} of ${t}`,
21
22
  announceSelection: (l) => l === 1 ? "1 row selected" : `${l} rows selected`,
22
23
  announceLoaded: (l) => l === 1 ? "Loaded 1 row" : `Loaded ${l} rows`
23
- }, M = x(`@charset "UTF-8";
24
- :host {
24
+ }, z = x(`@charset "UTF-8";
25
+ mp-datatable {
25
26
  display: block;
26
27
  width: 100%;
27
28
  position: relative;
@@ -33,62 +34,60 @@ const E = {
33
34
  --mp-datatable-resize-handle-color: var(--bs-primary, #0d6efd);
34
35
  }
35
36
 
36
- * {
37
+ [data-mps=datatable] {
37
38
  box-sizing: border-box;
38
39
  }
39
40
 
40
- .datatable-shell {
41
+ .datatable-shell[data-mps=datatable] {
41
42
  display: flex;
42
43
  flex-direction: column;
43
44
  width: 100%;
44
45
  height: 100%;
45
46
  }
46
47
 
47
- .datatable-scroll {
48
+ .datatable-scroll[data-mps=datatable] {
48
49
  overflow: auto;
49
50
  flex: 1 1 auto;
50
51
  }
51
52
 
52
- .datatable-scroll.datatable-virtual {
53
+ .datatable-scroll.datatable-virtual[data-mps=datatable] {
53
54
  max-height: var(--mp-datatable-virtual-max-height, 480px);
54
55
  }
55
- .datatable-scroll.datatable-virtual thead th {
56
+ .datatable-scroll.datatable-virtual[data-mps=datatable] thead[data-mps=datatable] th[data-mps=datatable] {
56
57
  position: sticky;
57
58
  top: 0;
58
59
  z-index: 1;
59
60
  background-color: var(--bs-body-bg, #fff);
60
61
  }
61
- .datatable-scroll.datatable-virtual thead th[data-sortable=true]:hover {
62
+ .datatable-scroll.datatable-virtual[data-mps=datatable] thead[data-mps=datatable] th[data-sortable=true]:hover[data-mps=datatable] {
62
63
  background-color: var(--bs-body-bg, #fff);
63
64
  background-image: linear-gradient(var(--mp-datatable-row-hover-bg), var(--mp-datatable-row-hover-bg));
64
65
  }
65
66
 
66
- tr.virtual-spacer {
67
+ tr.virtual-spacer[data-mps=datatable] {
67
68
  pointer-events: none;
68
69
  }
69
-
70
- tr.virtual-spacer > td {
70
+ tr.virtual-spacer[data-mps=datatable] > td {
71
71
  border-bottom: 0;
72
72
  }
73
73
 
74
- table {
74
+ table[data-mps=datatable] {
75
75
  width: 100%;
76
76
  border-collapse: collapse;
77
77
  margin: 0;
78
78
  table-layout: auto;
79
79
  }
80
80
 
81
- table.measured {
81
+ table.measured[data-mps=datatable] {
82
82
  table-layout: fixed;
83
83
  }
84
-
85
- tbody td {
84
+ tbody[data-mps=datatable] > tr[data-mps=datatable] > td {
86
85
  white-space: nowrap;
87
86
  overflow: hidden;
88
87
  text-overflow: ellipsis;
89
88
  }
90
89
 
91
- thead th {
90
+ thead[data-mps=datatable] th[data-mps=datatable] {
92
91
  background-color: var(--bs-table-bg, transparent);
93
92
  border-bottom: 1px solid var(--mp-datatable-border-color);
94
93
  text-align: left;
@@ -99,42 +98,42 @@ thead th {
99
98
  user-select: none;
100
99
  }
101
100
 
102
- thead th[data-sortable=true] {
101
+ thead[data-mps=datatable] th[data-sortable=true][data-mps=datatable] {
103
102
  cursor: pointer;
104
103
  padding-right: 2rem;
105
104
  }
106
- thead th[data-sortable=true]::before, thead th[data-sortable=true]::after {
105
+ thead[data-mps=datatable] th[data-sortable=true][data-mps=datatable]::before, thead[data-mps=datatable] th[data-sortable=true][data-mps=datatable]::after {
107
106
  position: absolute;
108
107
  display: block;
109
108
  opacity: 0.3;
110
109
  bottom: 0.5em;
111
110
  }
112
- thead th[data-sortable=true]::before {
111
+ thead[data-mps=datatable] th[data-sortable=true][data-mps=datatable]::before {
113
112
  content: "↑";
114
113
  right: 1em;
115
114
  }
116
- thead th[data-sortable=true]::after {
115
+ thead[data-mps=datatable] th[data-sortable=true][data-mps=datatable]::after {
117
116
  content: "↓";
118
117
  right: 0.5em;
119
118
  }
120
- thead th[data-sortable=true][aria-sort=ascending]::after {
119
+ thead[data-mps=datatable] th[data-sortable=true][aria-sort=ascending][data-mps=datatable]::after {
121
120
  opacity: 1;
122
121
  }
123
- thead th[data-sortable=true][aria-sort=descending]::before {
122
+ thead[data-mps=datatable] th[data-sortable=true][aria-sort=descending][data-mps=datatable]::before {
124
123
  opacity: 1;
125
124
  }
126
125
 
127
- thead th[data-sortable=true]:hover {
126
+ thead[data-mps=datatable] th[data-sortable=true]:hover[data-mps=datatable] {
128
127
  background-color: var(--mp-datatable-row-hover-bg);
129
128
  }
130
129
 
131
- .header-cell {
130
+ .header-cell[data-mps=datatable] {
132
131
  display: inline-flex;
133
132
  align-items: center;
134
133
  gap: 0.4rem;
135
134
  }
136
135
 
137
- button.header-sort {
136
+ button.header-sort[data-mps=datatable] {
138
137
  border: 0;
139
138
  padding: 0;
140
139
  margin: 0;
@@ -145,18 +144,18 @@ button.header-sort {
145
144
  cursor: pointer;
146
145
  }
147
146
 
148
- .resize-handle:focus-visible,
149
- button.header-sort:focus-visible {
147
+ .resize-handle:focus-visible[data-mps=datatable],
148
+ button.header-sort:focus-visible[data-mps=datatable] {
150
149
  outline: 2px solid var(--mp-datatable-resize-handle-color);
151
150
  outline-offset: 1px;
152
151
  }
153
152
 
154
- tbody tr:focus-visible {
153
+ tbody[data-mps=datatable] tr:focus-visible[data-mps=datatable] {
155
154
  outline: 2px solid var(--mp-datatable-resize-handle-color);
156
155
  outline-offset: -2px;
157
156
  }
158
157
 
159
- .sort-index {
158
+ .sort-index[data-mps=datatable] {
160
159
  position: absolute;
161
160
  right: 0.1em;
162
161
  bottom: 0.3em;
@@ -165,7 +164,7 @@ tbody tr:focus-visible {
165
164
  opacity: 0.7;
166
165
  }
167
166
 
168
- .resize-handle {
167
+ .resize-handle[data-mps=datatable] {
169
168
  position: absolute;
170
169
  right: 0;
171
170
  top: 0;
@@ -176,63 +175,62 @@ tbody tr:focus-visible {
176
175
  z-index: 2;
177
176
  }
178
177
 
179
- .resize-handle:hover,
180
- .resize-handle.active {
178
+ .resize-handle:hover[data-mps=datatable],
179
+ .resize-handle.active[data-mps=datatable] {
181
180
  background-color: var(--mp-datatable-resize-handle-color);
182
181
  }
183
-
184
- tbody td {
182
+ tbody[data-mps=datatable] > tr[data-mps=datatable] > td {
185
183
  padding: 0.5rem 0.75rem;
186
184
  border-bottom: 1px solid var(--mp-datatable-border-color);
187
185
  vertical-align: middle;
188
186
  }
189
-
190
- tbody td svg,
191
- tbody td img {
187
+ tbody[data-mps=datatable] > tr[data-mps=datatable] > td svg,
188
+ tbody[data-mps=datatable] > tr[data-mps=datatable] > td img {
192
189
  max-width: var(--mp-datatable-cell-media-max-width, none);
193
190
  height: auto;
194
191
  vertical-align: middle;
195
192
  }
196
193
 
197
- tbody tr {
194
+ tbody[data-mps=datatable] tr[data-mps=datatable] {
198
195
  cursor: default;
199
196
  }
200
197
 
201
- tbody tr[data-clickable=true] {
198
+ tbody[data-mps=datatable] tr[data-clickable=true][data-mps=datatable] {
202
199
  cursor: pointer;
203
200
  }
204
201
 
205
- tbody tr:hover {
202
+ tbody[data-mps=datatable] tr:hover[data-mps=datatable] {
206
203
  background-color: var(--mp-datatable-row-hover-bg);
207
204
  }
208
205
 
209
- tbody tr[data-selected=true] {
206
+ tbody[data-mps=datatable] tr[data-selected=true][data-mps=datatable] {
210
207
  background-color: var(--mp-datatable-row-selected-bg);
211
208
  color: var(--mp-datatable-row-selected-color);
212
209
  }
213
210
 
214
- tbody tr[data-cut=true] {
211
+ tbody[data-mps=datatable] tr[data-cut=true][data-mps=datatable] {
215
212
  opacity: var(--mp-datatable-cut-opacity);
216
213
  }
217
214
 
218
- tbody tr[data-focused=true] {
215
+ tbody[data-mps=datatable] tr[data-focused=true][data-mps=datatable] {
219
216
  outline: 2px solid var(--bs-primary, #0d6efd);
220
217
  outline-offset: -2px;
221
218
  }
222
-
223
- .checkbox-cell {
219
+ tr[data-mps=datatable] > .checkbox-cell[data-mps=datatable] {
224
220
  width: 2.5rem;
221
+ padding-inline: 0.5rem;
225
222
  text-align: center;
223
+ text-overflow: clip;
226
224
  }
227
225
 
228
- .tree-chevron-cell {
226
+ .tree-chevron-cell[data-mps=datatable] {
229
227
  width: 2rem;
230
228
  padding-right: 0;
231
229
  white-space: nowrap;
232
230
  user-select: none;
233
231
  }
234
232
 
235
- .tree-chevron {
233
+ .tree-chevron[data-mps=datatable] {
236
234
  appearance: none;
237
235
  background: transparent;
238
236
  border: 0;
@@ -248,34 +246,34 @@ tbody tr[data-focused=true] {
248
246
  align-items: center;
249
247
  justify-content: center;
250
248
  }
251
- .tree-chevron:hover {
249
+ .tree-chevron:hover[data-mps=datatable] {
252
250
  background-color: var(--mp-datatable-row-hover-bg);
253
251
  }
254
- .tree-chevron:focus-visible {
252
+ .tree-chevron:focus-visible[data-mps=datatable] {
255
253
  outline: 2px solid var(--bs-primary, #0d6efd);
256
254
  outline-offset: 1px;
257
255
  }
258
256
 
259
- tbody tr[data-placeholder=true] {
257
+ tbody[data-mps=datatable] tr[data-placeholder=true][data-mps=datatable] {
260
258
  cursor: default;
261
259
  opacity: 0.6;
262
260
  pointer-events: none;
263
261
  }
264
262
 
265
- .tree-placeholder-cell {
263
+ .tree-placeholder-cell[data-mps=datatable] {
266
264
  color: var(--bs-secondary-color, #6c757d);
267
265
  font-style: italic;
268
266
  padding-left: 1.25rem;
269
267
  }
270
268
 
271
- .empty-state,
272
- .loading-state {
269
+ .empty-state[data-mps=datatable],
270
+ .loading-state[data-mps=datatable] {
273
271
  padding: 2rem 1rem;
274
272
  text-align: center;
275
273
  color: var(--bs-secondary-color, #6c757d);
276
274
  }
277
275
 
278
- .datatable-footer {
276
+ .datatable-footer[data-mps=datatable] {
279
277
  display: flex;
280
278
  align-items: center;
281
279
  justify-content: space-between;
@@ -285,80 +283,89 @@ tbody tr[data-placeholder=true] {
285
283
  flex: 0 0 auto;
286
284
  }
287
285
 
288
- .datatable-per-page,
289
- .datatable-pagination {
286
+ .datatable-per-page[data-mps=datatable],
287
+ .datatable-pagination[data-mps=datatable] {
290
288
  flex: 0 1 auto;
291
289
  }
292
290
 
293
291
  @media (prefers-reduced-motion: reduce) {
294
- .resize-handle {
292
+ .resize-handle[data-mps=datatable] {
295
293
  transition: none !important;
296
294
  }
297
295
  }`);
298
- function K(l, e, t) {
299
- if (t) {
300
- const i = l.findIndex((a) => a.property === e);
301
- return i === -1 ? [...l, { property: e, direction: "ascending" }] : l[i].direction === "ascending" ? l.map(
302
- (a, r) => r === i ? { ...a, direction: "descending" } : a
303
- ) : l.filter((a, r) => r !== i);
304
- }
305
- const s = l.length === 1 && l[0].property === e;
296
+ function L(l, t, e) {
297
+ if (e) {
298
+ const a = l.findIndex((i) => i.property === t);
299
+ return a === -1 ? [...l, { property: t, direction: "ascending" }] : l[a].direction === "ascending" ? l.map(
300
+ (i, r) => r === a ? { ...i, direction: "descending" } : i
301
+ ) : l.filter((i, r) => r !== a);
302
+ }
303
+ const s = l.length === 1 && l[0].property === t;
306
304
  return [
307
305
  {
308
- property: e,
306
+ property: t,
309
307
  direction: s && l[0].direction === "ascending" ? "descending" : "ascending"
310
308
  }
311
309
  ];
312
310
  }
313
- function b(l, e) {
314
- return e.length === 0 ? l.slice() : l.map((t, s) => ({ row: t, index: s })).sort((t, s) => {
315
- for (const i of e) {
316
- const a = w(t.row, i.property), r = w(s.row, i.property), o = z(a, r);
311
+ function _(l, t) {
312
+ return t.length === 0 ? l.slice() : l.map((e, s) => ({ row: e, index: s })).sort((e, s) => {
313
+ for (const a of t) {
314
+ const i = w(e.row, a.property), r = w(s.row, a.property), o = k(i, r);
317
315
  if (o !== 0)
318
- return i.direction === "ascending" ? o : -o;
316
+ return a.direction === "ascending" ? o : -o;
319
317
  }
320
- return t.index - s.index;
321
- }).map(({ row: t }) => t);
318
+ return e.index - s.index;
319
+ }).map(({ row: e }) => e);
322
320
  }
323
- function w(l, e) {
321
+ function w(l, t) {
324
322
  if (!(l == null || typeof l != "object"))
325
- return l[e];
323
+ return l[t];
326
324
  }
327
- function z(l, e) {
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));
325
+ function k(l, t) {
326
+ return l === t ? 0 : l == null ? 1 : t == null ? -1 : typeof l == "number" && typeof t == "number" ? l - t : l instanceof Date && t instanceof Date ? l.getTime() - t.getTime() : String(l).localeCompare(String(t));
329
327
  }
330
- let L = 0;
331
- class k extends C {
328
+ const c = R("datatable");
329
+ let A = 0;
330
+ class F extends C {
332
331
  constructor() {
333
- super(...arguments), this.instanceId = `mp-datatable-${++L}`, this._caption = null, this._inputLabel = null, this.hostAria = new I(this, {
332
+ super(...arguments), this.instanceId = `mp-datatable-${++A}`, this._caption = null, this._inputLabel = null, this.hostAria = new E(this, {
334
333
  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 $(
334
+ }), 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 $(this), this.rowFocusRestore = new I(this, new P(
336
335
  () => this.renderRoot ?? null,
337
336
  {
338
337
  selector: 'tbody tr[data-row-key]:not([data-placeholder="true"])',
339
- keyOf: (e) => e.dataset.rowKey ?? null,
338
+ keyOf: (t) => t.dataset.rowKey ?? null,
340
339
  container: () => this.renderRoot?.querySelector("table") ?? null
341
340
  }
342
- )), this._rowKey = (e, t) => {
343
- const s = e;
344
- return s && s.id != null ? String(s.id) : `row-${t}`;
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) => {
341
+ )), this._rowKey = (t, e) => {
342
+ const s = t;
343
+ return s && s.id != null ? String(s.id) : `row-${e}`;
344
+ }, 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 = (t) => {
346
345
  if (!this.resizeState) return;
347
- const t = e.clientX - this.resizeState.startX, s = Math.max(40, this.resizeState.startWidth + t);
346
+ const e = t.clientX - this.resizeState.startX, s = Math.max(40, this.resizeState.startWidth + e);
348
347
  this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(this.resizeState.columnName, s), this.requestUpdate();
349
- }, this.onColumnResizeEnd = (e) => {
348
+ }, this.onColumnResizeEnd = (t) => {
350
349
  if (this.resizeState) {
351
350
  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);
352
351
  try {
353
- this.resizeState.handle.releasePointerCapture(e.pointerId);
352
+ this.resizeState.handle.releasePointerCapture(t.pointerId);
354
353
  } catch {
355
354
  }
356
355
  this.resizeState = null;
357
356
  }
358
357
  };
359
358
  }
360
- static {
361
- this.styles = [M];
359
+ /**
360
+ * Light DOM. Consumer-authored row/cell/header content is mounted here by the
361
+ * render callbacks, and inside a shadow root the page's stylesheets — the
362
+ * consumer's own component CSS and Bootstrap's utilities alike — cannot reach
363
+ * it (issue #408). Rendering in the document tree is what makes that content
364
+ * style correctly; encapsulation is preserved by the build-time rescoping
365
+ * instead of by the boundary.
366
+ */
367
+ createRenderRoot() {
368
+ return this;
362
369
  }
363
370
  static get observedAttributes() {
364
371
  return [
@@ -393,28 +400,28 @@ class k extends C {
393
400
  get caption() {
394
401
  return this._caption;
395
402
  }
396
- set caption(e) {
397
- const t = e ?? null;
398
- this._caption !== t && (this._caption = t, this.requestUpdate());
403
+ set caption(t) {
404
+ const e = t ?? null;
405
+ this._caption !== e && (this._caption = e, this.requestUpdate());
399
406
  }
400
407
  /** Merged view of labels — consumer keys over the English defaults. */
401
408
  get mergedLabels() {
402
- return { ...E, ...this.labels ?? {} };
409
+ return { ...K, ...this.labels ?? {} };
403
410
  }
404
411
  /** Optional invisible accessible name for the <table>. Host aria-label wins. */
405
412
  get inputLabel() {
406
413
  return this._inputLabel;
407
414
  }
408
- set inputLabel(e) {
409
- const t = e ?? null;
410
- this._inputLabel !== t && (this._inputLabel = t, this.requestUpdate());
415
+ set inputLabel(t) {
416
+ const e = t ?? null;
417
+ this._inputLabel !== e && (this._inputLabel = e, this.requestUpdate());
411
418
  }
412
419
  /** When true, the WC sorts `data` itself using `sortRows`. Set `false` if the consumer sorts externally. */
413
420
  get autoSort() {
414
421
  return this._autoSort;
415
422
  }
416
- set autoSort(e) {
417
- this._autoSort = !!e, this.requestUpdate();
423
+ set autoSort(t) {
424
+ this._autoSort = !!t, this.requestUpdate();
418
425
  }
419
426
  /**
420
427
  * Per-row renderer. When set, the WC delegates row content production to
@@ -424,44 +431,44 @@ class k extends C {
424
431
  get rowRenderer() {
425
432
  return this._rowRenderer;
426
433
  }
427
- set rowRenderer(e) {
428
- this._rowRenderer = e, this.requestUpdate();
434
+ set rowRenderer(t) {
435
+ this._rowRenderer = t, this.requestUpdate();
429
436
  }
430
437
  /** Enable scroll-position-driven virtualization. Rows outside the viewport are not rendered. */
431
438
  get virtualScroll() {
432
439
  return this._virtualScroll;
433
440
  }
434
- set virtualScroll(e) {
435
- const t = !!e;
436
- this._virtualScroll !== t && (this._virtualScroll = t, this.requestUpdate());
441
+ set virtualScroll(t) {
442
+ const e = !!t;
443
+ this._virtualScroll !== e && (this._virtualScroll = e, this.requestUpdate());
437
444
  }
438
445
  /** Approximate row height in px (used by virtual scroll). Default `40`. */
439
446
  get itemSize() {
440
447
  return this._itemSize;
441
448
  }
442
- set itemSize(e) {
443
- const t = Math.max(1, Math.floor(e || 0)) || 40;
444
- this._itemSize !== t && (this._itemSize = t, this.requestUpdate());
449
+ set itemSize(t) {
450
+ const e = Math.max(1, Math.floor(t || 0)) || 40;
451
+ this._itemSize !== e && (this._itemSize = e, this.requestUpdate());
445
452
  }
446
453
  /** Off-screen row buffer (each side) for virtual scrolling. */
447
454
  get virtualBuffer() {
448
455
  return this._virtualBuffer;
449
456
  }
450
- set virtualBuffer(e) {
451
- const t = Math.max(0, Math.floor(e || 0));
452
- this._virtualBuffer !== t && (this._virtualBuffer = t, this.requestUpdate());
457
+ set virtualBuffer(t) {
458
+ const e = Math.max(0, Math.floor(t || 0));
459
+ this._virtualBuffer !== e && (this._virtualBuffer = e, this.requestUpdate());
453
460
  }
454
461
  get columns() {
455
462
  return this._columns;
456
463
  }
457
- set columns(e) {
458
- this._columns = Array.isArray(e) ? e : [], this.requestUpdate();
464
+ set columns(t) {
465
+ this._columns = Array.isArray(t) ? t : [], this.requestUpdate();
459
466
  }
460
467
  get data() {
461
468
  return this._data;
462
469
  }
463
- set data(e) {
464
- this._data = Array.isArray(e) ? e : [], this.requestUpdate();
470
+ set data(t) {
471
+ this._data = Array.isArray(t) ? t : [], this.requestUpdate();
465
472
  }
466
473
  /**
467
474
  * High-level fetch callback. When set, the WC owns the entire server-paged
@@ -472,53 +479,53 @@ class k extends C {
472
479
  get fetch() {
473
480
  return this._fetch;
474
481
  }
475
- set fetch(e) {
476
- this._fetch = typeof e == "function" ? e : null, this._fetch && (this._autoSort = !1, this._initialFetchDone = !1, this._lastReloadKey = null, this.scheduleFetchReload());
482
+ set fetch(t) {
483
+ this._fetch = typeof t == "function" ? t : null, this._fetch && (this._autoSort = !1, this._initialFetchDone = !1, this._lastReloadKey = null, this.scheduleFetchReload());
477
484
  }
478
485
  get sortColumns() {
479
486
  return [...this._sortColumns];
480
487
  }
481
- set sortColumns(e) {
482
- this._sortColumns = Array.isArray(e) ? [...e] : [], this.requestUpdate(), this.scheduleFetchReload();
488
+ set sortColumns(t) {
489
+ this._sortColumns = Array.isArray(t) ? [...t] : [], this.requestUpdate(), this.scheduleFetchReload();
483
490
  }
484
491
  get selectionMode() {
485
492
  return this._selectionMode;
486
493
  }
487
- set selectionMode(e) {
488
- this._selectionMode = e, e === "none" && this._selectedIds.clear(), this.requestUpdate();
494
+ set selectionMode(t) {
495
+ this._selectionMode = t, t === "none" && this._selectedIds.clear(), this.requestUpdate();
489
496
  }
490
497
  get selectedIds() {
491
498
  return [...this._selectedIds];
492
499
  }
493
- set selectedIds(e) {
494
- this._selectedIds = new Set(e ?? []), this.requestUpdate();
500
+ set selectedIds(t) {
501
+ this._selectedIds = new Set(t ?? []), this.requestUpdate();
495
502
  }
496
503
  get cutIds() {
497
504
  return [...this._cutIds];
498
505
  }
499
- set cutIds(e) {
500
- this._cutIds = new Set(e ?? []), this.requestUpdate();
506
+ set cutIds(t) {
507
+ this._cutIds = new Set(t ?? []), this.requestUpdate();
501
508
  }
502
509
  get focusedRowKey() {
503
510
  return this._focusedRowKey;
504
511
  }
505
- set focusedRowKey(e) {
506
- this._focusedRowKey = e, this.requestUpdate();
512
+ set focusedRowKey(t) {
513
+ this._focusedRowKey = t, this.requestUpdate();
507
514
  }
508
515
  get rowKey() {
509
516
  return this._rowKey;
510
517
  }
511
- set rowKey(e) {
512
- this._rowKey = typeof e == "function" ? e : this._rowKey, this.requestUpdate();
518
+ set rowKey(t) {
519
+ this._rowKey = typeof t == "function" ? t : this._rowKey, this.requestUpdate();
513
520
  }
514
521
  // ─── Tree-mode public API ────────────────────────────────────────────────
515
522
  /** Enable tree mode (chevron column, nested expansion, lazy children). */
516
523
  get tree() {
517
524
  return this._tree;
518
525
  }
519
- set tree(e) {
520
- const t = !!e;
521
- this._tree !== t && (this._tree = t, this.requestUpdate());
526
+ set tree(t) {
527
+ const e = !!t;
528
+ this._tree !== e && (this._tree = e, this.requestUpdate());
522
529
  }
523
530
  /**
524
531
  * Property name or function that extracts the stable row identity used as
@@ -528,8 +535,8 @@ class k extends C {
528
535
  get idKey() {
529
536
  return this._idKey;
530
537
  }
531
- set idKey(e) {
532
- this._idKey = e, this.requestUpdate();
538
+ set idKey(t) {
539
+ this._idKey = t, this.requestUpdate();
533
540
  }
534
541
  /**
535
542
  * Property name on the row that holds the direct-child count. Drives both
@@ -538,69 +545,69 @@ class k extends C {
538
545
  get childCountKey() {
539
546
  return this._childCountKey;
540
547
  }
541
- set childCountKey(e) {
542
- this._childCountKey = e || null, this.requestUpdate();
548
+ set childCountKey(t) {
549
+ this._childCountKey = t || null, this.requestUpdate();
543
550
  }
544
551
  /** Indent in rem per depth level on the chevron cell. Default `1.25`. */
545
552
  get treeIndent() {
546
553
  return this._treeIndent;
547
554
  }
548
- set treeIndent(e) {
549
- const t = Number(e);
550
- this._treeIndent = Number.isFinite(t) && t >= 0 ? t : 1.25, this.requestUpdate();
555
+ set treeIndent(t) {
556
+ const e = Number(t);
557
+ this._treeIndent = Number.isFinite(e) && e >= 0 ? e : 1.25, this.requestUpdate();
551
558
  }
552
559
  /** Two-way binding target: set of expanded-row id values (per `idKey`). */
553
560
  get expandedIds() {
554
561
  return new Set(this._expandedIds);
555
562
  }
556
- set expandedIds(e) {
557
- e ? e instanceof Set ? this._expandedIds = new Set(e) : this._expandedIds = new Set(e) : this._expandedIds = /* @__PURE__ */ new Set(), this.requestUpdate();
563
+ set expandedIds(t) {
564
+ t ? t instanceof Set ? this._expandedIds = new Set(t) : this._expandedIds = new Set(t) : this._expandedIds = /* @__PURE__ */ new Set(), this.requestUpdate();
558
565
  }
559
566
  /** `'flat'` (default) or `'cascading'`. When `tree=true`, cascading is recommended. */
560
567
  get selectionStrategy() {
561
568
  return this._selectionStrategy;
562
569
  }
563
- set selectionStrategy(e) {
564
- this._selectionStrategy = e === "cascading" ? "cascading" : "flat", this.requestUpdate();
570
+ set selectionStrategy(t) {
571
+ this._selectionStrategy = t === "cascading" ? "cascading" : "flat", this.requestUpdate();
565
572
  }
566
573
  get loading() {
567
574
  return this._loading;
568
575
  }
569
- set loading(e) {
570
- const t = this._loading;
571
- this._loading = !!e, t && !this._loading && this.liveAnnouncer.announce(this.mergedLabels.announceLoaded(this._data.length)), this.requestUpdate();
576
+ set loading(t) {
577
+ const e = this._loading;
578
+ this._loading = !!t, e && !this._loading && this.liveAnnouncer.announce(this.mergedLabels.announceLoaded(this._data.length)), this.requestUpdate();
572
579
  }
573
580
  get emptyMessage() {
574
581
  return this._emptyMessage;
575
582
  }
576
- set emptyMessage(e) {
577
- this._emptyMessage = e || "No data", this.requestUpdate();
583
+ set emptyMessage(t) {
584
+ this._emptyMessage = t || "No data", this.requestUpdate();
578
585
  }
579
586
  get pagination() {
580
587
  return this._pagination;
581
588
  }
582
- set pagination(e) {
583
- this._pagination = !!e, this.requestUpdate();
589
+ set pagination(t) {
590
+ this._pagination = !!t, this.requestUpdate();
584
591
  }
585
592
  get page() {
586
593
  return this._page;
587
594
  }
588
- set page(e) {
589
- const t = Math.max(1, Math.floor(e || 1));
590
- this._page !== t && (this._page = t, this.requestUpdate(), this.scheduleFetchReload());
595
+ set page(t) {
596
+ const e = Math.max(1, Math.floor(t || 1));
597
+ this._page !== e && (this._page = e, this.requestUpdate(), this.scheduleFetchReload());
591
598
  }
592
599
  get perPage() {
593
600
  return this._perPage;
594
601
  }
595
- set perPage(e) {
596
- const t = Math.max(1, Math.floor(e || 1));
597
- this._perPage !== t && (this._perPage = t, this._page = 1, this.requestUpdate(), this.scheduleFetchReload());
602
+ set perPage(t) {
603
+ const e = Math.max(1, Math.floor(t || 1));
604
+ this._perPage !== e && (this._perPage = e, this._page = 1, this.requestUpdate(), this.scheduleFetchReload());
598
605
  }
599
606
  get perPageOptions() {
600
607
  return [...this._perPageOptions];
601
608
  }
602
- set perPageOptions(e) {
603
- this._perPageOptions = Array.isArray(e) && e.length > 0 ? [...e] : [10, 20, 50], this.requestUpdate();
609
+ set perPageOptions(t) {
610
+ this._perPageOptions = Array.isArray(t) && t.length > 0 ? [...t] : [10, 20, 50], this.requestUpdate();
604
611
  }
605
612
  /**
606
613
  * Read-only grand total. Derived by the WC from the `fetch` response (server
@@ -625,59 +632,59 @@ class k extends C {
625
632
  isRootWindowed() {
626
633
  return this._virtualScroll && this.isExternallyPaged();
627
634
  }
628
- attributeChangedCallback(e, t, s) {
629
- if (super.attributeChangedCallback(e, t, s), e === "caption")
635
+ attributeChangedCallback(t, e, s) {
636
+ if (super.attributeChangedCallback(t, e, s), t === "caption")
630
637
  this._caption = s, this.requestUpdate();
631
- else if (e === "input-label")
638
+ else if (t === "input-label")
632
639
  this._inputLabel = s, this.requestUpdate();
633
- else if (e === "aria-label")
640
+ else if (t === "aria-label")
634
641
  this.requestUpdate();
635
- else if (e === "aria-labelledby" || e === "aria-describedby")
642
+ else if (t === "aria-labelledby" || t === "aria-describedby")
636
643
  this.hostAria.syncReferences();
637
- else if (e === "selection-mode") {
638
- const i = s;
639
- (i === "none" || i === "single" || i === "multiple") && (this.selectionMode = i);
640
- } else if (e === "pagination")
644
+ else if (t === "selection-mode") {
645
+ const a = s;
646
+ (a === "none" || a === "single" || a === "multiple") && (this.selectionMode = a);
647
+ } else if (t === "pagination")
641
648
  this.pagination = s !== null;
642
- else if (e === "resizable-columns")
649
+ else if (t === "resizable-columns")
643
650
  this.resizableColumns = s !== null;
644
- else if (e === "auto-sort")
651
+ else if (t === "auto-sort")
645
652
  this.autoSort = s !== "false";
646
- else if (e === "empty-message")
653
+ else if (t === "empty-message")
647
654
  this.emptyMessage = s ?? "No data";
648
- else if (e === "virtual-scroll")
655
+ else if (t === "virtual-scroll")
649
656
  this.virtualScroll = s !== null;
650
- else if (e === "item-size") {
651
- const i = Number(s);
652
- Number.isFinite(i) && (this.itemSize = i);
653
- } else if (e === "tree")
657
+ else if (t === "item-size") {
658
+ const a = Number(s);
659
+ Number.isFinite(a) && (this.itemSize = a);
660
+ } else if (t === "tree")
654
661
  this.tree = s !== null;
655
- else if (e === "tree-indent") {
656
- const i = Number(s);
657
- Number.isFinite(i) && (this.treeIndent = i);
658
- } else e === "selection-strategy" && (this.selectionStrategy = s === "cascading" ? "cascading" : "flat");
662
+ else if (t === "tree-indent") {
663
+ const a = Number(s);
664
+ Number.isFinite(a) && (this.treeIndent = a);
665
+ } else t === "selection-strategy" && (this.selectionStrategy = s === "cascading" ? "cascading" : "flat");
659
666
  }
660
667
  get resizableColumns() {
661
668
  return this._resizableColumns;
662
669
  }
663
- set resizableColumns(e) {
664
- this._resizableColumns = !!e, this.requestUpdate();
670
+ set resizableColumns(t) {
671
+ this._resizableColumns = !!t, this.requestUpdate();
665
672
  }
666
673
  connectedCallback() {
667
674
  super.connectedCallback();
668
675
  }
669
676
  firstUpdated() {
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();
677
+ this._scrollElement = this.renderRoot?.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();
671
678
  }
672
- willUpdate(e) {
673
- super.willUpdate(e), this._cachedFlatList = null, this._cachedIndeterminateKeys = null;
679
+ willUpdate(t) {
680
+ super.willUpdate(t), this._cachedFlatList = null, this._cachedIndeterminateKeys = null;
674
681
  }
675
- updated(e) {
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)));
682
+ updated(t) {
683
+ super.updated(t), this.refreshVirtualRange(), this.maybeMeasureInitialColumnWidths();
684
+ const e = this.renderRoot?.querySelectorAll(".resize-handle:not([aria-valuenow])") ?? [];
685
+ for (const s of e) {
686
+ const a = s.closest("th");
687
+ a && s.setAttribute("aria-valuenow", String(Math.round(a.getBoundingClientRect().width)));
681
688
  }
682
689
  }
683
690
  /**
@@ -690,25 +697,25 @@ class k extends C {
690
697
  * authoritative and overflowing content clips with ellipsis.
691
698
  */
692
699
  maybeMeasureInitialColumnWidths() {
693
- if (this._hasMeasuredInitial || this._columns.length === 0 || this._data.length === 0 || !this.shadowRoot || this.shadowRoot.querySelectorAll('tbody tr[data-row-key]:not([data-placeholder="true"])').length === 0) return;
694
- const t = new Map(this._columnWidths);
700
+ if (this._hasMeasuredInitial || this._columns.length === 0 || this._data.length === 0 || !this.renderRoot || this.renderRoot.querySelectorAll('tbody tr[data-row-key]:not([data-placeholder="true"])').length === 0) return;
701
+ const e = new Map(this._columnWidths);
695
702
  let s = !1;
696
- for (const i of this._columns) {
697
- if (t.has(i.name)) continue;
698
- if (typeof i.width == "number") {
699
- t.set(i.name, i.width), s = !0;
703
+ for (const a of this._columns) {
704
+ if (e.has(a.name)) continue;
705
+ if (typeof a.width == "number") {
706
+ e.set(a.name, a.width), s = !0;
700
707
  continue;
701
708
  }
702
- const a = this.measureColumnWidth(i.name);
703
- a != null && (t.set(i.name, a), s = !0);
709
+ const i = this.measureColumnWidth(a.name);
710
+ i != null && (e.set(a.name, i), s = !0);
704
711
  }
705
- s && (this._columnWidths = t, this._hasMeasuredInitial = !0, this.requestUpdate());
712
+ s && (this._columnWidths = e, this._hasMeasuredInitial = !0, this.requestUpdate());
706
713
  }
707
- measureColumnWidth(e) {
708
- if (!this.shadowRoot) return null;
709
- const t = this.shadowRoot.querySelector(`th[data-column="${e}"]`);
710
- if (!t) return null;
711
- const s = Math.ceil(t.getBoundingClientRect().width);
714
+ measureColumnWidth(t) {
715
+ if (!this.renderRoot) return null;
716
+ const e = this.renderRoot.querySelector(`th[data-column="${t}"]`);
717
+ if (!e) return null;
718
+ const s = Math.ceil(e.getBoundingClientRect().width);
712
719
  return s > 0 ? s : null;
713
720
  }
714
721
  disconnectedCallback() {
@@ -716,19 +723,19 @@ class k extends C {
716
723
  }
717
724
  refreshVirtualRange() {
718
725
  if (!this._virtualScroll || !this._scrollElement) return;
719
- const e = this._scrollElement.scrollTop, t = this._scrollElement.clientHeight;
720
- this._viewportHeight = t;
721
- const s = this.getEffectiveData().length, i = this._itemSize, a = Math.max(0, Math.floor(e / i) - this._virtualBuffer), r = Math.ceil(t / i), o = Math.min(s, a + r + this._virtualBuffer * 2);
722
- (a !== this._virtualRange.startIndex || o !== this._virtualRange.endIndex) && (this._virtualRange = { startIndex: a, endIndex: o }, this.requestUpdate()), this._tree && this.maybeFetchPlaceholdersInViewport(), this.isRootWindowed() && this.maybeFetchPagesInViewport();
726
+ const t = this._scrollElement.scrollTop, e = this._scrollElement.clientHeight;
727
+ this._viewportHeight = e;
728
+ const s = this.getEffectiveData().length, a = this._itemSize, i = Math.max(0, Math.floor(t / a) - this._virtualBuffer), r = Math.ceil(e / a), o = Math.min(s, i + r + this._virtualBuffer * 2);
729
+ (i !== this._virtualRange.startIndex || o !== this._virtualRange.endIndex) && (this._virtualRange = { startIndex: i, endIndex: o }, this.requestUpdate()), this._tree && this.maybeFetchPlaceholdersInViewport(), this.isRootWindowed() && this.maybeFetchPagesInViewport();
723
730
  }
724
731
  /**
725
732
  * Walk the visible viewport for placeholder rows whose parent isn't cached
726
733
  * and isn't already in-flight. Emit a fetch-request per such parent.
727
734
  */
728
735
  maybeFetchPlaceholdersInViewport() {
729
- const e = this.getFlatList(), { startIndex: t, endIndex: s } = this._virtualRange, i = this._virtualScroll ? t : 0, a = this._virtualScroll ? s : e.length, r = /* @__PURE__ */ new Set();
730
- for (let o = i; o < a; o++) {
731
- const n = e[o];
736
+ const t = this.getFlatList(), { startIndex: e, endIndex: s } = this._virtualRange, a = this._virtualScroll ? e : 0, i = this._virtualScroll ? s : t.length, r = /* @__PURE__ */ new Set();
737
+ for (let o = a; o < i; o++) {
738
+ const n = t[o];
732
739
  !n.isPlaceholder || n.parentId == null || this._childCache.has(n.parentId) || this._pendingFetches.has(n.parentId) || r.add(n.parentId);
733
740
  }
734
741
  for (const o of r) this.fetchChildren(o);
@@ -741,86 +748,86 @@ class k extends C {
741
748
  * wrapper's first-page fetch).
742
749
  */
743
750
  maybeFetchPagesInViewport() {
744
- const e = this.getFlatList(), { startIndex: t, endIndex: s } = this._virtualRange, i = this._virtualScroll ? t : 0, a = this._virtualScroll ? s : e.length, r = /* @__PURE__ */ new Set();
745
- for (let o = i; o < a; o++) {
746
- const n = e[o];
751
+ const t = this.getFlatList(), { startIndex: e, endIndex: s } = this._virtualRange, a = this._virtualScroll ? e : 0, i = this._virtualScroll ? s : t.length, r = /* @__PURE__ */ new Set();
752
+ for (let o = a; o < i; o++) {
753
+ const n = t[o];
747
754
  !n.isPlaceholder || n.page == null || n.page <= 1 || this._pageCache.has(n.page) || this._pendingPageFetches.has(n.page) || r.add(n.page);
748
755
  }
749
756
  for (const o of r) this.fetchWindowPage(o);
750
757
  }
751
758
  render() {
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;
759
+ const t = this.computeVisibleRows(), e = this._totalRecords ?? this._data.length, s = this.pagination && !this._tree ? Math.max(1, Math.ceil(e / this._perPage)) : 1, a = this._selectionMode === "multiple", i = this._columns.length + (a ? 1 : 0) + (this._tree ? 1 : 0), r = this.getVirtualSpacerHeights(), o = (this._tree || this.isRootWindowed() ? this.getFlatList().length : this._data.length) + 1;
753
760
  return c`
754
761
  ${this.liveAnnouncer.template()}
755
762
  <div class="datatable-shell">
756
763
  <div class="datatable-scroll ${this._virtualScroll ? "datatable-virtual" : ""}" role="presentation">
757
764
  <table
758
- role=${this._tree ? "treegrid" : this._selectionMode !== "none" ? "grid" : d}
765
+ role=${this._tree ? "treegrid" : this._selectionMode !== "none" ? "grid" : h}
759
766
  aria-rowcount=${o}
760
- aria-colcount=${a}
761
- aria-busy=${this._loading ? "true" : d}
762
- aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? d}
767
+ aria-colcount=${i}
768
+ aria-busy=${this._loading ? "true" : h}
769
+ aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? h}
763
770
  class=${this._hasMeasuredInitial ? "measured" : ""}
764
771
  >
765
- ${this._caption ? c`<caption>${this._caption}</caption>` : d}
772
+ ${this._caption ? c`<caption>${this._caption}</caption>` : h}
766
773
  <thead>
767
774
  <tr role="row" aria-rowindex="1">
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">
775
+ ${this._tree ? c`<th class="tree-chevron-cell" scope="col" aria-label=${this.mergedLabels.treeChevronColumn}></th>` : h}
776
+ ${a ? c`<th class="checkbox-cell" scope="col">
770
777
  <mp-checkbox
771
778
  aria-label=${this.mergedLabels.deselectAll}
772
- aria-hidden=${this._selectedIds.size === 0 ? "true" : d}
773
- style=${m({ visibility: this._selectedIds.size > 0 ? "visible" : "hidden" })}
779
+ aria-hidden=${this._selectedIds.size === 0 ? "true" : h}
780
+ style=${b({ visibility: this._selectedIds.size > 0 ? "visible" : "hidden" })}
774
781
  .checked=${!1}
775
782
  .indeterminate=${this._selectedIds.size > 0}
776
783
  @change=${this.onDeselectAll}
777
784
  ></mp-checkbox>
778
- </th>` : d}
779
- ${this._columns.map((n, h) => this.renderHeader(n, h))}
785
+ </th>` : h}
786
+ ${this._columns.map((n, d) => this.renderHeader(n, d))}
780
787
  </tr>
781
788
  </thead>
782
789
  <tbody>
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(
786
- e,
790
+ ${this._loading ? c`<tr><td colspan=${i} class="loading-state">Loading…</td></tr>` : t.length === 0 ? c`<tr><td colspan=${i} class="empty-state">${this._emptyMessage}</td></tr>` : c`
791
+ ${r.top > 0 ? c`<tr class="virtual-spacer" aria-hidden="true"><td colspan=${i} style=${b({ height: `${r.top}px`, padding: "0", border: "0" })}></td></tr>` : h}
792
+ ${M(
793
+ t,
787
794
  ({ key: n }) => n,
788
- ({ key: n, rowIndex: h, flat: f }) => this.renderRow(f, n, h, i)
795
+ ({ key: n, rowIndex: d, flat: m }) => this.renderRow(m, n, d, a)
789
796
  )}
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}
797
+ ${r.bottom > 0 ? c`<tr class="virtual-spacer" aria-hidden="true"><td colspan=${i} style=${b({ height: `${r.bottom}px`, padding: "0", border: "0" })}></td></tr>` : h}
791
798
  `}
792
799
  </tbody>
793
800
  </table>
794
801
  </div>
795
- ${this._pagination && !this._tree ? this.renderFooter(s) : d}
802
+ ${this._pagination && !this._tree ? this.renderFooter(s) : h}
796
803
  </div>
797
804
  `;
798
805
  }
799
806
  getVirtualSpacerHeights() {
800
807
  if (!this._virtualScroll) return { top: 0, bottom: 0 };
801
- const e = this.getEffectiveData().length, { startIndex: t, endIndex: s } = this._virtualRange;
808
+ const t = this.getEffectiveData().length, { startIndex: e, endIndex: s } = this._virtualRange;
802
809
  return {
803
- top: t * this._itemSize,
804
- bottom: Math.max(0, (e - s) * this._itemSize)
810
+ top: e * this._itemSize,
811
+ bottom: Math.max(0, (t - s) * this._itemSize)
805
812
  };
806
813
  }
807
- renderHeader(e, t) {
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 = {};
814
+ renderHeader(t, e) {
815
+ const s = t.sortable ?? !0, a = this._sortColumns.findIndex((d) => d.property === t.name), i = a >= 0 ? this._sortColumns[a].direction : null, r = this._columnWidths.get(t.name) ?? t.width, o = t.headerRenderer ? t.headerRenderer(t) : t.label ?? t.name, n = {};
809
816
  return typeof r == "number" && (n.width = `${r}px`, n.minWidth = `${r}px`), c`
810
817
  <th
811
818
  scope="col"
812
- data-column=${e.name}
819
+ data-column=${t.name}
813
820
  data-sortable=${s ? "true" : "false"}
814
- aria-sort=${a ? a === "ascending" ? "ascending" : "descending" : "none"}
815
- style=${m(n)}
821
+ aria-sort=${i ? i === "ascending" ? "ascending" : "descending" : "none"}
822
+ style=${b(n)}
816
823
  >
817
824
  ${s ? c`<button
818
825
  type="button"
819
826
  class="header-cell header-sort"
820
- @click=${(h) => this.onHeaderClick(e, h)}
827
+ @click=${(d) => this.onHeaderClick(t, d)}
821
828
  >
822
829
  <span>${y(o)}</span>
823
- ${i >= 0 && this._sortColumns.length > 1 ? c`<span class="sort-index">${i + 1}</span>` : d}
830
+ ${a >= 0 && this._sortColumns.length > 1 ? c`<span class="sort-index">${a + 1}</span>` : h}
824
831
  </button>` : c`<span class="header-cell">
825
832
  <span>${y(o)}</span>
826
833
  </span>`}
@@ -829,80 +836,80 @@ class k extends C {
829
836
  role="separator"
830
837
  tabindex="0"
831
838
  aria-orientation="vertical"
832
- aria-label=${this.mergedLabels.resizeColumn(e.label ?? e.name)}
839
+ aria-label=${this.mergedLabels.resizeColumn(t.label ?? t.name)}
833
840
  aria-valuemin="40"
834
- aria-valuenow=${Math.round(r ?? 0) || d}
835
- @pointerdown=${(h) => this.startColumnResize(e, h)}
836
- @keydown=${(h) => this.onResizeHandleKeydown(e, h)}
837
- ></span>` : d}
841
+ aria-valuenow=${Math.round(r ?? 0) || h}
842
+ @pointerdown=${(d) => this.startColumnResize(t, d)}
843
+ @keydown=${(d) => this.onResizeHandleKeydown(t, d)}
844
+ ></span>` : h}
838
845
  </th>
839
846
  `;
840
847
  }
841
- renderRow(e, t, s, i) {
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);
848
+ renderRow(t, e, s, a) {
849
+ const { row: i, depth: r, isExpanded: o, isPlaceholder: n } = t, d = !n && this._selectedIds.has(e), m = !n && this._cutIds.has(e), u = !n && this._focusedRowKey === e, p = n ? 0 : this.extractChildCount(i), f = this._tree && !n && p > 0, v = !n && i != null && this.isParentIndeterminate(i);
843
850
  return c`
844
851
  <tr
845
852
  role="row"
846
853
  aria-rowindex=${s + 2}
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}
851
- data-row-key=${t}
852
- data-selected=${h ? "true" : "false"}
853
- data-cut=${f ? "true" : "false"}
854
+ aria-level=${this._tree ? r + 1 : h}
855
+ aria-expanded=${this._tree && p > 0 ? o ? "true" : "false" : h}
856
+ aria-busy=${n ? "true" : h}
857
+ aria-selected=${!n && this._selectionMode !== "none" ? d ? "true" : "false" : h}
858
+ data-row-key=${e}
859
+ data-selected=${d ? "true" : "false"}
860
+ data-cut=${m ? "true" : "false"}
854
861
  data-focused=${u ? "true" : "false"}
855
862
  data-placeholder=${n ? "true" : "false"}
856
- data-depth=${this._tree ? String(r) : d}
863
+ data-depth=${this._tree ? String(r) : h}
857
864
  data-clickable=${!n && (this._selectionMode !== "none" || this.hasRowClickListeners()) ? "true" : "false"}
858
- tabindex=${!n && (this._selectionMode !== "none" || this._tree) ? this._focusedRowKey === t || this._focusedRowKey === null && s === 0 ? "0" : "-1" : d}
865
+ tabindex=${!n && (this._selectionMode !== "none" || this._tree) ? this._focusedRowKey === e || this._focusedRowKey === null && s === 0 ? "0" : "-1" : h}
859
866
  @focus=${n ? null : () => {
860
- this._focusedRowKey = t, this.requestUpdate();
867
+ this._focusedRowKey = e, this.requestUpdate();
861
868
  }}
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)}
869
+ @click=${n ? null : (g) => this.onRowClick(i, e, s, g)}
870
+ @dblclick=${n ? null : (g) => this.onRowDblClick(i, e, s, g)}
871
+ @contextmenu=${n ? null : (g) => this.onRowContextMenu(i, e, s, g)}
872
+ @keydown=${n ? null : (g) => this.onRowKeydown(i, e, s, t.parentId, r, o, p, g)}
866
873
  >
867
- ${this._tree ? c`<td class="tree-chevron-cell" style=${m({ paddingInlineStart: `${r * this._treeIndent}rem` })}>
868
- ${_ ? c`<button
874
+ ${this._tree ? c`<td class="tree-chevron-cell" style=${b({ paddingInlineStart: `${r * this._treeIndent}rem` })}>
875
+ ${f ? c`<button
869
876
  type="button"
870
877
  class="tree-chevron"
871
878
  aria-label=${o ? this.mergedLabels.collapseRow : this.mergedLabels.expandRow}
872
879
  aria-expanded=${o ? "true" : "false"}
873
880
  data-expanded=${o ? "true" : "false"}
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
881
+ @click=${(g) => this.toggleExpand(i, t.parentId, r, g)}
882
+ >${o ? "▾" : "▸"}</button>` : h}
883
+ </td>` : h}
884
+ ${a ? c`<td class="checkbox-cell" @click=${(g) => g.stopPropagation()}>
885
+ ${n ? h : c`<mp-checkbox
879
886
  aria-label=${this.mergedLabels.selectRow(s + 1)}
880
- .checked=${h}
887
+ .checked=${d}
881
888
  .indeterminate=${v}
882
- @change=${(g) => this.onRowCheckboxToggle(a, t, s, g)}
889
+ @change=${(g) => this.onRowCheckboxToggle(i, e, s, g)}
883
890
  ></mp-checkbox>`}
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))}
891
+ </td>` : h}
892
+ ${this._rowRenderer ? this.renderRowFromRenderer(i, 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(i, g, s))}
886
893
  </tr>
887
894
  `;
888
895
  }
889
- renderRowFromRenderer(e, t, s) {
890
- const i = this._rowRenderer(e, t, s);
891
- if (i == null)
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)) {
894
- const a = [];
895
- for (const r of i) a.push(r);
896
- return a;
896
+ renderRowFromRenderer(t, e, s) {
897
+ const a = this._rowRenderer(t, e, s);
898
+ if (a == null)
899
+ return s.isPlaceholder ? c`<td colspan=${this._columns.length} class="tree-placeholder-cell" aria-label=${this.mergedLabels.loading}>…</td>` : this._columns.map((i) => this.renderCell(t, i, e));
900
+ if (Array.isArray(a) || U(a)) {
901
+ const i = [];
902
+ for (const r of a) i.push(r);
903
+ return i;
897
904
  }
898
- return i;
905
+ return a;
899
906
  }
900
- renderCell(e, t, s) {
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>`;
907
+ renderCell(t, e, s) {
908
+ const a = e.cellRenderer ? e.cellRenderer(t, e, s) : q(t, e);
909
+ return c`<td class=${e.cellClass ?? ""} data-column=${e.name}>${y(a)}</td>`;
903
910
  }
904
- renderFooter(e) {
905
- const t = Array.from({ length: e }, (s, i) => i + 1);
911
+ renderFooter(t) {
912
+ const e = Array.from({ length: t }, (s, a) => a + 1);
906
913
  return c`
907
914
  <div class="datatable-footer">
908
915
  <mp-pagination
@@ -915,7 +922,7 @@ class k extends C {
915
922
  ></mp-pagination>
916
923
  <mp-pagination
917
924
  class="datatable-pagination"
918
- .pageNumbers=${t}
925
+ .pageNumbers=${e}
919
926
  .selectedPageNumber=${this._page}
920
927
  .numberOfBoxes=${7}
921
928
  .showArrows=${!0}
@@ -924,11 +931,11 @@ class k extends C {
924
931
  </div>
925
932
  `;
926
933
  }
927
- setPerPage(e) {
928
- const t = Math.max(1, Math.floor(e || 1));
929
- this._perPage !== t && (this._perPage = t, this._page = 1, this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
934
+ setPerPage(t) {
935
+ const e = Math.max(1, Math.floor(t || 1));
936
+ this._perPage !== e && (this._perPage = e, this._page = 1, this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
930
937
  new CustomEvent("mp-datatable-per-page-change", {
931
- detail: { perPage: t },
938
+ detail: { perPage: e },
932
939
  bubbles: !0,
933
940
  composed: !0
934
941
  })
@@ -942,13 +949,13 @@ class k extends C {
942
949
  }
943
950
  getEffectiveData() {
944
951
  if (this._tree || this.isRootWindowed())
945
- return this.getFlatList().map((t) => t.row);
946
- let e = this._data;
947
- if (this._autoSort && this._sortColumns.length > 0 && (e = b(e, this._sortColumns)), this._pagination && !this.isExternallyPaged()) {
948
- const t = (this._page - 1) * this._perPage;
949
- e = e.slice(t, t + this._perPage);
952
+ return this.getFlatList().map((e) => e.row);
953
+ let t = this._data;
954
+ if (this._autoSort && this._sortColumns.length > 0 && (t = _(t, this._sortColumns)), this._pagination && !this.isExternallyPaged()) {
955
+ const e = (this._page - 1) * this._perPage;
956
+ t = t.slice(e, e + this._perPage);
950
957
  }
951
- return e;
958
+ return t;
952
959
  }
953
960
  /**
954
961
  * Flat list of visible rows including expansion + placeholders. Computed
@@ -964,21 +971,21 @@ class k extends C {
964
971
  if (!this._tree) {
965
972
  if (this.isRootWindowed()) {
966
973
  const r = this._totalRecords ?? this._data.length, o = Math.max(1, this._perPage), n = new Array(r);
967
- for (let h = 0; h < r; 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 };
974
+ for (let d = 0; d < r; d++) {
975
+ const m = Math.floor(d / o) + 1, u = d % o, p = m === 1 ? this._data[u] : this._pageCache.get(m)?.[u];
976
+ n[d] = p !== void 0 ? { row: p, key: this._rowKey(p, d), depth: 0, parentId: null, isExpanded: !1, isPlaceholder: !1 } : { row: void 0, key: `__placeholder-flat-${d}`, depth: 0, parentId: null, page: m, isExpanded: !1, isPlaceholder: !0 };
970
977
  }
971
978
  return this._cachedFlatList = n;
972
979
  }
973
- const a = (() => {
980
+ const i = (() => {
974
981
  let r = this._data;
975
- if (this._autoSort && this._sortColumns.length > 0 && (r = b(r, this._sortColumns)), this._pagination && !this.isExternallyPaged()) {
982
+ if (this._autoSort && this._sortColumns.length > 0 && (r = _(r, this._sortColumns)), this._pagination && !this.isExternallyPaged()) {
976
983
  const o = (this._page - 1) * this._perPage;
977
984
  r = r.slice(o, o + this._perPage);
978
985
  }
979
986
  return r;
980
987
  })();
981
- return this._cachedFlatList = a.map((r, o) => ({
988
+ return this._cachedFlatList = i.map((r, o) => ({
982
989
  row: r,
983
990
  key: this._rowKey(r, o),
984
991
  depth: 0,
@@ -987,67 +994,67 @@ class k extends C {
987
994
  isPlaceholder: !1
988
995
  }));
989
996
  }
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) => {
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;
997
+ const t = [], e = Math.max(1, this._perPage), s = (i) => this._autoSort && this._sortColumns.length > 0 ? _(i, this._sortColumns) : i, a = (i, r, o) => {
998
+ const n = this.extractId(i), d = n != null && this._expandedIds.has(n), m = this.extractChildCount(i);
999
+ if (t.push({ row: i, key: this._rowKey(i, t.length), depth: r, parentId: o, isExpanded: d, isPlaceholder: !1 }), !d || m === 0 || n == null) return;
993
1000
  const u = this._childCache.get(n);
994
1001
  if (u && u.length > 0) {
995
- for (const _ of s(u)) i(_, r + 1, n);
1002
+ for (const f of s(u)) a(f, r + 1, n);
996
1003
  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 });
1004
+ for (let f = 0; f < Math.max(0, p - u.length); f++)
1005
+ t.push({ row: void 0, key: `__placeholder-${String(n)}-${u.length + f}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
999
1006
  } else
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 });
1007
+ for (let p = 0; p < m; p++)
1008
+ t.push({ row: void 0, key: `__placeholder-${String(n)}-${p}`, depth: r + 1, parentId: n, isExpanded: !1, isPlaceholder: !0 });
1002
1009
  };
1003
1010
  if (this.isRootWindowed()) {
1004
- const a = this._totalRecords ?? this._data.length;
1005
- for (let r = 0; r < a; r++) {
1006
- const o = Math.floor(r / t) + 1, n = r % t, h = o === 1 ? this._data[n] : this._pageCache.get(o)?.[n];
1007
- h === void 0 ? e.push({ row: void 0, key: `__placeholder-root-${r}`, depth: 0, parentId: null, page: o, isExpanded: !1, isPlaceholder: !0 }) : i(h, 0, null);
1011
+ const i = this._totalRecords ?? this._data.length;
1012
+ for (let r = 0; r < i; r++) {
1013
+ const o = Math.floor(r / e) + 1, n = r % e, d = o === 1 ? this._data[n] : this._pageCache.get(o)?.[n];
1014
+ d === void 0 ? t.push({ row: void 0, key: `__placeholder-root-${r}`, depth: 0, parentId: null, page: o, isExpanded: !1, isPlaceholder: !0 }) : a(d, 0, null);
1008
1015
  }
1009
1016
  } else {
1010
- const a = this._autoSort && this._sortColumns.length > 0 ? b(this._data, this._sortColumns) : this._data;
1011
- for (const r of a) i(r, 0, null);
1017
+ const i = this._autoSort && this._sortColumns.length > 0 ? _(this._data, this._sortColumns) : this._data;
1018
+ for (const r of i) a(r, 0, null);
1012
1019
  }
1013
- return this._cachedFlatList = e;
1020
+ return this._cachedFlatList = t;
1014
1021
  }
1015
1022
  computeVisibleRows() {
1016
- const e = this.getFlatList(), t = this._tree ? 0 : this._pagination ? (this._page - 1) * this._perPage : 0;
1017
- let s = e, i = 0;
1023
+ const t = this.getFlatList(), e = this._tree ? 0 : this._pagination ? (this._page - 1) * this._perPage : 0;
1024
+ let s = t, a = 0;
1018
1025
  if (this._virtualScroll) {
1019
- const { startIndex: a, endIndex: r } = this._virtualRange;
1020
- s = e.slice(a, r), i = a;
1026
+ const { startIndex: i, endIndex: r } = this._virtualRange;
1027
+ s = t.slice(i, r), a = i;
1021
1028
  }
1022
- return s.map((a, r) => {
1023
- const o = t + i + r;
1024
- return { row: a.row, rowIndex: o, key: a.key, flat: a };
1029
+ return s.map((i, r) => {
1030
+ const o = e + a + r;
1031
+ return { row: i.row, rowIndex: o, key: i.key, flat: i };
1025
1032
  });
1026
1033
  }
1027
1034
  // ─── Tree-mode helpers ───────────────────────────────────────────────────
1028
- extractId(e) {
1029
- return !this._idKey || e == null || typeof e != "object" ? null : typeof this._idKey == "function" ? this._idKey(e) : e[this._idKey];
1035
+ extractId(t) {
1036
+ return !this._idKey || t == null || typeof t != "object" ? null : typeof this._idKey == "function" ? this._idKey(t) : t[this._idKey];
1030
1037
  }
1031
- extractChildCount(e) {
1032
- if (!this._childCountKey || e == null || typeof e != "object") return 0;
1033
- const t = e[this._childCountKey];
1034
- return typeof t == "number" && t > 0 ? t : 0;
1038
+ extractChildCount(t) {
1039
+ if (!this._childCountKey || t == null || typeof t != "object") return 0;
1040
+ const e = t[this._childCountKey];
1041
+ return typeof e == "number" && e > 0 ? e : 0;
1035
1042
  }
1036
1043
  /** Walks the loaded subtree of `row` and returns the rowKey for every descendant. */
1037
- collectDescendantKeys(e) {
1038
- const t = this.extractId(e), s = t != null ? this._childCache.get(t) : void 0;
1044
+ collectDescendantKeys(t) {
1045
+ const e = this.extractId(t), s = e != null ? this._childCache.get(e) : void 0;
1039
1046
  if (!s) return [];
1040
- const i = [];
1041
- for (const a of s) {
1042
- i.push(this._rowKey(a, -1));
1043
- const r = this.collectDescendantKeys(a);
1044
- for (const o of r) i.push(o);
1047
+ const a = [];
1048
+ for (const i of s) {
1049
+ a.push(this._rowKey(i, -1));
1050
+ const r = this.collectDescendantKeys(i);
1051
+ for (const o of r) a.push(o);
1045
1052
  }
1046
- return i;
1053
+ return a;
1047
1054
  }
1048
1055
  /** Some-but-not-all loaded descendants selected → indeterminate parent checkbox. */
1049
- isParentIndeterminate(e) {
1050
- return this._selectionStrategy !== "cascading" || e == null ? !1 : this.getIndeterminateKeys().has(this._rowKey(e, -1));
1056
+ isParentIndeterminate(t) {
1057
+ return this._selectionStrategy !== "cascading" || t == null ? !1 : this.getIndeterminateKeys().has(this._rowKey(t, -1));
1051
1058
  }
1052
1059
  /**
1053
1060
  * Per-render memo: the set of row keys whose loaded subtree is partially
@@ -1058,44 +1065,44 @@ class k extends C {
1058
1065
  */
1059
1066
  getIndeterminateKeys() {
1060
1067
  if (this._cachedIndeterminateKeys !== null) return this._cachedIndeterminateKeys;
1061
- const e = /* @__PURE__ */ new Set();
1068
+ const t = /* @__PURE__ */ new Set();
1062
1069
  if (this._selectionStrategy !== "cascading" || !this._tree)
1063
- return this._cachedIndeterminateKeys = e;
1064
- const t = (s) => {
1065
- const i = this.extractId(s);
1066
- if (i == null) return { selected: 0, total: 0 };
1067
- const a = this._childCache.get(i);
1068
- if (!a || a.length === 0) return { selected: 0, total: 0 };
1070
+ return this._cachedIndeterminateKeys = t;
1071
+ const e = (s) => {
1072
+ const a = this.extractId(s);
1073
+ if (a == null) return { selected: 0, total: 0 };
1074
+ const i = this._childCache.get(a);
1075
+ if (!i || i.length === 0) return { selected: 0, total: 0 };
1069
1076
  let r = 0, o = 0;
1070
- for (const n of a) {
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;
1077
+ for (const n of i) {
1078
+ const d = this._rowKey(n, -1), m = this._selectedIds.has(d) ? 1 : 0, u = e(n);
1079
+ r += m + u.selected, o += 1 + u.total;
1073
1080
  }
1074
- return o > 0 && r > 0 && r < o && e.add(this._rowKey(s, -1)), { selected: r, total: o };
1081
+ return o > 0 && r > 0 && r < o && t.add(this._rowKey(s, -1)), { selected: r, total: o };
1075
1082
  };
1076
- for (const s of this._data) t(s);
1077
- return this._cachedIndeterminateKeys = e;
1083
+ for (const s of this._data) e(s);
1084
+ return this._cachedIndeterminateKeys = t;
1078
1085
  }
1079
1086
  /**
1080
1087
  * Toggle a row's expanded state. On expand, fires a fetch-request event if
1081
1088
  * children aren't cached yet so the wrapper can bridge to the consumer's
1082
1089
  * `[fetch]` callback. Always fires `expanded-ids-change`.
1083
1090
  */
1084
- toggleExpand(e, t, s, i) {
1085
- i.stopPropagation(), i.preventDefault();
1086
- const a = this.extractId(e);
1087
- if (a == null) return;
1091
+ toggleExpand(t, e, s, a) {
1092
+ a.stopPropagation(), a.preventDefault();
1093
+ const i = this.extractId(t);
1094
+ if (i == null) return;
1088
1095
  const r = new Set(this._expandedIds);
1089
1096
  let o;
1090
- r.has(a) ? (r.delete(a), o = !1) : (r.add(a), o = !0), this._expandedIds = r, o ? (this.dispatchEvent(
1097
+ r.has(i) ? (r.delete(i), o = !1) : (r.add(i), o = !0), this._expandedIds = r, o ? (this.dispatchEvent(
1091
1098
  new CustomEvent("mp-datatable-row-expand", {
1092
- detail: { row: e, depth: s, parentId: t },
1099
+ detail: { row: t, depth: s, parentId: e },
1093
1100
  bubbles: !0,
1094
1101
  composed: !0
1095
1102
  })
1096
- ), this.extractChildCount(e) > 0 && !this._childCache.has(a) && !this._pendingFetches.has(a) && this.fetchChildren(a)) : this.dispatchEvent(
1103
+ ), this.extractChildCount(t) > 0 && !this._childCache.has(i) && !this._pendingFetches.has(i) && this.fetchChildren(i)) : this.dispatchEvent(
1097
1104
  new CustomEvent("mp-datatable-row-collapse", {
1098
- detail: { row: e, depth: s, parentId: t },
1105
+ detail: { row: t, depth: s, parentId: e },
1099
1106
  bubbles: !0,
1100
1107
  composed: !0
1101
1108
  })
@@ -1117,34 +1124,34 @@ class k extends C {
1117
1124
  * that echoes a different page number can't deadlock the window.
1118
1125
  * Generation-guarded against responses that land after an invalidation.
1119
1126
  */
1120
- async fetchWindowPage(e) {
1121
- if (!this._fetch || e <= 1) return;
1122
- this._pendingPageFetches.add(e);
1123
- const t = this._fetchGeneration;
1127
+ async fetchWindowPage(t) {
1128
+ if (!this._fetch || t <= 1) return;
1129
+ this._pendingPageFetches.add(t);
1130
+ const e = this._fetchGeneration;
1124
1131
  try {
1125
- const s = await this._fetch({ parentId: null, page: e, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1126
- if (t !== this._fetchGeneration || !this._fetch) return;
1127
- this._pendingPageFetches.delete(e), this._pageCache.set(e, [...s?.data ?? []]);
1128
- const i = s?.totalRecords == null ? null : Math.max(0, Math.floor(s.totalRecords));
1129
- i != null && (this._totalRecords = i), this.requestUpdate();
1132
+ const s = await this._fetch({ parentId: null, page: t, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1133
+ if (e !== this._fetchGeneration || !this._fetch) return;
1134
+ this._pendingPageFetches.delete(t), this._pageCache.set(t, [...s?.data ?? []]);
1135
+ const a = s?.totalRecords == null ? null : Math.max(0, Math.floor(s.totalRecords));
1136
+ a != null && (this._totalRecords = a), this.requestUpdate();
1130
1137
  } catch (s) {
1131
- this._pendingPageFetches.delete(e), console.error("[mp-datatable] fetch failed for root page", e, s);
1138
+ this._pendingPageFetches.delete(t), console.error("[mp-datatable] fetch failed for root page", t, s);
1132
1139
  }
1133
1140
  }
1134
1141
  /**
1135
1142
  * Fetch a node's children into the child cache. Called on expand or when a
1136
1143
  * child placeholder scrolls into view. Generation-guarded.
1137
1144
  */
1138
- async fetchChildren(e) {
1139
- if (!this._fetch || e == null) return;
1140
- this._pendingFetches.add(e);
1141
- const t = this._fetchGeneration;
1145
+ async fetchChildren(t) {
1146
+ if (!this._fetch || t == null) return;
1147
+ this._pendingFetches.add(t);
1148
+ const e = this._fetchGeneration;
1142
1149
  try {
1143
- const s = await this._fetch({ parentId: e, page: 1, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1144
- if (t !== this._fetchGeneration || !this._fetch) return;
1145
- this._pendingFetches.delete(e), this._childCache.set(e, [...s?.data ?? []]), this._childTotals.set(e, s?.totalRecords ?? s?.data?.length ?? 0), this.requestUpdate();
1150
+ const s = await this._fetch({ parentId: t, page: 1, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1151
+ if (e !== this._fetchGeneration || !this._fetch) return;
1152
+ this._pendingFetches.delete(t), this._childCache.set(t, [...s?.data ?? []]), this._childTotals.set(t, s?.totalRecords ?? s?.data?.length ?? 0), this.requestUpdate();
1146
1153
  } catch (s) {
1147
- this._pendingFetches.delete(e), console.error("[mp-datatable] fetch failed for children of", e, s);
1154
+ this._pendingFetches.delete(t), console.error("[mp-datatable] fetch failed for children of", t, s);
1148
1155
  }
1149
1156
  }
1150
1157
  /**
@@ -1152,20 +1159,20 @@ class k extends C {
1152
1159
  * non-virtual pagination). The grand total is read from the response —
1153
1160
  * consumers never set `totalRecords`. Generation-guarded against stale loads.
1154
1161
  */
1155
- async loadPage(e) {
1162
+ async loadPage(t) {
1156
1163
  if (!this._fetch) return;
1157
- const t = this._fetchGeneration;
1164
+ const e = this._fetchGeneration;
1158
1165
  let s;
1159
1166
  try {
1160
- s = await this._fetch({ parentId: null, page: e, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1161
- } catch (a) {
1162
- console.error("[mp-datatable] fetch failed for page", e, a);
1167
+ s = await this._fetch({ parentId: null, page: t, perPage: this._perPage, sortColumns: [...this._sortColumns] });
1168
+ } catch (i) {
1169
+ console.error("[mp-datatable] fetch failed for page", t, i);
1163
1170
  return;
1164
1171
  }
1165
- if (t !== this._fetchGeneration || !this._fetch) return;
1172
+ if (e !== this._fetchGeneration || !this._fetch) return;
1166
1173
  this._data = [...s?.data ?? []];
1167
- const i = s?.totalRecords == null ? null : Math.max(0, Math.floor(s.totalRecords));
1168
- this._totalRecords = i, this._initialFetchDone = !0, this.requestUpdate();
1174
+ const a = s?.totalRecords == null ? null : Math.max(0, Math.floor(s.totalRecords));
1175
+ this._totalRecords = a, this._initialFetchDone = !0, this.requestUpdate();
1169
1176
  }
1170
1177
  /**
1171
1178
  * Coalesce sort/perPage/page changes (which arrive both as user actions and
@@ -1176,42 +1183,42 @@ class k extends C {
1176
1183
  scheduleFetchReload() {
1177
1184
  !this._fetch || this._reloadScheduled || (this._reloadScheduled = !0, queueMicrotask(() => {
1178
1185
  if (this._reloadScheduled = !1, !this._fetch) return;
1179
- const e = JSON.stringify({
1186
+ const t = JSON.stringify({
1180
1187
  s: this._sortColumns,
1181
1188
  pp: this._perPage,
1182
1189
  p: this._virtualScroll ? 1 : this._page
1183
1190
  });
1184
- this._initialFetchDone && e === this._lastReloadKey || (this._lastReloadKey = e, this._fetchGeneration++, this._pageCache.clear(), this._pendingPageFetches.clear(), this._childCache.clear(), this._childTotals.clear(), this._pendingFetches.clear(), this.loadPage(this._virtualScroll ? 1 : this._page));
1191
+ this._initialFetchDone && t === this._lastReloadKey || (this._lastReloadKey = t, this._fetchGeneration++, this._pageCache.clear(), this._pendingPageFetches.clear(), this._childCache.clear(), this._childTotals.clear(), this._pendingFetches.clear(), this.loadPage(this._virtualScroll ? 1 : this._page));
1185
1192
  }));
1186
1193
  }
1187
1194
  /** Keyboard handling on a tree-mode row. Arrow keys + Enter/Space toggle expansion. */
1188
- onRowKeydown(e, t, s, i, a, r, o, n) {
1195
+ onRowKeydown(t, e, s, a, i, r, o, n) {
1189
1196
  if (!n.altKey && n.composedPath()[0] === n.currentTarget) {
1190
1197
  if (n.key === "ArrowDown" || n.key === "ArrowUp") {
1191
1198
  n.preventDefault();
1192
- const h = Array.from(
1199
+ const d = Array.from(
1193
1200
  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)];
1201
+ ), m = d.findIndex((p) => p.dataset.rowKey === e), u = d[m + (n.key === "ArrowDown" ? 1 : -1)];
1195
1202
  u && u.focus();
1196
1203
  return;
1197
1204
  }
1198
1205
  if (this._tree) {
1199
1206
  if (n.key === "ArrowRight" && o > 0 && !r) {
1200
- this.toggleExpand(e, i, a, n);
1207
+ this.toggleExpand(t, a, i, n);
1201
1208
  return;
1202
1209
  }
1203
1210
  if (n.key === "ArrowLeft" && r) {
1204
- this.toggleExpand(e, i, a, n);
1211
+ this.toggleExpand(t, a, i, n);
1205
1212
  return;
1206
1213
  }
1207
1214
  if ((n.key === "Enter" || n.key === " ") && o > 0) {
1208
- this.toggleExpand(e, i, a, n);
1215
+ this.toggleExpand(t, a, i, n);
1209
1216
  return;
1210
1217
  }
1211
1218
  }
1212
- (n.key === "Enter" || n.key === " ") && this._selectionMode !== "none" && (n.preventDefault(), this._focusedRowKey = t, this.handleSelectionOnClick(t, n), this.requestUpdate(), this.dispatchEvent(
1219
+ (n.key === "Enter" || n.key === " ") && this._selectionMode !== "none" && (n.preventDefault(), this._focusedRowKey = e, this.handleSelectionOnClick(e, n), this.requestUpdate(), this.dispatchEvent(
1213
1220
  new CustomEvent("mp-datatable-row-click", {
1214
- detail: { row: e, rowIndex: s, rowKey: t, originalEvent: n },
1221
+ detail: { row: t, rowIndex: s, rowKey: e, originalEvent: n },
1215
1222
  bubbles: !0,
1216
1223
  composed: !0
1217
1224
  })
@@ -1221,66 +1228,66 @@ class k extends C {
1221
1228
  hasRowClickListeners() {
1222
1229
  return !0;
1223
1230
  }
1224
- onHeaderClick(e, t) {
1225
- if (!(e.sortable ?? !0) || t.target.closest(".resize-handle")) return;
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);
1231
+ onHeaderClick(t, e) {
1232
+ if (!(t.sortable ?? !0) || e.target.closest(".resize-handle")) return;
1233
+ const i = L(this._sortColumns, t.name, e.shiftKey);
1234
+ this._sortColumns = i, this._page = 1;
1235
+ const r = i.find((o) => o.property === t.name);
1229
1236
  this.liveAnnouncer.announce(
1230
1237
  this.mergedLabels.announceSorted(
1231
- e.label ?? e.name,
1238
+ t.label ?? t.name,
1232
1239
  r ? r.direction === "ascending" ? "ascending" : "descending" : "none"
1233
1240
  )
1234
1241
  ), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
1235
1242
  new CustomEvent("mp-datatable-sort-change", {
1236
- detail: { sortColumns: a },
1243
+ detail: { sortColumns: i },
1237
1244
  bubbles: !0,
1238
1245
  composed: !0
1239
1246
  })
1240
1247
  );
1241
1248
  }
1242
- onRowClick(e, t, s, i) {
1243
- i.target.closest('input[type="checkbox"]') || (this._focusedRowKey = t, this.handleSelectionOnClick(t, i), this.requestUpdate(), this.dispatchEvent(
1249
+ onRowClick(t, e, s, a) {
1250
+ a.target.closest('input[type="checkbox"]') || (this._focusedRowKey = e, this.handleSelectionOnClick(e, a), this.requestUpdate(), this.dispatchEvent(
1244
1251
  new CustomEvent("mp-datatable-row-click", {
1245
- detail: { row: e, rowIndex: s, rowKey: t, originalEvent: i },
1252
+ detail: { row: t, rowIndex: s, rowKey: e, originalEvent: a },
1246
1253
  bubbles: !0,
1247
1254
  composed: !0
1248
1255
  })
1249
1256
  ));
1250
1257
  }
1251
- onRowDblClick(e, t, s, i) {
1258
+ onRowDblClick(t, e, s, a) {
1252
1259
  this.dispatchEvent(
1253
1260
  new CustomEvent("mp-datatable-row-dblclick", {
1254
- detail: { row: e, rowIndex: s, rowKey: t, originalEvent: i },
1261
+ detail: { row: t, rowIndex: s, rowKey: e, originalEvent: a },
1255
1262
  bubbles: !0,
1256
1263
  composed: !0
1257
1264
  })
1258
1265
  );
1259
1266
  }
1260
- onRowContextMenu(e, t, s, i) {
1261
- this._selectionMode !== "none" && !this._selectedIds.has(t) && (this._selectedIds = /* @__PURE__ */ new Set([t]), this._focusedRowKey = t, this.emitSelectionChange(), this.requestUpdate()), this.dispatchEvent(
1267
+ onRowContextMenu(t, e, s, a) {
1268
+ this._selectionMode !== "none" && !this._selectedIds.has(e) && (this._selectedIds = /* @__PURE__ */ new Set([e]), this._focusedRowKey = e, this.emitSelectionChange(), this.requestUpdate()), this.dispatchEvent(
1262
1269
  new CustomEvent("mp-datatable-row-contextmenu", {
1263
- detail: { row: e, rowIndex: s, rowKey: t, originalEvent: i },
1270
+ detail: { row: t, rowIndex: s, rowKey: e, originalEvent: a },
1264
1271
  bubbles: !0,
1265
1272
  composed: !0,
1266
1273
  cancelable: !0
1267
1274
  })
1268
1275
  );
1269
1276
  }
1270
- onRowCheckboxToggle(e, t, s, i) {
1277
+ onRowCheckboxToggle(t, e, s, a) {
1271
1278
  if (this._selectionMode !== "none") {
1272
1279
  if (this._selectionMode === "single")
1273
- this._selectedIds = /* @__PURE__ */ new Set([t]);
1280
+ this._selectedIds = /* @__PURE__ */ new Set([e]);
1274
1281
  else {
1275
- const a = new Set(this._selectedIds), r = !a.has(t);
1276
- if (r ? a.add(t) : a.delete(t), this._tree && this._selectionStrategy === "cascading" && e != null) {
1277
- const o = this.collectDescendantKeys(e);
1282
+ const i = new Set(this._selectedIds), r = !i.has(e);
1283
+ if (r ? i.add(e) : i.delete(e), this._tree && this._selectionStrategy === "cascading" && t != null) {
1284
+ const o = this.collectDescendantKeys(t);
1278
1285
  if (r)
1279
- for (const n of o) a.add(n);
1286
+ for (const n of o) i.add(n);
1280
1287
  else
1281
- for (const n of o) a.delete(n);
1288
+ for (const n of o) i.delete(n);
1282
1289
  }
1283
- this._selectedIds = a;
1290
+ this._selectedIds = i;
1284
1291
  }
1285
1292
  this.emitSelectionChange(), this.requestUpdate();
1286
1293
  }
@@ -1295,33 +1302,33 @@ class k extends C {
1295
1302
  onDeselectAll() {
1296
1303
  this._selectedIds.size !== 0 && (this._selectedIds = /* @__PURE__ */ new Set(), this.emitSelectionChange(), this.requestUpdate());
1297
1304
  }
1298
- handleSelectionOnClick(e, t) {
1305
+ handleSelectionOnClick(t, e) {
1299
1306
  if (this._selectionMode !== "none") {
1300
1307
  if (this._selectionMode === "single") {
1301
- this._selectedIds = /* @__PURE__ */ new Set([e]), this.emitSelectionChange();
1308
+ this._selectedIds = /* @__PURE__ */ new Set([t]), this.emitSelectionChange();
1302
1309
  return;
1303
1310
  }
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);
1306
- if (i >= 0 && a >= 0) {
1307
- const [r, o] = i < a ? [i, a] : [a, i], n = s.slice(r, o + 1).map((h) => h.key);
1311
+ if (e.shiftKey && this._selectionAnchorKey && this._selectionAnchorKey !== t) {
1312
+ const s = this.computeVisibleRows(), a = s.findIndex((r) => r.key === this._selectionAnchorKey), i = s.findIndex((r) => r.key === t);
1313
+ if (a >= 0 && i >= 0) {
1314
+ const [r, o] = a < i ? [a, i] : [i, a], n = s.slice(r, o + 1).map((d) => d.key);
1308
1315
  this._selectedIds = /* @__PURE__ */ new Set([...this._selectedIds, ...n]), this.emitSelectionChange();
1309
1316
  return;
1310
1317
  }
1311
1318
  }
1312
- if (t.ctrlKey || t.metaKey) {
1319
+ if (e.ctrlKey || e.metaKey) {
1313
1320
  const s = new Set(this._selectedIds);
1314
- s.has(e) ? s.delete(e) : s.add(e), this._selectedIds = s, this._selectionAnchorKey = e, this.emitSelectionChange();
1321
+ s.has(t) ? s.delete(t) : s.add(t), this._selectedIds = s, this._selectionAnchorKey = t, this.emitSelectionChange();
1315
1322
  return;
1316
1323
  }
1317
- this._selectedIds = /* @__PURE__ */ new Set([e]), this._selectionAnchorKey = e, this.emitSelectionChange();
1324
+ this._selectedIds = /* @__PURE__ */ new Set([t]), this._selectionAnchorKey = t, this.emitSelectionChange();
1318
1325
  }
1319
1326
  }
1320
1327
  emitSelectionChange() {
1321
- const e = [...this._selectedIds];
1322
- this.liveAnnouncer.announce(this.mergedLabels.announceSelection(e.length)), this.dispatchEvent(
1328
+ const t = [...this._selectedIds];
1329
+ this.liveAnnouncer.announce(this.mergedLabels.announceSelection(t.length)), this.dispatchEvent(
1323
1330
  new CustomEvent("mp-datatable-selection-change", {
1324
- detail: { selectedIds: e, selectedRows: this.resolveRows(e) },
1331
+ detail: { selectedIds: t, selectedRows: this.resolveRows(t) },
1325
1332
  bubbles: !0,
1326
1333
  composed: !0
1327
1334
  })
@@ -1332,19 +1339,19 @@ class k extends C {
1332
1339
  * fetched windows in `_pageCache`, tree children in `_childCache`). One pass
1333
1340
  * builds a key→row index; unresolvable ids are skipped.
1334
1341
  */
1335
- resolveRows(e) {
1336
- if (e.length === 0) return [];
1337
- const t = /* @__PURE__ */ new Map(), s = (i) => {
1338
- for (const a of i) t.set(this._rowKey(a, -1), a);
1342
+ resolveRows(t) {
1343
+ if (t.length === 0) return [];
1344
+ const e = /* @__PURE__ */ new Map(), s = (a) => {
1345
+ for (const i of a) e.set(this._rowKey(i, -1), i);
1339
1346
  };
1340
1347
  s(this._data);
1341
- for (const i of this._pageCache.values()) s(i);
1342
- for (const i of this._childCache.values()) s(i);
1343
- return e.map((i) => t.get(i)).filter((i) => i !== void 0);
1348
+ for (const a of this._pageCache.values()) s(a);
1349
+ for (const a of this._childCache.values()) s(a);
1350
+ return t.map((a) => e.get(a)).filter((a) => a !== void 0);
1344
1351
  }
1345
- gotoPage(e) {
1346
- const t = this._totalRecords ?? this._data.length, s = Math.max(1, Math.ceil(t / this._perPage));
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(
1352
+ gotoPage(t) {
1353
+ const e = this._totalRecords ?? this._data.length, s = Math.max(1, Math.ceil(e / this._perPage));
1354
+ this._page = Math.max(1, Math.min(s, t)), this.liveAnnouncer.announce(this.mergedLabels.announcePage(this._page, s)), this.requestUpdate(), this.scheduleFetchReload(), this.dispatchEvent(
1348
1355
  new CustomEvent("mp-datatable-page-change", {
1349
1356
  detail: { page: this._page },
1350
1357
  bubbles: !0,
@@ -1357,36 +1364,37 @@ class k extends C {
1357
1364
  * floor. The handle is a focusable role="separator"; without this it was the
1358
1365
  * audit's pointer-only finding for the datatable.
1359
1366
  */
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();
1367
+ onResizeHandleKeydown(t, e) {
1368
+ if (!this._resizableColumns || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
1369
+ e.preventDefault(), e.stopPropagation();
1370
+ const a = e.currentTarget.closest("th"), i = this._columnWidths.get(t.name) ?? a?.getBoundingClientRect().width ?? 100, r = Math.max(40, i + (e.key === "ArrowRight" ? 10 : -10));
1371
+ this._columnWidths = new Map(this._columnWidths), this._columnWidths.set(t.name, r), this.requestUpdate();
1365
1372
  }
1366
- startColumnResize(e, t) {
1373
+ startColumnResize(t, e) {
1367
1374
  if (!this._resizableColumns) return;
1368
- t.preventDefault(), t.stopPropagation();
1369
- const s = t.currentTarget, i = s.closest("th");
1370
- if (!i) return;
1371
- const a = i.getBoundingClientRect().width;
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);
1375
+ e.preventDefault(), e.stopPropagation();
1376
+ const s = e.currentTarget, a = s.closest("th");
1377
+ if (!a) return;
1378
+ const i = a.getBoundingClientRect().width;
1379
+ this.resizeState = { columnName: t.name, startX: e.clientX, startWidth: i, handle: s }, s.classList.add("active"), s.setPointerCapture(e.pointerId), s.addEventListener("pointermove", this.onColumnResizeMove), s.addEventListener("pointerup", this.onColumnResizeEnd), s.addEventListener("pointercancel", this.onColumnResizeEnd);
1373
1380
  }
1374
1381
  }
1375
- function A(l, e) {
1382
+ function q(l, t) {
1376
1383
  if (l == null || typeof l != "object") return "";
1377
- const t = l[e.name];
1378
- return t == null ? "" : String(t);
1384
+ const e = l[t.name];
1385
+ return e == null ? "" : String(e);
1379
1386
  }
1380
- function F(l) {
1387
+ function U(l) {
1381
1388
  return l != null && typeof l != "string" && typeof l[Symbol.iterator] == "function";
1382
1389
  }
1383
1390
  function y(l) {
1384
- return l == null || l === !1 ? d : (l instanceof Node || typeof l == "object" && "_$litType$" in l, l);
1391
+ return l == null || l === !1 ? h : (l instanceof Node || typeof l == "object" && "_$litType$" in l, l);
1385
1392
  }
1386
- typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable", k);
1393
+ S("datatable", z);
1394
+ typeof customElements < "u" && !customElements.get("mp-datatable") && customElements.define("mp-datatable", F);
1387
1395
  export {
1388
- k as M,
1389
- K as c,
1390
- M as d,
1391
- b as s
1396
+ F as M,
1397
+ L as c,
1398
+ z as d,
1399
+ _ as s
1392
1400
  };