rez-table-listing-mui 1.0.38 → 1.0.39

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.
@@ -267,10 +267,6 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
267
267
  setSelectedTabIndex(newValue);
268
268
  };
269
269
 
270
- console.log("+++++", quickTabStates?.show_list?.length);
271
-
272
- TOGGLE_BUTTON_TABS[1].isDisabled = !quickTabStates?.show_list?.length;
273
-
274
270
  return (
275
271
  <Box sx={{ maxHeight: "600px" }}>
276
272
  <Box sx={{ maxHeight: "500px", borderRadius: 1, bgcolor: "white" }}>
@@ -38,9 +38,14 @@ const QuickTab = ({
38
38
  const [searchTerm, setSearchTerm] = useState<string>("");
39
39
 
40
40
  useEffect(() => {
41
+ // if Tab changes i dont want to reset the show list and hide list in tab change the api musnt trigger for the show list and hide list
42
+
41
43
  if (!Object.entries(quickTabStates).length) {
44
+ // if (quickTabStates && quickTabStates.show_list?.length) return;
42
45
  setQuickTabStates({
43
- attribute: columnsData?.column_list[0]?.attribute_key || "",
46
+ attribute: columnsData?.column_list?.filter(
47
+ (item) => item.datasource_list
48
+ )[0]?.attribute_key,
44
49
  sorting: sortingOptions[0]?.value as QuickTabSortingType,
45
50
  hide_list: [],
46
51
  show_list: [],
@@ -51,10 +56,19 @@ const QuickTab = ({
51
56
 
52
57
  setQuickTabStates((prev) => ({
53
58
  ...prev,
54
- hide_list: tabsApiData,
59
+ hide_list: tabsApiData, // All data goes to hide_list initially
60
+ show_list: [], // Empty the show_list when attribute/sorting changes
55
61
  }));
56
62
  }, [columnsData.column_list, tabsApiData]);
57
63
 
64
+ // useEffect(() => {
65
+ // setQuickTabStates((prev) => ({
66
+ // ...prev,
67
+ // hide_list: tabsApiData, // All data goes to hide_list initially
68
+ // show_list: [], // Empty the show_list when attribute/sorting changes
69
+ // }));
70
+ // }, [quickTabStates.attribute, quickTabStates.sorting]);
71
+
58
72
  const sortingOptions = [
59
73
  { label: "A-Z", value: "asc" },
60
74
  { label: "Z-A", value: "dsc" },
@@ -203,14 +217,16 @@ const QuickTab = ({
203
217
  }))
204
218
  }
205
219
  >
206
- {columnsData?.column_list?.map((column) => (
207
- <MenuItem
208
- key={column?.attribute_key}
209
- value={column?.attribute_key}
210
- >
211
- {column?.name}
212
- </MenuItem>
213
- ))}
220
+ {columnsData?.column_list
221
+ ?.filter((col) => col.datasource_list != null)
222
+ .map((column) => (
223
+ <MenuItem
224
+ key={column?.attribute_key}
225
+ value={column?.attribute_key}
226
+ >
227
+ {column?.name}
228
+ </MenuItem>
229
+ ))}
214
230
  </Select>
215
231
  </FormControl>
216
232
  <FormControl
@@ -50,7 +50,7 @@ export function TableTabs({
50
50
  {settingsOptions?.showIcon && (
51
51
  <IconButton
52
52
  onClick={settingsOptions?.onClick}
53
- style={{ zIndex: 1000 }}
53
+ style={{ zIndex: 1000, marginRight: "0.75rem" }}
54
54
  >
55
55
  <SettingsOutlinedIcon />
56
56
  </IconButton>
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export { TableFilter as CraftTableFilter } from "./components/filter";
5
5
 
6
6
  export * from "./types/table";
7
7
  export * from "./types/table-options";
8
+ export * from "./types/filter-settings";