next-recomponents 2.0.30 → 2.0.31
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 +167 -245
- package/dist/index.mjs +174 -252
- package/package.json +1 -1
- package/src/table/index.tsx +217 -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,68 @@ 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
|
+
row: selectedRow,
|
|
35866
|
+
hide: onClose
|
|
35867
|
+
}
|
|
35838
35868
|
) })
|
|
35839
35869
|
] });
|
|
35840
35870
|
}
|
|
35841
|
-
function Toolbar({
|
|
35842
|
-
exportName,
|
|
35843
|
-
onSave,
|
|
35844
|
-
onSelect,
|
|
35845
|
-
rows,
|
|
35846
|
-
filteredRows
|
|
35847
|
-
}) {
|
|
35871
|
+
function Toolbar({ exportName, onSave, onSelect, rows, filteredRows }) {
|
|
35848
35872
|
const excel = useExcel();
|
|
35849
35873
|
const stripMeta = (r) => {
|
|
35850
35874
|
const { _edited, ...rest } = r;
|
|
35851
35875
|
return rest;
|
|
35852
35876
|
};
|
|
35853
35877
|
if (!exportName && !onSave && !onSelect) return null;
|
|
35854
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2
|
|
35878
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 p-2 text-xs", children: [
|
|
35855
35879
|
exportName && /* @__PURE__ */ jsx6(
|
|
35856
35880
|
Button,
|
|
35857
35881
|
{
|
|
@@ -35871,170 +35895,20 @@ function Toolbar({
|
|
|
35871
35895
|
) : onSave && /* @__PURE__ */ jsx6(Button, { onClick: () => onSave(rows.map(stripMeta)), children: "Guardar" })
|
|
35872
35896
|
] });
|
|
35873
35897
|
}
|
|
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
35898
|
function SearchBar({
|
|
35996
35899
|
value,
|
|
35997
35900
|
onChange
|
|
35998
35901
|
}) {
|
|
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
|
-
] });
|
|
35902
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-2 px-2 pb-1", children: /* @__PURE__ */ jsx6(
|
|
35903
|
+
"input",
|
|
35904
|
+
{
|
|
35905
|
+
type: "text",
|
|
35906
|
+
value,
|
|
35907
|
+
onChange: (e) => onChange(e.target.value),
|
|
35908
|
+
placeholder: "Buscar\u2026",
|
|
35909
|
+
className: "w-full max-w-xs text-xs border border-gray-300 rounded px-2 py-1"
|
|
35910
|
+
}
|
|
35911
|
+
) });
|
|
36038
35912
|
}
|
|
36039
35913
|
function rowMatchesSearch(row, query) {
|
|
36040
35914
|
if (!query.trim()) return true;
|
|
@@ -36068,29 +35942,54 @@ function IHTable({
|
|
|
36068
35942
|
autoHeight = false
|
|
36069
35943
|
}) {
|
|
36070
35944
|
var _a;
|
|
36071
|
-
if (modal && onSelect)
|
|
36072
|
-
throw new Error("Solo se puede usar modal o onSelect por separado");
|
|
36073
35945
|
const [open, setOpen] = useState5(false);
|
|
36074
35946
|
const [rows, setRows] = useState5(data);
|
|
35947
|
+
const [modalIndex, setModalIndex] = useState5(null);
|
|
36075
35948
|
const [selectedRows, setSelectedRows] = useState5({
|
|
36076
35949
|
type: "include",
|
|
36077
35950
|
ids: /* @__PURE__ */ new Set()
|
|
36078
35951
|
});
|
|
36079
|
-
const [modalRow, setModalRow] = useState5();
|
|
36080
35952
|
const [searchQuery, setSearchQuery] = useState5("");
|
|
36081
|
-
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
36082
35953
|
useEffect3(() => {
|
|
36083
35954
|
setRows(data);
|
|
36084
35955
|
}, [data]);
|
|
35956
|
+
const filteredRows = useMemo(() => {
|
|
35957
|
+
if ((selectedRows == null ? void 0 : selectedRows.type) === "exclude") {
|
|
35958
|
+
return rows.filter((r) => !Array.from(selectedRows.ids).includes(r.id));
|
|
35959
|
+
}
|
|
35960
|
+
if ((selectedRows == null ? void 0 : selectedRows.type) === "include") {
|
|
35961
|
+
return rows.filter((r) => Array.from(selectedRows.ids).includes(r.id));
|
|
35962
|
+
}
|
|
35963
|
+
return [];
|
|
35964
|
+
}, [selectedRows, rows]);
|
|
35965
|
+
const displayRows = useMemo(
|
|
35966
|
+
() => searchable ? rows.filter((r) => rowMatchesSearch(r, searchQuery)) : rows,
|
|
35967
|
+
[rows, searchQuery, searchable]
|
|
35968
|
+
);
|
|
35969
|
+
const modalRow = modalIndex != null ? displayRows[modalIndex] : void 0;
|
|
36085
35970
|
const handleModalOpen = (row) => {
|
|
36086
|
-
|
|
35971
|
+
const index = displayRows.findIndex((r) => r.id === row.id);
|
|
35972
|
+
if (index === -1) return;
|
|
35973
|
+
setModalIndex(index);
|
|
36087
35974
|
setOpen(true);
|
|
36088
35975
|
};
|
|
36089
35976
|
const handleClose = async () => {
|
|
36090
|
-
const pass = onCloseModal ? await
|
|
35977
|
+
const pass = onCloseModal ? await onCloseModal(modalRow) : true;
|
|
36091
35978
|
if (!pass) return;
|
|
36092
35979
|
setOpen(false);
|
|
36093
|
-
|
|
35980
|
+
setModalIndex(null);
|
|
35981
|
+
};
|
|
35982
|
+
const handlePrevRow = () => {
|
|
35983
|
+
setModalIndex((prev) => {
|
|
35984
|
+
if (prev == null) return prev;
|
|
35985
|
+
return Math.max(prev - 1, 0);
|
|
35986
|
+
});
|
|
35987
|
+
};
|
|
35988
|
+
const handleNextRow = () => {
|
|
35989
|
+
setModalIndex((prev) => {
|
|
35990
|
+
if (prev == null) return prev;
|
|
35991
|
+
return Math.min(prev + 1, displayRows.length - 1);
|
|
35992
|
+
});
|
|
36094
35993
|
};
|
|
36095
35994
|
const handleRowUpdate = (newRow) => {
|
|
36096
35995
|
if (!newRow.id) throw new Error("Fila sin id");
|
|
@@ -36100,40 +35999,82 @@ function IHTable({
|
|
|
36100
35999
|
);
|
|
36101
36000
|
return updated;
|
|
36102
36001
|
};
|
|
36103
|
-
const
|
|
36104
|
-
|
|
36105
|
-
|
|
36106
|
-
|
|
36107
|
-
|
|
36108
|
-
return
|
|
36002
|
+
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
36003
|
+
const columns = useMemo(() => {
|
|
36004
|
+
if (!displayRows.length) return [];
|
|
36005
|
+
const cols = Object.keys(displayRows[0]).filter((key) => !key.startsWith("_") && !hideColumns.includes(key)).map((key) => {
|
|
36006
|
+
var _a2, _b;
|
|
36007
|
+
return {
|
|
36008
|
+
field: key,
|
|
36009
|
+
headerName: key,
|
|
36010
|
+
flex: key == "id" ? false : !(colSize == null ? void 0 : colSize[key]),
|
|
36011
|
+
width: key == "id" ? 80 : (_a2 = colSize == null ? void 0 : colSize[key]) != null ? _a2 : void 0,
|
|
36012
|
+
editable: (_b = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _b : false,
|
|
36013
|
+
type: typeof displayRows[0][key] === "number" ? "number" : "string",
|
|
36014
|
+
valueFormatter: (value) => {
|
|
36015
|
+
if (value == null || value === "") return "";
|
|
36016
|
+
const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
|
|
36017
|
+
if (`${value}`.match(isDate)) {
|
|
36018
|
+
return value.toString().split("T")[0].split("-").reverse().join("/");
|
|
36019
|
+
}
|
|
36020
|
+
const splited = `${value}`.split(".");
|
|
36021
|
+
const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
|
|
36022
|
+
if (hasDecimals) {
|
|
36023
|
+
return [
|
|
36024
|
+
currentCoin,
|
|
36025
|
+
(+`${value}`).toLocaleString("en-US", {
|
|
36026
|
+
minimumFractionDigits: 2,
|
|
36027
|
+
maximumFractionDigits: 2
|
|
36028
|
+
})
|
|
36029
|
+
].join(" ");
|
|
36030
|
+
}
|
|
36031
|
+
return value;
|
|
36032
|
+
},
|
|
36033
|
+
renderCell: (resolvedButtons == null ? void 0 : resolvedButtons[key]) ? (params) => {
|
|
36034
|
+
var _a3, _b2, _c;
|
|
36035
|
+
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];
|
|
36036
|
+
return React3.cloneElement(resolvedButtons[key], {
|
|
36037
|
+
className: `${(_c = params == null ? void 0 : params.className) != null ? _c : ""} m-auto text-xs`,
|
|
36038
|
+
children,
|
|
36039
|
+
row: params == null ? void 0 : params.row,
|
|
36040
|
+
onClick: async (e) => {
|
|
36041
|
+
var _a4, _b3;
|
|
36042
|
+
e.row = params == null ? void 0 : params.row;
|
|
36043
|
+
if ((_b3 = (_a4 = resolvedButtons[key]) == null ? void 0 : _a4.props) == null ? void 0 : _b3.onClick) {
|
|
36044
|
+
const newVal = await resolvedButtons[key].props.onClick(e);
|
|
36045
|
+
if (newVal) {
|
|
36046
|
+
handleRowUpdate({ ...e.row, newVal });
|
|
36047
|
+
}
|
|
36048
|
+
}
|
|
36049
|
+
}
|
|
36050
|
+
});
|
|
36051
|
+
} : null
|
|
36052
|
+
};
|
|
36053
|
+
});
|
|
36054
|
+
if (modal) {
|
|
36055
|
+
cols.unshift({
|
|
36056
|
+
field: "Modal",
|
|
36057
|
+
headerName: "Modal",
|
|
36058
|
+
width: 100,
|
|
36059
|
+
renderCell: (params) => /* @__PURE__ */ jsx6(
|
|
36060
|
+
Button,
|
|
36061
|
+
{
|
|
36062
|
+
className: "text-xs",
|
|
36063
|
+
onClick: () => handleModalOpen(params.row),
|
|
36064
|
+
icon: /* @__PURE__ */ jsx6(EditIcon, {}),
|
|
36065
|
+
children: "Abrir"
|
|
36066
|
+
}
|
|
36067
|
+
)
|
|
36068
|
+
});
|
|
36109
36069
|
}
|
|
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
|
-
);
|
|
36070
|
+
return cols;
|
|
36071
|
+
}, [displayRows]);
|
|
36131
36072
|
if (!rows.length) return null;
|
|
36132
36073
|
const rowHeightProps = wrapText ? { getRowHeight: () => "auto" } : rowHeight != null ? { rowHeight } : {};
|
|
36133
36074
|
const containerHeight = autoHeight ? void 0 : (_a = HEIGHT_MAP[displayRows.length]) != null ? _a : height;
|
|
36134
36075
|
const hideFooter = autoHeight || displayRows.length <= Object.keys(HEIGHT_MAP).length;
|
|
36135
36076
|
return /* @__PURE__ */ jsxs5("div", { className: "m-2", children: [
|
|
36136
|
-
header && /* @__PURE__ */ jsx6("div", { className: "font-bold
|
|
36077
|
+
header && /* @__PURE__ */ jsx6("div", { className: "font-bold p-2", children: header }),
|
|
36137
36078
|
/* @__PURE__ */ jsxs5("div", { className: "flex justify-between", children: [
|
|
36138
36079
|
/* @__PURE__ */ jsx6(
|
|
36139
36080
|
Toolbar,
|
|
@@ -36153,10 +36094,8 @@ function IHTable({
|
|
|
36153
36094
|
sx: {
|
|
36154
36095
|
display: "flex",
|
|
36155
36096
|
flexDirection: "column",
|
|
36156
|
-
// undefined height lets the child DataGrid size itself freely
|
|
36157
36097
|
height: containerHeight,
|
|
36158
|
-
width
|
|
36159
|
-
zIndex: 999999999
|
|
36098
|
+
width
|
|
36160
36099
|
},
|
|
36161
36100
|
children: [
|
|
36162
36101
|
modal && /* @__PURE__ */ jsx6(
|
|
@@ -36165,7 +36104,11 @@ function IHTable({
|
|
|
36165
36104
|
open,
|
|
36166
36105
|
onClose: handleClose,
|
|
36167
36106
|
modal,
|
|
36168
|
-
selectedRow: modalRow
|
|
36107
|
+
selectedRow: modalRow,
|
|
36108
|
+
onPrev: handlePrevRow,
|
|
36109
|
+
onNext: handleNextRow,
|
|
36110
|
+
hasPrev: (modalIndex != null ? modalIndex : 0) > 0,
|
|
36111
|
+
hasNext: (modalIndex != null ? modalIndex : -1) < displayRows.length - 1
|
|
36169
36112
|
}
|
|
36170
36113
|
),
|
|
36171
36114
|
/* @__PURE__ */ jsx6(
|
|
@@ -36183,35 +36126,14 @@ function IHTable({
|
|
|
36183
36126
|
sx: {
|
|
36184
36127
|
fontSize,
|
|
36185
36128
|
"& .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
|
-
}
|
|
36129
|
+
fontSize
|
|
36195
36130
|
},
|
|
36196
36131
|
"& .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
|
-
}
|
|
36132
|
+
fontSize
|
|
36206
36133
|
},
|
|
36207
36134
|
"& .MuiDataGrid-cell--editable": {
|
|
36208
36135
|
backgroundColor: "#c6d8f0",
|
|
36209
36136
|
fontWeight: 500
|
|
36210
|
-
},
|
|
36211
|
-
...displayRows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
36212
|
-
"& .MuiDataGrid-filler": {
|
|
36213
|
-
display: "none"
|
|
36214
|
-
}
|
|
36215
36137
|
}
|
|
36216
36138
|
},
|
|
36217
36139
|
editMode: "row",
|
|
@@ -36770,7 +36692,7 @@ function useResources({
|
|
|
36770
36692
|
// src/select/index.tsx
|
|
36771
36693
|
import React5, {
|
|
36772
36694
|
useEffect as useEffect5,
|
|
36773
|
-
useRef as
|
|
36695
|
+
useRef as useRef2,
|
|
36774
36696
|
useState as useState8
|
|
36775
36697
|
} from "react";
|
|
36776
36698
|
|
|
@@ -36829,7 +36751,7 @@ function Select({
|
|
|
36829
36751
|
);
|
|
36830
36752
|
const [hasEdition, setHasEdition] = useState8(false);
|
|
36831
36753
|
const [highlightedIndex, setHighlightedIndex] = useState8(-1);
|
|
36832
|
-
const inputRef =
|
|
36754
|
+
const inputRef = useRef2(null);
|
|
36833
36755
|
const validOption = (value) => {
|
|
36834
36756
|
return options.find((opt) => opt.label == value);
|
|
36835
36757
|
};
|
|
@@ -36877,7 +36799,7 @@ function Select({
|
|
|
36877
36799
|
setInputValue(opt.label);
|
|
36878
36800
|
setIsOpen(false);
|
|
36879
36801
|
};
|
|
36880
|
-
const containerRef =
|
|
36802
|
+
const containerRef = useRef2(null);
|
|
36881
36803
|
const [openUpwards, setOpenUpwards] = useState8(false);
|
|
36882
36804
|
useEffect5(() => {
|
|
36883
36805
|
if (isOpen && containerRef.current) {
|
|
@@ -37015,7 +36937,7 @@ function Select({
|
|
|
37015
36937
|
import { cloneElement as cloneElement2, useEffect as useEffect6 } from "react";
|
|
37016
36938
|
|
|
37017
36939
|
// src/pop/index.tsx
|
|
37018
|
-
import { useState as useState9, useCallback, useRef as
|
|
36940
|
+
import { useState as useState9, useCallback, useRef as useRef3 } from "react";
|
|
37019
36941
|
|
|
37020
36942
|
// src/pop/actions.tsx
|
|
37021
36943
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -37260,7 +37182,7 @@ var INITIAL_STATE = {
|
|
|
37260
37182
|
};
|
|
37261
37183
|
function usePopup() {
|
|
37262
37184
|
const [popup, setPopup] = useState9(INITIAL_STATE);
|
|
37263
|
-
const messageRef =
|
|
37185
|
+
const messageRef = useRef3(null);
|
|
37264
37186
|
const open = useCallback(
|
|
37265
37187
|
(partial) => {
|
|
37266
37188
|
const { message, ...rest } = partial;
|
|
@@ -37622,7 +37544,7 @@ import React9, {
|
|
|
37622
37544
|
useEffect as useEffect9,
|
|
37623
37545
|
useMemo as useMemo6,
|
|
37624
37546
|
useReducer as useReducer2,
|
|
37625
|
-
useRef as
|
|
37547
|
+
useRef as useRef5,
|
|
37626
37548
|
useState as useState13
|
|
37627
37549
|
} from "react";
|
|
37628
37550
|
|
|
@@ -38486,7 +38408,7 @@ function Table3({
|
|
|
38486
38408
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38487
38409
|
}, [objectData, maxItems]);
|
|
38488
38410
|
const [sort, setSort] = useState13(sortBy);
|
|
38489
|
-
const modalRef =
|
|
38411
|
+
const modalRef = useRef5(null);
|
|
38490
38412
|
const [dialogRow, setDialogRow] = useState13({});
|
|
38491
38413
|
const context = {
|
|
38492
38414
|
objectData,
|