trithuc-mvc-react 1.8.11 → 1.9.2

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.
@@ -134,7 +134,8 @@ function EditorForm({ fields, submitRef }) {
134
134
  keyValue,
135
135
  keyValueLabel,
136
136
  required,
137
- disabled = false
137
+ disabled = false,
138
+ ...rest
138
139
  }) => {
139
140
  return (
140
141
  <Grid item md={size?.md} xs={size?.xs} sm={size?.sm} key={field}>
@@ -153,6 +154,7 @@ function EditorForm({ fields, submitRef }) {
153
154
  size={elementSize}
154
155
  required={required}
155
156
  disabled={disabled}
157
+ {...rest}
156
158
  />
157
159
  </Grid>
158
160
  );
@@ -16,13 +16,12 @@ 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";
19
- import { useCallback, useEffect, } from "react";
19
+ import { useCallback, useEffect } from "react";
20
20
  import moment from "moment/moment";
21
21
  import { DEFAULT_DATE_FORMAT } from "../../constants";
22
22
  import UploadMultipleFile from "./upload/UploadMultipleFile";
23
23
  import RhfUploadAvatar from "./upload/RhfUploadAvatar";
24
24
 
25
-
26
25
  FormField.propTypes = {
27
26
  datas: PropTypes.array,
28
27
  loading: PropTypes.bool
@@ -38,10 +37,11 @@ function FormField({
38
37
  keyLabel,
39
38
  keyValue,
40
39
  keyValueLabel,
41
- childrenFields,
40
+
42
41
  size,
43
42
  required = false,
44
- disabled = false
43
+ disabled = false,
44
+ ...rest
45
45
  }) {
46
46
  const { setValue, register } = useFormContext();
47
47
  const getValueObject = useCallback(
@@ -60,7 +60,6 @@ function FormField({
60
60
  }
61
61
  }, []);
62
62
 
63
-
64
63
  switch (type) {
65
64
  case "textarea":
66
65
  return (
@@ -134,7 +133,10 @@ function FormField({
134
133
  value={getValueObject(value)}
135
134
  fullWidth
136
135
  getOptionLabel={(option) => option[keyLabel]}
137
- renderInput={(params) => <TextField {...params} label={label} error={Boolean(error)} helperText={error?.message} />}
136
+ renderInput={(params) => (
137
+ <TextField {...params} label={label} error={Boolean(error)} helperText={error?.message} />
138
+ )}
139
+ {...rest}
138
140
  />
139
141
  );
140
142
  }}
@@ -187,7 +189,9 @@ function FormField({
187
189
  <Controller
188
190
  name={name}
189
191
  control={control}
190
- render={({ field }) => <FormControlLabel disabled={disabled} control={<Checkbox {...field} checked={field.value} />} label={label} />}
192
+ render={({ field }) => (
193
+ <FormControlLabel disabled={disabled} control={<Checkbox {...field} checked={field.value} />} label={label} />
194
+ )}
191
195
  />
192
196
 
193
197
  {/* {errors.terms && (
@@ -271,9 +275,7 @@ function FormField({
271
275
  />
272
276
  );
273
277
  case "file":
274
- return (
275
- <UploadMultipleFile name={name} label={label} disabled={disabled} />
276
- );
278
+ return <UploadMultipleFile name={name} label={label} disabled={disabled} />;
277
279
  case "avatar":
278
280
  return (
279
281
  <Controller
@@ -141,7 +141,7 @@ function DataManagement({
141
141
 
142
142
  const methods = useForm({ defaultValues: getDefaultValues(filters) });
143
143
  const { reset, setValue } = methods;
144
- console.log("filters", filters);
144
+
145
145
  return (
146
146
  <>
147
147
  <DataTableContext.Provider value={values}>
@@ -4,7 +4,7 @@ import { Controller, useFormContext } from "react-hook-form";
4
4
  import UploadMultiFile from "trithuc-mvc-react/components/DataManagement/upload/UploadMultiFile";
5
5
  import { useCallback, useState } from "react";
6
6
  import { saveFilesToServer } from "@/utils";
7
-
7
+ import { Typography } from '@mui/material';
8
8
  const UploadMultipleFile = ({ name, label, disabled }) => {
9
9
  const { control, getValues, setValue } = useFormContext();
10
10
  const [isLoadingUpfile, setIsLoadingUpfile] = useState(false);
@@ -34,7 +34,7 @@ const UploadMultipleFile = ({ name, label, disabled }) => {
34
34
  render={({ field, fieldState: { error } }) => {
35
35
  return (
36
36
  <>
37
-
37
+ <Typography variant="h5"> {label}</Typography>
38
38
  <UploadMultiFile
39
39
  disabled={disabled}
40
40
  maxSize={3145728}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "1.8.11",
3
+ "version": "1.9.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"