rez-table-listing-mui 1.2.14 → 1.2.16
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 +8 -110
- 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/components/LeadCard.tsx +1 -1
- package/src/kanban/hooks/hooks.ts +2 -2
- package/src/kanban/index.tsx +50 -41
- package/src/kanban/services/service.ts +1 -1
- package/src/kanban/types/types.ts +22 -95
- package/src/listing/components/common/index.scss +1 -1
- package/src/listing/components/index.scss +0 -2
- package/src/listing/components/table-head-dnd-cell.tsx +5 -5
- package/src/listing/components/table-head.tsx +5 -5
- package/src/listing/components/table-settings/components/column.tsx +0 -5
- package/src/listing/components/table-settings/components/group-by.tsx +511 -0
- package/src/listing/components/table-settings/components/lane.tsx +510 -0
- package/src/listing/components/table-settings/components/sorting.tsx +0 -2
- package/src/listing/components/table-settings/constants.ts +12 -0
- package/src/listing/components/table-settings/index.tsx +61 -29
- package/src/listing/components/tabs/index.scss +1 -1
- package/src/listing/libs/hooks/useDefaultColumns.tsx +0 -1
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +0 -1
- package/src/listing/libs/utils/common.ts +1 -4
- package/src/listing/types/filter-settings.ts +1 -0
- package/src/view/KanbanView.tsx +58 -6
- package/src/view/ListingView.tsx +1 -3
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Select,
|
|
5
|
+
MenuItem,
|
|
6
|
+
FormControl,
|
|
7
|
+
Typography,
|
|
8
|
+
Checkbox,
|
|
9
|
+
FormControlLabel,
|
|
10
|
+
Grid,
|
|
11
|
+
Alert,
|
|
12
|
+
} from "@mui/material";
|
|
13
|
+
|
|
14
|
+
import ListingValues from "../common/listing-values";
|
|
15
|
+
import {
|
|
16
|
+
DndContext,
|
|
17
|
+
closestCenter,
|
|
18
|
+
KeyboardSensor,
|
|
19
|
+
MouseSensor,
|
|
20
|
+
TouchSensor,
|
|
21
|
+
useSensor,
|
|
22
|
+
useSensors,
|
|
23
|
+
DragEndEvent,
|
|
24
|
+
} from "@dnd-kit/core";
|
|
25
|
+
import {
|
|
26
|
+
QuickTabConfigProps,
|
|
27
|
+
SettingsQuickTabProps,
|
|
28
|
+
} from "../../../types/filter-settings";
|
|
29
|
+
import { TabsStyles } from "../style";
|
|
30
|
+
import InfoAlert from "../common/info-alert";
|
|
31
|
+
import { craftTableFilterSettingsOptionsProps } from "../../../types/table-options";
|
|
32
|
+
import { LANE_SELECTS } from "../constants";
|
|
33
|
+
|
|
34
|
+
const Lane = ({
|
|
35
|
+
filterSettingStates,
|
|
36
|
+
columnsData,
|
|
37
|
+
tabsApiData,
|
|
38
|
+
tabsApiDataLoading,
|
|
39
|
+
}: {
|
|
40
|
+
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
41
|
+
columnsData: any;
|
|
42
|
+
tabsApiData?: string[];
|
|
43
|
+
tabsApiDataLoading?: boolean;
|
|
44
|
+
}) => {
|
|
45
|
+
const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
|
|
46
|
+
filterSettingStates;
|
|
47
|
+
|
|
48
|
+
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
49
|
+
const [currentQuickAttribute, setCurrentQuickAttribute] = useState<string>(
|
|
50
|
+
settingsData?.quick_tab?.attribute || ""
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const quickTabStates = settingsData?.quick_tab as any;
|
|
54
|
+
|
|
55
|
+
// In case there is no quick tab state from API
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const stateToArray =
|
|
58
|
+
(quickTabStates && Object.entries(quickTabStates)) || [];
|
|
59
|
+
const isEmptyState = stateToArray.length ? false : true;
|
|
60
|
+
|
|
61
|
+
if (isEmptyState) {
|
|
62
|
+
setSettingsData((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
quick_tab: {
|
|
65
|
+
...prev?.quick_tab,
|
|
66
|
+
attribute: LANE_SELECTS[0].value,
|
|
67
|
+
sorting: "asc",
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}, [columnsData]);
|
|
72
|
+
|
|
73
|
+
// When user changes attribute
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (currentQuickAttribute === settingsData?.quick_tab?.attribute) return;
|
|
76
|
+
|
|
77
|
+
if (tabsApiData?.length) {
|
|
78
|
+
setSettingsData((prev) => ({
|
|
79
|
+
...prev,
|
|
80
|
+
quick_tab: {
|
|
81
|
+
...prev?.quick_tab,
|
|
82
|
+
hide_list: tabsApiData,
|
|
83
|
+
show_list: [],
|
|
84
|
+
},
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
setCurrentQuickAttribute(settingsData?.quick_tab?.attribute || "");
|
|
88
|
+
}
|
|
89
|
+
}, [tabsApiData]);
|
|
90
|
+
|
|
91
|
+
// Validation when user changes show list or hide list
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const showList = quickTabStates?.show_list || [];
|
|
94
|
+
const hideList = quickTabStates?.hide_list || [];
|
|
95
|
+
|
|
96
|
+
if (showList || hideList) {
|
|
97
|
+
// Check if showList is valid (between 1 and 5 items)
|
|
98
|
+
const isValidShowList = showList.length > 0 && showList.length <= 5;
|
|
99
|
+
const ERROR_CODE = "quick_tab_error";
|
|
100
|
+
|
|
101
|
+
if (!isValidShowList) {
|
|
102
|
+
const errorMessage = {
|
|
103
|
+
type: ERROR_CODE,
|
|
104
|
+
message:
|
|
105
|
+
showList.length === 0
|
|
106
|
+
? "Quick Lane: Please select at least one item"
|
|
107
|
+
: "Quick Lane: Please select no more than 5 items",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Check if the error is already present in the messages array
|
|
111
|
+
const hasQuickTabError = saveButtonError?.messages?.some(
|
|
112
|
+
(message) => message.type === ERROR_CODE
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
// Update the error state
|
|
116
|
+
|
|
117
|
+
// Later we can use this to show error message when we will make error logic more simple
|
|
118
|
+
// setSaveButtonError((prev) => {
|
|
119
|
+
// const otherMessages =
|
|
120
|
+
// prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
|
|
121
|
+
// [];
|
|
122
|
+
|
|
123
|
+
// return {
|
|
124
|
+
// ...prev,
|
|
125
|
+
// hasError: true,
|
|
126
|
+
// messages: hasQuickTabError
|
|
127
|
+
// ? [...prev?.messages]
|
|
128
|
+
// : [...otherMessages, errorMessage],
|
|
129
|
+
// };
|
|
130
|
+
// });
|
|
131
|
+
} else {
|
|
132
|
+
const hasOtherMessages = saveButtonError?.messages?.some(
|
|
133
|
+
(message) => message.type !== ERROR_CODE
|
|
134
|
+
);
|
|
135
|
+
// Reset error state if the list is valid
|
|
136
|
+
// setSaveButtonError((prev) => ({
|
|
137
|
+
// ...prev,
|
|
138
|
+
// hasError: hasOtherMessages,
|
|
139
|
+
// messages:
|
|
140
|
+
// prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
|
|
141
|
+
// [],
|
|
142
|
+
// }));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, [quickTabStates?.hide_list, quickTabStates?.show_list]);
|
|
146
|
+
|
|
147
|
+
const sortingOptions = [
|
|
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
|
+
// Convert show_list/hide_list to FilterValue[] for rendering only
|
|
156
|
+
const showListValues = (quickTabStates?.show_list || [])?.map((id: any) => ({
|
|
157
|
+
id,
|
|
158
|
+
label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
|
|
159
|
+
}));
|
|
160
|
+
const hideListValues = (quickTabStates?.hide_list || [])?.map((id: any) => ({
|
|
161
|
+
id,
|
|
162
|
+
label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
|
|
163
|
+
}));
|
|
164
|
+
|
|
165
|
+
const sensors = useSensors(
|
|
166
|
+
useSensor(MouseSensor),
|
|
167
|
+
useSensor(TouchSensor),
|
|
168
|
+
useSensor(KeyboardSensor)
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
// Drag and drop logic, update only local state
|
|
172
|
+
const handleDragEnd = (event: DragEndEvent) => {
|
|
173
|
+
const { active, over } = event;
|
|
174
|
+
if (!over) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const currentContainer = active.data.current?.containerId;
|
|
178
|
+
const overContainer = over.data.current?.containerId;
|
|
179
|
+
if (!currentContainer || !overContainer) return;
|
|
180
|
+
if (currentContainer === overContainer) {
|
|
181
|
+
// Reorder within the same list
|
|
182
|
+
let newShowList = [...(quickTabStates.show_list ?? [])];
|
|
183
|
+
let newHideList = [...(quickTabStates.hide_list ?? [])];
|
|
184
|
+
if (currentContainer === "list") {
|
|
185
|
+
const oldIndex = newHideList.indexOf(String(active.id));
|
|
186
|
+
const newIndex = newHideList.indexOf(String(over.id));
|
|
187
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
188
|
+
const [removed] = newHideList.splice(oldIndex, 1);
|
|
189
|
+
newHideList.splice(newIndex, 0, removed);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
const oldIndex = newShowList.indexOf(String(active.id));
|
|
193
|
+
const newIndex = newShowList.indexOf(String(over.id));
|
|
194
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
195
|
+
const [removed] = newShowList.splice(oldIndex, 1);
|
|
196
|
+
newShowList.splice(newIndex, 0, removed);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
setSettingsData((prev) => ({
|
|
201
|
+
...prev,
|
|
202
|
+
quick_tab: {
|
|
203
|
+
...prev?.quick_tab,
|
|
204
|
+
show_list: newShowList,
|
|
205
|
+
hide_list: newHideList,
|
|
206
|
+
},
|
|
207
|
+
}));
|
|
208
|
+
} else {
|
|
209
|
+
// Move between lists
|
|
210
|
+
let newShowList = [...(quickTabStates.show_list ?? [])];
|
|
211
|
+
let newHideList = [...(quickTabStates.hide_list ?? [])];
|
|
212
|
+
if (currentContainer === "list" && overContainer === "lanes") {
|
|
213
|
+
if (newShowList.length >= 5) return; // prevent overflow
|
|
214
|
+
// Move from hide to show
|
|
215
|
+
|
|
216
|
+
const idx = newHideList.indexOf(String(active.id));
|
|
217
|
+
if (idx !== -1) {
|
|
218
|
+
newHideList.splice(idx, 1);
|
|
219
|
+
newShowList.push(String(active.id));
|
|
220
|
+
}
|
|
221
|
+
} else if (currentContainer === "lanes" && overContainer === "list") {
|
|
222
|
+
// Move from show to hide
|
|
223
|
+
const idx = newShowList.indexOf(String(active.id));
|
|
224
|
+
if (idx !== -1) {
|
|
225
|
+
newShowList.splice(idx, 1);
|
|
226
|
+
newHideList.push(String(active.id));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setSettingsData((prev) => ({
|
|
231
|
+
...prev,
|
|
232
|
+
quick_tab: {
|
|
233
|
+
...prev?.quick_tab,
|
|
234
|
+
show_list: newShowList,
|
|
235
|
+
hide_list: newHideList,
|
|
236
|
+
},
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const filteredListValues = hideListValues.filter((value: any) =>
|
|
242
|
+
value?.label?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
// Show All/Hide All logic (local only)
|
|
246
|
+
const handleShowAll = () => {
|
|
247
|
+
const currentShowList = quickTabStates.show_list || [];
|
|
248
|
+
const currentHideList = quickTabStates.hide_list || [];
|
|
249
|
+
|
|
250
|
+
const availableSlots = 5 - currentShowList.length;
|
|
251
|
+
|
|
252
|
+
if (availableSlots <= 0) return; // Already at limit
|
|
253
|
+
|
|
254
|
+
const limitedHideList = currentHideList.slice(0, availableSlots);
|
|
255
|
+
|
|
256
|
+
setSettingsData((prev) => ({
|
|
257
|
+
...prev,
|
|
258
|
+
quick_tab: {
|
|
259
|
+
...prev?.quick_tab,
|
|
260
|
+
show_list: [...currentShowList, ...limitedHideList],
|
|
261
|
+
hide_list: currentHideList.filter(
|
|
262
|
+
(item: string) => !limitedHideList.includes(item)
|
|
263
|
+
),
|
|
264
|
+
},
|
|
265
|
+
}));
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const handleHideAll = () => {
|
|
269
|
+
setSettingsData((prev) => ({
|
|
270
|
+
...prev,
|
|
271
|
+
quick_tab: {
|
|
272
|
+
...prev?.quick_tab,
|
|
273
|
+
hide_list: [
|
|
274
|
+
...(prev?.quick_tab?.hide_list || []),
|
|
275
|
+
...(prev?.quick_tab?.show_list || []),
|
|
276
|
+
],
|
|
277
|
+
show_list: [],
|
|
278
|
+
},
|
|
279
|
+
}));
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// Checkbox logic (local only)
|
|
283
|
+
const handleShowSubLaneChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
284
|
+
setSettingsData((prev) => ({
|
|
285
|
+
...prev,
|
|
286
|
+
quick_tab: {
|
|
287
|
+
...prev?.quick_tab,
|
|
288
|
+
showSubLane: e.target.checked,
|
|
289
|
+
},
|
|
290
|
+
}));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const handleShowColorColumnsChange = (
|
|
294
|
+
e: React.ChangeEvent<HTMLInputElement>
|
|
295
|
+
) => {
|
|
296
|
+
setSettingsData((prev) => ({
|
|
297
|
+
...prev,
|
|
298
|
+
quick_tab: {
|
|
299
|
+
...prev?.quick_tab,
|
|
300
|
+
showColorColumns: e.target.checked,
|
|
301
|
+
},
|
|
302
|
+
}));
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const handleItemToggle = (itemId: string, fromContainerId: string) => {
|
|
306
|
+
const toShowList = [...(quickTabStates.show_list ?? [])];
|
|
307
|
+
const toHideList = [...(quickTabStates.hide_list ?? [])];
|
|
308
|
+
|
|
309
|
+
if (fromContainerId === "list") {
|
|
310
|
+
if (toShowList.length >= 5) return; // prevent overflow
|
|
311
|
+
// Move from hide_list to show_list
|
|
312
|
+
const index = toHideList.indexOf(itemId);
|
|
313
|
+
if (index > -1) {
|
|
314
|
+
toHideList.splice(index, 1);
|
|
315
|
+
toShowList.push(itemId);
|
|
316
|
+
}
|
|
317
|
+
} else if (fromContainerId === "lanes") {
|
|
318
|
+
// Move from show_list to hide_list
|
|
319
|
+
const index = toShowList.indexOf(itemId);
|
|
320
|
+
if (index > -1) {
|
|
321
|
+
toShowList.splice(index, 1);
|
|
322
|
+
toHideList.push(itemId);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
setSettingsData((prev) => ({
|
|
327
|
+
...prev,
|
|
328
|
+
quick_tab: {
|
|
329
|
+
...prev?.quick_tab,
|
|
330
|
+
show_list: toShowList,
|
|
331
|
+
hide_list: toHideList,
|
|
332
|
+
},
|
|
333
|
+
}));
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const enableDND = quickTabStates?.sorting === "custom" ? true : false;
|
|
337
|
+
|
|
338
|
+
return (
|
|
339
|
+
<Box
|
|
340
|
+
sx={{
|
|
341
|
+
display: "flex",
|
|
342
|
+
flexDirection: "column",
|
|
343
|
+
// gap: "0.5rem",
|
|
344
|
+
height: "100%",
|
|
345
|
+
}}
|
|
346
|
+
>
|
|
347
|
+
<Typography variant="caption" sx={TabsStyles.mainTabsHeader}>
|
|
348
|
+
*Quick filter settings will be reflected in vertical lanes
|
|
349
|
+
</Typography>
|
|
350
|
+
<Box>
|
|
351
|
+
<Grid sx={{ position: "relative" }} container>
|
|
352
|
+
<Grid size={12}>
|
|
353
|
+
<Box>
|
|
354
|
+
<Grid sx={TabsStyles.mainTabDropdown} size={6}>
|
|
355
|
+
<FormControl sx={TabsStyles.mainTabSelect} size="small">
|
|
356
|
+
<Select
|
|
357
|
+
value={quickTabStates?.attribute || ""}
|
|
358
|
+
onChange={(e) =>
|
|
359
|
+
setSettingsData((prev) => ({
|
|
360
|
+
...prev,
|
|
361
|
+
quick_tab: {
|
|
362
|
+
...prev?.quick_tab,
|
|
363
|
+
attribute: e.target.value,
|
|
364
|
+
},
|
|
365
|
+
}))
|
|
366
|
+
}
|
|
367
|
+
displayEmpty
|
|
368
|
+
renderValue={(selected) => {
|
|
369
|
+
if (!selected) {
|
|
370
|
+
return <em>Select Attribute</em>;
|
|
371
|
+
}
|
|
372
|
+
return selected;
|
|
373
|
+
}}
|
|
374
|
+
>
|
|
375
|
+
{LANE_SELECTS?.map((lane: any) => (
|
|
376
|
+
<MenuItem key={lane?.key} value={lane?.value}>
|
|
377
|
+
{lane?.value}
|
|
378
|
+
</MenuItem>
|
|
379
|
+
))}
|
|
380
|
+
</Select>
|
|
381
|
+
</FormControl>
|
|
382
|
+
<FormControl
|
|
383
|
+
sx={TabsStyles.selectDropdownSeparator}
|
|
384
|
+
size="small"
|
|
385
|
+
>
|
|
386
|
+
<Select
|
|
387
|
+
value={quickTabStates?.sorting || "asc"}
|
|
388
|
+
onChange={(e) =>
|
|
389
|
+
setSettingsData((prev) => ({
|
|
390
|
+
...prev,
|
|
391
|
+
quick_tab: {
|
|
392
|
+
...prev?.quick_tab,
|
|
393
|
+
sorting: e.target.value,
|
|
394
|
+
},
|
|
395
|
+
}))
|
|
396
|
+
}
|
|
397
|
+
displayEmpty
|
|
398
|
+
renderValue={(selected) => {
|
|
399
|
+
if (!selected) {
|
|
400
|
+
return <em>Sort by</em>;
|
|
401
|
+
}
|
|
402
|
+
const option = sortingOptions.find(
|
|
403
|
+
(opt) => opt.value === selected
|
|
404
|
+
);
|
|
405
|
+
return option?.label || selected;
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
{sortingOptions.map((option) => (
|
|
409
|
+
<MenuItem key={option?.value} value={option?.value}>
|
|
410
|
+
{option?.label}
|
|
411
|
+
</MenuItem>
|
|
412
|
+
))}
|
|
413
|
+
</Select>
|
|
414
|
+
</FormControl>
|
|
415
|
+
</Grid>
|
|
416
|
+
</Box>
|
|
417
|
+
</Grid>
|
|
418
|
+
<Grid>
|
|
419
|
+
{/* <Alert
|
|
420
|
+
severity="info"
|
|
421
|
+
sx={{
|
|
422
|
+
fontSize: "12px",
|
|
423
|
+
color: "#088AB2",
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
Please select at least 1 and at most 5 values to display as lanes.
|
|
427
|
+
</Alert> */}
|
|
428
|
+
</Grid>
|
|
429
|
+
<DndContext
|
|
430
|
+
sensors={sensors}
|
|
431
|
+
collisionDetection={closestCenter}
|
|
432
|
+
onDragEnd={handleDragEnd}
|
|
433
|
+
>
|
|
434
|
+
<Grid sx={{ mt: 2 }} container spacing={2} size={12}>
|
|
435
|
+
<ListingValues
|
|
436
|
+
buttonText="Show All"
|
|
437
|
+
onClick={handleShowAll}
|
|
438
|
+
headerText="List of Values"
|
|
439
|
+
filteredValues={filteredListValues}
|
|
440
|
+
searchTerm={searchTerm}
|
|
441
|
+
setSearchTerm={setSearchTerm}
|
|
442
|
+
containerId="list"
|
|
443
|
+
tabsApiDataLoading={tabsApiDataLoading}
|
|
444
|
+
onItemToggle={handleItemToggle}
|
|
445
|
+
enableDragAndDrop={enableDND}
|
|
446
|
+
/>
|
|
447
|
+
<ListingValues
|
|
448
|
+
buttonText="Hide All"
|
|
449
|
+
onClick={handleHideAll}
|
|
450
|
+
headerText="View as Lanes"
|
|
451
|
+
filteredValues={showListValues}
|
|
452
|
+
containerId="lanes"
|
|
453
|
+
// tabsApiDataLoading={tabsApiDataLoading}
|
|
454
|
+
onItemToggle={handleItemToggle}
|
|
455
|
+
enableDragAndDrop={enableDND}
|
|
456
|
+
AlertComponenet={
|
|
457
|
+
<InfoAlert
|
|
458
|
+
message="Please select at least 1 and at most 5 values to display as
|
|
459
|
+
lanes."
|
|
460
|
+
width={"49%"}
|
|
461
|
+
position="absolute"
|
|
462
|
+
color="#088AB2"
|
|
463
|
+
top={10}
|
|
464
|
+
zIndex={1}
|
|
465
|
+
/>
|
|
466
|
+
}
|
|
467
|
+
/>
|
|
468
|
+
</Grid>
|
|
469
|
+
</DndContext>
|
|
470
|
+
<Grid size={12}>
|
|
471
|
+
<Box sx={TabsStyles.checkboxStyle}>
|
|
472
|
+
<FormControlLabel
|
|
473
|
+
control={
|
|
474
|
+
<Checkbox
|
|
475
|
+
checked={quickTabStates?.showSubLane || false}
|
|
476
|
+
onChange={handleShowSubLaneChange}
|
|
477
|
+
size="small"
|
|
478
|
+
sx={{
|
|
479
|
+
"&.Mui-checked": {
|
|
480
|
+
color: "#7A5AF8",
|
|
481
|
+
},
|
|
482
|
+
}}
|
|
483
|
+
/>
|
|
484
|
+
}
|
|
485
|
+
label="Show Sublane"
|
|
486
|
+
/>
|
|
487
|
+
<FormControlLabel
|
|
488
|
+
control={
|
|
489
|
+
<Checkbox
|
|
490
|
+
checked={quickTabStates?.showColorColumns || false}
|
|
491
|
+
onChange={handleShowColorColumnsChange}
|
|
492
|
+
size="small"
|
|
493
|
+
sx={{
|
|
494
|
+
"&.Mui-checked": {
|
|
495
|
+
color: "#7A5AF8",
|
|
496
|
+
},
|
|
497
|
+
}}
|
|
498
|
+
/>
|
|
499
|
+
}
|
|
500
|
+
label="Show Color columns"
|
|
501
|
+
/>
|
|
502
|
+
</Box>
|
|
503
|
+
</Grid>
|
|
504
|
+
</Grid>
|
|
505
|
+
</Box>
|
|
506
|
+
</Box>
|
|
507
|
+
);
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
export default Lane;
|
|
@@ -6,6 +6,18 @@ export const SETTINGS_TABS: { label: string }[] = [
|
|
|
6
6
|
{ label: "Sorting" },
|
|
7
7
|
];
|
|
8
8
|
|
|
9
|
+
export const KANBAN_SETTINGS_TABS: { label: string }[] = [
|
|
10
|
+
{ label: "Lane" },
|
|
11
|
+
{ label: "Group By" },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const LANE_SELECTS = [
|
|
15
|
+
{ key: "stage_group", value: "Stage Group" },
|
|
16
|
+
{ key: "stage", value: "Stage" },
|
|
17
|
+
{ key: "source", value: "Source" },
|
|
18
|
+
{ key: "status", value: "Status" },
|
|
19
|
+
];
|
|
20
|
+
|
|
9
21
|
export const TOGGLE_BUTTON_TABS: ToggleButtonTabsProps[] = [
|
|
10
22
|
{ label: "Default", value: true, isDisabled: false },
|
|
11
23
|
{ label: "Tab Wise", value: false, isDisabled: false },
|
|
@@ -17,10 +17,13 @@ import { QuickFilterModalProps } from "../../types/filter-settings";
|
|
|
17
17
|
import { CustomDialog, DialogTransition } from "./components/custom-dialog";
|
|
18
18
|
import { dialogStyles } from "./style";
|
|
19
19
|
import CustomButton from "./components/custom-button";
|
|
20
|
-
import { SETTINGS_TABS } from "./constants";
|
|
20
|
+
import { KANBAN_SETTINGS_TABS, SETTINGS_TABS } from "./constants";
|
|
21
21
|
import Loader from "../common/loader/loader";
|
|
22
|
+
import Lane from "./components/lane";
|
|
23
|
+
import GroupBy from "./components/group-by";
|
|
22
24
|
|
|
23
25
|
export function QuickFilterSettings({
|
|
26
|
+
view = "listing",
|
|
24
27
|
show,
|
|
25
28
|
filterSettingStates,
|
|
26
29
|
onClose,
|
|
@@ -108,38 +111,67 @@ export function QuickFilterSettings({
|
|
|
108
111
|
<CustomVerticalTabs
|
|
109
112
|
value={tabValue}
|
|
110
113
|
onChange={handleTabChange}
|
|
111
|
-
tabItems={
|
|
114
|
+
tabItems={
|
|
115
|
+
view === "listing" ? SETTINGS_TABS : KANBAN_SETTINGS_TABS
|
|
116
|
+
}
|
|
112
117
|
/>
|
|
113
118
|
|
|
114
119
|
<Box sx={{ flex: "1" }}>
|
|
115
|
-
|
|
116
|
-
{tabValue
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
{view.toLowerCase() === "listing" && (
|
|
121
|
+
<CustomTabPanel value={tabValue} index={0}>
|
|
122
|
+
{tabValue === 0 && (
|
|
123
|
+
<QuickTab
|
|
124
|
+
filterSettingStates={filterSettingStates}
|
|
125
|
+
columnsData={columnsData}
|
|
126
|
+
tabsApiData={tabsApiData}
|
|
127
|
+
tabsApiDataLoading={tabsApiDataLoading}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
</CustomTabPanel>
|
|
131
|
+
)}
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
{tabValue
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
{view.toLowerCase() === "listing" && (
|
|
134
|
+
<CustomTabPanel value={tabValue} index={1}>
|
|
135
|
+
{tabValue === 1 && (
|
|
136
|
+
<Column
|
|
137
|
+
filterSettingStates={filterSettingStates}
|
|
138
|
+
columnsData={columnsData}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
</CustomTabPanel>
|
|
142
|
+
)}
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
{tabValue
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
{view.toLowerCase() === "listing" && (
|
|
145
|
+
<CustomTabPanel value={tabValue} index={2}>
|
|
146
|
+
{tabValue === 2 && (
|
|
147
|
+
<Sorting
|
|
148
|
+
filterSettingStates={filterSettingStates}
|
|
149
|
+
columnsData={columnsData}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
</CustomTabPanel>
|
|
153
|
+
)}
|
|
154
|
+
{view.toLowerCase() === "kanban" && (
|
|
155
|
+
<CustomTabPanel value={tabValue} index={0}>
|
|
156
|
+
{tabValue === 0 && (
|
|
157
|
+
<Lane
|
|
158
|
+
filterSettingStates={filterSettingStates}
|
|
159
|
+
columnsData={columnsData}
|
|
160
|
+
/>
|
|
161
|
+
)}
|
|
162
|
+
</CustomTabPanel>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
{view.toLowerCase() === "kanban" && (
|
|
166
|
+
<CustomTabPanel value={tabValue} index={1}>
|
|
167
|
+
{tabValue === 1 && (
|
|
168
|
+
<GroupBy
|
|
169
|
+
filterSettingStates={filterSettingStates}
|
|
170
|
+
columnsData={columnsData}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
</CustomTabPanel>
|
|
174
|
+
)}
|
|
143
175
|
</Box>
|
|
144
176
|
</>
|
|
145
177
|
)}
|
|
@@ -152,7 +184,7 @@ export function QuickFilterSettings({
|
|
|
152
184
|
disabled={saveButtonError?.hasError}
|
|
153
185
|
onClick={handleSaveSetSettingsData}
|
|
154
186
|
>
|
|
155
|
-
Save Quick Filter
|
|
187
|
+
{view === "listing" ? "Save Quick Filter" : "Save Kanban Layout"}
|
|
156
188
|
</CustomButton>
|
|
157
189
|
</DialogActions>
|
|
158
190
|
)}
|