trithuc-mvc-react 2.8.2 → 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.
@@ -288,16 +288,16 @@ const DataTable = ({ multipleActions = [], page, setPage = () => {}, disableEdit
288
288
  </Table>
289
289
  </TableContainer>
290
290
 
291
- <Grid container>
291
+ <Grid2 container>
292
292
  {!hasTabpanel && (
293
- <Grid item alignSelf={"center"} sx={{ pl: 2 }}>
293
+ <Grid2 item alignSelf={"center"} sx={{ pl: 2 }}>
294
294
  <Typography variant="body1">
295
295
  Tổng số lượng: <span>{total}</span>
296
296
  </Typography>
297
297
  </Grid>
298
298
  )}
299
299
 
300
- <Grid item xs>
300
+ <Grid2 item xs>
301
301
  <TablePaginationCustom
302
302
  count={total}
303
303
  rowsPerPage={rowsPerPage}
@@ -289,16 +289,16 @@ const DataTableSM = ({ multipleActions = [], page, setPage = () => {}, disableEd
289
289
  </Table>
290
290
  </TableContainer>
291
291
 
292
- <Grid container>
292
+ <Grid2 container>
293
293
  {!hasTabpanel && (
294
- <Grid item alignSelf={"center"} sx={{ pl: 2 }}>
294
+ <Grid2 item alignSelf={"center"} sx={{ pl: 2 }}>
295
295
  <Typography variant="body1">
296
296
  Tổng số lượng: <span>{total}</span>
297
297
  </Typography>
298
298
  </Grid>
299
299
  )}
300
300
 
301
- <Grid item xs>
301
+ <Grid2 item xs>
302
302
  <TablePaginationCustom
303
303
  count={total}
304
304
  rowsPerPage={rowsPerPage}
@@ -166,7 +166,7 @@ function EditorForm({ fields, submitRef }) {
166
166
  return (
167
167
  <FormProvider {...methods}>
168
168
  <Box component={"form"} onSubmit={methods.handleSubmit(onSubmit, onValid)}>
169
- <Grid container spacing={2}>
169
+ <Grid2 container spacing={2}>
170
170
  {fields.map(
171
171
  ({
172
172
  field,
@@ -185,7 +185,7 @@ function EditorForm({ fields, submitRef }) {
185
185
  ...rest
186
186
  }) => {
187
187
  return (
188
- <Grid item md={size?.md} xs={size?.xs} sm={size?.sm} key={field}>
188
+ <Grid2 item md={size?.md} xs={size?.xs} sm={size?.sm} key={field}>
189
189
  <FormField
190
190
  type={type}
191
191
  label={label}
@@ -1,4 +1,4 @@
1
- import { Accordion, AccordionSummary, Box, Slider, Typography } from "@mui/material";
1
+ import { Accordion, AccordionSummary, Box, Grid2, Slider, Typography } from "@mui/material";
2
2
  import { useFormContext } from "react-hook-form";
3
3
 
4
4
  import { FilterElement } from "./FilterElement";
@@ -30,7 +30,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
30
30
  <Typography variant="h6">Tìm kiếm</Typography>
31
31
  </AccordionSummary>
32
32
  <AccordionDetails>
33
- <Grid container spacing={1}>
33
+ <Grid2 container spacing={1}>
34
34
  {filters.map(({ field, size, ...rest }) => {
35
35
  if (rest.type === "date-range") {
36
36
  let label = ["Từ ngày", "Đến ngày"];
@@ -39,7 +39,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
39
39
  label = field.label;
40
40
  }
41
41
  return (
42
- <Grid key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
42
+ <Grid2 key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
43
43
  <DateRangePicker
44
44
  label={label}
45
45
  onChange={(value) => {
@@ -59,7 +59,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
59
59
 
60
60
  if (rest.type === "slider-range") {
61
61
  return (
62
- <Grid key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
62
+ <Grid2 key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
63
63
  <Slider
64
64
  onChange={(e, value) => {
65
65
  setDataSearch({
@@ -80,7 +80,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
80
80
  );
81
81
  }
82
82
  return (
83
- <Grid key={field} md={size?.md} xs={size?.xs} sm={size?.sm}>
83
+ <Grid2 key={field} md={size?.md} xs={size?.xs} sm={size?.sm}>
84
84
  <FilterElement name={field} {...rest} setPage={setPage} />
85
85
  </Grid>
86
86
  );
@@ -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.2",
3
+ "version": "2.8.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"