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