next-recomponents 1.7.63 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +30 -37
- package/dist/index.d.ts +30 -37
- package/dist/index.js +671 -742
- package/dist/index.mjs +677 -748
- package/package.json +1 -1
- package/src/container/index.tsx +3 -6
- package/src/index.tsx +1 -2
- package/src/table/filters.tsx +16 -15
- package/src/table/h.tsx +49 -63
- package/src/table/td.tsx +5 -24
- package/src/table/vtd.tsx +1 -0
- package/src/table3/body.tsx +75 -0
- package/src/table3/dialog.tsx +49 -0
- package/src/table3/filter.tsx +213 -0
- package/src/table3/footer.tsx +56 -0
- package/src/table3/head.tsx +72 -0
- package/src/table3/index.tsx +190 -0
- package/src/table3/panel.tsx +85 -0
- package/src/table3/tr.tsx +148 -0
- package/tsconfig.json +2 -2
- package/src/table2/context.tsx +0 -141
- package/src/table2/h.table.tsx +0 -5
- package/src/table2/icons.tsx +0 -116
- package/src/table2/index.tsx +0 -70
- package/src/table2/v.table.body.tsx +0 -155
- package/src/table2/v.table.head.filter.tsx +0 -196
- package/src/table2/v.table.head.tsx +0 -43
- package/src/table2/v.table.pagination.tsx +0 -73
- package/src/table2/v.table.tsx +0 -58
- package/src/use-modal/index.tsx +0 -79
package/src/table2/v.table.tsx
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { TableContextType } from "./context";
|
|
2
|
-
import { IoIosSave, RiFileExcel2Fill } from "./icons";
|
|
3
|
-
import VTableBody from "./v.table.body";
|
|
4
|
-
import THead from "./v.table.head";
|
|
5
|
-
import VtablePagination from "./v.table.pagination";
|
|
6
|
-
|
|
7
|
-
export default function VTable({
|
|
8
|
-
context,
|
|
9
|
-
...props
|
|
10
|
-
}: { context: TableContextType } & any) {
|
|
11
|
-
return (
|
|
12
|
-
<div className="border shadow rounded m-1 flex flex-col ">
|
|
13
|
-
<div className="flex gap-2 ">
|
|
14
|
-
<div className="flex justify-start gap-2 p-2 bg-gray-100 ">
|
|
15
|
-
{context?.onSave && (
|
|
16
|
-
<button
|
|
17
|
-
className="p-1 bg-blue-700 text-white border shadow rounded flex gap-1 items-center"
|
|
18
|
-
onClick={(e) =>
|
|
19
|
-
context?.onSave?.(Object.values(context.defaultData))
|
|
20
|
-
}
|
|
21
|
-
>
|
|
22
|
-
<IoIosSave />
|
|
23
|
-
Guardar
|
|
24
|
-
</button>
|
|
25
|
-
)}
|
|
26
|
-
{context.exportName && (
|
|
27
|
-
<button
|
|
28
|
-
className="p-1 bg-green-700 text-white border shadow rounded flex gap-1 items-center"
|
|
29
|
-
onClick={() => {
|
|
30
|
-
const cleanedData = Object.values(context.defaultData).map(
|
|
31
|
-
(row: any) => {
|
|
32
|
-
const newRow: Record<string, any> = {};
|
|
33
|
-
for (const key in row) {
|
|
34
|
-
if (!key.startsWith("_")) {
|
|
35
|
-
newRow[key] = row[key];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return newRow;
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
context.excel.export(cleanedData, context.exportName + ".xlsx");
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<RiFileExcel2Fill />
|
|
46
|
-
Exportar
|
|
47
|
-
</button>
|
|
48
|
-
)}
|
|
49
|
-
</div>
|
|
50
|
-
<VtablePagination context={context} />
|
|
51
|
-
</div>
|
|
52
|
-
<table {...props}>
|
|
53
|
-
<THead context={context} />
|
|
54
|
-
<VTableBody context={context} />
|
|
55
|
-
</table>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
}
|
package/src/use-modal/index.tsx
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DetailedHTMLProps,
|
|
3
|
-
DialogHTMLAttributes,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from "react";
|
|
8
|
-
import { createPortal } from "react-dom";
|
|
9
|
-
|
|
10
|
-
export default function useModal() {
|
|
11
|
-
const modalRef = useRef<HTMLDialogElement | null>(null);
|
|
12
|
-
const [mounted, setMounted] = useState(false);
|
|
13
|
-
|
|
14
|
-
useEffect(() => setMounted(true), []);
|
|
15
|
-
|
|
16
|
-
const show = () => {
|
|
17
|
-
requestAnimationFrame(() => {
|
|
18
|
-
const dlg = modalRef.current;
|
|
19
|
-
if (!dlg) return;
|
|
20
|
-
if (typeof dlg.showModal === "function") {
|
|
21
|
-
try {
|
|
22
|
-
if (!dlg.open) dlg.showModal();
|
|
23
|
-
} catch {
|
|
24
|
-
dlg.setAttribute("open", "");
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
dlg.setAttribute("open", "");
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const hide = () => {
|
|
33
|
-
const dlg = modalRef.current;
|
|
34
|
-
if (!dlg) return;
|
|
35
|
-
if (typeof dlg.close === "function") dlg.close();
|
|
36
|
-
else dlg.removeAttribute("open");
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const Modal = ({
|
|
40
|
-
className,
|
|
41
|
-
children,
|
|
42
|
-
title,
|
|
43
|
-
...props
|
|
44
|
-
}: DetailedHTMLProps<
|
|
45
|
-
DialogHTMLAttributes<HTMLDialogElement>,
|
|
46
|
-
HTMLDialogElement
|
|
47
|
-
> & { title?: React.ReactNode }) => {
|
|
48
|
-
if (!mounted) return null;
|
|
49
|
-
|
|
50
|
-
const dialog = (
|
|
51
|
-
<dialog
|
|
52
|
-
ref={modalRef}
|
|
53
|
-
className={
|
|
54
|
-
(className ?? "") +
|
|
55
|
-
" p-6 rounded-2xl shadow-2xl bg-white max-w-lg w-[90%]"
|
|
56
|
-
}
|
|
57
|
-
{...props}
|
|
58
|
-
>
|
|
59
|
-
{/* Header con título y botón cerrar */}
|
|
60
|
-
<div className="flex justify-between items-center border-b pb-2 mb-4">
|
|
61
|
-
<h2 className="text-lg font-semibold text-gray-800">{title}</h2>
|
|
62
|
-
<button
|
|
63
|
-
onClick={hide}
|
|
64
|
-
className="text-gray-500 hover:text-gray-800 text-2xl font-bold"
|
|
65
|
-
>
|
|
66
|
-
×
|
|
67
|
-
</button>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
{/* Contenido dinámico */}
|
|
71
|
-
<div className="mt-2 text-gray-800">{children}</div>
|
|
72
|
-
</dialog>
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return createPortal(dialog, document.body);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
return { show, hide, Modal };
|
|
79
|
-
}
|