trithuc-mvc-react 1.5.6 → 1.5.8
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.
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Switch,
|
|
13
13
|
TextField
|
|
14
14
|
} from "@mui/material";
|
|
15
|
-
import { Controller,
|
|
15
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
16
16
|
// Grid version 2
|
|
17
17
|
import PropTypes from "prop-types";
|
|
18
18
|
import { DatePicker } from "@mui/x-date-pickers";
|
|
@@ -80,7 +80,6 @@ function FormField({
|
|
|
80
80
|
}}
|
|
81
81
|
/>
|
|
82
82
|
);
|
|
83
|
-
|
|
84
83
|
case "text":
|
|
85
84
|
case "number":
|
|
86
85
|
return (
|
|
@@ -103,7 +102,6 @@ function FormField({
|
|
|
103
102
|
}}
|
|
104
103
|
/>
|
|
105
104
|
);
|
|
106
|
-
|
|
107
105
|
case "autocomplete": {
|
|
108
106
|
if (keyValueLabel) {
|
|
109
107
|
register(keyValueLabel);
|
|
@@ -137,7 +135,6 @@ function FormField({
|
|
|
137
135
|
/>
|
|
138
136
|
);
|
|
139
137
|
}
|
|
140
|
-
|
|
141
138
|
case "select":
|
|
142
139
|
return (
|
|
143
140
|
<Controller
|
|
@@ -238,6 +235,33 @@ function FormField({
|
|
|
238
235
|
}}
|
|
239
236
|
/>
|
|
240
237
|
);
|
|
238
|
+
|
|
239
|
+
case "trangThaiXuLy":
|
|
240
|
+
return (
|
|
241
|
+
<Controller
|
|
242
|
+
name={name}
|
|
243
|
+
control={control}
|
|
244
|
+
render={({ field, fieldState: { error } }) => {
|
|
245
|
+
return (
|
|
246
|
+
<TextField
|
|
247
|
+
{...field}
|
|
248
|
+
type={type}
|
|
249
|
+
label={label + (required ? "*" : "")}
|
|
250
|
+
error={Boolean(error)}
|
|
251
|
+
helperText={error?.message}
|
|
252
|
+
fullWidth
|
|
253
|
+
placeholder={label}
|
|
254
|
+
size={size}
|
|
255
|
+
InputProps={{
|
|
256
|
+
style: {
|
|
257
|
+
display: "none"
|
|
258
|
+
}
|
|
259
|
+
}}
|
|
260
|
+
/>
|
|
261
|
+
);
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
241
265
|
}
|
|
242
266
|
}
|
|
243
267
|
|
|
@@ -14,8 +14,7 @@ export function usePermission() {
|
|
|
14
14
|
const canCreate = !Permission || Permission.Create;
|
|
15
15
|
const canAction = !Permission || Permission.Action;
|
|
16
16
|
const canView = !Permission || Permission.View;
|
|
17
|
-
|
|
18
|
-
console.table({canEdit, canDelete, canDeleteMulti, canSave, canCreate, canAction, canView});
|
|
17
|
+
|
|
19
18
|
return { canEdit, canDelete, canDeleteMulti, canSave, canCreate, canAction, canView };
|
|
20
19
|
}, [Permission]);
|
|
21
20
|
|