rez-table-listing-mui 1.2.13 → 1.2.14
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 +116 -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/App.tsx +47 -405
- package/src/index.ts +10 -9
- package/src/kanban/components/LeadCard.tsx +130 -0
- package/src/kanban/constants/kanban-constants.ts +249 -0
- package/src/kanban/hooks/hooks.ts +16 -0
- package/src/kanban/index.tsx +331 -0
- package/src/kanban/services/service.ts +11 -0
- package/src/kanban/styles/styles.tsx +256 -0
- package/src/kanban/types/types.ts +132 -0
- package/src/{components → listing/components}/column-visibility-modal/column-list-item.tsx +1 -1
- package/src/{components → listing/components}/column-visibility-modal/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/forms/components/Filter-criteria.tsx +1 -1
- package/src/{components → listing/components}/filter/components/forms/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/saved-filter.tsx +2 -2
- package/src/{components → listing/components}/filter/components/search/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/tabs/index.tsx +1 -1
- package/src/{components → listing/components}/index-table.tsx +1 -1
- package/src/{components → listing/components}/pagination/default/index.tsx +1 -1
- package/src/{components → listing/components}/search/index.tsx +1 -1
- package/src/{components → listing/components}/sorting-modal.tsx/index.tsx +1 -1
- package/src/{components → listing/components}/sorting-modal.tsx/sorting-item.tsx +1 -1
- package/src/{components → listing/components}/table-change-layout.tsx +1 -1
- package/src/{components → listing/components}/table-head-dnd-cell.tsx +6 -6
- package/src/{components → listing/components}/table-head-pin.tsx +1 -1
- package/src/{components → listing/components}/table-head-popover.tsx +1 -1
- package/src/{components → listing/components}/table-head.tsx +6 -6
- package/src/{components → listing/components}/table-settings/common/listing-values.tsx +1 -1
- package/src/{components → listing/components}/table-settings/components/sorting.tsx +1 -1
- package/src/{components → listing/components}/tabs/index.tsx +1 -1
- package/src/{components → listing/components}/topbar/index.tsx +7 -7
- package/src/{components → listing/components}/viewmore/index.tsx +1 -1
- package/src/{libs → listing/libs}/hooks/useDefaultColumns.tsx +1 -0
- package/src/{libs → listing/libs}/utils/common.ts +1 -1
- package/src/view/KanbanView.tsx +16 -0
- package/src/view/ListingView.tsx +423 -0
- /package/src/{components → listing/components}/column-visibility-modal/index.scss +0 -0
- /package/src/{components → listing/components}/common/confirm-modal/index.tsx +0 -0
- /package/src/{components → listing/components}/common/index.scss +0 -0
- /package/src/{components → listing/components}/common/index.tsx +0 -0
- /package/src/{components → listing/components}/common/loader/loader.tsx +0 -0
- /package/src/{components → listing/components}/dropdown/index.scss +0 -0
- /package/src/{components → listing/components}/dropdown/index.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/attributes-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Date.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Dropdown.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Multi-Select.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Select.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Textfield.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/styles.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/main-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/saved-edit-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/tabs/custom-tab-panel.tsx +0 -0
- /package/src/{components → listing/components}/filter/index.tsx +0 -0
- /package/src/{components → listing/components}/filter/style.ts +0 -0
- /package/src/{components → listing/components}/index.scss +0 -0
- /package/src/{components → listing/components}/inputs/checkbox/index.tsx +0 -0
- /package/src/{components → listing/components}/inputs/index.scss +0 -0
- /package/src/{components → listing/components}/inputs/switch.tsx +0 -0
- /package/src/{components → listing/components}/login/index.tsx +0 -0
- /package/src/{components → listing/components}/nestedcomponent/index.scss +0 -0
- /package/src/{components → listing/components}/nestedcomponent/index.tsx +0 -0
- /package/src/{components → listing/components}/pagination/default/index.scss +0 -0
- /package/src/{components → listing/components}/search/style.ts +0 -0
- /package/src/{components → listing/components}/table-body-dnd-cell.tsx +0 -0
- /package/src/{components → listing/components}/table-body.tsx +0 -0
- /package/src/{components → listing/components}/table-dnd.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/common/draggable-listitem.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/common/info-alert.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/column.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/custom-button.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/custom-dialog.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/quick-tab.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/toggle-button-switch.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/constants.ts +0 -0
- /package/src/{components → listing/components}/table-settings/index.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/style.ts +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/horizontal/index.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/styles.ts +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/vertical/custom-tab-panel.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/vertical/index.tsx +0 -0
- /package/src/{components → listing/components}/table.tsx +0 -0
- /package/src/{components → listing/components}/tabs/index.scss +0 -0
- /package/src/{components → listing/components}/tabs/styles.ts +0 -0
- /package/src/{components → listing/components}/topbar/index.scss +0 -0
- /package/src/{components → listing/components}/viewmore/index.scss +0 -0
- /package/src/{libs → listing/libs}/hooks/useCraftTable.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useCraftTableFilterSettings.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useElementWidth.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useEntityTableAPI.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useEntityTableHooks.ts +0 -0
- /package/src/{libs → listing/libs}/hooks/useFullScreen.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useOutsideClick.tsx +0 -0
- /package/src/{libs → listing/libs}/utils/Data-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/amount-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/apiColumn.ts +0 -0
- /package/src/{libs → listing/libs}/utils/date-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/debounce.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-hierar-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-nested-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/rows-data.ts +0 -0
- /package/src/{types → listing/types}/common.ts +0 -0
- /package/src/{types → listing/types}/filter-settings.ts +0 -0
- /package/src/{types → listing/types}/filter.ts +0 -0
- /package/src/{types → listing/types}/table-options.ts +0 -0
- /package/src/{types → listing/types}/table.ts +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Kanban from "../kanban";
|
|
2
|
+
import LeadCard from "../kanban/components/LeadCard";
|
|
3
|
+
import { useGetKanbanData } from "../kanban/hooks/hooks";
|
|
4
|
+
|
|
5
|
+
const KanbanView = () => {
|
|
6
|
+
const { rawData, isLoading } = useGetKanbanData("LEAD");
|
|
7
|
+
return (
|
|
8
|
+
<Kanban
|
|
9
|
+
rawData={rawData}
|
|
10
|
+
isLoading={isLoading}
|
|
11
|
+
KanbanCardComponent={LeadCard}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default KanbanView;
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { makeData, Person } from "../listing/libs/utils/make-hierar-data";
|
|
3
|
+
import { useCraftTable } from "../listing/libs/hooks/useCraftTable";
|
|
4
|
+
import { useCraftTableFilterSettings } from "../listing/libs/hooks/useCraftTableFilterSettings";
|
|
5
|
+
import { useDefaultColumns } from "../listing/libs/hooks/useDefaultColumns";
|
|
6
|
+
import {
|
|
7
|
+
useDetailsQueryAPI,
|
|
8
|
+
useFetchData,
|
|
9
|
+
} from "../listing/libs/hooks/useEntityTableHooks";
|
|
10
|
+
import { ENTITY_TYPE } from "../listing/libs/utils/common";
|
|
11
|
+
import {
|
|
12
|
+
useCommonDropdownAPI,
|
|
13
|
+
useDeleteFilterAPI,
|
|
14
|
+
useEntityTableAPI,
|
|
15
|
+
useGetSettingsDataAPI,
|
|
16
|
+
useSavedFilterAPI,
|
|
17
|
+
useSaveSettingsDataAPI,
|
|
18
|
+
useSettingsDropDownAPI,
|
|
19
|
+
useUpdateFilterAPI,
|
|
20
|
+
} from "../listing/libs/hooks/useEntityTableAPI";
|
|
21
|
+
import { useGetKanbanData } from "../kanban/hooks/hooks";
|
|
22
|
+
import { entityTableMetaMaster } from "../listing/libs/utils/apiColumn";
|
|
23
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
24
|
+
import { FilterMasterStateProps } from "../listing/types/filter";
|
|
25
|
+
import { SettingsDataProps } from "../listing/types/filter-settings";
|
|
26
|
+
import LoginButton from "../listing/components/login";
|
|
27
|
+
import TableWrapper from "../listing/components/index-table";
|
|
28
|
+
import { CraftTableFilter } from "..";
|
|
29
|
+
import { TableTabs } from "../listing/components/tabs";
|
|
30
|
+
import { QuickFilterSettings } from "../listing/components/table-settings";
|
|
31
|
+
|
|
32
|
+
function ListingView() {
|
|
33
|
+
// const [mockLoading, setMockLoading] = useState<boolean>(true);
|
|
34
|
+
// const [jsonData] = useState<any[]>([]);
|
|
35
|
+
const [columns, setColumns] = useState<any[]>([]);
|
|
36
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
37
|
+
// const [data, setData] = useState<Person[]>(() => makeData(200, 3, 2));
|
|
38
|
+
|
|
39
|
+
const [selectedTab, setSelectedTab] = useState("All");
|
|
40
|
+
|
|
41
|
+
const tableStates = useCraftTable();
|
|
42
|
+
const filterSettingStates = useCraftTableFilterSettings();
|
|
43
|
+
|
|
44
|
+
const { filters, setFilters, filterMaster, setFilterMaster, filterToDelete } =
|
|
45
|
+
tableStates;
|
|
46
|
+
|
|
47
|
+
const { showListViewSettings, setShowListViewSettings, setSettingsData } =
|
|
48
|
+
filterSettingStates;
|
|
49
|
+
|
|
50
|
+
const { defaultColumns } = useDefaultColumns();
|
|
51
|
+
|
|
52
|
+
const { metaQuery } = useFetchData(ENTITY_TYPE);
|
|
53
|
+
const { detailsQuery } = useDetailsQueryAPI(
|
|
54
|
+
filterMaster?.saved_filters?.selectedId
|
|
55
|
+
? filterMaster?.saved_filters?.selectedId
|
|
56
|
+
: metaQuery?.data?.default_filter?.value
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const { savedMutation } = useSavedFilterAPI(); //API CALL FOR SAVED FILTER
|
|
60
|
+
const { deleteMutation } = useDeleteFilterAPI(); //API FOR DELETING FILTER
|
|
61
|
+
const { updateMutation } = useUpdateFilterAPI(); //API FOR UPDATE FILTER
|
|
62
|
+
const { saveSettingsDataMutation } = useSaveSettingsDataAPI(ENTITY_TYPE);
|
|
63
|
+
const { dropdownData } = useCommonDropdownAPI(metaQuery.data);
|
|
64
|
+
const { settingsTabDropdownData, settingsTabDropdownPending } =
|
|
65
|
+
useSettingsDropDownAPI({
|
|
66
|
+
entity_type: ENTITY_TYPE,
|
|
67
|
+
column: filterSettingStates?.quickTabStates?.attribute,
|
|
68
|
+
sort_by: filterSettingStates?.quickTabStates?.sorting,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const { getSettingsAPIData } = useGetSettingsDataAPI(ENTITY_TYPE);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
// setTimeout(() => {
|
|
75
|
+
// setMockLoading(false);
|
|
76
|
+
// }, 1000);
|
|
77
|
+
|
|
78
|
+
const fetchMeta = async () => {
|
|
79
|
+
try {
|
|
80
|
+
const { res: allColumns } = await entityTableMetaMaster(ENTITY_TYPE);
|
|
81
|
+
|
|
82
|
+
const savedColumnSettings = filterSettingStates.settingsData?.column;
|
|
83
|
+
|
|
84
|
+
const getOrderedColumns = (
|
|
85
|
+
showList: { value: string }[],
|
|
86
|
+
filteredColumns: any[]
|
|
87
|
+
) => {
|
|
88
|
+
// Build ordered columns using showList and filteredColumns
|
|
89
|
+
return showList
|
|
90
|
+
?.map((showItem) => {
|
|
91
|
+
return filteredColumns.find(
|
|
92
|
+
(col) => col?.accessorKey === showItem?.value
|
|
93
|
+
);
|
|
94
|
+
})
|
|
95
|
+
?.filter((col): col is ColumnDef<any> => col !== undefined); // Ensure non-undefined columns are returned
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
savedColumnSettings &&
|
|
100
|
+
!savedColumnSettings.isDefault &&
|
|
101
|
+
savedColumnSettings.tabs
|
|
102
|
+
) {
|
|
103
|
+
// Tab-wise view: find the active tab and use its show_list
|
|
104
|
+
const activeTabSettings = savedColumnSettings.tabs.find(
|
|
105
|
+
(tab) => tab.tab_name.toLowerCase() === selectedTab.toLowerCase()
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (activeTabSettings?.show_list) {
|
|
109
|
+
const visibleColumns = new Set(
|
|
110
|
+
activeTabSettings.show_list.map((c) => c.value)
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// First, filter columns based on visibleColumns
|
|
114
|
+
const filteredColumns = allColumns.filter((col: any) =>
|
|
115
|
+
visibleColumns.has(col?.accessorKey)
|
|
116
|
+
);
|
|
117
|
+
setColumns(
|
|
118
|
+
getOrderedColumns(activeTabSettings.show_list, filteredColumns)
|
|
119
|
+
);
|
|
120
|
+
} else {
|
|
121
|
+
// Fallback if no specific settings for the active tab are found
|
|
122
|
+
setColumns(allColumns);
|
|
123
|
+
}
|
|
124
|
+
} else if (savedColumnSettings && savedColumnSettings.show_list) {
|
|
125
|
+
// Default view: use the main show_list
|
|
126
|
+
const visibleColumns = new Set(
|
|
127
|
+
savedColumnSettings.show_list.map((c) => c.value)
|
|
128
|
+
);
|
|
129
|
+
const filtered = allColumns.filter((col: any) =>
|
|
130
|
+
visibleColumns.has(col?.accessorKey)
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
setColumns(
|
|
134
|
+
getOrderedColumns(savedColumnSettings.show_list, filtered)
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
// No settings found, use all columns
|
|
138
|
+
setColumns(allColumns);
|
|
139
|
+
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error("Failed to fetch metadata:", error);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
fetchMeta();
|
|
146
|
+
}, [selectedTab]);
|
|
147
|
+
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
setFilters(detailsQuery.data ?? []);
|
|
150
|
+
}, [detailsQuery.data]);
|
|
151
|
+
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
setSettingsData(getSettingsAPIData?.layout_json);
|
|
154
|
+
}, [getSettingsAPIData]);
|
|
155
|
+
|
|
156
|
+
//For server side sorting
|
|
157
|
+
const enableServerSideSorting = true;
|
|
158
|
+
|
|
159
|
+
const { tableData } = useEntityTableAPI({
|
|
160
|
+
page: 0,
|
|
161
|
+
size: 50,
|
|
162
|
+
entity_type: ENTITY_TYPE,
|
|
163
|
+
tabs: {
|
|
164
|
+
columnName:
|
|
165
|
+
getSettingsAPIData?.layout_json?.quick_tab?.attribute || "status",
|
|
166
|
+
sortBy: getSettingsAPIData?.layout_json?.quick_tab?.sorting || "ASC",
|
|
167
|
+
value:
|
|
168
|
+
selectedTab.toLowerCase() === "all" ? "" : selectedTab.toLowerCase(),
|
|
169
|
+
},
|
|
170
|
+
quickFilter: tableStates.filters,
|
|
171
|
+
sortby: [
|
|
172
|
+
{
|
|
173
|
+
sortColum: "name",
|
|
174
|
+
sortType: "ASC",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
attributeFilter: [],
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const newData = useMemo(
|
|
181
|
+
() => tableData?.entity_list || [],
|
|
182
|
+
[tableData?.entity_list]
|
|
183
|
+
);
|
|
184
|
+
const tabsData = tableData?.entity_tabs;
|
|
185
|
+
|
|
186
|
+
// Auto-switch tab if the selected tab is removed
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
if (
|
|
189
|
+
tabsData &&
|
|
190
|
+
tabsData.length > 0 &&
|
|
191
|
+
!tabsData.some(
|
|
192
|
+
(tab) => tab.tab_value?.toLowerCase() === selectedTab.toLowerCase()
|
|
193
|
+
)
|
|
194
|
+
) {
|
|
195
|
+
// Try to select 'ALL' if it exists
|
|
196
|
+
const allTab = tabsData.find(
|
|
197
|
+
(tab) => tab.tab_value?.toLowerCase() === "all"
|
|
198
|
+
);
|
|
199
|
+
if (allTab) {
|
|
200
|
+
setSelectedTab(allTab.tab_value || "All");
|
|
201
|
+
} else {
|
|
202
|
+
setSelectedTab(tabsData[0].tab_value || "All");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, [tabsData, selectedTab]);
|
|
206
|
+
|
|
207
|
+
const totalCount = useMemo(() => {
|
|
208
|
+
return Number(
|
|
209
|
+
tableData?.entity_tabs?.find((tab) => {
|
|
210
|
+
const activeTab = selectedTab || "All";
|
|
211
|
+
return (
|
|
212
|
+
tab.tab_value?.toLocaleLowerCase() === activeTab.toLocaleLowerCase()
|
|
213
|
+
);
|
|
214
|
+
})?.tab_value_count || "0"
|
|
215
|
+
);
|
|
216
|
+
}, [tableData, selectedTab]);
|
|
217
|
+
|
|
218
|
+
const handleRenderStatus = ({ value }: any) => {
|
|
219
|
+
const statusValue = value?.toUpperCase();
|
|
220
|
+
return (
|
|
221
|
+
<div
|
|
222
|
+
style={{
|
|
223
|
+
backgroundColor: "#F0F0F0",
|
|
224
|
+
color: "#757575",
|
|
225
|
+
textTransform: "capitalize",
|
|
226
|
+
fontSize: "0.75rem",
|
|
227
|
+
fontWeight: 500,
|
|
228
|
+
borderRadius: "4px",
|
|
229
|
+
padding: "4px",
|
|
230
|
+
width: "fit-content",
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
{statusValue}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const handleRenderAction = ({ row }: any) => {
|
|
239
|
+
return <button onClick={() => alert(JSON.stringify(row))}>Edit</button>;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const filteredData = useMemo(() => {
|
|
243
|
+
if (!searchTerm) return newData;
|
|
244
|
+
|
|
245
|
+
return newData.filter((row: any) =>
|
|
246
|
+
Object.values(row)
|
|
247
|
+
.join(" ")
|
|
248
|
+
.toLowerCase()
|
|
249
|
+
.includes(searchTerm.toLowerCase())
|
|
250
|
+
);
|
|
251
|
+
}, [newData, searchTerm]);
|
|
252
|
+
|
|
253
|
+
// API to handle saving a filter
|
|
254
|
+
const handleSaveFilter = (name: string) => {
|
|
255
|
+
const quickFilter = filters.map((f) => ({
|
|
256
|
+
filter_attribute: f.filter_attribute,
|
|
257
|
+
filter_operator: f.filter_operator,
|
|
258
|
+
filter_value: f.filter_value,
|
|
259
|
+
}));
|
|
260
|
+
|
|
261
|
+
const payload = {
|
|
262
|
+
name,
|
|
263
|
+
is_default: false,
|
|
264
|
+
mapped_entity_type: ENTITY_TYPE, // For that entity type
|
|
265
|
+
status: "ACTIVE",
|
|
266
|
+
entity_type: "SFM", // FIXED entity type
|
|
267
|
+
filterDetails: quickFilter,
|
|
268
|
+
};
|
|
269
|
+
const entity_type = "SFM";
|
|
270
|
+
savedMutation.mutate(
|
|
271
|
+
{ entity_type, payload },
|
|
272
|
+
{
|
|
273
|
+
onSuccess: (response) => {
|
|
274
|
+
const newFilterId = response?.id;
|
|
275
|
+
if (newFilterId) {
|
|
276
|
+
setFilterMaster(
|
|
277
|
+
(prev) =>
|
|
278
|
+
({
|
|
279
|
+
...prev,
|
|
280
|
+
saved_filters: {
|
|
281
|
+
...prev?.saved_filters,
|
|
282
|
+
selectedId: newFilterId.toString(),
|
|
283
|
+
selectedName: name,
|
|
284
|
+
},
|
|
285
|
+
activeFilterTabIndex: 1,
|
|
286
|
+
} as FilterMasterStateProps)
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// API to handle removing or deleting a filter
|
|
295
|
+
const handleRemoveFilter = () => {
|
|
296
|
+
const payload = {
|
|
297
|
+
name: filterToDelete?.label,
|
|
298
|
+
id: filterToDelete?.value,
|
|
299
|
+
is_default: false,
|
|
300
|
+
mapped_entity_type: ENTITY_TYPE,
|
|
301
|
+
status: "INACTIVE",
|
|
302
|
+
entity_type: "SFM",
|
|
303
|
+
};
|
|
304
|
+
const entity_type = "SFM";
|
|
305
|
+
deleteMutation.mutate({ entity_type, payload });
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
//API to update the filter
|
|
309
|
+
const handleUpdateFilter = () => {
|
|
310
|
+
const quickFilter = filters.map((f) => ({
|
|
311
|
+
filter_attribute: f.filter_attribute,
|
|
312
|
+
filter_operator: f.filter_operator,
|
|
313
|
+
filter_value: f.filter_value,
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
const payload = {
|
|
317
|
+
name: filterMaster?.saved_filters?.selectedName, // Name of the filter
|
|
318
|
+
is_default: false,
|
|
319
|
+
id: filterMaster?.saved_filters?.selectedId,
|
|
320
|
+
mapped_entity_type: ENTITY_TYPE,
|
|
321
|
+
status: "ACTIVE",
|
|
322
|
+
entity_type: "SFM",
|
|
323
|
+
filterDetails: quickFilter,
|
|
324
|
+
};
|
|
325
|
+
const entity_type = "SFM";
|
|
326
|
+
updateMutation.mutate({ entity_type, payload });
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const handleSaveSettingsData = (settingsData: SettingsDataProps) => {
|
|
330
|
+
const payload = {
|
|
331
|
+
entity_type: "LAP",
|
|
332
|
+
mapped_entity_type: ENTITY_TYPE,
|
|
333
|
+
layout_json: settingsData,
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
saveSettingsDataMutation.mutate({ payload });
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<TableWrapper
|
|
341
|
+
data={filteredData}
|
|
342
|
+
// data={data}
|
|
343
|
+
// columns={defaultColumns}
|
|
344
|
+
columns={columns && columns.length > 0 ? columns : defaultColumns}
|
|
345
|
+
tableStates={tableStates}
|
|
346
|
+
featureOptions={{
|
|
347
|
+
striped: true,
|
|
348
|
+
compactTable: false,
|
|
349
|
+
enableSorting: !enableServerSideSorting,
|
|
350
|
+
enableColumnReordering: true,
|
|
351
|
+
enableColumnResizing: true,
|
|
352
|
+
enableRowSelection: false,
|
|
353
|
+
enableServerSideSorting: enableServerSideSorting,
|
|
354
|
+
}}
|
|
355
|
+
// loadingOptions={{
|
|
356
|
+
// isLoading: isTableDataPending || detailsQuery.isPending,
|
|
357
|
+
// // loaderText: "Loading, Please wait...",
|
|
358
|
+
// }}
|
|
359
|
+
paginationOptions={{
|
|
360
|
+
showPagination: true,
|
|
361
|
+
paginationPosition: "top",
|
|
362
|
+
paginationView: "compact",
|
|
363
|
+
totalRows: totalCount,
|
|
364
|
+
}}
|
|
365
|
+
customRenderFn={{
|
|
366
|
+
renderStatus: handleRenderStatus,
|
|
367
|
+
renderAction: handleRenderAction,
|
|
368
|
+
}}
|
|
369
|
+
// emptyListComponent={<div>No data found</div>}
|
|
370
|
+
filterOptions={{
|
|
371
|
+
show: tableStates?.showTableFilter,
|
|
372
|
+
component: (
|
|
373
|
+
<CraftTableFilter
|
|
374
|
+
tableStates={tableStates}
|
|
375
|
+
onClose={() => tableStates.setShowTableFilter(false)}
|
|
376
|
+
onUpdateFilter={handleUpdateFilter}
|
|
377
|
+
columnsData={metaQuery.data || {}}
|
|
378
|
+
dropdownData={dropdownData || []}
|
|
379
|
+
onDeleteFilter={handleRemoveFilter}
|
|
380
|
+
onSaveFilter={handleSaveFilter}
|
|
381
|
+
/>
|
|
382
|
+
),
|
|
383
|
+
}}
|
|
384
|
+
topbarOptions={{
|
|
385
|
+
tableStates,
|
|
386
|
+
leftSideComponent: (
|
|
387
|
+
<>
|
|
388
|
+
<TableTabs
|
|
389
|
+
columns={columns}
|
|
390
|
+
settingsOptions={{
|
|
391
|
+
showIcon: true,
|
|
392
|
+
onClick: () => setShowListViewSettings(!showListViewSettings),
|
|
393
|
+
}}
|
|
394
|
+
activeTab={selectedTab}
|
|
395
|
+
tableStates={tableStates}
|
|
396
|
+
tabsData={tabsData}
|
|
397
|
+
onClick={(state) => {
|
|
398
|
+
setSelectedTab(state);
|
|
399
|
+
}}
|
|
400
|
+
/>
|
|
401
|
+
|
|
402
|
+
<QuickFilterSettings
|
|
403
|
+
filterSettingStates={filterSettingStates}
|
|
404
|
+
onClose={() => setShowListViewSettings(false)}
|
|
405
|
+
columnsData={metaQuery.data || {}}
|
|
406
|
+
columnsDataLoading={metaQuery.isPending}
|
|
407
|
+
tabsApiData={settingsTabDropdownData || []}
|
|
408
|
+
tabsApiDataLoading={settingsTabDropdownPending}
|
|
409
|
+
onSaveSettingsData={handleSaveSettingsData}
|
|
410
|
+
/>
|
|
411
|
+
</>
|
|
412
|
+
),
|
|
413
|
+
searchValue: searchTerm,
|
|
414
|
+
onSearchChange: (val) => setSearchTerm(val),
|
|
415
|
+
showFilterToggle: true,
|
|
416
|
+
onFilterButtonClick: () =>
|
|
417
|
+
tableStates.setShowTableFilter(!tableStates.showTableFilter),
|
|
418
|
+
}}
|
|
419
|
+
/>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export default ListingView;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{components → listing/components}/filter/components/forms/components/Dropdown.tsx
RENAMED
|
File without changes
|
/package/src/{components → listing/components}/filter/components/forms/components/Multi-Select.tsx
RENAMED
|
File without changes
|
/package/src/{components → listing/components}/filter/components/forms/components/Select.tsx
RENAMED
|
File without changes
|
/package/src/{components → listing/components}/filter/components/forms/components/Textfield.tsx
RENAMED
|
File without changes
|
/package/src/{components → listing/components}/filter/components/forms/components/styles.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{components → listing/components}/table-settings/components/toggle-button-switch.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{components → listing/components}/table-settings/tabs/vertical/custom-tab-panel.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|