@kapiuara/ui 0.15.3 → 0.17.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 +505 -13
- package/dist/components/chat/KapiChatThread.js +4 -4
- package/dist/components/chat/KapiComposer.js +8 -8
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +25 -25
- 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/KapiSparkline.d.ts +2 -1
- package/dist/components/data/KapiSparkline.js +29 -26
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFilter.js +6 -6
- 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 +17 -5
- package/dist/components/data/tableCells.js +52 -53
- 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 +54 -1
- package/dist/components/data/useTableSelection.d.ts +4 -2
- package/dist/components/data/useTableSelection.js +29 -25
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiAnnotation.js +68 -63
- package/dist/components/display/KapiAvatar.d.ts +6 -4
- package/dist/components/display/KapiAvatar.js +33 -28
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiCodeBlock.d.ts +48 -0
- package/dist/components/display/KapiCodeBlock.js +44 -0
- package/dist/components/display/KapiCommentComposer.js +6 -6
- package/dist/components/display/KapiDiff.d.ts +62 -0
- package/dist/components/display/KapiDiff.js +118 -0
- package/dist/components/display/KapiHighlight.d.ts +27 -0
- package/dist/components/display/KapiHighlight.js +21 -0
- package/dist/components/display/KapiIconTile.d.ts +2 -1
- package/dist/components/display/KapiIconTile.js +23 -21
- package/dist/components/display/KapiStat.d.ts +3 -2
- package/dist/components/display/KapiStat.js +32 -26
- package/dist/components/display/KapiTag.d.ts +4 -3
- package/dist/components/display/KapiTag.js +29 -24
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTimeline.d.ts +5 -2
- package/dist/components/display/KapiTimeline.js +31 -23
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/annotationLogic.d.ts +2 -1
- package/dist/components/display/annotationLogic.js +7 -6
- package/dist/components/display/codeBlockSlots.d.ts +10 -0
- package/dist/components/display/codeBlockSlots.js +13 -0
- package/dist/components/display/diffLogic.d.ts +58 -0
- package/dist/components/display/diffLogic.js +96 -0
- package/dist/components/display/diffSlots.d.ts +14 -0
- package/dist/components/display/diffSlots.js +17 -0
- package/dist/components/display/highlightLogic.d.ts +18 -0
- package/dist/components/display/highlightLogic.js +26 -0
- package/dist/components/display/highlightSlots.d.ts +5 -0
- package/dist/components/display/highlightSlots.js +8 -0
- package/dist/components/display/iconTileLogic.d.ts +2 -2
- package/dist/components/display/iconTileLogic.js +7 -6
- package/dist/components/display/index.d.ts +15 -0
- package/dist/components/display/statLogic.d.ts +2 -1
- package/dist/components/display/statLogic.js +7 -6
- package/dist/components/display/tagLogic.d.ts +2 -1
- package/dist/components/display/tagLogic.js +7 -6
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/display/timelineLogic.d.ts +20 -2
- package/dist/components/display/timelineLogic.js +10 -2
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/feedback/KapiFab.js +108 -108
- package/dist/components/feedback/KapiProgress.js +63 -54
- package/dist/components/feedback/KapiToastContainer.js +9 -9
- package/dist/components/feedback/KapiTour.js +12 -12
- package/dist/components/feedback/progressLogic.d.ts +2 -1
- package/dist/components/feedback/progressLogic.js +9 -8
- package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
- package/dist/components/inputs/KapiAutocomplete.js +86 -85
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiChecklist.d.ts +7 -1
- package/dist/components/inputs/KapiChecklist.js +53 -52
- package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
- package/dist/components/inputs/KapiCopyButton.js +35 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDatePicker.js +118 -116
- package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDateRangePicker.js +136 -135
- package/dist/components/inputs/KapiFacetedSearch.js +5 -5
- package/dist/components/inputs/KapiField.d.ts +9 -1
- package/dist/components/inputs/KapiField.js +43 -42
- package/dist/components/inputs/KapiFileUpload.js +6 -6
- package/dist/components/inputs/KapiInput.d.ts +29 -1
- package/dist/components/inputs/KapiInput.js +74 -51
- package/dist/components/inputs/KapiMaskedInput.js +26 -26
- package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
- package/dist/components/inputs/KapiNumberStepper.js +24 -23
- package/dist/components/inputs/KapiPinInput.d.ts +72 -0
- package/dist/components/inputs/KapiPinInput.js +75 -0
- package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
- package/dist/components/inputs/KapiPropsForm.js +78 -0
- package/dist/components/inputs/KapiRating.d.ts +7 -1
- package/dist/components/inputs/KapiRating.js +39 -38
- package/dist/components/inputs/KapiSearchChip.js +5 -5
- package/dist/components/inputs/KapiSegmented.d.ts +13 -5
- package/dist/components/inputs/KapiSegmented.js +81 -77
- package/dist/components/inputs/KapiSelect.d.ts +21 -1
- package/dist/components/inputs/KapiSelect.js +251 -245
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/KapiSlider.d.ts +10 -3
- package/dist/components/inputs/KapiSlider.js +67 -63
- package/dist/components/inputs/KapiTagInput.d.ts +7 -1
- package/dist/components/inputs/KapiTagInput.js +70 -69
- package/dist/components/inputs/KapiTextarea.d.ts +7 -1
- package/dist/components/inputs/KapiTextarea.js +51 -50
- package/dist/components/inputs/copyLogic.d.ts +1 -0
- package/dist/components/inputs/copyLogic.js +12 -0
- package/dist/components/inputs/fieldLogic.d.ts +21 -1
- package/dist/components/inputs/fieldLogic.js +18 -11
- package/dist/components/inputs/index.d.ts +9 -1
- package/dist/components/inputs/inputLogic.d.ts +16 -1
- package/dist/components/inputs/inputLogic.js +3 -3
- package/dist/components/inputs/ownField.d.ts +3 -1
- package/dist/components/inputs/ownField.js +28 -27
- package/dist/components/inputs/pinInputLogic.d.ts +34 -0
- package/dist/components/inputs/pinInputLogic.js +37 -0
- package/dist/components/inputs/propsFormLogic.d.ts +53 -0
- package/dist/components/inputs/propsFormLogic.js +11 -0
- package/dist/components/inputs/segmentedLogic.d.ts +7 -0
- package/dist/components/inputs/segmentedLogic.js +2 -2
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiAccessCard.d.ts +5 -1
- package/dist/components/layout/KapiAccessCard.js +43 -39
- package/dist/components/layout/KapiAccountMenu.js +7 -7
- 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/KapiCollapse.d.ts +39 -0
- package/dist/components/layout/KapiCollapse.js +20 -0
- package/dist/components/layout/KapiContextSlot.js +4 -4
- package/dist/components/layout/KapiDivider.d.ts +11 -2
- package/dist/components/layout/KapiDivider.js +30 -24
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiNotificationBell.js +10 -10
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +94 -92
- 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 +125 -122
- package/dist/components/layout/KapiRoot.d.ts +55 -5
- package/dist/components/layout/KapiRoot.js +57 -38
- package/dist/components/layout/KapiShell.d.ts +44 -3
- package/dist/components/layout/KapiShell.js +54 -50
- package/dist/components/layout/accessCardLogic.d.ts +8 -1
- package/dist/components/layout/accessCardLogic.js +11 -7
- 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 +13 -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/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiAccordion.js +9 -9
- 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 +152 -136
- package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
- package/dist/components/navigation/KapiNavBadge.js +26 -22
- 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/KapiToc.d.ts +48 -0
- package/dist/components/navigation/KapiToc.js +66 -0
- package/dist/components/navigation/KapiTree.js +10 -10
- 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/index.d.ts +3 -0
- 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/navigation/tocLogic.d.ts +35 -0
- package/dist/components/navigation/tocLogic.js +11 -0
- package/dist/components/navigation/tocSlots.d.ts +8 -0
- package/dist/components/navigation/tocSlots.js +11 -0
- package/dist/components/overlays/KapiCommandPalette.js +6 -6
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiContextMenu.js +5 -5
- package/dist/components/overlays/KapiMenuButton.js +7 -7
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +79 -77
- package/dist/components/overlays/KapiOffcanvas.js +24 -24
- package/dist/components/overlays/KapiPhotoView.js +10 -10
- package/dist/components/overlays/KapiPopover.js +6 -6
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiTooltip.js +18 -18
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +127 -117
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +123 -0
- package/dist/components/slotCatalog.js +27 -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/KapiAnnotation.css +1 -1
- package/dist/css/components/display/KapiCodeBlock.css +1 -0
- package/dist/css/components/display/KapiDiff.css +1 -0
- 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/inputs/KapiPinInput.css +1 -0
- package/dist/css/components/inputs/KapiSelect.css +1 -1
- package/dist/css/components/inputs/inputsExtra.css +1 -1
- package/dist/css/components/layout/KapiAccessCard.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiCollapse.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -1
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/KapiToc.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/asyncResourceLogic.d.ts +11 -0
- package/dist/hooks/asyncResourceLogic.js +4 -0
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +7 -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 +146 -0
- package/dist/hooks/toneFamilyLogic.js +164 -0
- package/dist/hooks/useAsyncResource.d.ts +45 -0
- package/dist/hooks/useAsyncResource.js +24 -0
- package/dist/hooks/useKapiTheme.d.ts +16 -3
- package/dist/hooks/useKapiTheme.js +130 -117
- package/dist/hooks/useToneFamilies.d.ts +40 -0
- package/dist/hooks/useToneFamilies.js +50 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +227 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.d.ts +41 -0
- package/dist/logic.js +42 -0
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +14 -3
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { joinClasses as e } from "../rootProps.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { copyText as t } from "../inputs/copyLogic.js";
|
|
4
|
+
import { columnAlign as n, readCell as r, stickySideOf as i } from "./tableLogic.js";
|
|
5
|
+
import { KapiSkeleton as a } from "../feedback/KapiSkeleton.js";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDown as c, ChevronUp as l, ChevronsUpDown as u, Copy as d, Loader2 as f } from "lucide-react";
|
|
7
8
|
//#region src/components/data/tableCells.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} catch {}
|
|
12
|
-
t?.(e);
|
|
13
|
-
}, f = (e, t, n) => {
|
|
9
|
+
var p = async (e, n, r) => {
|
|
10
|
+
await t(String(e), r) && n?.(e);
|
|
11
|
+
}, m = (e, t, n) => {
|
|
14
12
|
let r = n[e.key];
|
|
15
13
|
return r === void 0 ? t === "th" ? {
|
|
16
14
|
width: e.flex ? "100%" : e.width,
|
|
@@ -24,102 +22,103 @@ var d = (e, t) => {
|
|
|
24
22
|
minWidth: r,
|
|
25
23
|
maxWidth: r
|
|
26
24
|
};
|
|
27
|
-
},
|
|
28
|
-
let t =
|
|
25
|
+
}, h = (e) => {
|
|
26
|
+
let t = n(e);
|
|
29
27
|
if (t) return `is-align-${t}${t === "start" ? " is-align-left" : t === "end" ? " is-align-right" : ""}`;
|
|
30
|
-
},
|
|
31
|
-
let a =
|
|
32
|
-
return e(a && "is-sticky", a === "right" && "is-sticky-right", a === "left" &&
|
|
33
|
-
},
|
|
28
|
+
}, g = (t, n, r) => {
|
|
29
|
+
let a = i(t.sticky);
|
|
30
|
+
return e(a && "is-sticky", a === "right" && "is-sticky-right", a === "left" && n === r.lastLeft && "is-sticky-last", a === "right" && n === r.firstRight && "is-sticky-first-right", t.flex && "is-flex", h(t.align));
|
|
31
|
+
}, _ = (e, t) => ({
|
|
34
32
|
insetInlineStart: t.lefts[e],
|
|
35
33
|
insetInlineEnd: t.rights[e]
|
|
36
|
-
}),
|
|
37
|
-
let
|
|
34
|
+
}), v = (e) => `kapi-actcol${e.firstRight >= 0 ? " is-joined" : ""}`, y = (e, t, n, i) => {
|
|
35
|
+
let a = e.render ? e.render(t) : r(t, e.key), c = e.clamp === void 0 ? a : /* @__PURE__ */ o("span", {
|
|
38
36
|
className: "kapi-cell-clamp",
|
|
39
37
|
style: { "--kapi-cell-lines": String(e.clamp) },
|
|
40
|
-
children:
|
|
38
|
+
children: a
|
|
41
39
|
});
|
|
42
40
|
if (!e.copyable) return c;
|
|
43
|
-
let
|
|
44
|
-
return /* @__PURE__ */
|
|
41
|
+
let l = e.copyValue ? e.copyValue(t) : r(t, e.key);
|
|
42
|
+
return /* @__PURE__ */ s("span", {
|
|
45
43
|
className: "kapi-cell",
|
|
46
|
-
children: [/* @__PURE__ */
|
|
44
|
+
children: [/* @__PURE__ */ o("span", {
|
|
47
45
|
className: "kapi-cell__v",
|
|
48
46
|
children: c
|
|
49
|
-
}), /* @__PURE__ */
|
|
47
|
+
}), /* @__PURE__ */ o("button", {
|
|
50
48
|
type: "button",
|
|
51
49
|
className: "kapi-cell__copy",
|
|
52
|
-
"aria-label":
|
|
50
|
+
"aria-label": n.copy,
|
|
53
51
|
onClick: (e) => {
|
|
54
|
-
e.stopPropagation(),
|
|
52
|
+
e.stopPropagation(), p(l, i, e.currentTarget);
|
|
55
53
|
},
|
|
56
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ o(d, {
|
|
57
55
|
size: 13,
|
|
58
56
|
strokeWidth: 2
|
|
59
57
|
})
|
|
60
58
|
})]
|
|
61
59
|
});
|
|
62
|
-
},
|
|
60
|
+
}, b = (e) => e === "asc" ? /* @__PURE__ */ o(l, {
|
|
63
61
|
size: 13,
|
|
64
62
|
strokeWidth: 2.4
|
|
65
|
-
}) : e === "desc" ? /* @__PURE__ */
|
|
63
|
+
}) : e === "desc" ? /* @__PURE__ */ o(c, {
|
|
66
64
|
size: 13,
|
|
67
65
|
strokeWidth: 2.4
|
|
68
|
-
}) : /* @__PURE__ */
|
|
66
|
+
}) : /* @__PURE__ */ o(u, {
|
|
69
67
|
size: 13,
|
|
70
68
|
strokeWidth: 2
|
|
71
|
-
}),
|
|
69
|
+
}), x = (e, t) => t?.key === e.key ? t.direction : "none", S = (e, t) => {
|
|
72
70
|
if (!e.sortable) return;
|
|
73
|
-
let n =
|
|
71
|
+
let n = x(e, t);
|
|
74
72
|
return n === "none" ? "none" : n === "asc" ? "ascending" : "descending";
|
|
75
|
-
},
|
|
73
|
+
}, C = (e, t, n, r) => {
|
|
76
74
|
if (!e.sortable) return e.label;
|
|
77
|
-
let
|
|
78
|
-
return /* @__PURE__ */
|
|
75
|
+
let i = x(e, t);
|
|
76
|
+
return /* @__PURE__ */ s("button", {
|
|
79
77
|
type: "button",
|
|
80
|
-
className: `kapi-thsort${
|
|
78
|
+
className: `kapi-thsort${i === "none" ? "" : " is-active"}`,
|
|
81
79
|
onClick: () => n(e.key),
|
|
82
80
|
title: typeof e.label == "string" ? `${r.sortBy} ${e.label}` : void 0,
|
|
83
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ o("span", { children: e.label }), b(i)]
|
|
84
82
|
});
|
|
85
|
-
},
|
|
83
|
+
}, w = (e, t, n = !1) => /* @__PURE__ */ o("tr", {
|
|
86
84
|
className: "kapi-table-staterow",
|
|
87
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ s("td", {
|
|
88
86
|
colSpan: e,
|
|
89
87
|
className: "kapi-table-state",
|
|
90
|
-
children: [n && /* @__PURE__ */
|
|
88
|
+
children: [n && /* @__PURE__ */ o(f, {
|
|
91
89
|
size: 16,
|
|
92
90
|
strokeWidth: 2.2,
|
|
93
91
|
className: "kapi-table-spin",
|
|
94
92
|
"aria-hidden": !0
|
|
95
|
-
}), /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ o("span", { children: t })]
|
|
96
94
|
})
|
|
97
|
-
}),
|
|
95
|
+
}), T = [
|
|
98
96
|
96,
|
|
99
97
|
72,
|
|
100
98
|
84,
|
|
101
99
|
60
|
|
102
|
-
],
|
|
103
|
-
let
|
|
100
|
+
], E = (e, t, n) => {
|
|
101
|
+
let r = e.flex ? `${[
|
|
104
102
|
70,
|
|
105
103
|
55,
|
|
106
104
|
80
|
|
107
|
-
][n % 3]}%` : Math.max(32, Math.min(
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
width:
|
|
105
|
+
][n % 3]}%` : Math.max(32, Math.min(T[(t + n) % T.length] ?? 72, (e.width ?? 120) - 36));
|
|
106
|
+
return /* @__PURE__ */ o(a, {
|
|
107
|
+
width: r,
|
|
110
108
|
height: 14,
|
|
111
109
|
radius: 6
|
|
112
110
|
});
|
|
113
|
-
},
|
|
111
|
+
}, D = (e, t, r, i, a, s, c, l) => /* @__PURE__ */ o("td", {
|
|
114
112
|
"data-col": e.key,
|
|
115
|
-
|
|
113
|
+
colSpan: l !== void 0 && l > 1 ? l : void 0,
|
|
114
|
+
className: g(e, t, i),
|
|
116
115
|
style: {
|
|
117
|
-
...
|
|
118
|
-
...
|
|
119
|
-
textAlign:
|
|
116
|
+
..._(t, i),
|
|
117
|
+
...m(e, "td", a),
|
|
118
|
+
textAlign: n(e.align)
|
|
120
119
|
},
|
|
121
120
|
"data-label": typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : void 0,
|
|
122
|
-
children:
|
|
121
|
+
children: y(e, r, s, c)
|
|
123
122
|
}, e.key);
|
|
124
123
|
//#endregion
|
|
125
|
-
export {
|
|
124
|
+
export { v as actColClass, S as ariaSortOf, D as bodyCell, g as cellClass, n as columnAlign, m as columnBoxStyle, p as copyToClipboard, C as headerContent, y as renderCell, E as skeletonBar, x as sortDirectionOf, b as sortIcon, w as stateRow, _ 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";
|
|
@@ -54,6 +55,14 @@ type KapiTableColumnBase<T> = {
|
|
|
54
55
|
* mismo punto y se leen idénticos, así que la columna deja de distinguir.
|
|
55
56
|
*/
|
|
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;
|
|
57
66
|
/** Entra en el filtro de la tabla (en "Todas" y en el selector de columna). Default `true`. */
|
|
58
67
|
filterable?: boolean | undefined;
|
|
59
68
|
/** Texto con el que compara el filtro, p. ej. para celdas que muestran un badge (default: `row[key]`). */
|
|
@@ -61,6 +70,34 @@ type KapiTableColumnBase<T> = {
|
|
|
61
70
|
/** Valor exportado al CSV (default: `copyValue` o `row[key]`). */
|
|
62
71
|
csvValue?: ((row: T) => KapiTableCellValue) | undefined;
|
|
63
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>;
|
|
64
101
|
/**
|
|
65
102
|
* Columna de `KapiTable<T>`. Sin `render`, `key` tiene que ser una propiedad de la fila (es lo que se
|
|
66
103
|
* muestra, y un error de tipeo no compila); con `render`, `key` es un identificador libre.
|
|
@@ -273,6 +310,8 @@ export type KapiTableClientPagination = {
|
|
|
273
310
|
*/
|
|
274
311
|
showEdges?: boolean | undefined;
|
|
275
312
|
};
|
|
313
|
+
/** Partes de `KapiTable` que acepta `classNames`: `root`, `toolbar`, `scrollArea`, `table` y `pagination`. */
|
|
314
|
+
export type KapiTableClassNames = KapiClassNames<"table">;
|
|
276
315
|
/** `className`/`style`/`id` (`KapiRootProps`) van a la carcasa `.kapi-table-shell` (herramientas + tabla + pie). */
|
|
277
316
|
/**
|
|
278
317
|
* Lo que puede ser el valor de una fila que la identifica. Es `string | number` y no `unknown` a
|
|
@@ -311,10 +350,24 @@ export type KapiTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyField
|
|
|
311
350
|
* scrollea internamente, y el footer queda fijo abajo. Con `fill`, `maxHeight` se ignora.
|
|
312
351
|
*/
|
|
313
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;
|
|
314
360
|
/** Dónde se muestra la barra de acciones masivas: arriba (estilo Gmail) o abajo. Default `"bottom"`. */
|
|
315
361
|
bulkActionsPlacement?: "top" | "bottom" | undefined;
|
|
316
362
|
/** Textos fijos de la tabla (selección, paginación, columnas, filtro…). */
|
|
317
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;
|
|
318
371
|
/**
|
|
319
372
|
* Contenido propio en la zona de herramientas, después del filtro y antes de CSV y columnas. Abre la
|
|
320
373
|
* zona aunque no haya filtro ni CSV ni columnas; `null`, `undefined` o `false` no muestran nada.
|
|
@@ -427,7 +480,7 @@ export type KapiTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyField
|
|
|
427
480
|
defaultExpandedIds?: ReadonlyArray<T[K]> | undefined;
|
|
428
481
|
/** Recibe los ids expandidos cada vez que cambia la expansión (controlada o no). */
|
|
429
482
|
onExpandedIdsChange?: ((ids: Array<T[K]>) => void) | undefined;
|
|
430
|
-
/** `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. */
|
|
431
484
|
density?: "default" | "card" | undefined;
|
|
432
485
|
/** Resalta la fila al pasar el mouse (fondo tenue). Opt-in: apagado por defecto. */
|
|
433
486
|
rowHover?: boolean | undefined;
|