trithuc-mvc-react 1.5.6 → 1.5.7

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.
@@ -144,7 +144,7 @@ const DataTable = () => {
144
144
  };
145
145
  const theme = useTheme();
146
146
  const downXL = useMediaQuery(theme.breakpoints.down("xl"));
147
- console.log("downXL", downXL);
147
+
148
148
  return (
149
149
  <>
150
150
  <TableContainer sx={{ position: "relative" }}>
@@ -12,7 +12,7 @@ import {
12
12
  Switch,
13
13
  TextField
14
14
  } from "@mui/material";
15
- import { Controller, useFormContext } from "react-hook-form";
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
 
@@ -1,4 +1,4 @@
1
1
  import { createContext } from "react";
2
2
 
3
3
  export const DataTableContext = createContext({ tableName: null });
4
- export const PermissionContext = createContext(null);
4
+ export const PermissionContext = createContext({});
@@ -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
- console.table(Permission);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"