rez-table-listing-mui 1.3.44 → 1.3.46
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 +70 -9
- 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/listing/components/common/saved-filter-modal/index.tsx +517 -0
- package/src/listing/components/filter/components/attributes-filter.tsx +2 -2
- package/src/listing/components/filter/components/forms/components/Dropdown.tsx +2 -2
- package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +9 -7
- package/src/listing/components/filter/components/forms/components/Textfield.tsx +2 -4
- package/src/listing/components/filter/components/forms/components/filter-criteria-list.tsx +1 -0
- package/src/listing/components/filter/components/forms/index.tsx +23 -14
- package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +3 -3
- package/src/listing/components/filter/components/main-filter.tsx +6 -6
- package/src/listing/components/filter/components/saved-edit-filter.tsx +5 -3
- package/src/listing/components/filter/components/saved-filter.tsx +300 -124
- package/src/listing/components/filter/components/search/index.tsx +1 -0
- package/src/listing/components/filter/components/single-filter-rendering.tsx +3 -3
- package/src/listing/components/filter/index.tsx +130 -5
- package/src/listing/components/index-table.tsx +9 -0
- package/src/listing/components/login/index.tsx +3 -6
- package/src/listing/components/table-dnd.tsx +6 -0
- package/src/listing/components/table-head-dnd-cell.tsx +7 -0
- package/src/listing/components/table-head-popover.tsx +24 -3
- package/src/listing/components/table-head.tsx +10 -0
- package/src/listing/components/table-settings/components/column.tsx +85 -26
- package/src/listing/components/table-settings/components/quick-tab.tsx +395 -77
- package/src/listing/components/table-settings/components/sorting.tsx +60 -20
- package/src/listing/components/table-settings/index.tsx +12 -2
- package/src/listing/components/table.tsx +6 -0
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +20 -5
- package/src/listing/libs/utils/apiColumn.ts +8 -3
- package/src/listing/libs/utils/common.ts +2 -1
- package/src/listing/libs/utils/hydrate-saved-filters.ts +2 -2
- package/src/listing/types/common.ts +1 -0
- package/src/listing/types/filter-settings.ts +8 -2
- package/src/listing/types/filter.ts +51 -3
- package/src/listing/types/table.ts +9 -0
- package/src/view/FIlterWrapper.tsx +15 -0
- package/src/view/ListingView.tsx +179 -63
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
verticalListSortingStrategy,
|
|
30
30
|
} from "@dnd-kit/sortable";
|
|
31
31
|
import { AddIcon, CloseIcon } from "../../../../assets/svg";
|
|
32
|
+
import CustomToggleSwitchButton from "./toggle-button-switch";
|
|
33
|
+
import { TOGGLE_BUTTON_TABS } from "../constants";
|
|
32
34
|
|
|
33
35
|
const Sorting = ({
|
|
34
36
|
filterSettingStates,
|
|
@@ -38,7 +40,7 @@ const Sorting = ({
|
|
|
38
40
|
filterSettingStates;
|
|
39
41
|
|
|
40
42
|
const [activeTab, setActiveTab] = useState<string | undefined>(
|
|
41
|
-
quickTabStates?.show_list?.[0]
|
|
43
|
+
quickTabStates?.show_list?.[0]?.value
|
|
42
44
|
);
|
|
43
45
|
|
|
44
46
|
const columnTabState = settingsData?.column as ColumnTabConfigProps;
|
|
@@ -100,25 +102,55 @@ const Sorting = ({
|
|
|
100
102
|
{ column: "", order: "asc" },
|
|
101
103
|
];
|
|
102
104
|
|
|
103
|
-
//
|
|
105
|
+
// CASE 1: Initialize sorting if completely empty
|
|
104
106
|
if (!sortingTabState || Object.keys(sortingTabState).length === 0) {
|
|
105
|
-
setSettingsData((prev) => ({
|
|
106
|
-
...prev,
|
|
107
|
-
sorting: { isDefault: true, sortby: emptySortBy },
|
|
108
|
-
}));
|
|
109
|
-
return; // ✅ prevent further execution
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// if sortby is missing or empty
|
|
113
|
-
if (!sortingTabState?.sortby || sortingTabState?.sortby.length === 0) {
|
|
114
107
|
setSettingsData((prev) => ({
|
|
115
108
|
...prev,
|
|
116
109
|
sorting: {
|
|
117
|
-
...prev.sorting,
|
|
118
|
-
sortby: emptySortBy,
|
|
119
110
|
isDefault: true,
|
|
111
|
+
sortby: [],
|
|
120
112
|
},
|
|
121
113
|
}));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// CASE 2: sorting is default BUT missing sortby
|
|
118
|
+
// if (
|
|
119
|
+
// (!sortingTabState?.sortby || sortingTabState?.sortby.length === 0) &&
|
|
120
|
+
// sortingTabState?.isDefault
|
|
121
|
+
// ) {
|
|
122
|
+
// setSettingsData((prev) => ({
|
|
123
|
+
// ...prev,
|
|
124
|
+
// sorting: {
|
|
125
|
+
// ...prev.sorting,
|
|
126
|
+
// sortby: emptySortBy,
|
|
127
|
+
// isDefault: true,
|
|
128
|
+
// },
|
|
129
|
+
// }));
|
|
130
|
+
// return;
|
|
131
|
+
// }
|
|
132
|
+
|
|
133
|
+
// CASE 3: CUSTOM MODE → Populate tabs automatically
|
|
134
|
+
if (
|
|
135
|
+
sortingTabState?.isDefault === false &&
|
|
136
|
+
(!sortingTabState?.tabs || sortingTabState?.tabs.length === 0)
|
|
137
|
+
) {
|
|
138
|
+
setSettingsData((prev) => {
|
|
139
|
+
const quickTabs = prev.quick_tab?.show_list || [];
|
|
140
|
+
|
|
141
|
+
const generatedTabs = quickTabs.map((t) => ({
|
|
142
|
+
tab_name: { value: t.value, label: t.label },
|
|
143
|
+
sortby: emptySortBy,
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
...prev,
|
|
148
|
+
sorting: {
|
|
149
|
+
...prev.sorting,
|
|
150
|
+
tabs: generatedTabs,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
});
|
|
122
154
|
}
|
|
123
155
|
}, []);
|
|
124
156
|
|
|
@@ -143,8 +175,10 @@ const Sorting = ({
|
|
|
143
175
|
|
|
144
176
|
const sensors = useSensors(useSensor(PointerSensor));
|
|
145
177
|
|
|
146
|
-
const activeTabIndex =
|
|
147
|
-
(tab) =>
|
|
178
|
+
const activeTabIndex = columnTabState?.tabs?.findIndex(
|
|
179
|
+
(tab) =>
|
|
180
|
+
tab?.tab_name?.value == activeTab ||
|
|
181
|
+
tab?.tab_name?.label?.toLowerCase() == activeTab?.toLowerCase()
|
|
148
182
|
);
|
|
149
183
|
|
|
150
184
|
/**
|
|
@@ -159,9 +193,10 @@ const Sorting = ({
|
|
|
159
193
|
* * If activeTab is undefined
|
|
160
194
|
* * - Return an empty array
|
|
161
195
|
*/
|
|
196
|
+
|
|
162
197
|
const tabSortedList = useMemo(() => {
|
|
163
198
|
return isSortingDefault
|
|
164
|
-
? sortingTabState?.sortby
|
|
199
|
+
? sortingTabState?.sortby || [{ column: "", order: "asc" }]
|
|
165
200
|
: activeTab !== undefined
|
|
166
201
|
? sortingTabState?.tabs?.[activeTabIndex || 0]?.sortby
|
|
167
202
|
? sortingTabState?.tabs?.[activeTabIndex || 0]?.sortby
|
|
@@ -177,6 +212,11 @@ const Sorting = ({
|
|
|
177
212
|
const tabs = [...(prev?.sorting?.tabs || [])];
|
|
178
213
|
tabs[activeTabIndex || 0] = {
|
|
179
214
|
...tabs[activeTabIndex || 0],
|
|
215
|
+
tab_name: settingsData?.column?.tabs?.[activeTabIndex || 0]
|
|
216
|
+
?.tab_name || {
|
|
217
|
+
label: "",
|
|
218
|
+
value: "",
|
|
219
|
+
},
|
|
180
220
|
sortby: updated,
|
|
181
221
|
};
|
|
182
222
|
return { ...prev, sorting: { ...prev?.sorting, tabs } };
|
|
@@ -285,10 +325,10 @@ const Sorting = ({
|
|
|
285
325
|
hideList: columnTabState?.hide_list || [],
|
|
286
326
|
};
|
|
287
327
|
} else {
|
|
288
|
-
const currentTab =
|
|
328
|
+
const currentTab = sortingTabState?.tabs?.[activeTabIndex || 0];
|
|
289
329
|
return {
|
|
290
330
|
showList: columnsData || [],
|
|
291
|
-
hideList: currentTab?.hide_list || [],
|
|
331
|
+
// hideList: currentTab?.hide_list || [],
|
|
292
332
|
};
|
|
293
333
|
}
|
|
294
334
|
};
|
|
@@ -299,11 +339,11 @@ const Sorting = ({
|
|
|
299
339
|
<Box sx={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}>
|
|
300
340
|
<Typography>Select attribute(s) you want to sort by</Typography>
|
|
301
341
|
|
|
302
|
-
|
|
342
|
+
<CustomToggleSwitchButton
|
|
303
343
|
buttons={TOGGLE_BUTTON_TABS}
|
|
304
344
|
value={isSortingDefault}
|
|
305
345
|
onChange={handleModeChange}
|
|
306
|
-
/>
|
|
346
|
+
/>
|
|
307
347
|
|
|
308
348
|
{hasShowListQuickTabs ? (
|
|
309
349
|
<>
|
|
@@ -32,11 +32,14 @@ export function QuickFilterSettings({
|
|
|
32
32
|
columnsDataLoading,
|
|
33
33
|
quickTabAttributes,
|
|
34
34
|
quickTabAttributesLoading,
|
|
35
|
+
columnTabAttributes,
|
|
36
|
+
columnTabAttributesLoading,
|
|
35
37
|
sortingTabAttributes,
|
|
36
38
|
sortingTabAttributesLoading,
|
|
37
39
|
tabsApiData,
|
|
38
40
|
tabsApiDataLoading,
|
|
39
41
|
onSaveSettingsData,
|
|
42
|
+
activeTab,
|
|
40
43
|
}: QuickFilterModalProps) {
|
|
41
44
|
const [tabValue, setTabValue] = useState(0);
|
|
42
45
|
const { container: fullscreenContainer } = useFullscreenPopoverContainer();
|
|
@@ -73,7 +76,10 @@ export function QuickFilterSettings({
|
|
|
73
76
|
sortby:
|
|
74
77
|
sortingTabState?.sortby?.filter((item) => item.column !== "") || [],
|
|
75
78
|
}
|
|
76
|
-
:
|
|
79
|
+
: {
|
|
80
|
+
isDefault: false,
|
|
81
|
+
tabs: sortingTabState?.tabs || [],
|
|
82
|
+
};
|
|
77
83
|
|
|
78
84
|
const modifiedSettingsData = {
|
|
79
85
|
quick_tab: quickTabStates,
|
|
@@ -132,6 +138,8 @@ export function QuickFilterSettings({
|
|
|
132
138
|
columnsData={quickTabAttributes}
|
|
133
139
|
tabsApiData={tabsApiData}
|
|
134
140
|
tabsApiDataLoading={tabsApiDataLoading}
|
|
141
|
+
activeTab={activeTab}
|
|
142
|
+
columnTabAttributes={columnTabAttributes}
|
|
135
143
|
/>
|
|
136
144
|
)}
|
|
137
145
|
</CustomTabPanel>
|
|
@@ -143,6 +151,8 @@ export function QuickFilterSettings({
|
|
|
143
151
|
<Column
|
|
144
152
|
filterSettingStates={filterSettingStates}
|
|
145
153
|
columnsData={columnsData}
|
|
154
|
+
columnTabAttributes={columnTabAttributes}
|
|
155
|
+
columnTabAttributesLoading={columnTabAttributesLoading}
|
|
146
156
|
/>
|
|
147
157
|
)}
|
|
148
158
|
</CustomTabPanel>
|
|
@@ -188,7 +198,7 @@ export function QuickFilterSettings({
|
|
|
188
198
|
<DialogActions>
|
|
189
199
|
<CustomButton
|
|
190
200
|
// disabled={saveButtonError?.hasError}
|
|
191
|
-
disabled={saveButtonError?.hasError}
|
|
201
|
+
// disabled={saveButtonError?.hasError}
|
|
192
202
|
onClick={handleSaveSetSettingsData}
|
|
193
203
|
>
|
|
194
204
|
{view === "listing" ? "Save Quick Filter" : "Save Kanban Layout"}
|
|
@@ -5,11 +5,14 @@ import TableHead from "./table-head";
|
|
|
5
5
|
|
|
6
6
|
function Table<T>({
|
|
7
7
|
table,
|
|
8
|
+
activeTab,
|
|
8
9
|
featureOptions,
|
|
9
10
|
NestedComponent,
|
|
10
11
|
columnOrder,
|
|
11
12
|
isCompactTable,
|
|
12
13
|
tableStates,
|
|
14
|
+
filterSettingStates,
|
|
15
|
+
onSaveSettings,
|
|
13
16
|
}: CraftTableComponentProps<T>) {
|
|
14
17
|
const { striped } = featureOptions;
|
|
15
18
|
|
|
@@ -23,9 +26,12 @@ function Table<T>({
|
|
|
23
26
|
>
|
|
24
27
|
<TableHead
|
|
25
28
|
table={table}
|
|
29
|
+
activeTab={activeTab}
|
|
26
30
|
featureOptions={featureOptions}
|
|
27
31
|
columnOrder={columnOrder}
|
|
28
32
|
tableStates={tableStates}
|
|
33
|
+
filterSettingStates={filterSettingStates}
|
|
34
|
+
onSaveSettings={onSaveSettings}
|
|
29
35
|
/>
|
|
30
36
|
<TableBody
|
|
31
37
|
table={table}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
viewSettingsDropDown,
|
|
24
24
|
getOperationList,
|
|
25
25
|
getLayoutAttributes,
|
|
26
|
+
getSettingsColumnAttributes,
|
|
26
27
|
} from "../utils/apiColumn";
|
|
27
28
|
import {
|
|
28
29
|
FilterDataMainFilterEntityListProps,
|
|
@@ -71,6 +72,7 @@ const entityListingCall = async ({
|
|
|
71
72
|
const params: APIParamsProps = {
|
|
72
73
|
page,
|
|
73
74
|
size,
|
|
75
|
+
// use_flatjson: true,
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
const response = await api.post(url, body, { params });
|
|
@@ -163,9 +165,12 @@ export const useDeleteFilterAPI = (tableStates: CraftTableOptionsProps) => {
|
|
|
163
165
|
const newFilterMasterState = {
|
|
164
166
|
...filterMaster,
|
|
165
167
|
saved_filters: {
|
|
168
|
+
...(filterMaster?.saved_filters ?? {}),
|
|
166
169
|
selectedId: "",
|
|
167
170
|
selectedName: "",
|
|
168
171
|
selectedCode: "",
|
|
172
|
+
shareWithTeam: undefined,
|
|
173
|
+
allowTeamEdit: undefined,
|
|
169
174
|
},
|
|
170
175
|
activeFilterTabIndex: -1,
|
|
171
176
|
};
|
|
@@ -251,7 +256,7 @@ export const useCommonFilterDropdownAPI = (
|
|
|
251
256
|
// Step 1: Extract all keys and query types
|
|
252
257
|
const dropdownConfigs = useMemo(() => {
|
|
253
258
|
return filters
|
|
254
|
-
?.filter((col) => col?.
|
|
259
|
+
?.filter((col) => col?.filter_attribute_data_type === "select")
|
|
255
260
|
?.map((col) => ({
|
|
256
261
|
key: col?.filter_attribute,
|
|
257
262
|
dataSourceType: value ?? col?.datasource_list ?? "STS",
|
|
@@ -370,20 +375,30 @@ export const useGetOperationList = () => {
|
|
|
370
375
|
|
|
371
376
|
export const useGetLayoutAttributes = ({
|
|
372
377
|
entity_type,
|
|
373
|
-
|
|
378
|
+
data_type,
|
|
374
379
|
}: {
|
|
375
380
|
entity_type: string;
|
|
376
|
-
|
|
381
|
+
data_type?: string;
|
|
377
382
|
}) => {
|
|
378
383
|
// First query to get meta data
|
|
379
384
|
const layoutAttributes = useQuery({
|
|
380
|
-
queryKey: ["layoutAttributes", entity_type,
|
|
385
|
+
queryKey: ["layoutAttributes", entity_type, data_type],
|
|
381
386
|
queryFn: () =>
|
|
382
387
|
getLayoutAttributes({
|
|
383
388
|
entity_type,
|
|
384
|
-
|
|
389
|
+
data_type,
|
|
385
390
|
}),
|
|
386
391
|
});
|
|
387
392
|
|
|
388
393
|
return { layoutAttributes };
|
|
389
394
|
};
|
|
395
|
+
|
|
396
|
+
export const useGetSettingsColumnAttributes = (entity_type: string) => {
|
|
397
|
+
// First query to get meta data
|
|
398
|
+
const settingsColumnAttributes = useQuery({
|
|
399
|
+
queryKey: ["settingsColumnAttributes", entity_type],
|
|
400
|
+
queryFn: () => getSettingsColumnAttributes(entity_type),
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
return { settingsColumnAttributes };
|
|
404
|
+
};
|
|
@@ -193,13 +193,13 @@ export const getOperationList = async () => {
|
|
|
193
193
|
|
|
194
194
|
export const getLayoutAttributes = async ({
|
|
195
195
|
entity_type,
|
|
196
|
-
|
|
196
|
+
data_type,
|
|
197
197
|
}: {
|
|
198
198
|
entity_type: string;
|
|
199
|
-
|
|
199
|
+
data_type?: string;
|
|
200
200
|
}) => {
|
|
201
201
|
const params = {
|
|
202
|
-
|
|
202
|
+
data_type,
|
|
203
203
|
};
|
|
204
204
|
const response = await api.post(
|
|
205
205
|
`/layout-preference/attributes`,
|
|
@@ -208,3 +208,8 @@ export const getLayoutAttributes = async ({
|
|
|
208
208
|
);
|
|
209
209
|
return response.data;
|
|
210
210
|
};
|
|
211
|
+
|
|
212
|
+
export const getSettingsColumnAttributes = async (entity_type: string) => {
|
|
213
|
+
const response = await api.get(`/attribute-master/getAll/${entity_type}`);
|
|
214
|
+
return response.data;
|
|
215
|
+
};
|
|
@@ -77,9 +77,10 @@ export function customDebounce<T extends (...args: any[]) => any>(
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
//ENTITY TYPE
|
|
80
|
-
const ENVIRONMENT = "
|
|
80
|
+
const ENVIRONMENT = "crm_dev";
|
|
81
81
|
export const ENTITY_TYPE = "LEAD";
|
|
82
82
|
export const MAPPED_ENTITY_TYPE = "LYPR"; // LAP OR LYPR
|
|
83
|
+
export const USER_ID = 226;
|
|
83
84
|
|
|
84
85
|
const environments = {
|
|
85
86
|
adm_dev: "http://localhost:4010/api",
|
|
@@ -8,7 +8,7 @@ export const hydrateSavedFilters = async (
|
|
|
8
8
|
// const attribute = tableStates..find(
|
|
9
9
|
// (attr) => attr.attribute_key === filter.filter_attribute
|
|
10
10
|
// );
|
|
11
|
-
if (typeof filter.
|
|
11
|
+
if (typeof filter.filter_attribute_data_type === "undefined") {
|
|
12
12
|
return {
|
|
13
13
|
...filter,
|
|
14
14
|
dropdown_list: [],
|
|
@@ -16,7 +16,7 @@ export const hydrateSavedFilters = async (
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const matchingDropdownList =
|
|
19
|
-
operationList[filter.
|
|
19
|
+
operationList[filter.filter_attribute_data_type] || [];
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
22
|
...filter,
|
|
@@ -10,11 +10,14 @@ export interface QuickFilterModalProps {
|
|
|
10
10
|
columnsDataLoading?: boolean;
|
|
11
11
|
quickTabAttributes?: any[];
|
|
12
12
|
quickTabAttributesLoading?: boolean;
|
|
13
|
+
columnTabAttributes?: any[];
|
|
14
|
+
columnTabAttributesLoading?: boolean;
|
|
13
15
|
sortingTabAttributes?: any[];
|
|
14
16
|
sortingTabAttributesLoading?: boolean;
|
|
15
17
|
tabsApiData?: { label: string; value: string }[];
|
|
16
18
|
tabsApiDataLoading?: boolean;
|
|
17
19
|
onSaveSettingsData?: (data: any) => void;
|
|
20
|
+
activeTab?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
type TabName = string;
|
|
@@ -42,7 +45,7 @@ interface ColumnItem {
|
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
interface ColumnTab {
|
|
45
|
-
tab_name:
|
|
48
|
+
tab_name: { label: string; value: string };
|
|
46
49
|
show_list: ColumnItem[];
|
|
47
50
|
hide_list: ColumnItem[];
|
|
48
51
|
}
|
|
@@ -53,7 +56,7 @@ export interface SortingConfigSortByProps {
|
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
interface SortingConfigTabProps {
|
|
56
|
-
tab_name:
|
|
59
|
+
tab_name: { label: string; value: string };
|
|
57
60
|
sortby: SortingConfigSortByProps[];
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -96,6 +99,9 @@ export interface SettingsQuickTabProps {
|
|
|
96
99
|
columnsData: any;
|
|
97
100
|
tabsApiData?: { label: string; value: string }[];
|
|
98
101
|
tabsApiDataLoading?: boolean;
|
|
102
|
+
activeTab?: string;
|
|
103
|
+
columnTabAttributes?: any[];
|
|
104
|
+
columnTabAttributesLoading?: boolean;
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
export interface SettingsDataProps {
|
|
@@ -15,6 +15,38 @@ export interface FilterOperationListProps {
|
|
|
15
15
|
code: string;
|
|
16
16
|
label: string;
|
|
17
17
|
value: string;
|
|
18
|
+
is_shared: boolean;
|
|
19
|
+
is_editable: boolean;
|
|
20
|
+
is_owner: boolean;
|
|
21
|
+
created_by: string;
|
|
22
|
+
// user_id: number;
|
|
23
|
+
description: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FilterSharedListProps {
|
|
27
|
+
created_date: string; // ISO date string
|
|
28
|
+
entity_type: string;
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
status: string;
|
|
32
|
+
parent_type: string | null;
|
|
33
|
+
parent_id: string | number | null;
|
|
34
|
+
code: string;
|
|
35
|
+
created_by: string;
|
|
36
|
+
modified_by: string | null;
|
|
37
|
+
modified_date: string | null;
|
|
38
|
+
enterprise_id: number;
|
|
39
|
+
organization_id: number;
|
|
40
|
+
appcode: string | null;
|
|
41
|
+
level_id: string;
|
|
42
|
+
level_type: string;
|
|
43
|
+
mapped_entity_type: string;
|
|
44
|
+
user_id: number;
|
|
45
|
+
is_default: boolean;
|
|
46
|
+
filter_scope: string;
|
|
47
|
+
is_shared: boolean;
|
|
48
|
+
is_editable: boolean | string; // API gives "true" (string) so support both
|
|
49
|
+
description: string | null;
|
|
18
50
|
}
|
|
19
51
|
|
|
20
52
|
export type FilterInputDataTypes =
|
|
@@ -48,7 +80,7 @@ export interface FilterColumnsListProps {
|
|
|
48
80
|
searchable: string | null;
|
|
49
81
|
attribute_key: string;
|
|
50
82
|
sort_type: string | null;
|
|
51
|
-
|
|
83
|
+
data_type: FilterInputDataTypes;
|
|
52
84
|
data_source_type: string | null;
|
|
53
85
|
datasource_list: any | null;
|
|
54
86
|
visible: string;
|
|
@@ -58,6 +90,7 @@ export interface FilterColumnsDataProps {
|
|
|
58
90
|
column_list: FilterColumnsListProps[];
|
|
59
91
|
operation_list: OperationMapProps;
|
|
60
92
|
saved_filter: FilterOperationListProps[];
|
|
93
|
+
shared_filter: FilterOperationListProps[];
|
|
61
94
|
}
|
|
62
95
|
|
|
63
96
|
export interface FilterDropdownDataProps {
|
|
@@ -180,7 +213,7 @@ export interface FilterStateProps {
|
|
|
180
213
|
filter_value: string | string[];
|
|
181
214
|
// id: string | number; // removed as per backend req
|
|
182
215
|
filter_attribute_name: string | undefined;
|
|
183
|
-
|
|
216
|
+
filter_attribute_data_type: FilterInputDataTypes | undefined;
|
|
184
217
|
attribute_key?: string;
|
|
185
218
|
dropdown_list?: {
|
|
186
219
|
label?: string;
|
|
@@ -215,6 +248,7 @@ export interface createSavedFilterPayload {
|
|
|
215
248
|
enterprise_id?: number;
|
|
216
249
|
user_id?: number;
|
|
217
250
|
is_default: boolean;
|
|
251
|
+
description: string | null;
|
|
218
252
|
mapped_entity_type: string;
|
|
219
253
|
status?: string;
|
|
220
254
|
entity_type: string;
|
|
@@ -234,6 +268,7 @@ export interface updateSavedFilterPayload {
|
|
|
234
268
|
name: string;
|
|
235
269
|
is_default: boolean;
|
|
236
270
|
id: string | number;
|
|
271
|
+
|
|
237
272
|
status?: string;
|
|
238
273
|
entity_type: string;
|
|
239
274
|
mapped_entity_type: string;
|
|
@@ -242,12 +277,14 @@ export interface updateSavedFilterPayload {
|
|
|
242
277
|
|
|
243
278
|
export interface FilterFormComponentProps {
|
|
244
279
|
columnsData: FilterColumnsDataProps;
|
|
280
|
+
saved_filter?: any;
|
|
281
|
+
shared_filter?: any;
|
|
245
282
|
dropdownData: FilterDropdownDataProps;
|
|
246
283
|
tableStates: CraftTableOptionsProps;
|
|
247
284
|
editMode?: boolean;
|
|
248
285
|
setEditMode?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
249
286
|
setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
250
|
-
|
|
287
|
+
onSaveFilterButtonClick?: () => void;
|
|
251
288
|
tabValue?: number;
|
|
252
289
|
onChangeFunction: ({
|
|
253
290
|
updatedFilters,
|
|
@@ -256,6 +293,11 @@ export interface FilterFormComponentProps {
|
|
|
256
293
|
filterComponentOptions?: FilterComponentOptions;
|
|
257
294
|
}
|
|
258
295
|
|
|
296
|
+
export interface SavedFilterSharingPreference {
|
|
297
|
+
shareWithTeam?: boolean;
|
|
298
|
+
allowTeamEdit?: boolean;
|
|
299
|
+
}
|
|
300
|
+
|
|
259
301
|
export interface FilterMasterStateProps {
|
|
260
302
|
attributes: {
|
|
261
303
|
selected: string;
|
|
@@ -265,8 +307,13 @@ export interface FilterMasterStateProps {
|
|
|
265
307
|
selectedId: string;
|
|
266
308
|
selectedName: string;
|
|
267
309
|
selectedCode?: string;
|
|
310
|
+
description?: string;
|
|
311
|
+
is_shared?: boolean;
|
|
312
|
+
is_editable?: boolean;
|
|
313
|
+
is_owner?: boolean;
|
|
268
314
|
};
|
|
269
315
|
activeFilterTabIndex: number;
|
|
316
|
+
shared_filters_meta?: Record<string, SavedFilterSharingPreference>;
|
|
270
317
|
}
|
|
271
318
|
|
|
272
319
|
export interface AttributesFilterProps {
|
|
@@ -308,6 +355,7 @@ export interface FilterDataMainFilterEntityWiseCriteriaProps {
|
|
|
308
355
|
attribute_key: string;
|
|
309
356
|
element_type: FilterInputDataTypes;
|
|
310
357
|
datasource_list: any;
|
|
358
|
+
data_type: FilterInputDataTypes;
|
|
311
359
|
}
|
|
312
360
|
|
|
313
361
|
export interface FilterDataProps {
|
|
@@ -81,6 +81,8 @@ export interface CraftTableProps<T> {
|
|
|
81
81
|
data: T[];
|
|
82
82
|
columns: CustomColumnDef<T>[];
|
|
83
83
|
tableStates: CraftTableOptionsProps;
|
|
84
|
+
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
85
|
+
onSaveSettings?: (columnId: string) => void;
|
|
84
86
|
paginationOptions?: CraftTablePaginationProps;
|
|
85
87
|
featureOptions?: CraftTableFeatureProps;
|
|
86
88
|
nestedComponent?: React.ComponentType<{ row: Row<T> }>;
|
|
@@ -93,19 +95,26 @@ export interface CraftTableProps<T> {
|
|
|
93
95
|
filterOptions?: FilterOptionsProps;
|
|
94
96
|
settingsOptions?: settingsOptionsProps;
|
|
95
97
|
craftTableFilterSettingsOptions?: craftTableFilterSettingsOptionsProps;
|
|
98
|
+
activeTab?: string;
|
|
96
99
|
}
|
|
97
100
|
export interface CraftTableComponentProps<T> {
|
|
98
101
|
table: Table<T>;
|
|
102
|
+
activeTab?: string;
|
|
99
103
|
featureOptions: CraftTableFeatureProps;
|
|
100
104
|
NestedComponent?: React.ComponentType<{ row: Row<T> }>;
|
|
101
105
|
columnOrder: ColumnOrderState;
|
|
102
106
|
setColumnOrder: React.Dispatch<React.SetStateAction<ColumnOrderState>>;
|
|
103
107
|
isCompactTable: boolean;
|
|
104
108
|
tableStates: CraftTableOptionsProps;
|
|
109
|
+
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
110
|
+
onSaveSettings?: (columnId: string) => void;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
export interface TableHeaderProps<T> {
|
|
108
114
|
header: Header<T, unknown>;
|
|
115
|
+
activeTab?: string;
|
|
109
116
|
featureOptions: CraftTableFeatureProps;
|
|
110
117
|
tableStates: CraftTableOptionsProps;
|
|
118
|
+
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
119
|
+
onSaveSettings?: (columnId: string) => void;
|
|
111
120
|
}
|
|
@@ -87,6 +87,9 @@ const CraftTableFilterWrapper = ({
|
|
|
87
87
|
// API to handle saving a filter
|
|
88
88
|
const handleSaveFilter = (name: string) => {
|
|
89
89
|
const quickFilter = filters.map((f: any) => ({ ...f }));
|
|
90
|
+
const shareWithTeam = filterMaster?.saved_filters?.is_shared ?? false;
|
|
91
|
+
const allowTeamEdit = filterMaster?.saved_filters?.is_editable ?? false;
|
|
92
|
+
const description = filterMaster?.saved_filters?.description ?? "";
|
|
90
93
|
|
|
91
94
|
const payload = {
|
|
92
95
|
name,
|
|
@@ -94,7 +97,10 @@ const CraftTableFilterWrapper = ({
|
|
|
94
97
|
mapped_entity_type: ENTITY_TYPE, // For that entity type
|
|
95
98
|
status: "ACTIVE",
|
|
96
99
|
entity_type: "SFM", // FIXED entity type
|
|
100
|
+
description: description,
|
|
97
101
|
filterDetails: quickFilter,
|
|
102
|
+
is_shared: shareWithTeam,
|
|
103
|
+
is_editable: allowTeamEdit,
|
|
98
104
|
};
|
|
99
105
|
const entity_type = "SFM";
|
|
100
106
|
savedMutation.mutate(
|
|
@@ -111,6 +117,9 @@ const CraftTableFilterWrapper = ({
|
|
|
111
117
|
...prev?.saved_filters,
|
|
112
118
|
selectedId: newFilterId.toString(),
|
|
113
119
|
selectedName: name,
|
|
120
|
+
description: description,
|
|
121
|
+
is_shared: shareWithTeam,
|
|
122
|
+
is_editable: allowTeamEdit,
|
|
114
123
|
},
|
|
115
124
|
activeFilterTabIndex: 1,
|
|
116
125
|
} as FilterMasterStateProps)
|
|
@@ -127,6 +136,9 @@ const CraftTableFilterWrapper = ({
|
|
|
127
136
|
filter_operator: f.filter_operator,
|
|
128
137
|
filter_value: f.filter_value,
|
|
129
138
|
}));
|
|
139
|
+
const shareWithTeam = filterMaster?.saved_filters?.is_shared ?? false;
|
|
140
|
+
const allowTeamEdit = filterMaster?.saved_filters?.is_editable ?? false;
|
|
141
|
+
const description = filterMaster?.saved_filters?.description ?? "";
|
|
130
142
|
|
|
131
143
|
const payload = {
|
|
132
144
|
name: filterMaster?.saved_filters?.selectedName, // Name of the filter
|
|
@@ -134,8 +146,11 @@ const CraftTableFilterWrapper = ({
|
|
|
134
146
|
id: filterMaster?.saved_filters?.selectedId,
|
|
135
147
|
mapped_entity_type: ENTITY_TYPE,
|
|
136
148
|
status: "ACTIVE",
|
|
149
|
+
description: description,
|
|
137
150
|
entity_type: "SFM",
|
|
138
151
|
filterDetails: quickFilter,
|
|
152
|
+
is_shared: shareWithTeam, // Now true/false from state
|
|
153
|
+
is_editable: allowTeamEdit,
|
|
139
154
|
};
|
|
140
155
|
const entity_type = "SFM";
|
|
141
156
|
updateMutation.mutate({ entity_type, payload });
|