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