next-recomponents 2.0.30 → 2.0.32
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 +0 -27
- package/dist/index.d.ts +0 -27
- package/dist/index.js +168 -245
- package/dist/index.mjs +175 -252
- package/package.json +1 -1
- package/src/table/index.tsx +218 -312
package/dist/index.mjs
CHANGED
|
@@ -35807,10 +35807,6 @@ function CustomFooter({
|
|
|
35807
35807
|
if (!entries.length) return null;
|
|
35808
35808
|
return /* @__PURE__ */ jsx6("div", { className: "flex justify-end gap-6 px-4 py-2 bg-gray-100 border-t border-gray-300 text-sm font-semibold text-gray-700", children: entries.map(([key, type]) => {
|
|
35809
35809
|
const value = computeAggregation(rows, key, type);
|
|
35810
|
-
const formatted = value.toLocaleString("en-US", {
|
|
35811
|
-
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
35812
|
-
maximumFractionDigits: value % 1 !== 0 ? 2 : 0
|
|
35813
|
-
});
|
|
35814
35810
|
return /* @__PURE__ */ jsxs5("span", { children: [
|
|
35815
35811
|
FOOTER_LABELS[type],
|
|
35816
35812
|
" de",
|
|
@@ -35818,40 +35814,69 @@ function CustomFooter({
|
|
|
35818
35814
|
/* @__PURE__ */ jsx6("span", { className: "text-gray-900", children: key }),
|
|
35819
35815
|
":",
|
|
35820
35816
|
" ",
|
|
35821
|
-
/* @__PURE__ */ jsx6("span", { className: "text-blue-700", children:
|
|
35817
|
+
/* @__PURE__ */ jsx6("span", { className: "text-blue-700", children: value.toLocaleString() })
|
|
35822
35818
|
] }, key);
|
|
35823
35819
|
}) });
|
|
35824
35820
|
}
|
|
35825
|
-
function ModalDialog({
|
|
35821
|
+
function ModalDialog({
|
|
35822
|
+
open,
|
|
35823
|
+
onClose,
|
|
35824
|
+
modal,
|
|
35825
|
+
selectedRow,
|
|
35826
|
+
onPrev,
|
|
35827
|
+
onNext,
|
|
35828
|
+
hasPrev,
|
|
35829
|
+
hasNext
|
|
35830
|
+
}) {
|
|
35826
35831
|
return /* @__PURE__ */ jsxs5(Dialog, { open, maxWidth: "xl", fullWidth: true, children: [
|
|
35827
|
-
/* @__PURE__ */
|
|
35828
|
-
"
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35832
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between p-4 border-b", children: [
|
|
35833
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
35834
|
+
/* @__PURE__ */ jsx6(
|
|
35835
|
+
"button",
|
|
35836
|
+
{
|
|
35837
|
+
disabled: !hasPrev,
|
|
35838
|
+
onClick: onPrev,
|
|
35839
|
+
className: "px-4 py-2 rounded border bg-gray-100 hover:bg-gray-200 disabled:opacity-40",
|
|
35840
|
+
children: "\u2190 Anterior"
|
|
35841
|
+
}
|
|
35842
|
+
),
|
|
35843
|
+
/* @__PURE__ */ jsx6(
|
|
35844
|
+
"button",
|
|
35845
|
+
{
|
|
35846
|
+
disabled: !hasNext,
|
|
35847
|
+
onClick: onNext,
|
|
35848
|
+
className: "px-4 py-2 rounded border bg-gray-100 hover:bg-gray-200 disabled:opacity-40",
|
|
35849
|
+
children: "Siguiente \u2192"
|
|
35850
|
+
}
|
|
35851
|
+
)
|
|
35852
|
+
] }),
|
|
35853
|
+
/* @__PURE__ */ jsx6(
|
|
35854
|
+
"button",
|
|
35855
|
+
{
|
|
35856
|
+
onClick: onClose,
|
|
35857
|
+
className: "font-bold w-[35px] h-[35px] flex items-center justify-center hover:animate-pulse border shadow rounded bg-red-500 text-white",
|
|
35858
|
+
children: "\xD7"
|
|
35859
|
+
}
|
|
35860
|
+
)
|
|
35861
|
+
] }),
|
|
35835
35862
|
/* @__PURE__ */ jsx6("div", { className: "mt-4 m-auto p-5", children: selectedRow && React3.cloneElement(
|
|
35836
35863
|
modal,
|
|
35837
|
-
{
|
|
35864
|
+
{
|
|
35865
|
+
key: selectedRow.id,
|
|
35866
|
+
row: selectedRow,
|
|
35867
|
+
hide: onClose
|
|
35868
|
+
}
|
|
35838
35869
|
) })
|
|
35839
35870
|
] });
|
|
35840
35871
|
}
|
|
35841
|
-
function Toolbar({
|
|
35842
|
-
exportName,
|
|
35843
|
-
onSave,
|
|
35844
|
-
onSelect,
|
|
35845
|
-
rows,
|
|
35846
|
-
filteredRows
|
|
35847
|
-
}) {
|
|
35872
|
+
function Toolbar({ exportName, onSave, onSelect, rows, filteredRows }) {
|
|
35848
35873
|
const excel = useExcel();
|
|
35849
35874
|
const stripMeta = (r) => {
|
|
35850
35875
|
const { _edited, ...rest } = r;
|
|
35851
35876
|
return rest;
|
|
35852
35877
|
};
|
|
35853
35878
|
if (!exportName && !onSave && !onSelect) return null;
|
|
35854
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2
|
|
35879
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 p-2 text-xs", children: [
|
|
35855
35880
|
exportName && /* @__PURE__ */ jsx6(
|
|
35856
35881
|
Button,
|
|
35857
35882
|
{
|
|
@@ -35871,170 +35896,20 @@ function Toolbar({
|
|
|
35871
35896
|
) : onSave && /* @__PURE__ */ jsx6(Button, { onClick: () => onSave(rows.map(stripMeta)), children: "Guardar" })
|
|
35872
35897
|
] });
|
|
35873
35898
|
}
|
|
35874
|
-
function useColumns(rows, currentCoin, options, colSize) {
|
|
35875
|
-
const {
|
|
35876
|
-
flex,
|
|
35877
|
-
editableFields,
|
|
35878
|
-
buttons,
|
|
35879
|
-
hideColumns,
|
|
35880
|
-
modal,
|
|
35881
|
-
wrapText,
|
|
35882
|
-
handleRowUpdate,
|
|
35883
|
-
onModalOpen
|
|
35884
|
-
} = options;
|
|
35885
|
-
return useMemo(() => {
|
|
35886
|
-
if (!rows.length) return [];
|
|
35887
|
-
const cols = Object.keys(rows[0]).filter((key) => !key.startsWith("_") && !hideColumns.includes(key)).map((key) => {
|
|
35888
|
-
var _a, _b;
|
|
35889
|
-
return {
|
|
35890
|
-
field: key,
|
|
35891
|
-
headerName: key,
|
|
35892
|
-
valueFormatter: (value) => {
|
|
35893
|
-
if (value == null || value === "") return "";
|
|
35894
|
-
const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
|
|
35895
|
-
if (`${value}`.match(isDate)) {
|
|
35896
|
-
return value.toString().split("T")[0].split("-").reverse().join("/");
|
|
35897
|
-
}
|
|
35898
|
-
const splited = `${value}`.split(".");
|
|
35899
|
-
const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
|
|
35900
|
-
if (hasDecimals) {
|
|
35901
|
-
return [
|
|
35902
|
-
currentCoin,
|
|
35903
|
-
(+`${value}`).toLocaleString("en-US", {
|
|
35904
|
-
minimumFractionDigits: 2,
|
|
35905
|
-
maximumFractionDigits: 2
|
|
35906
|
-
})
|
|
35907
|
-
].join(" ");
|
|
35908
|
-
}
|
|
35909
|
-
const isNumber = typeof value === "number";
|
|
35910
|
-
if (isNumber) {
|
|
35911
|
-
if (isNaN(value)) return value;
|
|
35912
|
-
return value;
|
|
35913
|
-
}
|
|
35914
|
-
return value;
|
|
35915
|
-
},
|
|
35916
|
-
flex: key == "id" ? false : !(colSize == null ? void 0 : colSize[key]),
|
|
35917
|
-
width: key == "id" ? 80 : (_a = colSize == null ? void 0 : colSize[key]) != null ? _a : void 0,
|
|
35918
|
-
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
35919
|
-
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
35920
|
-
// When wrapText is enabled, allow cells to grow vertically
|
|
35921
|
-
...wrapText && {
|
|
35922
|
-
renderHeader: (params) => /* @__PURE__ */ jsx6(
|
|
35923
|
-
"span",
|
|
35924
|
-
{
|
|
35925
|
-
style: {
|
|
35926
|
-
whiteSpace: "normal",
|
|
35927
|
-
lineHeight: 1.3,
|
|
35928
|
-
wordBreak: "break-word"
|
|
35929
|
-
},
|
|
35930
|
-
children: params.colDef.headerName
|
|
35931
|
-
}
|
|
35932
|
-
)
|
|
35933
|
-
},
|
|
35934
|
-
renderCell: (buttons == null ? void 0 : buttons[key]) ? (params) => {
|
|
35935
|
-
var _a2, _b2, _c;
|
|
35936
|
-
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];
|
|
35937
|
-
return React3.cloneElement(buttons[key], {
|
|
35938
|
-
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
35939
|
-
children,
|
|
35940
|
-
row: params == null ? void 0 : params.row,
|
|
35941
|
-
onClick: async (e) => {
|
|
35942
|
-
var _a3, _b3;
|
|
35943
|
-
e.row = params == null ? void 0 : params.row;
|
|
35944
|
-
if ((_b3 = (_a3 = buttons[key]) == null ? void 0 : _a3.props) == null ? void 0 : _b3.onClick) {
|
|
35945
|
-
const newVal = await buttons[key].props.onClick(e);
|
|
35946
|
-
if (newVal) handleRowUpdate({ ...e.row, newVal });
|
|
35947
|
-
}
|
|
35948
|
-
}
|
|
35949
|
-
});
|
|
35950
|
-
} : wrapText ? (params) => {
|
|
35951
|
-
var _a2;
|
|
35952
|
-
return (
|
|
35953
|
-
// Plain cell with wrap — no custom button
|
|
35954
|
-
/* @__PURE__ */ jsx6(
|
|
35955
|
-
"span",
|
|
35956
|
-
{
|
|
35957
|
-
style: {
|
|
35958
|
-
whiteSpace: "normal",
|
|
35959
|
-
wordBreak: "break-word",
|
|
35960
|
-
lineHeight: 1.4,
|
|
35961
|
-
padding: "6px 0",
|
|
35962
|
-
display: "block"
|
|
35963
|
-
},
|
|
35964
|
-
children: (_a2 = params.formattedValue) != null ? _a2 : params.value
|
|
35965
|
-
}
|
|
35966
|
-
)
|
|
35967
|
-
);
|
|
35968
|
-
} : null
|
|
35969
|
-
};
|
|
35970
|
-
});
|
|
35971
|
-
if (modal) {
|
|
35972
|
-
cols.unshift({
|
|
35973
|
-
field: "Modal",
|
|
35974
|
-
headerName: "Modal",
|
|
35975
|
-
editable: false,
|
|
35976
|
-
type: "string",
|
|
35977
|
-
width: 10,
|
|
35978
|
-
renderCell: (params) => {
|
|
35979
|
-
var _a;
|
|
35980
|
-
return /* @__PURE__ */ jsx6(
|
|
35981
|
-
Button,
|
|
35982
|
-
{
|
|
35983
|
-
className: "text-xs",
|
|
35984
|
-
onClick: () => onModalOpen(params.row),
|
|
35985
|
-
icon: /* @__PURE__ */ jsx6(EditIcon, {}),
|
|
35986
|
-
children: (_a = params == null ? void 0 : params.row) == null ? void 0 : _a["Modal"]
|
|
35987
|
-
}
|
|
35988
|
-
);
|
|
35989
|
-
}
|
|
35990
|
-
});
|
|
35991
|
-
}
|
|
35992
|
-
return cols;
|
|
35993
|
-
}, [rows, wrapText]);
|
|
35994
|
-
}
|
|
35995
35899
|
function SearchBar({
|
|
35996
35900
|
value,
|
|
35997
35901
|
onChange
|
|
35998
35902
|
}) {
|
|
35999
|
-
return /* @__PURE__ */
|
|
36000
|
-
|
|
36001
|
-
|
|
36002
|
-
|
|
36003
|
-
|
|
36004
|
-
|
|
36005
|
-
|
|
36006
|
-
|
|
36007
|
-
|
|
36008
|
-
|
|
36009
|
-
"path",
|
|
36010
|
-
{
|
|
36011
|
-
fillRule: "evenodd",
|
|
36012
|
-
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",
|
|
36013
|
-
clipRule: "evenodd"
|
|
36014
|
-
}
|
|
36015
|
-
)
|
|
36016
|
-
}
|
|
36017
|
-
),
|
|
36018
|
-
/* @__PURE__ */ jsx6(
|
|
36019
|
-
"input",
|
|
36020
|
-
{
|
|
36021
|
-
type: "text",
|
|
36022
|
-
value,
|
|
36023
|
-
onChange: (e) => onChange(e.target.value),
|
|
36024
|
-
placeholder: "Buscar\u2026",
|
|
36025
|
-
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"
|
|
36026
|
-
}
|
|
36027
|
-
),
|
|
36028
|
-
value && /* @__PURE__ */ jsx6(
|
|
36029
|
-
"button",
|
|
36030
|
-
{
|
|
36031
|
-
onClick: () => onChange(""),
|
|
36032
|
-
className: "text-gray-400 hover:text-gray-600 text-sm leading-none",
|
|
36033
|
-
title: "Limpiar b\xFAsqueda",
|
|
36034
|
-
children: "\xD7"
|
|
36035
|
-
}
|
|
36036
|
-
)
|
|
36037
|
-
] });
|
|
35903
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-2 px-2 pb-1", children: /* @__PURE__ */ jsx6(
|
|
35904
|
+
"input",
|
|
35905
|
+
{
|
|
35906
|
+
type: "text",
|
|
35907
|
+
value,
|
|
35908
|
+
onChange: (e) => onChange(e.target.value),
|
|
35909
|
+
placeholder: "Buscar\u2026",
|
|
35910
|
+
className: "w-full max-w-xs text-xs border border-gray-300 rounded px-2 py-1"
|
|
35911
|
+
}
|
|
35912
|
+
) });
|
|
36038
35913
|
}
|
|
36039
35914
|
function rowMatchesSearch(row, query) {
|
|
36040
35915
|
if (!query.trim()) return true;
|
|
@@ -36068,29 +35943,54 @@ function IHTable({
|
|
|
36068
35943
|
autoHeight = false
|
|
36069
35944
|
}) {
|
|
36070
35945
|
var _a;
|
|
36071
|
-
if (modal && onSelect)
|
|
36072
|
-
throw new Error("Solo se puede usar modal o onSelect por separado");
|
|
36073
35946
|
const [open, setOpen] = useState5(false);
|
|
36074
35947
|
const [rows, setRows] = useState5(data);
|
|
35948
|
+
const [modalIndex, setModalIndex] = useState5(null);
|
|
36075
35949
|
const [selectedRows, setSelectedRows] = useState5({
|
|
36076
35950
|
type: "include",
|
|
36077
35951
|
ids: /* @__PURE__ */ new Set()
|
|
36078
35952
|
});
|
|
36079
|
-
const [modalRow, setModalRow] = useState5();
|
|
36080
35953
|
const [searchQuery, setSearchQuery] = useState5("");
|
|
36081
|
-
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
36082
35954
|
useEffect3(() => {
|
|
36083
35955
|
setRows(data);
|
|
36084
35956
|
}, [data]);
|
|
35957
|
+
const filteredRows = useMemo(() => {
|
|
35958
|
+
if ((selectedRows == null ? void 0 : selectedRows.type) === "exclude") {
|
|
35959
|
+
return rows.filter((r) => !Array.from(selectedRows.ids).includes(r.id));
|
|
35960
|
+
}
|
|
35961
|
+
if ((selectedRows == null ? void 0 : selectedRows.type) === "include") {
|
|
35962
|
+
return rows.filter((r) => Array.from(selectedRows.ids).includes(r.id));
|
|
35963
|
+
}
|
|
35964
|
+
return [];
|
|
35965
|
+
}, [selectedRows, rows]);
|
|
35966
|
+
const displayRows = useMemo(
|
|
35967
|
+
() => searchable ? rows.filter((r) => rowMatchesSearch(r, searchQuery)) : rows,
|
|
35968
|
+
[rows, searchQuery, searchable]
|
|
35969
|
+
);
|
|
35970
|
+
const modalRow = modalIndex != null ? displayRows[modalIndex] : void 0;
|
|
36085
35971
|
const handleModalOpen = (row) => {
|
|
36086
|
-
|
|
35972
|
+
const index = displayRows.findIndex((r) => r.id === row.id);
|
|
35973
|
+
if (index === -1) return;
|
|
35974
|
+
setModalIndex(index);
|
|
36087
35975
|
setOpen(true);
|
|
36088
35976
|
};
|
|
36089
35977
|
const handleClose = async () => {
|
|
36090
|
-
const pass = onCloseModal ? await
|
|
35978
|
+
const pass = onCloseModal ? await onCloseModal(modalRow) : true;
|
|
36091
35979
|
if (!pass) return;
|
|
36092
35980
|
setOpen(false);
|
|
36093
|
-
|
|
35981
|
+
setModalIndex(null);
|
|
35982
|
+
};
|
|
35983
|
+
const handlePrevRow = () => {
|
|
35984
|
+
setModalIndex((prev) => {
|
|
35985
|
+
if (prev == null) return prev;
|
|
35986
|
+
return Math.max(prev - 1, 0);
|
|
35987
|
+
});
|
|
35988
|
+
};
|
|
35989
|
+
const handleNextRow = () => {
|
|
35990
|
+
setModalIndex((prev) => {
|
|
35991
|
+
if (prev == null) return prev;
|
|
35992
|
+
return Math.min(prev + 1, displayRows.length - 1);
|
|
35993
|
+
});
|
|
36094
35994
|
};
|
|
36095
35995
|
const handleRowUpdate = (newRow) => {
|
|
36096
35996
|
if (!newRow.id) throw new Error("Fila sin id");
|
|
@@ -36100,40 +36000,82 @@ function IHTable({
|
|
|
36100
36000
|
);
|
|
36101
36001
|
return updated;
|
|
36102
36002
|
};
|
|
36103
|
-
const
|
|
36104
|
-
|
|
36105
|
-
|
|
36106
|
-
|
|
36107
|
-
|
|
36108
|
-
return
|
|
36003
|
+
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
36004
|
+
const columns = useMemo(() => {
|
|
36005
|
+
if (!displayRows.length) return [];
|
|
36006
|
+
const cols = Object.keys(displayRows[0]).filter((key) => !key.startsWith("_") && !hideColumns.includes(key)).map((key) => {
|
|
36007
|
+
var _a2, _b;
|
|
36008
|
+
return {
|
|
36009
|
+
field: key,
|
|
36010
|
+
headerName: key,
|
|
36011
|
+
flex: key == "id" ? false : !(colSize == null ? void 0 : colSize[key]),
|
|
36012
|
+
width: key == "id" ? 80 : (_a2 = colSize == null ? void 0 : colSize[key]) != null ? _a2 : void 0,
|
|
36013
|
+
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
36014
|
+
type: typeof displayRows[0][key] === "number" ? "number" : "string",
|
|
36015
|
+
valueFormatter: (value) => {
|
|
36016
|
+
if (value == null || value === "") return "";
|
|
36017
|
+
const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
|
|
36018
|
+
if (`${value}`.match(isDate)) {
|
|
36019
|
+
return value.toString().split("T")[0].split("-").reverse().join("/");
|
|
36020
|
+
}
|
|
36021
|
+
const splited = `${value}`.split(".");
|
|
36022
|
+
const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
|
|
36023
|
+
if (hasDecimals) {
|
|
36024
|
+
return [
|
|
36025
|
+
currentCoin,
|
|
36026
|
+
(+`${value}`).toLocaleString("en-US", {
|
|
36027
|
+
minimumFractionDigits: 2,
|
|
36028
|
+
maximumFractionDigits: 2
|
|
36029
|
+
})
|
|
36030
|
+
].join(" ");
|
|
36031
|
+
}
|
|
36032
|
+
return value;
|
|
36033
|
+
},
|
|
36034
|
+
renderCell: (resolvedButtons == null ? void 0 : resolvedButtons[key]) ? (params) => {
|
|
36035
|
+
var _a3, _b2, _c;
|
|
36036
|
+
const children = ((_a3 = resolvedButtons == null ? void 0 : resolvedButtons[key]) == null ? void 0 : _a3.type) == "input" ? null : (_b2 = params == null ? void 0 : params.row) == null ? void 0 : _b2[key];
|
|
36037
|
+
return React3.cloneElement(resolvedButtons[key], {
|
|
36038
|
+
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
36039
|
+
children,
|
|
36040
|
+
row: params == null ? void 0 : params.row,
|
|
36041
|
+
onClick: async (e) => {
|
|
36042
|
+
var _a4, _b3;
|
|
36043
|
+
e.row = params == null ? void 0 : params.row;
|
|
36044
|
+
if ((_b3 = (_a4 = resolvedButtons[key]) == null ? void 0 : _a4.props) == null ? void 0 : _b3.onClick) {
|
|
36045
|
+
const newVal = await resolvedButtons[key].props.onClick(e);
|
|
36046
|
+
if (newVal) {
|
|
36047
|
+
handleRowUpdate({ ...e.row, newVal });
|
|
36048
|
+
}
|
|
36049
|
+
}
|
|
36050
|
+
}
|
|
36051
|
+
});
|
|
36052
|
+
} : null
|
|
36053
|
+
};
|
|
36054
|
+
});
|
|
36055
|
+
if (modal) {
|
|
36056
|
+
cols.unshift({
|
|
36057
|
+
field: "Modal",
|
|
36058
|
+
headerName: "Modal",
|
|
36059
|
+
width: 100,
|
|
36060
|
+
renderCell: (params) => /* @__PURE__ */ jsx6(
|
|
36061
|
+
Button,
|
|
36062
|
+
{
|
|
36063
|
+
className: "text-xs",
|
|
36064
|
+
onClick: () => handleModalOpen(params.row),
|
|
36065
|
+
icon: /* @__PURE__ */ jsx6(EditIcon, {}),
|
|
36066
|
+
children: "Abrir"
|
|
36067
|
+
}
|
|
36068
|
+
)
|
|
36069
|
+
});
|
|
36109
36070
|
}
|
|
36110
|
-
return
|
|
36111
|
-
}, [
|
|
36112
|
-
const displayRows = useMemo(
|
|
36113
|
-
() => searchable ? rows.filter((r) => rowMatchesSearch(r, searchQuery)) : rows,
|
|
36114
|
-
[rows, searchQuery, searchable]
|
|
36115
|
-
);
|
|
36116
|
-
const columns = useColumns(
|
|
36117
|
-
displayRows,
|
|
36118
|
-
currentCoin,
|
|
36119
|
-
{
|
|
36120
|
-
flex,
|
|
36121
|
-
editableFields,
|
|
36122
|
-
buttons: resolvedButtons,
|
|
36123
|
-
hideColumns,
|
|
36124
|
-
modal,
|
|
36125
|
-
wrapText,
|
|
36126
|
-
handleRowUpdate,
|
|
36127
|
-
onModalOpen: handleModalOpen
|
|
36128
|
-
},
|
|
36129
|
-
colSize
|
|
36130
|
-
);
|
|
36071
|
+
return cols;
|
|
36072
|
+
}, [displayRows]);
|
|
36131
36073
|
if (!rows.length) return null;
|
|
36132
36074
|
const rowHeightProps = wrapText ? { getRowHeight: () => "auto" } : rowHeight != null ? { rowHeight } : {};
|
|
36133
36075
|
const containerHeight = autoHeight ? void 0 : (_a = HEIGHT_MAP[displayRows.length]) != null ? _a : height;
|
|
36134
36076
|
const hideFooter = autoHeight || displayRows.length <= Object.keys(HEIGHT_MAP).length;
|
|
36135
36077
|
return /* @__PURE__ */ jsxs5("div", { className: "m-2", children: [
|
|
36136
|
-
header && /* @__PURE__ */ jsx6("div", { className: "font-bold
|
|
36078
|
+
header && /* @__PURE__ */ jsx6("div", { className: "font-bold p-2", children: header }),
|
|
36137
36079
|
/* @__PURE__ */ jsxs5("div", { className: "flex justify-between", children: [
|
|
36138
36080
|
/* @__PURE__ */ jsx6(
|
|
36139
36081
|
Toolbar,
|
|
@@ -36153,10 +36095,8 @@ function IHTable({
|
|
|
36153
36095
|
sx: {
|
|
36154
36096
|
display: "flex",
|
|
36155
36097
|
flexDirection: "column",
|
|
36156
|
-
// undefined height lets the child DataGrid size itself freely
|
|
36157
36098
|
height: containerHeight,
|
|
36158
|
-
width
|
|
36159
|
-
zIndex: 999999999
|
|
36099
|
+
width
|
|
36160
36100
|
},
|
|
36161
36101
|
children: [
|
|
36162
36102
|
modal && /* @__PURE__ */ jsx6(
|
|
@@ -36165,7 +36105,11 @@ function IHTable({
|
|
|
36165
36105
|
open,
|
|
36166
36106
|
onClose: handleClose,
|
|
36167
36107
|
modal,
|
|
36168
|
-
selectedRow: modalRow
|
|
36108
|
+
selectedRow: modalRow,
|
|
36109
|
+
onPrev: handlePrevRow,
|
|
36110
|
+
onNext: handleNextRow,
|
|
36111
|
+
hasPrev: (modalIndex != null ? modalIndex : 0) > 0,
|
|
36112
|
+
hasNext: (modalIndex != null ? modalIndex : -1) < displayRows.length - 1
|
|
36169
36113
|
}
|
|
36170
36114
|
),
|
|
36171
36115
|
/* @__PURE__ */ jsx6(
|
|
@@ -36183,35 +36127,14 @@ function IHTable({
|
|
|
36183
36127
|
sx: {
|
|
36184
36128
|
fontSize,
|
|
36185
36129
|
"& .MuiDataGrid-cell": {
|
|
36186
|
-
fontSize
|
|
36187
|
-
// Allow cells to wrap text when wrapText is enabled
|
|
36188
|
-
...wrapText && {
|
|
36189
|
-
alignItems: "flex-start",
|
|
36190
|
-
paddingTop: "8px",
|
|
36191
|
-
paddingBottom: "8px",
|
|
36192
|
-
whiteSpace: "normal",
|
|
36193
|
-
wordBreak: "break-word"
|
|
36194
|
-
}
|
|
36130
|
+
fontSize
|
|
36195
36131
|
},
|
|
36196
36132
|
"& .MuiDataGrid-columnHeader": {
|
|
36197
|
-
fontSize
|
|
36198
|
-
...wrapText && {
|
|
36199
|
-
whiteSpace: "normal",
|
|
36200
|
-
"& .MuiDataGrid-columnHeaderTitle": {
|
|
36201
|
-
whiteSpace: "normal",
|
|
36202
|
-
lineHeight: 1.3,
|
|
36203
|
-
wordBreak: "break-word"
|
|
36204
|
-
}
|
|
36205
|
-
}
|
|
36133
|
+
fontSize
|
|
36206
36134
|
},
|
|
36207
36135
|
"& .MuiDataGrid-cell--editable": {
|
|
36208
36136
|
backgroundColor: "#c6d8f0",
|
|
36209
36137
|
fontWeight: 500
|
|
36210
|
-
},
|
|
36211
|
-
...displayRows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
36212
|
-
"& .MuiDataGrid-filler": {
|
|
36213
|
-
display: "none"
|
|
36214
|
-
}
|
|
36215
36138
|
}
|
|
36216
36139
|
},
|
|
36217
36140
|
editMode: "row",
|
|
@@ -36770,7 +36693,7 @@ function useResources({
|
|
|
36770
36693
|
// src/select/index.tsx
|
|
36771
36694
|
import React5, {
|
|
36772
36695
|
useEffect as useEffect5,
|
|
36773
|
-
useRef as
|
|
36696
|
+
useRef as useRef2,
|
|
36774
36697
|
useState as useState8
|
|
36775
36698
|
} from "react";
|
|
36776
36699
|
|
|
@@ -36829,7 +36752,7 @@ function Select({
|
|
|
36829
36752
|
);
|
|
36830
36753
|
const [hasEdition, setHasEdition] = useState8(false);
|
|
36831
36754
|
const [highlightedIndex, setHighlightedIndex] = useState8(-1);
|
|
36832
|
-
const inputRef =
|
|
36755
|
+
const inputRef = useRef2(null);
|
|
36833
36756
|
const validOption = (value) => {
|
|
36834
36757
|
return options.find((opt) => opt.label == value);
|
|
36835
36758
|
};
|
|
@@ -36877,7 +36800,7 @@ function Select({
|
|
|
36877
36800
|
setInputValue(opt.label);
|
|
36878
36801
|
setIsOpen(false);
|
|
36879
36802
|
};
|
|
36880
|
-
const containerRef =
|
|
36803
|
+
const containerRef = useRef2(null);
|
|
36881
36804
|
const [openUpwards, setOpenUpwards] = useState8(false);
|
|
36882
36805
|
useEffect5(() => {
|
|
36883
36806
|
if (isOpen && containerRef.current) {
|
|
@@ -37015,7 +36938,7 @@ function Select({
|
|
|
37015
36938
|
import { cloneElement as cloneElement2, useEffect as useEffect6 } from "react";
|
|
37016
36939
|
|
|
37017
36940
|
// src/pop/index.tsx
|
|
37018
|
-
import { useState as useState9, useCallback, useRef as
|
|
36941
|
+
import { useState as useState9, useCallback, useRef as useRef3 } from "react";
|
|
37019
36942
|
|
|
37020
36943
|
// src/pop/actions.tsx
|
|
37021
36944
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -37260,7 +37183,7 @@ var INITIAL_STATE = {
|
|
|
37260
37183
|
};
|
|
37261
37184
|
function usePopup() {
|
|
37262
37185
|
const [popup, setPopup] = useState9(INITIAL_STATE);
|
|
37263
|
-
const messageRef =
|
|
37186
|
+
const messageRef = useRef3(null);
|
|
37264
37187
|
const open = useCallback(
|
|
37265
37188
|
(partial) => {
|
|
37266
37189
|
const { message, ...rest } = partial;
|
|
@@ -37622,7 +37545,7 @@ import React9, {
|
|
|
37622
37545
|
useEffect as useEffect9,
|
|
37623
37546
|
useMemo as useMemo6,
|
|
37624
37547
|
useReducer as useReducer2,
|
|
37625
|
-
useRef as
|
|
37548
|
+
useRef as useRef5,
|
|
37626
37549
|
useState as useState13
|
|
37627
37550
|
} from "react";
|
|
37628
37551
|
|
|
@@ -38486,7 +38409,7 @@ function Table3({
|
|
|
38486
38409
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38487
38410
|
}, [objectData, maxItems]);
|
|
38488
38411
|
const [sort, setSort] = useState13(sortBy);
|
|
38489
|
-
const modalRef =
|
|
38412
|
+
const modalRef = useRef5(null);
|
|
38490
38413
|
const [dialogRow, setDialogRow] = useState13({});
|
|
38491
38414
|
const context = {
|
|
38492
38415
|
objectData,
|