rez-table-listing-mui 1.0.48 → 1.0.50
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.
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/App.tsx +81 -24
- package/src/assets/svg.tsx +5 -5
- package/src/components/filter/components/attributes-filter.tsx +78 -52
- package/src/components/filter/components/forms/components/Date.tsx +178 -109
- package/src/components/filter/components/forms/components/Dropdown.tsx +36 -3
- package/src/components/filter/components/forms/components/Filter-criteria.tsx +3 -3
- package/src/components/filter/components/forms/components/Multi-Select.tsx +62 -34
- package/src/components/filter/components/forms/index.tsx +29 -7
- package/src/components/filter/components/main-filter.tsx +3 -0
- package/src/components/filter/components/saved-edit-filter.tsx +6 -0
- package/src/components/filter/components/saved-filter.tsx +66 -9
- package/src/components/filter/components/search/index.tsx +18 -1
- package/src/components/filter/index.tsx +21 -6
- package/src/components/filter/style.ts +1 -1
- package/src/components/index.scss +1 -1
- package/src/components/table-settings/common/info-alert.tsx +37 -0
- package/src/components/table-settings/common/listing-values.tsx +102 -54
- package/src/components/table-settings/components/column.tsx +206 -173
- package/src/components/table-settings/components/quick-tab.tsx +281 -153
- package/src/components/table-settings/components/sorting.tsx +135 -120
- package/src/components/table-settings/components/toggle-button-switch.tsx +2 -2
- package/src/components/table-settings/index.tsx +3 -5
- package/src/components/table-settings/style.ts +1 -0
- package/src/components/topbar/index.tsx +3 -1
- package/src/libs/hooks/useCraftTable.tsx +5 -0
- package/src/libs/hooks/useElementWidth.tsx +2 -2
- package/src/libs/hooks/useEntityTableAPI.tsx +1 -16
- package/src/libs/utils/apiColumn.ts +1 -11
- package/src/libs/utils/common.ts +4 -3
- package/src/types/filter-settings.ts +11 -0
- package/src/types/filter.ts +1 -2
- package/src/types/table-options.ts +2 -0
|
@@ -4,7 +4,7 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
|
4
4
|
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
|
|
5
5
|
import moment from "moment";
|
|
6
6
|
import { UpdatedFilterStateProps } from "../../../../../types/filter";
|
|
7
|
-
import { SxProps, Theme } from "@mui/material";
|
|
7
|
+
import { SxProps, Theme, Box } from "@mui/material";
|
|
8
8
|
|
|
9
9
|
type FormDatePickerProps = {
|
|
10
10
|
filter: UpdatedFilterStateProps;
|
|
@@ -18,121 +18,190 @@ const FormDatePicker = ({
|
|
|
18
18
|
filter,
|
|
19
19
|
control,
|
|
20
20
|
sx,
|
|
21
|
-
views = ["day", "month", "year"],
|
|
21
|
+
views = ["day", "month", "year"],
|
|
22
22
|
onValueChange,
|
|
23
23
|
}: FormDatePickerProps) => {
|
|
24
|
+
const isRange = filter.filter_operator === "between";
|
|
25
|
+
const isRelativeToToday = filter.filter_operator === "today";
|
|
26
|
+
|
|
24
27
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
|
29
|
+
<Box display="flex" gap={1}>
|
|
30
|
+
<Controller
|
|
31
|
+
name={`${filter?.name}.value`}
|
|
32
|
+
control={control}
|
|
33
|
+
defaultValue={
|
|
34
|
+
isRange
|
|
35
|
+
? ["", ""]
|
|
36
|
+
: isRelativeToToday
|
|
37
|
+
? moment().format("YYYY-MM-DD")
|
|
38
|
+
: filter.filter_value
|
|
39
|
+
? moment(filter.filter_value, "YYYY-MM-DD").toDate()
|
|
40
|
+
: null
|
|
41
|
+
}
|
|
42
|
+
render={({ field }) => {
|
|
43
|
+
const value = field.value;
|
|
44
|
+
const todayDate = moment().toDate();
|
|
45
|
+
if (isRange) {
|
|
46
|
+
const fromDate = Array.isArray(value) ? value[0] : "";
|
|
47
|
+
const toDate = Array.isArray(value) ? value[1] : "";
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<DatePicker
|
|
52
|
+
views={views}
|
|
53
|
+
value={
|
|
54
|
+
isRelativeToToday
|
|
55
|
+
? todayDate
|
|
56
|
+
: fromDate
|
|
57
|
+
? moment(fromDate, "YYYY-MM-DD").toDate()
|
|
58
|
+
: null
|
|
59
|
+
}
|
|
60
|
+
onChange={(date) => {
|
|
61
|
+
if (isRelativeToToday) return;
|
|
62
|
+
let formatted = "";
|
|
63
|
+
if (date) {
|
|
64
|
+
formatted =
|
|
65
|
+
views?.length === 1 && views[0] === "year"
|
|
66
|
+
? moment(date).format("YYYY")
|
|
67
|
+
: moment(date).format("YYYY-MM-DD");
|
|
68
|
+
}
|
|
69
|
+
const updated: [string, string] = [
|
|
70
|
+
formatted,
|
|
71
|
+
toDate || "",
|
|
72
|
+
];
|
|
73
|
+
field.onChange(updated);
|
|
74
|
+
onValueChange?.();
|
|
75
|
+
}}
|
|
76
|
+
disabled={isRelativeToToday}
|
|
77
|
+
format={
|
|
78
|
+
views?.length === 1 && views[0] === "year"
|
|
79
|
+
? "yyyy"
|
|
80
|
+
: "dd-MM-yyyy"
|
|
81
|
+
}
|
|
82
|
+
sx={{
|
|
83
|
+
"& .MuiOutlinedInput-input": {
|
|
84
|
+
padding: "12px 20px",
|
|
85
|
+
},
|
|
86
|
+
...sx,
|
|
87
|
+
}}
|
|
88
|
+
slotProps={{
|
|
89
|
+
textField: {
|
|
90
|
+
size: "small",
|
|
91
|
+
fullWidth: true,
|
|
92
|
+
placeholder:
|
|
93
|
+
views?.length === 1 && views[0] === "year"
|
|
94
|
+
? "YYYY"
|
|
95
|
+
: "From Date",
|
|
96
|
+
},
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<DatePicker
|
|
101
|
+
views={views}
|
|
102
|
+
value={
|
|
103
|
+
isRelativeToToday
|
|
104
|
+
? todayDate
|
|
105
|
+
: toDate
|
|
106
|
+
? moment(toDate, "YYYY-MM-DD").toDate()
|
|
107
|
+
: null
|
|
108
|
+
}
|
|
109
|
+
onChange={(date) => {
|
|
110
|
+
if (isRelativeToToday) return;
|
|
111
|
+
let formatted = "";
|
|
112
|
+
if (date) {
|
|
113
|
+
formatted =
|
|
114
|
+
views?.length === 1 && views[0] === "year"
|
|
115
|
+
? moment(date).format("YYYY")
|
|
116
|
+
: moment(date).format("YYYY-MM-DD");
|
|
117
|
+
}
|
|
118
|
+
const updated: [string, string] = [
|
|
119
|
+
fromDate || "",
|
|
120
|
+
formatted,
|
|
121
|
+
];
|
|
122
|
+
field.onChange(updated);
|
|
123
|
+
onValueChange?.();
|
|
124
|
+
}}
|
|
125
|
+
disabled={isRelativeToToday}
|
|
126
|
+
format={
|
|
127
|
+
views?.length === 1 && views[0] === "year"
|
|
128
|
+
? "yyyy"
|
|
129
|
+
: "dd-MM-yyyy"
|
|
130
|
+
}
|
|
131
|
+
sx={{
|
|
132
|
+
"& .MuiOutlinedInput-input": {
|
|
133
|
+
padding: "12px 20px",
|
|
134
|
+
},
|
|
135
|
+
...sx,
|
|
136
|
+
}}
|
|
137
|
+
slotProps={{
|
|
138
|
+
textField: {
|
|
139
|
+
size: "small",
|
|
140
|
+
fullWidth: true,
|
|
141
|
+
placeholder:
|
|
142
|
+
views?.length === 1 && views[0] === "year"
|
|
143
|
+
? "YYYY"
|
|
144
|
+
: "To Date",
|
|
145
|
+
},
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
40
150
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
151
|
+
|
|
152
|
+
// Single DatePicker
|
|
153
|
+
return (
|
|
154
|
+
<DatePicker
|
|
155
|
+
{...field}
|
|
156
|
+
views={views}
|
|
157
|
+
value={
|
|
158
|
+
isRelativeToToday
|
|
159
|
+
? todayDate
|
|
160
|
+
: field.value
|
|
161
|
+
? moment(field.value, "YYYY-MM-DD").toDate()
|
|
162
|
+
: null
|
|
48
163
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
textField: {
|
|
64
|
-
size: "small",
|
|
65
|
-
fullWidth: true,
|
|
66
|
-
placeholder:
|
|
164
|
+
onChange={(date) => {
|
|
165
|
+
if (isRelativeToToday) return;
|
|
166
|
+
let formatted = "";
|
|
167
|
+
if (date) {
|
|
168
|
+
formatted =
|
|
169
|
+
views?.length === 1 && views[0] === "year"
|
|
170
|
+
? moment(date).format("YYYY")
|
|
171
|
+
: moment(date).format("YYYY-MM-DD");
|
|
172
|
+
}
|
|
173
|
+
field.onChange(formatted);
|
|
174
|
+
onValueChange?.();
|
|
175
|
+
}}
|
|
176
|
+
disabled={isRelativeToToday}
|
|
177
|
+
format={
|
|
67
178
|
views?.length === 1 && views[0] === "year"
|
|
68
|
-
? "
|
|
69
|
-
: "
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
179
|
+
? "yyyy"
|
|
180
|
+
: "dd-MM-yyyy"
|
|
181
|
+
}
|
|
182
|
+
sx={{
|
|
183
|
+
"& .MuiOutlinedInput-input": {
|
|
184
|
+
padding: "12px 20px",
|
|
185
|
+
},
|
|
186
|
+
...sx,
|
|
187
|
+
}}
|
|
188
|
+
slotProps={{
|
|
189
|
+
textField: {
|
|
190
|
+
size: "small",
|
|
191
|
+
fullWidth: true,
|
|
192
|
+
placeholder:
|
|
193
|
+
views?.length === 1 && views[0] === "year"
|
|
194
|
+
? "YYYY"
|
|
195
|
+
: "DD-MM-YYYY",
|
|
196
|
+
},
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
</Box>
|
|
203
|
+
</LocalizationProvider>
|
|
76
204
|
);
|
|
77
205
|
};
|
|
78
206
|
|
|
79
207
|
export default FormDatePicker;
|
|
80
|
-
|
|
81
|
-
// import { Controller } from "react-hook-form";
|
|
82
|
-
// import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
83
|
-
// import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
84
|
-
// import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
|
|
85
|
-
// import moment from "moment";
|
|
86
|
-
// import { UpdatedFilterStateProps } from "../../../../../types/filter";
|
|
87
|
-
// import { SxProps, Theme } from "@mui/material";
|
|
88
|
-
|
|
89
|
-
// const FormDatePicker = ({
|
|
90
|
-
// filter,
|
|
91
|
-
// control,
|
|
92
|
-
// sx,
|
|
93
|
-
// }: {
|
|
94
|
-
// filter: UpdatedFilterStateProps;
|
|
95
|
-
// control: any;
|
|
96
|
-
// sx?: SxProps<Theme>;
|
|
97
|
-
// }) => {
|
|
98
|
-
// return (
|
|
99
|
-
// <Controller
|
|
100
|
-
// name={`${filter?.name}.value`} // or use a consistent structure like `filters.${index}.filter_value`
|
|
101
|
-
// control={control}
|
|
102
|
-
// defaultValue={
|
|
103
|
-
// filter.filter_value
|
|
104
|
-
// ? moment(filter.filter_value, "DD-MM-YYYY").toDate()
|
|
105
|
-
// : null
|
|
106
|
-
// }
|
|
107
|
-
// render={({ field }) => (
|
|
108
|
-
// <LocalizationProvider dateAdapter={AdapterDateFns}>
|
|
109
|
-
// <DatePicker
|
|
110
|
-
// sx={{
|
|
111
|
-
// "& .MuiOutlinedInput-input": {
|
|
112
|
-
// padding: "12px 20px",
|
|
113
|
-
// },
|
|
114
|
-
// }}
|
|
115
|
-
// {...field}
|
|
116
|
-
// value={
|
|
117
|
-
// field.value ? moment(field.value, "DD-MM-YYYY").toDate() : null
|
|
118
|
-
// }
|
|
119
|
-
// onChange={(date) => {
|
|
120
|
-
// const formatted = date ? moment(date).format("DD-MM-YYYY") : "";
|
|
121
|
-
// field.onChange(formatted);
|
|
122
|
-
// }}
|
|
123
|
-
// format="dd-MM-yyyy"
|
|
124
|
-
// slotProps={{
|
|
125
|
-
// textField: {
|
|
126
|
-
// size: "small",
|
|
127
|
-
// fullWidth: true,
|
|
128
|
-
// placeholder: "DD-MM-YYYY",
|
|
129
|
-
// },
|
|
130
|
-
// }}
|
|
131
|
-
// />
|
|
132
|
-
// </LocalizationProvider>
|
|
133
|
-
// )}
|
|
134
|
-
// />
|
|
135
|
-
// );
|
|
136
|
-
// };
|
|
137
|
-
|
|
138
|
-
// export default FormDatePicker;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FormControl, MenuItem, Select, SxProps, Theme } from "@mui/material";
|
|
2
|
-
import { Controller } from "react-hook-form";
|
|
2
|
+
import { Controller, UseFormSetValue } from "react-hook-form";
|
|
3
3
|
import { UpdatedFilterStateProps } from "../../../../../types/filter";
|
|
4
|
+
import moment from "moment";
|
|
4
5
|
|
|
5
6
|
interface FormDropdownProps {
|
|
6
7
|
filter: UpdatedFilterStateProps;
|
|
7
8
|
control: any;
|
|
9
|
+
setValue: UseFormSetValue<any>;
|
|
8
10
|
dropdownList: {
|
|
9
11
|
label?: string;
|
|
10
12
|
value?: string;
|
|
@@ -17,6 +19,7 @@ interface FormDropdownProps {
|
|
|
17
19
|
const FormDropdown = ({
|
|
18
20
|
filter,
|
|
19
21
|
control,
|
|
22
|
+
setValue,
|
|
20
23
|
dropdownList,
|
|
21
24
|
isLoading = false,
|
|
22
25
|
sx,
|
|
@@ -48,8 +51,38 @@ const FormDropdown = ({
|
|
|
48
51
|
disabled={isLoading}
|
|
49
52
|
disableUnderline
|
|
50
53
|
onChange={(e) => {
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const newOperator = e.target.value;
|
|
55
|
+
const oldOperator = field.value;
|
|
56
|
+
|
|
57
|
+
field.onChange(e);
|
|
58
|
+
|
|
59
|
+
if (
|
|
60
|
+
(filter.data_type === "date" || filter.data_type === "year") &&
|
|
61
|
+
newOperator !== oldOperator
|
|
62
|
+
) {
|
|
63
|
+
if (newOperator === "today") {
|
|
64
|
+
setValue(
|
|
65
|
+
`${filter.name}.value`,
|
|
66
|
+
moment().format("YYYY-MM-DD"),
|
|
67
|
+
{
|
|
68
|
+
shouldDirty: true,
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
} else if (newOperator === "between") {
|
|
72
|
+
setValue(`${filter.name}.value`, ["", ""], {
|
|
73
|
+
shouldDirty: true,
|
|
74
|
+
});
|
|
75
|
+
} else if (
|
|
76
|
+
oldOperator === "between" ||
|
|
77
|
+
oldOperator === "today"
|
|
78
|
+
) {
|
|
79
|
+
setValue(`${filter.name}.value`, "", {
|
|
80
|
+
shouldDirty: true,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onValueChange?.();
|
|
53
86
|
}}
|
|
54
87
|
>
|
|
55
88
|
{dropdownList?.map((item, idx) => (
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Paper,
|
|
8
8
|
ListItemText,
|
|
9
9
|
} from "@mui/material";
|
|
10
|
-
import {
|
|
10
|
+
import { useRef } from "react";
|
|
11
11
|
import { AddIcon } from "../../../../../assets/svg";
|
|
12
12
|
import {
|
|
13
13
|
FilterColumnsDataProps,
|
|
@@ -45,8 +45,8 @@ const FilterCriteria = ({
|
|
|
45
45
|
},
|
|
46
46
|
}));
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const { filters, setFilters, showFilterOptions, setShowFilterOption } =
|
|
49
|
+
tableStates;
|
|
50
50
|
|
|
51
51
|
const filterButtonRef = useRef<HTMLButtonElement>(null);
|
|
52
52
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Controller } from "react-hook-form";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
Select,
|
|
5
|
+
MenuItem,
|
|
6
|
+
Theme,
|
|
7
|
+
SxProps,
|
|
8
|
+
Checkbox,
|
|
9
|
+
} from "@mui/material";
|
|
3
10
|
import { UpdatedFilterStateProps } from "../../../../../types/filter";
|
|
4
11
|
import { DropdownOption } from "../../../../../types/common";
|
|
5
12
|
|
|
@@ -22,39 +29,60 @@ const FormMultiSelect = ({
|
|
|
22
29
|
<Controller
|
|
23
30
|
name={`${filter?.name}.value`}
|
|
24
31
|
control={control}
|
|
25
|
-
defaultValue={
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
field
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
32
|
+
defaultValue={
|
|
33
|
+
Array.isArray(filter.filter_value)
|
|
34
|
+
? filter.filter_value.filter(Boolean)
|
|
35
|
+
: []
|
|
36
|
+
}
|
|
37
|
+
render={({ field }) => {
|
|
38
|
+
const cleanedValue = Array.isArray(field.value)
|
|
39
|
+
? field.value.filter(Boolean)
|
|
40
|
+
: [];
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<FormControl sx={sx} fullWidth size="small">
|
|
44
|
+
<Select
|
|
45
|
+
{...field}
|
|
46
|
+
sx={{
|
|
47
|
+
"& .MuiOutlinedInput-input": {
|
|
48
|
+
padding: "12px 20px",
|
|
49
|
+
},
|
|
50
|
+
}}
|
|
51
|
+
multiple
|
|
52
|
+
value={cleanedValue}
|
|
53
|
+
onChange={(e) => {
|
|
54
|
+
const value = e.target.value;
|
|
55
|
+
const filtered = Array.isArray(value)
|
|
56
|
+
? value.filter(Boolean)
|
|
57
|
+
: [];
|
|
58
|
+
field.onChange(filtered);
|
|
59
|
+
onValueChange?.();
|
|
60
|
+
}}
|
|
61
|
+
renderValue={(selected) => {
|
|
62
|
+
const filtered = Array.isArray(selected)
|
|
63
|
+
? selected.filter(Boolean)
|
|
64
|
+
: [];
|
|
65
|
+
return filtered
|
|
66
|
+
.map(
|
|
67
|
+
(val) =>
|
|
68
|
+
options.find((item) => item.value === val)?.label || val
|
|
69
|
+
)
|
|
70
|
+
.join(", ");
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{options.map((item, idx) => (
|
|
74
|
+
<MenuItem key={idx} value={item.value}>
|
|
75
|
+
<Checkbox
|
|
76
|
+
checked={cleanedValue.includes(item.value)}
|
|
77
|
+
sx={{ marginRight: 1 }}
|
|
78
|
+
/>
|
|
79
|
+
{item.label}
|
|
80
|
+
</MenuItem>
|
|
81
|
+
))}
|
|
82
|
+
</Select>
|
|
83
|
+
</FormControl>
|
|
84
|
+
);
|
|
85
|
+
}}
|
|
58
86
|
/>
|
|
59
87
|
);
|
|
60
88
|
};
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import { Controller, useForm } from "react-hook-form";
|
|
17
17
|
import FormTextfield from "./components/Textfield";
|
|
18
18
|
import React, { useEffect, useMemo, useCallback } from "react";
|
|
19
|
-
import FormSelect from "./components/Select";
|
|
20
19
|
import FormDatePicker from "./components/Date";
|
|
21
20
|
import FormDropdown from "./components/Dropdown";
|
|
22
21
|
import FormMultiSelect from "./components/Multi-Select";
|
|
@@ -41,6 +40,8 @@ const FilterForm = ({
|
|
|
41
40
|
dropdownData,
|
|
42
41
|
searchTerm = "",
|
|
43
42
|
setSearchTerm,
|
|
43
|
+
criteriaSearchTerm = "",
|
|
44
|
+
setCriteriaSearchTerm,
|
|
44
45
|
selectedFilters,
|
|
45
46
|
setSelectedFilters,
|
|
46
47
|
handleRemoveFilter,
|
|
@@ -53,6 +54,8 @@ const FilterForm = ({
|
|
|
53
54
|
dropdownData: FilterDropdownDataProps;
|
|
54
55
|
searchTerm?: string;
|
|
55
56
|
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
57
|
+
criteriaSearchTerm?: string;
|
|
58
|
+
setCriteriaSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
56
59
|
selectedFilters: UpdatedFilterStateProps[];
|
|
57
60
|
setSelectedFilters: React.Dispatch<
|
|
58
61
|
React.SetStateAction<UpdatedFilterStateProps[]>
|
|
@@ -91,7 +94,7 @@ const FilterForm = ({
|
|
|
91
94
|
control,
|
|
92
95
|
watch,
|
|
93
96
|
reset,
|
|
94
|
-
formState: { isDirty },
|
|
97
|
+
// formState: { isDirty },
|
|
95
98
|
setValue,
|
|
96
99
|
unregister,
|
|
97
100
|
} = useForm<FormValues & { dummyChange: string }>({
|
|
@@ -231,15 +234,18 @@ const FilterForm = ({
|
|
|
231
234
|
columnsData={columnsData}
|
|
232
235
|
tableStates={tableStates}
|
|
233
236
|
setSelectedFilters={setSelectedFilters}
|
|
234
|
-
searchTerm={
|
|
235
|
-
setSearchTerm={
|
|
237
|
+
searchTerm={criteriaSearchTerm}
|
|
238
|
+
setSearchTerm={setCriteriaSearchTerm}
|
|
236
239
|
/>
|
|
237
240
|
|
|
238
241
|
{!editMode && (
|
|
239
242
|
<CustomSearch value={searchTerm} onChange={setSearchTerm} />
|
|
240
243
|
)}
|
|
241
244
|
|
|
242
|
-
<Box
|
|
245
|
+
<Box
|
|
246
|
+
className="filter-form-inputs"
|
|
247
|
+
sx={filterFormStyles.formFlexContainer}
|
|
248
|
+
>
|
|
243
249
|
{selectedFilters
|
|
244
250
|
.filter(
|
|
245
251
|
(filter) =>
|
|
@@ -251,6 +257,7 @@ const FilterForm = ({
|
|
|
251
257
|
.toLowerCase()
|
|
252
258
|
.includes(searchTerm.toLowerCase())
|
|
253
259
|
)
|
|
260
|
+
.reverse()
|
|
254
261
|
.map((filter) => {
|
|
255
262
|
const { dropdown_list = [] } = filter;
|
|
256
263
|
return (
|
|
@@ -265,6 +272,7 @@ const FilterForm = ({
|
|
|
265
272
|
<FormDropdown
|
|
266
273
|
filter={filter}
|
|
267
274
|
control={control}
|
|
275
|
+
setValue={setValue}
|
|
268
276
|
dropdownList={dropdown_list}
|
|
269
277
|
sx={filterFormStyles.formListItemHeaderDropdown}
|
|
270
278
|
onValueChange={updateFiltersFromForm}
|
|
@@ -315,7 +323,7 @@ const FilterForm = ({
|
|
|
315
323
|
onValueChange={updateFiltersFromForm}
|
|
316
324
|
/>
|
|
317
325
|
) : filter.data_type === "select" ? (
|
|
318
|
-
<
|
|
326
|
+
<FormMultiSelect
|
|
319
327
|
filter={filter}
|
|
320
328
|
control={control}
|
|
321
329
|
dropdownData={dropdownData}
|
|
@@ -328,6 +336,20 @@ const FilterForm = ({
|
|
|
328
336
|
dropdownData={dropdownData}
|
|
329
337
|
onValueChange={updateFiltersFromForm}
|
|
330
338
|
/>
|
|
339
|
+
) : filter.data_type === "radio" ? (
|
|
340
|
+
<FormMultiSelect
|
|
341
|
+
filter={filter}
|
|
342
|
+
control={control}
|
|
343
|
+
dropdownData={dropdownData}
|
|
344
|
+
onValueChange={updateFiltersFromForm}
|
|
345
|
+
/>
|
|
346
|
+
) : filter.data_type === "checkbox" ? (
|
|
347
|
+
<FormMultiSelect
|
|
348
|
+
filter={filter}
|
|
349
|
+
control={control}
|
|
350
|
+
dropdownData={dropdownData}
|
|
351
|
+
onValueChange={updateFiltersFromForm}
|
|
352
|
+
/>
|
|
331
353
|
) : (
|
|
332
354
|
<FormControl fullWidth size="small" />
|
|
333
355
|
)}
|
|
@@ -362,7 +384,7 @@ const FilterForm = ({
|
|
|
362
384
|
<Button
|
|
363
385
|
variant="contained"
|
|
364
386
|
fullWidth
|
|
365
|
-
disabled={!isDirty && editMode}
|
|
387
|
+
// disabled={!isDirty && editMode}
|
|
366
388
|
sx={{
|
|
367
389
|
color: "white",
|
|
368
390
|
backgroundColor: "#7A5AF8",
|
|
@@ -16,6 +16,7 @@ const MainFilter = ({
|
|
|
16
16
|
setSavedFilterModalOpen,
|
|
17
17
|
}: FilterFormComponentProps) => {
|
|
18
18
|
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
19
|
+
const [criteriaSearchTerm, setCriteriaSearchTerm] = useState<string>("");
|
|
19
20
|
|
|
20
21
|
const { setFilters, setFilterMaster } = tableStates;
|
|
21
22
|
|
|
@@ -52,6 +53,8 @@ const MainFilter = ({
|
|
|
52
53
|
columnsData={columnsData}
|
|
53
54
|
searchTerm={searchTerm}
|
|
54
55
|
setSearchTerm={setSearchTerm}
|
|
56
|
+
criteriaSearchTerm={criteriaSearchTerm}
|
|
57
|
+
setCriteriaSearchTerm={setCriteriaSearchTerm}
|
|
55
58
|
selectedFilters={selectedFilters}
|
|
56
59
|
setSelectedFilters={setSelectedFilters}
|
|
57
60
|
handleRemoveFilter={handleRemoveFilter}
|
|
@@ -19,6 +19,8 @@ const SavedFilterEditComponent = ({
|
|
|
19
19
|
setEditMode,
|
|
20
20
|
searchTerm,
|
|
21
21
|
setSearchTerm,
|
|
22
|
+
criteriaSearchTerm,
|
|
23
|
+
setCriteriaSearchTerm,
|
|
22
24
|
setSavedFilterModalOpen,
|
|
23
25
|
setDeleteFilterModalOpen,
|
|
24
26
|
}: {
|
|
@@ -33,6 +35,8 @@ const SavedFilterEditComponent = ({
|
|
|
33
35
|
setEditMode?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
36
|
searchTerm?: string;
|
|
35
37
|
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
38
|
+
criteriaSearchTerm?: string;
|
|
39
|
+
setCriteriaSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
36
40
|
setSavedFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
37
41
|
setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
38
42
|
}) => {
|
|
@@ -95,6 +99,8 @@ const SavedFilterEditComponent = ({
|
|
|
95
99
|
dropdownData={dropdownData}
|
|
96
100
|
searchTerm={searchTerm}
|
|
97
101
|
setSearchTerm={setSearchTerm}
|
|
102
|
+
criteriaSearchTerm={criteriaSearchTerm}
|
|
103
|
+
setCriteriaSearchTerm={setCriteriaSearchTerm}
|
|
98
104
|
setSavedFilterModalOpen={setSavedFilterModalOpen}
|
|
99
105
|
setDeleteFilterModalOpen={setDeleteFilterModalOpen}
|
|
100
106
|
/>
|