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