@kapiuara/ui 0.18.0 → 0.19.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/dist/components/data/KapiDataTable.d.ts +12 -2
- package/dist/components/data/KapiDataTable.js +78 -76
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +229 -227
- package/dist/components/data/index.d.ts +1 -1
- package/dist/components/data/tableTypes.d.ts +37 -0
- package/dist/components/data/useRowKeyWarning.d.ts +9 -3
- package/dist/components/data/useRowKeyWarning.js +7 -7
- package/dist/components/data/useTableSelection.d.ts +3 -2
- package/dist/components/data/useTableSelection.js +3 -3
- package/dist/css/base.css +1 -1
- package/dist/hooks/themeDeriveLogic.js +2 -2
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +2 -2
|
@@ -32,33 +32,33 @@ import { headerMenuItems as Ze } from "./tableHeaderMenu.js";
|
|
|
32
32
|
import { useShallowStable as s } from "../../hooks/shallowStable.js";
|
|
33
33
|
import { TableRow as Qe } from "./KapiTableRow.js";
|
|
34
34
|
import { TableFooter as $e } from "./KapiTableFooter.js";
|
|
35
|
-
import {
|
|
35
|
+
import { useCallback as et, useEffect as tt, useLayoutEffect as nt, useMemo as c, useRef as l, useState as u } from "react";
|
|
36
36
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
37
|
-
import { RefreshCw as
|
|
37
|
+
import { RefreshCw as rt } from "lucide-react";
|
|
38
38
|
//#region src/components/data/KapiTable.tsx
|
|
39
|
-
var
|
|
39
|
+
var it = 600, at = 46, ot = 5, st = {
|
|
40
40
|
text: "",
|
|
41
41
|
column: null
|
|
42
|
-
},
|
|
43
|
-
function
|
|
44
|
-
let C = s(
|
|
45
|
-
onMenu: _ || S ? (e, t) =>
|
|
42
|
+
}, ct = [];
|
|
43
|
+
function lt({ columns: lt, rows: p, keyField: dt = "id", getRowKey: m, maxHeight: ft = "58vh", fill: pt = !1, footer: mt, bulkActionsPlacement: ht = "bottom", className: gt, classNames: h, style: _t, id: vt, ref: yt, labels: bt, actions: xt, rowMenu: g, contextMenu: _, onCopy: St, selectable: v = !1, rowSelect: Ct = !1, rowLabel: wt, selectedIds: Tt, defaultSelectedIds: Et, onSelectedIdsChange: Dt, bulkActions: Ot, rangeSelect: kt = !0, selectionPresets: At, virtual: y = !1, rowHeight: jt = at, estimatedRowHeight: Mt = at, sort: Nt, defaultSort: Pt = null, onSortChange: Ft, manualSort: It = !1, pagination: b, dataset: Lt, loading: x = !1, loadingRows: Rt, card: zt = !1, emptyMessage: Bt, loadingMessage: Vt, isRowSelectable: Ht, renderSubComponent: Ut, expandedIds: Wt, defaultExpandedIds: Gt, onExpandedIdsChange: Kt, density: qt = "default", rowHover: Jt = !1, columnToggle: Yt = !1, columnVisibility: Xt, defaultColumnVisibility: Zt, onColumnVisibilityChange: Qt, columnPinning: $t = !1, pinnedColumns: en, defaultPinnedColumns: tn, onPinnedColumnsChange: nn, headerMenu: rn = !1, resizableColumns: an = !1, columnWidths: on, defaultColumnWidths: sn, onColumnWidthsChange: cn, filterable: ln = !1, filter: un, defaultFilter: dn = st, onFilterChange: fn, manualFilter: pn = !1, filterDebounce: mn = 300, exportCsv: hn, toolbar: gn, toolbarActions: _n, onRefresh: S, mobileCards: vn = !1, onRowClick: yn, getRowProps: bn }) {
|
|
44
|
+
let C = s(lt), w = r("table", Pe, s(bt)), xn = Bt === void 0 ? w.empty : Bt, Sn = Vt === void 0 ? w.loading : Vt, Cn = n(), wn = t(), [Tn, En] = u(null), [T, Dn] = u(null), [E, On] = u(null), D = ke({
|
|
45
|
+
onMenu: _ || S ? (e, t) => En({
|
|
46
46
|
x: e,
|
|
47
47
|
y: t
|
|
48
48
|
}) : void 0,
|
|
49
|
-
zoneMenu:
|
|
49
|
+
zoneMenu: rn ? {
|
|
50
50
|
selector: "thead th[data-col]",
|
|
51
51
|
onMenu: (e, t, n) => {
|
|
52
52
|
let r = e.getAttribute("data-col");
|
|
53
53
|
if (r !== null) {
|
|
54
54
|
if (t === 0 && n === 0) {
|
|
55
55
|
let t = e.getBoundingClientRect();
|
|
56
|
-
|
|
56
|
+
On({
|
|
57
57
|
x: t.left,
|
|
58
58
|
y: t.bottom,
|
|
59
59
|
key: r
|
|
60
60
|
});
|
|
61
|
-
} else
|
|
61
|
+
} else On({
|
|
62
62
|
x: t,
|
|
63
63
|
y: n,
|
|
64
64
|
key: r
|
|
@@ -66,139 +66,141 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
} : void 0
|
|
69
|
-
}),
|
|
69
|
+
}), kn = Ae(), [O, An] = i(Nt, Pt, Ft), jn = (e) => An(pe(O, e)), k = y && jt === "auto", Mn = jt === "auto" ? void 0 : jt, A = !!Ut && (!y || k), [Nn, Pn] = i(Wt, Gt ?? ct, Kt && ((e) => Kt([...e]))), Fn = c(() => new Set(Nn), [Nn]), In = (e) => Pn([...we(Fn, e)]), [j, Ln] = i(Xt, Zt ?? {}, Qt), Rn = (e) => Ln(Ce(j, e)), zn = (e) => {
|
|
70
70
|
let t = new Set(e), n = { ...j };
|
|
71
71
|
C.forEach((e) => {
|
|
72
72
|
e.hideable !== !1 && (n[e.key] = t.has(e.key));
|
|
73
|
-
}),
|
|
74
|
-
}, [
|
|
75
|
-
|
|
73
|
+
}), Ln(n);
|
|
74
|
+
}, [Bn, Vn] = i(on, sn ?? {}, cn), M = s(Bn), Hn = l(null), Un = $t || en !== void 0 || tn !== void 0, [N, Wn] = i(en, () => tn ?? ye(C), nn), Gn = (e, t) => Wn(_e(N, e, t)), Kn = c(() => Un ? me(C, N) : C, [
|
|
75
|
+
Un,
|
|
76
76
|
C,
|
|
77
77
|
N
|
|
78
|
-
]), P = s(c(() => Te(
|
|
79
|
-
if (
|
|
78
|
+
]), P = s(c(() => Te(Kn, j), [Kn, j])), [F, qn] = i(un, dn, fn), Jn = c(() => {
|
|
79
|
+
if (pn) return p;
|
|
80
80
|
let e = ue(P, F.column);
|
|
81
81
|
return le(p, (t) => e.map((e) => e.filterValue ? e.filterValue(t) : he(t, e.key)), F.text);
|
|
82
82
|
}, [
|
|
83
83
|
p,
|
|
84
84
|
P,
|
|
85
85
|
F,
|
|
86
|
-
|
|
87
|
-
]), I = c(() =>
|
|
88
|
-
|
|
86
|
+
pn
|
|
87
|
+
]), I = c(() => It ? Jn : ve(Jn, C, O, Cn), [
|
|
88
|
+
Jn,
|
|
89
89
|
C,
|
|
90
90
|
O,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
]), L = Ke(b) ? b : void 0, R = Ke(b) ? void 0 : b, [z, B] = i(L?.page, L?.defaultPage ?? 1, L?.onPageChange), [
|
|
91
|
+
It,
|
|
92
|
+
Cn
|
|
93
|
+
]), L = Ke(b) ? b : void 0, R = Ke(b) ? void 0 : b, [z, B] = i(L?.page, L?.defaultPage ?? 1, L?.onPageChange), [Yn, Xn] = i(L?.pageSize, L?.defaultPageSize ?? 10, L?.onPageSizeChange), V = `${F.column ?? ""}\u0000${F.text}`, Zn = l(V), Qn = L !== void 0 && Zn.current !== V, H = c(() => L ? Ge(I, Qn ? 1 : z, Yn) : null, [
|
|
94
94
|
L !== void 0,
|
|
95
95
|
I,
|
|
96
|
-
|
|
96
|
+
Qn,
|
|
97
97
|
z,
|
|
98
|
-
|
|
98
|
+
Yn
|
|
99
99
|
]), U = H ? H.rows : I, W = L ? {
|
|
100
100
|
page: H?.info.page ?? 1,
|
|
101
|
-
pageSize:
|
|
101
|
+
pageSize: Yn,
|
|
102
102
|
total: I.length,
|
|
103
103
|
onPageChange: B,
|
|
104
104
|
...L.pageSizeOptions && {
|
|
105
105
|
pageSizeOptions: L.pageSizeOptions,
|
|
106
106
|
onPageSizeChange: (e) => {
|
|
107
|
-
|
|
107
|
+
Xn(e), z !== 1 && B(1);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
showEdges: L.showEdges
|
|
111
|
-
} : R ?? null,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, [V,
|
|
115
|
-
let
|
|
111
|
+
} : R ?? null, $n = H && H.info.page !== z && (!x || Qn) ? H.info.page : null, er = l(B);
|
|
112
|
+
er.current = B, tt(() => {
|
|
113
|
+
Zn.current = V, $n !== null && er.current($n);
|
|
114
|
+
}, [V, $n]);
|
|
115
|
+
let tr = l(m);
|
|
116
|
+
tr.current = m;
|
|
117
|
+
let nr = m !== void 0, G = et((e) => nr ? tr.current(e) : e[dt], [nr, dt]), { sel: rr, commitSelection: ir, clearSelection: ar, selectedList: K, allIds: or, hasPresets: sr, presetItems: cr, headerState: lr, datasetNotice: ur, activateRow: dr } = Xe({
|
|
116
118
|
rows: U,
|
|
117
|
-
|
|
119
|
+
claveDe: G,
|
|
118
120
|
selectable: v,
|
|
119
|
-
selectedIds:
|
|
120
|
-
defaultSelectedIds:
|
|
121
|
-
onSelectedIdsChange:
|
|
122
|
-
isRowSelectable:
|
|
123
|
-
selectionPresets:
|
|
124
|
-
rangeSelect:
|
|
125
|
-
dataset:
|
|
121
|
+
selectedIds: Tt,
|
|
122
|
+
defaultSelectedIds: Et,
|
|
123
|
+
onSelectedIdsChange: Dt,
|
|
124
|
+
isRowSelectable: Ht,
|
|
125
|
+
selectionPresets: At,
|
|
126
|
+
rangeSelect: kt,
|
|
127
|
+
dataset: Lt,
|
|
126
128
|
loadingLabel: w.loading,
|
|
127
|
-
locale:
|
|
128
|
-
}),
|
|
129
|
+
locale: Cn
|
|
130
|
+
}), fr = sr ? 80 : 46, pr = c(() => ie(P.map((e) => ({
|
|
129
131
|
sticky: e.sticky,
|
|
130
132
|
width: ce(e, M)
|
|
131
|
-
})), (v ?
|
|
133
|
+
})), (v ? fr : 0) + (A ? 44 : 0)), [
|
|
132
134
|
P,
|
|
133
135
|
M,
|
|
134
136
|
v,
|
|
135
|
-
|
|
137
|
+
fr,
|
|
136
138
|
A
|
|
137
|
-
]),
|
|
138
|
-
|
|
139
|
-
let e =
|
|
140
|
-
if (!e || !
|
|
139
|
+
]), q = !!(xt || g), mr = c(() => P.some((e) => be(e.sticky) === "right"), [P]), hr = l(null), [gr, _r] = u(0);
|
|
140
|
+
nt(() => {
|
|
141
|
+
let e = hr.current;
|
|
142
|
+
if (!e || !mr) return;
|
|
141
143
|
let t = () => {
|
|
142
144
|
let t = e.getBoundingClientRect().width;
|
|
143
|
-
|
|
145
|
+
_r((e) => e === t ? e : t);
|
|
144
146
|
};
|
|
145
147
|
if (t(), typeof ResizeObserver > "u") return;
|
|
146
148
|
let n = new ResizeObserver(t);
|
|
147
149
|
return n.observe(e), () => n.disconnect();
|
|
148
|
-
}, [
|
|
149
|
-
let
|
|
150
|
+
}, [mr, q]);
|
|
151
|
+
let vr = q ? gr : 0, yr = c(() => ae(P.map((e) => ({
|
|
150
152
|
sticky: e.sticky,
|
|
151
153
|
width: ce(e, M)
|
|
152
|
-
})),
|
|
154
|
+
})), vr), [
|
|
153
155
|
P,
|
|
154
156
|
M,
|
|
155
|
-
|
|
156
|
-
]),
|
|
157
|
-
lefts:
|
|
158
|
-
rights:
|
|
157
|
+
vr
|
|
158
|
+
]), J = c(() => ({
|
|
159
|
+
lefts: pr,
|
|
160
|
+
rights: yr,
|
|
159
161
|
lastLeft: fe(P),
|
|
160
162
|
firstRight: de(P)
|
|
161
163
|
}), [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
pr,
|
|
165
|
+
yr,
|
|
164
166
|
P
|
|
165
|
-
]),
|
|
167
|
+
]), Y = E ? P.find((e) => e.key === E.key) : void 0, br = Y ? Ze(Y, {
|
|
166
168
|
sort: O,
|
|
167
169
|
pinned: N,
|
|
168
|
-
canPin:
|
|
169
|
-
canHide:
|
|
170
|
+
canPin: $t,
|
|
171
|
+
canHide: Yt,
|
|
170
172
|
visibleCount: P.length,
|
|
171
173
|
text: w,
|
|
172
|
-
onSort:
|
|
173
|
-
onPin:
|
|
174
|
-
onHide:
|
|
175
|
-
}) : [],
|
|
174
|
+
onSort: An,
|
|
175
|
+
onPin: Gn,
|
|
176
|
+
onHide: Rn
|
|
177
|
+
}) : [], X = P.length + +!!v + +!!q + +!!A, xr = c(() => k ? U.map((e) => G(e)) : void 0, [
|
|
176
178
|
k,
|
|
177
179
|
U,
|
|
178
|
-
|
|
179
|
-
]),
|
|
180
|
+
G
|
|
181
|
+
]), Sr = ee({
|
|
180
182
|
enabled: y,
|
|
181
183
|
count: U.length,
|
|
182
184
|
scrollRef: D,
|
|
183
|
-
estimate: k ?
|
|
185
|
+
estimate: k ? Mt : Mn ?? at,
|
|
184
186
|
measure: k,
|
|
185
|
-
keys:
|
|
187
|
+
keys: xr,
|
|
186
188
|
overscan: 6,
|
|
187
|
-
fallbackViewHeight:
|
|
188
|
-
}), { start:
|
|
189
|
-
|
|
190
|
-
y &&
|
|
189
|
+
fallbackViewHeight: it
|
|
190
|
+
}), { start: Z, end: Cr, padTop: wr, padBottom: Tr } = Sr, Er = U.slice(Z, Cr), Dr = Rt ?? W?.pageSize ?? ot, Or = W ? Math.max(0, W.page - 1) * W.pageSize : 0, { cortaDerecha: kr, cortaIzquierda: Ar, medirBordes: jr } = We(D, P), { onScroll: Mr } = Sr;
|
|
191
|
+
nt(() => {
|
|
192
|
+
y && Mr();
|
|
191
193
|
}, [
|
|
192
194
|
y,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
ft,
|
|
196
|
+
Mr
|
|
195
197
|
]);
|
|
196
|
-
let
|
|
197
|
-
y &&
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
if (
|
|
201
|
-
|
|
198
|
+
let Nr = (e) => {
|
|
199
|
+
y && Mr(), jr(e.currentTarget);
|
|
200
|
+
}, Pr = l(!0);
|
|
201
|
+
tt(() => {
|
|
202
|
+
if (Pr.current) {
|
|
203
|
+
Pr.current = !1;
|
|
202
204
|
return;
|
|
203
205
|
}
|
|
204
206
|
let e = D.current;
|
|
@@ -208,55 +210,55 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
208
210
|
F.column,
|
|
209
211
|
D
|
|
210
212
|
]);
|
|
211
|
-
let
|
|
212
|
-
let e = P.map(se), t =
|
|
213
|
-
Oe(new Blob([`\uFEFF${te(e, n,
|
|
214
|
-
},
|
|
213
|
+
let Fr = typeof hn == "object" ? hn : {}, Ir = () => {
|
|
214
|
+
let e = P.map(se), t = Fr.rows, n = (t === void 0 ? I : typeof t == "function" ? t() : t).map((e) => P.map((t) => t.csvValue ? t.csvValue(e) : t.copyValue ? t.copyValue(e) : he(e, t.key)));
|
|
215
|
+
Oe(new Blob([`\uFEFF${te(e, n, Fr.separator)}`], { type: "text/csv;charset=utf-8" }), oe(Fr.fileName));
|
|
216
|
+
}, Lr = vn && !y, Rr = (e, t) => {
|
|
215
217
|
if (!g) return;
|
|
216
218
|
let n = e.currentTarget.getBoundingClientRect();
|
|
217
|
-
|
|
219
|
+
Dn({
|
|
218
220
|
x: n.right,
|
|
219
221
|
y: n.bottom + 4,
|
|
220
222
|
items: g(t)
|
|
221
223
|
});
|
|
222
|
-
},
|
|
223
|
-
activateRow:
|
|
224
|
-
toggleExpanded:
|
|
225
|
-
openRowMenu:
|
|
226
|
-
onRowClick:
|
|
227
|
-
onCopy:
|
|
224
|
+
}, Q = l({
|
|
225
|
+
activateRow: dr,
|
|
226
|
+
toggleExpanded: In,
|
|
227
|
+
openRowMenu: Rr,
|
|
228
|
+
onRowClick: yn,
|
|
229
|
+
onCopy: St
|
|
228
230
|
});
|
|
229
|
-
|
|
230
|
-
activateRow:
|
|
231
|
-
toggleExpanded:
|
|
232
|
-
openRowMenu:
|
|
233
|
-
onRowClick:
|
|
234
|
-
onCopy:
|
|
231
|
+
Q.current = {
|
|
232
|
+
activateRow: dr,
|
|
233
|
+
toggleExpanded: In,
|
|
234
|
+
openRowMenu: Rr,
|
|
235
|
+
onRowClick: yn,
|
|
236
|
+
onCopy: St
|
|
235
237
|
};
|
|
236
|
-
let
|
|
237
|
-
activate: (e, t) =>
|
|
238
|
-
toggleExpanded: (e) =>
|
|
239
|
-
openMenu: (e, t) =>
|
|
240
|
-
rowClick: (e, t) =>
|
|
241
|
-
copy: (e) =>
|
|
238
|
+
let zr = c(() => ({
|
|
239
|
+
activate: (e, t) => Q.current.activateRow(e, t),
|
|
240
|
+
toggleExpanded: (e) => Q.current.toggleExpanded(e),
|
|
241
|
+
openMenu: (e, t) => Q.current.openRowMenu(e, t),
|
|
242
|
+
rowClick: (e, t) => Q.current.onRowClick?.(e, t),
|
|
243
|
+
copy: (e) => Q.current.onCopy?.(e)
|
|
242
244
|
}), []);
|
|
243
|
-
Ue("KapiTable", p, m);
|
|
244
|
-
let { resizeHandle:
|
|
245
|
-
tableRef:
|
|
245
|
+
Ue("KapiTable", p, G, m ? "getRowKey" : `keyField ("${String(dt)}")`);
|
|
246
|
+
let { resizeHandle: Br } = qe({
|
|
247
|
+
tableRef: Hn,
|
|
246
248
|
columns: P,
|
|
247
249
|
widths: M,
|
|
248
|
-
onCommit:
|
|
249
|
-
lefts:
|
|
250
|
-
rights:
|
|
251
|
-
offset: (v ?
|
|
252
|
-
rightEnd:
|
|
253
|
-
resizableColumns:
|
|
250
|
+
onCommit: Vn,
|
|
251
|
+
lefts: pr,
|
|
252
|
+
rights: yr,
|
|
253
|
+
offset: (v ? fr : 0) + (A ? 44 : 0),
|
|
254
|
+
rightEnd: vr,
|
|
255
|
+
resizableColumns: an,
|
|
254
256
|
resizeLabel: w.resizeColumn
|
|
255
|
-
}),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}, [
|
|
259
|
-
let
|
|
257
|
+
}), $ = H ? H.info : R ? re(R) : null, Vr = R && $ && !x && R.total > 0 && $.page !== R.page ? $.page : null, Hr = l(R?.onPageChange);
|
|
258
|
+
Hr.current = R?.onPageChange, tt(() => {
|
|
259
|
+
Vr !== null && Hr.current?.(Vr);
|
|
260
|
+
}, [Vr]);
|
|
261
|
+
let Ur = Array.from({ length: Dr }, (e, t) => /* @__PURE__ */ f("tr", {
|
|
260
262
|
className: "kapi-table-skrow",
|
|
261
263
|
"aria-hidden": !0,
|
|
262
264
|
children: [
|
|
@@ -272,15 +274,15 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
272
274
|
A && /* @__PURE__ */ d("td", { className: "kapi-expandcol" }),
|
|
273
275
|
P.map((e, n) => /* @__PURE__ */ d("td", {
|
|
274
276
|
"data-col": e.key,
|
|
275
|
-
className: Le(e, n,
|
|
277
|
+
className: Le(e, n, J),
|
|
276
278
|
style: {
|
|
277
|
-
...He(n,
|
|
279
|
+
...He(n, J),
|
|
278
280
|
...Re(e, "td", M)
|
|
279
281
|
},
|
|
280
282
|
children: Be(e, n, t)
|
|
281
283
|
}, e.key)),
|
|
282
|
-
|
|
283
|
-
className: Fe(
|
|
284
|
+
q && /* @__PURE__ */ d("td", {
|
|
285
|
+
className: Fe(J),
|
|
284
286
|
children: /* @__PURE__ */ d(je, {
|
|
285
287
|
width: 28,
|
|
286
288
|
height: 14,
|
|
@@ -289,15 +291,15 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
289
291
|
})
|
|
290
292
|
})
|
|
291
293
|
]
|
|
292
|
-
}, `sk-${t}`)),
|
|
293
|
-
count:
|
|
294
|
-
onClear:
|
|
295
|
-
placement:
|
|
296
|
-
children:
|
|
297
|
-
ids:
|
|
298
|
-
clear:
|
|
294
|
+
}, `sk-${t}`)), Wr = v && Ot && K.length > 0 ? /* @__PURE__ */ d(Me, {
|
|
295
|
+
count: K.length,
|
|
296
|
+
onClear: ar,
|
|
297
|
+
placement: ht,
|
|
298
|
+
children: Ot({
|
|
299
|
+
ids: K,
|
|
300
|
+
clear: ar
|
|
299
301
|
})
|
|
300
|
-
}) : null,
|
|
302
|
+
}) : null, Gr = () => ({
|
|
301
303
|
columns: [...P],
|
|
302
304
|
hiddenColumns: C.filter((e) => j[e.key] === !1).map((e) => e.key),
|
|
303
305
|
columnWidths: { ...M },
|
|
@@ -307,99 +309,99 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
307
309
|
},
|
|
308
310
|
sort: O ?? null,
|
|
309
311
|
filter: F,
|
|
310
|
-
selectedIds:
|
|
312
|
+
selectedIds: K,
|
|
311
313
|
rows: [...U],
|
|
312
314
|
pagination: W ? {
|
|
313
315
|
page: W.page,
|
|
314
316
|
pageSize: W.pageSize,
|
|
315
317
|
total: W.total
|
|
316
318
|
} : null
|
|
317
|
-
}),
|
|
318
|
-
S &&
|
|
319
|
-
},
|
|
319
|
+
}), Kr = (e, t) => kn.run(e, (e) => t(Gr(), { signal: e })), qr = kn.isPending(ut), Jr = () => {
|
|
320
|
+
S && Kr(ut, S);
|
|
321
|
+
}, Yr = [..._ ?? [], ...S ? [..._ && _.length > 0 ? [{ sep: !0 }] : [], {
|
|
320
322
|
label: w.refresh,
|
|
321
|
-
icon: /* @__PURE__ */ d(
|
|
322
|
-
disabled:
|
|
323
|
-
onClick:
|
|
324
|
-
}] : []],
|
|
323
|
+
icon: /* @__PURE__ */ d(rt, { size: 16 }),
|
|
324
|
+
disabled: qr,
|
|
325
|
+
onClick: Jr
|
|
326
|
+
}] : []], Xr = typeof mt == "function" ? mt(Gr()) : mt, Zr = typeof gn == "function" ? gn(Gr()) : gn;
|
|
325
327
|
return /* @__PURE__ */ f("div", {
|
|
326
|
-
ref:
|
|
327
|
-
id:
|
|
328
|
-
style:
|
|
329
|
-
...a(o, "root", h, e("kapi-table-shell",
|
|
328
|
+
ref: yt,
|
|
329
|
+
id: vt,
|
|
330
|
+
style: _t,
|
|
331
|
+
...a(o, "root", h, e("kapi-table-shell", zt && "kapi-table-shell--card", pt && "kapi-table-shell--fill", Lr && "kapi-table-shell--cards", gt)),
|
|
330
332
|
children: [
|
|
331
|
-
|
|
333
|
+
ht === "top" && Wr,
|
|
332
334
|
/* @__PURE__ */ d(Je, {
|
|
333
335
|
classNames: h,
|
|
334
336
|
text: w,
|
|
335
|
-
filterable:
|
|
337
|
+
filterable: ln,
|
|
336
338
|
filter: F,
|
|
337
|
-
onFilterChange:
|
|
339
|
+
onFilterChange: qn,
|
|
338
340
|
visibleColumns: P,
|
|
339
|
-
manualFilter:
|
|
340
|
-
filterDebounce:
|
|
341
|
+
manualFilter: pn,
|
|
342
|
+
filterDebounce: mn,
|
|
341
343
|
shownCount: I.length,
|
|
342
344
|
totalCount: p.length,
|
|
343
|
-
content:
|
|
344
|
-
toolbarActions:
|
|
345
|
-
isPending:
|
|
346
|
-
context:
|
|
347
|
-
onRun:
|
|
348
|
-
refresh: S ?
|
|
349
|
-
refreshing:
|
|
350
|
-
onExportCsv:
|
|
345
|
+
content: Zr,
|
|
346
|
+
toolbarActions: _n,
|
|
347
|
+
isPending: kn.isPending,
|
|
348
|
+
context: Gr,
|
|
349
|
+
onRun: Kr,
|
|
350
|
+
refresh: S ? Jr : void 0,
|
|
351
|
+
refreshing: qr,
|
|
352
|
+
onExportCsv: hn ? Ir : void 0,
|
|
351
353
|
columns: C,
|
|
352
|
-
columnToggle:
|
|
353
|
-
columnPinning:
|
|
354
|
+
columnToggle: Yt,
|
|
355
|
+
columnPinning: $t,
|
|
354
356
|
visibility: j,
|
|
355
|
-
onShownColumnsChange:
|
|
357
|
+
onShownColumnsChange: zn,
|
|
356
358
|
pinned: N,
|
|
357
|
-
onPinnedChange:
|
|
359
|
+
onPinnedChange: Wn
|
|
358
360
|
}),
|
|
359
|
-
|
|
361
|
+
Lt !== void 0 && v && /* @__PURE__ */ d(Ye, {
|
|
360
362
|
classNames: h,
|
|
361
|
-
dataset:
|
|
362
|
-
notice:
|
|
363
|
-
shown:
|
|
363
|
+
dataset: Lt,
|
|
364
|
+
notice: ur,
|
|
365
|
+
shown: or.length,
|
|
364
366
|
clearLabel: w.datasetClear,
|
|
365
367
|
labels: w,
|
|
366
|
-
locale:
|
|
368
|
+
locale: wn
|
|
367
369
|
}),
|
|
368
370
|
/* @__PURE__ */ f("div", {
|
|
369
371
|
...a(o, "scrollArea", h, e(xe({
|
|
370
|
-
cortaDerecha:
|
|
371
|
-
cortaIzquierda:
|
|
372
|
-
rightEdge:
|
|
372
|
+
cortaDerecha: kr,
|
|
373
|
+
cortaIzquierda: Ar,
|
|
374
|
+
rightEdge: q || mr
|
|
373
375
|
}), k && "is-virtual-auto")),
|
|
374
376
|
ref: D,
|
|
375
377
|
tabIndex: 0,
|
|
376
|
-
style:
|
|
377
|
-
onScroll:
|
|
378
|
+
style: pt ? void 0 : { maxHeight: ft },
|
|
379
|
+
onScroll: Nr,
|
|
378
380
|
children: [
|
|
379
381
|
/* @__PURE__ */ f("table", {
|
|
380
|
-
ref:
|
|
381
|
-
...a(o, "table", h, `kapi-table2${y ? k ? " is-virtual-auto" : " is-virtual" : ""}${
|
|
382
|
+
ref: Hn,
|
|
383
|
+
...a(o, "table", h, `kapi-table2${y ? k ? " is-virtual-auto" : " is-virtual" : ""}${qt === "card" ? " kapi-table2--card" : ""}${Jt ? " kapi-table2--hover" : ""}`),
|
|
382
384
|
children: [
|
|
383
385
|
/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [
|
|
384
386
|
v && /* @__PURE__ */ f("th", {
|
|
385
|
-
className: `is-sticky kapi-cbcol${
|
|
387
|
+
className: `is-sticky kapi-cbcol${sr ? " kapi-cbcol--presets" : ""}`,
|
|
386
388
|
style: { insetInlineStart: 0 },
|
|
387
389
|
children: [/* @__PURE__ */ d("label", {
|
|
388
390
|
className: "kapi-check kapi-check--block",
|
|
389
391
|
children: /* @__PURE__ */ d("input", {
|
|
390
392
|
type: "checkbox",
|
|
391
|
-
checked:
|
|
393
|
+
checked: lr === "all",
|
|
392
394
|
ref: (e) => {
|
|
393
|
-
e && (e.indeterminate =
|
|
395
|
+
e && (e.indeterminate = lr === "some");
|
|
394
396
|
},
|
|
395
|
-
onChange: () =>
|
|
397
|
+
onChange: () => ir(Se(rr, or)),
|
|
396
398
|
"aria-label": w.selectAll
|
|
397
399
|
})
|
|
398
|
-
}),
|
|
400
|
+
}), sr && /* @__PURE__ */ d(De, {
|
|
399
401
|
label: null,
|
|
400
402
|
"aria-label": w.selectMatching,
|
|
401
403
|
variant: "ghost",
|
|
402
|
-
items:
|
|
404
|
+
items: cr
|
|
403
405
|
})]
|
|
404
406
|
}),
|
|
405
407
|
A && /* @__PURE__ */ d("th", {
|
|
@@ -411,111 +413,111 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
411
413
|
}),
|
|
412
414
|
P.map((t, n) => /* @__PURE__ */ f("th", {
|
|
413
415
|
"data-col": t.key,
|
|
414
|
-
className: e(Le(t, n,
|
|
416
|
+
className: e(Le(t, n, J), t.sortable && "is-sortable"),
|
|
415
417
|
"aria-sort": Ie(t, O),
|
|
416
418
|
style: {
|
|
417
|
-
...He(n,
|
|
419
|
+
...He(n, J),
|
|
418
420
|
...Re(t, "th", M),
|
|
419
421
|
textAlign: ne(t.align)
|
|
420
422
|
},
|
|
421
|
-
children: [ze(t, O,
|
|
423
|
+
children: [ze(t, O, jn, w), Br(t)]
|
|
422
424
|
}, t.key)),
|
|
423
|
-
|
|
424
|
-
ref:
|
|
425
|
-
className: Fe(
|
|
425
|
+
q && /* @__PURE__ */ d("th", {
|
|
426
|
+
ref: hr,
|
|
427
|
+
className: Fe(J),
|
|
426
428
|
children: w.actions
|
|
427
429
|
})
|
|
428
430
|
] }) }),
|
|
429
431
|
/* @__PURE__ */ f("tbody", { children: [
|
|
430
|
-
x && (
|
|
431
|
-
!x && U.length === 0 && Ve(
|
|
432
|
-
!x && U.length > 0 &&
|
|
432
|
+
x && (Dr > 0 ? Ur : Ve(X, Sn, !0)),
|
|
433
|
+
!x && U.length === 0 && Ve(X, xn),
|
|
434
|
+
!x && U.length > 0 && wr > 0 && /* @__PURE__ */ d("tr", {
|
|
433
435
|
"aria-hidden": !0,
|
|
434
|
-
style: { height:
|
|
436
|
+
style: { height: wr },
|
|
435
437
|
children: /* @__PURE__ */ d("td", {
|
|
436
|
-
colSpan:
|
|
438
|
+
colSpan: X,
|
|
437
439
|
className: "kapi-table-pad"
|
|
438
440
|
})
|
|
439
441
|
}),
|
|
440
|
-
!x &&
|
|
441
|
-
let n = e
|
|
442
|
+
!x && Er.map((e, t) => {
|
|
443
|
+
let n = G(e), r = !Ht || Ht(e), i = Or + Z + t + 1;
|
|
442
444
|
return /* @__PURE__ */ d(Qe, {
|
|
443
445
|
row: e,
|
|
444
446
|
id: n,
|
|
445
|
-
index:
|
|
446
|
-
selected:
|
|
447
|
-
selectLabel: v ? ge(e, P, i, w,
|
|
448
|
-
open: A &&
|
|
447
|
+
index: Z + t,
|
|
448
|
+
selected: rr.has(n),
|
|
449
|
+
selectLabel: v ? ge(e, P, i, w, wt) : "",
|
|
450
|
+
open: A && Fn.has(n),
|
|
449
451
|
canSelect: r,
|
|
450
|
-
clickSelect: v &&
|
|
451
|
-
clickable:
|
|
452
|
-
getRowProps:
|
|
453
|
-
rangeSelect:
|
|
452
|
+
clickSelect: v && Ct && r,
|
|
453
|
+
clickable: yn !== void 0,
|
|
454
|
+
getRowProps: bn,
|
|
455
|
+
rangeSelect: kt,
|
|
454
456
|
selectable: v,
|
|
455
457
|
expandable: A,
|
|
456
|
-
rowHeight: y ?
|
|
457
|
-
virtualIndex: k ?
|
|
458
|
+
rowHeight: y ? Mn : void 0,
|
|
459
|
+
virtualIndex: k ? Z + t : void 0,
|
|
458
460
|
columns: P,
|
|
459
|
-
layout:
|
|
461
|
+
layout: J,
|
|
460
462
|
widths: M,
|
|
461
463
|
text: w,
|
|
462
|
-
hasActions:
|
|
463
|
-
actions:
|
|
464
|
+
hasActions: q,
|
|
465
|
+
actions: xt,
|
|
464
466
|
hasRowMenu: g !== void 0,
|
|
465
|
-
renderSubComponent:
|
|
466
|
-
colSpan:
|
|
467
|
-
handlers:
|
|
467
|
+
renderSubComponent: Ut,
|
|
468
|
+
colSpan: X,
|
|
469
|
+
handlers: zr
|
|
468
470
|
}, n);
|
|
469
471
|
}),
|
|
470
|
-
!x && U.length > 0 &&
|
|
472
|
+
!x && U.length > 0 && Tr > 0 && /* @__PURE__ */ d("tr", {
|
|
471
473
|
"aria-hidden": !0,
|
|
472
|
-
style: { height:
|
|
474
|
+
style: { height: Tr },
|
|
473
475
|
children: /* @__PURE__ */ d("td", {
|
|
474
|
-
colSpan:
|
|
476
|
+
colSpan: X,
|
|
475
477
|
className: "kapi-table-pad"
|
|
476
478
|
})
|
|
477
479
|
})
|
|
478
480
|
] }),
|
|
479
|
-
!x &&
|
|
480
|
-
rows:
|
|
481
|
+
!x && Xr && Xr.length > 0 && /* @__PURE__ */ d($e, {
|
|
482
|
+
rows: Xr,
|
|
481
483
|
columns: P,
|
|
482
|
-
layout:
|
|
484
|
+
layout: J,
|
|
483
485
|
widths: M,
|
|
484
486
|
selectable: v,
|
|
485
487
|
expandable: A,
|
|
486
|
-
hasActions:
|
|
488
|
+
hasActions: q
|
|
487
489
|
})
|
|
488
490
|
]
|
|
489
491
|
}),
|
|
490
|
-
|
|
492
|
+
Tn && Yr.length > 0 && /* @__PURE__ */ d(Ee, {
|
|
491
493
|
open: !0,
|
|
492
|
-
x:
|
|
493
|
-
y:
|
|
494
|
-
items:
|
|
495
|
-
onClose: () =>
|
|
494
|
+
x: Tn.x,
|
|
495
|
+
y: Tn.y,
|
|
496
|
+
items: Yr,
|
|
497
|
+
onClose: () => En(null)
|
|
496
498
|
}),
|
|
497
|
-
E &&
|
|
499
|
+
E && Y && br.length > 0 && /* @__PURE__ */ d(Ee, {
|
|
498
500
|
open: !0,
|
|
499
501
|
x: E.x,
|
|
500
502
|
y: E.y,
|
|
501
|
-
items:
|
|
502
|
-
"aria-label": `${w.columnActions} ${typeof
|
|
503
|
-
onClose: () =>
|
|
503
|
+
items: br,
|
|
504
|
+
"aria-label": `${w.columnActions} ${typeof Y.label == "string" ? Y.label : Y.key}`,
|
|
505
|
+
onClose: () => On(null)
|
|
504
506
|
}),
|
|
505
507
|
T && /* @__PURE__ */ d(Ee, {
|
|
506
508
|
open: !0,
|
|
507
509
|
x: T.x,
|
|
508
510
|
y: T.y,
|
|
509
511
|
items: T.items,
|
|
510
|
-
onClose: () =>
|
|
512
|
+
onClose: () => Dn(null)
|
|
511
513
|
})
|
|
512
514
|
]
|
|
513
515
|
}),
|
|
514
|
-
|
|
515
|
-
W &&
|
|
516
|
+
ht === "bottom" && Wr,
|
|
517
|
+
W && $ && /* @__PURE__ */ d(Ne, {
|
|
516
518
|
...a(o, "pagination", h),
|
|
517
519
|
as: "div",
|
|
518
|
-
info:
|
|
520
|
+
info: $,
|
|
519
521
|
pageSize: W.pageSize,
|
|
520
522
|
total: W.total,
|
|
521
523
|
onPageChange: W.onPageChange,
|
|
@@ -527,6 +529,6 @@ function ct({ columns: ct, rows: p, keyField: m = "id", maxHeight: ut = "58vh",
|
|
|
527
529
|
]
|
|
528
530
|
});
|
|
529
531
|
}
|
|
530
|
-
var
|
|
532
|
+
var ut = "\0refresh";
|
|
531
533
|
//#endregion
|
|
532
|
-
export { Pe as DEFAULT_TABLE_LABELS,
|
|
534
|
+
export { Pe as DEFAULT_TABLE_LABELS, lt as KapiTable };
|