rez-table-listing-mui 1.0.45 → 1.0.47
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/package.json
CHANGED
|
@@ -35,8 +35,14 @@ const QuickTab = ({
|
|
|
35
35
|
tabsApiData,
|
|
36
36
|
tabsApiDataLoading,
|
|
37
37
|
}: SettingsQuickTabProps) => {
|
|
38
|
-
const {
|
|
39
|
-
|
|
38
|
+
const {
|
|
39
|
+
quickTabStates,
|
|
40
|
+
setQuickTabStates,
|
|
41
|
+
settingsData,
|
|
42
|
+
setColumnTabState,
|
|
43
|
+
saveButtonError,
|
|
44
|
+
setSaveButtonError,
|
|
45
|
+
} = filterSettingStates;
|
|
40
46
|
|
|
41
47
|
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
42
48
|
|
|
@@ -101,6 +107,43 @@ const QuickTab = ({
|
|
|
101
107
|
}));
|
|
102
108
|
}
|
|
103
109
|
}
|
|
110
|
+
|
|
111
|
+
// check for error
|
|
112
|
+
const hasInvalidValidShowList =
|
|
113
|
+
quickTabStates.show_list &&
|
|
114
|
+
(quickTabStates.show_list?.length === 0 ||
|
|
115
|
+
quickTabStates.show_list.length >= 5);
|
|
116
|
+
|
|
117
|
+
if (hasInvalidValidShowList) {
|
|
118
|
+
// Check if error is already in the state to avoid duplication
|
|
119
|
+
const errorMessage = {
|
|
120
|
+
type: "quick_tab_error",
|
|
121
|
+
message:
|
|
122
|
+
"Quick Tab : View as Tabs should have at least 1 and at most 5 tabs.",
|
|
123
|
+
};
|
|
124
|
+
const hasQuickTabError = saveButtonError?.messages?.some(
|
|
125
|
+
(message) => message.type === "quick_tab_error"
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
if (!hasQuickTabError) {
|
|
129
|
+
setSaveButtonError((prev) => ({
|
|
130
|
+
...prev,
|
|
131
|
+
hasError: true,
|
|
132
|
+
messages: [...(prev?.messages || []), errorMessage], // Only add if it doesn't exist
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
const otherMessages =
|
|
137
|
+
saveButtonError?.messages?.filter(
|
|
138
|
+
(message) => message.type !== "quick_tab_error"
|
|
139
|
+
) || [];
|
|
140
|
+
|
|
141
|
+
setSaveButtonError((prev) => ({
|
|
142
|
+
...prev,
|
|
143
|
+
hasError: otherMessages.length > 0,
|
|
144
|
+
messages: otherMessages,
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
104
147
|
}, [quickTabStates.show_list, quickTabStates.hide_list]);
|
|
105
148
|
|
|
106
149
|
// useEffect(() => {
|
|
@@ -37,6 +37,7 @@ export function QuickFilterSettings({
|
|
|
37
37
|
quickTabStates,
|
|
38
38
|
columnTabState,
|
|
39
39
|
sortingTabState,
|
|
40
|
+
saveButtonError,
|
|
40
41
|
} = filterSettingStates;
|
|
41
42
|
|
|
42
43
|
const hasAPIData = Boolean(Object.entries(columnsData).length);
|
|
@@ -148,7 +149,10 @@ export function QuickFilterSettings({
|
|
|
148
149
|
|
|
149
150
|
{!columnsDataLoading && hasAPIData && (
|
|
150
151
|
<DialogActions>
|
|
151
|
-
<CustomButton
|
|
152
|
+
<CustomButton
|
|
153
|
+
disabled={saveButtonError?.hasError}
|
|
154
|
+
onClick={handleSaveSetSettingsData}
|
|
155
|
+
>
|
|
152
156
|
Save Quick Filter
|
|
153
157
|
</CustomButton>
|
|
154
158
|
</DialogActions>
|
|
@@ -45,7 +45,6 @@ function Topbar<T>({
|
|
|
45
45
|
tableStates,
|
|
46
46
|
onFilterButtonClick,
|
|
47
47
|
}: TopbarProps<T>) {
|
|
48
|
-
const [isFullscreenState, setIsFullscreenState] = useState(isFullscreen);
|
|
49
48
|
const [sortAnchorEl, setSortAnchorEl] = useState<HTMLElement | null>(null);
|
|
50
49
|
const [groupBy, setGroupBy] = useState<string>("None");
|
|
51
50
|
|
|
@@ -211,11 +210,8 @@ function Topbar<T>({
|
|
|
211
210
|
onCompactToggle={(value: string) =>
|
|
212
211
|
setIsCompactTable(value === "Compact")
|
|
213
212
|
}
|
|
214
|
-
isFullscreen={
|
|
215
|
-
onFullscreenToggle={
|
|
216
|
-
fullscreenToggle();
|
|
217
|
-
setIsFullscreenState((prev) => !prev);
|
|
218
|
-
}}
|
|
213
|
+
isFullscreen={isFullscreen}
|
|
214
|
+
onFullscreenToggle={fullscreenToggle}
|
|
219
215
|
groupBy={groupBy}
|
|
220
216
|
onGroupByChange={(value: string) => setGroupBy(value)}
|
|
221
217
|
tableStates={tableStates}
|