rez-table-listing-mui 2.0.14 → 2.0.15
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 +42 -1
- 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/hooks/hooks.ts +18 -1
- package/src/listing/components/table-settings/components/lane.tsx +232 -120
- package/src/listing/components/table-settings/components/swim-lane.tsx +293 -109
- package/src/listing/components/table-settings/index.tsx +17 -1
- package/src/listing/libs/hooks/useCraftTableFilterSettings.tsx +5 -0
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +12 -4
- package/src/listing/libs/utils/apiColumn.ts +13 -4
- package/src/listing/types/filter-settings.ts +29 -0
- package/src/listing/types/table-options.ts +3 -0
- package/src/view/KanbanView.tsx +65 -7
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
4
|
Select,
|
|
5
5
|
MenuItem,
|
|
6
6
|
FormControl,
|
|
7
7
|
Typography,
|
|
8
|
+
Checkbox,
|
|
9
|
+
FormControlLabel,
|
|
8
10
|
Grid,
|
|
9
11
|
} from "@mui/material";
|
|
10
12
|
|
|
@@ -21,133 +23,299 @@ import {
|
|
|
21
23
|
} from "@dnd-kit/core";
|
|
22
24
|
import { TabsStyles } from "../style";
|
|
23
25
|
import { craftTableFilterSettingsOptionsProps } from "../../../types/table-options";
|
|
24
|
-
import { LANE_SELECTS } from "../constants";
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const SwimLane = ({
|
|
27
28
|
filterSettingStates,
|
|
28
|
-
columnsData,
|
|
29
|
-
tabsApiData,
|
|
30
29
|
tabsApiDataLoading,
|
|
30
|
+
selectSwinLandData,
|
|
31
|
+
swimLaneHideListData,
|
|
31
32
|
}: {
|
|
32
33
|
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
33
34
|
columnsData: any;
|
|
34
|
-
tabsApiData?:
|
|
35
|
+
tabsApiData?: { label: string; value: string }[];
|
|
35
36
|
tabsApiDataLoading?: boolean;
|
|
37
|
+
selectSwinLandData?: { label: string; value: string }[];
|
|
38
|
+
swimLaneHideListData?: { label: string; value: string }[];
|
|
36
39
|
}) => {
|
|
37
|
-
const {
|
|
40
|
+
const { kanbanSettingsData, setKanbanSettingsData } = filterSettingStates;
|
|
38
41
|
|
|
39
|
-
const
|
|
40
|
-
const [
|
|
42
|
+
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
43
|
+
const [currentSwimLaneAttribute, setCurrentSwimLaneAttribute] =
|
|
44
|
+
useState<string>(kanbanSettingsData?.swim_lane?.attribute || "");
|
|
41
45
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const sensors = useSensors(
|
|
48
|
-
useSensor(MouseSensor),
|
|
49
|
-
useSensor(TouchSensor),
|
|
50
|
-
useSensor(KeyboardSensor)
|
|
51
|
-
);
|
|
46
|
+
const isStatusAttribute =
|
|
47
|
+
kanbanSettingsData?.swim_lane?.attribute === "lead_status" ||
|
|
48
|
+
kanbanSettingsData?.swim_lane?.attribute === "status";
|
|
49
|
+
const isSourceAttribute =
|
|
50
|
+
kanbanSettingsData?.swim_lane?.attribute === "lead_source";
|
|
52
51
|
|
|
53
52
|
useEffect(() => {
|
|
54
|
-
if (
|
|
55
|
-
|
|
53
|
+
if (isStatusAttribute) {
|
|
54
|
+
setKanbanSettingsData((prev) => ({
|
|
56
55
|
...prev,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
sorting: "
|
|
60
|
-
show_list: [],
|
|
61
|
-
hide_list: [],
|
|
56
|
+
swim_lane: {
|
|
57
|
+
...prev.swim_lane,
|
|
58
|
+
sorting: "sort_by",
|
|
62
59
|
},
|
|
63
60
|
}));
|
|
64
61
|
}
|
|
65
|
-
}, []);
|
|
62
|
+
}, [kanbanSettingsData?.swim_lane?.attribute]);
|
|
66
63
|
|
|
67
64
|
useEffect(() => {
|
|
68
|
-
if (!
|
|
65
|
+
if (!isSourceAttribute) return;
|
|
69
66
|
|
|
70
|
-
|
|
67
|
+
setKanbanSettingsData((prev) => ({
|
|
71
68
|
...prev,
|
|
72
|
-
|
|
73
|
-
...prev.
|
|
74
|
-
|
|
75
|
-
show_list: [],
|
|
76
|
-
sorting: quickTabStates?.attribute === "Source" ? "count_dsc" : "asc",
|
|
69
|
+
swim_lane: {
|
|
70
|
+
...prev.swim_lane,
|
|
71
|
+
sorting: "count_dsc",
|
|
77
72
|
},
|
|
78
73
|
}));
|
|
79
|
-
}, [
|
|
74
|
+
}, [isSourceAttribute]);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const stateToArray =
|
|
78
|
+
(kanbanSettingsData?.swim_lane &&
|
|
79
|
+
Object.entries(kanbanSettingsData?.swim_lane)) ||
|
|
80
|
+
[];
|
|
81
|
+
const isEmptyState = stateToArray.length ? false : true;
|
|
82
|
+
|
|
83
|
+
if (isEmptyState) {
|
|
84
|
+
setKanbanSettingsData((prev) => ({
|
|
85
|
+
...prev,
|
|
86
|
+
swim_lane: {
|
|
87
|
+
...prev?.swim_lane,
|
|
88
|
+
attribute: selectSwinLandData
|
|
89
|
+
?.filter((i) => i?.value !== kanbanSettingsData?.lane?.attribute)
|
|
90
|
+
?.find((i) => i?.value == "lead_status" || i?.value == "status")
|
|
91
|
+
?.value,
|
|
92
|
+
// sorting: "asc",
|
|
93
|
+
},
|
|
94
|
+
}));
|
|
95
|
+
} else {
|
|
96
|
+
if (
|
|
97
|
+
kanbanSettingsData?.swim_lane?.attribute ==
|
|
98
|
+
kanbanSettingsData?.lane?.attribute
|
|
99
|
+
) {
|
|
100
|
+
setKanbanSettingsData((prev) => ({
|
|
101
|
+
...prev,
|
|
102
|
+
swim_lane: {
|
|
103
|
+
...prev?.swim_lane,
|
|
104
|
+
attribute: selectSwinLandData
|
|
105
|
+
?.filter((i) => i?.value !== kanbanSettingsData?.lane?.attribute)
|
|
106
|
+
?.find((i) => i?.value == "lead_status" || i?.value == "status")
|
|
107
|
+
?.value,
|
|
108
|
+
// sorting: "asc",
|
|
109
|
+
},
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, [selectSwinLandData]);
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (currentSwimLaneAttribute === kanbanSettingsData?.swim_lane?.attribute)
|
|
117
|
+
return;
|
|
118
|
+
|
|
119
|
+
if (swimLaneHideListData?.length) {
|
|
120
|
+
setKanbanSettingsData((prev) => ({
|
|
121
|
+
...prev,
|
|
122
|
+
swim_lane: {
|
|
123
|
+
...prev?.swim_lane,
|
|
124
|
+
hide_list: swimLaneHideListData,
|
|
125
|
+
show_list: [],
|
|
126
|
+
},
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
setCurrentSwimLaneAttribute(
|
|
130
|
+
kanbanSettingsData?.swim_lane?.attribute || ""
|
|
131
|
+
);
|
|
132
|
+
} else {
|
|
133
|
+
setKanbanSettingsData((prev) => ({
|
|
134
|
+
...prev,
|
|
135
|
+
swim_lane: {
|
|
136
|
+
...prev?.swim_lane,
|
|
137
|
+
hide_list: [],
|
|
138
|
+
show_list: [],
|
|
139
|
+
},
|
|
140
|
+
}));
|
|
141
|
+
|
|
142
|
+
setCurrentSwimLaneAttribute("");
|
|
143
|
+
}
|
|
144
|
+
}, [swimLaneHideListData]);
|
|
145
|
+
|
|
146
|
+
const sortingOptions = [
|
|
147
|
+
{ label: "Sort By", value: "sort_by" },
|
|
148
|
+
{ label: "A-Z", value: "asc" },
|
|
149
|
+
{ label: "Z-A", value: "dsc" },
|
|
150
|
+
{ label: "Count (Ascending)", value: "count_asc" },
|
|
151
|
+
{ label: "Count (Descending)", value: "count_dsc" },
|
|
152
|
+
{ label: "Custom", value: "custom" },
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const normalizeTabItem = (item: any) => ({
|
|
156
|
+
label: item.label,
|
|
157
|
+
value: item?.value,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const constructHideList = () => {
|
|
161
|
+
const normalizedTabs = swimLaneHideListData?.map(normalizeTabItem) || [];
|
|
162
|
+
|
|
163
|
+
// remove items already in show_list (value-safe comparison)
|
|
164
|
+
return normalizedTabs?.filter(
|
|
165
|
+
(tab) => !showListValues?.some((i) => i?.value === tab?.value)
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const showListValues = kanbanSettingsData?.swim_lane?.show_list || [];
|
|
170
|
+
const hideListValues = constructHideList() || [];
|
|
171
|
+
|
|
172
|
+
const filteredListValues = hideListValues.filter((value: any) =>
|
|
173
|
+
value?.label?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const sensors = useSensors(
|
|
177
|
+
useSensor(MouseSensor),
|
|
178
|
+
useSensor(TouchSensor),
|
|
179
|
+
useSensor(KeyboardSensor)
|
|
180
|
+
);
|
|
80
181
|
|
|
81
|
-
/* Drag logic unchanged */
|
|
82
182
|
const handleDragEnd = (event: DragEndEvent) => {
|
|
83
183
|
const { active, over } = event;
|
|
84
184
|
if (!over) return;
|
|
85
185
|
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
if (!from || !to) return;
|
|
186
|
+
const currentContainer = active.data.current?.containerId;
|
|
187
|
+
const overContainer = over.data.current?.containerId;
|
|
89
188
|
|
|
90
|
-
|
|
91
|
-
const hideList = [...(quickTabStates.hide_list ?? [])];
|
|
189
|
+
if (!currentContainer || !overContainer) return;
|
|
92
190
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
191
|
+
let newShowList = [...(kanbanSettingsData?.swim_lane?.show_list ?? [])];
|
|
192
|
+
let newHideList = [...(kanbanSettingsData?.swim_lane?.hide_list ?? [])];
|
|
193
|
+
|
|
194
|
+
if (currentContainer === overContainer) {
|
|
195
|
+
if (currentContainer === "list") {
|
|
196
|
+
const oldIndex = newHideList.findIndex((i) => i.value === active.id);
|
|
197
|
+
const newIndex = newHideList.findIndex((i) => i.value === over.id);
|
|
198
|
+
|
|
199
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
200
|
+
const [removed] = newHideList.splice(oldIndex, 1);
|
|
201
|
+
newHideList.splice(newIndex, 0, removed);
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
const oldIndex = newShowList.findIndex((i) => i.value === active.id);
|
|
205
|
+
const newIndex = newShowList.findIndex((i) => i.value === over.id);
|
|
206
|
+
|
|
207
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
208
|
+
const [removed] = newShowList.splice(oldIndex, 1);
|
|
209
|
+
newShowList.splice(newIndex, 0, removed);
|
|
210
|
+
}
|
|
105
211
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// -------------------------------------
|
|
215
|
+
// CASE 2: MOVE BETWEEN LISTS
|
|
216
|
+
// -------------------------------------
|
|
217
|
+
if (currentContainer !== overContainer) {
|
|
218
|
+
if (currentContainer === "list" && overContainer === "tabs") {
|
|
219
|
+
// if (newShowList.length < 5) {
|
|
220
|
+
const idx = newHideList.findIndex((i) => i.value === String(active.id));
|
|
221
|
+
if (idx !== -1) {
|
|
222
|
+
const item = newHideList.splice(idx, 1)[0];
|
|
223
|
+
newShowList.push(item);
|
|
224
|
+
}
|
|
225
|
+
// }
|
|
226
|
+
} else if (currentContainer === "tabs" && overContainer === "list") {
|
|
227
|
+
const idx = newShowList.findIndex((i) => i.value === String(active.id));
|
|
228
|
+
if (idx !== -1) {
|
|
229
|
+
const item = newShowList.splice(idx, 1)[0];
|
|
230
|
+
newHideList.push(item);
|
|
231
|
+
}
|
|
109
232
|
}
|
|
110
233
|
}
|
|
111
234
|
|
|
112
|
-
|
|
235
|
+
// ----------------------------------------------------------
|
|
236
|
+
// ⭐ APPLY MASTER UPDATE (with isDefault CHECK for columns)
|
|
237
|
+
// ----------------------------------------------------------
|
|
238
|
+
setKanbanSettingsData((prev) => {
|
|
239
|
+
// FINAL RETURN
|
|
240
|
+
return {
|
|
241
|
+
...prev,
|
|
242
|
+
swim_lane: {
|
|
243
|
+
...prev.swim_lane,
|
|
244
|
+
show_list: newShowList,
|
|
245
|
+
hide_list: newHideList,
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const handleShowAll = () => {
|
|
252
|
+
setKanbanSettingsData((prev) => ({
|
|
113
253
|
...prev,
|
|
114
|
-
|
|
115
|
-
...prev
|
|
116
|
-
show_list:
|
|
117
|
-
|
|
254
|
+
swim_lane: {
|
|
255
|
+
...prev?.swim_lane,
|
|
256
|
+
show_list: [
|
|
257
|
+
...(prev?.swim_lane?.show_list || []),
|
|
258
|
+
...(prev?.swim_lane?.hide_list || []),
|
|
259
|
+
],
|
|
260
|
+
hide_list: [],
|
|
118
261
|
},
|
|
119
262
|
}));
|
|
120
263
|
};
|
|
121
264
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const hideList = [...(quickTabStates.hide_list ?? [])];
|
|
125
|
-
|
|
126
|
-
if (fromContainerId === "list") {
|
|
127
|
-
hideList.splice(hideList.indexOf(itemId), 1);
|
|
128
|
-
showList.push(itemId);
|
|
129
|
-
} else {
|
|
130
|
-
showList.splice(showList.indexOf(itemId), 1);
|
|
131
|
-
hideList.push(itemId);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
setSettingsData((prev) => ({
|
|
265
|
+
const handleHideAll = () => {
|
|
266
|
+
setKanbanSettingsData((prev) => ({
|
|
135
267
|
...prev,
|
|
136
|
-
|
|
137
|
-
...prev
|
|
138
|
-
|
|
139
|
-
|
|
268
|
+
swim_lane: {
|
|
269
|
+
...prev?.swim_lane,
|
|
270
|
+
hide_list: [
|
|
271
|
+
...(prev?.swim_lane?.hide_list || []),
|
|
272
|
+
...(prev?.swim_lane?.show_list || []),
|
|
273
|
+
],
|
|
274
|
+
show_list: [],
|
|
140
275
|
},
|
|
141
276
|
}));
|
|
142
277
|
};
|
|
143
278
|
|
|
144
|
-
const
|
|
145
|
-
{ label:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
279
|
+
const handleItemToggle = (
|
|
280
|
+
item: { label: string; value: string },
|
|
281
|
+
fromContainerId: string
|
|
282
|
+
) => {
|
|
283
|
+
setKanbanSettingsData((prev) => {
|
|
284
|
+
const toShowList = [...(kanbanSettingsData?.swim_lane?.show_list ?? [])];
|
|
285
|
+
const toHideList = [...(kanbanSettingsData?.swim_lane?.hide_list ?? [])];
|
|
286
|
+
|
|
287
|
+
if (fromContainerId === "list") {
|
|
288
|
+
const index = toHideList.findIndex((i) => i.value == item.value);
|
|
289
|
+
if (index > -1) {
|
|
290
|
+
toHideList.splice(index, 1);
|
|
291
|
+
toShowList.push(item);
|
|
292
|
+
// 🌟 ALSO create sorting tab entry if missing
|
|
293
|
+
}
|
|
294
|
+
} else if (fromContainerId === "tabs") {
|
|
295
|
+
const index = toShowList.findIndex((i) => i.value == item.value);
|
|
296
|
+
if (index > -1) {
|
|
297
|
+
toShowList.splice(index, 1);
|
|
298
|
+
toHideList.push(item);
|
|
299
|
+
// let itemIndex =
|
|
300
|
+
// filterSettingStates?.quickTabStates?.show_list?.findIndex(
|
|
301
|
+
// (i) => i.value == item.value
|
|
302
|
+
// );
|
|
303
|
+
// 🔥 REMOVE COLUMN WHEN TAB REMOVED (if not default)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
...prev,
|
|
308
|
+
swim_lane: {
|
|
309
|
+
...prev?.swim_lane,
|
|
310
|
+
show_list: toShowList,
|
|
311
|
+
hide_list: toHideList,
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const enableDND =
|
|
318
|
+
isSourceAttribute && kanbanSettingsData?.swim_lane?.sorting === "custom";
|
|
151
319
|
|
|
152
320
|
return (
|
|
153
321
|
<Box sx={{ display: "flex", flexDirection: "column", height: "100%" }}>
|
|
@@ -156,54 +324,68 @@ const GroupBy = ({
|
|
|
156
324
|
</Typography>
|
|
157
325
|
|
|
158
326
|
<Grid sx={{ position: "relative" }} container>
|
|
327
|
+
{/* Attribute + Sort */}
|
|
159
328
|
<Grid size={12}>
|
|
160
329
|
<Grid sx={TabsStyles.mainTabDropdown} size={6}>
|
|
161
330
|
<FormControl sx={TabsStyles.mainTabSelect} size="small">
|
|
162
331
|
<Select
|
|
163
|
-
value={
|
|
332
|
+
value={kanbanSettingsData?.swim_lane?.attribute || ""}
|
|
164
333
|
onChange={(e) =>
|
|
165
|
-
|
|
334
|
+
setKanbanSettingsData((prev) => ({
|
|
166
335
|
...prev,
|
|
167
|
-
|
|
168
|
-
...prev
|
|
336
|
+
swim_lane: {
|
|
337
|
+
...prev?.swim_lane,
|
|
169
338
|
attribute: e.target.value,
|
|
170
339
|
},
|
|
171
340
|
}))
|
|
172
341
|
}
|
|
173
342
|
>
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
343
|
+
{selectSwinLandData
|
|
344
|
+
?.filter(
|
|
345
|
+
(i) => i?.value !== kanbanSettingsData?.lane?.attribute
|
|
346
|
+
)
|
|
347
|
+
?.map((lane: any) => (
|
|
348
|
+
<MenuItem key={lane?.key} value={lane?.value}>
|
|
349
|
+
{lane?.label}
|
|
350
|
+
</MenuItem>
|
|
351
|
+
))}
|
|
179
352
|
</Select>
|
|
180
353
|
</FormControl>
|
|
181
354
|
|
|
182
355
|
<FormControl sx={TabsStyles.selectDropdownSeparator} size="small">
|
|
183
356
|
<Select
|
|
184
|
-
|
|
185
|
-
|
|
357
|
+
value={kanbanSettingsData?.swim_lane?.sorting || "asc"}
|
|
358
|
+
disabled={isStatusAttribute}
|
|
186
359
|
onChange={(e) =>
|
|
187
|
-
|
|
360
|
+
setKanbanSettingsData((prev) => ({
|
|
188
361
|
...prev,
|
|
189
|
-
|
|
190
|
-
...prev
|
|
362
|
+
swim_lane: {
|
|
363
|
+
...prev?.swim_lane,
|
|
191
364
|
sorting: e.target.value,
|
|
192
365
|
},
|
|
193
366
|
}))
|
|
194
367
|
}
|
|
195
368
|
>
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
369
|
+
{isStatusAttribute && (
|
|
370
|
+
<MenuItem value="sort_by" disabled>
|
|
371
|
+
Sort By
|
|
372
|
+
</MenuItem>
|
|
373
|
+
)}
|
|
374
|
+
|
|
375
|
+
{!isStatusAttribute &&
|
|
376
|
+
sortingOptions
|
|
377
|
+
.filter((option) => option.value !== "sort_by")
|
|
378
|
+
.map((option) => (
|
|
379
|
+
<MenuItem key={option.value} value={option.value}>
|
|
380
|
+
{option.label}
|
|
381
|
+
</MenuItem>
|
|
382
|
+
))}
|
|
202
383
|
</Select>
|
|
203
384
|
</FormControl>
|
|
204
385
|
</Grid>
|
|
205
386
|
</Grid>
|
|
206
387
|
|
|
388
|
+
{/* Lists */}
|
|
207
389
|
<DndContext
|
|
208
390
|
sensors={sensors}
|
|
209
391
|
collisionDetection={closestCenter}
|
|
@@ -212,8 +394,9 @@ const GroupBy = ({
|
|
|
212
394
|
<Grid sx={{ mt: 2 }} container spacing={2} size={12}>
|
|
213
395
|
<ListingValues
|
|
214
396
|
buttonText="Show All"
|
|
397
|
+
onClick={handleShowAll}
|
|
215
398
|
headerText="List of Values"
|
|
216
|
-
filteredValues={
|
|
399
|
+
filteredValues={filteredListValues}
|
|
217
400
|
searchTerm={searchTerm}
|
|
218
401
|
setSearchTerm={setSearchTerm}
|
|
219
402
|
containerId="list"
|
|
@@ -224,9 +407,10 @@ const GroupBy = ({
|
|
|
224
407
|
|
|
225
408
|
<ListingValues
|
|
226
409
|
buttonText="Hide All"
|
|
410
|
+
onClick={handleHideAll}
|
|
227
411
|
headerText="View as Lanes"
|
|
228
|
-
filteredValues={
|
|
229
|
-
containerId="
|
|
412
|
+
filteredValues={showListValues}
|
|
413
|
+
containerId="tabs"
|
|
230
414
|
onItemToggle={handleItemToggle}
|
|
231
415
|
enableDragAndDrop={enableDND}
|
|
232
416
|
/>
|
|
@@ -237,4 +421,4 @@ const GroupBy = ({
|
|
|
237
421
|
);
|
|
238
422
|
};
|
|
239
423
|
|
|
240
|
-
export default
|
|
424
|
+
export default SwimLane;
|
|
@@ -43,6 +43,9 @@ export function QuickFilterSettings({
|
|
|
43
43
|
activeTab,
|
|
44
44
|
selectAttributeData,
|
|
45
45
|
selectSwinLandData,
|
|
46
|
+
laneHideListData,
|
|
47
|
+
swimLaneHideListData,
|
|
48
|
+
onSaveKanbanSettingsData,
|
|
46
49
|
}: QuickFilterModalProps) {
|
|
47
50
|
const [tabValue, setTabValue] = useState(0);
|
|
48
51
|
const { container: fullscreenContainer } = useFullscreenPopoverContainer();
|
|
@@ -53,6 +56,7 @@ export function QuickFilterSettings({
|
|
|
53
56
|
columnTabState,
|
|
54
57
|
sortingTabState,
|
|
55
58
|
saveButtonError,
|
|
59
|
+
kanbanSettingsData,
|
|
56
60
|
} = filterSettingStates;
|
|
57
61
|
|
|
58
62
|
const hasAPIData = Boolean(Object.entries(columnsData).length);
|
|
@@ -100,6 +104,16 @@ export function QuickFilterSettings({
|
|
|
100
104
|
onClose && onClose();
|
|
101
105
|
};
|
|
102
106
|
|
|
107
|
+
const handleSaveKanbanSetSettingsData = () => {
|
|
108
|
+
const modifiedKanbanSettingsData = {
|
|
109
|
+
lane: kanbanSettingsData?.lane,
|
|
110
|
+
swim_lane: kanbanSettingsData?.swim_lane,
|
|
111
|
+
};
|
|
112
|
+
onSaveKanbanSettingsData &&
|
|
113
|
+
onSaveKanbanSettingsData(modifiedKanbanSettingsData);
|
|
114
|
+
onClose && onClose();
|
|
115
|
+
};
|
|
116
|
+
|
|
103
117
|
return (
|
|
104
118
|
<CustomDialog
|
|
105
119
|
open={show || showListViewSettings}
|
|
@@ -190,6 +204,7 @@ export function QuickFilterSettings({
|
|
|
190
204
|
filterSettingStates={filterSettingStates}
|
|
191
205
|
columnsData={columnsData}
|
|
192
206
|
selectAttributeData={selectAttributeData}
|
|
207
|
+
laneHideListData={laneHideListData}
|
|
193
208
|
/>
|
|
194
209
|
)}
|
|
195
210
|
</CustomTabPanel>
|
|
@@ -202,6 +217,7 @@ export function QuickFilterSettings({
|
|
|
202
217
|
filterSettingStates={filterSettingStates}
|
|
203
218
|
columnsData={columnsData}
|
|
204
219
|
selectSwinLandData={selectSwinLandData}
|
|
220
|
+
swimLaneHideListData={swimLaneHideListData}
|
|
205
221
|
/>
|
|
206
222
|
)}
|
|
207
223
|
</CustomTabPanel>
|
|
@@ -235,7 +251,7 @@ export function QuickFilterSettings({
|
|
|
235
251
|
)}
|
|
236
252
|
|
|
237
253
|
{view === "kanban" && tabValue === 1 && (
|
|
238
|
-
<CustomButton onClick={
|
|
254
|
+
<CustomButton onClick={handleSaveKanbanSetSettingsData}>
|
|
239
255
|
Save
|
|
240
256
|
</CustomButton>
|
|
241
257
|
)}
|
|
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
|
|
2
2
|
import { craftTableFilterSettingsOptionsProps } from "../../types/table-options";
|
|
3
3
|
import {
|
|
4
4
|
ColumnTabConfigProps,
|
|
5
|
+
KanbanSettingsDataProps,
|
|
5
6
|
QuickTabConfigProps,
|
|
6
7
|
SavedButtonErrorProps,
|
|
7
8
|
SettingsDataProps,
|
|
@@ -14,6 +15,8 @@ export function useCraftTableFilterSettings() {
|
|
|
14
15
|
useState<boolean>(false);
|
|
15
16
|
|
|
16
17
|
const [settingsData, setSettingsData] = useState<SettingsDataProps>({});
|
|
18
|
+
const [kanbanSettingsData, setKanbanSettingsData] =
|
|
19
|
+
useState<KanbanSettingsDataProps>({});
|
|
17
20
|
|
|
18
21
|
// Quick FIlter settings local states
|
|
19
22
|
|
|
@@ -46,6 +49,8 @@ export function useCraftTableFilterSettings() {
|
|
|
46
49
|
{
|
|
47
50
|
settingsData: settingsData,
|
|
48
51
|
setSettingsData: setSettingsData,
|
|
52
|
+
kanbanSettingsData: kanbanSettingsData,
|
|
53
|
+
setKanbanSettingsData: setKanbanSettingsData,
|
|
49
54
|
showListViewSettings: showListViewSettings,
|
|
50
55
|
setShowListViewSettings: setShowListViewSettings,
|
|
51
56
|
quickTabStates: quickTabStates,
|
|
@@ -347,14 +347,22 @@ export const useSaveSettingsDataAPI = (entity_type: string) => {
|
|
|
347
347
|
return { saveSettingsDataMutation };
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
-
export const useGetSettingsDataAPI = (entity_type: string) => {
|
|
351
|
-
const {
|
|
350
|
+
export const useGetSettingsDataAPI = (entity_type: string, type: string) => {
|
|
351
|
+
const {
|
|
352
|
+
data: getSettingsAPIData,
|
|
353
|
+
isSuccess: getSettingsAPIDataSuccess,
|
|
354
|
+
isPending: getSettingsAPIDataPending,
|
|
355
|
+
} = useQuery({
|
|
352
356
|
queryKey: ["getSettingsData", entity_type],
|
|
353
|
-
queryFn: () => getSettingsData(entity_type),
|
|
357
|
+
queryFn: () => getSettingsData(entity_type, type),
|
|
354
358
|
enabled: !!entity_type,
|
|
355
359
|
});
|
|
356
360
|
|
|
357
|
-
return {
|
|
361
|
+
return {
|
|
362
|
+
getSettingsAPIData,
|
|
363
|
+
getSettingsAPIDataSuccess,
|
|
364
|
+
getSettingsAPIDataPending,
|
|
365
|
+
};
|
|
358
366
|
};
|
|
359
367
|
|
|
360
368
|
export const useGetFilterEntityListAndCriteria = ({
|
|
@@ -142,11 +142,20 @@ export const saveSettingsData = async (payload: any) => {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
export const getSettingsData = async (entity_type:
|
|
145
|
+
export const getSettingsData = async (entity_type: string, type: string) => {
|
|
146
|
+
let url = `/meta/layout-preference`;
|
|
147
|
+
|
|
148
|
+
// if (entity_type === USER || entity_type === ROLE || entity_type === ORGP) {
|
|
149
|
+
// url = `sso/layout`;
|
|
150
|
+
// }
|
|
151
|
+
|
|
152
|
+
const params = {
|
|
153
|
+
entity_type: entity_type,
|
|
154
|
+
type: type,
|
|
155
|
+
};
|
|
156
|
+
|
|
146
157
|
try {
|
|
147
|
-
const response = await api.get(
|
|
148
|
-
`meta/layout-preference?entity_type=${entity_type}`
|
|
149
|
-
);
|
|
158
|
+
const response = await api.get(url, { params });
|
|
150
159
|
return response.data;
|
|
151
160
|
} catch (error) {
|
|
152
161
|
console.error("Failed to fetch settings data:", error);
|