rez-table-listing-mui 1.3.18 → 1.3.20
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.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/listing/components/filter/components/forms/components/Dropdown.tsx +133 -0
- package/src/listing/components/filter/components/forms/index.tsx +538 -66
- package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +123 -0
- package/src/listing/components/login/index.tsx +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { FormControl } from "@mui/material";
|
|
2
|
+
import { FilterStateProps } from "../../../../../types/filter";
|
|
3
|
+
import FormTextfield from "../components/Textfield";
|
|
4
|
+
import FormDatePicker from "../components/Date";
|
|
5
|
+
import FormMultiSelect from "../components/Multi-Select";
|
|
6
|
+
|
|
7
|
+
export type DateOperator =
|
|
8
|
+
| "equal"
|
|
9
|
+
| "before"
|
|
10
|
+
| "after"
|
|
11
|
+
| "between"
|
|
12
|
+
| "is"
|
|
13
|
+
| "today"
|
|
14
|
+
| "is_before"
|
|
15
|
+
| "is_after"
|
|
16
|
+
| "is_on_or_before"
|
|
17
|
+
| "is_on_or_after"
|
|
18
|
+
| "empty"
|
|
19
|
+
| "not_empty";
|
|
20
|
+
|
|
21
|
+
export const DATE_ALLOWED_OPERATORS: DateOperator[] = [
|
|
22
|
+
"equal",
|
|
23
|
+
"before",
|
|
24
|
+
"after",
|
|
25
|
+
"between",
|
|
26
|
+
"is",
|
|
27
|
+
"today",
|
|
28
|
+
"is_before",
|
|
29
|
+
"is_after",
|
|
30
|
+
"is_on_or_before",
|
|
31
|
+
"is_on_or_after",
|
|
32
|
+
"empty",
|
|
33
|
+
"not_empty",
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export const resolveFilterInput = ({
|
|
37
|
+
filter,
|
|
38
|
+
operator,
|
|
39
|
+
control,
|
|
40
|
+
dropdownData,
|
|
41
|
+
updateFiltersFromForm,
|
|
42
|
+
}: {
|
|
43
|
+
filter: FilterStateProps;
|
|
44
|
+
operator: string | undefined;
|
|
45
|
+
control: any;
|
|
46
|
+
dropdownData: any;
|
|
47
|
+
updateFiltersFromForm: () => void;
|
|
48
|
+
}) => {
|
|
49
|
+
const isDateType = filter.filter_attribute_data_type === "date";
|
|
50
|
+
|
|
51
|
+
const showDatePicker =
|
|
52
|
+
isDateType && operator && DATE_ALLOWED_OPERATORS.includes(operator as any);
|
|
53
|
+
|
|
54
|
+
const showTextInsteadOfDate =
|
|
55
|
+
isDateType &&
|
|
56
|
+
(!operator || !DATE_ALLOWED_OPERATORS.includes(operator as any));
|
|
57
|
+
|
|
58
|
+
// TEXT / NUMBER -> Always TextField
|
|
59
|
+
if (
|
|
60
|
+
filter?.filter_attribute_data_type === "text" ||
|
|
61
|
+
filter?.filter_attribute_data_type === "number"
|
|
62
|
+
) {
|
|
63
|
+
return (
|
|
64
|
+
<FormTextfield
|
|
65
|
+
filter={filter}
|
|
66
|
+
control={control}
|
|
67
|
+
onValueChange={updateFiltersFromForm}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// YEAR
|
|
73
|
+
if (filter?.filter_attribute_data_type === "year") {
|
|
74
|
+
return (
|
|
75
|
+
<FormDatePicker
|
|
76
|
+
filter={filter}
|
|
77
|
+
control={control}
|
|
78
|
+
views={["year"]}
|
|
79
|
+
onValueChange={updateFiltersFromForm}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// DATE LOGIC
|
|
85
|
+
if (showDatePicker) {
|
|
86
|
+
return (
|
|
87
|
+
<FormDatePicker
|
|
88
|
+
filter={filter}
|
|
89
|
+
control={control}
|
|
90
|
+
onValueChange={updateFiltersFromForm}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (showTextInsteadOfDate) {
|
|
96
|
+
return (
|
|
97
|
+
<FormTextfield
|
|
98
|
+
filter={filter}
|
|
99
|
+
control={control}
|
|
100
|
+
onValueChange={updateFiltersFromForm}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// MULTISELECT / SELECT / RADIO / CHECKBOX
|
|
106
|
+
if (
|
|
107
|
+
filter?.filter_attribute_data_type !== undefined &&
|
|
108
|
+
["select", "multiselect", "radio", "checkbox"].includes(
|
|
109
|
+
filter?.filter_attribute_data_type
|
|
110
|
+
)
|
|
111
|
+
) {
|
|
112
|
+
return (
|
|
113
|
+
<FormMultiSelect
|
|
114
|
+
filter={filter}
|
|
115
|
+
control={control}
|
|
116
|
+
dropdownData={dropdownData}
|
|
117
|
+
onValueChange={updateFiltersFromForm}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return <FormControl fullWidth size="small" />;
|
|
123
|
+
};
|
|
@@ -8,7 +8,7 @@ const LoginButton = () => {
|
|
|
8
8
|
const handleLogin = async () => {
|
|
9
9
|
setLoading(true);
|
|
10
10
|
const api_url = "https://api.eth-qa.rezolut.in/api/admin/auth";
|
|
11
|
-
const email_id = "
|
|
11
|
+
const email_id = "kartik.shetty@rezolut.in";
|
|
12
12
|
const email_otp = "123456";
|
|
13
13
|
const sub_domain = "nair";
|
|
14
14
|
|