trithuc-mvc-react 2.8.3 → 2.8.4

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.
@@ -1,18 +1,16 @@
1
1
  import { Box } from "@mui/material";
2
- import { FormProvider, useForm } from "react-hook-form";
3
- import Grid from "@mui/material/Unstable_Grid2"; // Grid version 2
2
+
4
3
  import PropTypes from "prop-types";
4
+ import { FormProvider, useForm } from "react-hook-form";
5
5
 
6
6
  import moment from "moment/moment";
7
7
 
8
-
9
- import FormField from "./FormField";
10
8
  import { yupResolver } from "@hookform/resolvers/yup";
9
+ import FormField from "./FormField";
11
10
  DynamicForm.propTypes = {
12
11
  fields: PropTypes.array
13
12
  };
14
13
  function DynamicForm({ fields, elementSize = "medium", submitRef, validationSchema, onSubmit }) {
15
-
16
14
  const methods = useForm({ defaultValues: {}, resolver: yupResolver(validationSchema) });
17
15
 
18
16
  const handleSubmit = (data) => {
@@ -30,8 +28,8 @@ function DynamicForm({ fields, elementSize = "medium", submitRef, validationSche
30
28
  data[keyValueLabel] = datas.find((item) => item[keyValue] == data[field])?.[keyLabel];
31
29
  }
32
30
  });
33
-
34
- onSubmit(data);
31
+
32
+ onSubmit(data);
35
33
  };
36
34
 
37
35
  return (
@@ -12,15 +12,14 @@ import {
12
12
  Switch,
13
13
  TextField
14
14
  } from "@mui/material";
15
- import { Controller, useFormContext } from "react-hook-form";
16
- // Grid version 2
17
- import PropTypes from "prop-types";
15
+ import { Controller, useFormContext } from "react-hook-form";
16
+
18
17
  import { DatePicker } from "@mui/x-date-pickers";
19
- import { useCallback, useEffect, } from "react";
20
18
  import moment from "moment/moment";
19
+ import PropTypes from "prop-types";
20
+ import { useCallback, useEffect } from "react";
21
21
  import { DEFAULT_DATE_FORMAT } from "../../constants";
22
22
 
23
-
24
23
  FormField.propTypes = {
25
24
  datas: PropTypes.array,
26
25
  loading: PropTypes.bool
@@ -57,7 +56,6 @@ function FormField({
57
56
  }
58
57
  }, []);
59
58
 
60
-
61
59
  switch (type) {
62
60
  case "textarea":
63
61
  return (
@@ -130,7 +128,9 @@ function FormField({
130
128
  value={getValueObject(value)}
131
129
  fullWidth
132
130
  getOptionLabel={(option) => option[keyLabel]}
133
- renderInput={(params) => <TextField {...params} label={label} error={Boolean(error)} helperText={error?.message} />}
131
+ renderInput={(params) => (
132
+ <TextField {...params} label={label} error={Boolean(error)} helperText={error?.message} />
133
+ )}
134
134
  />
135
135
  );
136
136
  }}
@@ -218,18 +218,17 @@ function FormField({
218
218
  format={DEFAULT_DATE_FORMAT}
219
219
  slotProps={{
220
220
  textField: {
221
- fullWidth: true, error: Boolean(error),
221
+ fullWidth: true,
222
+ error: Boolean(error),
222
223
  helperText: error?.message
223
224
  },
224
225
  popper: {
225
226
  disablePortal: false,
226
227
  popperOptions: {
227
- strategy: 'fixed'
228
- },
228
+ strategy: "fixed"
229
+ }
229
230
  }
230
231
  }}
231
-
232
-
233
232
  />
234
233
  );
235
234
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "2.8.3",
3
+ "version": "2.8.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"