rez-table-listing-mui 1.3.58 → 1.3.59
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 +4 -4
- 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/filter/components/attributes-filter.tsx +2 -2
- package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +5 -4
- package/src/listing/components/login/index.tsx +25 -39
- package/src/listing/components/table-body.tsx +2 -14
- package/src/listing/components/table-settings/components/sorting.tsx +10 -2
- package/src/listing/components/table-settings/index.tsx +3 -3
- package/src/listing/components/tabs/index.tsx +13 -15
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +24 -16
- package/src/listing/libs/utils/apiColumn.ts +11 -11
- package/src/listing/libs/utils/common.ts +3 -9
- package/src/listing/types/common.ts +2 -2
- package/src/listing/types/filter.ts +2 -2
- package/src/testing-grounds/filter-in-modal/saved-filter-modal.tsx +1 -2
- package/src/view/FIlterWrapper.tsx +2 -1
- package/src/view/ListingView.tsx +71 -72
package/src/view/ListingView.tsx
CHANGED
|
@@ -10,11 +10,8 @@ import { ENTITY_TYPE, MAPPED_ENTITY_TYPE } from "../listing/libs/utils/common";
|
|
|
10
10
|
import {
|
|
11
11
|
useCommonFilterDropdownAPI,
|
|
12
12
|
useEntityTableAPI,
|
|
13
|
-
|
|
14
|
-
useGetLayoutAttributes,
|
|
13
|
+
useGetAttributes,
|
|
15
14
|
useGetOperationList,
|
|
16
|
-
useGetSettingsColumnAttributes,
|
|
17
|
-
useGetSettingsDataAPI,
|
|
18
15
|
useSaveSettingsDataAPI,
|
|
19
16
|
useSettingsDropDownAPI,
|
|
20
17
|
} from "../listing/libs/hooks/useEntityTableAPI";
|
|
@@ -55,24 +52,17 @@ function ListingView() {
|
|
|
55
52
|
const { defaultColumns } = useDefaultColumns();
|
|
56
53
|
|
|
57
54
|
const { metaQuery } = useFetchData(ENTITY_TYPE);
|
|
55
|
+
|
|
58
56
|
const { detailsQuery } = useDetailsQueryAPI(
|
|
59
57
|
filterMaster?.saved_filters?.selectedId
|
|
60
58
|
? filterMaster?.saved_filters?.selectedId
|
|
61
59
|
: metaQuery?.data?.default_filter?.value
|
|
62
60
|
);
|
|
63
61
|
const { saveSettingsDataMutation } = useSaveSettingsDataAPI(ENTITY_TYPE);
|
|
64
|
-
const { settingsColumnAttributes } =
|
|
65
|
-
useGetSettingsColumnAttributes(ENTITY_TYPE);
|
|
66
62
|
const { operationList } = useGetOperationList();
|
|
67
63
|
|
|
68
|
-
const {
|
|
69
|
-
entity_type: ENTITY_TYPE,
|
|
70
|
-
data_type: "select",
|
|
71
|
-
});
|
|
64
|
+
const { attributes } = useGetAttributes(ENTITY_TYPE);
|
|
72
65
|
|
|
73
|
-
const { layoutAttributes: sortingTabAttributes } = useGetLayoutAttributes({
|
|
74
|
-
entity_type: ENTITY_TYPE,
|
|
75
|
-
});
|
|
76
66
|
const isColumnDefault =
|
|
77
67
|
filterSettingStates?.columnTabState?.isDefault || false;
|
|
78
68
|
const activeTabIndex = filterSettingStates?.columnTabState?.tabs?.findIndex(
|
|
@@ -118,55 +108,58 @@ function ListingView() {
|
|
|
118
108
|
// ?.filter((col): col is ColumnDef<any> => col !== undefined); // Ensure non-undefined columns are returned
|
|
119
109
|
|
|
120
110
|
// didnt know what above code was doing so rewrote it as below
|
|
121
|
-
const res = showList.map((item: any) => ({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}));
|
|
126
|
-
|
|
127
|
-
return res;
|
|
111
|
+
// const res = showList.map((item: any) => ({
|
|
112
|
+
// id: item.value,
|
|
113
|
+
// accessorKey: item.value,
|
|
114
|
+
// header: item.label,
|
|
115
|
+
// }));
|
|
116
|
+
|
|
117
|
+
// return res;
|
|
118
|
+
return allColumns;
|
|
128
119
|
};
|
|
129
120
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
121
|
+
setColumns(allColumns);
|
|
122
|
+
|
|
123
|
+
// if (
|
|
124
|
+
// savedColumnSettings &&
|
|
125
|
+
// !savedColumnSettings.isDefault &&
|
|
126
|
+
// savedColumnSettings.tabs
|
|
127
|
+
// ) {
|
|
128
|
+
// // Tab-wise view: find the active tab and use its show_list
|
|
129
|
+
// const activeTabSettings = savedColumnSettings.tabs.find(
|
|
130
|
+
// (tab) => tab.tab_name?.value == selectedTab.toLowerCase()
|
|
131
|
+
// );
|
|
132
|
+
|
|
133
|
+
// if (activeTabSettings?.show_list) {
|
|
134
|
+
// const visibleColumns = new Set(
|
|
135
|
+
// activeTabSettings.show_list.map((c) => c.value)
|
|
136
|
+
// );
|
|
137
|
+
|
|
138
|
+
// // First, filter columns based on visibleColumns
|
|
139
|
+
// const filteredColumns = allColumns.filter((col: any) =>
|
|
140
|
+
// visibleColumns.has(col?.accessorKey)
|
|
141
|
+
// );
|
|
142
|
+
// setColumns(
|
|
143
|
+
// getOrderedColumns(activeTabSettings.show_list, filteredColumns)
|
|
144
|
+
// );
|
|
145
|
+
// } else {
|
|
146
|
+
// // Fallback if no specific settings for the active tab are found
|
|
147
|
+
// setColumns(allColumns);
|
|
148
|
+
// }
|
|
149
|
+
// } else if (savedColumnSettings && savedColumnSettings.show_list) {
|
|
150
|
+
// // Default view: use the main show_list
|
|
151
|
+
// const visibleColumns = new Set(
|
|
152
|
+
// savedColumnSettings.show_list.map((c) => c.value)
|
|
153
|
+
// );
|
|
154
|
+
// const filtered = allColumns.filter((col: any) =>
|
|
155
|
+
// visibleColumns.has(col?.accessorKey)
|
|
156
|
+
// );
|
|
157
|
+
|
|
158
|
+
// setColumns(getOrderedColumns(savedColumnSettings.show_list, filtered));
|
|
159
|
+
// } else {
|
|
160
|
+
// // No settings found, use all columns
|
|
161
|
+
// setColumns(allColumns);
|
|
162
|
+
// }
|
|
170
163
|
} catch (error) {
|
|
171
164
|
console.error("Failed to fetch metadata:", error);
|
|
172
165
|
}
|
|
@@ -238,17 +231,17 @@ function ListingView() {
|
|
|
238
231
|
tabsData &&
|
|
239
232
|
tabsData.length > 0 &&
|
|
240
233
|
!tabsData.some(
|
|
241
|
-
(tab) => tab.
|
|
234
|
+
(tab) => tab.tab_name?.toLowerCase() === selectedTab.toLowerCase()
|
|
242
235
|
)
|
|
243
236
|
) {
|
|
244
237
|
// Try to select 'ALL' if it exists
|
|
245
238
|
const allTab = tabsData.find(
|
|
246
|
-
(tab) => tab.
|
|
239
|
+
(tab) => tab.tab_name?.toLowerCase() === "all"
|
|
247
240
|
);
|
|
248
241
|
if (allTab) {
|
|
249
|
-
setSelectedTab(allTab.
|
|
242
|
+
setSelectedTab(allTab.tab_name || "All");
|
|
250
243
|
} else {
|
|
251
|
-
setSelectedTab(tabsData[0].
|
|
244
|
+
setSelectedTab(tabsData[0].tab_name || "All");
|
|
252
245
|
}
|
|
253
246
|
}
|
|
254
247
|
}, [tabsData, selectedTab]);
|
|
@@ -258,9 +251,9 @@ function ListingView() {
|
|
|
258
251
|
tableData?.entity_tabs?.find((tab) => {
|
|
259
252
|
const activeTab = selectedTab || "All";
|
|
260
253
|
return (
|
|
261
|
-
tab.
|
|
254
|
+
tab.tab_name?.toLocaleLowerCase() === activeTab.toLocaleLowerCase()
|
|
262
255
|
);
|
|
263
|
-
})?.
|
|
256
|
+
})?.count || "0"
|
|
264
257
|
);
|
|
265
258
|
}, [tableData, selectedTab]);
|
|
266
259
|
|
|
@@ -410,6 +403,9 @@ function ListingView() {
|
|
|
410
403
|
queryClient.invalidateQueries({
|
|
411
404
|
queryKey: ["GET_NAVIGATION_LAYOUT", ENTITY_TYPE],
|
|
412
405
|
});
|
|
406
|
+
queryClient.invalidateQueries({
|
|
407
|
+
queryKey: ["meta", ENTITY_TYPE],
|
|
408
|
+
});
|
|
413
409
|
},
|
|
414
410
|
}
|
|
415
411
|
);
|
|
@@ -541,14 +537,17 @@ function ListingView() {
|
|
|
541
537
|
onClose={() => setShowListViewSettings(false)}
|
|
542
538
|
columnsData={metaQuery.data || {}}
|
|
543
539
|
columnsDataLoading={metaQuery.isPending}
|
|
544
|
-
quickTabAttributes={
|
|
545
|
-
|
|
546
|
-
|
|
540
|
+
quickTabAttributes={attributes?.data?.map((item) => ({
|
|
541
|
+
label: item.name,
|
|
542
|
+
value: item.attribute_key,
|
|
543
|
+
}))}
|
|
544
|
+
quickTabAttributesLoading={attributes?.data?.isLoading}
|
|
545
|
+
columnTabAttributes={attributes?.data?.filter(
|
|
547
546
|
(item) => item.attribute_key
|
|
548
547
|
)}
|
|
549
|
-
columnAttributesLoading={
|
|
550
|
-
sortingTabAttributes={
|
|
551
|
-
sortingTabAttributesLoading={
|
|
548
|
+
columnAttributesLoading={attributes?.data?.isLoading}
|
|
549
|
+
sortingTabAttributes={attributes?.data}
|
|
550
|
+
sortingTabAttributesLoading={attributes?.data?.isLoading}
|
|
552
551
|
tabsApiData={settingsTabDropdownData || []}
|
|
553
552
|
tabsApiDataLoading={settingsTabDropdownPending}
|
|
554
553
|
onSaveSettingsData={handleSaveSettingsData}
|