@kapiuara/ui 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -5
- package/dist/components/chat/KapiChatDivider.d.ts +15 -0
- package/dist/components/chat/KapiChatDivider.js +17 -0
- package/dist/components/chat/KapiChatList.d.ts +57 -0
- package/dist/components/chat/KapiChatList.js +71 -0
- package/dist/components/chat/KapiChatThread.d.ts +35 -0
- package/dist/components/chat/KapiChatThread.js +85 -0
- package/dist/components/chat/KapiComposer.d.ts +60 -0
- package/dist/components/chat/KapiComposer.js +91 -0
- package/dist/components/chat/KapiMessageBubble.d.ts +43 -0
- package/dist/components/chat/KapiMessageBubble.js +67 -0
- package/dist/components/chat/KapiTypingIndicator.d.ts +27 -0
- package/dist/components/chat/KapiTypingIndicator.js +34 -0
- package/dist/components/chat/chatLogic.d.ts +76 -0
- package/dist/components/chat/chatLogic.js +34 -0
- package/dist/components/chat/index.d.ts +14 -0
- package/dist/components/data/KapiTable.d.ts +25 -1
- package/dist/components/data/KapiTable.js +408 -390
- package/dist/components/data/index.d.ts +1 -1
- package/dist/components/data/tableLogic.d.ts +7 -0
- package/dist/components/data/tableLogic.js +21 -16
- package/dist/components/display/KapiCommentComposer.d.ts +4 -0
- package/dist/components/display/KapiCommentComposer.js +43 -46
- package/dist/components/display/commentLogic.d.ts +9 -2
- package/dist/components/display/commentLogic.js +1 -1
- package/dist/components/display/index.d.ts +1 -0
- package/dist/components/inputs/KapiButton.d.ts +9 -2
- package/dist/components/inputs/KapiButton.js +25 -15
- package/dist/components/inputs/KapiFacetedSearch.d.ts +29 -5
- package/dist/components/inputs/KapiFacetedSearch.js +161 -119
- package/dist/components/inputs/KapiSegmented.d.ts +2 -1
- package/dist/components/inputs/KapiSegmented.js +45 -44
- package/dist/components/inputs/facetedSearchLogic.d.ts +40 -9
- package/dist/components/inputs/facetedSearchLogic.js +38 -20
- package/dist/components/inputs/index.d.ts +2 -2
- package/dist/components/layout/KapiPanelParts.js +9 -9
- package/dist/components/layout/KapiRail.d.ts +1 -1
- package/dist/components/layout/KapiRail.js +60 -53
- package/dist/components/layout/KapiShell.d.ts +9 -2
- package/dist/components/layout/KapiShell.js +22 -22
- package/dist/components/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiContextPanel.js +86 -86
- package/dist/components/navigation/KapiPanelGroup.js +18 -18
- package/dist/components/navigation/KapiTabs.d.ts +3 -1
- package/dist/components/navigation/KapiTabs.js +47 -46
- package/dist/components/navigation/MiniNavItem.js +1 -1
- package/dist/components/overlays/KapiCanvasForm.js +2 -6
- package/dist/components/overlays/KapiConfirm.js +1 -6
- package/dist/hooks/colorLogic.d.ts +26 -0
- package/dist/hooks/colorLogic.js +53 -0
- package/dist/hooks/dateFormat.d.ts +7 -0
- package/dist/hooks/dateFormat.js +16 -2
- package/dist/hooks/index.d.ts +7 -1
- package/dist/hooks/numberFormatLogic.d.ts +6 -0
- package/dist/hooks/numberFormatLogic.js +7 -0
- package/dist/hooks/rightClick.d.ts +10 -0
- package/dist/hooks/rightClick.js +10 -4
- package/dist/hooks/themeColorsLogic.d.ts +11 -0
- package/dist/hooks/themeColorsLogic.js +37 -0
- package/dist/hooks/themeContrastLogic.d.ts +23 -0
- package/dist/hooks/themeContrastLogic.js +46 -0
- package/dist/hooks/themeDeriveLogic.d.ts +52 -0
- package/dist/hooks/themeDeriveLogic.js +103 -0
- package/dist/hooks/useDragScroll.js +26 -23
- package/dist/hooks/useGlobalRightClick.js +28 -25
- package/dist/hooks/useKapiTheme.d.ts +28 -4
- package/dist/hooks/useKapiTheme.js +82 -50
- package/dist/hooks/useSubmitDraft.d.ts +34 -0
- package/dist/hooks/useSubmitDraft.js +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +129 -119
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
|
+
import { joinClasses as t } from "../rootProps.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { Check as i, CheckCheck as a, Clock as o, TriangleAlert as s } from "lucide-react";
|
|
7
|
+
//#region src/components/chat/KapiMessageBubble.tsx
|
|
8
|
+
var c = {
|
|
9
|
+
sending: "Enviando",
|
|
10
|
+
sent: "Enviado",
|
|
11
|
+
delivered: "Entregado",
|
|
12
|
+
read: "Leído",
|
|
13
|
+
failed: "No se pudo enviar"
|
|
14
|
+
}, l = {
|
|
15
|
+
sending: o,
|
|
16
|
+
sent: i,
|
|
17
|
+
delivered: a,
|
|
18
|
+
read: a,
|
|
19
|
+
failed: s
|
|
20
|
+
}, u = (e) => e != null && e !== !1, d = ({ outgoing: i = !1, grouping: a = "single", author: o, time: s, status: d, reply: f, media: p, children: m, labels: h, ref: g, className: _, ...v }) => {
|
|
21
|
+
let y = e("messageBubble", c, h), b = i && d !== void 0 ? l[d] : null, x = u(s) || b !== null;
|
|
22
|
+
return /* @__PURE__ */ r("div", {
|
|
23
|
+
...v,
|
|
24
|
+
ref: g,
|
|
25
|
+
className: t("kapi-bubble", _),
|
|
26
|
+
"data-direction": i ? "out" : "in",
|
|
27
|
+
"data-grouping": a,
|
|
28
|
+
children: [
|
|
29
|
+
!i && u(o) && /* @__PURE__ */ n("span", {
|
|
30
|
+
className: "kapi-bubble__author",
|
|
31
|
+
children: o
|
|
32
|
+
}),
|
|
33
|
+
u(f) && /* @__PURE__ */ n("div", {
|
|
34
|
+
className: "kapi-bubble__reply",
|
|
35
|
+
children: f
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ n("div", {
|
|
38
|
+
className: "kapi-bubble__text",
|
|
39
|
+
children: m
|
|
40
|
+
}),
|
|
41
|
+
u(p) && /* @__PURE__ */ n("div", {
|
|
42
|
+
className: "kapi-bubble__media",
|
|
43
|
+
children: p
|
|
44
|
+
}),
|
|
45
|
+
x && /* @__PURE__ */ r("span", {
|
|
46
|
+
className: "kapi-bubble__meta",
|
|
47
|
+
children: [u(s) && /* @__PURE__ */ n("span", {
|
|
48
|
+
className: "kapi-bubble__time",
|
|
49
|
+
children: s
|
|
50
|
+
}), b !== null && d !== void 0 && /* @__PURE__ */ r("span", {
|
|
51
|
+
className: "kapi-bubble__status",
|
|
52
|
+
"data-status": d,
|
|
53
|
+
children: [/* @__PURE__ */ n(b, {
|
|
54
|
+
size: 14,
|
|
55
|
+
strokeWidth: 2,
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
}), /* @__PURE__ */ n("span", {
|
|
58
|
+
className: "kapi-sr-only",
|
|
59
|
+
children: y[d]
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { c as DEFAULT_MESSAGE_BUBBLE_LABELS, d as KapiMessageBubble };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes, Ref } from "react";
|
|
2
|
+
import type { KapiLabelsOverride } from "../labelsLogic";
|
|
3
|
+
import "./chat.css";
|
|
4
|
+
/** Textos del indicador de escritura. */
|
|
5
|
+
export type KapiTypingIndicatorLabels = {
|
|
6
|
+
/** Una persona escribiendo: `{name}` se reemplaza por el nombre. */
|
|
7
|
+
one: string;
|
|
8
|
+
/** Dos o más: `{count}` se reemplaza por la cantidad. */
|
|
9
|
+
many: string;
|
|
10
|
+
/** Sin nombres. */
|
|
11
|
+
someone: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const DEFAULT_TYPING_INDICATOR_LABELS: KapiTypingIndicatorLabels;
|
|
14
|
+
/** Los atributos nativos (`className`, `style`, `id`, `data-*`…) van al `<div>` raíz. */
|
|
15
|
+
export type KapiTypingIndicatorProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
16
|
+
/** Quiénes están escribiendo; vacío no dibuja nada. */
|
|
17
|
+
names?: readonly string[] | undefined;
|
|
18
|
+
/** Textos (clave `typingIndicator`). */
|
|
19
|
+
labels?: KapiLabelsOverride<KapiTypingIndicatorLabels> | undefined;
|
|
20
|
+
/** Ref al `<div>`. */
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Aviso de "está escribiendo…": tres puntos que laten y el texto. El `<div>` es una región `aria-live`
|
|
25
|
+
* educada, así que un lector de pantalla lo anuncia sin mover el foco. Sin `names` no dibuja nada.
|
|
26
|
+
*/
|
|
27
|
+
export declare const KapiTypingIndicator: ({ names, labels, ref, className, ...rest }: KapiTypingIndicatorProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
|
+
import { joinClasses as t } from "../rootProps.js";
|
|
4
|
+
import { typingText as n } from "./chatLogic.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/chat/KapiTypingIndicator.tsx
|
|
8
|
+
var a = {
|
|
9
|
+
one: "{name} está escribiendo…",
|
|
10
|
+
many: "{count} personas están escribiendo…",
|
|
11
|
+
someone: "Alguien está escribiendo…"
|
|
12
|
+
}, o = ({ names: o, labels: s, ref: c, className: l, ...u }) => {
|
|
13
|
+
let d = e("typingIndicator", a, s), f = n(o, d);
|
|
14
|
+
return f === null ? null : /* @__PURE__ */ i("div", {
|
|
15
|
+
"aria-live": "polite",
|
|
16
|
+
...u,
|
|
17
|
+
ref: c,
|
|
18
|
+
className: t("kapi-typing", l),
|
|
19
|
+
children: [/* @__PURE__ */ i("span", {
|
|
20
|
+
className: "kapi-typing__dots",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" }),
|
|
24
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" }),
|
|
25
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" })
|
|
26
|
+
]
|
|
27
|
+
}), /* @__PURE__ */ r("span", {
|
|
28
|
+
className: "kapi-typing__text",
|
|
29
|
+
children: f
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { a as DEFAULT_TYPING_INDICATOR_LABELS, o as KapiTypingIndicator };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Estado de entrega de un mensaje propio. */
|
|
2
|
+
export type KapiChatStatus = "sending" | "sent" | "delivered" | "read" | "failed";
|
|
3
|
+
/** Mínimo que necesita la lógica de un mensaje; el consumidor lo extiende con su contenido. */
|
|
4
|
+
export type KapiChatMessage<Id extends string = string> = {
|
|
5
|
+
/** Identificador estable del mensaje; también es su `key`. */
|
|
6
|
+
id: Id;
|
|
7
|
+
/** Quién lo escribió; se compara con `meId` para saber si es saliente. */
|
|
8
|
+
authorId: string;
|
|
9
|
+
/** Momento en que se envió. */
|
|
10
|
+
at: Date;
|
|
11
|
+
/** Estado de entrega (solo tiene sentido en mensajes salientes). */
|
|
12
|
+
status?: KapiChatStatus | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** Posición de un mensaje dentro de una corrida del mismo autor. */
|
|
15
|
+
export type KapiChatGrouping = "single" | "first" | "middle" | "last";
|
|
16
|
+
/** Un renglón del hilo: separador de día, marcador de no leídos o mensaje. */
|
|
17
|
+
export type KapiChatEntry<Id extends string = string, M extends KapiChatMessage<Id> = KapiChatMessage<Id>> = {
|
|
18
|
+
kind: "day";
|
|
19
|
+
key: string;
|
|
20
|
+
at: Date;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "unread";
|
|
23
|
+
key: string;
|
|
24
|
+
count: number;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "message";
|
|
27
|
+
key: string;
|
|
28
|
+
message: M;
|
|
29
|
+
outgoing: boolean;
|
|
30
|
+
grouping: KapiChatGrouping;
|
|
31
|
+
};
|
|
32
|
+
/** Opciones de `groupChatMessages`. */
|
|
33
|
+
export type KapiChatGroupOptions<Id extends string = string> = {
|
|
34
|
+
/** Id del usuario actual: sus mensajes son salientes. */
|
|
35
|
+
meId: string;
|
|
36
|
+
/** Hueco máximo, en milisegundos, para agrupar dos mensajes seguidos del mismo autor. @default 300000 */
|
|
37
|
+
groupGapMs?: number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Id del primer mensaje no leído; antes de él se emite el marcador de no leídos. Va en `NoInfer`
|
|
40
|
+
* para que `Id` salga sólo de los mensajes: si participara de la inferencia, pasarle un literal
|
|
41
|
+
* (`"m7"`) lo ancla a ese literal y obliga al consumidor a escribir el argumento de tipo a mano.
|
|
42
|
+
*/
|
|
43
|
+
firstUnreadId?: NoInfer<Id> | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Convierte los mensajes en los renglones del hilo: separadores de día, marcador de no leídos y mensajes
|
|
47
|
+
* con su posición dentro de la corrida del mismo autor. Espera los mensajes en orden cronológico
|
|
48
|
+
* ascendente y NO los ordena.
|
|
49
|
+
*
|
|
50
|
+
* Un mensaje se agrupa con el anterior solo si tiene el mismo autor, no hay entre ellos un separador de
|
|
51
|
+
* día ni el marcador de no leídos, y los separan como mucho `groupGapMs`. El `count` del marcador son los
|
|
52
|
+
* mensajes entrantes desde `firstUnreadId` (inclusive) hasta el final; si ese id no está, no hay marcador.
|
|
53
|
+
*/
|
|
54
|
+
export declare const groupChatMessages: <Id extends string, M extends KapiChatMessage<Id>>(messages: readonly M[], options: KapiChatGroupOptions<Id>) => KapiChatEntry<Id, M>[];
|
|
55
|
+
/**
|
|
56
|
+
* Si el usuario está al fondo, un mensaje nuevo lo sigue. Si subió a leer algo viejo NO se le mueve el
|
|
57
|
+
* scroll (se le avisa con la píldora); pero un mensaje propio siempre baja, porque lo acaba de enviar.
|
|
58
|
+
* Saber si está al fondo no se calcula acá: sale de `useScrollEdges` (`edges.end === false` es "al fondo").
|
|
59
|
+
*/
|
|
60
|
+
export declare const shouldFollowBottom: (state: {
|
|
61
|
+
atBottom: boolean;
|
|
62
|
+
outgoing: boolean;
|
|
63
|
+
}) => boolean;
|
|
64
|
+
/** Textos que necesita `typingText`; estructuralmente son los de `KapiTypingIndicatorLabels`. */
|
|
65
|
+
type TypingTextLabels = {
|
|
66
|
+
one: string;
|
|
67
|
+
many: string;
|
|
68
|
+
someone: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Texto del indicador de escritura, o `null` si no escribe nadie. Una persona con nombre usa `one`
|
|
72
|
+
* (`{name}`); dos o más usan `many` (`{count}` con la cantidad de personas); un nombre vacío o de solo
|
|
73
|
+
* espacios es una persona sin nombre y usa `someone`.
|
|
74
|
+
*/
|
|
75
|
+
export declare const typingText: (names: readonly string[] | undefined, labels: TypingTextLabels) => string | null;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/components/chat/chatLogic.ts
|
|
2
|
+
var e = (e) => String(e).padStart(2, "0"), t = (t) => `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`, n = (e, n) => {
|
|
3
|
+
let { meId: r, groupGapMs: i = 3e5, firstUnreadId: a = null } = n, o = [], s = a === null ? -1 : e.findIndex((e) => e.id === a), c = s < 0 ? 0 : e.slice(s).filter((e) => e.authorId !== r).length, l = [], u = () => {
|
|
4
|
+
l.forEach((e, t) => {
|
|
5
|
+
let n = o[e];
|
|
6
|
+
n?.kind === "message" && (n.grouping = l.length === 1 ? "single" : t === 0 ? "first" : t === l.length - 1 ? "last" : "middle");
|
|
7
|
+
}), l = [];
|
|
8
|
+
}, d;
|
|
9
|
+
return e.forEach((e, n) => {
|
|
10
|
+
let a = d === void 0 || t(d.at) !== t(e.at), f = n === s;
|
|
11
|
+
a && o.push({
|
|
12
|
+
kind: "day",
|
|
13
|
+
key: t(e.at),
|
|
14
|
+
at: e.at
|
|
15
|
+
}), f && o.push({
|
|
16
|
+
kind: "unread",
|
|
17
|
+
key: "unread",
|
|
18
|
+
count: c
|
|
19
|
+
}), d !== void 0 && !a && !f && d.authorId === e.authorId && e.at.getTime() - d.at.getTime() <= i || u(), l.push(o.length), o.push({
|
|
20
|
+
kind: "message",
|
|
21
|
+
key: e.id,
|
|
22
|
+
message: e,
|
|
23
|
+
outgoing: e.authorId === r,
|
|
24
|
+
grouping: "single"
|
|
25
|
+
}), d = e;
|
|
26
|
+
}), u(), o;
|
|
27
|
+
}, r = (e) => e.atBottom || e.outgoing, i = (e, t) => {
|
|
28
|
+
if (e === void 0 || e.length === 0) return null;
|
|
29
|
+
if (e.length > 1) return t.many.replaceAll("{count}", () => String(e.length));
|
|
30
|
+
let n = (e[0] ?? "").trim();
|
|
31
|
+
return n === "" ? t.someone : t.one.replaceAll("{name}", () => n);
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as groupChatMessages, r as shouldFollowBottom, i as typingText };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { groupChatMessages, shouldFollowBottom, typingText } from "./chatLogic";
|
|
2
|
+
export { KapiChatDivider } from "./KapiChatDivider";
|
|
3
|
+
export { DEFAULT_CHAT_LIST_LABELS, KapiChatList } from "./KapiChatList";
|
|
4
|
+
export { DEFAULT_COMPOSER_LABELS, KapiComposer } from "./KapiComposer";
|
|
5
|
+
export { DEFAULT_CHAT_THREAD_LABELS, KapiChatThread } from "./KapiChatThread";
|
|
6
|
+
export { DEFAULT_MESSAGE_BUBBLE_LABELS, KapiMessageBubble } from "./KapiMessageBubble";
|
|
7
|
+
export { DEFAULT_TYPING_INDICATOR_LABELS, KapiTypingIndicator } from "./KapiTypingIndicator";
|
|
8
|
+
export type { KapiChatEntry, KapiChatGroupOptions, KapiChatGrouping, KapiChatMessage, KapiChatStatus } from "./chatLogic";
|
|
9
|
+
export type { KapiChatDividerProps, KapiChatDividerTone } from "./KapiChatDivider";
|
|
10
|
+
export type { KapiChatConversation, KapiChatListLabels, KapiChatListProps } from "./KapiChatList";
|
|
11
|
+
export type { KapiChatThreadLabels, KapiChatThreadProps } from "./KapiChatThread";
|
|
12
|
+
export type { KapiComposerLabels, KapiComposerProps } from "./KapiComposer";
|
|
13
|
+
export type { KapiMessageBubbleLabels, KapiMessageBubbleProps } from "./KapiMessageBubble";
|
|
14
|
+
export type { KapiTypingIndicatorLabels, KapiTypingIndicatorProps } from "./KapiTypingIndicator";
|
|
@@ -76,6 +76,8 @@ export type KapiTableLabels = {
|
|
|
76
76
|
/** Contenido durante la carga con `loadingRows={0}` (lo pisa `loadingMessage`). */
|
|
77
77
|
loading: string;
|
|
78
78
|
selectAll: string;
|
|
79
|
+
/** Nombre accesible del menú de la cabecera con las condiciones de `selectionPresets`. */
|
|
80
|
+
selectMatching: string;
|
|
79
81
|
/** Checkbox de una fila sin etiqueta propia: "Seleccionar fila 3". */
|
|
80
82
|
selectRow: string;
|
|
81
83
|
/** Checkbox de una fila con etiqueta (`rowLabel` o la primera columna): "Seleccionar Ana". */
|
|
@@ -105,6 +107,17 @@ export type KapiTableLabels = {
|
|
|
105
107
|
exportCsv: string;
|
|
106
108
|
};
|
|
107
109
|
export declare const DEFAULT_TABLE_LABELS: KapiTableLabels;
|
|
110
|
+
/** Una condición con nombre del menú de selección de la cabecera ("Presentada", "Demoradas"…). */
|
|
111
|
+
export type KapiTableSelectionPreset<T> = {
|
|
112
|
+
/** Identificador estable de la condición. */
|
|
113
|
+
id: string;
|
|
114
|
+
/** Texto del ítem en el menú. */
|
|
115
|
+
label: string;
|
|
116
|
+
/** Ícono (lucide-react) antes del texto. */
|
|
117
|
+
icon?: ReactNode | undefined;
|
|
118
|
+
/** Decide si una fila cumple la condición. Las filas que `isRowSelectable` rechaza nunca se seleccionan. */
|
|
119
|
+
match: (row: T) => boolean;
|
|
120
|
+
};
|
|
108
121
|
/** Paginación presentacional: la tabla NO recorta `rows`, el padre pasa la página actual. */
|
|
109
122
|
export type KapiTablePagination = {
|
|
110
123
|
/** Página actual (desde 1). */
|
|
@@ -136,6 +149,11 @@ export type KapiTableProps<T, K extends keyof T = keyof T> = KapiRootProps & {
|
|
|
136
149
|
bulkActionsPlacement?: "top" | "bottom";
|
|
137
150
|
/** Textos fijos de la tabla (selección, paginación, columnas, filtro…). */
|
|
138
151
|
labels?: KapiLabelsOverride<KapiTableLabels> | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Contenido propio en la zona de herramientas, después del filtro y antes de CSV y columnas. Abre la
|
|
154
|
+
* zona aunque no haya filtro ni CSV ni columnas; `null`, `undefined` o `false` no muestran nada.
|
|
155
|
+
*/
|
|
156
|
+
toolbar?: ReactNode | undefined;
|
|
139
157
|
/** Columna de acciones: contenido custom por fila (botones). */
|
|
140
158
|
actions?: (row: T) => ReactNode;
|
|
141
159
|
/** Agrega el botón ⋯ en la columna de acciones, con estos ítems. */
|
|
@@ -164,6 +182,12 @@ export type KapiTableProps<T, K extends keyof T = keyof T> = KapiRootProps & {
|
|
|
164
182
|
}) => ReactNode;
|
|
165
183
|
/** Con `selectable`: Shift+clic selecciona (o deselecciona) el rango desde la última fila tildada. Default `true`. */
|
|
166
184
|
rangeSelect?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Con `selectable`: condiciones con nombre en un menú junto al checkbox de la cabecera. Elegir una deja
|
|
187
|
+
* seleccionadas exactamente las filas que la cumplen entre las que la tabla recibe; lo seleccionado fuera
|
|
188
|
+
* de ellas (otra página, otra búsqueda) se conserva. Una condición sin coincidencias queda deshabilitada.
|
|
189
|
+
*/
|
|
190
|
+
selectionPresets?: ReadonlyArray<KapiTableSelectionPreset<NoInfer<T>>> | undefined;
|
|
167
191
|
/** Renderiza sólo las filas visibles (altura fija `rowHeight`). */
|
|
168
192
|
virtual?: boolean;
|
|
169
193
|
/** Alto fijo de fila en px para `virtual`. */
|
|
@@ -248,4 +272,4 @@ export type KapiTableProps<T, K extends keyof T = keyof T> = KapiRootProps & {
|
|
|
248
272
|
* por header, columna de acciones fija, copiar por celda, virtualización de altura fija,
|
|
249
273
|
* drag-scroll con click derecho y menú contextual con doble click derecho.
|
|
250
274
|
*/
|
|
251
|
-
export declare function KapiTable<T, K extends keyof T = keyof T>({ columns, rows, keyField, maxHeight, fill, bulkActionsPlacement, className, style, id, labels, actions, rowMenu, contextMenu, onCopy, selectable, rowSelect, rowLabel, selectedIds, onSelectedIdsChange, bulkActions, rangeSelect, virtual, rowHeight, sort, defaultSort, onSortChange, manualSort, pagination, loading, loadingRows, card, emptyMessage, loadingMessage, isRowSelectable, renderSubComponent, expandedIds, onExpandedIdsChange, density, rowHover, columnToggle, columnVisibility, defaultColumnVisibility, onColumnVisibilityChange, resizableColumns, columnWidths, defaultColumnWidths, onColumnWidthsChange, filterable, filter, defaultFilter, onFilterChange, manualFilter, filterDebounce, exportCsv, mobileCards }: KapiTableProps<T, K>): import("react").JSX.Element;
|
|
275
|
+
export declare function KapiTable<T, K extends keyof T = keyof T>({ columns, rows, keyField, maxHeight, fill, bulkActionsPlacement, className, style, id, labels, actions, rowMenu, contextMenu, onCopy, selectable, rowSelect, rowLabel, selectedIds, onSelectedIdsChange, bulkActions, rangeSelect, selectionPresets, virtual, rowHeight, sort, defaultSort, onSortChange, manualSort, pagination, loading, loadingRows, card, emptyMessage, loadingMessage, isRowSelectable, renderSubComponent, expandedIds, onExpandedIdsChange, density, rowHover, columnToggle, columnVisibility, defaultColumnVisibility, onColumnVisibilityChange, resizableColumns, columnWidths, defaultColumnWidths, onColumnWidthsChange, filterable, filter, defaultFilter, onFilterChange, manualFilter, filterDebounce, exportCsv, toolbar, mobileCards }: KapiTableProps<T, K>): import("react").JSX.Element;
|