trithuc-mvc-react 1.7.3 → 1.7.5

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,17 +1,23 @@
1
- import {
2
- Autocomplete, FormControl, InputAdornment,
3
- InputLabel,
4
- MenuItem,
5
- OutlinedInput,
6
- Select, TextField
7
- } from "@mui/material";
1
+ import { Autocomplete, FormControl, InputAdornment, InputLabel, MenuItem, OutlinedInput, Select, TextField } from "@mui/material";
8
2
  import { useCallback } from "react";
9
3
  import { SearchOutlined } from "@mui/icons-material";
10
4
  import { useController, useFormContext } from "react-hook-form";
11
5
  import { debounce } from "lodash";
12
6
  import { useDataTable } from "./hooks";
13
7
 
14
- export function FilterElement({ name, type, label, keyValue, keyLabel, childrenFields, datas, loading = false, onChange = () => { }, size= "small" }) {
8
+
9
+ export function FilterElement({
10
+ name,
11
+ type,
12
+ label,
13
+ keyValue,
14
+ keyLabel,
15
+ childrenFields,
16
+ datas,
17
+ loading = false,
18
+ onChange = () => {},
19
+ size = "small"
20
+ }) {
15
21
  const { control, setValue } = useFormContext();
16
22
 
17
23
  const {
@@ -71,7 +77,8 @@ export function FilterElement({ name, type, label, keyValue, keyLabel, childrenF
71
77
  }}
72
78
  value={value || null}
73
79
  getOptionLabel={(option) => option?.[keyLabel]}
74
- renderInput={(params) => <TextField {...params} label={label} />} />
80
+ renderInput={(params) => <TextField {...params} label={label} />}
81
+ />
75
82
  );
76
83
 
77
84
  case "select":
@@ -80,13 +87,11 @@ export function FilterElement({ name, type, label, keyValue, keyLabel, childrenF
80
87
  <InputLabel shrink={true}>{label}</InputLabel>
81
88
  <Select
82
89
  {...rest}
83
- labelId="demo-simple-select-label"
84
- id="demo-simple-select"
85
90
  name={name}
86
91
  fullWidth
87
92
  size={size}
88
93
  label={label}
89
- value={value ?? ""}
94
+ value={value}
90
95
  displayEmpty
91
96
  onChange={(e) => {
92
97
  onFieldChange(e);
@@ -170,7 +170,7 @@ function FormField({
170
170
  render={({ field }) => {
171
171
  return (
172
172
  <FormControl fullWidth size={size}>
173
- <FormLabel>{label}</FormLabel>
173
+ {/* <FormLabel>{label}</FormLabel> */}
174
174
  <RadioGroup row {...field}>
175
175
  {[...datas].map(({ label, value }) => (
176
176
  <FormControlLabel key={value} value={value} control={<Radio />} label={label} />
@@ -2,5 +2,6 @@ import { useContext } from "react";
2
2
  import { DataTableContext } from "./context";
3
3
 
4
4
  export function useDataTable() {
5
- return useContext(DataTableContext);
5
+ const context = useContext(DataTableContext);
6
+ return context;
6
7
  }
@@ -130,6 +130,7 @@ function DataManagement({
130
130
 
131
131
  const methods = useForm({ defaultValues: {} });
132
132
  const { reset, setValue } = methods;
133
+
133
134
  return (
134
135
  <>
135
136
  <DataTableContext.Provider value={values}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -31,13 +31,15 @@
31
31
  "eslint": "^8.45.0",
32
32
  "eslint-plugin-react": "^7.32.2",
33
33
  "eslint-plugin-react-hooks": "^4.6.0",
34
- "eslint-plugin-react-refresh": "^0.4.3"
34
+ "eslint-plugin-react-refresh": "^0.4.3",
35
+ "react": "^18.2.0",
36
+ "react-dom": "^18.2.0"
35
37
  },
36
38
  "peerDependencies": {
37
39
  "@mui/icons-material": "^5.14.1",
38
40
  "@mui/material": "^5.14.1",
39
- "react": "^18.2.0",
40
- "react-dom": "^18.2.0",
41
+ "react": ">=16",
42
+ "react-dom": ">=16",
41
43
  "react-query": "^3.39.3",
42
44
  "react-toastify": "^9.1.3",
43
45
  "material-ui-confirm": "^3.0.9",