next-recomponents 2.0.29 → 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 +1 -20
- package/dist/index.d.ts +1 -20
- package/dist/index.js +174 -247
- package/dist/index.mjs +181 -254
- package/package.json +1 -1
- package/src/table/index.tsx +228 -293
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;
|
|
@@ -36064,32 +35938,58 @@ function IHTable({
|
|
|
36064
35938
|
rowHeight,
|
|
36065
35939
|
wrapText = false,
|
|
36066
35940
|
density = "standard",
|
|
36067
|
-
searchable = false
|
|
35941
|
+
searchable = false,
|
|
35942
|
+
autoHeight = false
|
|
36068
35943
|
}) {
|
|
36069
35944
|
var _a;
|
|
36070
|
-
if (modal && onSelect)
|
|
36071
|
-
throw new Error("Solo se puede usar modal o onSelect por separado");
|
|
36072
35945
|
const [open, setOpen] = useState5(false);
|
|
36073
35946
|
const [rows, setRows] = useState5(data);
|
|
35947
|
+
const [modalIndex, setModalIndex] = useState5(null);
|
|
36074
35948
|
const [selectedRows, setSelectedRows] = useState5({
|
|
36075
35949
|
type: "include",
|
|
36076
35950
|
ids: /* @__PURE__ */ new Set()
|
|
36077
35951
|
});
|
|
36078
|
-
const [modalRow, setModalRow] = useState5();
|
|
36079
35952
|
const [searchQuery, setSearchQuery] = useState5("");
|
|
36080
|
-
const resolvedButtons = modal ? { ...buttons, Modal: "" } : buttons;
|
|
36081
35953
|
useEffect3(() => {
|
|
36082
35954
|
setRows(data);
|
|
36083
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;
|
|
36084
35970
|
const handleModalOpen = (row) => {
|
|
36085
|
-
|
|
35971
|
+
const index = displayRows.findIndex((r) => r.id === row.id);
|
|
35972
|
+
if (index === -1) return;
|
|
35973
|
+
setModalIndex(index);
|
|
36086
35974
|
setOpen(true);
|
|
36087
35975
|
};
|
|
36088
35976
|
const handleClose = async () => {
|
|
36089
|
-
const pass = onCloseModal ? await
|
|
35977
|
+
const pass = onCloseModal ? await onCloseModal(modalRow) : true;
|
|
36090
35978
|
if (!pass) return;
|
|
36091
35979
|
setOpen(false);
|
|
36092
|
-
|
|
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
|
+
});
|
|
36093
35993
|
};
|
|
36094
35994
|
const handleRowUpdate = (newRow) => {
|
|
36095
35995
|
if (!newRow.id) throw new Error("Fila sin id");
|
|
@@ -36099,38 +35999,82 @@ function IHTable({
|
|
|
36099
35999
|
);
|
|
36100
36000
|
return updated;
|
|
36101
36001
|
};
|
|
36102
|
-
const
|
|
36103
|
-
|
|
36104
|
-
|
|
36105
|
-
|
|
36106
|
-
|
|
36107
|
-
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
|
+
});
|
|
36108
36069
|
}
|
|
36109
|
-
return
|
|
36110
|
-
}, [
|
|
36111
|
-
const displayRows = useMemo(
|
|
36112
|
-
() => searchable ? rows.filter((r) => rowMatchesSearch(r, searchQuery)) : rows,
|
|
36113
|
-
[rows, searchQuery, searchable]
|
|
36114
|
-
);
|
|
36115
|
-
const columns = useColumns(
|
|
36116
|
-
displayRows,
|
|
36117
|
-
currentCoin,
|
|
36118
|
-
{
|
|
36119
|
-
flex,
|
|
36120
|
-
editableFields,
|
|
36121
|
-
buttons: resolvedButtons,
|
|
36122
|
-
hideColumns,
|
|
36123
|
-
modal,
|
|
36124
|
-
wrapText,
|
|
36125
|
-
handleRowUpdate,
|
|
36126
|
-
onModalOpen: handleModalOpen
|
|
36127
|
-
},
|
|
36128
|
-
colSize
|
|
36129
|
-
);
|
|
36070
|
+
return cols;
|
|
36071
|
+
}, [displayRows]);
|
|
36130
36072
|
if (!rows.length) return null;
|
|
36131
36073
|
const rowHeightProps = wrapText ? { getRowHeight: () => "auto" } : rowHeight != null ? { rowHeight } : {};
|
|
36074
|
+
const containerHeight = autoHeight ? void 0 : (_a = HEIGHT_MAP[displayRows.length]) != null ? _a : height;
|
|
36075
|
+
const hideFooter = autoHeight || displayRows.length <= Object.keys(HEIGHT_MAP).length;
|
|
36132
36076
|
return /* @__PURE__ */ jsxs5("div", { className: "m-2", children: [
|
|
36133
|
-
header && /* @__PURE__ */ jsx6("div", { className: "font-bold
|
|
36077
|
+
header && /* @__PURE__ */ jsx6("div", { className: "font-bold p-2", children: header }),
|
|
36134
36078
|
/* @__PURE__ */ jsxs5("div", { className: "flex justify-between", children: [
|
|
36135
36079
|
/* @__PURE__ */ jsx6(
|
|
36136
36080
|
Toolbar,
|
|
@@ -36150,9 +36094,8 @@ function IHTable({
|
|
|
36150
36094
|
sx: {
|
|
36151
36095
|
display: "flex",
|
|
36152
36096
|
flexDirection: "column",
|
|
36153
|
-
height:
|
|
36154
|
-
width
|
|
36155
|
-
zIndex: 999999999
|
|
36097
|
+
height: containerHeight,
|
|
36098
|
+
width
|
|
36156
36099
|
},
|
|
36157
36100
|
children: [
|
|
36158
36101
|
modal && /* @__PURE__ */ jsx6(
|
|
@@ -36161,7 +36104,11 @@ function IHTable({
|
|
|
36161
36104
|
open,
|
|
36162
36105
|
onClose: handleClose,
|
|
36163
36106
|
modal,
|
|
36164
|
-
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
|
|
36165
36112
|
}
|
|
36166
36113
|
),
|
|
36167
36114
|
/* @__PURE__ */ jsx6(
|
|
@@ -36171,6 +36118,7 @@ function IHTable({
|
|
|
36171
36118
|
rows: displayRows,
|
|
36172
36119
|
columns,
|
|
36173
36120
|
density,
|
|
36121
|
+
autoHeight,
|
|
36174
36122
|
checkboxSelection: Boolean(onSelect),
|
|
36175
36123
|
rowSelectionModel: selectedRows,
|
|
36176
36124
|
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
@@ -36178,41 +36126,20 @@ function IHTable({
|
|
|
36178
36126
|
sx: {
|
|
36179
36127
|
fontSize,
|
|
36180
36128
|
"& .MuiDataGrid-cell": {
|
|
36181
|
-
fontSize
|
|
36182
|
-
// Allow cells to wrap text when wrapText is enabled
|
|
36183
|
-
...wrapText && {
|
|
36184
|
-
alignItems: "flex-start",
|
|
36185
|
-
paddingTop: "8px",
|
|
36186
|
-
paddingBottom: "8px",
|
|
36187
|
-
whiteSpace: "normal",
|
|
36188
|
-
wordBreak: "break-word"
|
|
36189
|
-
}
|
|
36129
|
+
fontSize
|
|
36190
36130
|
},
|
|
36191
36131
|
"& .MuiDataGrid-columnHeader": {
|
|
36192
|
-
fontSize
|
|
36193
|
-
...wrapText && {
|
|
36194
|
-
whiteSpace: "normal",
|
|
36195
|
-
"& .MuiDataGrid-columnHeaderTitle": {
|
|
36196
|
-
whiteSpace: "normal",
|
|
36197
|
-
lineHeight: 1.3,
|
|
36198
|
-
wordBreak: "break-word"
|
|
36199
|
-
}
|
|
36200
|
-
}
|
|
36132
|
+
fontSize
|
|
36201
36133
|
},
|
|
36202
36134
|
"& .MuiDataGrid-cell--editable": {
|
|
36203
36135
|
backgroundColor: "#c6d8f0",
|
|
36204
36136
|
fontWeight: 500
|
|
36205
|
-
},
|
|
36206
|
-
...displayRows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
36207
|
-
"& .MuiDataGrid-filler": {
|
|
36208
|
-
display: "none"
|
|
36209
|
-
}
|
|
36210
36137
|
}
|
|
36211
36138
|
},
|
|
36212
36139
|
editMode: "row",
|
|
36213
36140
|
processRowUpdate: handleRowUpdate,
|
|
36214
36141
|
pageSizeOptions: [5, 10],
|
|
36215
|
-
hideFooter
|
|
36142
|
+
hideFooter
|
|
36216
36143
|
}
|
|
36217
36144
|
)
|
|
36218
36145
|
]
|
|
@@ -36765,7 +36692,7 @@ function useResources({
|
|
|
36765
36692
|
// src/select/index.tsx
|
|
36766
36693
|
import React5, {
|
|
36767
36694
|
useEffect as useEffect5,
|
|
36768
|
-
useRef as
|
|
36695
|
+
useRef as useRef2,
|
|
36769
36696
|
useState as useState8
|
|
36770
36697
|
} from "react";
|
|
36771
36698
|
|
|
@@ -36824,7 +36751,7 @@ function Select({
|
|
|
36824
36751
|
);
|
|
36825
36752
|
const [hasEdition, setHasEdition] = useState8(false);
|
|
36826
36753
|
const [highlightedIndex, setHighlightedIndex] = useState8(-1);
|
|
36827
|
-
const inputRef =
|
|
36754
|
+
const inputRef = useRef2(null);
|
|
36828
36755
|
const validOption = (value) => {
|
|
36829
36756
|
return options.find((opt) => opt.label == value);
|
|
36830
36757
|
};
|
|
@@ -36872,7 +36799,7 @@ function Select({
|
|
|
36872
36799
|
setInputValue(opt.label);
|
|
36873
36800
|
setIsOpen(false);
|
|
36874
36801
|
};
|
|
36875
|
-
const containerRef =
|
|
36802
|
+
const containerRef = useRef2(null);
|
|
36876
36803
|
const [openUpwards, setOpenUpwards] = useState8(false);
|
|
36877
36804
|
useEffect5(() => {
|
|
36878
36805
|
if (isOpen && containerRef.current) {
|
|
@@ -37010,7 +36937,7 @@ function Select({
|
|
|
37010
36937
|
import { cloneElement as cloneElement2, useEffect as useEffect6 } from "react";
|
|
37011
36938
|
|
|
37012
36939
|
// src/pop/index.tsx
|
|
37013
|
-
import { useState as useState9, useCallback, useRef as
|
|
36940
|
+
import { useState as useState9, useCallback, useRef as useRef3 } from "react";
|
|
37014
36941
|
|
|
37015
36942
|
// src/pop/actions.tsx
|
|
37016
36943
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -37255,7 +37182,7 @@ var INITIAL_STATE = {
|
|
|
37255
37182
|
};
|
|
37256
37183
|
function usePopup() {
|
|
37257
37184
|
const [popup, setPopup] = useState9(INITIAL_STATE);
|
|
37258
|
-
const messageRef =
|
|
37185
|
+
const messageRef = useRef3(null);
|
|
37259
37186
|
const open = useCallback(
|
|
37260
37187
|
(partial) => {
|
|
37261
37188
|
const { message, ...rest } = partial;
|
|
@@ -37617,7 +37544,7 @@ import React9, {
|
|
|
37617
37544
|
useEffect as useEffect9,
|
|
37618
37545
|
useMemo as useMemo6,
|
|
37619
37546
|
useReducer as useReducer2,
|
|
37620
|
-
useRef as
|
|
37547
|
+
useRef as useRef5,
|
|
37621
37548
|
useState as useState13
|
|
37622
37549
|
} from "react";
|
|
37623
37550
|
|
|
@@ -38481,7 +38408,7 @@ function Table3({
|
|
|
38481
38408
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38482
38409
|
}, [objectData, maxItems]);
|
|
38483
38410
|
const [sort, setSort] = useState13(sortBy);
|
|
38484
|
-
const modalRef =
|
|
38411
|
+
const modalRef = useRef5(null);
|
|
38485
38412
|
const [dialogRow, setDialogRow] = useState13({});
|
|
38486
38413
|
const context = {
|
|
38487
38414
|
objectData,
|