next-recomponents 2.0.16 → 2.0.18
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.js +86 -70
- package/dist/index.mjs +86 -70
- package/package.json +1 -1
- package/src/table/index.tsx +70 -61
package/dist/index.js
CHANGED
|
@@ -35696,14 +35696,16 @@ function useExcel() {
|
|
|
35696
35696
|
// src/table/index.tsx
|
|
35697
35697
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
35698
35698
|
var HEIGHT_MAP = {
|
|
35699
|
-
1:
|
|
35700
|
-
2:
|
|
35701
|
-
3:
|
|
35702
|
-
4:
|
|
35703
|
-
5:
|
|
35704
|
-
6:
|
|
35705
|
-
7:
|
|
35706
|
-
8:
|
|
35699
|
+
1: 110,
|
|
35700
|
+
2: 165,
|
|
35701
|
+
3: 215,
|
|
35702
|
+
4: 265,
|
|
35703
|
+
5: 320,
|
|
35704
|
+
6: 370,
|
|
35705
|
+
7: 425,
|
|
35706
|
+
8: 475,
|
|
35707
|
+
9: 525,
|
|
35708
|
+
10: 585
|
|
35707
35709
|
};
|
|
35708
35710
|
function EditIcon() {
|
|
35709
35711
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -35756,7 +35758,10 @@ function CustomFooter({
|
|
|
35756
35758
|
if (!entries.length) return null;
|
|
35757
35759
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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]) => {
|
|
35758
35760
|
const value = computeAggregation(rows, key, type);
|
|
35759
|
-
const formatted =
|
|
35761
|
+
const formatted = value.toLocaleString("en-US", {
|
|
35762
|
+
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
35763
|
+
maximumFractionDigits: value % 1 !== 0 ? 2 : 0
|
|
35764
|
+
});
|
|
35760
35765
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
35761
35766
|
FOOTER_LABELS[type],
|
|
35762
35767
|
" de",
|
|
@@ -35797,7 +35802,7 @@ function Toolbar({
|
|
|
35797
35802
|
return rest;
|
|
35798
35803
|
};
|
|
35799
35804
|
if (!exportName && !onSave && !onSelect) return null;
|
|
35800
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-2
|
|
35805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-2 p-2 text-xs", children: [
|
|
35801
35806
|
exportName && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35802
35807
|
Button,
|
|
35803
35808
|
{
|
|
@@ -35834,6 +35839,15 @@ function useColumns(rows, options) {
|
|
|
35834
35839
|
return {
|
|
35835
35840
|
field: key,
|
|
35836
35841
|
headerName: key,
|
|
35842
|
+
valueFormatter: (value) => {
|
|
35843
|
+
if (value == null || value === "") return "";
|
|
35844
|
+
const num = parseFloat(value);
|
|
35845
|
+
if (isNaN(num)) return value;
|
|
35846
|
+
return num.toLocaleString("en-US", {
|
|
35847
|
+
minimumFractionDigits: num % 1 !== 0 ? 2 : 0,
|
|
35848
|
+
maximumFractionDigits: num % 1 !== 0 ? 2 : 0
|
|
35849
|
+
});
|
|
35850
|
+
},
|
|
35837
35851
|
flex,
|
|
35838
35852
|
editable: (_a = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _a : false,
|
|
35839
35853
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
@@ -35887,7 +35901,7 @@ function IHTable({
|
|
|
35887
35901
|
buttons,
|
|
35888
35902
|
exportName,
|
|
35889
35903
|
modal,
|
|
35890
|
-
height =
|
|
35904
|
+
height = 580,
|
|
35891
35905
|
width = "100%",
|
|
35892
35906
|
header,
|
|
35893
35907
|
hideColumns = [],
|
|
@@ -35942,66 +35956,68 @@ function IHTable({
|
|
|
35942
35956
|
onModalOpen: handleModalOpen
|
|
35943
35957
|
});
|
|
35944
35958
|
if (!rows.length) return null;
|
|
35945
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
35946
|
-
|
|
35947
|
-
|
|
35948
|
-
|
|
35949
|
-
|
|
35950
|
-
|
|
35951
|
-
|
|
35952
|
-
|
|
35953
|
-
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
|
|
35957
|
-
|
|
35958
|
-
|
|
35959
|
-
|
|
35960
|
-
|
|
35961
|
-
|
|
35962
|
-
|
|
35963
|
-
|
|
35964
|
-
|
|
35965
|
-
|
|
35966
|
-
|
|
35967
|
-
|
|
35968
|
-
|
|
35969
|
-
|
|
35970
|
-
|
|
35971
|
-
|
|
35972
|
-
|
|
35973
|
-
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35985
|
-
|
|
35986
|
-
|
|
35987
|
-
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
35991
|
-
|
|
35959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "m-2", children: [
|
|
35960
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "font-bold p-2 ", children: header }),
|
|
35961
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35962
|
+
Toolbar,
|
|
35963
|
+
{
|
|
35964
|
+
exportName,
|
|
35965
|
+
onSave,
|
|
35966
|
+
onSelect,
|
|
35967
|
+
rows,
|
|
35968
|
+
filteredRows
|
|
35969
|
+
}
|
|
35970
|
+
),
|
|
35971
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
35972
|
+
import_material.Box,
|
|
35973
|
+
{
|
|
35974
|
+
sx: {
|
|
35975
|
+
display: "flex",
|
|
35976
|
+
flexDirection: "column",
|
|
35977
|
+
height: (_a = HEIGHT_MAP[rows.length]) != null ? _a : height,
|
|
35978
|
+
width,
|
|
35979
|
+
zIndex: 999999999
|
|
35980
|
+
},
|
|
35981
|
+
children: [
|
|
35982
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35983
|
+
ModalDialog,
|
|
35984
|
+
{
|
|
35985
|
+
open,
|
|
35986
|
+
onClose: handleClose,
|
|
35987
|
+
modal,
|
|
35988
|
+
selectedRow: modalRow
|
|
35989
|
+
}
|
|
35990
|
+
),
|
|
35991
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35992
|
+
import_x_data_grid.DataGrid,
|
|
35993
|
+
{
|
|
35994
|
+
rows,
|
|
35995
|
+
columns,
|
|
35996
|
+
checkboxSelection: Boolean(onSelect),
|
|
35997
|
+
rowSelectionModel: selectedRows,
|
|
35998
|
+
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
35999
|
+
sx: {
|
|
36000
|
+
"& .MuiDataGrid-cell--editable": {
|
|
36001
|
+
backgroundColor: "#c6d8f0",
|
|
36002
|
+
fontWeight: 500
|
|
36003
|
+
},
|
|
36004
|
+
...rows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
36005
|
+
"& .MuiDataGrid-filler": {
|
|
36006
|
+
display: "none"
|
|
36007
|
+
}
|
|
35992
36008
|
}
|
|
35993
|
-
}
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
36000
|
-
|
|
36001
|
-
|
|
36002
|
-
|
|
36003
|
-
|
|
36004
|
-
);
|
|
36009
|
+
},
|
|
36010
|
+
editMode: "row",
|
|
36011
|
+
processRowUpdate: handleRowUpdate,
|
|
36012
|
+
pageSizeOptions: [5, 10],
|
|
36013
|
+
hideFooter: rows.length <= Object.keys(HEIGHT_MAP).length
|
|
36014
|
+
}
|
|
36015
|
+
),
|
|
36016
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CustomFooter, { footer, rows })
|
|
36017
|
+
]
|
|
36018
|
+
}
|
|
36019
|
+
)
|
|
36020
|
+
] });
|
|
36005
36021
|
}
|
|
36006
36022
|
function Table(props) {
|
|
36007
36023
|
if (Array.isArray(props.data)) {
|
package/dist/index.mjs
CHANGED
|
@@ -35676,14 +35676,16 @@ function useExcel() {
|
|
|
35676
35676
|
// src/table/index.tsx
|
|
35677
35677
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
35678
35678
|
var HEIGHT_MAP = {
|
|
35679
|
-
1:
|
|
35680
|
-
2:
|
|
35681
|
-
3:
|
|
35682
|
-
4:
|
|
35683
|
-
5:
|
|
35684
|
-
6:
|
|
35685
|
-
7:
|
|
35686
|
-
8:
|
|
35679
|
+
1: 110,
|
|
35680
|
+
2: 165,
|
|
35681
|
+
3: 215,
|
|
35682
|
+
4: 265,
|
|
35683
|
+
5: 320,
|
|
35684
|
+
6: 370,
|
|
35685
|
+
7: 425,
|
|
35686
|
+
8: 475,
|
|
35687
|
+
9: 525,
|
|
35688
|
+
10: 585
|
|
35687
35689
|
};
|
|
35688
35690
|
function EditIcon() {
|
|
35689
35691
|
return /* @__PURE__ */ jsx6(
|
|
@@ -35736,7 +35738,10 @@ function CustomFooter({
|
|
|
35736
35738
|
if (!entries.length) return null;
|
|
35737
35739
|
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]) => {
|
|
35738
35740
|
const value = computeAggregation(rows, key, type);
|
|
35739
|
-
const formatted =
|
|
35741
|
+
const formatted = value.toLocaleString("en-US", {
|
|
35742
|
+
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
35743
|
+
maximumFractionDigits: value % 1 !== 0 ? 2 : 0
|
|
35744
|
+
});
|
|
35740
35745
|
return /* @__PURE__ */ jsxs5("span", { children: [
|
|
35741
35746
|
FOOTER_LABELS[type],
|
|
35742
35747
|
" de",
|
|
@@ -35777,7 +35782,7 @@ function Toolbar({
|
|
|
35777
35782
|
return rest;
|
|
35778
35783
|
};
|
|
35779
35784
|
if (!exportName && !onSave && !onSelect) return null;
|
|
35780
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2
|
|
35785
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 p-2 text-xs", children: [
|
|
35781
35786
|
exportName && /* @__PURE__ */ jsx6(
|
|
35782
35787
|
Button,
|
|
35783
35788
|
{
|
|
@@ -35814,6 +35819,15 @@ function useColumns(rows, options) {
|
|
|
35814
35819
|
return {
|
|
35815
35820
|
field: key,
|
|
35816
35821
|
headerName: key,
|
|
35822
|
+
valueFormatter: (value) => {
|
|
35823
|
+
if (value == null || value === "") return "";
|
|
35824
|
+
const num = parseFloat(value);
|
|
35825
|
+
if (isNaN(num)) return value;
|
|
35826
|
+
return num.toLocaleString("en-US", {
|
|
35827
|
+
minimumFractionDigits: num % 1 !== 0 ? 2 : 0,
|
|
35828
|
+
maximumFractionDigits: num % 1 !== 0 ? 2 : 0
|
|
35829
|
+
});
|
|
35830
|
+
},
|
|
35817
35831
|
flex,
|
|
35818
35832
|
editable: (_a = editableFields == null ? void 0 : editableFields.includes(key)) != null ? _a : false,
|
|
35819
35833
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
@@ -35867,7 +35881,7 @@ function IHTable({
|
|
|
35867
35881
|
buttons,
|
|
35868
35882
|
exportName,
|
|
35869
35883
|
modal,
|
|
35870
|
-
height =
|
|
35884
|
+
height = 580,
|
|
35871
35885
|
width = "100%",
|
|
35872
35886
|
header,
|
|
35873
35887
|
hideColumns = [],
|
|
@@ -35922,66 +35936,68 @@ function IHTable({
|
|
|
35922
35936
|
onModalOpen: handleModalOpen
|
|
35923
35937
|
});
|
|
35924
35938
|
if (!rows.length) return null;
|
|
35925
|
-
return /* @__PURE__ */ jsxs5(
|
|
35926
|
-
|
|
35927
|
-
|
|
35928
|
-
|
|
35929
|
-
|
|
35930
|
-
|
|
35931
|
-
|
|
35932
|
-
|
|
35933
|
-
|
|
35934
|
-
|
|
35935
|
-
|
|
35936
|
-
|
|
35937
|
-
|
|
35938
|
-
|
|
35939
|
-
|
|
35940
|
-
|
|
35941
|
-
|
|
35942
|
-
|
|
35943
|
-
|
|
35944
|
-
|
|
35945
|
-
|
|
35946
|
-
|
|
35947
|
-
|
|
35948
|
-
|
|
35949
|
-
|
|
35950
|
-
|
|
35951
|
-
|
|
35952
|
-
|
|
35953
|
-
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
|
|
35957
|
-
|
|
35958
|
-
|
|
35959
|
-
|
|
35960
|
-
|
|
35961
|
-
|
|
35962
|
-
|
|
35963
|
-
|
|
35964
|
-
|
|
35965
|
-
|
|
35966
|
-
|
|
35967
|
-
|
|
35968
|
-
|
|
35969
|
-
|
|
35970
|
-
|
|
35971
|
-
|
|
35939
|
+
return /* @__PURE__ */ jsxs5("div", { className: "m-2", children: [
|
|
35940
|
+
header && /* @__PURE__ */ jsx6("div", { className: "font-bold p-2 ", children: header }),
|
|
35941
|
+
/* @__PURE__ */ jsx6(
|
|
35942
|
+
Toolbar,
|
|
35943
|
+
{
|
|
35944
|
+
exportName,
|
|
35945
|
+
onSave,
|
|
35946
|
+
onSelect,
|
|
35947
|
+
rows,
|
|
35948
|
+
filteredRows
|
|
35949
|
+
}
|
|
35950
|
+
),
|
|
35951
|
+
/* @__PURE__ */ jsxs5(
|
|
35952
|
+
Box,
|
|
35953
|
+
{
|
|
35954
|
+
sx: {
|
|
35955
|
+
display: "flex",
|
|
35956
|
+
flexDirection: "column",
|
|
35957
|
+
height: (_a = HEIGHT_MAP[rows.length]) != null ? _a : height,
|
|
35958
|
+
width,
|
|
35959
|
+
zIndex: 999999999
|
|
35960
|
+
},
|
|
35961
|
+
children: [
|
|
35962
|
+
modal && /* @__PURE__ */ jsx6(
|
|
35963
|
+
ModalDialog,
|
|
35964
|
+
{
|
|
35965
|
+
open,
|
|
35966
|
+
onClose: handleClose,
|
|
35967
|
+
modal,
|
|
35968
|
+
selectedRow: modalRow
|
|
35969
|
+
}
|
|
35970
|
+
),
|
|
35971
|
+
/* @__PURE__ */ jsx6(
|
|
35972
|
+
DataGrid,
|
|
35973
|
+
{
|
|
35974
|
+
rows,
|
|
35975
|
+
columns,
|
|
35976
|
+
checkboxSelection: Boolean(onSelect),
|
|
35977
|
+
rowSelectionModel: selectedRows,
|
|
35978
|
+
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
35979
|
+
sx: {
|
|
35980
|
+
"& .MuiDataGrid-cell--editable": {
|
|
35981
|
+
backgroundColor: "#c6d8f0",
|
|
35982
|
+
fontWeight: 500
|
|
35983
|
+
},
|
|
35984
|
+
...rows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
35985
|
+
"& .MuiDataGrid-filler": {
|
|
35986
|
+
display: "none"
|
|
35987
|
+
}
|
|
35972
35988
|
}
|
|
35973
|
-
}
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
);
|
|
35989
|
+
},
|
|
35990
|
+
editMode: "row",
|
|
35991
|
+
processRowUpdate: handleRowUpdate,
|
|
35992
|
+
pageSizeOptions: [5, 10],
|
|
35993
|
+
hideFooter: rows.length <= Object.keys(HEIGHT_MAP).length
|
|
35994
|
+
}
|
|
35995
|
+
),
|
|
35996
|
+
/* @__PURE__ */ jsx6(CustomFooter, { footer, rows })
|
|
35997
|
+
]
|
|
35998
|
+
}
|
|
35999
|
+
)
|
|
36000
|
+
] });
|
|
35985
36001
|
}
|
|
35986
36002
|
function Table(props) {
|
|
35987
36003
|
if (Array.isArray(props.data)) {
|
package/package.json
CHANGED
package/src/table/index.tsx
CHANGED
|
@@ -42,14 +42,16 @@ interface TableProps {
|
|
|
42
42
|
// ─── Height mapping ───────────────────────────────────────────────────────────
|
|
43
43
|
|
|
44
44
|
const HEIGHT_MAP: Record<number, number> = {
|
|
45
|
-
1:
|
|
46
|
-
2:
|
|
47
|
-
3:
|
|
48
|
-
4:
|
|
49
|
-
5:
|
|
50
|
-
6:
|
|
51
|
-
7:
|
|
52
|
-
8:
|
|
45
|
+
1: 110,
|
|
46
|
+
2: 165,
|
|
47
|
+
3: 215,
|
|
48
|
+
4: 265,
|
|
49
|
+
5: 320,
|
|
50
|
+
6: 370,
|
|
51
|
+
7: 425,
|
|
52
|
+
8: 475,
|
|
53
|
+
9: 525,
|
|
54
|
+
10: 585,
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
// ─── Icons ────────────────────────────────────────────────────────────────────
|
|
@@ -133,10 +135,10 @@ function CustomFooter({
|
|
|
133
135
|
<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">
|
|
134
136
|
{entries.map(([key, type]) => {
|
|
135
137
|
const value = computeAggregation(rows, key, type);
|
|
136
|
-
const formatted =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
const formatted = value.toLocaleString("en-US", {
|
|
139
|
+
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
140
|
+
maximumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
141
|
+
});
|
|
140
142
|
return (
|
|
141
143
|
<span key={key}>
|
|
142
144
|
{FOOTER_LABELS[type]} de{" "}
|
|
@@ -207,7 +209,7 @@ function Toolbar({
|
|
|
207
209
|
if (!exportName && !onSave && !onSelect) return null;
|
|
208
210
|
|
|
209
211
|
return (
|
|
210
|
-
<div className="flex gap-2
|
|
212
|
+
<div className="flex gap-2 p-2 text-xs">
|
|
211
213
|
{exportName && (
|
|
212
214
|
<Button
|
|
213
215
|
className="bg-green-800 text-white"
|
|
@@ -267,6 +269,16 @@ function useColumns(
|
|
|
267
269
|
.map((key) => ({
|
|
268
270
|
field: key,
|
|
269
271
|
headerName: key,
|
|
272
|
+
valueFormatter: (value: any) => {
|
|
273
|
+
if (value == null || value === "") return "";
|
|
274
|
+
const num = parseFloat(value);
|
|
275
|
+
if (isNaN(num)) return value;
|
|
276
|
+
|
|
277
|
+
return num.toLocaleString("en-US", {
|
|
278
|
+
minimumFractionDigits: num % 1 !== 0 ? 2 : 0,
|
|
279
|
+
maximumFractionDigits: num % 1 !== 0 ? 2 : 0,
|
|
280
|
+
});
|
|
281
|
+
},
|
|
270
282
|
flex,
|
|
271
283
|
editable: editableFields?.includes(key) ?? false,
|
|
272
284
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
@@ -304,7 +316,7 @@ function useColumns(
|
|
|
304
316
|
{params?.row?.["Modal"]}
|
|
305
317
|
</Button>
|
|
306
318
|
) as any,
|
|
307
|
-
});
|
|
319
|
+
} as any);
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
return cols;
|
|
@@ -322,7 +334,7 @@ function IHTable({
|
|
|
322
334
|
buttons,
|
|
323
335
|
exportName,
|
|
324
336
|
modal,
|
|
325
|
-
height =
|
|
337
|
+
height = 580,
|
|
326
338
|
width = "100%",
|
|
327
339
|
header,
|
|
328
340
|
hideColumns = [],
|
|
@@ -387,30 +399,8 @@ function IHTable({
|
|
|
387
399
|
if (!rows.length) return null;
|
|
388
400
|
|
|
389
401
|
return (
|
|
390
|
-
<
|
|
391
|
-
|
|
392
|
-
display: "flex",
|
|
393
|
-
flexDirection: "column",
|
|
394
|
-
height: HEIGHT_MAP[rows.length] ?? height,
|
|
395
|
-
width,
|
|
396
|
-
zIndex: 999999999,
|
|
397
|
-
}}
|
|
398
|
-
>
|
|
399
|
-
{modal && (
|
|
400
|
-
<ModalDialog
|
|
401
|
-
open={open}
|
|
402
|
-
onClose={handleClose}
|
|
403
|
-
modal={modal}
|
|
404
|
-
selectedRow={modalRow}
|
|
405
|
-
/>
|
|
406
|
-
)}
|
|
407
|
-
|
|
408
|
-
{header && (
|
|
409
|
-
<div className="font-bold text-xl p-2 bg-blue-500 text-white border shadow rounded">
|
|
410
|
-
{header}
|
|
411
|
-
</div>
|
|
412
|
-
)}
|
|
413
|
-
|
|
402
|
+
<div className="m-2">
|
|
403
|
+
{header && <div className="font-bold p-2 ">{header}</div>}
|
|
414
404
|
<Toolbar
|
|
415
405
|
exportName={exportName}
|
|
416
406
|
onSave={onSave}
|
|
@@ -419,31 +409,50 @@ function IHTable({
|
|
|
419
409
|
filteredRows={filteredRows}
|
|
420
410
|
/>
|
|
421
411
|
|
|
422
|
-
<
|
|
423
|
-
rows={rows}
|
|
424
|
-
columns={columns as any}
|
|
425
|
-
checkboxSelection={Boolean(onSelect)}
|
|
426
|
-
rowSelectionModel={selectedRows}
|
|
427
|
-
onRowSelectionModelChange={!modal ? setSelectedRows : undefined}
|
|
412
|
+
<Box
|
|
428
413
|
sx={{
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
"& .MuiDataGrid-filler": {
|
|
435
|
-
display: "none",
|
|
436
|
-
},
|
|
437
|
-
}),
|
|
414
|
+
display: "flex",
|
|
415
|
+
flexDirection: "column",
|
|
416
|
+
height: HEIGHT_MAP[rows.length] ?? height,
|
|
417
|
+
width,
|
|
418
|
+
zIndex: 999999999,
|
|
438
419
|
}}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
420
|
+
>
|
|
421
|
+
{modal && (
|
|
422
|
+
<ModalDialog
|
|
423
|
+
open={open}
|
|
424
|
+
onClose={handleClose}
|
|
425
|
+
modal={modal}
|
|
426
|
+
selectedRow={modalRow}
|
|
427
|
+
/>
|
|
428
|
+
)}
|
|
429
|
+
|
|
430
|
+
<DataGrid
|
|
431
|
+
rows={rows}
|
|
432
|
+
columns={columns as any}
|
|
433
|
+
checkboxSelection={Boolean(onSelect)}
|
|
434
|
+
rowSelectionModel={selectedRows}
|
|
435
|
+
onRowSelectionModelChange={!modal ? setSelectedRows : undefined}
|
|
436
|
+
sx={{
|
|
437
|
+
"& .MuiDataGrid-cell--editable": {
|
|
438
|
+
backgroundColor: "#c6d8f0",
|
|
439
|
+
fontWeight: 500,
|
|
440
|
+
},
|
|
441
|
+
...(rows.length <= Object.keys(HEIGHT_MAP).length && {
|
|
442
|
+
"& .MuiDataGrid-filler": {
|
|
443
|
+
display: "none",
|
|
444
|
+
},
|
|
445
|
+
}),
|
|
446
|
+
}}
|
|
447
|
+
editMode="row"
|
|
448
|
+
processRowUpdate={handleRowUpdate}
|
|
449
|
+
pageSizeOptions={[5, 10]}
|
|
450
|
+
hideFooter={rows.length <= Object.keys(HEIGHT_MAP).length}
|
|
451
|
+
/>
|
|
444
452
|
|
|
445
|
-
|
|
446
|
-
|
|
453
|
+
<CustomFooter footer={footer} rows={rows} />
|
|
454
|
+
</Box>
|
|
455
|
+
</div>
|
|
447
456
|
);
|
|
448
457
|
}
|
|
449
458
|
|