bitboss-ui 2.1.127 → 2.1.129

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.
@@ -0,0 +1,664 @@
1
+ import { clamp as e } from "./index8.js";
2
+ import { useId as t } from "./index12.js";
3
+ import { useLogger as n } from "./index31.js";
4
+ import { useLocale as r } from "./index42.js";
5
+ import { hash as i } from "./index81.js";
6
+ import a from "./index85.js";
7
+ import { useItemsGetter as o } from "./index89.js";
8
+ import { useIndexById as s } from "./index90.js";
9
+ import { useItemValue as c } from "./index92.js";
10
+ import { useBaseOptions as l } from "./index93.js";
11
+ import { isNil as u } from "./index94.js";
12
+ import { useHashedWatcher as d } from "./index96.js";
13
+ import { usePrefill as ee } from "./index97.js";
14
+ import { when as te } from "./index151.js";
15
+ import f from "./index154.js";
16
+ import { useTableWidthContext as ne } from "./index325.js";
17
+ import { applyFixedTableColumns as re, columnKeyToSlotName as p, mergeCellClasses as ie, mergeHeaderClasses as ae } from "./index326.js";
18
+ import { Fragment as m, computed as h, createBlock as oe, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as se, createVNode as ce, defineComponent as y, mergeModels as le, mergeProps as ue, nextTick as de, normalizeClass as b, normalizeStyle as x, onBeforeUnmount as fe, onMounted as pe, openBlock as S, reactive as me, ref as C, renderList as w, renderSlot as T, resolveDynamicComponent as he, toDisplayString as E, toRef as ge, unref as D, useModel as _e, watch as O, withCtx as ve } from "vue";
19
+ //#region src/components/BbTable/BbTable.vue?vue&type=script&setup=true&lang.ts
20
+ var ye = {
21
+ key: 0,
22
+ class: "sr-only"
23
+ }, be = ["aria-rowindex"], xe = { class: "bb-table-header__content" }, Se = { class: "bb-table-check__label-text sr-only" }, Ce = {
24
+ key: 1,
25
+ class: "bb-table-radio__label-text sr-only"
26
+ }, we = ["aria-sort"], Te = { class: "bb-table-header__content" }, Ee = { class: "bb-table-header__content sr-only" }, De = ["aria-rowindex"], Oe = {
27
+ key: 0,
28
+ class: "bb-table-skeleton__cell bb-table-skeleton__cell--select"
29
+ }, ke = {
30
+ key: 0,
31
+ class: "bb-table-skeleton__cell-content"
32
+ }, Ae = {
33
+ key: 1,
34
+ class: "bb-table-skeleton__avatar"
35
+ }, je = {
36
+ key: 2,
37
+ class: "bb-table-skeleton__avatar-text"
38
+ }, Me = { class: "bb-table-skeleton__cell-content" }, Ne = {
39
+ key: 3,
40
+ class: "bb-table-skeleton__image"
41
+ }, Pe = {
42
+ key: 4,
43
+ class: "bb-table-skeleton__badge"
44
+ }, Fe = {
45
+ key: 1,
46
+ class: "bb-table-skeleton__cell bb-table-skeleton__cell--actions"
47
+ }, Ie = ["aria-rowindex"], Le = ["colspan"], Re = { class: "bb-table-loading__text sr-only" }, ze = ["aria-rowindex"], Be = ["colspan"], Ve = { class: "bb-table-no-data__text" }, He = [
48
+ "aria-rowindex",
49
+ "onClick",
50
+ "onContextmenu",
51
+ "onDblclick"
52
+ ], Ue = { class: "bb-table-check__label-text sr-only" }, We = { class: "bb-table-radio__label-text sr-only" }, Ge = ["aria-rowindex", "id"], Ke = ["colspan"], qe = /* @__PURE__ */ y({
53
+ __name: "BbTable",
54
+ props: /* @__PURE__ */ le({
55
+ accessibleLabel: {},
56
+ actions: { type: Boolean },
57
+ actionsText: { default: "Azioni" },
58
+ align: { default: "left" },
59
+ id: {},
60
+ inheritColumnWidths: {
61
+ type: [Boolean, String],
62
+ default: !0
63
+ },
64
+ allowSelectAll: {
65
+ type: Boolean,
66
+ default: !0
67
+ },
68
+ caption: {},
69
+ compact: { type: Boolean },
70
+ dependencies: { default: () => [] },
71
+ depsDebounceTime: { default: 0 },
72
+ disabled: { type: Boolean },
73
+ displayCaption: { type: Boolean },
74
+ fixed: { type: Boolean },
75
+ fixedColumns: { default: () => [] },
76
+ fixedHeaders: { type: Boolean },
77
+ items: {
78
+ type: [Array, Function],
79
+ default: () => []
80
+ },
81
+ itemValue: {},
82
+ legend: {},
83
+ loading: { type: Boolean },
84
+ loadingText: {},
85
+ max: { default: Infinity },
86
+ modelValue: { default: () => [] },
87
+ multiple: {
88
+ type: Boolean,
89
+ default: !0
90
+ },
91
+ name: {},
92
+ noDataText: {},
93
+ page: {},
94
+ perPage: {},
95
+ readonly: { type: Boolean },
96
+ selectAll: { type: Boolean },
97
+ selectable: { type: [Boolean, Function] },
98
+ selectAllLabel: {},
99
+ selectText: {},
100
+ tdClass: {},
101
+ thClass: {},
102
+ totalItems: {},
103
+ unselectedItems: { default: () => [] },
104
+ columns: { default: () => [] }
105
+ }, {
106
+ selectAll: {
107
+ type: Boolean,
108
+ required: !1,
109
+ default: !1
110
+ },
111
+ selectAllModifiers: {},
112
+ expandedItems: {
113
+ required: !1,
114
+ default: () => []
115
+ },
116
+ expandedItemsModifiers: {}
117
+ }),
118
+ emits: /* @__PURE__ */ le([
119
+ "click:row",
120
+ "contextmenu:row",
121
+ "dblclick:row",
122
+ "update:modelValue",
123
+ "update:selectAll",
124
+ "update:expandedItems",
125
+ "update:unselectedItems",
126
+ "item:selected",
127
+ "item:unselected"
128
+ ], ["update:selectAll", "update:expandedItems"]),
129
+ setup(y, { emit: le }) {
130
+ let { getItemValue: qe } = c(), Je = t().id.value, k = y, A = le;
131
+ k.multiple && !Array.isArray(k.modelValue) && n().throw("BbTable is set for multiple selection but modelValue is not an array.");
132
+ let { t: j } = r(), M = C(), N = C(), { id: Ye, parentId: P, parentNode: F, cssVars: Xe, parentVar: Ze, setTracks: Qe } = ne({
133
+ id: () => k.id,
134
+ container: () => N.value,
135
+ inheritFrom: () => typeof k.inheritColumnWidths == "string" ? k.inheritColumnWidths : void 0
136
+ }), I = h(() => k.inheritColumnWidths !== !1), L = h(() => k.fixed || k.columns.some((e) => e.width != null) || I.value && !!P.value), R = h(() => I.value && !!P.value), $e = R, et = (e) => {
137
+ if (typeof e == "number") return `${e}px`;
138
+ let t = e.trim();
139
+ return /^-?\d*\.?\d+$/.test(t) ? `${t}px` : t;
140
+ }, tt = h(() => {
141
+ let e = F.value?.tracks;
142
+ return e ? Object.keys(e).filter((e) => /^\d+$/.test(e)).length : 0;
143
+ }), nt = h(() => {
144
+ let e = F.value?.tracks ?? {}, t = [];
145
+ "select" in e && t.push("select");
146
+ for (let e = 0; e < tt.value; e++) t.push(String(e));
147
+ return "actions" in e && t.push("actions"), t;
148
+ }), rt = h(() => +("select" in (F.value?.tracks ?? {}))), it = h(() => rt.value + tt.value), at = h(() => nt.value.length), ot = (e) => {
149
+ let t = nt.value[e];
150
+ return t ? Ze(t, "0px") : "0px";
151
+ }, st = (e, t) => {
152
+ if (!P.value || t - e <= 1e-6) return null;
153
+ let n = [];
154
+ for (let r = Math.floor(e); r < Math.ceil(t - 1e-6); r++) {
155
+ let i = Math.min(t, r + 1) - Math.max(e, r);
156
+ if (i <= 1e-6) continue;
157
+ let a = ot(r);
158
+ n.push(i >= .999999 ? a : `${Number(i.toFixed(4))} * ${a}`);
159
+ }
160
+ return n.length ? n.length === 1 && !n[0].includes("*") ? n[0] : `calc(${n.join(" + ")})` : null;
161
+ }, z = h(() => {
162
+ let e = k.columns, t = e.map((e) => typeof e.snap == "number" ? e.snap : Array.isArray(e.snap) ? e.snap[0] : null), n = rt.value;
163
+ return e.map((e, r) => {
164
+ let i = t[r] ?? n, a;
165
+ if (Array.isArray(e.snap)) a = e.snap[1] === -1 ? it.value : e.snap[1];
166
+ else {
167
+ let e = t[r + 1];
168
+ a = e != null && e > i ? e : Math.floor(i) + 1;
169
+ }
170
+ return n = a, {
171
+ start: i,
172
+ end: a
173
+ };
174
+ });
175
+ }), ct = (e) => R.value && e.start >= it.value, lt = h(() => z.value.some(ct)), B = (e) => k.columns[e]?.width == null && !R.value, V = h(() => {
176
+ if (!R.value) return -1;
177
+ for (let e = k.columns.length - 1; e >= 0; e--) {
178
+ let t = k.columns[e];
179
+ if (t.width == null && t.snap == null) return e;
180
+ }
181
+ return -1;
182
+ }), ut = h(() => {
183
+ let e = z.value[0];
184
+ if (!I.value || !P.value || !e) return null;
185
+ let t = st(0, e.start), n = k.selectable ? H.select : null;
186
+ return n ? `calc(${t ?? "0px"} - ${n})` : t;
187
+ }), dt = h(() => {
188
+ let e = z.value, t = e[e.length - 1];
189
+ if (!I.value || !P.value || !t || lt.value || V.value === k.columns.length - 1) return null;
190
+ let n = st(t.end, at.value), r = k.actions ? H.actions : null;
191
+ return r ? `calc(${n ?? "0px"} - ${r})` : n;
192
+ }), ft = h(() => ut.value !== null), pt = h(() => dt.value !== null), H = me({
193
+ select: null,
194
+ actions: null
195
+ }), mt = h(() => {
196
+ let e = (e) => I.value ? Ze(e) : "auto", t = (t) => L.value && H[t] ? H[t] : e(t), n = [];
197
+ k.selectable && n.push({
198
+ key: "select",
199
+ width: t("select")
200
+ });
201
+ let r = k.columns.length - 1;
202
+ return k.columns.forEach((e, t) => {
203
+ let i = String(t), a = e.width == null ? null : et(e.width), o = z.value[t];
204
+ if (t === V.value && !lt.value) {
205
+ n.push({
206
+ key: i,
207
+ width: "auto"
208
+ });
209
+ return;
210
+ }
211
+ let s;
212
+ s = a ?? (B(t) ? L.value && xt.value[t] || null : ct(o) ? St.value[t] ?? null : st(o.start, o.end));
213
+ let c = [];
214
+ t === 0 && ft.value && c.push("var(--bb-table-offset-internal-start)"), t === r && pt.value && c.push("var(--bb-table-offset-internal-end)");
215
+ let l = c.length ? `calc(${[...c, s ?? "0px"].join(" + ")})` : s ?? "auto";
216
+ n.push({
217
+ key: i,
218
+ width: l
219
+ });
220
+ }), k.actions && n.push({
221
+ key: "actions",
222
+ width: t("actions")
223
+ }), n;
224
+ }), ht = h(() => {
225
+ let e = {};
226
+ return ut.value && (e["--bb-table-offset-start"] = ut.value), dt.value && (e["--bb-table-offset-end"] = dt.value), e;
227
+ }), gt = h(() => {
228
+ let e = {
229
+ ...Xe.value,
230
+ ...ht.value
231
+ };
232
+ return Ct.value && (e["--bb-table-natural-width"] = Ct.value), U.value > 0 && (e["--bb-table-fill"] = `${U.value}px`), e;
233
+ }), _t = () => Array.from(M.value?.querySelectorAll(":scope > thead > tr.bb-table-header-row > th") ?? []), vt = () => {
234
+ let e = mt.value.map((e) => e.key), t = {};
235
+ _t().forEach((n, r) => {
236
+ let i = e[r];
237
+ i != null && (t[i] = `${n.getBoundingClientRect().width}px`);
238
+ }), Qe(t);
239
+ }, yt = () => {
240
+ let e = M.value;
241
+ if (!e) return;
242
+ let t = (t) => {
243
+ let n = 0;
244
+ return e.querySelectorAll(t).forEach((e) => {
245
+ let t = Infinity, r = -Infinity;
246
+ e.querySelectorAll(":scope > *").forEach((e) => {
247
+ let n = e.getBoundingClientRect();
248
+ t = Math.min(t, n.left), r = Math.max(r, n.right);
249
+ });
250
+ let i = r > t ? r - t : 0, a = getComputedStyle(e), o = parseFloat(a.paddingLeft) + parseFloat(a.paddingRight);
251
+ n = Math.max(n, i + o);
252
+ }), n > 0 ? `${Math.ceil(n)}px` : null;
253
+ };
254
+ H.select = k.selectable ? t(":scope > thead > tr > th.bb-table-header--select, :scope > tbody > tr > td.bb-table-data__cell--select") : null, H.actions = k.actions ? t(":scope > thead > tr > th.bb-table-header--actions, :scope > tbody > tr > td.bb-table__cell--actions") : null;
255
+ }, bt = () => {
256
+ yt(), vt();
257
+ }, xt = C([]), St = C([]), U = C(0), Ct = C(null), wt = () => {
258
+ let e = N.value;
259
+ if (!e || !L.value || !k.columns.some((e) => e.width != null) && !lt.value && V.value < 0) return;
260
+ let t = e.offsetWidth, n = +!!k.selectable, r = H.select ? parseFloat(H.select) : 0, i = H.actions ? parseFloat(H.actions) : 0, a = _t(), o = 0, s = 0;
261
+ k.columns.forEach((e, t) => {
262
+ let r = a[n + t]?.getBoundingClientRect().width ?? 0;
263
+ e.width != null && (o += r), B(t) || (s += r);
264
+ });
265
+ let c = document.createElement("div");
266
+ c.style.cssText = [
267
+ "position:absolute",
268
+ "top:-9999px",
269
+ "left:-9999px",
270
+ "visibility:hidden",
271
+ "pointer-events:none",
272
+ `width:${t}px`,
273
+ `height:${e.offsetHeight}px`,
274
+ "overflow:visible"
275
+ ].join(";");
276
+ let l = e.cloneNode(!0);
277
+ l.classList.remove("bb-table--fixed"), l.querySelectorAll(".bb-table-expand__row").forEach((e) => e.remove());
278
+ let u = Array.from(l.querySelectorAll("col"));
279
+ k.columns.forEach((e, t) => {
280
+ if (e.width == null) {
281
+ let e = u[n + t];
282
+ e && (e.style.width = "");
283
+ }
284
+ });
285
+ let d = l.querySelector("table");
286
+ d && (d.style.width = "min-content", d.style.minWidth = "0"), c.appendChild(l), document.body.appendChild(c);
287
+ let ee = c.querySelector("table thead tr.bb-table-header-row"), te = ee ? Array.from(ee.querySelectorAll(":scope > th")) : [], f = k.columns.map((e, t) => {
288
+ if (e.width != null) return 0;
289
+ let r = te[n + t];
290
+ return r ? r.getBoundingClientRect().width : 0;
291
+ });
292
+ document.body.removeChild(c);
293
+ let ne = k.columns.reduce((e, t, n) => e + (B(n) ? f[n] : 0), 0), re = t - s - r - i, p = (e) => `${Number(e.toFixed(3))}px`;
294
+ if (xt.value = k.columns.map((e, t) => {
295
+ if (!B(t)) return null;
296
+ let n = f[t];
297
+ if (ne <= 0) return p(n);
298
+ let r = re > 0 ? n / ne * re : 0;
299
+ return p(Math.max(n, r));
300
+ }), St.value = f.map((e) => e > 0 ? p(e) : null), V.value >= 0) {
301
+ let e = Object.values(F.value?.tracks ?? {}).reduce((e, t) => e + (parseFloat(t) || 0), 0), t = a.reduce((e, t) => e + t.getBoundingClientRect().width, 0);
302
+ U.value = Math.max(0, e - t + U.value);
303
+ } else U.value = 0;
304
+ let ie = f.reduce((e, t) => e + t, 0), ae = o + ie + r + i;
305
+ Ct.value = ae > 0 ? `${Math.ceil(ae)}px` : null;
306
+ }, W = null, Tt, Et = () => {
307
+ W !== null && clearTimeout(W), W = setTimeout(() => {
308
+ W = null, wt();
309
+ }, 200);
310
+ }, G, Dt, Ot = () => {
311
+ G && (G.disconnect(), _t().forEach((e) => G?.observe(e)), bt());
312
+ };
313
+ pe(() => {
314
+ G = new ResizeObserver(() => bt()), Ot(), de(wt), M.value && (Tt = new MutationObserver(Et), Tt.observe(M.value, {
315
+ childList: !0,
316
+ subtree: !0,
317
+ characterData: !0
318
+ })), N.value && (Dt = new ResizeObserver(Et), Dt.observe(N.value));
319
+ }), fe(() => {
320
+ G?.disconnect(), Dt?.disconnect(), Tt?.disconnect(), W !== null && clearTimeout(W);
321
+ }), O(mt, () => de(Ot), { flush: "post" });
322
+ let kt = (e) => [j("table.select").value, ...e.map((e) => e.content)].join(" "), At = h(() => k.selectable ? "fieldset" : "div"), jt = h(() => k.loading || Lt.value), K = h(() => !u(k.page) && !u(k.perPage) && !u(k.totalItems)), Mt = h(() => ({
323
+ "bb-table": !0,
324
+ [`bb-table--align-${k.align}`]: !0,
325
+ "bb-table--compact": k.compact,
326
+ "bb-table--fixed": L.value,
327
+ "bb-table--inherit-widths": $e.value,
328
+ "bb-table--fixed-header": k.fixedHeaders,
329
+ "bb-table--loading": jt.value,
330
+ "bb-table--empty": !q.value.length,
331
+ "bb-table--selectable": !!k.selectable,
332
+ "scrollbar-border": !0
333
+ })), Nt = h(() => k.columns.length + Number(!!k.selectable) + Number(!!k.actions)), Pt = h(() => Object.fromEntries(k.columns.map((e) => [e.key, p(e.key)]))), { getter: Ft, items: It, loading: Lt } = o({ items: ge(k, "items") }), { hasPrefilled: Rt } = ee({
334
+ trigger: !0,
335
+ fn: async (e) => {
336
+ await Ft(e, k.modelValue);
337
+ }
338
+ }), { data: zt } = s({ items: ge(k, "modelValue") }), { options: q } = l({
339
+ disabled: ge(k, "disabled"),
340
+ items: It,
341
+ itemText: void 0,
342
+ itemValue: k.itemValue,
343
+ max: k.max,
344
+ selectable: !0,
345
+ selectedIndexedByHash: zt
346
+ }), Bt = async (e) => {
347
+ k.multiple ? A("update:modelValue", k.modelValue.concat(e.value)) : A("update:modelValue", e.value);
348
+ }, Vt = async (e) => {
349
+ if (k.multiple) {
350
+ let t = { ...zt.value };
351
+ delete t[e.valueHash], A("update:modelValue", Object.values(t));
352
+ } else A("update:modelValue", null);
353
+ };
354
+ d(() => [k.dependencies, k.items], async () => {
355
+ Rt.value && await Ft(!1, k.modelValue);
356
+ }, { debounce: k.depsDebounceTime });
357
+ let Ht = (e, t) => {
358
+ let n = Pt.value[e.key], r = e.align ?? "left", i = qe(t.item, e.key);
359
+ return e.formatter && (!u(i) || e.formatOnNull !== !1) && (i = e.formatter(i, e.key, t.item)), e.placeholder && u(i) && (i = e.placeholder), {
360
+ align: r,
361
+ classes: ie([`bb-table-data__cell--${r}`], k.tdClass, e.tdClass, i, e.key, t.item),
362
+ content: i,
363
+ key: e.key,
364
+ label: e.label,
365
+ slotName: n
366
+ };
367
+ }, Ut = h(() => k.columns.map((e) => {
368
+ let t = e.align ?? "left", n = `header:${Pt.value[e.key]}`, r = e.sorted ? e.sorted === "asc" ? "ascending" : "descending" : void 0;
369
+ return {
370
+ align: t,
371
+ key: e.key,
372
+ label: e.label,
373
+ slotName: n,
374
+ classes: ae([`bb-table-header--${t}`], k.thClass, e.thClass),
375
+ sortDirection: r
376
+ };
377
+ })), Wt = h(() => {
378
+ let e = 0;
379
+ return q.value.map((t, n) => {
380
+ let r = !k.selectable || typeof k.selectable == "function" && !k.selectable(t.item) || !!t.disabled, i = (k.page ?? -1) * (k.perPage ?? 0), a = n + 1, o = i + 1 + a + e, s = k.columns.map((e) => Ht(e, t)), c = X.value[t.valueHash] ?? !1;
381
+ return c && e++, {
382
+ accessibleLabel: kt(s),
383
+ cols: s,
384
+ expanded: c,
385
+ onRowClick: (e) => A("click:row", e, t, !!t.selected),
386
+ onRowContextMenu: (e) => A("contextmenu:row", e, t, !!t.selected),
387
+ onRowDblClick: (e) => A("dblclick:row", e, t, !!t.selected),
388
+ item: t.item,
389
+ text: t.text,
390
+ rowIndex: o,
391
+ valueHash: t.valueHash,
392
+ value: t.value,
393
+ selected: t.selected,
394
+ disabled: r
395
+ };
396
+ });
397
+ }), J = _e(y, "selectAll"), Y = _e(y, "expandedItems"), { data: X } = s({ items: Y }), Gt = (e, t) => {
398
+ e.target instanceof HTMLElement && (e.target instanceof HTMLButtonElement || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), Z(t)));
399
+ }, Kt = (e) => ({
400
+ "aria-controls": u(X.value[e.valueHash]) ? void 0 : `expanded_${e.valueHash}`,
401
+ "aria-expanded": e.expanded ? "true" : "false",
402
+ onClick: (t) => {
403
+ t.stopPropagation(), Z(e.valueHash);
404
+ },
405
+ onKeydown: (t) => Gt(t, e.valueHash)
406
+ }), Z = (e) => {
407
+ let t = q.value.find((t) => t.valueHash === e);
408
+ t && (e in X.value ? Y.value = Y.value.filter((t) => i(t) !== e) : Y.value = [...Y.value, t.value]);
409
+ };
410
+ O(J, () => {
411
+ Q.clear(), A("update:unselectedItems", []), A("update:modelValue", []);
412
+ });
413
+ let qt = h(() => !!(k.multiple && k.modelValue.length > 0 && !k.selectAll || J.value && Q.size > 0)), Q = me(/* @__PURE__ */ new Set());
414
+ O(() => k.unselectedItems, () => {
415
+ Q.clear(), k.unselectedItems.forEach((e) => {
416
+ Q.add(i(e));
417
+ });
418
+ });
419
+ let Jt = (e) => {
420
+ if (Yt(e)) {
421
+ Vt(e), A("item:unselected", e.value), Q.add(e.valueHash), A("update:unselectedItems", [...k.unselectedItems, e.value]);
422
+ return;
423
+ }
424
+ J.value || Bt(e), A("item:selected", e.value), Q.delete(e.valueHash), A("update:unselectedItems", k.unselectedItems.filter((t) => i(t) !== i(e.value)));
425
+ }, Yt = (e) => Q.has(e.valueHash) ? !1 : e.selected || J.value, Xt = te((e) => typeof e != "string", JSON.stringify), Zt = h(() => [].concat(k.modelValue ?? []).map((e) => ({
426
+ disabled: k.disabled,
427
+ name: k.name,
428
+ type: "hidden",
429
+ value: Xt(e)
430
+ }))), $ = [
431
+ 70,
432
+ 45,
433
+ 85,
434
+ 55
435
+ ], Qt = h(() => e(q.value.length || k.columns.length || 1, 4, 10));
436
+ return O(() => [Wt.value, k.fixedColumns], () => {
437
+ M.value && k.fixedColumns?.length && re(M.value, k.fixedColumns);
438
+ }, { flush: "post" }), (e, t) => (S(), oe(he(At.value), {
439
+ ref_key: "containerRef",
440
+ ref: N,
441
+ "aria-busy": jt.value,
442
+ "aria-rowcount": K.value ? k.totalItems : void 0,
443
+ class: b(Mt.value),
444
+ "data-bb-table-id": D(Ye),
445
+ inert: e.disabled,
446
+ style: x(gt.value)
447
+ }, {
448
+ default: ve(() => [
449
+ e.selectable ? (S(), _("legend", ye, E(e.legend), 1)) : g("", !0),
450
+ v("table", {
451
+ ref_key: "tableRef",
452
+ ref: M
453
+ }, [
454
+ e.caption ? (S(), _("caption", {
455
+ key: 0,
456
+ class: b({
457
+ "bb-table-caption": !0,
458
+ "sr-only": !e.displayCaption
459
+ })
460
+ }, E(e.caption), 3)) : g("", !0),
461
+ v("colgroup", null, [(S(!0), _(m, null, w(mt.value, (e) => (S(), _("col", {
462
+ key: e.key,
463
+ style: x({ width: e.width })
464
+ }, null, 4))), 128))]),
465
+ v("thead", null, [T(e.$slots, "thead", {}, () => [v("tr", {
466
+ "aria-rowindex": K.value ? 1 : void 0,
467
+ class: "bb-table-header-row"
468
+ }, [
469
+ e.selectable ? (S(), _("th", {
470
+ key: 0,
471
+ class: b(["bb-table-header bb-table-header--select", e.thClass]),
472
+ scope: "col"
473
+ }, [T(e.$slots, "header:select", {
474
+ multiple: e.multiple,
475
+ selectAll: !!J.value,
476
+ text: e.selectText || D(j)("table.selectText").value
477
+ }, () => [v("span", xe, [e.allowSelectAll && e.multiple ? (S(), _("label", {
478
+ key: 0,
479
+ class: b(["bb-table-check__label", { "bb-table-check__label--disabled": e.disabled }])
480
+ }, [(S(), oe(a, {
481
+ key: qt.value.toString(),
482
+ modelValue: J.value,
483
+ "onUpdate:modelValue": t[0] ||= (e) => J.value = e,
484
+ class: "bb-table-check",
485
+ disabled: e.disabled,
486
+ indeterminate: qt.value,
487
+ name: `select_all_${e.name || ""}`,
488
+ readonly: e.readonly
489
+ }, null, 8, [
490
+ "modelValue",
491
+ "disabled",
492
+ "indeterminate",
493
+ "name",
494
+ "readonly"
495
+ ])), v("span", Se, E(e.selectAllLabel || D(j)("table.selectAllLabel").value), 1)], 2)) : e.multiple ? g("", !0) : (S(), _("span", Ce, E(e.selectText || D(j)("table.selectText").value), 1))])])], 2)) : g("", !0),
496
+ (S(!0), _(m, null, w(Ut.value, (t, n) => (S(), _("th", {
497
+ key: t.key,
498
+ "aria-sort": t.sortDirection,
499
+ class: b(["bb-table-header", [t.classes, {
500
+ "bb-table-header--edge-start": n === 0,
501
+ "bb-table-header--edge-end": n === Ut.value.length - 1
502
+ }]]),
503
+ scope: "col"
504
+ }, [T(e.$slots, t.slotName, {
505
+ classes: t.classes,
506
+ items: D(It),
507
+ label: t.label
508
+ }, () => [v("span", Te, E(t.label), 1)])], 10, we))), 128)),
509
+ e.actions ? (S(), _("th", {
510
+ key: 1,
511
+ class: b(["bb-table-header bb-table-header--actions", e.thClass]),
512
+ scope: "col"
513
+ }, [T(e.$slots, "header:actions", { text: e.actionsText }, () => [v("span", Ee, E(e.actionsText), 1)])], 2)) : g("", !0)
514
+ ], 8, be)])]),
515
+ v("tbody", null, [jt.value ? T(e.$slots, "loading", {
516
+ key: 0,
517
+ items: D(It)
518
+ }, () => [(S(!0), _(m, null, w(Qt.value, (n, r) => (S(), _("tr", {
519
+ key: r,
520
+ "aria-rowindex": K.value ? r + 2 : void 0,
521
+ class: "bb-table-skeleton__row"
522
+ }, [
523
+ e.selectable ? (S(), _("td", Oe, t[1] ||= [v("div", { class: "bb-table-skeleton__placeholder" }, null, -1)])) : g("", !0),
524
+ (S(!0), _(m, null, w(k.columns, (e, n) => (S(), _("td", {
525
+ key: e.key,
526
+ class: b(["bb-table-skeleton__cell", `bb-table-skeleton__cell--${e.skeleton ?? "text"}`])
527
+ }, [!e.skeleton || e.skeleton === "text" ? (S(), _("div", ke, [v("div", {
528
+ class: "bb-table-skeleton__line",
529
+ style: x({ width: `${$[(r + n) % 4]}%` })
530
+ }, null, 4), v("div", {
531
+ class: "bb-table-skeleton__line",
532
+ style: x({ width: `${$[(r + n + 2) % 4]}%` })
533
+ }, null, 4)])) : e.skeleton === "avatar" ? (S(), _("div", Ae)) : e.skeleton === "avatar-text" ? (S(), _("div", je, [t[2] ||= v("div", { class: "bb-table-skeleton__avatar" }, null, -1), v("div", Me, [v("div", {
534
+ class: "bb-table-skeleton__line",
535
+ style: x({ width: `${$[(r + n) % 4]}%` })
536
+ }, null, 4), v("div", {
537
+ class: "bb-table-skeleton__line",
538
+ style: x({ width: `${$[(r + n + 2) % 4]}%` })
539
+ }, null, 4)])])) : e.skeleton === "image" ? (S(), _("div", Ne)) : e.skeleton === "badge" ? (S(), _("div", Pe)) : g("", !0)], 2))), 128)),
540
+ e.actions ? (S(), _("td", Fe, t[3] ||= [v("div", { class: "bb-table-skeleton__placeholder" }, null, -1)])) : g("", !0)
541
+ ], 8, De))), 128)), v("tr", {
542
+ "aria-rowindex": K.value ? Qt.value + 2 : void 0,
543
+ class: "bb-table-loading__row bb-table-loading__row--sr-only"
544
+ }, [v("td", {
545
+ colspan: Nt.value,
546
+ class: "bb-table-loading__cell",
547
+ "aria-live": "polite",
548
+ role: "status"
549
+ }, [v("span", Re, E(e.loadingText), 1)], 8, Le)], 8, Ie)]) : D(q).length ? T(e.$slots, "tbody", { key: 2 }, () => [(S(!0), _(m, null, w(Wt.value, (t) => (S(), _(m, { key: t.valueHash }, [v("tr", {
550
+ "aria-rowindex": K.value && t.rowIndex ? t.rowIndex : void 0,
551
+ class: "bb-table-data__row",
552
+ onClick: t.onRowClick,
553
+ onContextmenu: t.onRowContextMenu,
554
+ onDblclick: t.onRowDblClick
555
+ }, [
556
+ e.selectable ? (S(), _("td", {
557
+ key: 0,
558
+ class: b(["bb-table-data__cell bb-table-data__cell--select", e.tdClass])
559
+ }, [T(e.$slots, "select", {
560
+ checked: Yt(t),
561
+ disabled: !!t.disabled,
562
+ inputName: D(Je),
563
+ item: t.item,
564
+ readonly: !!e.readonly,
565
+ value: t.value
566
+ }, () => [e.multiple ? (S(), _("label", {
567
+ key: 0,
568
+ class: b(["bb-table-check__label", { "bb-table-check__label--disabled": t.disabled }])
569
+ }, [ce(a, {
570
+ checked: Yt(t),
571
+ class: "bb-table-check",
572
+ disabled: t.disabled,
573
+ readonly: e.readonly,
574
+ onChange: () => Jt(t)
575
+ }, null, 8, [
576
+ "checked",
577
+ "disabled",
578
+ "readonly",
579
+ "onChange"
580
+ ]), v("span", Ue, E(t.accessibleLabel), 1)], 2)) : (S(), _("label", {
581
+ key: 1,
582
+ class: b(["bb-table-radio__label", { "bb-table-radio__label--disabled": t.disabled }])
583
+ }, [ce(f, {
584
+ checked: t.selected,
585
+ class: "bb-table-radio",
586
+ disabled: t.disabled,
587
+ name: D(Je),
588
+ readonly: e.readonly,
589
+ value: t.value,
590
+ onChange: () => Jt(t)
591
+ }, null, 8, [
592
+ "checked",
593
+ "disabled",
594
+ "name",
595
+ "readonly",
596
+ "value",
597
+ "onChange"
598
+ ]), v("span", We, E(t.accessibleLabel), 1)], 2))])], 2)) : g("", !0),
599
+ (S(!0), _(m, null, w(t.cols, (n, r) => (S(), _("td", {
600
+ key: n.key,
601
+ class: b(["bb-table-data__cell", [n.classes, {
602
+ "bb-table-data__cell--edge-start": r === 0,
603
+ "bb-table-data__cell--edge-end": r === t.cols.length - 1
604
+ }]])
605
+ }, [T(e.$slots, n.slotName, {
606
+ classes: n.classes,
607
+ content: n.content,
608
+ expanded: t.expanded,
609
+ item: t.item,
610
+ expandProps: Kt(t),
611
+ toggleExpanded: () => Z(t.valueHash),
612
+ value: t.value
613
+ }, () => [se(E(n.content), 1)])], 2))), 128)),
614
+ e.actions ? (S(), _("td", {
615
+ key: 1,
616
+ class: b(["bb-table__cell bb-table__cell--actions", e.tdClass])
617
+ }, [T(e.$slots, "actions", {
618
+ expanded: t.expanded,
619
+ item: t.item,
620
+ expandProps: Kt(t),
621
+ toggleExpanded: () => Z(t.valueHash),
622
+ value: t.value
623
+ })], 2)) : g("", !0)
624
+ ], 40, He), t.expanded ? (S(), _("tr", {
625
+ key: 0,
626
+ "aria-rowindex": K.value && t.rowIndex ? t.rowIndex + 1 : void 0,
627
+ id: `expanded_${t.valueHash}`,
628
+ class: "bb-table-expand__row"
629
+ }, [v("td", {
630
+ colspan: Nt.value,
631
+ class: "bb-table-expand__cell"
632
+ }, [T(e.$slots, "expand", {
633
+ expanded: t.expanded,
634
+ item: t.item,
635
+ expandProps: Kt(t),
636
+ toggleExpanded: () => Z(t.valueHash),
637
+ value: t.value
638
+ })], 8, Ke)], 8, Ge)) : g("", !0)], 64))), 128))]) : T(e.$slots, "no-data", { key: 1 }, () => [v("tr", {
639
+ "aria-rowindex": K.value ? 2 : void 0,
640
+ class: "bb-table-no-data__row"
641
+ }, [v("td", {
642
+ class: "bb-table-no-data__cell",
643
+ colspan: Nt.value
644
+ }, [v("span", Ve, E(e.noDataText || D(j)("table.noDataText").value), 1)], 8, Be)], 8, ze)])]),
645
+ v("tfoot", null, [T(e.$slots, "tfoot")])
646
+ ], 512),
647
+ (S(!0), _(m, null, w(Zt.value, (e) => (S(), _("input", ue({
648
+ key: e.value,
649
+ ref_for: !0
650
+ }, e), null, 16))), 128))
651
+ ]),
652
+ _: 3
653
+ }, 8, [
654
+ "aria-busy",
655
+ "aria-rowcount",
656
+ "class",
657
+ "data-bb-table-id",
658
+ "inert",
659
+ "style"
660
+ ]));
661
+ }
662
+ });
663
+ //#endregion
664
+ export { qe as default };