next-recomponents 2.0.24 → 2.0.26
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -9
- package/dist/index.mjs +13 -9
- package/package.json +1 -1
- package/src/container/index.tsx +3 -11
- package/src/table/index.tsx +16 -6
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,7 @@ interface TableProps {
|
|
|
72
72
|
editableFields?: string[];
|
|
73
73
|
onSelect?: (data: GridValidRowModel[]) => void;
|
|
74
74
|
onSave?: (data: GridValidRowModel[]) => void;
|
|
75
|
+
onCloseModal?: (data: GridValidRowModel | undefined) => boolean;
|
|
75
76
|
buttons?: Record<string, any>;
|
|
76
77
|
exportName?: string;
|
|
77
78
|
modal?: React$1.ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ interface TableProps {
|
|
|
72
72
|
editableFields?: string[];
|
|
73
73
|
onSelect?: (data: GridValidRowModel[]) => void;
|
|
74
74
|
onSave?: (data: GridValidRowModel[]) => void;
|
|
75
|
+
onCloseModal?: (data: GridValidRowModel | undefined) => boolean;
|
|
75
76
|
buttons?: Record<string, any>;
|
|
76
77
|
exportName?: string;
|
|
77
78
|
modal?: React$1.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -3725,10 +3725,9 @@ function Container({
|
|
|
3725
3725
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3726
3726
|
"div",
|
|
3727
3727
|
{
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
className: "bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out",
|
|
3728
|
+
className: `bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out
|
|
3729
|
+
${isSidebarOpen ? "w-full md:w-[250px]" : "w-0 md:w-[60px]"}
|
|
3730
|
+
`,
|
|
3732
3731
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("ul", { className: "space-y-3", children: [
|
|
3733
3732
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3734
3733
|
"li",
|
|
@@ -35774,12 +35773,12 @@ function CustomFooter({
|
|
|
35774
35773
|
}) });
|
|
35775
35774
|
}
|
|
35776
35775
|
function ModalDialog({ open, onClose, modal, selectedRow }) {
|
|
35777
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material.Dialog, { open,
|
|
35776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material.Dialog, { open, maxWidth: "xl", fullWidth: true, children: [
|
|
35778
35777
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35779
35778
|
"button",
|
|
35780
35779
|
{
|
|
35781
35780
|
onClick: onClose,
|
|
35782
|
-
className: "
|
|
35781
|
+
className: " font-bold p-1 m-5 w-[30px] h-[30px] flex items-center justify-center hover:animate-pulse border shadow rounded bg-red-500 text-white",
|
|
35783
35782
|
children: "\xD7"
|
|
35784
35783
|
}
|
|
35785
35784
|
) }),
|
|
@@ -35868,10 +35867,12 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35868
35867
|
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
35869
35868
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
35870
35869
|
renderCell: (buttons == null ? void 0 : buttons[key]) ? (params) => {
|
|
35871
|
-
var _a2, _b2;
|
|
35870
|
+
var _a2, _b2, _c;
|
|
35871
|
+
const children = ((_a2 = buttons == null ? void 0 : buttons[key]) == null ? void 0 : _a2.type) == "input" ? null : (_b2 = params == null ? void 0 : params.row) == null ? void 0 : _b2[key];
|
|
35872
35872
|
return import_react4.default.cloneElement(buttons[key], {
|
|
35873
|
-
className: `${(
|
|
35874
|
-
children
|
|
35873
|
+
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
35874
|
+
children,
|
|
35875
|
+
row: params == null ? void 0 : params.row,
|
|
35875
35876
|
onClick: async (e) => {
|
|
35876
35877
|
var _a3, _b3;
|
|
35877
35878
|
e.row = params == null ? void 0 : params.row;
|
|
@@ -35915,6 +35916,7 @@ function IHTable({
|
|
|
35915
35916
|
editableFields,
|
|
35916
35917
|
onSave,
|
|
35917
35918
|
onSelect,
|
|
35919
|
+
onCloseModal,
|
|
35918
35920
|
buttons,
|
|
35919
35921
|
exportName,
|
|
35920
35922
|
modal,
|
|
@@ -35947,6 +35949,8 @@ function IHTable({
|
|
|
35947
35949
|
setOpen(true);
|
|
35948
35950
|
};
|
|
35949
35951
|
const handleClose = () => {
|
|
35952
|
+
const pass = onCloseModal ? onCloseModal == null ? void 0 : onCloseModal(modalRow) : true;
|
|
35953
|
+
if (!pass) return;
|
|
35950
35954
|
setOpen(false);
|
|
35951
35955
|
setModalRow(void 0);
|
|
35952
35956
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -3700,10 +3700,9 @@ function Container({
|
|
|
3700
3700
|
/* @__PURE__ */ jsx3(
|
|
3701
3701
|
"div",
|
|
3702
3702
|
{
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
className: "bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out",
|
|
3703
|
+
className: `bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out
|
|
3704
|
+
${isSidebarOpen ? "w-full md:w-[250px]" : "w-0 md:w-[60px]"}
|
|
3705
|
+
`,
|
|
3707
3706
|
children: /* @__PURE__ */ jsx3("div", { className: "p-4 ", children: /* @__PURE__ */ jsxs2("ul", { className: "space-y-3", children: [
|
|
3708
3707
|
/* @__PURE__ */ jsxs2(
|
|
3709
3708
|
"li",
|
|
@@ -35754,12 +35753,12 @@ function CustomFooter({
|
|
|
35754
35753
|
}) });
|
|
35755
35754
|
}
|
|
35756
35755
|
function ModalDialog({ open, onClose, modal, selectedRow }) {
|
|
35757
|
-
return /* @__PURE__ */ jsxs5(Dialog, { open,
|
|
35756
|
+
return /* @__PURE__ */ jsxs5(Dialog, { open, maxWidth: "xl", fullWidth: true, children: [
|
|
35758
35757
|
/* @__PURE__ */ jsx6("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx6(
|
|
35759
35758
|
"button",
|
|
35760
35759
|
{
|
|
35761
35760
|
onClick: onClose,
|
|
35762
|
-
className: "
|
|
35761
|
+
className: " font-bold p-1 m-5 w-[30px] h-[30px] flex items-center justify-center hover:animate-pulse border shadow rounded bg-red-500 text-white",
|
|
35763
35762
|
children: "\xD7"
|
|
35764
35763
|
}
|
|
35765
35764
|
) }),
|
|
@@ -35848,10 +35847,12 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35848
35847
|
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
35849
35848
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
35850
35849
|
renderCell: (buttons == null ? void 0 : buttons[key]) ? (params) => {
|
|
35851
|
-
var _a2, _b2;
|
|
35850
|
+
var _a2, _b2, _c;
|
|
35851
|
+
const children = ((_a2 = buttons == null ? void 0 : buttons[key]) == null ? void 0 : _a2.type) == "input" ? null : (_b2 = params == null ? void 0 : params.row) == null ? void 0 : _b2[key];
|
|
35852
35852
|
return React3.cloneElement(buttons[key], {
|
|
35853
|
-
className: `${(
|
|
35854
|
-
children
|
|
35853
|
+
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
35854
|
+
children,
|
|
35855
|
+
row: params == null ? void 0 : params.row,
|
|
35855
35856
|
onClick: async (e) => {
|
|
35856
35857
|
var _a3, _b3;
|
|
35857
35858
|
e.row = params == null ? void 0 : params.row;
|
|
@@ -35895,6 +35896,7 @@ function IHTable({
|
|
|
35895
35896
|
editableFields,
|
|
35896
35897
|
onSave,
|
|
35897
35898
|
onSelect,
|
|
35899
|
+
onCloseModal,
|
|
35898
35900
|
buttons,
|
|
35899
35901
|
exportName,
|
|
35900
35902
|
modal,
|
|
@@ -35927,6 +35929,8 @@ function IHTable({
|
|
|
35927
35929
|
setOpen(true);
|
|
35928
35930
|
};
|
|
35929
35931
|
const handleClose = () => {
|
|
35932
|
+
const pass = onCloseModal ? onCloseModal == null ? void 0 : onCloseModal(modalRow) : true;
|
|
35933
|
+
if (!pass) return;
|
|
35930
35934
|
setOpen(false);
|
|
35931
35935
|
setModalRow(void 0);
|
|
35932
35936
|
};
|
package/package.json
CHANGED
package/src/container/index.tsx
CHANGED
|
@@ -87,17 +87,9 @@ export default function Container({
|
|
|
87
87
|
<div className="flex flex-1 overflow-hidden relative">
|
|
88
88
|
{/* Sidebar como drawer en mobile */}
|
|
89
89
|
<div
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
? isSidebarOpen
|
|
94
|
-
? "100%"
|
|
95
|
-
: 0
|
|
96
|
-
: isSidebarOpen
|
|
97
|
-
? 250
|
|
98
|
-
: 60,
|
|
99
|
-
}}
|
|
100
|
-
className="bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out"
|
|
90
|
+
className={`bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out
|
|
91
|
+
${isSidebarOpen ? "w-full md:w-[250px]" : "w-0 md:w-[60px]"}
|
|
92
|
+
`}
|
|
101
93
|
>
|
|
102
94
|
<div className="p-4 ">
|
|
103
95
|
{
|
package/src/table/index.tsx
CHANGED
|
@@ -28,6 +28,7 @@ interface TableProps {
|
|
|
28
28
|
editableFields?: string[];
|
|
29
29
|
onSelect?: (data: GridValidRowModel[]) => void;
|
|
30
30
|
onSave?: (data: GridValidRowModel[]) => void;
|
|
31
|
+
onCloseModal?: (data: GridValidRowModel | undefined) => boolean;
|
|
31
32
|
buttons?: Record<string, any>;
|
|
32
33
|
exportName?: string;
|
|
33
34
|
modal?: React.ReactNode;
|
|
@@ -167,11 +168,11 @@ interface ModalDialogProps {
|
|
|
167
168
|
|
|
168
169
|
function ModalDialog({ open, onClose, modal, selectedRow }: ModalDialogProps) {
|
|
169
170
|
return (
|
|
170
|
-
<Dialog open={open}
|
|
171
|
+
<Dialog open={open} maxWidth="xl" fullWidth>
|
|
171
172
|
<div className="flex justify-end">
|
|
172
173
|
<button
|
|
173
174
|
onClick={onClose}
|
|
174
|
-
className="
|
|
175
|
+
className=" font-bold p-1 m-5 w-[30px] h-[30px] flex items-center justify-center hover:animate-pulse border shadow rounded bg-red-500 text-white"
|
|
175
176
|
>
|
|
176
177
|
×
|
|
177
178
|
</button>
|
|
@@ -317,10 +318,14 @@ function useColumns(
|
|
|
317
318
|
editable: editableFields?.includes(key) ?? false,
|
|
318
319
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
319
320
|
renderCell: buttons?.[key]
|
|
320
|
-
? (params: any) =>
|
|
321
|
-
|
|
321
|
+
? (params: any) => {
|
|
322
|
+
const children =
|
|
323
|
+
buttons?.[key]?.type == "input" ? null : params?.row?.[key];
|
|
324
|
+
|
|
325
|
+
return React.cloneElement(buttons[key], {
|
|
322
326
|
className: `${params?.className ?? ""} m-auto text-xs`,
|
|
323
|
-
children
|
|
327
|
+
children,
|
|
328
|
+
row: params?.row,
|
|
324
329
|
onClick: async (e: TableButtonProps) => {
|
|
325
330
|
e.row = params?.row;
|
|
326
331
|
if (buttons[key]?.props?.onClick) {
|
|
@@ -329,7 +334,8 @@ function useColumns(
|
|
|
329
334
|
if (newVal) handleRowUpdate({ ...e.row, newVal });
|
|
330
335
|
}
|
|
331
336
|
},
|
|
332
|
-
})
|
|
337
|
+
});
|
|
338
|
+
}
|
|
333
339
|
: null,
|
|
334
340
|
}));
|
|
335
341
|
|
|
@@ -366,6 +372,7 @@ function IHTable({
|
|
|
366
372
|
editableFields,
|
|
367
373
|
onSave,
|
|
368
374
|
onSelect,
|
|
375
|
+
onCloseModal,
|
|
369
376
|
buttons,
|
|
370
377
|
exportName,
|
|
371
378
|
modal,
|
|
@@ -402,6 +409,9 @@ function IHTable({
|
|
|
402
409
|
setOpen(true);
|
|
403
410
|
};
|
|
404
411
|
const handleClose = () => {
|
|
412
|
+
const pass = onCloseModal ? onCloseModal?.(modalRow) : true;
|
|
413
|
+
|
|
414
|
+
if (!pass) return;
|
|
405
415
|
setOpen(false);
|
|
406
416
|
setModalRow(undefined);
|
|
407
417
|
};
|