@kapiuara/ui 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -15
- package/README.md +338 -6
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +22 -22
- package/dist/components/data/KapiPaginationFooter.js +1 -1
- package/dist/components/data/KapiSheet.d.ts +105 -0
- package/dist/components/data/KapiSheet.js +75 -0
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFooter.d.ts +22 -0
- package/dist/components/data/KapiTableFooter.js +55 -0
- package/dist/components/data/KapiTableRow.js +53 -52
- package/dist/components/data/KapiTableToolbar.d.ts +4 -2
- package/dist/components/data/KapiTableToolbar.js +71 -69
- package/dist/components/data/index.d.ts +3 -1
- package/dist/components/data/tableCells.d.ts +5 -4
- package/dist/components/data/tableCells.js +48 -43
- package/dist/components/data/tableLogic.d.ts +2 -0
- package/dist/components/data/tableLogic.js +66 -66
- package/dist/components/data/tableSlots.d.ts +9 -0
- package/dist/components/data/tableSlots.js +12 -0
- package/dist/components/data/tableSpanLogic.d.ts +35 -0
- package/dist/components/data/tableSpanLogic.js +47 -0
- package/dist/components/data/tableTypes.d.ts +66 -1
- package/dist/components/data/useTableSelection.d.ts +4 -2
- package/dist/components/data/useTableSelection.js +27 -23
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/index.d.ts +7 -0
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiSelect.d.ts +12 -0
- package/dist/components/inputs/KapiSelect.js +215 -212
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/fieldLogic.d.ts +2 -2
- package/dist/components/inputs/index.d.ts +1 -1
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiBox.d.ts +31 -0
- package/dist/components/layout/KapiBox.js +26 -0
- package/dist/components/layout/KapiCard.d.ts +16 -4
- package/dist/components/layout/KapiCard.js +46 -34
- package/dist/components/layout/KapiCenter.d.ts +13 -0
- package/dist/components/layout/KapiCenter.js +23 -0
- package/dist/components/layout/KapiCol.d.ts +22 -0
- package/dist/components/layout/KapiCol.js +23 -0
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +82 -80
- package/dist/components/layout/KapiPanelParts.d.ts +11 -2
- package/dist/components/layout/KapiPanelParts.js +73 -56
- package/dist/components/layout/KapiRail.d.ts +10 -1
- package/dist/components/layout/KapiRail.js +123 -120
- package/dist/components/layout/KapiRoot.d.ts +35 -5
- package/dist/components/layout/KapiRoot.js +54 -39
- package/dist/components/layout/KapiShell.d.ts +36 -3
- package/dist/components/layout/KapiShell.js +53 -50
- package/dist/components/layout/cardSlots.d.ts +9 -0
- package/dist/components/layout/cardSlots.js +12 -0
- package/dist/components/layout/gridSpanLogic.d.ts +46 -0
- package/dist/components/layout/gridSpanLogic.js +39 -0
- package/dist/components/layout/index.d.ts +11 -4
- package/dist/components/layout/layoutPrimitives.d.ts +11 -0
- package/dist/components/layout/layoutPrimitives.js +12 -1
- package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
- package/dist/components/layout/pageHeaderSlots.js +15 -0
- package/dist/components/layout/railLogic.d.ts +16 -3
- package/dist/components/layout/railSlots.d.ts +12 -0
- package/dist/components/layout/railSlots.js +15 -0
- package/dist/components/layout/shellSlots.d.ts +6 -0
- package/dist/components/layout/shellSlots.js +9 -0
- package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
- package/dist/components/layout/useGridBreakpoint.js +35 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
- package/dist/components/navigation/KapiBreadcrumb.js +23 -16
- package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
- package/dist/components/navigation/KapiContextPanel.js +151 -135
- package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
- package/dist/components/navigation/KapiPanelGroup.js +66 -65
- package/dist/components/navigation/KapiTabs.d.ts +12 -0
- package/dist/components/navigation/KapiTabs.js +87 -71
- package/dist/components/navigation/MiniNavItem.d.ts +7 -2
- package/dist/components/navigation/MiniNavItem.js +41 -36
- package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
- package/dist/components/navigation/breadcrumbLogic.js +1 -1
- package/dist/components/navigation/navLink.d.ts +21 -0
- package/dist/components/navigation/navLink.js +26 -0
- package/dist/components/navigation/navLinkLogic.d.ts +18 -0
- package/dist/components/navigation/navLinkLogic.js +22 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +77 -75
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +123 -113
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +90 -0
- package/dist/components/slotCatalog.js +19 -0
- package/dist/components/slotsLogic.d.ts +34 -0
- package/dist/components/slotsLogic.js +18 -0
- package/dist/components/tone.d.ts +26 -0
- package/dist/components/tone.js +15 -14
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiEventCalendar.css +1 -1
- package/dist/css/components/data/KapiTable.css +1 -1
- package/dist/css/components/display/display.css +1 -1
- package/dist/css/components/display/typography.css +1 -0
- package/dist/css/components/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiButton.css +1 -1
- package/dist/css/components/inputs/KapiDatePicker.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/themeColorsLogic.d.ts +19 -0
- package/dist/hooks/themeColorsLogic.js +4 -2
- package/dist/hooks/themeDeriveLogic.d.ts +16 -0
- package/dist/hooks/themeDeriveLogic.js +27 -17
- package/dist/hooks/toneFamilyLogic.d.ts +122 -0
- package/dist/hooks/toneFamilyLogic.js +151 -0
- package/dist/hooks/useKapiTheme.d.ts +8 -2
- package/dist/hooks/useKapiTheme.js +116 -103
- package/dist/hooks/useToneFamilies.d.ts +30 -0
- package/dist/hooks/useToneFamilies.js +46 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +213 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +4 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { joinClasses as e } from "../rootProps.js";
|
|
3
|
-
import {
|
|
4
|
-
import { KapiSkeleton as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { ChevronDown as
|
|
3
|
+
import { columnAlign as t, readCell as n, stickySideOf as r } from "./tableLogic.js";
|
|
4
|
+
import { KapiSkeleton as i } from "../feedback/KapiSkeleton.js";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronDown as s, ChevronUp as c, ChevronsUpDown as l, Copy as u, Loader2 as d } from "lucide-react";
|
|
7
7
|
//#region src/components/data/tableCells.tsx
|
|
8
|
-
var
|
|
8
|
+
var f = (e, t) => {
|
|
9
9
|
try {
|
|
10
10
|
navigator.clipboard?.writeText(String(e))?.catch(() => void 0);
|
|
11
11
|
} catch {}
|
|
12
12
|
t?.(e);
|
|
13
|
-
},
|
|
13
|
+
}, p = (e, t, n) => {
|
|
14
14
|
let r = n[e.key];
|
|
15
15
|
return r === void 0 ? t === "th" ? {
|
|
16
16
|
width: e.flex ? "100%" : e.width,
|
|
@@ -24,44 +24,48 @@ var d = (e, t) => {
|
|
|
24
24
|
minWidth: r,
|
|
25
25
|
maxWidth: r
|
|
26
26
|
};
|
|
27
|
-
},
|
|
28
|
-
let
|
|
29
|
-
if (
|
|
30
|
-
}, h = (t,
|
|
31
|
-
let a =
|
|
32
|
-
return e(a && "is-sticky", a === "right" && "is-sticky-right", a === "left" &&
|
|
27
|
+
}, m = (e) => {
|
|
28
|
+
let n = t(e);
|
|
29
|
+
if (n) return `is-align-${n}${n === "start" ? " is-align-left" : n === "end" ? " is-align-right" : ""}`;
|
|
30
|
+
}, h = (t, n, i) => {
|
|
31
|
+
let a = r(t.sticky);
|
|
32
|
+
return e(a && "is-sticky", a === "right" && "is-sticky-right", a === "left" && n === i.lastLeft && "is-sticky-last", a === "right" && n === i.firstRight && "is-sticky-first-right", t.flex && "is-flex", m(t.align));
|
|
33
33
|
}, g = (e, t) => ({
|
|
34
34
|
insetInlineStart: t.lefts[e],
|
|
35
35
|
insetInlineEnd: t.rights[e]
|
|
36
|
-
}), _ = (e) => `kapi-actcol${e.firstRight >= 0 ? " is-joined" : ""}`, v = (e,
|
|
37
|
-
let s = e.render ? e.render(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
}), _ = (e) => `kapi-actcol${e.firstRight >= 0 ? " is-joined" : ""}`, v = (e, t, r, i) => {
|
|
37
|
+
let s = e.render ? e.render(t) : n(t, e.key), c = e.clamp === void 0 ? s : /* @__PURE__ */ a("span", {
|
|
38
|
+
className: "kapi-cell-clamp",
|
|
39
|
+
style: { "--kapi-cell-lines": String(e.clamp) },
|
|
40
|
+
children: s
|
|
41
|
+
});
|
|
42
|
+
if (!e.copyable) return c;
|
|
43
|
+
let l = e.copyValue ? e.copyValue(t) : n(t, e.key);
|
|
44
|
+
return /* @__PURE__ */ o("span", {
|
|
41
45
|
className: "kapi-cell",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ a("span", {
|
|
43
47
|
className: "kapi-cell__v",
|
|
44
|
-
children:
|
|
45
|
-
}), /* @__PURE__ */
|
|
48
|
+
children: c
|
|
49
|
+
}), /* @__PURE__ */ a("button", {
|
|
46
50
|
type: "button",
|
|
47
51
|
className: "kapi-cell__copy",
|
|
48
52
|
"aria-label": r.copy,
|
|
49
53
|
onClick: (e) => {
|
|
50
|
-
e.stopPropagation(),
|
|
54
|
+
e.stopPropagation(), f(l, i);
|
|
51
55
|
},
|
|
52
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ a(u, {
|
|
53
57
|
size: 13,
|
|
54
58
|
strokeWidth: 2
|
|
55
59
|
})
|
|
56
60
|
})]
|
|
57
61
|
});
|
|
58
|
-
}, y = (e) => e === "asc" ? /* @__PURE__ */
|
|
62
|
+
}, y = (e) => e === "asc" ? /* @__PURE__ */ a(c, {
|
|
59
63
|
size: 13,
|
|
60
64
|
strokeWidth: 2.4
|
|
61
|
-
}) : e === "desc" ? /* @__PURE__ */
|
|
65
|
+
}) : e === "desc" ? /* @__PURE__ */ a(s, {
|
|
62
66
|
size: 13,
|
|
63
67
|
strokeWidth: 2.4
|
|
64
|
-
}) : /* @__PURE__ */
|
|
68
|
+
}) : /* @__PURE__ */ a(l, {
|
|
65
69
|
size: 13,
|
|
66
70
|
strokeWidth: 2
|
|
67
71
|
}), b = (e, t) => t?.key === e.key ? t.direction : "none", x = (e, t) => {
|
|
@@ -70,25 +74,25 @@ var d = (e, t) => {
|
|
|
70
74
|
return n === "none" ? "none" : n === "asc" ? "ascending" : "descending";
|
|
71
75
|
}, S = (e, t, n, r) => {
|
|
72
76
|
if (!e.sortable) return e.label;
|
|
73
|
-
let
|
|
74
|
-
return /* @__PURE__ */
|
|
77
|
+
let i = b(e, t);
|
|
78
|
+
return /* @__PURE__ */ o("button", {
|
|
75
79
|
type: "button",
|
|
76
|
-
className: `kapi-thsort${
|
|
80
|
+
className: `kapi-thsort${i === "none" ? "" : " is-active"}`,
|
|
77
81
|
onClick: () => n(e.key),
|
|
78
82
|
title: typeof e.label == "string" ? `${r.sortBy} ${e.label}` : void 0,
|
|
79
|
-
children: [/* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ a("span", { children: e.label }), y(i)]
|
|
80
84
|
});
|
|
81
|
-
}, C = (e, t, n = !1) => /* @__PURE__ */
|
|
85
|
+
}, C = (e, t, n = !1) => /* @__PURE__ */ a("tr", {
|
|
82
86
|
className: "kapi-table-staterow",
|
|
83
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ o("td", {
|
|
84
88
|
colSpan: e,
|
|
85
89
|
className: "kapi-table-state",
|
|
86
|
-
children: [n && /* @__PURE__ */
|
|
90
|
+
children: [n && /* @__PURE__ */ a(d, {
|
|
87
91
|
size: 16,
|
|
88
92
|
strokeWidth: 2.2,
|
|
89
93
|
className: "kapi-table-spin",
|
|
90
94
|
"aria-hidden": !0
|
|
91
|
-
}), /* @__PURE__ */
|
|
95
|
+
}), /* @__PURE__ */ a("span", { children: t })]
|
|
92
96
|
})
|
|
93
97
|
}), w = [
|
|
94
98
|
96,
|
|
@@ -96,26 +100,27 @@ var d = (e, t) => {
|
|
|
96
100
|
84,
|
|
97
101
|
60
|
|
98
102
|
], T = (e, t, n) => {
|
|
99
|
-
let
|
|
103
|
+
let r = e.flex ? `${[
|
|
100
104
|
70,
|
|
101
105
|
55,
|
|
102
106
|
80
|
|
103
107
|
][n % 3]}%` : Math.max(32, Math.min(w[(t + n) % w.length] ?? 72, (e.width ?? 120) - 36));
|
|
104
|
-
return /* @__PURE__ */ i
|
|
105
|
-
width:
|
|
108
|
+
return /* @__PURE__ */ a(i, {
|
|
109
|
+
width: r,
|
|
106
110
|
height: 14,
|
|
107
111
|
radius: 6
|
|
108
112
|
});
|
|
109
|
-
}, E = (e,
|
|
113
|
+
}, E = (e, n, r, i, o, s, c, l) => /* @__PURE__ */ a("td", {
|
|
110
114
|
"data-col": e.key,
|
|
111
|
-
|
|
115
|
+
colSpan: l !== void 0 && l > 1 ? l : void 0,
|
|
116
|
+
className: h(e, n, i),
|
|
112
117
|
style: {
|
|
113
|
-
...g(
|
|
114
|
-
...
|
|
115
|
-
textAlign:
|
|
118
|
+
...g(n, i),
|
|
119
|
+
...p(e, "td", o),
|
|
120
|
+
textAlign: t(e.align)
|
|
116
121
|
},
|
|
117
122
|
"data-label": typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : void 0,
|
|
118
|
-
children: v(e,
|
|
123
|
+
children: v(e, r, s, c)
|
|
119
124
|
}, e.key);
|
|
120
125
|
//#endregion
|
|
121
|
-
export { _ as actColClass, x as ariaSortOf, E as bodyCell, h as cellClass,
|
|
126
|
+
export { _ as actColClass, x as ariaSortOf, E as bodyCell, h as cellClass, t as columnAlign, p as columnBoxStyle, f as copyToClipboard, S as headerContent, v as renderCell, T as skeletonBar, b as sortDirectionOf, y as sortIcon, C as stateRow, g as stickyInset };
|
|
@@ -18,6 +18,8 @@ export type StickyColumnInfo = {
|
|
|
18
18
|
sticky?: KapiTableSticky | undefined;
|
|
19
19
|
width?: number | undefined;
|
|
20
20
|
};
|
|
21
|
+
/** Alineación lógica de una columna o celda: `left`/`right` son alias de `start`/`end`. */
|
|
22
|
+
export declare const columnAlign: (align: "start" | "center" | "end" | "left" | "right" | undefined) => "start" | "center" | "end" | undefined;
|
|
21
23
|
/** Lado donde está clavada una columna (`null` si no es fija). `true` cuenta como izquierda. */
|
|
22
24
|
export declare const stickySideOf: (sticky: KapiTableSticky | undefined) => KapiTableStickySide | null;
|
|
23
25
|
/**
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import "../../hooks/rangeSelectLogic.js";
|
|
2
|
-
var e = (e) => e === "right" ? "right" : e ? "left" : null,
|
|
2
|
+
var e = (e) => e === "left" ? "start" : e === "right" ? "end" : e, t = (e) => e === "right" ? "right" : e ? "left" : null, n = (e, n = 0, r = 170) => {
|
|
3
3
|
let i = n;
|
|
4
|
-
return
|
|
5
|
-
if (e
|
|
4
|
+
return e.map((e) => {
|
|
5
|
+
if (t(e.sticky) !== "left") return;
|
|
6
6
|
let n = i;
|
|
7
|
-
return i +=
|
|
7
|
+
return i += e.width || r, n;
|
|
8
8
|
});
|
|
9
|
-
},
|
|
10
|
-
let i =
|
|
11
|
-
for (let n =
|
|
12
|
-
let o =
|
|
13
|
-
|
|
9
|
+
}, r = (e, n = 0, r = 170) => {
|
|
10
|
+
let i = e.map(() => void 0), a = n;
|
|
11
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
12
|
+
let o = e[n];
|
|
13
|
+
t(o.sticky) === "right" && (i[n] = a, a += o.width || r);
|
|
14
14
|
}
|
|
15
15
|
return i;
|
|
16
|
-
},
|
|
16
|
+
}, i = (e) => {
|
|
17
17
|
let n = -1;
|
|
18
|
-
return
|
|
19
|
-
e
|
|
18
|
+
return e.forEach((e, r) => {
|
|
19
|
+
t(e.sticky) === "left" && (n = r);
|
|
20
20
|
}), n;
|
|
21
|
-
},
|
|
21
|
+
}, a = (e) => e.findIndex((e) => t(e.sticky) === "right"), o = ({ page: e, pageSize: t, total: n }) => {
|
|
22
22
|
let r = Math.max(1, t), i = Math.max(1, Math.ceil(n / r)), a = Math.min(Math.max(1, e), i);
|
|
23
23
|
return {
|
|
24
24
|
totalPages: i,
|
|
@@ -28,98 +28,98 @@ var e = (e) => e === "right" ? "right" : e ? "left" : null, t = (t, n = 0, r = 1
|
|
|
28
28
|
canNext: a < i,
|
|
29
29
|
page: a
|
|
30
30
|
};
|
|
31
|
-
},
|
|
31
|
+
}, s = (e) => e == null || typeof e == "number" && Number.isNaN(e) || e instanceof Date && Number.isNaN(e.getTime()), c = (e) => e instanceof Date ? e.getTime() : typeof e == "boolean" ? +!!e : e, l = /* @__PURE__ */ new Map(), u = (e) => {
|
|
32
32
|
if (!e) return;
|
|
33
|
-
if (
|
|
33
|
+
if (l.has(e)) return l.get(e);
|
|
34
34
|
let t;
|
|
35
35
|
try {
|
|
36
36
|
t = Intl.getCanonicalLocales(e)[0];
|
|
37
37
|
} catch {
|
|
38
38
|
t = void 0;
|
|
39
39
|
}
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
let t = e ?? "", n =
|
|
40
|
+
return l.set(e, t), t;
|
|
41
|
+
}, d = /* @__PURE__ */ new Map(), f = (e) => {
|
|
42
|
+
let t = e ?? "", n = d.get(t);
|
|
43
43
|
return n || (n = new Intl.Collator(e, {
|
|
44
44
|
numeric: !0,
|
|
45
45
|
sensitivity: "base"
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
let i =
|
|
46
|
+
}), d.set(t, n)), n;
|
|
47
|
+
}, p = (e, t, n = "asc", r) => {
|
|
48
|
+
let i = s(e), a = s(t);
|
|
49
49
|
if (i || a) return i && a ? 0 : i ? 1 : -1;
|
|
50
|
-
let
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
let i =
|
|
50
|
+
let o = c(e), l = c(t), d;
|
|
51
|
+
return d = typeof o == "number" && typeof l == "number" ? o - l : f(u(r)).compare(String(o), String(l)), n === "desc" ? -d : d;
|
|
52
|
+
}, m = (e, t, n, r) => {
|
|
53
|
+
let i = u(r);
|
|
54
54
|
return e.map((e, n) => ({
|
|
55
55
|
row: e,
|
|
56
56
|
index: n,
|
|
57
57
|
value: t(e)
|
|
58
|
-
})).sort((e, t) =>
|
|
59
|
-
},
|
|
58
|
+
})).sort((e, t) => p(e.value, t.value, n, i) || e.index - t.index).map((e) => e.row);
|
|
59
|
+
}, h = (e, t) => e[t], g = (e, t, n, r) => {
|
|
60
60
|
if (!n) return e;
|
|
61
61
|
let i = t.find((e) => e.key === n.key);
|
|
62
|
-
return !i || !i.sortable ? e :
|
|
63
|
-
},
|
|
64
|
-
let { from: r, to: i } =
|
|
62
|
+
return !i || !i.sortable ? e : m(e, (e) => i.sortValue ? i.sortValue(e) : h(e, i.key), n.direction, r);
|
|
63
|
+
}, _ = (e, t, n) => {
|
|
64
|
+
let { from: r, to: i } = o({
|
|
65
65
|
page: t,
|
|
66
66
|
pageSize: n,
|
|
67
67
|
total: e.length
|
|
68
68
|
});
|
|
69
69
|
return r === 0 ? [] : e.slice(r - 1, i);
|
|
70
|
-
},
|
|
70
|
+
}, v = (e, t) => !e || e.key !== t ? {
|
|
71
71
|
key: t,
|
|
72
72
|
direction: "asc"
|
|
73
73
|
} : e.direction === "asc" ? {
|
|
74
74
|
key: t,
|
|
75
75
|
direction: "desc"
|
|
76
|
-
} : null,
|
|
76
|
+
} : null, y = (e, t) => {
|
|
77
77
|
if (e.length === 0) return "none";
|
|
78
78
|
let n = 0;
|
|
79
79
|
for (let r of e) t.has(r) && (n += 1);
|
|
80
80
|
return n === 0 ? "none" : n === e.length ? "all" : "some";
|
|
81
|
-
},
|
|
81
|
+
}, b = (e, t) => {
|
|
82
82
|
let n = new Set(e);
|
|
83
83
|
return n.has(t) ? n.delete(t) : n.add(t), n;
|
|
84
|
-
},
|
|
84
|
+
}, x = (e, t) => {
|
|
85
85
|
let n = new Set(e);
|
|
86
|
-
return
|
|
87
|
-
},
|
|
86
|
+
return y(t, e) === "all" ? t.forEach((e) => n.delete(e)) : t.forEach((e) => n.add(e)), n;
|
|
87
|
+
}, S = (e, t, n) => {
|
|
88
88
|
let r = new Set(t), i = /* @__PURE__ */ new Set();
|
|
89
89
|
return e.forEach((e) => {
|
|
90
90
|
r.has(e) || i.add(e);
|
|
91
91
|
}), n.forEach((e) => i.add(e)), i;
|
|
92
|
-
},
|
|
92
|
+
}, C = (e, t) => e.filter((e) => t?.[e.key] !== !1), w = (e, t) => ({
|
|
93
93
|
...e,
|
|
94
94
|
[t]: e?.[t] === !1
|
|
95
|
-
}),
|
|
96
|
-
left:
|
|
97
|
-
right:
|
|
98
|
-
}),
|
|
95
|
+
}), T = (e) => ({
|
|
96
|
+
left: e.filter((e) => t(e.sticky) === "left").map((e) => e.key),
|
|
97
|
+
right: e.filter((e) => t(e.sticky) === "right").map((e) => e.key)
|
|
98
|
+
}), E = (e, n) => {
|
|
99
99
|
let r = new Set(n.left), i = new Set(n.right), a = {
|
|
100
100
|
left: [],
|
|
101
101
|
free: [],
|
|
102
102
|
right: []
|
|
103
103
|
};
|
|
104
|
-
for (let n of
|
|
105
|
-
let
|
|
104
|
+
for (let n of e) {
|
|
105
|
+
let e = r.has(n.key) ? "left" : i.has(n.key) ? "right" : null, o = e === t(n.sticky) ? n : {
|
|
106
106
|
...n,
|
|
107
|
-
sticky:
|
|
107
|
+
sticky: e === "right" ? "right" : e === "left"
|
|
108
108
|
};
|
|
109
|
-
a[
|
|
109
|
+
a[e ?? "free"].push(o);
|
|
110
110
|
}
|
|
111
111
|
return [
|
|
112
112
|
...a.left,
|
|
113
113
|
...a.free,
|
|
114
114
|
...a.right
|
|
115
115
|
];
|
|
116
|
-
},
|
|
116
|
+
}, D = (e, t, n) => {
|
|
117
117
|
let r = e.left.filter((e) => e !== t), i = e.right.filter((e) => e !== t);
|
|
118
118
|
return n === "left" && r.push(t), n === "right" && i.push(t), {
|
|
119
119
|
left: r,
|
|
120
120
|
right: i
|
|
121
121
|
};
|
|
122
|
-
},
|
|
122
|
+
}, O = (e, t, n) => {
|
|
123
123
|
let r = t === "left" ? "right" : "left", i = new Set(n), a = e[t].filter((e) => i.has(e)), o = n.filter((n) => !e[t].includes(n)), s = [...a, ...o], c = e[r].filter((e) => !i.has(e));
|
|
124
124
|
return t === "left" ? {
|
|
125
125
|
left: s,
|
|
@@ -128,19 +128,19 @@ var e = (e) => e === "right" ? "right" : e ? "left" : null, t = (t, n = 0, r = 1
|
|
|
128
128
|
left: c,
|
|
129
129
|
right: s
|
|
130
130
|
};
|
|
131
|
-
},
|
|
131
|
+
}, k = 16, A = {
|
|
132
132
|
side: "bottom",
|
|
133
133
|
align: "end",
|
|
134
134
|
offset: 6,
|
|
135
135
|
flip: "auto",
|
|
136
136
|
shift: !1
|
|
137
|
-
},
|
|
137
|
+
}, j = {
|
|
138
138
|
width: 240,
|
|
139
139
|
height: 370
|
|
140
|
-
},
|
|
140
|
+
}, M = (e, t, n, r = k) => {
|
|
141
141
|
let i = e === "top" ? t.top - r : n - t.bottom - r;
|
|
142
142
|
return Math.max(220, Math.min(i, 560));
|
|
143
|
-
},
|
|
143
|
+
}, N = (e, t) => {
|
|
144
144
|
let n = [];
|
|
145
145
|
if (e.sortable) {
|
|
146
146
|
let r = ["sort-asc", "sort-desc"];
|
|
@@ -151,30 +151,30 @@ var e = (e) => e === "right" ? "right" : e ? "left" : null, t = (t, n = 0, r = 1
|
|
|
151
151
|
r !== "left" && i.push("pin-left"), r !== "right" && i.push("pin-right"), r && i.push("unpin"), n.push(i);
|
|
152
152
|
}
|
|
153
153
|
return t.canHide && e.hideable !== !1 && t.visibleCount > 1 && n.push(["hide"]), n;
|
|
154
|
-
},
|
|
154
|
+
}, P = ({ cortaDerecha: e, cortaIzquierda: t, rightEdge: n }) => `kapi-tablewrap${e && !n ? " is-corta-derecha" : ""}${t ? " is-shaded-start" : ""}${e ? " is-shaded-end" : ""}`, F = (e, t = 60) => Math.max(t, Math.round(e)), I = (e, t) => t?.[e.key] ?? e.width, L = (e, t, n, r, i = 60) => ({
|
|
155
155
|
...e,
|
|
156
|
-
[t]:
|
|
157
|
-
}),
|
|
156
|
+
[t]: F(n + r, i)
|
|
157
|
+
}), R = (e) => e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().trim(), z = (e) => R(e).split(/\s+/).filter(Boolean), B = (e) => e == null ? "" : e instanceof Date ? Number.isNaN(e.getTime()) ? "" : e.toISOString() : R(String(e)), V = (e, t) => {
|
|
158
158
|
if (t.length === 0) return !0;
|
|
159
|
-
let n = e.map(
|
|
159
|
+
let n = e.map(B);
|
|
160
160
|
return t.every((e) => n.some((t) => t.includes(e)));
|
|
161
|
-
},
|
|
162
|
-
let r =
|
|
163
|
-
return r.length === 0 ? e : e.filter((e) =>
|
|
164
|
-
},
|
|
161
|
+
}, H = (e, t, n) => {
|
|
162
|
+
let r = z(n);
|
|
163
|
+
return r.length === 0 ? e : e.filter((e) => V(t(e), r));
|
|
164
|
+
}, U = (e) => z(e.text).length > 0, W = (e, t) => {
|
|
165
165
|
let n = e.filter((e) => e.filterable !== !1), r = t === null ? void 0 : n.find((e) => e.key === t);
|
|
166
166
|
return r ? [r] : n;
|
|
167
|
-
},
|
|
167
|
+
}, G = /^[+-]?\d+([.,]\d+)?$/, K = /^[=+\-@\t\r]/, q = (e, t = ",") => {
|
|
168
168
|
if (e == null) return "";
|
|
169
169
|
let n;
|
|
170
|
-
return n = e instanceof Date ? Number.isNaN(e.getTime()) ? "" : e.toISOString() : String(e), typeof e == "string" &&
|
|
171
|
-
},
|
|
170
|
+
return n = e instanceof Date ? Number.isNaN(e.getTime()) ? "" : e.toISOString() : String(e), typeof e == "string" && K.test(n) && !G.test(n) && (n = `'${n}`), n.includes("\"") || n.includes(t) || /[\r\n]/.test(n) ? `"${n.replace(/"/g, "\"\"")}"` : n;
|
|
171
|
+
}, J = (e, t, n = ",") => [e, ...t].map((e) => e.map((e) => q(e, n)).join(n)).join("\r\n"), Y = (e) => typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : e.key, X = (e) => {
|
|
172
172
|
let t = e?.trim() || "tabla";
|
|
173
173
|
return /\.csv$/i.test(t) ? t : `${t}.csv`;
|
|
174
|
-
},
|
|
174
|
+
}, Z = (e) => W(e, null).map((e) => ({
|
|
175
175
|
value: e.key,
|
|
176
|
-
label:
|
|
177
|
-
})),
|
|
176
|
+
label: Y(e)
|
|
177
|
+
})), Q = (e, t, n, r, i) => {
|
|
178
178
|
let a;
|
|
179
179
|
if (i) a = i(e);
|
|
180
180
|
else {
|
|
@@ -184,4 +184,4 @@ var e = (e) => e === "right" ? "right" : e ? "left" : null, t = (t, n = 0, r = 1
|
|
|
184
184
|
return a?.trim() ? `${r.selectRowNamed} ${a.trim()}` : `${r.selectRow} ${n}`;
|
|
185
185
|
};
|
|
186
186
|
//#endregion
|
|
187
|
-
export {
|
|
187
|
+
export { j as COLUMNS_PANEL_ESTIMATE, A as COLUMNS_PANEL_PLACEMENT, J as buildCsv, F as clampColumnWidth, e as columnAlign, M as columnsPanelMaxHeight, p as compareSortValues, o as computePagination, n as computeStickyOffsets, r as computeStickyRightOffsets, q as csvCell, X as csvFileName, Y as csvHeaderOf, I as effectiveColumnWidth, Z as filterColumnOptions, H as filterRows, W as filterSearchColumns, z as filterTerms, a as firstRightStickyIndex, N as headerMenuActions, U as isFilterActive, i as lastStickyIndex, v as nextSortState, R as normalizeFilterText, _ as paginateRows, E as pinColumns, h as readCell, L as resizeColumn, V as rowMatchesFilter, Q as rowSelectLabel, u as safeLocale, S as selectOnlyWithin, y as selectionState, D as setColumnPin, O as setSidePins, m as sortRows, g as sortRowsByColumn, T as stickyKeysOf, t as stickySideOf, P as tableWrapClass, x as toggleAllIds, w as toggleColumnVisibility, b as toggleId, C as visibleColumnsOf };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Partes de `table` (ver `slotCatalog.ts` para el contrato). Vive junto al componente para que su CSS lo siga. */
|
|
2
|
+
export declare const TABLE_SLOTS: import("../slotsLogic.js").SlotTable<"table", {
|
|
3
|
+
readonly root: "kapi-table-shell";
|
|
4
|
+
readonly toolbar: "kapi-tabletools";
|
|
5
|
+
readonly scrollArea: null;
|
|
6
|
+
readonly table: "kapi-table2";
|
|
7
|
+
readonly datasetNotice: "kapi-table__dataset";
|
|
8
|
+
readonly pagination: "kapi-tablefoot";
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineSlots as e } from "../slotsLogic.js";
|
|
2
|
+
//#region src/components/data/tableSlots.ts
|
|
3
|
+
var t = e("table", {
|
|
4
|
+
root: "kapi-table-shell",
|
|
5
|
+
toolbar: "kapi-tabletools",
|
|
6
|
+
scrollArea: null,
|
|
7
|
+
table: "kapi-table2",
|
|
8
|
+
datasetNotice: "kapi-table__dataset",
|
|
9
|
+
pagination: "kapi-tablefoot"
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as TABLE_SLOTS };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type KapiTableSticky } from "./tableLogic.js";
|
|
2
|
+
import type { KapiTableFooterCell } from "./tableTypes.js";
|
|
3
|
+
/** Lo mínimo que mira `rowColSpans` de una columna. */
|
|
4
|
+
type SpanColumn<T> = {
|
|
5
|
+
key: string;
|
|
6
|
+
sticky?: KapiTableSticky | undefined;
|
|
7
|
+
colSpan?: ((row: T) => number | undefined) | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Cuántas columnas ocupa la celda de cada columna visible en una fila: `1` es una celda común, `n > 1`
|
|
11
|
+
* es la celda que se expande y `0` es una columna tapada por la de su izquierda (no se dibuja).
|
|
12
|
+
*
|
|
13
|
+
* Una columna FIJADA nunca se expande ni queda tapada: su `left`/`right` se calcula suponiendo una
|
|
14
|
+
* celda por columna, así que un span que la cruzara la dejaría desalineada de su encabezado. El span
|
|
15
|
+
* corta antes de la primera fijada que encuentra.
|
|
16
|
+
*/
|
|
17
|
+
export declare const rowColSpans: <T>(columns: ReadonlyArray<SpanColumn<T>>, row: T) => number[];
|
|
18
|
+
/** Un tramo del pie: la celda (o `null` = relleno vacío), la columna visible donde empieza y cuántas ocupa. */
|
|
19
|
+
export type FooterSlot = {
|
|
20
|
+
start: number;
|
|
21
|
+
span: number;
|
|
22
|
+
cell: KapiTableFooterCell | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Reparte las celdas de una fila del pie entre las columnas visibles, de izquierda a derecha.
|
|
26
|
+
*
|
|
27
|
+
* - Una celda sin `column` empieza donde terminó la anterior; con `column`, en esa columna, y el hueco
|
|
28
|
+
* que queda antes se rellena. Así el total sigue bajo su columna aunque el usuario oculte otras.
|
|
29
|
+
* - Una celda anclada a una columna que no está visible se omite: no hay dónde ponerla.
|
|
30
|
+
* - Nunca se superponen (una celda que apunta antes del cursor empieza en el cursor) ni se pasan del
|
|
31
|
+
* borde (el span se acota; lo que sobra después del último casillero se descarta).
|
|
32
|
+
* - Lo que no cubre ninguna celda se rellena, así la fila siempre suma todas las columnas.
|
|
33
|
+
*/
|
|
34
|
+
export declare const layoutFooterRow: (cells: ReadonlyArray<KapiTableFooterCell>, columnKeys: ReadonlyArray<string>) => FooterSlot[];
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { stickySideOf as e } from "./tableLogic.js";
|
|
2
|
+
//#region src/components/data/tableSpanLogic.ts
|
|
3
|
+
var t = (e) => e !== void 0 && Number.isFinite(e) && e >= 1 ? Math.floor(e) : 1, n = (n, r) => {
|
|
4
|
+
let i = n.map(() => 1);
|
|
5
|
+
for (let a = 0; a < n.length;) {
|
|
6
|
+
let o = n[a], s = t(o.colSpan?.(r));
|
|
7
|
+
if (s === 1 || e(o.sticky)) {
|
|
8
|
+
a += 1;
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
let c = 1;
|
|
12
|
+
for (; c < s && a + c < n.length && !e(n[a + c].sticky);) c += 1;
|
|
13
|
+
i[a] = c;
|
|
14
|
+
for (let e = 1; e < c; e += 1) i[a + e] = 0;
|
|
15
|
+
a += c;
|
|
16
|
+
}
|
|
17
|
+
return i;
|
|
18
|
+
}, r = (e, n) => {
|
|
19
|
+
let r = n.length, i = [], a = 0;
|
|
20
|
+
for (let o of e) {
|
|
21
|
+
if (a >= r) break;
|
|
22
|
+
let e = a;
|
|
23
|
+
if (o.column !== void 0) {
|
|
24
|
+
let t = n.indexOf(o.column);
|
|
25
|
+
if (t < 0) continue;
|
|
26
|
+
e = Math.max(t, a);
|
|
27
|
+
}
|
|
28
|
+
e > a && i.push({
|
|
29
|
+
start: a,
|
|
30
|
+
span: e - a,
|
|
31
|
+
cell: null
|
|
32
|
+
});
|
|
33
|
+
let s = Math.min(t(o.colSpan), r - e);
|
|
34
|
+
i.push({
|
|
35
|
+
start: e,
|
|
36
|
+
span: s,
|
|
37
|
+
cell: o
|
|
38
|
+
}), a = e + s;
|
|
39
|
+
}
|
|
40
|
+
return a < r && i.push({
|
|
41
|
+
start: a,
|
|
42
|
+
span: r - a,
|
|
43
|
+
cell: null
|
|
44
|
+
}), i;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { r as layoutFooterRow, n as rowColSpans };
|
|
@@ -3,6 +3,7 @@ import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
|
3
3
|
import type { KapiMenuItem } from "../overlays/KapiContextMenu.js";
|
|
4
4
|
import type { KapiMenuItemTone } from "../tone.js";
|
|
5
5
|
import type { KapiRootProps } from "../rootProps.js";
|
|
6
|
+
import type { KapiClassNames } from "../slotCatalog.js";
|
|
6
7
|
import type { KapiTableLabels } from "./tableLabels.js";
|
|
7
8
|
import type { KapiTableRowAttributes } from "./rowClickLogic.js";
|
|
8
9
|
import type { KapiTableColumnPinning, KapiTableColumnVisibility, KapiTableColumnWidths, KapiTableFilterState, KapiTableSortState, KapiTableSortValue, KapiTableSticky } from "./tableLogic.js";
|
|
@@ -42,6 +43,26 @@ type KapiTableColumnBase<T> = {
|
|
|
42
43
|
resizable?: boolean | undefined;
|
|
43
44
|
/** Ancho mínimo (px) al redimensionar. Default 60. */
|
|
44
45
|
minWidth?: number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Acota la celda a N líneas y recorta con elipsis lo que sobra. Sin esto, una celda larga estira
|
|
48
|
+
* su fila sin límite (con `flex`) o empuja la tabla a lo ancho (sin él).
|
|
49
|
+
*
|
|
50
|
+
* Un listado es para RECORRER: una fila que crece sola rompe el recorrido, y lo rompe de forma
|
|
51
|
+
* impredecible porque el alto pasa a depender de qué le tocó a esa página. Medido en una app
|
|
52
|
+
* real: una fila de 296px al lado de otras de 62.
|
|
53
|
+
*
|
|
54
|
+
* `2` suele ser el número: con UNA sola línea, dos valores que comparten prefijo se cortan en el
|
|
55
|
+
* mismo punto y se leen idénticos, así que la columna deja de distinguir.
|
|
56
|
+
*/
|
|
57
|
+
clamp?: number | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Cuántas columnas ocupa la celda de ESTA columna en una fila (`undefined` o `1` = una). Las columnas
|
|
60
|
+
* que tapa a su derecha no dibujan celda en esa fila: sirve para un renglón de sección («ACTIVO») que
|
|
61
|
+
* recorre toda la fila, o para un subtotal que se lee mejor ancho. Se acota a las columnas visibles
|
|
62
|
+
* que quedan y no cruza una columna fijada (`sticky`): la fijada conserva su celda, y una columna
|
|
63
|
+
* fijada tampoco se expande.
|
|
64
|
+
*/
|
|
65
|
+
colSpan?: ((row: T) => number | undefined) | undefined;
|
|
45
66
|
/** Entra en el filtro de la tabla (en "Todas" y en el selector de columna). Default `true`. */
|
|
46
67
|
filterable?: boolean | undefined;
|
|
47
68
|
/** Texto con el que compara el filtro, p. ej. para celdas que muestran un badge (default: `row[key]`). */
|
|
@@ -49,6 +70,34 @@ type KapiTableColumnBase<T> = {
|
|
|
49
70
|
/** Valor exportado al CSV (default: `copyValue` o `row[key]`). */
|
|
50
71
|
csvValue?: ((row: T) => KapiTableCellValue) | undefined;
|
|
51
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Una celda del pie de `KapiTable` (`footer`). Las celdas de una fila se reparten de izquierda a derecha
|
|
75
|
+
* sobre las columnas visibles; la columna de checkboxes, la del expansor y la de acciones no cuentan: se
|
|
76
|
+
* rellenan solas.
|
|
77
|
+
*/
|
|
78
|
+
export type KapiTableFooterCell = {
|
|
79
|
+
/** Contenido de la celda (un total, una etiqueta, un nodo). */
|
|
80
|
+
content: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Cuántas columnas ocupa (`1` por defecto). Se acota a las columnas visibles que quedan en la fila;
|
|
83
|
+
* si cruza una columna fijada (`sticky`), esa celda no queda fija.
|
|
84
|
+
*/
|
|
85
|
+
colSpan?: number | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* `key` de la columna donde empieza la celda. Sin esto, empieza donde terminó la anterior. Con esto el
|
|
88
|
+
* total sigue bajo su columna aunque se oculten otras; si la columna está oculta, la celda no se dibuja.
|
|
89
|
+
*/
|
|
90
|
+
column?: string | undefined;
|
|
91
|
+
/** Alineación del contenido. Default: la de la columna donde empieza la celda. */
|
|
92
|
+
align?: KapiTableColumnBase<never>["align"] | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Dibuja un `<th scope="row">` en vez de un `<td>`: la etiqueta de la fila («Total activo»), que
|
|
95
|
+
* así queda asociada por los lectores de pantalla a las cifras que la acompañan.
|
|
96
|
+
*/
|
|
97
|
+
header?: boolean | undefined;
|
|
98
|
+
};
|
|
99
|
+
/** Una fila del pie: sus celdas, de izquierda a derecha. */
|
|
100
|
+
export type KapiTableFooterRow = ReadonlyArray<KapiTableFooterCell>;
|
|
52
101
|
/**
|
|
53
102
|
* Columna de `KapiTable<T>`. Sin `render`, `key` tiene que ser una propiedad de la fila (es lo que se
|
|
54
103
|
* muestra, y un error de tipeo no compila); con `render`, `key` es un identificador libre.
|
|
@@ -261,6 +310,8 @@ export type KapiTableClientPagination = {
|
|
|
261
310
|
*/
|
|
262
311
|
showEdges?: boolean | undefined;
|
|
263
312
|
};
|
|
313
|
+
/** Partes de `KapiTable` que acepta `classNames`: `root`, `toolbar`, `scrollArea`, `table` y `pagination`. */
|
|
314
|
+
export type KapiTableClassNames = KapiClassNames<"table">;
|
|
264
315
|
/** `className`/`style`/`id` (`KapiRootProps`) van a la carcasa `.kapi-table-shell` (herramientas + tabla + pie). */
|
|
265
316
|
/**
|
|
266
317
|
* Lo que puede ser el valor de una fila que la identifica. Es `string | number` y no `unknown` a
|
|
@@ -299,10 +350,24 @@ export type KapiTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyField
|
|
|
299
350
|
* scrollea internamente, y el footer queda fijo abajo. Con `fill`, `maxHeight` se ignora.
|
|
300
351
|
*/
|
|
301
352
|
fill?: boolean | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* Pie de la tabla: una o varias filas de totales que quedan fijas abajo del área con scroll. Una
|
|
355
|
+
* función recibe lo que se ve en este momento (`rows` ya filtradas y ordenadas, la página visible con
|
|
356
|
+
* paginación) para calcular el total de lo que la persona tiene delante. No se dibuja mientras carga.
|
|
357
|
+
* No lo cuentan la selección, el CSV ni la paginación: es presentación.
|
|
358
|
+
*/
|
|
359
|
+
footer?: ReadonlyArray<KapiTableFooterRow> | ((context: KapiTableContext<T, K>) => ReadonlyArray<KapiTableFooterRow>) | undefined;
|
|
302
360
|
/** Dónde se muestra la barra de acciones masivas: arriba (estilo Gmail) o abajo. Default `"bottom"`. */
|
|
303
361
|
bulkActionsPlacement?: "top" | "bottom" | undefined;
|
|
304
362
|
/** Textos fijos de la tabla (selección, paginación, columnas, filtro…). */
|
|
305
363
|
labels?: KapiLabelsOverride<KapiTableLabels> | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* Clases por parte: `classNames={{ toolbar: "mi-barra", table: "mi-tabla" }}`. Se suman a las propias,
|
|
366
|
+
* sin reemplazarlas. `root` es la carcasa (lo mismo que `className`), `scrollArea` el contenedor con
|
|
367
|
+
* scroll, `table` el `<table>` y `pagination` el pie de paginación. Cada parte además lleva
|
|
368
|
+
* `data-slot="table-<parte>"`: las filas y celdas se alcanzan desde ahí (`[data-slot="table-table"] th`).
|
|
369
|
+
*/
|
|
370
|
+
classNames?: KapiTableClassNames | undefined;
|
|
306
371
|
/**
|
|
307
372
|
* Contenido propio en la zona de herramientas, después del filtro y antes de CSV y columnas. Abre la
|
|
308
373
|
* zona aunque no haya filtro ni CSV ni columnas; `null`, `undefined` o `false` no muestran nada.
|
|
@@ -415,7 +480,7 @@ export type KapiTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyField
|
|
|
415
480
|
defaultExpandedIds?: ReadonlyArray<T[K]> | undefined;
|
|
416
481
|
/** Recibe los ids expandidos cada vez que cambia la expansión (controlada o no). */
|
|
417
482
|
onExpandedIdsChange?: ((ids: Array<T[K]>) => void) | undefined;
|
|
418
|
-
/** `card`: filas blandas y espaciadas, look de listado. Sólo visual; no cambia el comportamiento. */
|
|
483
|
+
/** `card`: filas blandas y espaciadas, look de listado. Sólo visual; no cambia el comportamiento. Es la FORMA de la tabla, no la densidad del sistema: ésa es `density` de `KapiRoot`/`KapiShell` y se combinan. */
|
|
419
484
|
density?: "default" | "card" | undefined;
|
|
420
485
|
/** Resalta la fila al pasar el mouse (fondo tenue). Opt-in: apagado por defecto. */
|
|
421
486
|
rowHover?: boolean | undefined;
|