rez-table-listing-mui 2.0.13 → 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 +51 -2
- 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 +38 -1
- package/src/listing/components/filter/components/attributes-filter.tsx +1 -1
- package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +4 -2
- package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +36 -1
- package/src/listing/components/login/index.tsx +3 -3
- package/src/listing/components/table-settings/components/lane.tsx +313 -366
- package/src/listing/components/table-settings/components/swim-lane.tsx +424 -0
- package/src/listing/components/table-settings/constants.ts +2 -1
- package/src/listing/components/table-settings/index.tsx +74 -31
- package/src/listing/libs/hooks/useCraftTableFilterSettings.tsx +5 -0
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +20 -6
- package/src/listing/libs/utils/apiColumn.ts +61 -6
- package/src/listing/libs/utils/common.ts +5 -3
- package/src/listing/types/common.ts +1 -0
- package/src/listing/types/filter-settings.ts +31 -0
- package/src/listing/types/filter.ts +2 -1
- package/src/listing/types/table-options.ts +3 -0
- package/src/view/KanbanView.tsx +70 -7
- package/src/view/ListingView.tsx +5 -20
- package/src/listing/components/table-settings/components/group-by.tsx +0 -511
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Select,
|
|
5
|
+
MenuItem,
|
|
6
|
+
FormControl,
|
|
7
|
+
Typography,
|
|
8
|
+
Checkbox,
|
|
9
|
+
FormControlLabel,
|
|
10
|
+
Grid,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
|
|
13
|
+
import ListingValues from "../common/listing-values";
|
|
14
|
+
import {
|
|
15
|
+
DndContext,
|
|
16
|
+
closestCenter,
|
|
17
|
+
KeyboardSensor,
|
|
18
|
+
MouseSensor,
|
|
19
|
+
TouchSensor,
|
|
20
|
+
useSensor,
|
|
21
|
+
useSensors,
|
|
22
|
+
DragEndEvent,
|
|
23
|
+
} from "@dnd-kit/core";
|
|
24
|
+
import { TabsStyles } from "../style";
|
|
25
|
+
import { craftTableFilterSettingsOptionsProps } from "../../../types/table-options";
|
|
26
|
+
|
|
27
|
+
const SwimLane = ({
|
|
28
|
+
filterSettingStates,
|
|
29
|
+
tabsApiDataLoading,
|
|
30
|
+
selectSwinLandData,
|
|
31
|
+
swimLaneHideListData,
|
|
32
|
+
}: {
|
|
33
|
+
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
34
|
+
columnsData: any;
|
|
35
|
+
tabsApiData?: { label: string; value: string }[];
|
|
36
|
+
tabsApiDataLoading?: boolean;
|
|
37
|
+
selectSwinLandData?: { label: string; value: string }[];
|
|
38
|
+
swimLaneHideListData?: { label: string; value: string }[];
|
|
39
|
+
}) => {
|
|
40
|
+
const { kanbanSettingsData, setKanbanSettingsData } = filterSettingStates;
|
|
41
|
+
|
|
42
|
+
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
43
|
+
const [currentSwimLaneAttribute, setCurrentSwimLaneAttribute] =
|
|
44
|
+
useState<string>(kanbanSettingsData?.swim_lane?.attribute || "");
|
|
45
|
+
|
|
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";
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (isStatusAttribute) {
|
|
54
|
+
setKanbanSettingsData((prev) => ({
|
|
55
|
+
...prev,
|
|
56
|
+
swim_lane: {
|
|
57
|
+
...prev.swim_lane,
|
|
58
|
+
sorting: "sort_by",
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
}, [kanbanSettingsData?.swim_lane?.attribute]);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!isSourceAttribute) return;
|
|
66
|
+
|
|
67
|
+
setKanbanSettingsData((prev) => ({
|
|
68
|
+
...prev,
|
|
69
|
+
swim_lane: {
|
|
70
|
+
...prev.swim_lane,
|
|
71
|
+
sorting: "count_dsc",
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
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
|
+
);
|
|
181
|
+
|
|
182
|
+
const handleDragEnd = (event: DragEndEvent) => {
|
|
183
|
+
const { active, over } = event;
|
|
184
|
+
if (!over) return;
|
|
185
|
+
|
|
186
|
+
const currentContainer = active.data.current?.containerId;
|
|
187
|
+
const overContainer = over.data.current?.containerId;
|
|
188
|
+
|
|
189
|
+
if (!currentContainer || !overContainer) return;
|
|
190
|
+
|
|
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
|
+
}
|
|
211
|
+
}
|
|
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
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
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) => ({
|
|
253
|
+
...prev,
|
|
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: [],
|
|
261
|
+
},
|
|
262
|
+
}));
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const handleHideAll = () => {
|
|
266
|
+
setKanbanSettingsData((prev) => ({
|
|
267
|
+
...prev,
|
|
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: [],
|
|
275
|
+
},
|
|
276
|
+
}));
|
|
277
|
+
};
|
|
278
|
+
|
|
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";
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<Box sx={{ display: "flex", flexDirection: "column", height: "100%" }}>
|
|
322
|
+
<Typography variant="caption" sx={TabsStyles.mainTabsHeader}>
|
|
323
|
+
**Swim Lane settings will be reflected in vertical lanes
|
|
324
|
+
</Typography>
|
|
325
|
+
|
|
326
|
+
<Grid sx={{ position: "relative" }} container>
|
|
327
|
+
{/* Attribute + Sort */}
|
|
328
|
+
<Grid size={12}>
|
|
329
|
+
<Grid sx={TabsStyles.mainTabDropdown} size={6}>
|
|
330
|
+
<FormControl sx={TabsStyles.mainTabSelect} size="small">
|
|
331
|
+
<Select
|
|
332
|
+
value={kanbanSettingsData?.swim_lane?.attribute || ""}
|
|
333
|
+
onChange={(e) =>
|
|
334
|
+
setKanbanSettingsData((prev) => ({
|
|
335
|
+
...prev,
|
|
336
|
+
swim_lane: {
|
|
337
|
+
...prev?.swim_lane,
|
|
338
|
+
attribute: e.target.value,
|
|
339
|
+
},
|
|
340
|
+
}))
|
|
341
|
+
}
|
|
342
|
+
>
|
|
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
|
+
))}
|
|
352
|
+
</Select>
|
|
353
|
+
</FormControl>
|
|
354
|
+
|
|
355
|
+
<FormControl sx={TabsStyles.selectDropdownSeparator} size="small">
|
|
356
|
+
<Select
|
|
357
|
+
value={kanbanSettingsData?.swim_lane?.sorting || "asc"}
|
|
358
|
+
disabled={isStatusAttribute}
|
|
359
|
+
onChange={(e) =>
|
|
360
|
+
setKanbanSettingsData((prev) => ({
|
|
361
|
+
...prev,
|
|
362
|
+
swim_lane: {
|
|
363
|
+
...prev?.swim_lane,
|
|
364
|
+
sorting: e.target.value,
|
|
365
|
+
},
|
|
366
|
+
}))
|
|
367
|
+
}
|
|
368
|
+
>
|
|
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
|
+
))}
|
|
383
|
+
</Select>
|
|
384
|
+
</FormControl>
|
|
385
|
+
</Grid>
|
|
386
|
+
</Grid>
|
|
387
|
+
|
|
388
|
+
{/* Lists */}
|
|
389
|
+
<DndContext
|
|
390
|
+
sensors={sensors}
|
|
391
|
+
collisionDetection={closestCenter}
|
|
392
|
+
onDragEnd={handleDragEnd}
|
|
393
|
+
>
|
|
394
|
+
<Grid sx={{ mt: 2 }} container spacing={2} size={12}>
|
|
395
|
+
<ListingValues
|
|
396
|
+
buttonText="Show All"
|
|
397
|
+
onClick={handleShowAll}
|
|
398
|
+
headerText="List of Values"
|
|
399
|
+
filteredValues={filteredListValues}
|
|
400
|
+
searchTerm={searchTerm}
|
|
401
|
+
setSearchTerm={setSearchTerm}
|
|
402
|
+
containerId="list"
|
|
403
|
+
tabsApiDataLoading={tabsApiDataLoading}
|
|
404
|
+
onItemToggle={handleItemToggle}
|
|
405
|
+
enableDragAndDrop={enableDND}
|
|
406
|
+
/>
|
|
407
|
+
|
|
408
|
+
<ListingValues
|
|
409
|
+
buttonText="Hide All"
|
|
410
|
+
onClick={handleHideAll}
|
|
411
|
+
headerText="View as Lanes"
|
|
412
|
+
filteredValues={showListValues}
|
|
413
|
+
containerId="tabs"
|
|
414
|
+
onItemToggle={handleItemToggle}
|
|
415
|
+
enableDragAndDrop={enableDND}
|
|
416
|
+
/>
|
|
417
|
+
</Grid>
|
|
418
|
+
</DndContext>
|
|
419
|
+
</Grid>
|
|
420
|
+
</Box>
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
export default SwimLane;
|
|
@@ -8,7 +8,7 @@ export const SETTINGS_TABS: { label: string }[] = [
|
|
|
8
8
|
|
|
9
9
|
export const KANBAN_SETTINGS_TABS: { label: string }[] = [
|
|
10
10
|
{ label: "Lane" },
|
|
11
|
-
{ label: "
|
|
11
|
+
{ label: "Swim Lane" },
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
export const LANE_SELECTS = [
|
|
@@ -22,3 +22,4 @@ export const TOGGLE_BUTTON_TABS: ToggleButtonTabsProps[] = [
|
|
|
22
22
|
{ label: "Default", value: true, isDisabled: false },
|
|
23
23
|
{ label: "Tab Wise", value: false, isDisabled: false },
|
|
24
24
|
];
|
|
25
|
+
|
|
@@ -20,7 +20,7 @@ import CustomButton from "./components/custom-button";
|
|
|
20
20
|
import { KANBAN_SETTINGS_TABS, SETTINGS_TABS } from "./constants";
|
|
21
21
|
import Loader from "../common/loader/loader";
|
|
22
22
|
import Lane from "./components/lane";
|
|
23
|
-
import GroupBy from "./components/
|
|
23
|
+
import GroupBy from "./components/swim-lane";
|
|
24
24
|
import { useFullscreenPopoverContainer } from "../../libs/hooks/useFullScreen";
|
|
25
25
|
|
|
26
26
|
export function QuickFilterSettings({
|
|
@@ -41,6 +41,11 @@ export function QuickFilterSettings({
|
|
|
41
41
|
tabsApiDataLoading,
|
|
42
42
|
onSaveSettingsData,
|
|
43
43
|
activeTab,
|
|
44
|
+
selectAttributeData,
|
|
45
|
+
selectSwinLandData,
|
|
46
|
+
laneHideListData,
|
|
47
|
+
swimLaneHideListData,
|
|
48
|
+
onSaveKanbanSettingsData,
|
|
44
49
|
}: QuickFilterModalProps) {
|
|
45
50
|
const [tabValue, setTabValue] = useState(0);
|
|
46
51
|
const { container: fullscreenContainer } = useFullscreenPopoverContainer();
|
|
@@ -51,6 +56,7 @@ export function QuickFilterSettings({
|
|
|
51
56
|
columnTabState,
|
|
52
57
|
sortingTabState,
|
|
53
58
|
saveButtonError,
|
|
59
|
+
kanbanSettingsData,
|
|
54
60
|
} = filterSettingStates;
|
|
55
61
|
|
|
56
62
|
const hasAPIData = Boolean(Object.entries(columnsData).length);
|
|
@@ -66,27 +72,27 @@ export function QuickFilterSettings({
|
|
|
66
72
|
};
|
|
67
73
|
|
|
68
74
|
const handleSaveSetSettingsData = () => {
|
|
69
|
-
const copyColumnTabState =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const copySortingTabState =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
const copyColumnTabState = {
|
|
76
|
+
isDefault: columnTabState?.isDefault,
|
|
77
|
+
show_list: columnTabState?.show_list || [],
|
|
78
|
+
hide_list: columnTabState?.hide_list || [],
|
|
79
|
+
tabs: columnTabState?.tabs || [],
|
|
80
|
+
};
|
|
81
|
+
// : {
|
|
82
|
+
// isDefault: false,
|
|
83
|
+
// tabs: columnTabState?.tabs || [],
|
|
84
|
+
// };
|
|
85
|
+
// commented as per the requirement
|
|
86
|
+
const copySortingTabState = {
|
|
87
|
+
isDefault: sortingTabState?.isDefault,
|
|
88
|
+
sortby:
|
|
89
|
+
sortingTabState?.sortby?.filter((item) => item.column !== "") || [],
|
|
90
|
+
tabs: sortingTabState?.tabs || [],
|
|
91
|
+
};
|
|
92
|
+
// : {
|
|
93
|
+
// isDefault: false,
|
|
94
|
+
// tabs: sortingTabState?.tabs || [],
|
|
95
|
+
// };
|
|
90
96
|
|
|
91
97
|
const modifiedSettingsData = {
|
|
92
98
|
quick_tab: quickTabStates,
|
|
@@ -98,6 +104,16 @@ export function QuickFilterSettings({
|
|
|
98
104
|
onClose && onClose();
|
|
99
105
|
};
|
|
100
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
|
+
|
|
101
117
|
return (
|
|
102
118
|
<CustomDialog
|
|
103
119
|
open={show || showListViewSettings}
|
|
@@ -109,7 +125,12 @@ export function QuickFilterSettings({
|
|
|
109
125
|
container={fullscreenContainer}
|
|
110
126
|
>
|
|
111
127
|
<DialogTitle sx={dialogStyles.dialogTitle}>
|
|
112
|
-
<Typography sx={{ fontSize: "1.125rem" }}>
|
|
128
|
+
<Typography sx={{ fontSize: "1.125rem" }}>
|
|
129
|
+
{view === "listing"
|
|
130
|
+
? "Quick Filter Settings"
|
|
131
|
+
: "Kanban View Settings"}
|
|
132
|
+
</Typography>
|
|
133
|
+
|
|
113
134
|
<IconButton
|
|
114
135
|
size="small"
|
|
115
136
|
color="inherit"
|
|
@@ -182,6 +203,8 @@ export function QuickFilterSettings({
|
|
|
182
203
|
<Lane
|
|
183
204
|
filterSettingStates={filterSettingStates}
|
|
184
205
|
columnsData={columnsData}
|
|
206
|
+
selectAttributeData={selectAttributeData}
|
|
207
|
+
laneHideListData={laneHideListData}
|
|
185
208
|
/>
|
|
186
209
|
)}
|
|
187
210
|
</CustomTabPanel>
|
|
@@ -193,6 +216,8 @@ export function QuickFilterSettings({
|
|
|
193
216
|
<GroupBy
|
|
194
217
|
filterSettingStates={filterSettingStates}
|
|
195
218
|
columnsData={columnsData}
|
|
219
|
+
selectSwinLandData={selectSwinLandData}
|
|
220
|
+
swimLaneHideListData={swimLaneHideListData}
|
|
196
221
|
/>
|
|
197
222
|
)}
|
|
198
223
|
</CustomTabPanel>
|
|
@@ -203,15 +228,33 @@ export function QuickFilterSettings({
|
|
|
203
228
|
</DialogContent>
|
|
204
229
|
|
|
205
230
|
{!columnsDataLoading && hasAPIData && (
|
|
231
|
+
// <DialogActions>
|
|
232
|
+
// <CustomButton
|
|
233
|
+
// // disabled={saveButtonError?.hasError}
|
|
234
|
+
// // disabled={saveButtonError?.hasError}
|
|
235
|
+
// disabled={disbaledCondition}
|
|
236
|
+
// onClick={handleSaveSetSettingsData}
|
|
237
|
+
// >
|
|
238
|
+
// {view === "listing" ? "Save Quick Filter" : "Save Kanban Layout"}
|
|
239
|
+
// </CustomButton>
|
|
240
|
+
// </DialogActions>
|
|
206
241
|
<DialogActions>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
242
|
+
{view === "kanban" && tabValue === 0 && (
|
|
243
|
+
<>
|
|
244
|
+
<CustomButton onClick={handleSaveSetSettingsData}>
|
|
245
|
+
Save & Close
|
|
246
|
+
</CustomButton>
|
|
247
|
+
<CustomButton onClick={() => setTabValue(1)} variant="contained">
|
|
248
|
+
Next
|
|
249
|
+
</CustomButton>
|
|
250
|
+
</>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
{view === "kanban" && tabValue === 1 && (
|
|
254
|
+
<CustomButton onClick={handleSaveKanbanSetSettingsData}>
|
|
255
|
+
Save
|
|
256
|
+
</CustomButton>
|
|
257
|
+
)}
|
|
215
258
|
</DialogActions>
|
|
216
259
|
)}
|
|
217
260
|
</CustomDialog>
|
|
@@ -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,
|
|
@@ -4,7 +4,12 @@ import {
|
|
|
4
4
|
useQuery,
|
|
5
5
|
useQueryClient,
|
|
6
6
|
} from "@tanstack/react-query";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
api,
|
|
9
|
+
APP_CODE,
|
|
10
|
+
ENTITY_TYPE,
|
|
11
|
+
MAPPED_ENTITY_TYPE,
|
|
12
|
+
} from "../utils/common";
|
|
8
13
|
import {
|
|
9
14
|
APIParamsProps,
|
|
10
15
|
EntityListingResponse,
|
|
@@ -62,7 +67,7 @@ const entityListingCall = async ({
|
|
|
62
67
|
responseStatus: number;
|
|
63
68
|
data: EntityListingResponse;
|
|
64
69
|
}> => {
|
|
65
|
-
const url = `filter
|
|
70
|
+
const url = `filter/${APP_CODE}`;
|
|
66
71
|
|
|
67
72
|
const body = {
|
|
68
73
|
entity_type,
|
|
@@ -102,6 +107,7 @@ export const useEntityTableAPI = ({
|
|
|
102
107
|
],
|
|
103
108
|
attributeFilter = [],
|
|
104
109
|
flatJson,
|
|
110
|
+
module_code,
|
|
105
111
|
}: EntityTableAPIProps) => {
|
|
106
112
|
const { data, isPending: isTableDataPending } = useQuery({
|
|
107
113
|
queryKey: ["entityTable", page, size, tabs, quickFilter],
|
|
@@ -341,14 +347,22 @@ export const useSaveSettingsDataAPI = (entity_type: string) => {
|
|
|
341
347
|
return { saveSettingsDataMutation };
|
|
342
348
|
};
|
|
343
349
|
|
|
344
|
-
export const useGetSettingsDataAPI = (entity_type: string) => {
|
|
345
|
-
const {
|
|
350
|
+
export const useGetSettingsDataAPI = (entity_type: string, type: string) => {
|
|
351
|
+
const {
|
|
352
|
+
data: getSettingsAPIData,
|
|
353
|
+
isSuccess: getSettingsAPIDataSuccess,
|
|
354
|
+
isPending: getSettingsAPIDataPending,
|
|
355
|
+
} = useQuery({
|
|
346
356
|
queryKey: ["getSettingsData", entity_type],
|
|
347
|
-
queryFn: () => getSettingsData(entity_type),
|
|
357
|
+
queryFn: () => getSettingsData(entity_type, type),
|
|
348
358
|
enabled: !!entity_type,
|
|
349
359
|
});
|
|
350
360
|
|
|
351
|
-
return {
|
|
361
|
+
return {
|
|
362
|
+
getSettingsAPIData,
|
|
363
|
+
getSettingsAPIDataSuccess,
|
|
364
|
+
getSettingsAPIDataPending,
|
|
365
|
+
};
|
|
352
366
|
};
|
|
353
367
|
|
|
354
368
|
export const useGetFilterEntityListAndCriteria = ({
|