@codezee/sixtify-brahma 0.2.29 → 0.2.31
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/package.json +1 -1
- package/packages/shared-components/dist/Actions/AddAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/AddAction.js +2 -1
- package/packages/shared-components/dist/Actions/CalendarAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/CalendarAction.js +2 -1
- package/packages/shared-components/dist/Actions/ConfigureAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/ConfigureAction.js +2 -1
- package/packages/shared-components/dist/Actions/DeleteAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/DeleteAction.js +2 -1
- package/packages/shared-components/dist/Actions/DownloadAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/DownloadAction.js +2 -1
- package/packages/shared-components/dist/Actions/EditAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/EditAction.js +2 -1
- package/packages/shared-components/dist/Actions/ExportAction.d.ts +4 -0
- package/packages/shared-components/dist/Actions/ExportAction.d.ts.map +1 -0
- package/packages/shared-components/dist/Actions/ExportAction.js +11 -0
- package/packages/shared-components/dist/Actions/FilterAction.d.ts +4 -0
- package/packages/shared-components/dist/Actions/FilterAction.d.ts.map +1 -0
- package/packages/shared-components/dist/Actions/FilterAction.js +11 -0
- package/packages/shared-components/dist/Actions/HistoryAction.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/HistoryAction.js +2 -1
- package/packages/shared-components/dist/Actions/ImportAction.d.ts +4 -0
- package/packages/shared-components/dist/Actions/ImportAction.d.ts.map +1 -0
- package/packages/shared-components/dist/Actions/ImportAction.js +11 -0
- package/packages/shared-components/dist/Actions/ViewAction.d.ts +4 -0
- package/packages/shared-components/dist/Actions/ViewAction.d.ts.map +1 -0
- package/packages/shared-components/dist/Actions/ViewAction.js +11 -0
- package/packages/shared-components/dist/Actions/index.d.ts +4 -0
- package/packages/shared-components/dist/Actions/index.d.ts.map +1 -1
- package/packages/shared-components/dist/Actions/index.js +4 -0
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.d.ts +2 -1
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.d.ts.map +1 -1
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.js +2 -2
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.d.ts +1 -0
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.d.ts.map +1 -1
- package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.js +22 -10
- package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts +14 -0
- package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts.map +1 -0
- package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.js +33 -0
- package/packages/shared-components/dist/FilterList/FilterList.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/FilterList.js +8 -8
- package/packages/shared-components/dist/FilterList/FilterListV2.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/FilterListV2.js +111 -24
- package/packages/shared-components/dist/FilterList/FilterPopup.d.ts +4 -2
- package/packages/shared-components/dist/FilterList/FilterPopup.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/FilterPopup.js +8 -5
- package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts +12 -4
- package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/FilterPopupWrapper.js +11 -24
- package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts +1 -0
- package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.d.ts +5 -0
- package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.d.ts.map +1 -0
- package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.js +26 -0
- package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.js +2 -2
- package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.d.ts +7 -3
- package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.js +5 -3
- package/packages/shared-components/dist/Layouts/FormRow/FormRow.styled.js +1 -1
- package/packages/shared-components/dist/Svgs/SvgExport.d.ts +3 -0
- package/packages/shared-components/dist/Svgs/SvgExport.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/SvgExport.js +8 -0
- package/packages/shared-components/dist/Svgs/SvgImport.d.ts +3 -0
- package/packages/shared-components/dist/Svgs/SvgImport.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/SvgImport.js +8 -0
- package/packages/shared-components/dist/Svgs/SvgProfile.d.ts +2 -0
- package/packages/shared-components/dist/Svgs/SvgProfile.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/SvgProfile.js +6 -0
- package/packages/shared-components/dist/Svgs/SvgView.d.ts +3 -0
- package/packages/shared-components/dist/Svgs/SvgView.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/SvgView.js +6 -0
- package/packages/shared-components/dist/Svgs/index.d.ts +4 -0
- package/packages/shared-components/dist/Svgs/index.d.ts.map +1 -1
- package/packages/shared-components/dist/Svgs/index.js +4 -0
- package/packages/shared-components/dist/utils/file.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/file.js +2 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilterListV2 = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const zod_1 = require("@hookform/resolvers/zod");
|
|
5
6
|
const icons_material_1 = require("@mui/icons-material");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const icons_1 = require("@mui/x-date-pickers/icons");
|
|
@@ -9,36 +10,80 @@ const lodash_1 = require("lodash");
|
|
|
9
10
|
const luxon_1 = require("luxon");
|
|
10
11
|
const react_1 = require("react");
|
|
11
12
|
const react_hook_form_1 = require("react-hook-form");
|
|
13
|
+
const zod_2 = require("zod");
|
|
12
14
|
const Button_1 = require("../Button");
|
|
13
15
|
const FilterPill_1 = require("../Chips/FilterPill");
|
|
14
16
|
const FormFields_1 = require("../FormFields");
|
|
15
17
|
const Switch_1 = require("../FormFields/Switch");
|
|
16
18
|
const PadBox_1 = require("../PadBox");
|
|
17
19
|
const SvgFilterList_1 = require("../Svgs/SvgFilterList");
|
|
20
|
+
const Toast_1 = require("../Toast");
|
|
18
21
|
const Tooltip_1 = require("../Tooltip");
|
|
19
22
|
const FilterPopupWrapper_1 = require("./FilterPopupWrapper");
|
|
23
|
+
const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
|
|
20
24
|
const getFormData_1 = require("./getFormData");
|
|
21
25
|
const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onApply, onClear, onChange, dateKeys, }) => {
|
|
22
26
|
const theme = (0, material_1.useTheme)();
|
|
23
27
|
const { iron, slate } = theme.palette.app.color;
|
|
24
28
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
25
29
|
const filterPopupAnchorElm = (0, react_1.useRef)(null);
|
|
30
|
+
const dateRangeAnchorRef = (0, react_1.useRef)(null);
|
|
26
31
|
const [openFilterPopup, setOpenFilterPopup] = (0, react_1.useState)(false);
|
|
32
|
+
const [datePickerPopup, setDatePickerPopup] = (0, react_1.useState)(false);
|
|
27
33
|
const [currentFilter, setCurrentFilter] = (0, react_1.useState)(null);
|
|
34
|
+
const [expandedKeys, setExpandedKeys] = (0, react_1.useState)([]);
|
|
28
35
|
const handleDateRange = (filter) => {
|
|
29
36
|
setCurrentFilter(filter);
|
|
30
|
-
|
|
37
|
+
setDatePickerPopup(true);
|
|
31
38
|
};
|
|
32
39
|
const defaultValues = (0, react_1.useMemo)(() => {
|
|
33
40
|
return filterListItems.reduce((acc, item) => {
|
|
34
|
-
|
|
41
|
+
if (item.multiSelect || item.type === "dateRange") {
|
|
42
|
+
acc[item.key] = item.value || [];
|
|
43
|
+
}
|
|
44
|
+
else if (item.type === "switch") {
|
|
45
|
+
acc[item.key] = item.value || false;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
acc[item.key] = item.value || null;
|
|
49
|
+
}
|
|
35
50
|
return acc;
|
|
36
51
|
}, {});
|
|
37
52
|
}, [filterListData]);
|
|
38
|
-
const
|
|
53
|
+
const baseSchema = zod_2.z.object((() => {
|
|
54
|
+
const shape = {};
|
|
55
|
+
filterListItems.forEach((item) => {
|
|
56
|
+
if (item.multiSelect || item.type === "dateRange") {
|
|
57
|
+
shape[item.key] = zod_2.z.array(zod_2.z.string()).nullable().optional();
|
|
58
|
+
}
|
|
59
|
+
else if (item.type === "switch") {
|
|
60
|
+
shape[item.key] = zod_2.z.boolean().nullable().optional();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
shape[item.key] = zod_2.z.string().nullable().optional();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return shape;
|
|
67
|
+
})());
|
|
68
|
+
const validationSchema = baseSchema.superRefine((data, ctx) => {
|
|
69
|
+
filterListItems.forEach((item) => {
|
|
70
|
+
if (item.required && !data[item.key].length) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
path: [item.key],
|
|
73
|
+
message: `${item.label} is required`,
|
|
74
|
+
code: zod_2.z.ZodIssueCode.custom,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
const { control, handleSubmit, setValue, reset, formState: { errors, dirtyFields }, watch, } = (0, react_hook_form_1.useForm)({
|
|
39
80
|
values: defaultValues,
|
|
81
|
+
resolver: (0, zod_1.zodResolver)(validationSchema),
|
|
82
|
+
mode: "all",
|
|
40
83
|
});
|
|
41
84
|
const company_id = watch("company_id");
|
|
85
|
+
const business_unit_id = watch("business_unit_id");
|
|
86
|
+
const department_id = watch("department_id");
|
|
42
87
|
const handleClose = () => {
|
|
43
88
|
setAnchorEl(null);
|
|
44
89
|
};
|
|
@@ -48,6 +93,12 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
48
93
|
}
|
|
49
94
|
setOpenFilterPopup(false);
|
|
50
95
|
};
|
|
96
|
+
const handleCloseDatePickerPopup = () => {
|
|
97
|
+
if (currentFilter?.key) {
|
|
98
|
+
setValue(`${currentFilter?.key}`, filterListData?.[currentFilter.key]);
|
|
99
|
+
}
|
|
100
|
+
setDatePickerPopup(false);
|
|
101
|
+
};
|
|
51
102
|
const handlerReset = () => {
|
|
52
103
|
reset();
|
|
53
104
|
onClear();
|
|
@@ -59,10 +110,26 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
59
110
|
const onSubmit = (data) => {
|
|
60
111
|
setOpenFilterPopup(false);
|
|
61
112
|
setCurrentFilter(null);
|
|
62
|
-
const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value && !(Array.isArray(value) && value.length
|
|
113
|
+
const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value && !(Array.isArray(value) && !value.length)));
|
|
63
114
|
onApply(filteredData, openFilterPopup, currentFilter?.key);
|
|
115
|
+
handleClose();
|
|
116
|
+
};
|
|
117
|
+
const handleDateRangeSubmit = () => {
|
|
118
|
+
setDatePickerPopup(false);
|
|
119
|
+
};
|
|
120
|
+
const onError = (error) => {
|
|
121
|
+
const errorKeys = Object.keys(error);
|
|
122
|
+
const tabsToExpand = filterListItems
|
|
123
|
+
.filter((filter) => filter.required && errorKeys.includes(filter.key))
|
|
124
|
+
.map((filter) => filter.key);
|
|
125
|
+
setExpandedKeys(tabsToExpand);
|
|
64
126
|
};
|
|
65
127
|
const handleDelete = (key) => {
|
|
128
|
+
const item = getFilterItem(key);
|
|
129
|
+
if (item?.required)
|
|
130
|
+
return Toast_1.toasts.error({
|
|
131
|
+
title: "This is a required custom filter field and cannot be removed.",
|
|
132
|
+
});
|
|
66
133
|
setValue(`${key}`, null);
|
|
67
134
|
const newData = { ...filterListData };
|
|
68
135
|
delete newData[key];
|
|
@@ -70,7 +137,11 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
70
137
|
};
|
|
71
138
|
const formData = (0, react_hook_form_1.useWatch)({ control });
|
|
72
139
|
const currentFilterValue = currentFilter?.key
|
|
73
|
-
?
|
|
140
|
+
? currentFilter.key === "switch"
|
|
141
|
+
? watch(currentFilter.key)
|
|
142
|
+
? "true"
|
|
143
|
+
: "false"
|
|
144
|
+
: watch(currentFilter.key)
|
|
74
145
|
: null;
|
|
75
146
|
(0, react_1.useEffect)(() => {
|
|
76
147
|
onChange(formData, openFilterPopup);
|
|
@@ -83,6 +154,17 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
83
154
|
setValue("company_id", company_id);
|
|
84
155
|
}
|
|
85
156
|
}, [company_id]);
|
|
157
|
+
(0, react_1.useMemo)(() => {
|
|
158
|
+
if (business_unit_id !== filterListData?.business_unit_id &&
|
|
159
|
+
!openFilterPopup) {
|
|
160
|
+
setValue("business_unit_location_id", null);
|
|
161
|
+
}
|
|
162
|
+
}, [business_unit_id]);
|
|
163
|
+
(0, react_1.useMemo)(() => {
|
|
164
|
+
if (department_id !== filterListData?.department_id && !openFilterPopup) {
|
|
165
|
+
setValue("sub_department_id", null);
|
|
166
|
+
}
|
|
167
|
+
}, [department_id]);
|
|
86
168
|
const getFilterItem = (key) => {
|
|
87
169
|
return filterListItems.find((item) => item.key === key);
|
|
88
170
|
};
|
|
@@ -93,7 +175,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
93
175
|
}, [formData, dirtyFields]);
|
|
94
176
|
const renderChips = (data) => {
|
|
95
177
|
return Object.entries(data).map(([key, value]) => {
|
|
96
|
-
if (!value) {
|
|
178
|
+
if (typeof value !== "boolean" && !value) {
|
|
97
179
|
return;
|
|
98
180
|
}
|
|
99
181
|
const item = getFilterItem(key);
|
|
@@ -101,7 +183,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
101
183
|
(0, getFormData_1.getFormValue)(dateKeys?.includes(item?.key)
|
|
102
184
|
? luxon_1.DateTime.fromISO(value).toFormat(FormFields_1.dateFormats.dateWithEuropean)
|
|
103
185
|
: value, item);
|
|
104
|
-
if (!keyValue) {
|
|
186
|
+
if (typeof value !== "boolean" && !keyValue) {
|
|
105
187
|
return;
|
|
106
188
|
}
|
|
107
189
|
return ((0, jsx_runtime_1.jsx)(FilterPill_1.FilterPill, { ref: filterPopupAnchorElm, label: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip
|
|
@@ -134,8 +216,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
134
216
|
if (!shouldFormSubmit) {
|
|
135
217
|
handleSubmit((data) => {
|
|
136
218
|
onSubmit(data);
|
|
137
|
-
|
|
138
|
-
})();
|
|
219
|
+
}, onError)();
|
|
139
220
|
}
|
|
140
221
|
}, onKeyDown: (e) => {
|
|
141
222
|
if (e.key === "Enter") {
|
|
@@ -143,8 +224,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
143
224
|
if (!shouldFormSubmit) {
|
|
144
225
|
handleSubmit((data) => {
|
|
145
226
|
onSubmit(data);
|
|
146
|
-
|
|
147
|
-
})();
|
|
227
|
+
}, onError)();
|
|
148
228
|
}
|
|
149
229
|
}
|
|
150
230
|
}, children: (0, jsx_runtime_1.jsxs)(material_1.Drawer, { open: open, onClose: (_event, reason) => {
|
|
@@ -162,7 +242,11 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
162
242
|
}, children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px 30px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: "Filter" }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => {
|
|
163
243
|
reset();
|
|
164
244
|
handleClose();
|
|
165
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, sx: { overflowX: "hidden" }, children: filterListItems.map((filter) => filter.type === "switch" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "80%", sx: { padding: "10px 5px 10px 20px ", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(Switch_1.Switch, { control: control, name: filter.key })] }, filter.key)) : ((0, jsx_runtime_1.jsxs)(material_1.Accordion, { defaultExpanded: !!filterListData?.[filter.key], disabled: filter.isDisabled,
|
|
245
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, sx: { overflowX: "hidden" }, children: filterListItems.map((filter) => filter.type === "switch" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "80%", sx: { padding: "10px 5px 10px 20px ", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(Switch_1.Switch, { control: control, name: filter.key })] }, filter.key)) : ((0, jsx_runtime_1.jsxs)(material_1.Accordion, { defaultExpanded: !!filterListData?.[filter.key], disabled: filter.isDisabled, expanded: expandedKeys.includes(filter.key), onChange: () => {
|
|
246
|
+
setExpandedKeys((prev) => prev.includes(filter.key)
|
|
247
|
+
? prev.filter((k) => k !== filter.key)
|
|
248
|
+
: [...prev, filter.key]);
|
|
249
|
+
}, sx: {
|
|
166
250
|
"&.MuiAccordion-root.Mui-expanded": {
|
|
167
251
|
margin: "0 !important",
|
|
168
252
|
},
|
|
@@ -179,7 +263,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
179
263
|
"& .MuiAccordionSummary-content.Mui-expanded": {
|
|
180
264
|
margin: "0px",
|
|
181
265
|
},
|
|
182
|
-
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "90%", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.menuInfo })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { sx: {
|
|
266
|
+
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "90%", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), filter.required && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", children: "*" }))] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.menuInfo })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { sx: {
|
|
183
267
|
background: slate[600],
|
|
184
268
|
borderRadius: "5px",
|
|
185
269
|
padding: "0px",
|
|
@@ -189,26 +273,29 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
189
273
|
paddingRight: "15px",
|
|
190
274
|
}, children: filter.type === "dateRange" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "10px", onClick: (e) => {
|
|
191
275
|
handleDateRange(filter);
|
|
192
|
-
|
|
276
|
+
dateRangeAnchorRef.current = e.currentTarget;
|
|
193
277
|
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
194
278
|
border: "1px solid black",
|
|
195
279
|
borderRadius: "5px",
|
|
196
280
|
width: "150px",
|
|
197
281
|
p: 1,
|
|
198
|
-
}, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children:
|
|
199
|
-
|
|
200
|
-
|
|
282
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: Array.isArray(watch(filter.key)) &&
|
|
283
|
+
watch(filter.key)[0]
|
|
284
|
+
? luxon_1.DateTime.fromISO(watch(filter.key)[0]).toFormat(FormFields_1.dateFormats.dateWithEuropean)
|
|
285
|
+
: "Start Date" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: "~" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
201
286
|
border: "1px solid black",
|
|
202
287
|
borderRadius: "5px",
|
|
203
288
|
width: "150px",
|
|
204
289
|
p: 1,
|
|
205
|
-
}, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}, children: "Apply" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", onClick: () => handlerReset(), disabled: Object.keys(formData).every((key) => !formData[key]), variant: "outlined", children: "Reset" })] }) }) })] }) }), currentFilter &&
|
|
290
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: Array.isArray(watch(filter.key)) &&
|
|
291
|
+
watch(filter.key)[1]
|
|
292
|
+
? luxon_1.DateTime.fromISO(watch(filter.key)[1]).toFormat(FormFields_1.dateFormats.dateWithEuropean)
|
|
293
|
+
: "End Date" }) })] })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, GetFilterPopupComponent_1.getFilterPopupComponent)(filter, control, errors)[filter.type] })) }) })] }, filter.key))) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%", position: "absolute", bottom: "70px" } }), (0, jsx_runtime_1.jsx)(material_1.Stack, { height: "70px", children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", sx: { position: "absolute", bottom: "15px" }, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { type: "submit", disabled: shouldFormSubmit, variant: "contained", onClick: () => {
|
|
294
|
+
handleSubmit(onSubmit, onError)();
|
|
295
|
+
}, children: "Apply" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", onClick: () => handlerReset(), disabled: Object.keys(formData).every((key) => !formData[key]), variant: "outlined", children: "Reset" })] }) }) })] }) }), currentFilter && ((0, jsx_runtime_1.jsx)(FilterPopupWrapper_1.FilterPopupWrapper, { open: openFilterPopup, onClose: handleCloseFilterPopup, onApply: () => {
|
|
211
296
|
handleSubmit(onSubmit)();
|
|
212
|
-
}, control: control, anchorEl: filterPopupAnchorElm.current, filterItem: currentFilter, currentFilterValue: currentFilterValue }))
|
|
297
|
+
}, control: control, errors: errors, reset: reset, anchorEl: filterPopupAnchorElm.current, filterItem: currentFilter, currentFilterValue: currentFilterValue })), currentFilter && ((0, jsx_runtime_1.jsx)(FilterPopupWrapper_1.FilterPopUpDateRangeWrapper, { open: datePickerPopup, onClose: handleCloseDatePickerPopup, onApply: () => {
|
|
298
|
+
handleDateRangeSubmit();
|
|
299
|
+
}, control: control, errors: errors, anchorEl: dateRangeAnchorRef.current, filterItem: currentFilter }))] }));
|
|
213
300
|
};
|
|
214
301
|
exports.FilterListV2 = FilterListV2;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { type PropsWithChildren } from "react";
|
|
2
1
|
import type { PopoverProps } from "@mui/material";
|
|
2
|
+
import { type PropsWithChildren } from "react";
|
|
3
3
|
import type { FilterListType } from "./FilterTypeWrapper";
|
|
4
4
|
type FilterPopupProps = PropsWithChildren<PopoverProps> & {
|
|
5
5
|
onApply?: () => void;
|
|
6
6
|
showFooter?: boolean;
|
|
7
7
|
showDivider?: boolean;
|
|
8
8
|
title?: string;
|
|
9
|
+
required?: boolean;
|
|
9
10
|
background?: boolean;
|
|
10
11
|
filterItem?: FilterListType;
|
|
11
12
|
currentFilterValue?: string | string[] | null;
|
|
13
|
+
reset?: () => void;
|
|
12
14
|
};
|
|
13
|
-
export declare const FilterPopup: ({ open, anchorEl, onClose, children, onApply, showDivider, showFooter, title, filterItem, background, currentFilterValue, }: FilterPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const FilterPopup: ({ open, anchorEl, onClose, children, onApply, showDivider, showFooter, title, required, filterItem, reset, background, currentFilterValue, }: FilterPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export {};
|
|
15
17
|
//# sourceMappingURL=FilterPopup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterPopup.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterPopup.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAWlD,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,KAAK,gBAAgB,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,8IAczB,gBAAgB,4CAyHlB,CAAC"}
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FilterPopup = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
8
|
const Clear_1 = __importDefault(require("@mui/icons-material/Clear"));
|
|
10
9
|
const material_1 = require("@mui/material");
|
|
10
|
+
const lodash_1 = require("lodash");
|
|
11
|
+
const react_1 = require("react");
|
|
11
12
|
const Button_1 = require("../Button");
|
|
12
13
|
const PadBox_1 = require("../PadBox");
|
|
13
|
-
const
|
|
14
|
-
const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider = false, showFooter = true, title, filterItem, background = false, currentFilterValue, }) => {
|
|
14
|
+
const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider = false, showFooter = true, title, required, filterItem, reset, background = false, currentFilterValue, }) => {
|
|
15
15
|
const theme = (0, material_1.useTheme)();
|
|
16
16
|
const { slate } = theme.palette.app.color;
|
|
17
17
|
const [initialValue, setInitialValue] = (0, react_1.useState)(null);
|
|
@@ -44,6 +44,9 @@ const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider =
|
|
|
44
44
|
};
|
|
45
45
|
const handleClose = () => {
|
|
46
46
|
setInitialValue(null);
|
|
47
|
+
if ((0, lodash_1.isFunction)(reset)) {
|
|
48
|
+
reset();
|
|
49
|
+
}
|
|
47
50
|
if ((0, lodash_1.isFunction)(onClose)) {
|
|
48
51
|
onClose({}, "backdropClick");
|
|
49
52
|
}
|
|
@@ -53,10 +56,10 @@ const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider =
|
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
55
58
|
handleClose();
|
|
56
|
-
}, sx: { "& .MuiPaper-root": { minWidth: "300px" } }, children: [showDivider && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "flex-end", children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: title }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
59
|
+
}, sx: { "& .MuiPaper-root": { minWidth: "300px" } }, children: [showDivider && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "flex-end", children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: title }), required && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", color: "error", children: "*" }))] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
57
60
|
background: background ? slate[600] : "transparent",
|
|
58
61
|
borderRadius: "5px",
|
|
59
62
|
maxWidth: "300px",
|
|
60
|
-
}, children: children }), showFooter && ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsx)(material_1.
|
|
63
|
+
}, children: children }), showFooter && ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", justifyContent: "flex-end", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleApply, disabled: isDisabled, variant: "text", sx: { maxWidth: "40px" }, children: "Apply" }) }) }))] }));
|
|
61
64
|
};
|
|
62
65
|
exports.FilterPopup = FilterPopup;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import { type PopoverProps } from "@mui/material";
|
|
1
2
|
import { type PropsWithChildren } from "react";
|
|
3
|
+
import type { Control, FieldErrors, FieldValues } from "react-hook-form";
|
|
2
4
|
import type { FilterListType } from "./FilterTypeWrapper";
|
|
3
|
-
import { type PopoverProps } from "@mui/material";
|
|
4
|
-
import type { Control, FieldValues } from "react-hook-form";
|
|
5
5
|
type FilterPopupWrapperProp = PropsWithChildren<PopoverProps> & {
|
|
6
6
|
filterItem: FilterListType;
|
|
7
7
|
control: Control<FieldValues>;
|
|
8
|
+
errors: FieldErrors<FieldValues>;
|
|
8
9
|
currentFilterValue?: string | string[] | null;
|
|
9
10
|
onApply: () => void;
|
|
11
|
+
reset?: () => void;
|
|
12
|
+
};
|
|
13
|
+
type FilterDateRangePickerWrapperProp = PropsWithChildren<PopoverProps> & {
|
|
14
|
+
filterItem: FilterListType;
|
|
15
|
+
control: Control<FieldValues>;
|
|
16
|
+
errors: FieldErrors<FieldValues>;
|
|
17
|
+
onApply: () => void;
|
|
10
18
|
};
|
|
11
19
|
export type FilterPopupComponentType = {
|
|
12
20
|
autoComplete?: JSX.Element;
|
|
@@ -17,7 +25,7 @@ export type FilterPopupComponentType = {
|
|
|
17
25
|
switch?: JSX.Element;
|
|
18
26
|
radio?: JSX.Element;
|
|
19
27
|
};
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
28
|
+
export declare const FilterPopupWrapper: ({ open, anchorEl, filterItem, onClose, control, errors, onApply, currentFilterValue, reset, }: FilterPopupWrapperProp) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const FilterPopUpDateRangeWrapper: ({ open, anchorEl, filterItem, onClose, control, errors, onApply, }: FilterDateRangePickerWrapperProp) => import("react/jsx-runtime").JSX.Element;
|
|
22
30
|
export {};
|
|
23
31
|
//# sourceMappingURL=FilterPopupWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterPopupWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopupWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FilterPopupWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopupWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,KAAK,sBAAsB,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IAC9D,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,KAAK,gCAAgC,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IACxE,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,+FAUhC,sBAAsB,4CAmCxB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,oEAQzC,gCAAgC,4CAkBlC,CAAC"}
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FilterPopUpDateRangeWrapper = exports.FilterPopupWrapper = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const FilterPopup_1 = require("./FilterPopup");
|
|
6
|
-
const FormFields_1 = require("../FormFields");
|
|
7
5
|
const material_1 = require("@mui/material");
|
|
6
|
+
const FormFields_1 = require("../FormFields");
|
|
8
7
|
const PadBox_1 = require("../PadBox");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
maxHeight: "250px",
|
|
15
|
-
overflowY: "auto",
|
|
16
|
-
width: "100%",
|
|
17
|
-
"& .MuiAutocomplete-tag": {
|
|
18
|
-
backgroundColor: sapphireBlue[300],
|
|
19
|
-
color: black[900],
|
|
20
|
-
},
|
|
21
|
-
} })),
|
|
22
|
-
text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: selectedFilter.label })),
|
|
23
|
-
date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled })),
|
|
24
|
-
dateRange: ((0, jsx_runtime_1.jsx)(FormFields_1.DateRangePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled })),
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.GetFilterPopupComponent = GetFilterPopupComponent;
|
|
28
|
-
const FilterPopupWrapper = ({ open, anchorEl, filterItem, onClose, control, onApply, currentFilterValue, }) => {
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)(FilterPopup_1.FilterPopup, { title: filterItem.label, filterItem: filterItem, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, currentFilterValue: currentFilterValue, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, exports.GetFilterPopupComponent)(filterItem, control)[filterItem.type] }) }));
|
|
8
|
+
const DateRangePickerPopUp_1 = require("./DateRangePickerPopUp");
|
|
9
|
+
const FilterPopup_1 = require("./FilterPopup");
|
|
10
|
+
const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
|
|
11
|
+
const FilterPopupWrapper = ({ open, anchorEl, filterItem, onClose, control, errors, onApply, currentFilterValue, reset, }) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(FilterPopup_1.FilterPopup, { title: filterItem.label, required: filterItem.required, filterItem: filterItem, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, currentFilterValue: currentFilterValue, reset: reset, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsxs)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: [(0, GetFilterPopupComponent_1.getFilterPopupComponent)(filterItem, control, errors)[filterItem.type], filterItem.type === "switch" && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { padding: "10px 5px 10px 20px", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filterItem.label }), (0, jsx_runtime_1.jsx)(FormFields_1.Switch, { control: control, name: filterItem.key })] }, filterItem.key))] }) }));
|
|
30
13
|
};
|
|
31
14
|
exports.FilterPopupWrapper = FilterPopupWrapper;
|
|
15
|
+
const FilterPopUpDateRangeWrapper = ({ open, anchorEl, filterItem, onClose, control, errors, onApply, }) => {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(DateRangePickerPopUp_1.DateRangePickerPopUp, { title: filterItem.label, required: filterItem.required, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, GetFilterPopupComponent_1.getFilterPopupComponent)(filterItem, control, errors)[filterItem.type] }) }));
|
|
17
|
+
};
|
|
18
|
+
exports.FilterPopUpDateRangeWrapper = FilterPopUpDateRangeWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,KAAK,OAAO,GAAG,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,EAAE,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,sBAG/B,sBAAsB,4CAqBxB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Control, FieldErrors, FieldValues } from "react-hook-form";
|
|
2
|
+
import { FilterPopupComponentType } from "./FilterPopupWrapper";
|
|
3
|
+
import { FilterListType } from "./FilterTypeWrapper";
|
|
4
|
+
export declare const getFilterPopupComponent: (selectedFilter: FilterListType, control: Control<FieldValues>, errors: FieldErrors<FieldValues>) => FilterPopupComponentType;
|
|
5
|
+
//# sourceMappingURL=GetFilterPopupComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetFilterPopupComponent.d.ts","sourceRoot":"","sources":["../../src/FilterList/GetFilterPopupComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,cAAc,EAC9B,SAAS,OAAO,CAAC,WAAW,CAAC,EAC7B,QAAQ,WAAW,CAAC,WAAW,CAAC,KAC/B,wBA4DF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFilterPopupComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const FormFields_1 = require("../FormFields");
|
|
7
|
+
const getFilterPopupComponent = (selectedFilter, control, errors) => {
|
|
8
|
+
const theme = (0, material_1.useTheme)();
|
|
9
|
+
const { sapphireBlue, black } = theme.palette.app.color;
|
|
10
|
+
const errorSelectedKey = errors[selectedFilter.key];
|
|
11
|
+
return {
|
|
12
|
+
autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder: `Select ${selectedFilter.label}`, name: `${selectedFilter.key}`, disabled: selectedFilter.isDisabled, shouldCloseOnSelect: selectedFilter.multiSelect ?? false, control: control, options: selectedFilter.options ?? [], sx: {
|
|
13
|
+
maxHeight: "250px",
|
|
14
|
+
overflowY: "auto",
|
|
15
|
+
width: "100%",
|
|
16
|
+
"& .MuiAutocomplete-tag": {
|
|
17
|
+
backgroundColor: sapphireBlue[300],
|
|
18
|
+
color: black[900],
|
|
19
|
+
},
|
|
20
|
+
}, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
|
|
21
|
+
text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: selectedFilter.label, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
|
|
22
|
+
date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
|
|
23
|
+
dateRange: ((0, jsx_runtime_1.jsx)(FormFields_1.DateRangePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.getFilterPopupComponent = getFilterPopupComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DateRangePicker = DateRangePicker;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
+
const react_1 = require("react");
|
|
6
7
|
const react_date_range_1 = require("react-date-range");
|
|
7
8
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
9
|
const Skeleton_1 = require("./Skeleton");
|
|
9
|
-
const react_1 = require("react");
|
|
10
10
|
function DateRangePicker({ control, defaultValue, disabled = false, label, name, error = false, helperText, loading = false, required = false, rules, }) {
|
|
11
11
|
const { field: { onChange }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
|
|
12
12
|
const [range, setRange] = (0, react_1.useState)([
|
|
@@ -35,5 +35,5 @@ function DateRangePicker({ control, defaultValue, disabled = false, label, name,
|
|
|
35
35
|
const endDate = new Date(selectedRange.endDate.toUTCString()).toISOString();
|
|
36
36
|
onChange([startDate, endDate]);
|
|
37
37
|
}
|
|
38
|
-
}, months:
|
|
38
|
+
}, months: 1, direction: "horizontal", calendarFocus: "backwards", staticRanges: [], inputRanges: [], moveRangeOnFirstSelection: false, preventSnapRefocus: true }), error && (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "red", children: helperText })] }));
|
|
39
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldValues, UseControllerProps
|
|
1
|
+
import type { FieldError, FieldValues, UseControllerProps } from "react-hook-form";
|
|
2
2
|
export type FileUploadProps<P extends FieldValues> = UseControllerProps<P> & {
|
|
3
3
|
multiple?: boolean;
|
|
4
4
|
loading?: boolean;
|
|
@@ -11,7 +11,11 @@ export type FileUploadProps<P extends FieldValues> = UseControllerProps<P> & {
|
|
|
11
11
|
accept?: string;
|
|
12
12
|
fileNames: JSX.Element;
|
|
13
13
|
acceptTitle?: string;
|
|
14
|
-
setError
|
|
14
|
+
setError: (name: keyof P, error: FieldError | {
|
|
15
|
+
type: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
}) => void;
|
|
15
18
|
};
|
|
16
|
-
export declare
|
|
19
|
+
export declare const error_with_transaltion = "error_with_transaltion";
|
|
20
|
+
export declare function FileUpload<P extends FieldValues>({ loading, onChange, isDisabled, multiple, error, helperText, label, fileNames, size, name, setError, accept, acceptTitle, ...restProps }: FileUploadProps<P>): import("react/jsx-runtime").JSX.Element;
|
|
17
21
|
//# sourceMappingURL=FileUpload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,
|
|
1
|
+
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAQzB,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,CAAC,EACb,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KACnD,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,EAChD,OAAe,EACf,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,IAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAA0C,EAC1C,WAAsD,EACtD,GAAG,SAAS,EACb,EAAE,eAAe,CAAC,CAAC,CAAC,2CA6GpB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.error_with_transaltion = void 0;
|
|
3
4
|
exports.FileUpload = FileUpload;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const material_1 = require("@mui/material");
|
|
@@ -11,7 +12,8 @@ const Svgs_1 = require("../../Svgs");
|
|
|
11
12
|
const utils_1 = require("../../utils");
|
|
12
13
|
const FileUpload_styled_1 = require("./FileUpload.styled");
|
|
13
14
|
const Skeleton_1 = require("./Skeleton");
|
|
14
|
-
|
|
15
|
+
exports.error_with_transaltion = "error_with_transaltion";
|
|
16
|
+
function FileUpload({ loading = false, onChange, isDisabled, multiple = false, error, helperText, label, fileNames, size = 10, name, setError, accept = ".png,.jpg,.jpeg,.doc,.docx,.pdf", acceptTitle = "Only JPG, PNG, PDF files are accepted.", ...restProps }) {
|
|
15
17
|
const theme = (0, material_1.useTheme)();
|
|
16
18
|
const { red } = theme.palette.app.color;
|
|
17
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
@@ -42,8 +44,8 @@ function FileUpload({ loading = false, onChange, isDisabled, multiple = false, e
|
|
|
42
44
|
}
|
|
43
45
|
if (isShowError) {
|
|
44
46
|
if ((0, lodash_1.isFunction)(setError)) {
|
|
45
|
-
setError(
|
|
46
|
-
type:
|
|
47
|
+
setError(name, {
|
|
48
|
+
type: exports.error_with_transaltion,
|
|
47
49
|
message: inValidFiles.join("\n"),
|
|
48
50
|
});
|
|
49
51
|
}
|
|
@@ -15,7 +15,7 @@ function calculateWidth(childrenCount, fullWidth, maxColumn) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.RowContainerStyled = (0, styles_1.styled)(material_1.Stack, {
|
|
17
17
|
shouldForwardProp(prop) {
|
|
18
|
-
return prop !== "fullWidth";
|
|
18
|
+
return prop !== "fullWidth" && prop !== "maxColumn";
|
|
19
19
|
},
|
|
20
20
|
})(({ children, fullWidth, maxColumn, }) => {
|
|
21
21
|
const childrenCount = react_1.Children.toArray(children).length;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgExport.d.ts","sourceRoot":"","sources":["../../src/Svgs/SvgExport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,SAAS,GAAI,OAAO,YAAY,4CA8B5C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SvgExport = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const SvgExport = (props) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 34 34", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: (0, jsx_runtime_1.jsxs)("g", { id: "Communication / Share_iOS_Export", children: [(0, jsx_runtime_1.jsx)("rect", { x: "0.5", y: "0.5", width: "33", height: "33", rx: "3.5", stroke: "#BCBFC2" }), (0, jsx_runtime_1.jsx)("path", { id: "Vector", d: "M14 11L17 8M17 8L20 11M17 8V18M12.0002 15C11.0683 15 10.6024 15 10.2349 15.1522C9.74481 15.3552 9.35523 15.7448 9.15224 16.2349C9 16.6024 9 17.0681 9 18V22.8C9 23.9201 9 24.4798 9.21799 24.9076C9.40973 25.2839 9.71547 25.5905 10.0918 25.7822C10.5192 26 11.079 26 12.1969 26H21.8036C22.9215 26 23.4805 26 23.9079 25.7822C24.2842 25.5905 24.5905 25.2839 24.7822 24.9076C25 24.4802 25 23.921 25 22.8031V18C25 17.0681 24.9999 16.6024 24.8477 16.2349C24.6447 15.7448 24.2554 15.3552 23.7654 15.1522C23.3978 15 22.9319 15 22 15", stroke: "#4C5D70", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })] }) }));
|
|
7
|
+
};
|
|
8
|
+
exports.SvgExport = SvgExport;
|