next-recomponents 2.0.27 → 2.0.29
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 +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +295 -112
- package/dist/index.mjs +253 -70
- package/package.json +1 -1
- package/src/input/index.tsx +66 -12
- package/src/table/index.tsx +171 -19
package/dist/index.js
CHANGED
|
@@ -3885,6 +3885,7 @@ function Form({
|
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
3887
|
// src/input/index.tsx
|
|
3888
|
+
var import_react4 = require("react");
|
|
3888
3889
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3889
3890
|
function Input({
|
|
3890
3891
|
label,
|
|
@@ -3895,27 +3896,96 @@ function Input({
|
|
|
3895
3896
|
}) {
|
|
3896
3897
|
const value = `${(props == null ? void 0 : props.value) || ""}`;
|
|
3897
3898
|
const isValid = !regex ? true : regex.test(value);
|
|
3899
|
+
const isPassword = props.type === "password";
|
|
3900
|
+
const [showPassword, setShowPassword] = (0, import_react4.useState)(false);
|
|
3898
3901
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w-full", children: [
|
|
3899
3902
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
3900
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "font-bold
|
|
3903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "font-bold", children: [
|
|
3901
3904
|
label,
|
|
3902
3905
|
" ",
|
|
3903
3906
|
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-red-500", children: "*" })
|
|
3904
3907
|
] }),
|
|
3905
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
3909
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3910
|
+
"input",
|
|
3911
|
+
{
|
|
3912
|
+
...props,
|
|
3913
|
+
type: isPassword && showPassword ? "text" : props.type,
|
|
3914
|
+
className: [
|
|
3915
|
+
"p-2 w-full rounded border shadow",
|
|
3916
|
+
isPassword && "pr-10",
|
|
3917
|
+
value !== "" && !isValid && "bg-red-200 text-black",
|
|
3918
|
+
value !== "" && isValid && "bg-green-200 text-black",
|
|
3919
|
+
className
|
|
3920
|
+
].filter(Boolean).join(" ")
|
|
3921
|
+
}
|
|
3922
|
+
),
|
|
3923
|
+
isPassword && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3924
|
+
"button",
|
|
3925
|
+
{
|
|
3926
|
+
type: "button",
|
|
3927
|
+
onClick: () => setShowPassword((prev) => !prev),
|
|
3928
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-800 focus:outline-none",
|
|
3929
|
+
"aria-label": showPassword ? "Ocultar contrase\xF1a" : "Mostrar contrase\xF1a",
|
|
3930
|
+
children: showPassword ? (
|
|
3931
|
+
// Ojo cerrado (ocultar)
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3933
|
+
"svg",
|
|
3934
|
+
{
|
|
3935
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3936
|
+
className: "h-5 w-5",
|
|
3937
|
+
fill: "none",
|
|
3938
|
+
viewBox: "0 0 24 24",
|
|
3939
|
+
stroke: "currentColor",
|
|
3940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3941
|
+
"path",
|
|
3942
|
+
{
|
|
3943
|
+
strokeLinecap: "round",
|
|
3944
|
+
strokeLinejoin: "round",
|
|
3945
|
+
strokeWidth: 2,
|
|
3946
|
+
d: "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
|
|
3947
|
+
}
|
|
3948
|
+
)
|
|
3949
|
+
}
|
|
3950
|
+
)
|
|
3951
|
+
) : (
|
|
3952
|
+
// Ojo abierto (mostrar)
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3954
|
+
"svg",
|
|
3955
|
+
{
|
|
3956
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3957
|
+
className: "h-5 w-5",
|
|
3958
|
+
fill: "none",
|
|
3959
|
+
viewBox: "0 0 24 24",
|
|
3960
|
+
stroke: "currentColor",
|
|
3961
|
+
children: [
|
|
3962
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3963
|
+
"path",
|
|
3964
|
+
{
|
|
3965
|
+
strokeLinecap: "round",
|
|
3966
|
+
strokeLinejoin: "round",
|
|
3967
|
+
strokeWidth: 2,
|
|
3968
|
+
d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
|
3969
|
+
}
|
|
3970
|
+
),
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3972
|
+
"path",
|
|
3973
|
+
{
|
|
3974
|
+
strokeLinecap: "round",
|
|
3975
|
+
strokeLinejoin: "round",
|
|
3976
|
+
strokeWidth: 2,
|
|
3977
|
+
d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
|
|
3978
|
+
}
|
|
3979
|
+
)
|
|
3980
|
+
]
|
|
3981
|
+
}
|
|
3982
|
+
)
|
|
3983
|
+
)
|
|
3984
|
+
}
|
|
3985
|
+
)
|
|
3986
|
+
] })
|
|
3917
3987
|
] }),
|
|
3918
|
-
!isValid && value
|
|
3988
|
+
!isValid && value !== "" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-red-800 invalid", children: invalidMessage })
|
|
3919
3989
|
] });
|
|
3920
3990
|
}
|
|
3921
3991
|
|
|
@@ -3930,7 +4000,7 @@ var regular_expresions_default = regularExpresions;
|
|
|
3930
4000
|
// src/table/index.tsx
|
|
3931
4001
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
3932
4002
|
var import_material = require("@mui/material");
|
|
3933
|
-
var
|
|
4003
|
+
var import_react5 = __toESM(require("react"));
|
|
3934
4004
|
|
|
3935
4005
|
// ../../node_modules/xlsx/xlsx.mjs
|
|
3936
4006
|
var XLSX = {};
|
|
@@ -35782,7 +35852,7 @@ function ModalDialog({ open, onClose, modal, selectedRow }) {
|
|
|
35782
35852
|
children: "\xD7"
|
|
35783
35853
|
}
|
|
35784
35854
|
) }),
|
|
35785
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-4 m-auto p-5", children: selectedRow &&
|
|
35855
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-4 m-auto p-5", children: selectedRow && import_react5.default.cloneElement(
|
|
35786
35856
|
modal,
|
|
35787
35857
|
{ row: selectedRow, hide: onClose }
|
|
35788
35858
|
) })
|
|
@@ -35828,10 +35898,11 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35828
35898
|
buttons,
|
|
35829
35899
|
hideColumns,
|
|
35830
35900
|
modal,
|
|
35901
|
+
wrapText,
|
|
35831
35902
|
handleRowUpdate,
|
|
35832
35903
|
onModalOpen
|
|
35833
35904
|
} = options;
|
|
35834
|
-
return (0,
|
|
35905
|
+
return (0, import_react5.useMemo)(() => {
|
|
35835
35906
|
if (!rows.length) return [];
|
|
35836
35907
|
const cols = Object.keys(rows[0]).filter((key) => !key.startsWith("_") && !hideColumns.includes(key)).map((key) => {
|
|
35837
35908
|
var _a, _b;
|
|
@@ -35866,10 +35937,24 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35866
35937
|
width: key == "id" ? 80 : (_a = colSize == null ? void 0 : colSize[key]) != null ? _a : void 0,
|
|
35867
35938
|
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
35868
35939
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
35940
|
+
// When wrapText is enabled, allow cells to grow vertically
|
|
35941
|
+
...wrapText && {
|
|
35942
|
+
renderHeader: (params) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35943
|
+
"span",
|
|
35944
|
+
{
|
|
35945
|
+
style: {
|
|
35946
|
+
whiteSpace: "normal",
|
|
35947
|
+
lineHeight: 1.3,
|
|
35948
|
+
wordBreak: "break-word"
|
|
35949
|
+
},
|
|
35950
|
+
children: params.colDef.headerName
|
|
35951
|
+
}
|
|
35952
|
+
)
|
|
35953
|
+
},
|
|
35869
35954
|
renderCell: (buttons == null ? void 0 : buttons[key]) ? (params) => {
|
|
35870
35955
|
var _a2, _b2, _c;
|
|
35871
35956
|
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
|
-
return
|
|
35957
|
+
return import_react5.default.cloneElement(buttons[key], {
|
|
35873
35958
|
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
35874
35959
|
children,
|
|
35875
35960
|
row: params == null ? void 0 : params.row,
|
|
@@ -35882,6 +35967,24 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35882
35967
|
}
|
|
35883
35968
|
}
|
|
35884
35969
|
});
|
|
35970
|
+
} : wrapText ? (params) => {
|
|
35971
|
+
var _a2;
|
|
35972
|
+
return (
|
|
35973
|
+
// Plain cell with wrap — no custom button
|
|
35974
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35975
|
+
"span",
|
|
35976
|
+
{
|
|
35977
|
+
style: {
|
|
35978
|
+
whiteSpace: "normal",
|
|
35979
|
+
wordBreak: "break-word",
|
|
35980
|
+
lineHeight: 1.4,
|
|
35981
|
+
padding: "6px 0",
|
|
35982
|
+
display: "block"
|
|
35983
|
+
},
|
|
35984
|
+
children: (_a2 = params.formattedValue) != null ? _a2 : params.value
|
|
35985
|
+
}
|
|
35986
|
+
)
|
|
35987
|
+
);
|
|
35885
35988
|
} : null
|
|
35886
35989
|
};
|
|
35887
35990
|
});
|
|
@@ -35889,7 +35992,6 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35889
35992
|
cols.unshift({
|
|
35890
35993
|
field: "Modal",
|
|
35891
35994
|
headerName: "Modal",
|
|
35892
|
-
// flex,
|
|
35893
35995
|
editable: false,
|
|
35894
35996
|
type: "string",
|
|
35895
35997
|
width: 10,
|
|
@@ -35908,7 +36010,57 @@ function useColumns(rows, currentCoin, options, colSize) {
|
|
|
35908
36010
|
});
|
|
35909
36011
|
}
|
|
35910
36012
|
return cols;
|
|
35911
|
-
}, [rows]);
|
|
36013
|
+
}, [rows, wrapText]);
|
|
36014
|
+
}
|
|
36015
|
+
function SearchBar({
|
|
36016
|
+
value,
|
|
36017
|
+
onChange
|
|
36018
|
+
}) {
|
|
36019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 px-2 pb-1", children: [
|
|
36020
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36021
|
+
"svg",
|
|
36022
|
+
{
|
|
36023
|
+
className: "text-gray-400 shrink-0",
|
|
36024
|
+
width: "14",
|
|
36025
|
+
height: "14",
|
|
36026
|
+
viewBox: "0 0 20 20",
|
|
36027
|
+
fill: "currentColor",
|
|
36028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36029
|
+
"path",
|
|
36030
|
+
{
|
|
36031
|
+
fillRule: "evenodd",
|
|
36032
|
+
d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",
|
|
36033
|
+
clipRule: "evenodd"
|
|
36034
|
+
}
|
|
36035
|
+
)
|
|
36036
|
+
}
|
|
36037
|
+
),
|
|
36038
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36039
|
+
"input",
|
|
36040
|
+
{
|
|
36041
|
+
type: "text",
|
|
36042
|
+
value,
|
|
36043
|
+
onChange: (e) => onChange(e.target.value),
|
|
36044
|
+
placeholder: "Buscar\u2026",
|
|
36045
|
+
className: "w-full max-w-xs text-xs border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200 transition"
|
|
36046
|
+
}
|
|
36047
|
+
),
|
|
36048
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36049
|
+
"button",
|
|
36050
|
+
{
|
|
36051
|
+
onClick: () => onChange(""),
|
|
36052
|
+
className: "text-gray-400 hover:text-gray-600 text-sm leading-none",
|
|
36053
|
+
title: "Limpiar b\xFAsqueda",
|
|
36054
|
+
children: "\xD7"
|
|
36055
|
+
}
|
|
36056
|
+
)
|
|
36057
|
+
] });
|
|
36058
|
+
}
|
|
36059
|
+
function rowMatchesSearch(row, query) {
|
|
36060
|
+
if (!query.trim()) return true;
|
|
36061
|
+
const words = query.trim().toLowerCase().split(/\s+/);
|
|
36062
|
+
const rowText = Object.values(row).filter((v) => v != null && v !== "").join(" ").toLowerCase();
|
|
36063
|
+
return words.every((word) => rowText.includes(word));
|
|
35912
36064
|
}
|
|
35913
36065
|
function IHTable({
|
|
35914
36066
|
data,
|
|
@@ -35928,20 +36080,25 @@ function IHTable({
|
|
|
35928
36080
|
currentCoin = "$",
|
|
35929
36081
|
fontSize = "1rem",
|
|
35930
36082
|
className,
|
|
35931
|
-
colSize
|
|
36083
|
+
colSize,
|
|
36084
|
+
rowHeight,
|
|
36085
|
+
wrapText = false,
|
|
36086
|
+
density = "standard",
|
|
36087
|
+
searchable = false
|
|
35932
36088
|
}) {
|
|
35933
36089
|
var _a;
|
|
35934
36090
|
if (modal && onSelect)
|
|
35935
36091
|
throw new Error("Solo se puede usar modal o onSelect por separado");
|
|
35936
|
-
const [open, setOpen] = (0,
|
|
35937
|
-
const [rows, setRows] = (0,
|
|
35938
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
36092
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
36093
|
+
const [rows, setRows] = (0, import_react5.useState)(data);
|
|
36094
|
+
const [selectedRows, setSelectedRows] = (0, import_react5.useState)({
|
|
35939
36095
|
type: "include",
|
|
35940
36096
|
ids: /* @__PURE__ */ new Set()
|
|
35941
36097
|
});
|
|
35942
|
-
const [modalRow, setModalRow] = (0,
|
|
36098
|
+
const [modalRow, setModalRow] = (0, import_react5.useState)();
|
|
36099
|
+
const [searchQuery, setSearchQuery] = (0, import_react5.useState)("");
|
|
35943
36100
|
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
35944
|
-
(0,
|
|
36101
|
+
(0, import_react5.useEffect)(() => {
|
|
35945
36102
|
setRows(data);
|
|
35946
36103
|
}, [data]);
|
|
35947
36104
|
const handleModalOpen = (row) => {
|
|
@@ -35962,7 +36119,7 @@ function IHTable({
|
|
|
35962
36119
|
);
|
|
35963
36120
|
return updated;
|
|
35964
36121
|
};
|
|
35965
|
-
const filteredRows = (0,
|
|
36122
|
+
const filteredRows = (0, import_react5.useMemo)(() => {
|
|
35966
36123
|
if ((selectedRows == null ? void 0 : selectedRows.type) === "exclude") {
|
|
35967
36124
|
return rows.filter((r) => !Array.from(selectedRows.ids).includes(r.id));
|
|
35968
36125
|
}
|
|
@@ -35971,8 +36128,12 @@ function IHTable({
|
|
|
35971
36128
|
}
|
|
35972
36129
|
return [];
|
|
35973
36130
|
}, [selectedRows, rows]);
|
|
36131
|
+
const displayRows = (0, import_react5.useMemo)(
|
|
36132
|
+
() => searchable ? rows.filter((r) => rowMatchesSearch(r, searchQuery)) : rows,
|
|
36133
|
+
[rows, searchQuery, searchable]
|
|
36134
|
+
);
|
|
35974
36135
|
const columns = useColumns(
|
|
35975
|
-
|
|
36136
|
+
displayRows,
|
|
35976
36137
|
currentCoin,
|
|
35977
36138
|
{
|
|
35978
36139
|
flex,
|
|
@@ -35980,31 +36141,36 @@ function IHTable({
|
|
|
35980
36141
|
buttons: resolvedButtons,
|
|
35981
36142
|
hideColumns,
|
|
35982
36143
|
modal,
|
|
36144
|
+
wrapText,
|
|
35983
36145
|
handleRowUpdate,
|
|
35984
36146
|
onModalOpen: handleModalOpen
|
|
35985
36147
|
},
|
|
35986
36148
|
colSize
|
|
35987
36149
|
);
|
|
35988
36150
|
if (!rows.length) return null;
|
|
36151
|
+
const rowHeightProps = wrapText ? { getRowHeight: () => "auto" } : rowHeight != null ? { rowHeight } : {};
|
|
35989
36152
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "m-2", children: [
|
|
35990
36153
|
header && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "font-bold p-2 ", children: header }),
|
|
35991
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
36000
|
-
|
|
36154
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-between", children: [
|
|
36155
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36156
|
+
Toolbar,
|
|
36157
|
+
{
|
|
36158
|
+
exportName,
|
|
36159
|
+
onSave,
|
|
36160
|
+
onSelect,
|
|
36161
|
+
rows,
|
|
36162
|
+
filteredRows
|
|
36163
|
+
}
|
|
36164
|
+
),
|
|
36165
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchBar, { value: searchQuery, onChange: setSearchQuery })
|
|
36166
|
+
] }),
|
|
36001
36167
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
36002
36168
|
import_material.Box,
|
|
36003
36169
|
{
|
|
36004
36170
|
sx: {
|
|
36005
36171
|
display: "flex",
|
|
36006
36172
|
flexDirection: "column",
|
|
36007
|
-
height: (_a = HEIGHT_MAP[
|
|
36173
|
+
height: (_a = HEIGHT_MAP[displayRows.length]) != null ? _a : height,
|
|
36008
36174
|
width,
|
|
36009
36175
|
zIndex: 999999999
|
|
36010
36176
|
},
|
|
@@ -36022,25 +36188,42 @@ function IHTable({
|
|
|
36022
36188
|
import_x_data_grid.DataGrid,
|
|
36023
36189
|
{
|
|
36024
36190
|
className,
|
|
36025
|
-
rows,
|
|
36191
|
+
rows: displayRows,
|
|
36026
36192
|
columns,
|
|
36193
|
+
density,
|
|
36027
36194
|
checkboxSelection: Boolean(onSelect),
|
|
36028
36195
|
rowSelectionModel: selectedRows,
|
|
36029
36196
|
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
36197
|
+
...rowHeightProps,
|
|
36030
36198
|
sx: {
|
|
36031
36199
|
fontSize,
|
|
36032
|
-
// equivalente a text-xs
|
|
36033
36200
|
"& .MuiDataGrid-cell": {
|
|
36034
|
-
fontSize
|
|
36201
|
+
fontSize,
|
|
36202
|
+
// Allow cells to wrap text when wrapText is enabled
|
|
36203
|
+
...wrapText && {
|
|
36204
|
+
alignItems: "flex-start",
|
|
36205
|
+
paddingTop: "8px",
|
|
36206
|
+
paddingBottom: "8px",
|
|
36207
|
+
whiteSpace: "normal",
|
|
36208
|
+
wordBreak: "break-word"
|
|
36209
|
+
}
|
|
36035
36210
|
},
|
|
36036
36211
|
"& .MuiDataGrid-columnHeader": {
|
|
36037
|
-
fontSize
|
|
36212
|
+
fontSize,
|
|
36213
|
+
...wrapText && {
|
|
36214
|
+
whiteSpace: "normal",
|
|
36215
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
36216
|
+
whiteSpace: "normal",
|
|
36217
|
+
lineHeight: 1.3,
|
|
36218
|
+
wordBreak: "break-word"
|
|
36219
|
+
}
|
|
36220
|
+
}
|
|
36038
36221
|
},
|
|
36039
36222
|
"& .MuiDataGrid-cell--editable": {
|
|
36040
36223
|
backgroundColor: "#c6d8f0",
|
|
36041
36224
|
fontWeight: 500
|
|
36042
36225
|
},
|
|
36043
|
-
...
|
|
36226
|
+
...displayRows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
36044
36227
|
"& .MuiDataGrid-filler": {
|
|
36045
36228
|
display: "none"
|
|
36046
36229
|
}
|
|
@@ -36049,13 +36232,13 @@ function IHTable({
|
|
|
36049
36232
|
editMode: "row",
|
|
36050
36233
|
processRowUpdate: handleRowUpdate,
|
|
36051
36234
|
pageSizeOptions: [5, 10],
|
|
36052
|
-
hideFooter:
|
|
36235
|
+
hideFooter: displayRows.length <= Object.keys(HEIGHT_MAP).length
|
|
36053
36236
|
}
|
|
36054
36237
|
)
|
|
36055
36238
|
]
|
|
36056
36239
|
}
|
|
36057
36240
|
),
|
|
36058
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CustomFooter, { footer, rows })
|
|
36241
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CustomFooter, { footer, rows: displayRows })
|
|
36059
36242
|
] });
|
|
36060
36243
|
}
|
|
36061
36244
|
function Table(props) {
|
|
@@ -36066,7 +36249,7 @@ function Table(props) {
|
|
|
36066
36249
|
}
|
|
36067
36250
|
|
|
36068
36251
|
// src/text-area/index.tsx
|
|
36069
|
-
var
|
|
36252
|
+
var import_react6 = require("react");
|
|
36070
36253
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
36071
36254
|
function TextArea({
|
|
36072
36255
|
label,
|
|
@@ -36076,7 +36259,7 @@ function TextArea({
|
|
|
36076
36259
|
children = "",
|
|
36077
36260
|
...props
|
|
36078
36261
|
}) {
|
|
36079
|
-
const [value, setValue] = (0,
|
|
36262
|
+
const [value, setValue] = (0, import_react6.useState)((props == null ? void 0 : props.value) || "");
|
|
36080
36263
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
36081
36264
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "font-bold ", children: [
|
|
36082
36265
|
label,
|
|
@@ -36111,12 +36294,12 @@ function TextArea({
|
|
|
36111
36294
|
}
|
|
36112
36295
|
|
|
36113
36296
|
// src/use-resources/index.ts
|
|
36114
|
-
var
|
|
36297
|
+
var import_react8 = require("react");
|
|
36115
36298
|
|
|
36116
36299
|
// src/use-resources/get.token.tsx
|
|
36117
|
-
var
|
|
36300
|
+
var import_react7 = require("react");
|
|
36118
36301
|
function useToken() {
|
|
36119
|
-
const token = (0,
|
|
36302
|
+
const token = (0, import_react7.useMemo)(() => {
|
|
36120
36303
|
if (typeof window != "undefined") {
|
|
36121
36304
|
const t = window.localStorage.getItem("token");
|
|
36122
36305
|
if (t) return t;
|
|
@@ -36208,7 +36391,7 @@ function useResources({
|
|
|
36208
36391
|
onError
|
|
36209
36392
|
}) {
|
|
36210
36393
|
const token = useToken();
|
|
36211
|
-
const [info, setInfo] = (0,
|
|
36394
|
+
const [info, setInfo] = (0, import_react8.useState)(
|
|
36212
36395
|
Object.keys(endpoints).reduce((acc, key) => {
|
|
36213
36396
|
var _a, _b;
|
|
36214
36397
|
const newAcc = {
|
|
@@ -36591,14 +36774,14 @@ function useResources({
|
|
|
36591
36774
|
}
|
|
36592
36775
|
}
|
|
36593
36776
|
}
|
|
36594
|
-
(0,
|
|
36777
|
+
(0, import_react8.useEffect)(() => {
|
|
36595
36778
|
doSome();
|
|
36596
36779
|
}, [JSON.stringify(Object.values(info).map((v) => v.loaded))]);
|
|
36597
36780
|
return results;
|
|
36598
36781
|
}
|
|
36599
36782
|
|
|
36600
36783
|
// src/select/index.tsx
|
|
36601
|
-
var
|
|
36784
|
+
var import_react9 = __toESM(require("react"));
|
|
36602
36785
|
|
|
36603
36786
|
// src/select/icon.tsx
|
|
36604
36787
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
@@ -36645,24 +36828,24 @@ function Select({
|
|
|
36645
36828
|
strictMode = true,
|
|
36646
36829
|
...props
|
|
36647
36830
|
}) {
|
|
36648
|
-
const [isOpen, setIsOpen] = (0,
|
|
36649
|
-
const [inputValue, setInputValue] = (0,
|
|
36650
|
-
const [options, setOptions] = (0,
|
|
36831
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
36832
|
+
const [inputValue, setInputValue] = (0, import_react9.useState)("");
|
|
36833
|
+
const [options, setOptions] = (0, import_react9.useState)(
|
|
36651
36834
|
[]
|
|
36652
36835
|
);
|
|
36653
|
-
const [filtered, setFiltered] = (0,
|
|
36836
|
+
const [filtered, setFiltered] = (0, import_react9.useState)(
|
|
36654
36837
|
[]
|
|
36655
36838
|
);
|
|
36656
|
-
const [hasEdition, setHasEdition] = (0,
|
|
36657
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
36658
|
-
const inputRef = (0,
|
|
36839
|
+
const [hasEdition, setHasEdition] = (0, import_react9.useState)(false);
|
|
36840
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react9.useState)(-1);
|
|
36841
|
+
const inputRef = (0, import_react9.useRef)(null);
|
|
36659
36842
|
const validOption = (value) => {
|
|
36660
36843
|
return options.find((opt) => opt.label == value);
|
|
36661
36844
|
};
|
|
36662
36845
|
const normalize = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z]/g, "");
|
|
36663
|
-
(0,
|
|
36846
|
+
(0, import_react9.useEffect)(() => {
|
|
36664
36847
|
var _a;
|
|
36665
|
-
const parsedOptions =
|
|
36848
|
+
const parsedOptions = import_react9.default.Children.toArray(children).filter((child) => {
|
|
36666
36849
|
return child.type === "option";
|
|
36667
36850
|
}).map((child) => {
|
|
36668
36851
|
return {
|
|
@@ -36675,7 +36858,7 @@ function Select({
|
|
|
36675
36858
|
const value = (props == null ? void 0 : props.value) && ((_a = parsedOptions.find((opt) => opt.value == props.value)) == null ? void 0 : _a.label);
|
|
36676
36859
|
setInputValue(value);
|
|
36677
36860
|
}, [children]);
|
|
36678
|
-
(0,
|
|
36861
|
+
(0, import_react9.useEffect)(() => {
|
|
36679
36862
|
const items = options.filter((opt) => {
|
|
36680
36863
|
if (!hasEdition) return true;
|
|
36681
36864
|
const normilizedLabel = normalize(`${opt == null ? void 0 : opt.label}`);
|
|
@@ -36703,9 +36886,9 @@ function Select({
|
|
|
36703
36886
|
setInputValue(opt.label);
|
|
36704
36887
|
setIsOpen(false);
|
|
36705
36888
|
};
|
|
36706
|
-
const containerRef = (0,
|
|
36707
|
-
const [openUpwards, setOpenUpwards] = (0,
|
|
36708
|
-
(0,
|
|
36889
|
+
const containerRef = (0, import_react9.useRef)(null);
|
|
36890
|
+
const [openUpwards, setOpenUpwards] = (0, import_react9.useState)(false);
|
|
36891
|
+
(0, import_react9.useEffect)(() => {
|
|
36709
36892
|
if (isOpen && containerRef.current) {
|
|
36710
36893
|
const rect = containerRef.current.getBoundingClientRect();
|
|
36711
36894
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -36838,10 +37021,10 @@ function Select({
|
|
|
36838
37021
|
}
|
|
36839
37022
|
|
|
36840
37023
|
// src/modal/index.tsx
|
|
36841
|
-
var
|
|
37024
|
+
var import_react11 = require("react");
|
|
36842
37025
|
|
|
36843
37026
|
// src/pop/index.tsx
|
|
36844
|
-
var
|
|
37027
|
+
var import_react10 = require("react");
|
|
36845
37028
|
|
|
36846
37029
|
// src/pop/actions.tsx
|
|
36847
37030
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -37085,9 +37268,9 @@ var INITIAL_STATE = {
|
|
|
37085
37268
|
full: false
|
|
37086
37269
|
};
|
|
37087
37270
|
function usePopup() {
|
|
37088
|
-
const [popup, setPopup] = (0,
|
|
37089
|
-
const messageRef = (0,
|
|
37090
|
-
const open = (0,
|
|
37271
|
+
const [popup, setPopup] = (0, import_react10.useState)(INITIAL_STATE);
|
|
37272
|
+
const messageRef = (0, import_react10.useRef)(null);
|
|
37273
|
+
const open = (0, import_react10.useCallback)(
|
|
37091
37274
|
(partial) => {
|
|
37092
37275
|
const { message, ...rest } = partial;
|
|
37093
37276
|
messageRef.current = message;
|
|
@@ -37095,7 +37278,7 @@ function usePopup() {
|
|
|
37095
37278
|
},
|
|
37096
37279
|
[]
|
|
37097
37280
|
);
|
|
37098
|
-
const close = (0,
|
|
37281
|
+
const close = (0, import_react10.useCallback)((confirmed, value) => {
|
|
37099
37282
|
setPopup((prev) => {
|
|
37100
37283
|
var _a, _b;
|
|
37101
37284
|
if (confirmed) (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
@@ -37103,7 +37286,7 @@ function usePopup() {
|
|
|
37103
37286
|
return { ...prev, visible: false, inputValue: "" };
|
|
37104
37287
|
});
|
|
37105
37288
|
}, []);
|
|
37106
|
-
const alert2 = (0,
|
|
37289
|
+
const alert2 = (0, import_react10.useCallback)(
|
|
37107
37290
|
(message, color = "primary") => new Promise(
|
|
37108
37291
|
(resolve) => open({
|
|
37109
37292
|
type: "alert",
|
|
@@ -37115,7 +37298,7 @@ function usePopup() {
|
|
|
37115
37298
|
),
|
|
37116
37299
|
[open]
|
|
37117
37300
|
);
|
|
37118
|
-
const modal = (0,
|
|
37301
|
+
const modal = (0, import_react10.useCallback)(
|
|
37119
37302
|
(message, color = "primary", icons = false, full = false) => new Promise(
|
|
37120
37303
|
(resolve) => open({
|
|
37121
37304
|
type: "modal",
|
|
@@ -37129,7 +37312,7 @@ function usePopup() {
|
|
|
37129
37312
|
),
|
|
37130
37313
|
[open]
|
|
37131
37314
|
);
|
|
37132
|
-
const confirm = (0,
|
|
37315
|
+
const confirm = (0, import_react10.useCallback)(
|
|
37133
37316
|
(message, color = "primary") => new Promise(
|
|
37134
37317
|
(resolve) => open({
|
|
37135
37318
|
type: "confirm",
|
|
@@ -37141,7 +37324,7 @@ function usePopup() {
|
|
|
37141
37324
|
),
|
|
37142
37325
|
[open]
|
|
37143
37326
|
);
|
|
37144
|
-
const prompt = (0,
|
|
37327
|
+
const prompt = (0, import_react10.useCallback)(
|
|
37145
37328
|
(message, color = "primary") => new Promise(
|
|
37146
37329
|
(resolve) => open({
|
|
37147
37330
|
type: "prompt",
|
|
@@ -37153,7 +37336,7 @@ function usePopup() {
|
|
|
37153
37336
|
),
|
|
37154
37337
|
[open]
|
|
37155
37338
|
);
|
|
37156
|
-
const updateMessage = (0,
|
|
37339
|
+
const updateMessage = (0, import_react10.useCallback)((message) => {
|
|
37157
37340
|
messageRef.current = message;
|
|
37158
37341
|
setPopup((prev) => ({ ...prev }));
|
|
37159
37342
|
}, []);
|
|
@@ -37186,14 +37369,14 @@ function Modal({
|
|
|
37186
37369
|
}) {
|
|
37187
37370
|
const pop = usePopup();
|
|
37188
37371
|
const hide = () => pop.close(false);
|
|
37189
|
-
const childrenWithHide = (0,
|
|
37190
|
-
(0,
|
|
37372
|
+
const childrenWithHide = (0, import_react11.cloneElement)(children, { hide });
|
|
37373
|
+
(0, import_react11.useEffect)(() => {
|
|
37191
37374
|
pop.updateMessage(childrenWithHide);
|
|
37192
37375
|
}, [children]);
|
|
37193
37376
|
const props = button == null ? void 0 : button.props;
|
|
37194
37377
|
const onClick = props == null ? void 0 : props.onClick;
|
|
37195
37378
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
37196
|
-
(0,
|
|
37379
|
+
(0, import_react11.cloneElement)(button, {
|
|
37197
37380
|
onClick: (e) => {
|
|
37198
37381
|
onClick == null ? void 0 : onClick(e);
|
|
37199
37382
|
pop.modal(childrenWithHide, color, false, true);
|
|
@@ -37252,7 +37435,7 @@ function useDates() {
|
|
|
37252
37435
|
}
|
|
37253
37436
|
|
|
37254
37437
|
// src/calendar/index.tsx
|
|
37255
|
-
var
|
|
37438
|
+
var import_react12 = require("react");
|
|
37256
37439
|
var import_react_datepicker = __toESM(require("react-datepicker"));
|
|
37257
37440
|
|
|
37258
37441
|
// src/calendar/calendar.icon.tsx
|
|
@@ -37285,11 +37468,11 @@ function MyCalendar({
|
|
|
37285
37468
|
value,
|
|
37286
37469
|
...otherProps
|
|
37287
37470
|
}) {
|
|
37288
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
37289
|
-
const [dateStr, setDateStr] = (0,
|
|
37471
|
+
const [selectedDate, setSelectedDate] = (0, import_react12.useState)(null);
|
|
37472
|
+
const [dateStr, setDateStr] = (0, import_react12.useState)(
|
|
37290
37473
|
defaultValue || value || ""
|
|
37291
37474
|
);
|
|
37292
|
-
const [open, setOpen] = (0,
|
|
37475
|
+
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
37293
37476
|
function handleChange(date) {
|
|
37294
37477
|
if (!date) return;
|
|
37295
37478
|
setSelectedDate(date);
|
|
@@ -37442,10 +37625,10 @@ function DocumentViewer({ item }) {
|
|
|
37442
37625
|
}
|
|
37443
37626
|
|
|
37444
37627
|
// src/table3/index.tsx
|
|
37445
|
-
var
|
|
37628
|
+
var import_react17 = __toESM(require("react"));
|
|
37446
37629
|
|
|
37447
37630
|
// src/table3/filter.tsx
|
|
37448
|
-
var
|
|
37631
|
+
var import_react13 = require("react");
|
|
37449
37632
|
|
|
37450
37633
|
// src/table3/filters.tsx
|
|
37451
37634
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -37555,14 +37738,14 @@ function Filter({
|
|
|
37555
37738
|
sort,
|
|
37556
37739
|
setSort
|
|
37557
37740
|
}) {
|
|
37558
|
-
const [visible, setVisible] = (0,
|
|
37559
|
-
const [text, setText] = (0,
|
|
37560
|
-
const items = (0,
|
|
37741
|
+
const [visible, setVisible] = (0, import_react13.useState)(false);
|
|
37742
|
+
const [text, setText] = (0, import_react13.useState)("");
|
|
37743
|
+
const items = (0, import_react13.useMemo)(
|
|
37561
37744
|
() => [...new Set(Object.values(objectData).map((o) => o[h]))],
|
|
37562
37745
|
[objectData]
|
|
37563
37746
|
);
|
|
37564
|
-
const [selected, setSelected] = (0,
|
|
37565
|
-
const itemsFiltered = (0,
|
|
37747
|
+
const [selected, setSelected] = (0, import_react13.useState)(items);
|
|
37748
|
+
const itemsFiltered = (0, import_react13.useMemo)(
|
|
37566
37749
|
() => items.sort((a, b) => `${a}`.localeCompare(b)).filter((item) => {
|
|
37567
37750
|
if (!text) return true;
|
|
37568
37751
|
return `${item}`.toLowerCase().includes(text.toLowerCase());
|
|
@@ -37599,7 +37782,7 @@ function Filter({
|
|
|
37599
37782
|
const hidden = Object.values(objectData).filter(
|
|
37600
37783
|
(d) => d._visible === false
|
|
37601
37784
|
);
|
|
37602
|
-
(0,
|
|
37785
|
+
(0, import_react13.useEffect)(() => {
|
|
37603
37786
|
if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
|
|
37604
37787
|
const news = [...new Set(data.map((o) => o[h]))];
|
|
37605
37788
|
setSelected(news);
|
|
@@ -37850,10 +38033,10 @@ function TableHead({
|
|
|
37850
38033
|
}
|
|
37851
38034
|
|
|
37852
38035
|
// src/table3/body.tsx
|
|
37853
|
-
var
|
|
38036
|
+
var import_react15 = require("react");
|
|
37854
38037
|
|
|
37855
38038
|
// src/table3/tr.tsx
|
|
37856
|
-
var
|
|
38039
|
+
var import_react14 = __toESM(require("react"));
|
|
37857
38040
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
37858
38041
|
function TR({
|
|
37859
38042
|
handlers,
|
|
@@ -37915,7 +38098,7 @@ function TR({
|
|
|
37915
38098
|
return null;
|
|
37916
38099
|
} else if (handlers == null ? void 0 : handlers[h]) {
|
|
37917
38100
|
const original = handlers[h];
|
|
37918
|
-
const cloned =
|
|
38101
|
+
const cloned = import_react14.default.cloneElement(original, {
|
|
37919
38102
|
// si es controlado por value → actualiza con row[h]
|
|
37920
38103
|
value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
|
|
37921
38104
|
// si usa children → actualiza con row[h] también
|
|
@@ -37995,7 +38178,7 @@ function TableBody({
|
|
|
37995
38178
|
symbols,
|
|
37996
38179
|
sort
|
|
37997
38180
|
}) {
|
|
37998
|
-
const [selected, setSelected] = (0,
|
|
38181
|
+
const [selected, setSelected] = (0, import_react15.useState)(-1);
|
|
37999
38182
|
const sorted = Object.entries(objectData).sort(([, a], [, b]) => {
|
|
38000
38183
|
for (const [key, order] of Object.entries(
|
|
38001
38184
|
sort || { id: "desc", _id: "desc" }
|
|
@@ -38171,7 +38354,7 @@ function TableFooter({
|
|
|
38171
38354
|
}
|
|
38172
38355
|
|
|
38173
38356
|
// src/table3/dialog.tsx
|
|
38174
|
-
var
|
|
38357
|
+
var import_react16 = __toESM(require("react"));
|
|
38175
38358
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
38176
38359
|
function Dialog3({
|
|
38177
38360
|
modalRef,
|
|
@@ -38188,9 +38371,9 @@ function Dialog3({
|
|
|
38188
38371
|
var _a;
|
|
38189
38372
|
return (_a = modalRef.current) == null ? void 0 : _a.close();
|
|
38190
38373
|
};
|
|
38191
|
-
const clonedModal = (0,
|
|
38192
|
-
if (dialogRow &&
|
|
38193
|
-
return
|
|
38374
|
+
const clonedModal = (0, import_react16.useMemo)(() => {
|
|
38375
|
+
if (dialogRow && import_react16.default.isValidElement(children)) {
|
|
38376
|
+
return import_react16.default.cloneElement(children, {
|
|
38194
38377
|
key: JSON.stringify(dialogRow),
|
|
38195
38378
|
row: dialogRow,
|
|
38196
38379
|
show,
|
|
@@ -38244,8 +38427,8 @@ function Table3({
|
|
|
38244
38427
|
sortBy,
|
|
38245
38428
|
...props
|
|
38246
38429
|
}) {
|
|
38247
|
-
const [handlers, setHandlers] = (0,
|
|
38248
|
-
const [page, setPage] = (0,
|
|
38430
|
+
const [handlers, setHandlers] = (0, import_react17.useState)({});
|
|
38431
|
+
const [page, setPage] = (0, import_react17.useState)(1);
|
|
38249
38432
|
function dataReducer(a, b) {
|
|
38250
38433
|
if (b == null) return {};
|
|
38251
38434
|
if (Array.isArray(b)) {
|
|
@@ -38266,7 +38449,7 @@ function Table3({
|
|
|
38266
38449
|
};
|
|
38267
38450
|
const newHandlers = { ...handlers };
|
|
38268
38451
|
for (let item in cc) {
|
|
38269
|
-
const isReactComponent =
|
|
38452
|
+
const isReactComponent = import_react17.default.isValidElement(cc[item]);
|
|
38270
38453
|
if (isReactComponent) {
|
|
38271
38454
|
newHandlers[item] = cc[item];
|
|
38272
38455
|
const value = ((_c = (_b = cc[item]) == null ? void 0 : _b.props) == null ? void 0 : _c.value) || (typeof ((_e = (_d = cc[item]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) !== "object" ? (_g = (_f = cc[item]) == null ? void 0 : _f.props) == null ? void 0 : _g.children : "");
|
|
@@ -38286,12 +38469,12 @@ function Table3({
|
|
|
38286
38469
|
return newA;
|
|
38287
38470
|
}
|
|
38288
38471
|
}
|
|
38289
|
-
const [objectData, setObjectData] = (0,
|
|
38290
|
-
(0,
|
|
38472
|
+
const [objectData, setObjectData] = (0, import_react17.useReducer)(dataReducer, null);
|
|
38473
|
+
(0, import_react17.useEffect)(() => {
|
|
38291
38474
|
setObjectData(data);
|
|
38292
38475
|
setPage(1);
|
|
38293
38476
|
}, [data]);
|
|
38294
|
-
const headers = (0,
|
|
38477
|
+
const headers = (0, import_react17.useMemo)(() => {
|
|
38295
38478
|
if (!objectData) return [];
|
|
38296
38479
|
return [
|
|
38297
38480
|
...new Set(
|
|
@@ -38299,13 +38482,13 @@ function Table3({
|
|
|
38299
38482
|
)
|
|
38300
38483
|
];
|
|
38301
38484
|
}, [objectData]);
|
|
38302
|
-
const totalPages = (0,
|
|
38485
|
+
const totalPages = (0, import_react17.useMemo)(() => {
|
|
38303
38486
|
if (!objectData) return 0;
|
|
38304
38487
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38305
38488
|
}, [objectData, maxItems]);
|
|
38306
|
-
const [sort, setSort] = (0,
|
|
38307
|
-
const modalRef = (0,
|
|
38308
|
-
const [dialogRow, setDialogRow] = (0,
|
|
38489
|
+
const [sort, setSort] = (0, import_react17.useState)(sortBy);
|
|
38490
|
+
const modalRef = (0, import_react17.useRef)(null);
|
|
38491
|
+
const [dialogRow, setDialogRow] = (0, import_react17.useState)({});
|
|
38309
38492
|
const context = {
|
|
38310
38493
|
objectData,
|
|
38311
38494
|
headers,
|
|
@@ -38332,7 +38515,7 @@ function Table3({
|
|
|
38332
38515
|
setSort,
|
|
38333
38516
|
...props
|
|
38334
38517
|
};
|
|
38335
|
-
(0,
|
|
38518
|
+
(0, import_react17.useEffect)(() => {
|
|
38336
38519
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
38337
38520
|
const newDialogRow = objectData[dialogRow == null ? void 0 : dialogRow.id] || objectData[dialogRow == null ? void 0 : dialogRow._id];
|
|
38338
38521
|
setDialogRow(newDialogRow);
|