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