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