rez-table-listing-mui 2.0.12 → 2.0.13
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 +2 -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/listing/components/table-settings/components/quick-tab.tsx +14 -3
- package/src/listing/components/table-settings/index.tsx +2 -0
- package/src/listing/types/filter-settings.ts +2 -0
- package/src/view/ListingView.tsx +1 -0
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ const QuickTab = ({
|
|
|
38
38
|
tabsApiDataLoading,
|
|
39
39
|
activeTab,
|
|
40
40
|
columnTabAttributes,
|
|
41
|
+
isFlatJson,
|
|
41
42
|
}: SettingsQuickTabProps) => {
|
|
42
43
|
const {
|
|
43
44
|
settingsData,
|
|
@@ -65,6 +66,10 @@ const QuickTab = ({
|
|
|
65
66
|
// // tab?.tab_name?.label?.toLowerCase() == activeTab?.toLowerCase()
|
|
66
67
|
// );
|
|
67
68
|
// In case there is no quick tab state from API
|
|
69
|
+
const normalizeTabItem = (item: any) => ({
|
|
70
|
+
label: item.label,
|
|
71
|
+
value: isFlatJson ? item.label : item.value,
|
|
72
|
+
});
|
|
68
73
|
useEffect(() => {
|
|
69
74
|
const stateToArray =
|
|
70
75
|
(quickTabStates && Object.entries(quickTabStates)) || [];
|
|
@@ -86,12 +91,14 @@ const QuickTab = ({
|
|
|
86
91
|
useEffect(() => {
|
|
87
92
|
if (currentQuickAttribute === settingsData?.quick_tab?.attribute) return;
|
|
88
93
|
|
|
94
|
+
const normalizedTabs = tabsApiData?.map(normalizeTabItem) || [];
|
|
95
|
+
|
|
89
96
|
if (tabsApiData?.length) {
|
|
90
97
|
setSettingsData((prev) => ({
|
|
91
98
|
...prev,
|
|
92
99
|
quick_tab: {
|
|
93
100
|
...prev?.quick_tab,
|
|
94
|
-
hide_list:
|
|
101
|
+
hide_list: normalizedTabs,
|
|
95
102
|
show_list: [],
|
|
96
103
|
},
|
|
97
104
|
}));
|
|
@@ -178,10 +185,14 @@ const QuickTab = ({
|
|
|
178
185
|
// Convert show_list/hide_list to FilterValue[] for rendering only
|
|
179
186
|
|
|
180
187
|
const constructHideList = () => {
|
|
181
|
-
|
|
182
|
-
|
|
188
|
+
const normalizedTabs = tabsApiData?.map(normalizeTabItem) || [];
|
|
189
|
+
|
|
190
|
+
// remove items already in show_list (value-safe comparison)
|
|
191
|
+
return normalizedTabs?.filter(
|
|
192
|
+
(tab) => !showListValues?.some((i) => i?.value === tab?.value)
|
|
183
193
|
);
|
|
184
194
|
};
|
|
195
|
+
|
|
185
196
|
const showListValues = quickTabStates?.show_list || [];
|
|
186
197
|
const hideListValues = constructHideList() || [];
|
|
187
198
|
|
|
@@ -25,6 +25,7 @@ import { useFullscreenPopoverContainer } from "../../libs/hooks/useFullScreen";
|
|
|
25
25
|
|
|
26
26
|
export function QuickFilterSettings({
|
|
27
27
|
view = "listing",
|
|
28
|
+
isFlatJson,
|
|
28
29
|
show,
|
|
29
30
|
filterSettingStates,
|
|
30
31
|
onClose,
|
|
@@ -146,6 +147,7 @@ export function QuickFilterSettings({
|
|
|
146
147
|
tabsApiDataLoading={tabsApiDataLoading}
|
|
147
148
|
activeTab={activeTab}
|
|
148
149
|
columnTabAttributes={columnTabAttributes}
|
|
150
|
+
isFlatJson={isFlatJson}
|
|
149
151
|
/>
|
|
150
152
|
)}
|
|
151
153
|
</CustomTabPanel>
|
|
@@ -3,6 +3,7 @@ import { craftTableFilterSettingsOptionsProps } from "./table-options";
|
|
|
3
3
|
|
|
4
4
|
export interface QuickFilterModalProps {
|
|
5
5
|
view?: string;
|
|
6
|
+
isFlatJson: boolean;
|
|
6
7
|
show?: boolean;
|
|
7
8
|
filterSettingStates: craftTableFilterSettingsOptionsProps;
|
|
8
9
|
onClose?: () => void;
|
|
@@ -102,6 +103,7 @@ export interface SettingsQuickTabProps {
|
|
|
102
103
|
activeTab?: string;
|
|
103
104
|
columnTabAttributes?: any[];
|
|
104
105
|
columnTabAttributesLoading?: boolean;
|
|
106
|
+
isFlatJson: boolean;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
export interface SettingsDataProps {
|
package/src/view/ListingView.tsx
CHANGED
|
@@ -503,6 +503,7 @@ function ListingView() {
|
|
|
503
503
|
|
|
504
504
|
<QuickFilterSettings
|
|
505
505
|
view="listing"
|
|
506
|
+
isFlatJson={metaQuery.data?.is_flat_json || false}
|
|
506
507
|
filterSettingStates={filterSettingStates}
|
|
507
508
|
onClose={() => setShowListViewSettings(false)}
|
|
508
509
|
columnsData={metaQuery.data || {}}
|