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