@kapiuara/ui 0.7.0 → 0.8.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.
@@ -3,22 +3,24 @@ import { useKapiLocale as e, useLabels as t } from "../locale/KapiLocaleProvider
3
3
  import { rafThrottle as n } from "../../hooks/rafThrottle.js";
4
4
  import { KapiSelect as r } from "../inputs/KapiSelect.js";
5
5
  import { joinClasses as i } from "../rootProps.js";
6
+ import { formatCount as a } from "../../hooks/numberFormatLogic.js";
6
7
  /* empty css */
7
- import { applyRangeSelection as a, buildCsv as o, clampColumnWidth as ee, computePagination as s, computeStickyOffsets as te, computeVisibleRange as ne, csvFileName as re, csvHeaderOf as ie, effectiveColumnWidth as ae, filterRows as oe, filterSearchColumns as c, lastStickyIndex as se, nextScrollWindow as ce, nextSortState as le, rangeBetween as ue, readCell as l, resizeColumn as de, rowSelectLabel as u, selectOnlyWithin as fe, selectionState as pe, sortRowsByColumn as me, toggleAllIds as he, toggleColumnVisibility as ge, toggleId as _e, visibleColumnsOf as ve } from "./tableLogic.js";
8
- import { KapiContextMenu as ye } from "../overlays/KapiContextMenu.js";
9
- import { KapiMenuButton as be } from "../overlays/KapiMenuButton.js";
10
- import { downloadBlob as xe } from "../../hooks/downloadLogic.js";
11
- import { useDragScroll as Se } from "../../hooks/useDragScroll.js";
12
- import { draftStickyLefts as Ce, endResizeDrag as we, moveResizeDrag as Te, needsDraftLeftPaint as Ee, startResizeDrag as De } from "./tableResizeLogic.js";
13
- import { KapiSkeleton as Oe } from "../feedback/KapiSkeleton.js";
14
- import { KapiBulkBar as ke } from "../feedback/KapiBulkBar.js";
15
- import { DEFAULT_TABLE_FILTER_LABELS as d, KapiTableFilter as Ae } from "./KapiTableFilter.js";
8
+ import { applyRangeSelection as o, buildCsv as ee, clampColumnWidth as s, computePagination as te, computeStickyOffsets as ne, computeVisibleRange as re, csvFileName as ie, csvHeaderOf as ae, effectiveColumnWidth as oe, filterRows as c, filterSearchColumns as se, lastStickyIndex as ce, nextScrollWindow as le, nextSortState as ue, rangeBetween as de, readCell as l, resizeColumn as u, rowSelectLabel as fe, selectOnlyWithin as pe, selectionState as me, sortRowsByColumn as he, toggleAllIds as ge, toggleColumnVisibility as _e, toggleId as ve, visibleColumnsOf as ye } from "./tableLogic.js";
9
+ import { KapiContextMenu as be } from "../overlays/KapiContextMenu.js";
10
+ import { KapiMenuButton as xe } from "../overlays/KapiMenuButton.js";
11
+ import { downloadBlob as Se } from "../../hooks/downloadLogic.js";
12
+ import { useDragScroll as Ce } from "../../hooks/useDragScroll.js";
13
+ import { draftStickyLefts as we, endResizeDrag as Te, moveResizeDrag as Ee, needsDraftLeftPaint as De, startResizeDrag as Oe } from "./tableResizeLogic.js";
14
+ import { datasetActionLabel as ke, datasetHintLabel as Ae, datasetNoticeState as je, datasetSelectedLabel as Me } from "./datasetSelectionLogic.js";
15
+ import { KapiSkeleton as Ne } from "../feedback/KapiSkeleton.js";
16
+ import { KapiBulkBar as Pe } from "../feedback/KapiBulkBar.js";
17
+ import { DEFAULT_TABLE_FILTER_LABELS as d, KapiTableFilter as Fe } from "./KapiTableFilter.js";
16
18
  /* empty css */
17
- import { Fragment as je, jsx as f, jsxs as p } from "react/jsx-runtime";
18
- import { memo as m, useCallback as Me, useEffect as h, useLayoutEffect as Ne, useMemo as g, useRef as _, useState as v } from "react";
19
- import { Check as Pe, ChevronDown as Fe, ChevronLeft as Ie, ChevronRight as Le, ChevronUp as y, ChevronsUpDown as Re, Columns3 as ze, Copy as Be, Download as Ve, Loader2 as He, MoreHorizontal as Ue } from "lucide-react";
19
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
20
+ import { memo as h, useCallback as Ie, useEffect as g, useLayoutEffect as Le, useMemo as _, useRef as v, useState as y } from "react";
21
+ import { Check as Re, ChevronDown as ze, ChevronLeft as Be, ChevronRight as Ve, ChevronUp as b, ChevronsUpDown as He, Columns3 as Ue, Copy as We, Download as Ge, Loader2 as Ke, MoreHorizontal as x } from "lucide-react";
20
22
  //#region src/components/data/KapiTable.tsx
21
- var We = {
23
+ var qe = {
22
24
  region: d.region,
23
25
  empty: "Sin resultados",
24
26
  loading: "Cargando…",
@@ -42,21 +44,22 @@ var We = {
42
44
  filterColumn: "Columna del filtro",
43
45
  filterAll: "Todas",
44
46
  of: "de",
45
- exportCsv: "Exportar CSV"
46
- }, Ge = "button, a, input, select, textarea, label, [role=button]", Ke = 600, qe = 5, Je = [
47
+ exportCsv: "Exportar CSV",
48
+ datasetClear: "Deshacer"
49
+ }, Je = "button, a, input, select, textarea, label, [role=button]", Ye = 600, Xe = 5, Ze = [
47
50
  96,
48
51
  72,
49
52
  84,
50
53
  60
51
- ], Ye = {
54
+ ], Qe = {
52
55
  text: "",
53
56
  column: null
54
- }, Xe = (e, t) => {
57
+ }, $e = (e, t) => {
55
58
  try {
56
59
  navigator.clipboard?.writeText(String(e))?.catch(() => void 0);
57
60
  } catch {}
58
61
  t?.(e);
59
- }, Ze = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), Qe = (e, t, n) => {
62
+ }, et = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), tt = (e, t, n) => {
60
63
  let r = n[e.key];
61
64
  return r === void 0 ? t === "th" ? {
62
65
  width: e.flex ? "100%" : e.width,
@@ -70,252 +73,257 @@ var We = {
70
73
  minWidth: r,
71
74
  maxWidth: r
72
75
  };
73
- }, $e = (e, t = !1) => `${e.sticky ? "is-sticky" : ""}${e.sticky && t ? " is-sticky-last" : ""}${e.flex ? " is-flex" : ""}${e.align ? ` is-align-${e.align}` : ""}`, et = (e, t, n, r) => {
76
+ }, nt = (e, t = !1) => `${e.sticky ? "is-sticky" : ""}${e.sticky && t ? " is-sticky-last" : ""}${e.flex ? " is-flex" : ""}${e.align ? ` is-align-${e.align}` : ""}`, rt = (e, t, n, r) => {
74
77
  let i = e.render ? e.render(t) : l(t, e.key);
75
78
  if (!e.copyable) return i;
76
79
  let a = e.copyValue ? e.copyValue(t) : l(t, e.key);
77
- return /* @__PURE__ */ p("span", {
80
+ return /* @__PURE__ */ m("span", {
78
81
  className: "kapi-cell",
79
- children: [/* @__PURE__ */ f("span", {
82
+ children: [/* @__PURE__ */ p("span", {
80
83
  className: "kapi-cell__v",
81
84
  children: i
82
- }), /* @__PURE__ */ f("button", {
85
+ }), /* @__PURE__ */ p("button", {
83
86
  type: "button",
84
87
  className: "kapi-cell__copy",
85
88
  "aria-label": n.copy,
86
89
  onClick: (e) => {
87
- e.stopPropagation(), Xe(a, r);
90
+ e.stopPropagation(), $e(a, r);
88
91
  },
89
- children: /* @__PURE__ */ f(Be, {
92
+ children: /* @__PURE__ */ p(We, {
90
93
  size: 13,
91
94
  strokeWidth: 2
92
95
  })
93
96
  })]
94
97
  });
95
- }, tt = (e) => e === "asc" ? /* @__PURE__ */ f(y, {
98
+ }, it = (e) => e === "asc" ? /* @__PURE__ */ p(b, {
96
99
  size: 13,
97
100
  strokeWidth: 2.4
98
- }) : e === "desc" ? /* @__PURE__ */ f(Fe, {
101
+ }) : e === "desc" ? /* @__PURE__ */ p(ze, {
99
102
  size: 13,
100
103
  strokeWidth: 2.4
101
- }) : /* @__PURE__ */ f(Re, {
104
+ }) : /* @__PURE__ */ p(He, {
102
105
  size: 13,
103
106
  strokeWidth: 2
104
107
  });
105
- function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", fill: Be = !1, bulkActionsPlacement: Ue = "bottom", className: Ge, style: Xe, id: et, labels: nt, actions: rt, rowMenu: b, contextMenu: at, onCopy: ot, selectable: x = !1, rowSelect: st = !1, rowLabel: ct, selectedIds: lt, onSelectedIdsChange: ut, bulkActions: dt, rangeSelect: ft = !0, selectionPresets: S, virtual: C = !1, rowHeight: w = 46, sort: pt, defaultSort: mt = null, onSortChange: ht, manualSort: gt = !1, pagination: T, loading: E = !1, loadingRows: _t = qe, card: vt = !1, emptyMessage: yt, loadingMessage: bt, isRowSelectable: D, renderSubComponent: xt, expandedIds: St, onExpandedIdsChange: Ct, density: wt = "default", rowHover: Tt = !1, columnToggle: Et = !1, columnVisibility: Dt, defaultColumnVisibility: Ot, onColumnVisibilityChange: kt, resizableColumns: At = !1, columnWidths: jt, defaultColumnWidths: Mt, onColumnWidthsChange: Nt, filterable: Pt = !1, filter: Ft, defaultFilter: It = Ye, onFilterChange: Lt, manualFilter: O = !1, filterDebounce: Rt = 300, exportCsv: k, toolbar: zt, mobileCards: Bt = !1 }) {
106
- let A = t("table", We, nt), Vt = yt === void 0 ? A.empty : yt, Ht = bt === void 0 ? A.loading : bt, Ut = e(), [Wt, Gt] = v(null), [j, Kt] = v(null), [qt, Jt] = v({
108
+ function at({ columns: d, rows: h, keyField: b = "id", maxHeight: He = "58vh", fill: We = !1, bulkActionsPlacement: x = "bottom", className: Je, style: $e, id: rt, labels: at, actions: ot, rowMenu: S, contextMenu: ct, onCopy: lt, selectable: C = !1, rowSelect: ut = !1, rowLabel: dt, selectedIds: ft, onSelectedIdsChange: pt, bulkActions: mt, rangeSelect: ht = !0, selectionPresets: w, virtual: T = !1, rowHeight: E = 46, sort: gt, defaultSort: _t = null, onSortChange: vt, manualSort: yt = !1, pagination: D, dataset: O, loading: k = !1, loadingRows: bt = Xe, card: xt = !1, emptyMessage: St, loadingMessage: Ct, isRowSelectable: A, renderSubComponent: wt, expandedIds: Tt, onExpandedIdsChange: Et, density: Dt = "default", rowHover: Ot = !1, columnToggle: kt = !1, columnVisibility: At, defaultColumnVisibility: jt, onColumnVisibilityChange: Mt, resizableColumns: Nt = !1, columnWidths: Pt, defaultColumnWidths: Ft, onColumnWidthsChange: It, filterable: Lt = !1, filter: Rt, defaultFilter: zt = Qe, onFilterChange: Bt, manualFilter: j = !1, filterDebounce: Vt = 300, exportCsv: M, toolbar: Ht, mobileCards: Ut = !1 }) {
109
+ let N = t("table", qe, at), Wt = St === void 0 ? N.empty : St, Gt = Ct === void 0 ? N.loading : Ct, Kt = e(), [qt, Jt] = y(null), [P, Yt] = y(null), [Xt, Zt] = y({
107
110
  scrollTop: 0,
108
- viewHeight: Ke
109
- }), M = Se({ onMenu: at ? (e, t) => Gt({
111
+ viewHeight: Ye
112
+ }), F = Ce({ onMenu: ct ? (e, t) => Jt({
110
113
  x: e,
111
114
  y: t
112
- }) : void 0 }), Yt = lt !== void 0, [Xt, Zt] = v(() => /* @__PURE__ */ new Set()), N = g(() => Yt ? new Set(lt) : Xt, [
113
- Yt,
114
- lt,
115
- Xt
116
- ]), P = (e) => {
117
- Yt || Zt(e), ut?.([...e]);
118
- }, Qt = () => P(/* @__PURE__ */ new Set()), $t = [...N], en = _(null), tn = pt !== void 0, [nn, rn] = v(mt), F = tn ? pt : nn, an = (e) => {
119
- let t = le(F, e);
120
- tn || rn(t), ht?.(t);
121
- }, I = !!xt && !C, on = St !== void 0, [sn, cn] = v(() => /* @__PURE__ */ new Set()), ln = g(() => on ? new Set(St) : sn, [
122
- on,
123
- St,
124
- sn
125
- ]), un = (e) => {
126
- let t = _e(ln, e);
127
- on || cn(t), Ct?.([...t]);
128
- }, dn = Dt !== void 0, [fn, pn] = v(Ot ?? {}), L = dn ? Dt : fn, [mn, hn] = v(!1), gn = (e) => {
129
- let t = ge(L, e);
130
- dn || pn(t), kt?.(t);
131
- }, _n = jt !== void 0, [vn, yn] = v(Mt ?? {}), R = _n ? jt : vn, bn = (e) => {
132
- _n || yn(e), Nt?.(e);
133
- }, z = _(null), xn = _(null), B = g(() => ve(d, L), [d, L]), Sn = Ft !== void 0, [Cn, wn] = v(It), V = Sn ? Ft : Cn, Tn = (e) => {
134
- Sn || wn(e), Lt?.(e);
135
- }, En = g(() => {
136
- if (O) return m;
137
- let e = c(B, V.column);
138
- return oe(m, (t) => e.map((e) => e.filterValue ? e.filterValue(t) : l(t, e.key)), V.text);
115
+ }) : void 0 }), Qt = ft !== void 0, [$t, en] = y(() => /* @__PURE__ */ new Set()), I = _(() => Qt ? new Set(ft) : $t, [
116
+ Qt,
117
+ ft,
118
+ $t
119
+ ]), L = (e) => {
120
+ Qt || en(e), pt?.([...e]);
121
+ }, tn = () => L(/* @__PURE__ */ new Set()), nn = [...I], rn = v(null), an = gt !== void 0, [on, sn] = y(_t), R = an ? gt : on, cn = (e) => {
122
+ let t = ue(R, e);
123
+ an || sn(t), vt?.(t);
124
+ }, z = !!wt && !T, ln = Tt !== void 0, [un, dn] = y(() => /* @__PURE__ */ new Set()), fn = _(() => ln ? new Set(Tt) : un, [
125
+ ln,
126
+ Tt,
127
+ un
128
+ ]), pn = (e) => {
129
+ let t = ve(fn, e);
130
+ ln || dn(t), Et?.([...t]);
131
+ }, mn = At !== void 0, [hn, gn] = y(jt ?? {}), B = mn ? At : hn, [_n, vn] = y(!1), yn = (e) => {
132
+ let t = _e(B, e);
133
+ mn || gn(t), Mt?.(t);
134
+ }, bn = Pt !== void 0, [xn, Sn] = y(Ft ?? {}), V = bn ? Pt : xn, Cn = (e) => {
135
+ bn || Sn(e), It?.(e);
136
+ }, H = v(null), wn = v(null), U = _(() => ye(d, B), [d, B]), Tn = Rt !== void 0, [En, Dn] = y(zt), W = Tn ? Rt : En, On = (e) => {
137
+ Tn || Dn(e), Bt?.(e);
138
+ }, kn = _(() => {
139
+ if (j) return h;
140
+ let e = se(U, W.column);
141
+ return c(h, (t) => e.map((e) => e.filterValue ? e.filterValue(t) : l(t, e.key)), W.text);
139
142
  }, [
140
- m,
141
- B,
142
- V,
143
- O
144
- ]), H = g(() => gt ? En : me(En, d, F, Ut), [
145
- En,
143
+ h,
144
+ U,
145
+ W,
146
+ j
147
+ ]), G = _(() => yt ? kn : he(kn, d, R, Kt), [
148
+ kn,
146
149
  d,
147
- F,
148
- gt,
149
- Ut
150
- ]), U = x && S !== void 0 && S.length > 0, Dn = U ? 80 : 46, W = g(() => te(B.map((e) => ({
151
- sticky: e.sticky,
152
- width: ae(e, R)
153
- })), (x ? Dn : 0) + (I ? 44 : 0)), [
154
- B,
155
150
  R,
156
- x,
157
- Dn,
158
- I
159
- ]), On = g(() => se(B), [B]), kn = d.filter((e) => e.hideable !== !1), G = !!(rt || b), K = B.length + +!!x + +!!G + +!!I, q = g(() => H.filter((e) => !D || D(e)), [H, D]), J = g(() => q.map((e) => e[y]), [q, y]), An = g(() => U && S ? S.map((e) => ({
151
+ yt,
152
+ Kt
153
+ ]), K = C && w !== void 0 && w.length > 0, An = K ? 80 : 46, q = _(() => ne(U.map((e) => ({
154
+ sticky: e.sticky,
155
+ width: oe(e, V)
156
+ })), (C ? An : 0) + (z ? 44 : 0)), [
157
+ U,
158
+ V,
159
+ C,
160
+ An,
161
+ z
162
+ ]), jn = _(() => ce(U), [U]), Mn = d.filter((e) => e.hideable !== !1), J = !!(ot || S), Y = U.length + +!!C + +!!J + +!!z, Nn = _(() => G.filter((e) => !A || A(e)), [G, A]), X = _(() => Nn.map((e) => e[b]), [Nn, b]), Pn = _(() => K && w ? w.map((e) => ({
160
163
  preset: e,
161
- matching: q.filter(e.match).map((e) => e[y])
164
+ matching: Nn.filter(e.match).map((e) => e[b])
162
165
  })) : [], [
163
- U,
164
- S,
165
- q,
166
- y
166
+ K,
167
+ w,
168
+ Nn,
169
+ b
167
170
  ]).map(({ preset: e, matching: t }) => ({
168
- label: e.label,
171
+ label: `${e.label} (${a(t.length, Kt)})`,
169
172
  ...e.icon !== void 0 && { icon: e.icon },
170
173
  disabled: t.length === 0,
171
- onClick: () => P(fe(N, J, t))
172
- })), jn = pe(J, N), Mn = (e, t) => {
173
- let n = !N.has(e), r = en.current;
174
- if (ft && t && r !== null && r !== e) {
175
- let t = ue(J, r, e);
174
+ onClick: () => L(pe(I, X, t))
175
+ })), Fn = me(X, I), In = O !== void 0 && C ? je({
176
+ headerState: Fn,
177
+ shown: X.length,
178
+ total: O.total,
179
+ selected: O.selected === !0
180
+ }) : "none", Ln = (e, t) => {
181
+ let n = !I.has(e), r = rn.current;
182
+ if (ht && t && r !== null && r !== e) {
183
+ let t = de(X, r, e);
176
184
  if (t.length > 0) {
177
- P(a(N, t, n));
185
+ L(o(I, t, n));
178
186
  return;
179
187
  }
180
188
  }
181
- en.current = e, P(_e(N, e));
182
- }, { start: Nn, end: Pn, padTop: Fn, padBottom: In } = C ? ne({
183
- total: H.length,
184
- rowHeight: w,
185
- ...qt
189
+ rn.current = e, L(ve(I, e));
190
+ }, { start: Rn, end: zn, padTop: Bn, padBottom: Vn } = T ? re({
191
+ total: G.length,
192
+ rowHeight: E,
193
+ ...Xt
186
194
  }) : {
187
195
  start: 0,
188
- end: H.length,
196
+ end: G.length,
189
197
  padTop: 0,
190
198
  padBottom: 0
191
- }, Ln = H.slice(Nn, Pn), Rn = T ? Math.max(0, T.page - 1) * T.pageSize : 0, zn = _({
192
- total: H.length,
193
- rowHeight: w
199
+ }, Hn = G.slice(Rn, zn), Un = D ? Math.max(0, D.page - 1) * D.pageSize : 0, Wn = v({
200
+ total: G.length,
201
+ rowHeight: E
194
202
  });
195
- zn.current = {
196
- total: H.length,
197
- rowHeight: w
203
+ Wn.current = {
204
+ total: G.length,
205
+ rowHeight: E
198
206
  };
199
- let Bn = Me((e) => {
207
+ let Gn = Ie((e) => {
200
208
  let t = {
201
209
  scrollTop: e.scrollTop,
202
- viewHeight: e.clientHeight || Ke
210
+ viewHeight: e.clientHeight || Ye
203
211
  };
204
- Jt((e) => ce(e, t, zn.current));
205
- }, []), Y = Me(() => {
206
- let e = M.current;
207
- e && Bn(e);
208
- }, [M, Bn]);
209
- Ne(() => {
210
- C && Y();
212
+ Zt((e) => le(e, t, Wn.current));
213
+ }, []), Kn = Ie(() => {
214
+ let e = F.current;
215
+ e && Gn(e);
216
+ }, [F, Gn]);
217
+ Le(() => {
218
+ T && Kn();
211
219
  }, [
212
- C,
213
- Re,
214
- w,
215
- Y
216
- ]), h(() => {
217
- let e = M.current;
218
- if (!C || !e || typeof ResizeObserver > "u") return;
219
- let t = new ResizeObserver(Y);
220
+ T,
221
+ He,
222
+ E,
223
+ Kn
224
+ ]), g(() => {
225
+ let e = F.current;
226
+ if (!T || !e || typeof ResizeObserver > "u") return;
227
+ let t = new ResizeObserver(Kn);
220
228
  return t.observe(e), () => t.disconnect();
221
229
  }, [
222
- C,
223
- M,
224
- Y
230
+ T,
231
+ F,
232
+ Kn
225
233
  ]);
226
- let Vn = (e) => {
227
- C && Bn(e.currentTarget);
228
- }, Hn = _(!0);
229
- h(() => {
230
- if (Hn.current) {
231
- Hn.current = !1;
234
+ let qn = (e) => {
235
+ T && Gn(e.currentTarget);
236
+ }, Jn = v(!0);
237
+ g(() => {
238
+ if (Jn.current) {
239
+ Jn.current = !1;
232
240
  return;
233
241
  }
234
- let e = M.current;
242
+ let e = F.current;
235
243
  e && e.scrollTop > 0 && (e.scrollTop = 0);
236
244
  }, [
237
- V.text,
238
- V.column,
239
- M
245
+ W.text,
246
+ W.column,
247
+ F
240
248
  ]);
241
- let Un = typeof k == "object" ? k : {}, Wn = () => {
242
- let e = B.map(ie), t = Un.rows, n = (t === void 0 ? H : typeof t == "function" ? t() : t).map((e) => B.map((t) => t.csvValue ? t.csvValue(e) : t.copyValue ? t.copyValue(e) : l(e, t.key)));
243
- xe(new Blob([`\uFEFF${o(e, n, Un.separator)}`], { type: "text/csv;charset=utf-8" }), re(Un.fileName));
244
- }, Gn = Bt && !C, Kn = (e, t) => {
245
- if (!b) return;
249
+ let Yn = typeof M == "object" ? M : {}, Xn = () => {
250
+ let e = U.map(ae), t = Yn.rows, n = (t === void 0 ? G : typeof t == "function" ? t() : t).map((e) => U.map((t) => t.csvValue ? t.csvValue(e) : t.copyValue ? t.copyValue(e) : l(e, t.key)));
251
+ Se(new Blob([`\uFEFF${ee(e, n, Yn.separator)}`], { type: "text/csv;charset=utf-8" }), ie(Yn.fileName));
252
+ }, Zn = Ut && !T, Qn = (e, t) => {
253
+ if (!S) return;
246
254
  let n = e.currentTarget.getBoundingClientRect();
247
- Kt({
255
+ Yt({
248
256
  x: n.right,
249
257
  y: n.bottom + 4,
250
- items: b(t)
258
+ items: S(t)
251
259
  });
252
- }, X = _({
253
- activateRow: Mn,
254
- toggleExpanded: un,
255
- openRowMenu: Kn
260
+ }, $n = v({
261
+ activateRow: Ln,
262
+ toggleExpanded: pn,
263
+ openRowMenu: Qn
256
264
  });
257
- X.current = {
258
- activateRow: Mn,
259
- toggleExpanded: un,
260
- openRowMenu: Kn
265
+ $n.current = {
266
+ activateRow: Ln,
267
+ toggleExpanded: pn,
268
+ openRowMenu: Qn
261
269
  };
262
- let qn = g(() => ({
263
- activate: (e, t) => X.current.activateRow(e, t),
264
- toggleExpanded: (e) => X.current.toggleExpanded(e),
265
- openMenu: (e, t) => X.current.openRowMenu(e, t)
266
- }), []), Jn = (e) => {
270
+ let er = _(() => ({
271
+ activate: (e, t) => $n.current.activateRow(e, t),
272
+ toggleExpanded: (e) => $n.current.toggleExpanded(e),
273
+ openMenu: (e, t) => $n.current.openRowMenu(e, t)
274
+ }), []), tr = (e) => {
267
275
  if (!e.sortable) return e.label;
268
- let t = F?.key === e.key ? F.direction : "none";
269
- return /* @__PURE__ */ p("button", {
276
+ let t = R?.key === e.key ? R.direction : "none";
277
+ return /* @__PURE__ */ m("button", {
270
278
  type: "button",
271
279
  className: `kapi-thsort${t === "none" ? "" : " is-active"}`,
272
- onClick: () => an(e.key),
273
- title: typeof e.label == "string" ? `${A.sortBy} ${e.label}` : void 0,
274
- children: [/* @__PURE__ */ f("span", { children: e.label }), tt(t)]
280
+ onClick: () => cn(e.key),
281
+ title: typeof e.label == "string" ? `${N.sortBy} ${e.label}` : void 0,
282
+ children: [/* @__PURE__ */ p("span", { children: e.label }), it(t)]
275
283
  });
276
- }, Yn = (e) => {
277
- if (e.sortable) return F?.key === e.key ? F.direction === "asc" ? "ascending" : "descending" : "none";
278
- }, Xn = (e) => e.resizable ?? At, Z = (e) => e.minWidth ?? 60, [Zn, Qn] = v({}), $n = (e) => ee(R[e.key] ?? e.width ?? Zn[e.key] ?? Z(e), Z(e)), er = Me(() => {
279
- let e = xn.current;
284
+ }, nr = (e) => {
285
+ if (e.sortable) return R?.key === e.key ? R.direction === "asc" ? "ascending" : "descending" : "none";
286
+ }, rr = (e) => e.resizable ?? Nt, Z = (e) => e.minWidth ?? 60, [ir, ar] = y({}), or = (e) => s(V[e.key] ?? e.width ?? ir[e.key] ?? Z(e), Z(e)), sr = Ie(() => {
287
+ let e = wn.current;
280
288
  if (!e) return;
281
289
  let t = {};
282
290
  for (let n of e.querySelectorAll(":scope > thead .kapi-colresize[data-col]")) {
283
291
  let e = n.dataset.col, r = n.parentElement?.getBoundingClientRect().width;
284
292
  e && r && (t[e] = Math.round(r));
285
293
  }
286
- Qn((e) => {
294
+ ar((e) => {
287
295
  let n = Object.keys(t);
288
296
  return n.length === Object.keys(e).length && n.every((n) => e[n] === t[n]) ? e : t;
289
297
  });
290
298
  }, []);
291
- Ne(er, [
292
- er,
293
- B,
294
- R
299
+ Le(sr, [
300
+ sr,
301
+ U,
302
+ V
295
303
  ]);
296
- let tr = _({
297
- visibleColumns: B,
298
- widths: R,
299
- lefts: W,
304
+ let cr = v({
305
+ visibleColumns: U,
306
+ widths: V,
307
+ lefts: q,
300
308
  offset: 0
301
309
  });
302
- tr.current = {
303
- visibleColumns: B,
304
- widths: R,
305
- lefts: W,
306
- offset: (x ? Dn : 0) + (I ? 44 : 0)
310
+ cr.current = {
311
+ visibleColumns: U,
312
+ widths: V,
313
+ lefts: q,
314
+ offset: (C ? An : 0) + (z ? 44 : 0)
307
315
  };
308
- let Q = _(/* @__PURE__ */ new Map()), nr = _(/* @__PURE__ */ new Map()), [rr] = v(() => n((e) => {
309
- let t = xn.current;
316
+ let lr = v(/* @__PURE__ */ new Map()), ur = v(/* @__PURE__ */ new Map()), [Q] = y(() => n((e) => {
317
+ let t = wn.current;
310
318
  if (!t) return;
311
- let n = tr.current, r = Ce(n.visibleColumns, n.widths, e.key, e.width, n.offset);
319
+ let n = cr.current, r = we(n.visibleColumns, n.widths, e.key, e.width, n.offset);
312
320
  n.visibleColumns.forEach((i, a) => {
313
- let o = i.key === e.key, ee = nr.current.get(i.key);
314
- if (!o && !Ee(r[a], n.lefts[a], ee)) return;
315
- nr.current.set(i.key, r[a]);
316
- let s = `[data-col="${Ze(i.key)}"]`;
321
+ let o = i.key === e.key, ee = ur.current.get(i.key);
322
+ if (!o && !De(r[a], n.lefts[a], ee)) return;
323
+ ur.current.set(i.key, r[a]);
324
+ let s = `[data-col="${et(i.key)}"]`;
317
325
  t.querySelectorAll(`:scope > thead > tr > ${s}, :scope > tbody > tr > ${s}`).forEach((t) => {
318
- if (Q.current.has(t) || Q.current.set(t, t.style.cssText), o) {
326
+ if (lr.current.has(t) || lr.current.set(t, t.style.cssText), o) {
319
327
  let n = `${e.width}px`;
320
328
  t.style.width = n, t.style.minWidth = n, t.style.maxWidth = n;
321
329
  }
@@ -323,106 +331,106 @@ function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", f
323
331
  n !== void 0 && (t.style.left = `${n}px`);
324
332
  });
325
333
  });
326
- })), ir = () => {
327
- rr.cancel(), Q.current.forEach((e, t) => {
334
+ })), dr = () => {
335
+ Q.cancel(), lr.current.forEach((e, t) => {
328
336
  t.style.cssText = e;
329
- }), Q.current.clear(), nr.current.clear();
337
+ }), lr.current.clear(), ur.current.clear();
330
338
  };
331
- h(() => () => rr.cancel(), [rr]);
332
- let ar = (e, t) => {
339
+ g(() => () => Q.cancel(), [Q]);
340
+ let fr = (e, t) => {
333
341
  if (e.button !== 0) return;
334
342
  e.preventDefault(), e.stopPropagation();
335
343
  let n = e.currentTarget.parentElement, r = n ? n.getBoundingClientRect().width : t.width ?? 120;
336
- z.current = De(t.key, e.clientX, r, Z(t)), e.currentTarget.setPointerCapture(e.pointerId);
337
- }, or = (e) => {
338
- let t = z.current;
344
+ H.current = Oe(t.key, e.clientX, r, Z(t)), e.currentTarget.setPointerCapture(e.pointerId);
345
+ }, pr = (e) => {
346
+ let t = H.current;
339
347
  if (!t) return;
340
- let n = Te(t, e.clientX);
341
- n && (z.current = n, rr(n));
342
- }, sr = (e) => {
343
- let t = z.current;
344
- if (z.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !t) return;
345
- ir();
346
- let n = e.type === "pointercancel" ? t : Te(t, e.clientX) ?? t, r = we(n, R, e.type === "pointercancel" ? "cancel" : "commit");
347
- r && bn(r);
348
- }, cr = (e, t) => {
348
+ let n = Ee(t, e.clientX);
349
+ n && (H.current = n, Q(n));
350
+ }, mr = (e) => {
351
+ let t = H.current;
352
+ if (H.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !t) return;
353
+ dr();
354
+ let n = e.type === "pointercancel" ? t : Ee(t, e.clientX) ?? t, r = Te(n, V, e.type === "pointercancel" ? "cancel" : "commit");
355
+ r && Cn(r);
356
+ }, hr = (e, t) => {
349
357
  if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
350
358
  e.preventDefault();
351
- let n = e.currentTarget.parentElement, r = R[t.key] ?? (n ? n.getBoundingClientRect().width : t.width ?? 120), i = e.key === "ArrowRight" ? 16 : -16;
352
- bn(de(R, t.key, r, i, Z(t)));
353
- }, lr = (e) => {
354
- if (!Xn(e)) return null;
359
+ let n = e.currentTarget.parentElement, r = V[t.key] ?? (n ? n.getBoundingClientRect().width : t.width ?? 120), i = e.key === "ArrowRight" ? 16 : -16;
360
+ Cn(u(V, t.key, r, i, Z(t)));
361
+ }, gr = (e) => {
362
+ if (!rr(e)) return null;
355
363
  let t = typeof e.label == "string" ? ` ${e.label}` : "";
356
- return /* @__PURE__ */ f("div", {
364
+ return /* @__PURE__ */ p("div", {
357
365
  role: "separator",
358
366
  "aria-orientation": "vertical",
359
- "aria-label": `${A.resizeColumn}${t}`,
367
+ "aria-label": `${N.resizeColumn}${t}`,
360
368
  "aria-valuemin": Z(e),
361
- "aria-valuenow": $n(e),
369
+ "aria-valuenow": or(e),
362
370
  tabIndex: 0,
363
371
  className: "kapi-colresize",
364
372
  "data-col": e.key,
365
- onFocus: er,
366
- onPointerDown: (t) => ar(t, e),
367
- onPointerMove: or,
368
- onPointerUp: sr,
369
- onPointerCancel: sr,
373
+ onFocus: sr,
374
+ onPointerDown: (t) => fr(t, e),
375
+ onPointerMove: pr,
376
+ onPointerUp: mr,
377
+ onPointerCancel: mr,
370
378
  onClick: (e) => e.stopPropagation(),
371
- onKeyDown: (t) => cr(t, e)
379
+ onKeyDown: (t) => hr(t, e)
372
380
  });
373
- }, $ = T ? s(T) : null, ur = T && $ && $.page !== T.page ? $.page : null, dr = _(T?.onPageChange);
374
- dr.current = T?.onPageChange, h(() => {
375
- ur !== null && dr.current?.(ur);
376
- }, [ur]);
377
- let fr = (e, t = !1) => /* @__PURE__ */ f("tr", {
381
+ }, $ = D ? te(D) : null, _r = D && $ && $.page !== D.page ? $.page : null, vr = v(D?.onPageChange);
382
+ vr.current = D?.onPageChange, g(() => {
383
+ _r !== null && vr.current?.(_r);
384
+ }, [_r]);
385
+ let yr = (e, t = !1) => /* @__PURE__ */ p("tr", {
378
386
  className: "kapi-table-staterow",
379
- children: /* @__PURE__ */ p("td", {
380
- colSpan: K,
387
+ children: /* @__PURE__ */ m("td", {
388
+ colSpan: Y,
381
389
  className: "kapi-table-state",
382
- children: [t && /* @__PURE__ */ f(He, {
390
+ children: [t && /* @__PURE__ */ p(Ke, {
383
391
  size: 16,
384
392
  strokeWidth: 2.2,
385
393
  className: "kapi-table-spin",
386
394
  "aria-hidden": !0
387
- }), /* @__PURE__ */ f("span", { children: e })]
395
+ }), /* @__PURE__ */ p("span", { children: e })]
388
396
  })
389
- }), pr = (e, t, n) => {
397
+ }), br = (e, t, n) => {
390
398
  let r = e.flex ? `${[
391
399
  70,
392
400
  55,
393
401
  80
394
- ][n % 3]}%` : Math.max(32, Math.min(Je[(t + n) % Je.length] ?? 72, (e.width ?? 120) - 36));
395
- return /* @__PURE__ */ f(Oe, {
402
+ ][n % 3]}%` : Math.max(32, Math.min(Ze[(t + n) % Ze.length] ?? 72, (e.width ?? 120) - 36));
403
+ return /* @__PURE__ */ p(Ne, {
396
404
  width: r,
397
405
  height: 14,
398
406
  radius: 6
399
407
  });
400
- }, mr = Array.from({ length: _t }, (e, t) => /* @__PURE__ */ p("tr", {
408
+ }, xr = Array.from({ length: bt }, (e, t) => /* @__PURE__ */ m("tr", {
401
409
  className: "kapi-table-skrow",
402
410
  "aria-hidden": !0,
403
411
  children: [
404
- x && /* @__PURE__ */ f("td", {
412
+ C && /* @__PURE__ */ p("td", {
405
413
  className: "is-sticky kapi-cbcol",
406
414
  style: { left: 0 },
407
- children: /* @__PURE__ */ f(Oe, {
415
+ children: /* @__PURE__ */ p(Ne, {
408
416
  width: 16,
409
417
  height: 16,
410
418
  radius: 5
411
419
  })
412
420
  }),
413
- I && /* @__PURE__ */ f("td", { className: "kapi-expandcol" }),
414
- B.map((e, n) => /* @__PURE__ */ f("td", {
421
+ z && /* @__PURE__ */ p("td", { className: "kapi-expandcol" }),
422
+ U.map((e, n) => /* @__PURE__ */ p("td", {
415
423
  "data-col": e.key,
416
- className: $e(e, n === On),
424
+ className: nt(e, n === jn),
417
425
  style: {
418
- left: W[n],
419
- ...Qe(e, "td", R)
426
+ left: q[n],
427
+ ...tt(e, "td", V)
420
428
  },
421
- children: pr(e, n, t)
429
+ children: br(e, n, t)
422
430
  }, e.key)),
423
- G && /* @__PURE__ */ f("td", {
431
+ J && /* @__PURE__ */ p("td", {
424
432
  className: "kapi-actcol",
425
- children: /* @__PURE__ */ f(Oe, {
433
+ children: /* @__PURE__ */ p(Ne, {
426
434
  width: 28,
427
435
  height: 14,
428
436
  radius: 6,
@@ -430,90 +438,90 @@ function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", f
430
438
  })
431
439
  })
432
440
  ]
433
- }, `sk-${t}`)), hr = x && dt && $t.length > 0 ? /* @__PURE__ */ f(ke, {
434
- count: $t.length,
435
- onClear: Qt,
436
- placement: Ue,
437
- children: dt({
438
- ids: $t,
439
- clear: Qt
441
+ }, `sk-${t}`)), Sr = C && mt && nn.length > 0 ? /* @__PURE__ */ p(Pe, {
442
+ count: nn.length,
443
+ onClear: tn,
444
+ placement: x,
445
+ children: mt({
446
+ ids: nn,
447
+ clear: tn
440
448
  })
441
- }) : null, gr = zt != null && typeof zt != "boolean";
442
- return /* @__PURE__ */ p("div", {
443
- id: et,
444
- style: Xe,
445
- className: i("kapi-table-shell", vt && "kapi-table-shell--card", Be && "kapi-table-shell--fill", Gn && "kapi-table-shell--cards", Ge),
449
+ }) : null, Cr = Ht != null && typeof Ht != "boolean";
450
+ return /* @__PURE__ */ m("div", {
451
+ id: rt,
452
+ style: $e,
453
+ className: i("kapi-table-shell", xt && "kapi-table-shell--card", We && "kapi-table-shell--fill", Zn && "kapi-table-shell--cards", Je),
446
454
  children: [
447
- Ue === "top" && hr,
448
- (Pt || gr || k || Et && kn.length > 0) && /* @__PURE__ */ p("div", {
455
+ x === "top" && Sr,
456
+ (Lt || Cr || M || kt && Mn.length > 0) && /* @__PURE__ */ m("div", {
449
457
  className: "kapi-tabletools",
450
458
  children: [
451
- Pt && /* @__PURE__ */ f(Ae, {
452
- value: V,
453
- onChange: Tn,
454
- columns: B,
455
- count: O ? void 0 : {
456
- shown: H.length,
457
- total: m.length
459
+ Lt && /* @__PURE__ */ p(Fe, {
460
+ value: W,
461
+ onChange: On,
462
+ columns: U,
463
+ count: j ? void 0 : {
464
+ shown: G.length,
465
+ total: h.length
458
466
  },
459
- debounce: O ? Rt : 0,
460
- labels: A
467
+ debounce: j ? Vt : 0,
468
+ labels: N
461
469
  }),
462
- zt,
463
- k && /* @__PURE__ */ p("button", {
470
+ Ht,
471
+ M && /* @__PURE__ */ m("button", {
464
472
  type: "button",
465
473
  className: "kapi-filterchip",
466
- onClick: Wn,
467
- children: [/* @__PURE__ */ f(Ve, {
474
+ onClick: Xn,
475
+ children: [/* @__PURE__ */ p(Ge, {
468
476
  size: 14,
469
477
  strokeWidth: 2.2
470
- }), /* @__PURE__ */ f("span", {
478
+ }), /* @__PURE__ */ p("span", {
471
479
  className: "kapi-strong",
472
- children: A.exportCsv
480
+ children: N.exportCsv
473
481
  })]
474
482
  }),
475
- Et && kn.length > 0 && /* @__PURE__ */ p("div", {
483
+ kt && Mn.length > 0 && /* @__PURE__ */ m("div", {
476
484
  className: "kapi-dropdown",
477
485
  onKeyDown: (e) => {
478
- e.key === "Escape" && hn(!1);
486
+ e.key === "Escape" && vn(!1);
479
487
  },
480
- children: [/* @__PURE__ */ p("button", {
488
+ children: [/* @__PURE__ */ m("button", {
481
489
  type: "button",
482
490
  className: "kapi-filterchip",
483
- onClick: () => hn((e) => !e),
491
+ onClick: () => vn((e) => !e),
484
492
  "aria-haspopup": "menu",
485
- "aria-expanded": mn,
493
+ "aria-expanded": _n,
486
494
  children: [
487
- /* @__PURE__ */ f(ze, {
495
+ /* @__PURE__ */ p(Ue, {
488
496
  size: 14,
489
497
  strokeWidth: 2.2
490
498
  }),
491
- /* @__PURE__ */ f("span", {
499
+ /* @__PURE__ */ p("span", {
492
500
  className: "kapi-strong",
493
- children: A.columns
501
+ children: N.columns
494
502
  }),
495
- /* @__PURE__ */ f(Fe, {
503
+ /* @__PURE__ */ p(ze, {
496
504
  size: 14,
497
505
  strokeWidth: 2.2,
498
506
  color: "var(--kapi-muted-2)"
499
507
  })
500
508
  ]
501
- }), mn && /* @__PURE__ */ p(je, { children: [/* @__PURE__ */ f("div", {
509
+ }), _n && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
502
510
  className: "kapi-dropdown__backdrop",
503
- onClick: () => hn(!1)
504
- }), /* @__PURE__ */ f("div", {
511
+ onClick: () => vn(!1)
512
+ }), /* @__PURE__ */ p("div", {
505
513
  className: "kapi-menu kapi-dropdown__menu kapi-dropdown__menu--down kapi-tabletools__menu",
506
514
  role: "menu",
507
- "aria-label": A.columns,
508
- children: kn.map((e) => {
509
- let t = L[e.key] !== !1;
510
- return /* @__PURE__ */ p("button", {
515
+ "aria-label": N.columns,
516
+ children: Mn.map((e) => {
517
+ let t = B[e.key] !== !1;
518
+ return /* @__PURE__ */ m("button", {
511
519
  type: "button",
512
520
  role: "menuitemcheckbox",
513
521
  "aria-checked": t,
514
522
  className: `kapi-menu__item${t ? " kapi-menu__item--on" : ""}`,
515
- onClick: () => gn(e.key),
516
- children: [/* @__PURE__ */ f("span", { children: e.label }), t && /* @__PURE__ */ f(Pe, {
523
+ onClick: () => yn(e.key),
524
+ children: [/* @__PURE__ */ p("span", { children: e.label }), t && /* @__PURE__ */ p(Re, {
517
525
  size: 14,
518
526
  strokeWidth: 2.6,
519
527
  color: "var(--kapi-primary)"
@@ -524,184 +532,199 @@ function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", f
524
532
  })
525
533
  ]
526
534
  }),
527
- /* @__PURE__ */ p("div", {
535
+ O !== void 0 && C && /* @__PURE__ */ m("div", {
536
+ className: In === "none" ? void 0 : "kapi-table__dataset",
537
+ role: "status",
538
+ children: [In === "offer" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { children: (O.hintLabel ?? Ae)(X.length, O.total) }), /* @__PURE__ */ p("button", {
539
+ type: "button",
540
+ className: "kapi-link",
541
+ onClick: O.onSelect,
542
+ children: (O.actionLabel ?? ke)(O.total)
543
+ })] }), In === "selected" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { children: (O.selectedLabel ?? Me)(O.total) }), O.onClear && /* @__PURE__ */ p("button", {
544
+ type: "button",
545
+ className: "kapi-link",
546
+ onClick: O.onClear,
547
+ children: N.datasetClear
548
+ })] })]
549
+ }),
550
+ /* @__PURE__ */ m("div", {
528
551
  className: "kapi-tablewrap",
529
- ref: M,
552
+ ref: F,
530
553
  tabIndex: 0,
531
- style: Be ? void 0 : { maxHeight: Re },
532
- onScroll: Vn,
554
+ style: We ? void 0 : { maxHeight: He },
555
+ onScroll: qn,
533
556
  children: [
534
- /* @__PURE__ */ p("table", {
535
- ref: xn,
536
- className: `kapi-table2${C ? " is-virtual" : ""}${wt === "card" ? " kapi-table2--card" : ""}${Tt ? " kapi-table2--hover" : ""}`,
537
- children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [
538
- x && /* @__PURE__ */ p("th", {
539
- className: `is-sticky kapi-cbcol${U ? " kapi-cbcol--presets" : ""}`,
557
+ /* @__PURE__ */ m("table", {
558
+ ref: wn,
559
+ className: `kapi-table2${T ? " is-virtual" : ""}${Dt === "card" ? " kapi-table2--card" : ""}${Ot ? " kapi-table2--hover" : ""}`,
560
+ children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
561
+ C && /* @__PURE__ */ m("th", {
562
+ className: `is-sticky kapi-cbcol${K ? " kapi-cbcol--presets" : ""}`,
540
563
  style: { left: 0 },
541
- children: [/* @__PURE__ */ f("label", {
564
+ children: [/* @__PURE__ */ p("label", {
542
565
  className: "kapi-check kapi-check--block",
543
- children: /* @__PURE__ */ f("input", {
566
+ children: /* @__PURE__ */ p("input", {
544
567
  type: "checkbox",
545
- checked: jn === "all",
568
+ checked: Fn === "all",
546
569
  ref: (e) => {
547
- e && (e.indeterminate = jn === "some");
570
+ e && (e.indeterminate = Fn === "some");
548
571
  },
549
- onChange: () => P(he(N, J)),
550
- "aria-label": A.selectAll
572
+ onChange: () => L(ge(I, X)),
573
+ "aria-label": N.selectAll
551
574
  })
552
- }), U && /* @__PURE__ */ f(be, {
575
+ }), K && /* @__PURE__ */ p(xe, {
553
576
  label: null,
554
- "aria-label": A.selectMatching,
577
+ "aria-label": N.selectMatching,
555
578
  variant: "ghost",
556
- items: An
579
+ items: Pn
557
580
  })]
558
581
  }),
559
- I && /* @__PURE__ */ f("th", {
582
+ z && /* @__PURE__ */ p("th", {
560
583
  className: "kapi-expandcol",
561
- children: /* @__PURE__ */ f("span", {
584
+ children: /* @__PURE__ */ p("span", {
562
585
  className: "kapi-sr-only",
563
- children: A.expandColumn
586
+ children: N.expandColumn
564
587
  })
565
588
  }),
566
- B.map((e, t) => /* @__PURE__ */ p("th", {
589
+ U.map((e, t) => /* @__PURE__ */ m("th", {
567
590
  "data-col": e.key,
568
- className: `${$e(e, t === On)}${e.sortable ? " is-sortable" : ""}`,
569
- "aria-sort": Yn(e),
591
+ className: `${nt(e, t === jn)}${e.sortable ? " is-sortable" : ""}`,
592
+ "aria-sort": nr(e),
570
593
  style: {
571
- left: W[t],
572
- ...Qe(e, "th", R),
594
+ left: q[t],
595
+ ...tt(e, "th", V),
573
596
  textAlign: e.align
574
597
  },
575
- children: [Jn(e), lr(e)]
598
+ children: [tr(e), gr(e)]
576
599
  }, e.key)),
577
- G && /* @__PURE__ */ f("th", {
600
+ J && /* @__PURE__ */ p("th", {
578
601
  className: "kapi-actcol",
579
- children: A.actions
602
+ children: N.actions
580
603
  })
581
- ] }) }), /* @__PURE__ */ p("tbody", { children: [
582
- E && (_t > 0 ? mr : fr(Ht, !0)),
583
- !E && H.length === 0 && fr(Vt),
584
- !E && H.length > 0 && Fn > 0 && /* @__PURE__ */ f("tr", {
604
+ ] }) }), /* @__PURE__ */ m("tbody", { children: [
605
+ k && (bt > 0 ? xr : yr(Gt, !0)),
606
+ !k && G.length === 0 && yr(Wt),
607
+ !k && G.length > 0 && Bn > 0 && /* @__PURE__ */ p("tr", {
585
608
  "aria-hidden": !0,
586
- style: { height: Fn },
587
- children: /* @__PURE__ */ f("td", {
588
- colSpan: K,
609
+ style: { height: Bn },
610
+ children: /* @__PURE__ */ p("td", {
611
+ colSpan: Y,
589
612
  className: "kapi-table-pad"
590
613
  })
591
614
  }),
592
- !E && Ln.map((e, t) => {
593
- let n = e[y], r = !D || D(e), i = Rn + Nn + t + 1;
594
- return /* @__PURE__ */ f(it, {
615
+ !k && Hn.map((e, t) => {
616
+ let n = e[b], r = !A || A(e), i = Un + Rn + t + 1;
617
+ return /* @__PURE__ */ p(st, {
595
618
  row: e,
596
619
  id: n,
597
- selected: N.has(n),
598
- selectLabel: x ? u(e, B, i, A, ct) : "",
599
- open: I && ln.has(n),
620
+ selected: I.has(n),
621
+ selectLabel: C ? fe(e, U, i, N, dt) : "",
622
+ open: z && fn.has(n),
600
623
  canSelect: r,
601
- clickSelect: x && st && r,
602
- rangeSelect: ft,
603
- selectable: x,
604
- expandable: I,
605
- rowHeight: C ? w : void 0,
606
- columns: B,
607
- lefts: W,
608
- lastSticky: On,
609
- widths: R,
610
- text: A,
611
- onCopy: ot,
612
- hasActions: G,
613
- actions: rt,
614
- rowMenu: b,
615
- renderSubComponent: xt,
616
- colSpan: K,
617
- handlers: qn
624
+ clickSelect: C && ut && r,
625
+ rangeSelect: ht,
626
+ selectable: C,
627
+ expandable: z,
628
+ rowHeight: T ? E : void 0,
629
+ columns: U,
630
+ lefts: q,
631
+ lastSticky: jn,
632
+ widths: V,
633
+ text: N,
634
+ onCopy: lt,
635
+ hasActions: J,
636
+ actions: ot,
637
+ rowMenu: S,
638
+ renderSubComponent: wt,
639
+ colSpan: Y,
640
+ handlers: er
618
641
  }, n);
619
642
  }),
620
- !E && H.length > 0 && In > 0 && /* @__PURE__ */ f("tr", {
643
+ !k && G.length > 0 && Vn > 0 && /* @__PURE__ */ p("tr", {
621
644
  "aria-hidden": !0,
622
- style: { height: In },
623
- children: /* @__PURE__ */ f("td", {
624
- colSpan: K,
645
+ style: { height: Vn },
646
+ children: /* @__PURE__ */ p("td", {
647
+ colSpan: Y,
625
648
  className: "kapi-table-pad"
626
649
  })
627
650
  })
628
651
  ] })]
629
652
  }),
630
- Wt && at && /* @__PURE__ */ f(ye, {
653
+ qt && ct && /* @__PURE__ */ p(be, {
631
654
  open: !0,
632
- x: Wt.x,
633
- y: Wt.y,
634
- items: at,
635
- onClose: () => Gt(null)
655
+ x: qt.x,
656
+ y: qt.y,
657
+ items: ct,
658
+ onClose: () => Jt(null)
636
659
  }),
637
- j && /* @__PURE__ */ f(ye, {
660
+ P && /* @__PURE__ */ p(be, {
638
661
  open: !0,
639
- x: j.x,
640
- y: j.y,
641
- items: j.items,
642
- onClose: () => Kt(null)
662
+ x: P.x,
663
+ y: P.y,
664
+ items: P.items,
665
+ onClose: () => Yt(null)
643
666
  })
644
667
  ]
645
668
  }),
646
- Ue === "bottom" && hr,
647
- T && $ && /* @__PURE__ */ p("div", {
669
+ x === "bottom" && Sr,
670
+ D && $ && /* @__PURE__ */ m("div", {
648
671
  className: "kapi-tablefoot",
649
- children: [/* @__PURE__ */ p("div", {
672
+ children: [/* @__PURE__ */ m("div", {
650
673
  className: "kapi-tablefoot__l",
651
- children: [/* @__PURE__ */ p("span", { children: [
674
+ children: [/* @__PURE__ */ m("span", { children: [
652
675
  $.from,
653
676
  "–",
654
677
  $.to,
655
678
  " ",
656
- A.of,
679
+ N.of,
657
680
  " ",
658
- T.total
659
- ] }), T.pageSizeOptions && T.onPageSizeChange && /* @__PURE__ */ p("div", {
681
+ D.total
682
+ ] }), D.pageSizeOptions && D.onPageSizeChange && /* @__PURE__ */ m("div", {
660
683
  className: "kapi-tablefoot__size",
661
- children: [/* @__PURE__ */ f("span", { children: A.rowsPerPage }), /* @__PURE__ */ f(r, {
684
+ children: [/* @__PURE__ */ p("span", { children: N.rowsPerPage }), /* @__PURE__ */ p(r, {
662
685
  size: "sm",
663
686
  searchable: !1,
664
- "aria-label": A.rowsPerPage,
665
- options: T.pageSizeOptions.map((e) => ({
687
+ "aria-label": N.rowsPerPage,
688
+ options: D.pageSizeOptions.map((e) => ({
666
689
  value: String(e),
667
690
  label: String(e)
668
691
  })),
669
- value: String(T.pageSize),
692
+ value: String(D.pageSize),
670
693
  onChange: (e) => {
671
- e !== null && T.onPageSizeChange?.(Number(e));
694
+ e !== null && D.onPageSizeChange?.(Number(e));
672
695
  }
673
696
  })]
674
697
  })]
675
- }), /* @__PURE__ */ p("div", {
698
+ }), /* @__PURE__ */ m("div", {
676
699
  className: "kapi-tablefoot__r",
677
700
  children: [
678
- /* @__PURE__ */ f("button", {
701
+ /* @__PURE__ */ p("button", {
679
702
  type: "button",
680
703
  className: "kapi-tablefoot__btn",
681
- "aria-label": A.prevPage,
704
+ "aria-label": N.prevPage,
682
705
  "aria-disabled": !$.canPrev || void 0,
683
706
  onClick: () => {
684
- $.canPrev && T.onPageChange($.page - 1);
707
+ $.canPrev && D.onPageChange($.page - 1);
685
708
  },
686
- children: /* @__PURE__ */ f(Ie, {
709
+ children: /* @__PURE__ */ p(Be, {
687
710
  size: 16,
688
711
  strokeWidth: 2
689
712
  })
690
713
  }),
691
- /* @__PURE__ */ p("span", { children: [
714
+ /* @__PURE__ */ m("span", { children: [
692
715
  $.page,
693
716
  " / ",
694
717
  $.totalPages
695
718
  ] }),
696
- /* @__PURE__ */ f("button", {
719
+ /* @__PURE__ */ p("button", {
697
720
  type: "button",
698
721
  className: "kapi-tablefoot__btn",
699
- "aria-label": A.nextPage,
722
+ "aria-label": N.nextPage,
700
723
  "aria-disabled": !$.canNext || void 0,
701
724
  onClick: () => {
702
- $.canNext && T.onPageChange($.page + 1);
725
+ $.canNext && D.onPageChange($.page + 1);
703
726
  },
704
- children: /* @__PURE__ */ f(Le, {
727
+ children: /* @__PURE__ */ p(Ve, {
705
728
  size: 16,
706
729
  strokeWidth: 2
707
730
  })
@@ -712,23 +735,23 @@ function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", f
712
735
  ]
713
736
  });
714
737
  }
715
- function rt({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a, clickSelect: o, rangeSelect: ee, selectable: s, expandable: te, rowHeight: ne, columns: re, lefts: ie, lastSticky: ae, widths: oe, text: c, onCopy: se, hasActions: ce, actions: le, rowMenu: ue, renderSubComponent: l, colSpan: de, handlers: u }) {
716
- return /* @__PURE__ */ p(je, { children: [/* @__PURE__ */ p("tr", {
738
+ function ot({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a, clickSelect: o, rangeSelect: ee, selectable: s, expandable: te, rowHeight: ne, columns: re, lefts: ie, lastSticky: ae, widths: oe, text: c, onCopy: se, hasActions: ce, actions: le, rowMenu: ue, renderSubComponent: de, colSpan: l, handlers: u }) {
739
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("tr", {
717
740
  className: `${n ? "is-selected" : ""}${o ? " is-rowsel" : ""}`,
718
741
  style: ne === void 0 ? void 0 : { height: ne },
719
742
  onClick: o ? (e) => {
720
- e.target.closest(Ge) || u.activate(t, e.shiftKey);
743
+ e.target.closest(Je) || u.activate(t, e.shiftKey);
721
744
  } : void 0,
722
745
  onMouseDown: o ? (e) => {
723
746
  ee && e.shiftKey && e.preventDefault();
724
747
  } : void 0,
725
748
  children: [
726
- s && /* @__PURE__ */ f("td", {
749
+ s && /* @__PURE__ */ p("td", {
727
750
  className: "is-sticky kapi-cbcol",
728
751
  style: { left: 0 },
729
- children: /* @__PURE__ */ f("label", {
752
+ children: /* @__PURE__ */ p("label", {
730
753
  className: "kapi-check kapi-check--block",
731
- children: /* @__PURE__ */ f("input", {
754
+ children: /* @__PURE__ */ p("input", {
732
755
  type: "checkbox",
733
756
  checked: n,
734
757
  disabled: !a,
@@ -740,41 +763,41 @@ function rt({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a,
740
763
  })
741
764
  })
742
765
  }),
743
- te && /* @__PURE__ */ f("td", {
766
+ te && /* @__PURE__ */ p("td", {
744
767
  className: "kapi-expandcol",
745
- children: /* @__PURE__ */ f("button", {
768
+ children: /* @__PURE__ */ p("button", {
746
769
  type: "button",
747
770
  className: "kapi-expandcol__btn",
748
771
  "aria-label": c.expandRow,
749
772
  "aria-expanded": i,
750
773
  onClick: () => u.toggleExpanded(t),
751
- children: f(i ? Fe : Le, {
774
+ children: p(i ? ze : Ve, {
752
775
  size: 16,
753
776
  strokeWidth: 2
754
777
  })
755
778
  })
756
779
  }),
757
- re.map((t, n) => /* @__PURE__ */ f("td", {
780
+ re.map((t, n) => /* @__PURE__ */ p("td", {
758
781
  "data-col": t.key,
759
- className: $e(t, n === ae),
782
+ className: nt(t, n === ae),
760
783
  style: {
761
784
  left: ie[n],
762
- ...Qe(t, "td", oe),
785
+ ...tt(t, "td", oe),
763
786
  textAlign: t.align
764
787
  },
765
788
  "data-label": typeof t.label == "string" || typeof t.label == "number" ? String(t.label) : void 0,
766
- children: et(t, e, c, se)
789
+ children: rt(t, e, c, se)
767
790
  }, t.key)),
768
- ce && /* @__PURE__ */ f("td", {
791
+ ce && /* @__PURE__ */ p("td", {
769
792
  className: "kapi-actcol",
770
- children: /* @__PURE__ */ p("div", {
793
+ children: /* @__PURE__ */ m("div", {
771
794
  className: "kapi-actcol__in",
772
- children: [le ? le(e) : null, ue && /* @__PURE__ */ f("button", {
795
+ children: [le ? le(e) : null, ue && /* @__PURE__ */ p("button", {
773
796
  type: "button",
774
797
  className: "kapi-actcol__dots",
775
798
  "aria-label": c.moreActions,
776
799
  onClick: (t) => u.openMenu(t, e),
777
- children: /* @__PURE__ */ f(Ue, {
800
+ children: /* @__PURE__ */ p(x, {
778
801
  size: 16,
779
802
  strokeWidth: 2
780
803
  })
@@ -782,14 +805,14 @@ function rt({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a,
782
805
  })
783
806
  })
784
807
  ]
785
- }), i && l && /* @__PURE__ */ f("tr", {
808
+ }), i && de && /* @__PURE__ */ p("tr", {
786
809
  className: "kapi-subrow",
787
- children: /* @__PURE__ */ f("td", {
788
- colSpan: de,
789
- children: l(e)
810
+ children: /* @__PURE__ */ p("td", {
811
+ colSpan: l,
812
+ children: de(e)
790
813
  })
791
814
  })] });
792
815
  }
793
- var it = m(rt);
816
+ var st = h(ot);
794
817
  //#endregion
795
- export { We as DEFAULT_TABLE_LABELS, nt as KapiTable };
818
+ export { qe as DEFAULT_TABLE_LABELS, at as KapiTable };