@nethru/ui 1.0.40 → 1.0.41
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/PropertyTable.js +1 -23
- package/package.json +1 -1
package/dist/PropertyTable.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { useMemo, useState } from "react";
|
|
2
|
-
import { DataGrid
|
|
3
|
-
import { Box } from "@mui/material";
|
|
2
|
+
import { DataGrid } from "@mui/x-data-grid";
|
|
4
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
4
|
export default function PropertyTable({
|
|
6
5
|
columns,
|
|
7
6
|
rows,
|
|
8
7
|
onUpdate,
|
|
9
8
|
readOnly,
|
|
10
|
-
customGridCellMap = {},
|
|
11
9
|
sx,
|
|
12
10
|
...props
|
|
13
11
|
}) {
|
|
@@ -58,22 +56,6 @@ export default function PropertyTable({
|
|
|
58
56
|
});
|
|
59
57
|
}, [columns, readOnly]);
|
|
60
58
|
const [updatedRows, setUpdatedRows] = useState(rows);
|
|
61
|
-
const CustomGridCell = function (params) {
|
|
62
|
-
let children;
|
|
63
|
-
const func = customGridCellMap[params.column.field];
|
|
64
|
-
if (func) children = func(params);
|
|
65
|
-
if (!children) children = /*#__PURE__*/_jsx(Box, {
|
|
66
|
-
sx: {
|
|
67
|
-
mt: 2,
|
|
68
|
-
mb: 2
|
|
69
|
-
},
|
|
70
|
-
children: params.formattedValue
|
|
71
|
-
});
|
|
72
|
-
return /*#__PURE__*/_jsx(GridCell, {
|
|
73
|
-
...params,
|
|
74
|
-
children: children
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
59
|
const processRowUpdate = row => {
|
|
78
60
|
const newRows = updatedRows.filter(r => r.id !== row.id);
|
|
79
61
|
newRows.push(row);
|
|
@@ -89,10 +71,6 @@ export default function PropertyTable({
|
|
|
89
71
|
isCellEditable: params => {
|
|
90
72
|
return params.row.deletable || !params.colDef.fixed;
|
|
91
73
|
},
|
|
92
|
-
slots: {
|
|
93
|
-
cell: CustomGridCell,
|
|
94
|
-
...props.slots
|
|
95
|
-
},
|
|
96
74
|
processRowUpdate: processRowUpdate,
|
|
97
75
|
onProcessRowUpdateError: error => console.log(error),
|
|
98
76
|
disableColumnMenu: true,
|