rez-table-listing-mui 1.3.32 → 1.3.34
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 +6 -0
- 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/common/saved-filter-modal/index.tsx +54 -16
- package/src/listing/components/filter/components/forms/components/Date.tsx +1 -1
- package/src/listing/components/filter/components/forms/components/Dropdown.tsx +2 -135
- package/src/listing/components/filter/components/forms/components/Textfield.tsx +4 -1
- package/src/listing/components/filter/components/forms/index.tsx +107 -59
- package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +24 -48
- package/src/listing/components/filter/components/saved-filter.tsx +742 -63
- package/src/listing/components/filter/index.tsx +7 -0
- package/src/listing/libs/utils/common.ts +1 -0
- package/src/listing/types/filter.ts +8 -0
- package/src/view/FIlterWrapper.tsx +5 -0
- package/src/view/ListingView.tsx +1 -1
|
@@ -4,37 +4,20 @@ import FormTextfield from "../components/Textfield";
|
|
|
4
4
|
import FormDatePicker from "../components/Date";
|
|
5
5
|
import FormMultiSelect from "../components/Multi-Select";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| "before"
|
|
10
|
-
| "after"
|
|
11
|
-
| "between"
|
|
12
|
-
| "is"
|
|
13
|
-
| "today"
|
|
14
|
-
| "is_day_before"
|
|
15
|
-
| "is_day_after"
|
|
16
|
-
| "is_month_before"
|
|
17
|
-
| "is_month_after"
|
|
18
|
-
| "is_before"
|
|
19
|
-
| "is_after"
|
|
20
|
-
| "is_on_or_before"
|
|
21
|
-
| "is_on_or_after";
|
|
22
|
-
|
|
23
|
-
export const DATE_ALLOWED_OPERATORS: DateOperator[] = [
|
|
7
|
+
// Operators that should show a Date Picker
|
|
8
|
+
const dateAllowedOperators = [
|
|
24
9
|
"equal",
|
|
25
10
|
"before",
|
|
26
11
|
"after",
|
|
27
12
|
"between",
|
|
28
13
|
"is",
|
|
29
14
|
"today",
|
|
30
|
-
"is_day_before",
|
|
31
|
-
"is_day_after",
|
|
32
|
-
"is_month_before",
|
|
33
|
-
"is_month_after",
|
|
34
15
|
"is_before",
|
|
35
16
|
"is_after",
|
|
36
17
|
"is_on_or_before",
|
|
37
18
|
"is_on_or_after",
|
|
19
|
+
"empty",
|
|
20
|
+
"not_empty",
|
|
38
21
|
];
|
|
39
22
|
|
|
40
23
|
export const resolveFilterInput = ({
|
|
@@ -50,20 +33,10 @@ export const resolveFilterInput = ({
|
|
|
50
33
|
dropdownData: any;
|
|
51
34
|
updateFiltersFromForm: () => void;
|
|
52
35
|
}) => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const showDatePicker =
|
|
56
|
-
isDateType && operator && DATE_ALLOWED_OPERATORS.includes(operator as any);
|
|
36
|
+
const dataType = filter?.filter_attribute_data_type;
|
|
57
37
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(!operator || !DATE_ALLOWED_OPERATORS.includes(operator as any));
|
|
61
|
-
|
|
62
|
-
// TEXT / NUMBER -> Always TextField
|
|
63
|
-
if (
|
|
64
|
-
filter?.filter_attribute_data_type === "text" ||
|
|
65
|
-
filter?.filter_attribute_data_type === "number"
|
|
66
|
-
) {
|
|
38
|
+
// TEXT / NUMBER → always textfield
|
|
39
|
+
if (dataType === "text" || dataType === "number") {
|
|
67
40
|
return (
|
|
68
41
|
<FormTextfield
|
|
69
42
|
filter={filter}
|
|
@@ -73,8 +46,8 @@ export const resolveFilterInput = ({
|
|
|
73
46
|
);
|
|
74
47
|
}
|
|
75
48
|
|
|
76
|
-
// YEAR
|
|
77
|
-
if (
|
|
49
|
+
// YEAR → DatePicker (Year mode)
|
|
50
|
+
if (dataType === "year") {
|
|
78
51
|
return (
|
|
79
52
|
<FormDatePicker
|
|
80
53
|
filter={filter}
|
|
@@ -85,18 +58,21 @@ export const resolveFilterInput = ({
|
|
|
85
58
|
);
|
|
86
59
|
}
|
|
87
60
|
|
|
88
|
-
// DATE
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
61
|
+
// DATE FIELD
|
|
62
|
+
if (dataType === "date") {
|
|
63
|
+
const showDatePicker = operator && dateAllowedOperators.includes(operator);
|
|
64
|
+
|
|
65
|
+
if (showDatePicker) {
|
|
66
|
+
// Date Picker
|
|
67
|
+
return (
|
|
68
|
+
<FormDatePicker
|
|
69
|
+
filter={filter}
|
|
70
|
+
control={control}
|
|
71
|
+
onValueChange={updateFiltersFromForm}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
98
75
|
|
|
99
|
-
if (showTextInsteadOfDate) {
|
|
100
76
|
return (
|
|
101
77
|
<FormTextfield
|
|
102
78
|
filter={filter}
|
|
@@ -106,7 +82,7 @@ export const resolveFilterInput = ({
|
|
|
106
82
|
);
|
|
107
83
|
}
|
|
108
84
|
|
|
109
|
-
//
|
|
85
|
+
// SELECT / MULTISELECT / RADIO / CHECKBOX
|
|
110
86
|
if (
|
|
111
87
|
filter?.filter_attribute_data_type !== undefined &&
|
|
112
88
|
["select", "multiselect", "radio", "checkbox"].includes(
|