rez-table-listing-mui 1.3.17 → 1.3.19
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 +18 -5
- 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/kanban/index.tsx +8 -10
- package/src/listing/components/filter/components/forms/components/Dropdown.tsx +135 -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 +127 -0
- package/src/listing/components/login/index.tsx +66 -24
- package/src/listing/components/table-settings/common/listing-values.tsx +22 -19
- package/src/listing/components/table-settings/components/column.tsx +13 -8
- package/src/listing/components/table-settings/components/group-by.tsx +1 -1
- package/src/listing/components/table-settings/components/lane.tsx +1 -1
- package/src/listing/components/table-settings/components/quick-tab.tsx +45 -35
- package/src/listing/components/table-settings/components/sorting.tsx +90 -68
- package/src/listing/components/table-settings/index.tsx +6 -2
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +22 -1
- package/src/listing/libs/services/getLayoutAPI.tsx +1 -1
- package/src/listing/libs/utils/apiColumn.ts +18 -0
- package/src/listing/libs/utils/common.ts +2 -2
- package/src/listing/types/filter-settings.ts +13 -9
- package/src/view/KanbanView.tsx +1 -1
- package/src/view/ListingView.tsx +55 -11
|
@@ -0,0 +1,127 @@
|
|
|
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_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[] = [
|
|
24
|
+
"equal",
|
|
25
|
+
"before",
|
|
26
|
+
"after",
|
|
27
|
+
"between",
|
|
28
|
+
"is",
|
|
29
|
+
"today",
|
|
30
|
+
"is_day_before",
|
|
31
|
+
"is_day_after",
|
|
32
|
+
"is_month_before",
|
|
33
|
+
"is_month_after",
|
|
34
|
+
"is_before",
|
|
35
|
+
"is_after",
|
|
36
|
+
"is_on_or_before",
|
|
37
|
+
"is_on_or_after",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export const resolveFilterInput = ({
|
|
41
|
+
filter,
|
|
42
|
+
operator,
|
|
43
|
+
control,
|
|
44
|
+
dropdownData,
|
|
45
|
+
updateFiltersFromForm,
|
|
46
|
+
}: {
|
|
47
|
+
filter: FilterStateProps;
|
|
48
|
+
operator: string | undefined;
|
|
49
|
+
control: any;
|
|
50
|
+
dropdownData: any;
|
|
51
|
+
updateFiltersFromForm: () => void;
|
|
52
|
+
}) => {
|
|
53
|
+
const isDateType = filter.filter_attribute_data_type === "date";
|
|
54
|
+
|
|
55
|
+
const showDatePicker =
|
|
56
|
+
isDateType && operator && DATE_ALLOWED_OPERATORS.includes(operator as any);
|
|
57
|
+
|
|
58
|
+
const showTextInsteadOfDate =
|
|
59
|
+
isDateType &&
|
|
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
|
+
) {
|
|
67
|
+
return (
|
|
68
|
+
<FormTextfield
|
|
69
|
+
filter={filter}
|
|
70
|
+
control={control}
|
|
71
|
+
onValueChange={updateFiltersFromForm}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// YEAR
|
|
77
|
+
if (filter?.filter_attribute_data_type === "year") {
|
|
78
|
+
return (
|
|
79
|
+
<FormDatePicker
|
|
80
|
+
filter={filter}
|
|
81
|
+
control={control}
|
|
82
|
+
views={["year"]}
|
|
83
|
+
onValueChange={updateFiltersFromForm}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// DATE LOGIC
|
|
89
|
+
if (showDatePicker) {
|
|
90
|
+
return (
|
|
91
|
+
<FormDatePicker
|
|
92
|
+
filter={filter}
|
|
93
|
+
control={control}
|
|
94
|
+
onValueChange={updateFiltersFromForm}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (showTextInsteadOfDate) {
|
|
100
|
+
return (
|
|
101
|
+
<FormTextfield
|
|
102
|
+
filter={filter}
|
|
103
|
+
control={control}
|
|
104
|
+
onValueChange={updateFiltersFromForm}
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// MULTISELECT / SELECT / RADIO / CHECKBOX
|
|
110
|
+
if (
|
|
111
|
+
filter?.filter_attribute_data_type !== undefined &&
|
|
112
|
+
["select", "multiselect", "radio", "checkbox"].includes(
|
|
113
|
+
filter?.filter_attribute_data_type
|
|
114
|
+
)
|
|
115
|
+
) {
|
|
116
|
+
return (
|
|
117
|
+
<FormMultiSelect
|
|
118
|
+
filter={filter}
|
|
119
|
+
control={control}
|
|
120
|
+
dropdownData={dropdownData}
|
|
121
|
+
onValueChange={updateFiltersFromForm}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return <FormControl fullWidth size="small" />;
|
|
127
|
+
};
|
|
@@ -7,30 +7,72 @@ const LoginButton = () => {
|
|
|
7
7
|
|
|
8
8
|
const handleLogin = async () => {
|
|
9
9
|
setLoading(true);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
const api_url = "https://api.eth-qa.rezolut.in/api/admin/auth";
|
|
11
|
+
const email_id = "kartik.shetty@rezolut.in";
|
|
12
|
+
const email_otp = "123456";
|
|
13
|
+
const sub_domain = "nair";
|
|
14
|
+
|
|
15
|
+
setLoading(true);
|
|
16
|
+
|
|
17
|
+
await axios
|
|
18
|
+
.post(`${api_url}/sso/check-email`, {
|
|
19
|
+
email_id: email_id,
|
|
20
|
+
subdomain: sub_domain,
|
|
21
|
+
})
|
|
22
|
+
.then(async (emailAPIResponse) => {
|
|
23
|
+
console.log(emailAPIResponse.data);
|
|
24
|
+
|
|
25
|
+
await axios
|
|
26
|
+
.post(`${api_url}/sso/otp/generate`, {
|
|
27
|
+
identifier: email_id,
|
|
28
|
+
service: "email",
|
|
29
|
+
})
|
|
30
|
+
.then(async (otpAPIResponse) => {
|
|
31
|
+
await axios
|
|
32
|
+
.post(`${api_url}/verify-otp`, {
|
|
33
|
+
fcm_token: "",
|
|
34
|
+
identifier: email_id,
|
|
35
|
+
otp: email_otp,
|
|
36
|
+
otp_id: otpAPIResponse.data.otp_id,
|
|
37
|
+
reset: true,
|
|
38
|
+
service: "email",
|
|
39
|
+
subdomain: "nair",
|
|
40
|
+
})
|
|
41
|
+
.then((otpVerifyResponse) => {
|
|
42
|
+
console.log(otpVerifyResponse.data);
|
|
43
|
+
const token = otpVerifyResponse.data.accessToken;
|
|
44
|
+
|
|
45
|
+
if (token) {
|
|
46
|
+
localStorage.setItem("authToken", token);
|
|
47
|
+
alert("Login successful");
|
|
48
|
+
window.location.reload(); // reload app to re-trigger axios with token
|
|
49
|
+
} else {
|
|
50
|
+
alert("Token not found in response.");
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
.catch((error) => {
|
|
54
|
+
console.error("Login failed:", error);
|
|
55
|
+
alert("Login failed. Check console for details.");
|
|
56
|
+
})
|
|
57
|
+
.finally(() => {
|
|
58
|
+
setLoading(false);
|
|
59
|
+
});
|
|
60
|
+
})
|
|
61
|
+
.catch((error) => {
|
|
62
|
+
console.error("Login failed:", error);
|
|
63
|
+
alert("Login failed. Check console for details.");
|
|
64
|
+
})
|
|
65
|
+
.finally(() => {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
.catch((error) => {
|
|
70
|
+
console.error("Login failed:", error);
|
|
71
|
+
alert("Login failed. Check console for details.");
|
|
72
|
+
})
|
|
73
|
+
.finally(() => {
|
|
74
|
+
setLoading(false);
|
|
75
|
+
});
|
|
34
76
|
};
|
|
35
77
|
|
|
36
78
|
return (
|
|
@@ -16,13 +16,12 @@ import DraggableListItem from "./draggable-listitem.tsx";
|
|
|
16
16
|
import { listingValuesStyles } from "../style.ts";
|
|
17
17
|
import Loader from "../../common/loader/loader.tsx";
|
|
18
18
|
import { ClosedEyeIcon, EyeIcon } from "../../../../assets/svg.tsx";
|
|
19
|
-
import InfoAlert from "./info-alert.tsx";
|
|
20
19
|
import React from "react";
|
|
21
20
|
``;
|
|
22
21
|
|
|
23
22
|
interface FilterValue {
|
|
24
|
-
id: string;
|
|
25
23
|
label: string;
|
|
24
|
+
value: string;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
interface ListingValuesProps {
|
|
@@ -34,7 +33,10 @@ interface ListingValuesProps {
|
|
|
34
33
|
setSearchTerm?: React.Dispatch<React.SetStateAction<string>>;
|
|
35
34
|
containerId: string;
|
|
36
35
|
tabsApiDataLoading?: boolean;
|
|
37
|
-
onItemToggle: (
|
|
36
|
+
onItemToggle: (
|
|
37
|
+
item: { label: string; value: string },
|
|
38
|
+
fromContainerId: string
|
|
39
|
+
) => void;
|
|
38
40
|
enableDragAndDrop?: boolean;
|
|
39
41
|
isQuickTabActive?: boolean;
|
|
40
42
|
AlertComponenet?: React.ReactNode;
|
|
@@ -47,7 +49,10 @@ const ListingValuesContent = ({
|
|
|
47
49
|
}: {
|
|
48
50
|
item: FilterValue;
|
|
49
51
|
containerId: string;
|
|
50
|
-
onItemToggle: (
|
|
52
|
+
onItemToggle: (
|
|
53
|
+
item: { label: string; value: string },
|
|
54
|
+
fromContainerId: string
|
|
55
|
+
) => void;
|
|
51
56
|
}) => {
|
|
52
57
|
return (
|
|
53
58
|
<Box
|
|
@@ -61,10 +66,7 @@ const ListingValuesContent = ({
|
|
|
61
66
|
}}
|
|
62
67
|
>
|
|
63
68
|
<Typography>{item.label}</Typography>
|
|
64
|
-
<IconButton
|
|
65
|
-
size="small"
|
|
66
|
-
onClick={() => onItemToggle(item.id, containerId)}
|
|
67
|
-
>
|
|
69
|
+
<IconButton size="small" onClick={() => onItemToggle(item, containerId)}>
|
|
68
70
|
{containerId === "tabs" ? <EyeIcon /> : <ClosedEyeIcon />}
|
|
69
71
|
</IconButton>
|
|
70
72
|
</Box>
|
|
@@ -121,14 +123,14 @@ const ListingValues = ({
|
|
|
121
123
|
<Box ref={setNodeRef} sx={listingValuesStyles.draggableContainer}>
|
|
122
124
|
{enableDragAndDrop ? (
|
|
123
125
|
<SortableContext
|
|
124
|
-
items={filteredValues.map((item) => item.
|
|
126
|
+
items={filteredValues.map((item) => item.value)}
|
|
125
127
|
strategy={verticalListSortingStrategy}
|
|
126
128
|
>
|
|
127
129
|
<Box sx={listingValuesStyles.draggableCover}>
|
|
128
130
|
{filteredValues.map((item) => (
|
|
129
131
|
<DraggableListItem
|
|
130
|
-
key={item.
|
|
131
|
-
id={item.
|
|
132
|
+
key={item.value}
|
|
133
|
+
id={item.value}
|
|
132
134
|
containerId={containerId}
|
|
133
135
|
>
|
|
134
136
|
<ListingValuesContent
|
|
@@ -142,14 +144,15 @@ const ListingValues = ({
|
|
|
142
144
|
</SortableContext>
|
|
143
145
|
) : (
|
|
144
146
|
<Box sx={listingValuesStyles.draggableCover}>
|
|
145
|
-
{filteredValues
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
{filteredValues?.length > 0 &&
|
|
148
|
+
filteredValues.map((item) => (
|
|
149
|
+
<ListingValuesContent
|
|
150
|
+
key={item.value}
|
|
151
|
+
item={item}
|
|
152
|
+
containerId={containerId}
|
|
153
|
+
onItemToggle={onItemToggle}
|
|
154
|
+
/>
|
|
155
|
+
))}
|
|
153
156
|
</Box>
|
|
154
157
|
)}
|
|
155
158
|
</Box>
|
|
@@ -194,13 +194,13 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
|
|
|
194
194
|
const { showList, hideList } = getCurrentLists();
|
|
195
195
|
|
|
196
196
|
const showListValues = showList.map((item) => ({
|
|
197
|
-
|
|
197
|
+
value: item.value,
|
|
198
198
|
label: item.label,
|
|
199
199
|
visible: true,
|
|
200
200
|
}));
|
|
201
201
|
|
|
202
202
|
const hideListValues = hideList.map((item) => ({
|
|
203
|
-
|
|
203
|
+
value: item.value,
|
|
204
204
|
label: item.label,
|
|
205
205
|
visible: false,
|
|
206
206
|
}));
|
|
@@ -209,18 +209,21 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
|
|
|
209
209
|
value.label.toLowerCase().includes(searchTerm.toLowerCase())
|
|
210
210
|
);
|
|
211
211
|
|
|
212
|
-
const handleItemToggle = (
|
|
212
|
+
const handleItemToggle = (
|
|
213
|
+
item: { label: string; value: string },
|
|
214
|
+
fromContainerId: string
|
|
215
|
+
) => {
|
|
213
216
|
let newShowList = [...showList];
|
|
214
217
|
let newHideList = [...hideList];
|
|
215
218
|
|
|
216
219
|
if (fromContainerId === "tabs") {
|
|
217
|
-
const idx = newShowList.findIndex((
|
|
220
|
+
const idx = newShowList.findIndex((i) => i.value === item.value);
|
|
218
221
|
if (idx > -1) {
|
|
219
222
|
const [moved] = newShowList.splice(idx, 1);
|
|
220
223
|
newHideList.push(moved);
|
|
221
224
|
}
|
|
222
225
|
} else if (fromContainerId === "list") {
|
|
223
|
-
const idx = newHideList.findIndex((
|
|
226
|
+
const idx = newHideList.findIndex((i) => i.value === item.value);
|
|
224
227
|
if (idx > -1) {
|
|
225
228
|
const [moved] = newHideList.splice(idx, 1);
|
|
226
229
|
newShowList.push(moved);
|
|
@@ -378,9 +381,11 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
|
|
|
378
381
|
<Box sx={{ flex: 1 }}>
|
|
379
382
|
{!isColumnDefault && hasShowListQuickTabs && (
|
|
380
383
|
<CustomTabs value={selectedTabIndex} onChange={handleTabChange}>
|
|
381
|
-
{quickTabStates?.show_list?.map(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
+
{quickTabStates?.show_list?.map(
|
|
385
|
+
(tab: { label: string; value: string }) => (
|
|
386
|
+
<Tab key={tab?.value} label={tab?.label} />
|
|
387
|
+
)
|
|
388
|
+
)}
|
|
384
389
|
</CustomTabs>
|
|
385
390
|
)}
|
|
386
391
|
|
|
@@ -40,7 +40,7 @@ const GroupBy = ({
|
|
|
40
40
|
}: {
|
|
41
41
|
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
42
42
|
columnsData: any;
|
|
43
|
-
tabsApiData?: string[];
|
|
43
|
+
tabsApiData?: { label: string; value: string }[];
|
|
44
44
|
tabsApiDataLoading?: boolean;
|
|
45
45
|
}) => {
|
|
46
46
|
const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
|
|
@@ -39,7 +39,7 @@ const Lane = ({
|
|
|
39
39
|
}: {
|
|
40
40
|
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
41
41
|
columnsData: any;
|
|
42
|
-
tabsApiData?: string[];
|
|
42
|
+
tabsApiData?: { label: string; value: string }[];
|
|
43
43
|
tabsApiDataLoading?: boolean;
|
|
44
44
|
}) => {
|
|
45
45
|
const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
|
|
@@ -58,9 +58,7 @@ const QuickTab = ({
|
|
|
58
58
|
...prev,
|
|
59
59
|
quick_tab: {
|
|
60
60
|
...prev?.quick_tab,
|
|
61
|
-
attribute: columnsData?.
|
|
62
|
-
(item) => item.datasource_list
|
|
63
|
-
)[0]?.attribute_key,
|
|
61
|
+
attribute: columnsData[0]?.value,
|
|
64
62
|
sorting: "asc",
|
|
65
63
|
},
|
|
66
64
|
}));
|
|
@@ -82,6 +80,15 @@ const QuickTab = ({
|
|
|
82
80
|
}));
|
|
83
81
|
|
|
84
82
|
setCurrentQuickAttribute(settingsData?.quick_tab?.attribute || "");
|
|
83
|
+
} else {
|
|
84
|
+
setSettingsData((prev) => ({
|
|
85
|
+
...prev,
|
|
86
|
+
quick_tab: {
|
|
87
|
+
...prev?.quick_tab,
|
|
88
|
+
hide_list: [],
|
|
89
|
+
show_list: [],
|
|
90
|
+
},
|
|
91
|
+
}));
|
|
85
92
|
}
|
|
86
93
|
}, [tabsApiData]);
|
|
87
94
|
|
|
@@ -150,14 +157,8 @@ const QuickTab = ({
|
|
|
150
157
|
];
|
|
151
158
|
|
|
152
159
|
// Convert show_list/hide_list to FilterValue[] for rendering only
|
|
153
|
-
const showListValues =
|
|
154
|
-
|
|
155
|
-
label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
|
|
156
|
-
}));
|
|
157
|
-
const hideListValues = (quickTabStates?.hide_list || []).map((id) => ({
|
|
158
|
-
id,
|
|
159
|
-
label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
|
|
160
|
-
}));
|
|
160
|
+
const showListValues = quickTabStates?.show_list || [];
|
|
161
|
+
const hideListValues = quickTabStates?.hide_list || [];
|
|
161
162
|
|
|
162
163
|
const sensors = useSensors(
|
|
163
164
|
useSensor(MouseSensor),
|
|
@@ -179,15 +180,16 @@ const QuickTab = ({
|
|
|
179
180
|
let newShowList = [...(quickTabStates.show_list ?? [])];
|
|
180
181
|
let newHideList = [...(quickTabStates.hide_list ?? [])];
|
|
181
182
|
if (currentContainer === "list") {
|
|
182
|
-
const oldIndex = newHideList.indexOf(String(active.id));
|
|
183
|
-
const
|
|
183
|
+
// const oldIndex = newHideList.indexOf(String(active.id));
|
|
184
|
+
const oldIndex = newHideList.findIndex((i) => i.value === active.id);
|
|
185
|
+
const newIndex = newHideList.findIndex((i) => i.value === over.id); //newHideList.indexOf(String(over.id));
|
|
184
186
|
if (oldIndex !== -1 && newIndex !== -1) {
|
|
185
187
|
const [removed] = newHideList.splice(oldIndex, 1);
|
|
186
188
|
newHideList.splice(newIndex, 0, removed);
|
|
187
189
|
}
|
|
188
190
|
} else {
|
|
189
|
-
const oldIndex = newShowList.indexOf(String(active.id));
|
|
190
|
-
const newIndex = newShowList.indexOf(String(over.id));
|
|
191
|
+
const oldIndex = newShowList.findIndex((i) => i.value === active.id); //newShowList.indexOf(String(active.id));
|
|
192
|
+
const newIndex = newShowList.findIndex((i) => i.value === over.id); //newShowList.indexOf(String(over.id));
|
|
191
193
|
if (oldIndex !== -1 && newIndex !== -1) {
|
|
192
194
|
const [removed] = newShowList.splice(oldIndex, 1);
|
|
193
195
|
newShowList.splice(newIndex, 0, removed);
|
|
@@ -210,17 +212,27 @@ const QuickTab = ({
|
|
|
210
212
|
if (newShowList.length >= 5) return; // prevent overflow
|
|
211
213
|
// Move from hide to show
|
|
212
214
|
|
|
213
|
-
const idx = newHideList.indexOf(String(active.id));
|
|
215
|
+
const idx = newHideList.findIndex((i) => i.value === String(active.id)); //newHideList.indexOf(String(active.id));
|
|
214
216
|
if (idx !== -1) {
|
|
215
217
|
newHideList.splice(idx, 1);
|
|
216
|
-
newShowList.push(
|
|
218
|
+
newShowList.push({
|
|
219
|
+
value: String(active.id),
|
|
220
|
+
label:
|
|
221
|
+
tabsApiData?.find((i) => i.value === String(active.id))?.label ??
|
|
222
|
+
"",
|
|
223
|
+
});
|
|
217
224
|
}
|
|
218
225
|
} else if (currentContainer === "tabs" && overContainer === "list") {
|
|
219
226
|
// Move from show to hide
|
|
220
|
-
const idx = newShowList.indexOf(String(active.id));
|
|
227
|
+
const idx = newShowList.findIndex((i) => i.value === String(active.id)); //newShowList.indexOf(String(active.id));
|
|
221
228
|
if (idx !== -1) {
|
|
222
229
|
newShowList.splice(idx, 1);
|
|
223
|
-
newHideList.push(
|
|
230
|
+
newHideList.push({
|
|
231
|
+
value: String(active.id),
|
|
232
|
+
label:
|
|
233
|
+
tabsApiData?.find((i) => i.value === String(active.id))?.label ??
|
|
234
|
+
"",
|
|
235
|
+
});
|
|
224
236
|
}
|
|
225
237
|
}
|
|
226
238
|
|
|
@@ -256,7 +268,7 @@ const QuickTab = ({
|
|
|
256
268
|
...prev?.quick_tab,
|
|
257
269
|
show_list: [...currentShowList, ...limitedHideList],
|
|
258
270
|
hide_list: currentHideList.filter(
|
|
259
|
-
(item) => !limitedHideList.
|
|
271
|
+
(item) => !limitedHideList.find((i) => i.value === item.value)
|
|
260
272
|
),
|
|
261
273
|
},
|
|
262
274
|
}));
|
|
@@ -298,24 +310,27 @@ const QuickTab = ({
|
|
|
298
310
|
}));
|
|
299
311
|
};
|
|
300
312
|
|
|
301
|
-
const handleItemToggle = (
|
|
313
|
+
const handleItemToggle = (
|
|
314
|
+
item: { label: string; value: string },
|
|
315
|
+
fromContainerId: string
|
|
316
|
+
) => {
|
|
302
317
|
const toShowList = [...(quickTabStates.show_list ?? [])];
|
|
303
318
|
const toHideList = [...(quickTabStates.hide_list ?? [])];
|
|
304
319
|
|
|
305
320
|
if (fromContainerId === "list") {
|
|
306
321
|
if (toShowList.length >= 5) return; // prevent overflow
|
|
307
322
|
// Move from hide_list to show_list
|
|
308
|
-
const index = toHideList.
|
|
323
|
+
const index = toHideList.findIndex((i) => i.value == item.value);
|
|
309
324
|
if (index > -1) {
|
|
310
325
|
toHideList.splice(index, 1);
|
|
311
|
-
toShowList.push(
|
|
326
|
+
toShowList.push(item);
|
|
312
327
|
}
|
|
313
328
|
} else if (fromContainerId === "tabs") {
|
|
314
329
|
// Move from show_list to hide_list
|
|
315
|
-
const index = toShowList.indexOf(
|
|
330
|
+
const index = toShowList.indexOf(item);
|
|
316
331
|
if (index > -1) {
|
|
317
332
|
toShowList.splice(index, 1);
|
|
318
|
-
toHideList.push(
|
|
333
|
+
toHideList.push(item);
|
|
319
334
|
}
|
|
320
335
|
}
|
|
321
336
|
|
|
@@ -362,16 +377,11 @@ const QuickTab = ({
|
|
|
362
377
|
}
|
|
363
378
|
MenuProps={{ container: fullscreenContainer }}
|
|
364
379
|
>
|
|
365
|
-
{columnsData?.
|
|
366
|
-
?.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
value={column?.attribute_key}
|
|
371
|
-
>
|
|
372
|
-
{column?.name}
|
|
373
|
-
</MenuItem>
|
|
374
|
-
))}
|
|
380
|
+
{columnsData?.map((column: any) => (
|
|
381
|
+
<MenuItem key={column?.value} value={column?.value}>
|
|
382
|
+
{column?.label}
|
|
383
|
+
</MenuItem>
|
|
384
|
+
))}
|
|
375
385
|
</Select>
|
|
376
386
|
</FormControl>
|
|
377
387
|
<FormControl
|