@nethru/ui 1.0.64 → 1.0.66
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/DataGrid.js +2 -2
- package/dist/Editor.js +11 -9
- package/dist/PropertyTable.js +37 -20
- package/package.json +1 -1
package/dist/DataGrid.js
CHANGED
|
@@ -52,7 +52,7 @@ export default function DataGrid({
|
|
|
52
52
|
columns,
|
|
53
53
|
rows,
|
|
54
54
|
customToolbar = /*#__PURE__*/_jsx(_Fragment, {}),
|
|
55
|
-
customGridCellMap
|
|
55
|
+
customGridCellMap,
|
|
56
56
|
slots = {},
|
|
57
57
|
slotProps,
|
|
58
58
|
initialState,
|
|
@@ -112,7 +112,7 @@ export default function DataGrid({
|
|
|
112
112
|
},
|
|
113
113
|
slots: {
|
|
114
114
|
toolbar: hideToolbar ? null : CustomToolbar,
|
|
115
|
-
cell: CustomGridCell,
|
|
115
|
+
cell: customGridCellMap ? CustomGridCell : undefined,
|
|
116
116
|
...slots
|
|
117
117
|
},
|
|
118
118
|
slotProps: {
|
package/dist/Editor.js
CHANGED
|
@@ -31,10 +31,18 @@ export default function Editor({
|
|
|
31
31
|
const styles = useMemo(() => {
|
|
32
32
|
return {
|
|
33
33
|
maxWidth: restrictWidth && ref.current ? `${ref.current.offsetWidth}px` : 'unset',
|
|
34
|
-
borderBottom: focused ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${!readOnly ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
|
|
34
|
+
borderBottom: focused || error ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${!readOnly ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
|
|
35
35
|
};
|
|
36
36
|
// eslint-disable-next-line
|
|
37
37
|
}, [readOnly, error, focused, ref.current]);
|
|
38
|
+
const helperTextStyles = useMemo(() => {
|
|
39
|
+
return {
|
|
40
|
+
color: error ? '#d32f2f' : '#555',
|
|
41
|
+
fontSize: 12,
|
|
42
|
+
ml: '14px',
|
|
43
|
+
mt: '3px'
|
|
44
|
+
};
|
|
45
|
+
}, [error]);
|
|
38
46
|
const highlight = useMemo(() => {
|
|
39
47
|
const highlightEffect = StateEffect.define();
|
|
40
48
|
const decoration = Decoration.mark({
|
|
@@ -119,15 +127,9 @@ export default function Editor({
|
|
|
119
127
|
...styles
|
|
120
128
|
},
|
|
121
129
|
...props
|
|
122
|
-
}),
|
|
130
|
+
}), helperText && /*#__PURE__*/_jsx(Typography, {
|
|
123
131
|
sx: helperTextStyles,
|
|
124
132
|
children: helperText
|
|
125
133
|
})]
|
|
126
134
|
});
|
|
127
|
-
}
|
|
128
|
-
const helperTextStyles = {
|
|
129
|
-
color: '#d32f2f',
|
|
130
|
-
fontSize: 12,
|
|
131
|
-
ml: '14px',
|
|
132
|
-
mt: '3px'
|
|
133
|
-
};
|
|
135
|
+
}
|
package/dist/PropertyTable.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { forwardRef, useMemo, useState } from "react";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
2
3
|
import MenuItem from "@mui/material/MenuItem";
|
|
3
4
|
import { DataGrid, useGridApiContext } from "@mui/x-data-grid";
|
|
4
5
|
import Select from "./Select";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
8
|
const PropertyTable = /*#__PURE__*/forwardRef(({
|
|
7
9
|
columns,
|
|
8
10
|
rows,
|
|
9
11
|
onUpdate,
|
|
10
12
|
readOnly,
|
|
13
|
+
error = false,
|
|
14
|
+
helperText,
|
|
11
15
|
sx,
|
|
12
16
|
...props
|
|
13
17
|
}, ref) => {
|
|
14
18
|
const styles = useMemo(() => {
|
|
15
19
|
const result = {
|
|
16
20
|
'&.MuiDataGrid-root': {
|
|
17
|
-
borderBottom: 'none'
|
|
21
|
+
borderBottom: error ? '2px solid #d32f2f' : 'none'
|
|
18
22
|
},
|
|
19
23
|
'.MuiDataGrid-columnHeaders': {
|
|
20
24
|
backgroundColor: '#f8f9fa'
|
|
@@ -42,7 +46,15 @@ const PropertyTable = /*#__PURE__*/forwardRef(({
|
|
|
42
46
|
};
|
|
43
47
|
}
|
|
44
48
|
return result;
|
|
45
|
-
}, [readOnly]);
|
|
49
|
+
}, [readOnly, error]);
|
|
50
|
+
const helperTextStyles = useMemo(() => {
|
|
51
|
+
return {
|
|
52
|
+
color: error ? '#d32f2f' : '#555',
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
ml: '14px',
|
|
55
|
+
mt: '3px'
|
|
56
|
+
};
|
|
57
|
+
}, [error]);
|
|
46
58
|
const arrangedColumns = useMemo(() => {
|
|
47
59
|
return columns.map(column => {
|
|
48
60
|
const newColumn = {
|
|
@@ -71,25 +83,30 @@ const PropertyTable = /*#__PURE__*/forwardRef(({
|
|
|
71
83
|
if (onUpdate) onUpdate(row, newRows);
|
|
72
84
|
return row;
|
|
73
85
|
};
|
|
74
|
-
return /*#__PURE__*/
|
|
86
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
75
87
|
ref: ref,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
children: [/*#__PURE__*/_jsx(DataGrid, {
|
|
89
|
+
columns: arrangedColumns,
|
|
90
|
+
rows: rows,
|
|
91
|
+
columnHeaderHeight: 35,
|
|
92
|
+
rowHeight: 30,
|
|
93
|
+
isCellEditable: params => {
|
|
94
|
+
return params.row.deletable || !params.colDef.fixed;
|
|
95
|
+
},
|
|
96
|
+
processRowUpdate: processRowUpdate,
|
|
97
|
+
onProcessRowUpdateError: error => console.log(error),
|
|
98
|
+
disableColumnMenu: true,
|
|
99
|
+
disableRowSelectionOnClick: readOnly,
|
|
100
|
+
hideFooter: true,
|
|
101
|
+
sx: {
|
|
102
|
+
...styles,
|
|
103
|
+
...sx
|
|
104
|
+
},
|
|
105
|
+
...props
|
|
106
|
+
}), helperText && /*#__PURE__*/_jsx(Typography, {
|
|
107
|
+
sx: helperTextStyles,
|
|
108
|
+
children: helperText
|
|
109
|
+
})]
|
|
93
110
|
});
|
|
94
111
|
});
|
|
95
112
|
const SingleSelect = /*#__PURE__*/forwardRef((props, ref) => {
|