rez-table-listing-mui 1.3.62 → 2.0.0

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.
Files changed (31) hide show
  1. package/dist/index.d.ts +4 -5
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/src/listing/components/index.scss +0 -144
  8. package/src/listing/components/login/index.tsx +4 -4
  9. package/src/listing/components/pagination/default/index.tsx +108 -138
  10. package/src/listing/components/pagination/default/pagination.styles.ts +113 -0
  11. package/src/listing/components/{table-body-dnd-cell.tsx → table-body/table-body-dnd-cell.tsx} +18 -25
  12. package/src/listing/components/table-body/table-body.styles.ts +64 -0
  13. package/src/listing/components/{table-body.tsx → table-body/table-body.tsx} +35 -32
  14. package/src/listing/components/table-head/table-head-dnd-cell.tsx +112 -0
  15. package/src/listing/components/table-head/table-head-pin.tsx +29 -0
  16. package/src/listing/components/{table-head-popover.tsx → table-head/table-head-popover.tsx} +4 -16
  17. package/src/listing/components/table-head/table-head-resizer.tsx +22 -0
  18. package/src/listing/components/table-head/table-head.styles.ts +115 -0
  19. package/src/listing/components/{table-head.tsx → table-head/table-head.tsx} +36 -69
  20. package/src/listing/components/table.tsx +2 -2
  21. package/src/listing/components/tabs/index.tsx +23 -41
  22. package/src/listing/components/tabs/tabs.styles.ts +49 -0
  23. package/src/listing/libs/hooks/useEntityTableHooks.ts +3 -3
  24. package/src/listing/libs/utils/apiColumn.ts +7 -3
  25. package/src/listing/libs/utils/common.ts +44 -0
  26. package/src/listing/types/table.ts +2 -2
  27. package/src/view/ListingView.tsx +39 -88
  28. package/src/listing/components/table-head-dnd-cell.tsx +0 -150
  29. package/src/listing/components/table-head-pin.tsx +0 -22
  30. package/src/listing/components/tabs/index.scss +0 -42
  31. package/src/listing/components/tabs/styles.ts +0 -34
@@ -3,17 +3,25 @@ import {
3
3
  CraftTableFeatureProps,
4
4
  craftTableFilterSettingsOptionsProps,
5
5
  CraftTableOptionsProps,
6
- } from "../types/table-options";
7
- import { DownArrow, UpArrow } from "../../assets/svg";
8
- import { CSSProperties, useState } from "react";
9
- import { getColumnPinningStyles } from "../libs/utils/common";
6
+ } from "../../types/table-options";
7
+ import { DownArrow, UpArrow } from "../../../assets/svg";
8
+ import { useState } from "react";
9
+ import { getColumnPinningStyles } from "../../libs/utils/common";
10
10
  import {
11
11
  horizontalListSortingStrategy,
12
12
  SortableContext,
13
13
  } from "@dnd-kit/sortable";
14
14
  import DraggableTableHeader from "./table-head-dnd-cell";
15
15
  import TableHeadPin from "./table-head-pin";
16
- import Checkbox from "./inputs/checkbox";
16
+ import Checkbox from "../inputs/checkbox";
17
+ import TableColumnResizeHandle from "./table-head-resizer";
18
+ import {
19
+ TableHeadCell,
20
+ TableHeadContent,
21
+ TableHeadRoot,
22
+ TableHeadRow,
23
+ TableHeadSort,
24
+ } from "./table-head.styles";
17
25
 
18
26
  interface TableHeadProps<T> {
19
27
  table: Table<T>;
@@ -49,54 +57,26 @@ function TableHead<T>({
49
57
  };
50
58
 
51
59
  return (
52
- <thead className={`ts__head ${stickyHeader ? "ts--sticky" : ""}`.trim()}>
60
+ <TableHeadRoot sticky={stickyHeader}>
53
61
  {table.getHeaderGroups().map((headerGroup) => (
54
- <tr className="ts__head__tr" key={headerGroup?.id}>
62
+ <TableHeadRow striped={featureOptions.striped} key={headerGroup?.id}>
55
63
  {enableRowSelection && (
56
- <th
57
- className="ts__head__th ts__head__checkbox"
58
- style={{
59
- position: "sticky",
60
- left: 0,
61
- width: "50px",
62
- }}
64
+ <TableHeadCell
65
+ sticky
66
+ compact={featureOptions.compactTable}
67
+ style={{ width: 50 }}
63
68
  >
64
- <div className="ts__content">
69
+ <TableHeadContent>
65
70
  <Checkbox
66
71
  checked={table.getIsAllRowsSelected()}
67
72
  indeterminate={table.getIsSomeRowsSelected()}
68
73
  onChange={() => table.toggleAllRowsSelected()}
69
74
  />
70
- </div>
71
- </th>
75
+ </TableHeadContent>
76
+ </TableHeadCell>
72
77
  )}
73
78
 
74
79
  {headerGroup.headers.map((header) => {
75
- let sortProps: {
76
- className: string;
77
- title?: string;
78
- style?: CSSProperties;
79
- } = {
80
- className: "ts__content",
81
- // style: {
82
- // justifyContent: getColumnAlignment(
83
- // (header?.column?.columnDef?.meta as align)?.align
84
- // ),
85
- // },
86
- };
87
-
88
- // if (header.column.getCanSort()) {
89
- // sortProps = {
90
- // ...sortProps,
91
- // title:
92
- // header.column.getNextSortingOrder() === "asc"
93
- // ? "Sort ascending"
94
- // : header.column.getNextSortingOrder() === "desc"
95
- // ? "Sort descending"
96
- // : "Clear sort",
97
- // };
98
- // }
99
-
100
80
  return enableColumnReordering ? (
101
81
  <SortableContext
102
82
  key={header?.id}
@@ -113,36 +93,30 @@ function TableHead<T>({
113
93
  />
114
94
  </SortableContext>
115
95
  ) : (
116
- <th
96
+ <TableHeadCell
117
97
  key={header?.id}
118
- className="ts__head__th"
119
98
  colSpan={header.colSpan}
99
+ compact={featureOptions.compactTable}
100
+ onClick={handleHover}
120
101
  style={{
121
102
  ...getColumnPinningStyles(header.column),
122
103
  width: `${header.column.getSize()}px`,
123
104
  minWidth: `${header.column.columnDef.minSize}px`,
124
105
  maxWidth: `${header.column.columnDef.maxSize}px`,
125
106
  }}
126
- onClick={handleHover}
127
107
  >
128
108
  {header.isPlaceholder ? null : (
129
- <div {...sortProps}>
130
- <div
131
- className={`${
132
- header.column.getCanSort() ? "ts__content__sort" : ""
133
- }`.trim()}
134
- // onClick={header.column.getToggleSortingHandler()}
135
- >
109
+ <TableHeadContent>
110
+ <TableHeadSort sortable={header.column.getCanSort()}>
136
111
  {flexRender(
137
112
  header.column.columnDef.header,
138
113
  header.getContext()
139
114
  )}
140
115
 
141
- {{
142
- asc: <UpArrow />,
143
- desc: <DownArrow />,
144
- }[header.column.getIsSorted() as "asc" | "desc"] ?? null}
145
- </div>
116
+ {{ asc: <UpArrow />, desc: <DownArrow /> }[
117
+ header.column.getIsSorted() as "asc" | "desc"
118
+ ] ?? null}
119
+ </TableHeadSort>
146
120
 
147
121
  {enableColumnPinning && (
148
122
  <TableHeadPin
@@ -151,19 +125,12 @@ function TableHead<T>({
151
125
  tableStates={tableStates}
152
126
  />
153
127
  )}
154
- </div>
128
+ </TableHeadContent>
155
129
  )}
156
130
 
157
131
  {/* column resizing */}
158
132
  {header.column.getCanResize() ? (
159
- <div
160
- onDoubleClick={() => header.column.resetSize()}
161
- onMouseDown={header.getResizeHandler()}
162
- onTouchStart={header.getResizeHandler()}
163
- className={`column__resize ${
164
- header.column.getIsResizing() ? "is__resizing" : ""
165
- }`}
166
- />
133
+ <TableColumnResizeHandle header={header} />
167
134
  ) : null}
168
135
 
169
136
  {/* Popover */}
@@ -174,12 +141,12 @@ function TableHead<T>({
174
141
  wrap={wrap}
175
142
  tableStates={tableStates}
176
143
  /> */}
177
- </th>
144
+ </TableHeadCell>
178
145
  );
179
146
  })}
180
- </tr>
147
+ </TableHeadRow>
181
148
  ))}
182
- </thead>
149
+ </TableHeadRoot>
183
150
  );
184
151
  }
185
152
 
@@ -1,7 +1,7 @@
1
1
  import { formatClassName } from "../libs/utils/common";
2
2
  import { CraftTableComponentProps } from "../types/table";
3
- import TableBody from "./table-body";
4
- import TableHead from "./table-head";
3
+ import TableBody from "./table-body/table-body";
4
+ import TableHead from "./table-head/table-head";
5
5
 
6
6
  function Table<T>({
7
7
  table,
@@ -1,31 +1,28 @@
1
- import "./index.scss";
2
- import { Box, CircularProgress, IconButton, Tab, Tabs } from "@mui/material";
1
+ import { Box, CircularProgress, IconButton } from "@mui/material";
3
2
  import { CraftTableOptionsProps } from "../../types/table-options";
4
- import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
5
3
  import { settingsOptionsProps } from "../../types/table";
6
- import { tableTabsStyles } from "./styles";
7
4
  import { useMemo } from "react";
8
- import { SettingIcon } from "../../../assets/svg";
5
+ import { TableTab, TableTabCount, TableTabsRoot } from "./tabs.styles";
6
+ import { SettingsOutlined } from "@mui/icons-material";
9
7
 
10
8
  interface TabDataProps {
11
9
  tab_name: string | null;
12
- count: string | number;
10
+ count?: string | number;
13
11
  }
14
12
 
15
13
  interface TableTabsProps {
16
14
  loading?: boolean;
17
15
  tabsData?: TabDataProps[];
18
- activeTab?: any;
16
+ activeTab?: TabDataProps;
19
17
  tableStates: CraftTableOptionsProps;
20
18
  onClick: (state: string) => void;
21
- columns?: any[];
22
19
  settingsOptions?: settingsOptionsProps;
23
20
  }
24
21
 
25
22
  export function TableTabs({
26
23
  loading = false,
27
24
  tabsData = [],
28
- activeTab = "All",
25
+ activeTab = { tab_name: "All", count: 0 },
29
26
  onClick,
30
27
  tableStates,
31
28
  settingsOptions,
@@ -34,10 +31,12 @@ export function TableTabs({
34
31
 
35
32
  const handleTabClick = (tab: string) => {
36
33
  onClick(tab);
37
- tableStates.setPagination((prev) => ({ ...prev, pageIndex: 0 }));
34
+ tableStates.setPagination((prev) => ({
35
+ ...prev,
36
+ pageIndex: 0,
37
+ }));
38
38
  };
39
39
 
40
- // Normalize tab_name to uppercase for display + logic
41
40
  const normalizedTabs = useMemo(() => {
42
41
  return tabsData
43
42
  ?.filter((tab) => tab.tab_name !== null)
@@ -55,64 +54,47 @@ export function TableTabs({
55
54
  );
56
55
  }, [normalizedTabs]);
57
56
 
58
- const selectedTab = activeTab || defaultTab;
57
+ const selectedTab = activeTab?.tab_name || defaultTab;
59
58
 
60
59
  return (
61
60
  <Box display="flex" alignItems="center" justifyContent="flex-start">
62
- {/* Layout settings icon */}
61
+ {/* Settings icon */}
63
62
  {settingsOptions?.showIcon && (
64
- <IconButton
65
- onClick={settingsOptions?.onClick}
66
- sx={{ zIndex: 1000, mx: 0 }}
67
- >
68
- <SettingIcon />
63
+ <IconButton size="small" onClick={settingsOptions?.onClick}>
64
+ <SettingsOutlined fontSize="small" />
69
65
  </IconButton>
70
66
  )}
71
67
 
72
68
  {/* Tabs */}
73
- <Tabs
69
+ <TableTabsRoot
74
70
  value={selectedTab}
75
- onChange={(_, newValue) => {
76
- handleTabClick(newValue);
77
- }}
71
+ onChange={(_, newValue) => handleTabClick(newValue)}
78
72
  variant="scrollable"
79
73
  scrollButtons="auto"
80
- slotProps={{ indicator: { sx: { display: "none" } } }}
81
- sx={tableTabsStyles.tabs}
82
74
  >
83
75
  {normalizedTabs.map((tab) => {
84
76
  const isSelected = activeTab?.tab_name === tab?.tab_name;
85
77
 
86
78
  return (
87
- <Tab
79
+ <TableTab
88
80
  key={tab?.tab_name}
89
81
  value={tab}
90
82
  label={
91
83
  <Box display="flex" alignItems="center" gap={1}>
92
- <Box>{tab?.tab_name}</Box>
93
- <Box
94
- sx={{
95
- ...tableTabsStyles.tabCount,
96
- ...(isSelected && {
97
- // backgroundColor: "#ced3da",
98
- // borderColor: "#ced3da",
99
- backgroundColor: "#000",
100
- color: "#fff",
101
- fontWeight: "500",
102
- }),
103
- }}
104
- >
84
+ <Box sx={{ color: isSelected ? "#000" : "" }}>
85
+ {tab?.tab_name}
86
+ </Box>
87
+ <TableTabCount selected={isSelected}>
105
88
  {tab?.count == 0
106
89
  ? "0"
107
90
  : String(tab?.count).padStart(2, "0")}
108
- </Box>
91
+ </TableTabCount>
109
92
  </Box>
110
93
  }
111
- sx={tableTabsStyles.tab}
112
94
  />
113
95
  );
114
96
  })}
115
- </Tabs>
97
+ </TableTabsRoot>
116
98
  </Box>
117
99
  );
118
100
  }
@@ -0,0 +1,49 @@
1
+ // tableTabs.styles.ts
2
+ import { styled } from "@mui/material/styles";
3
+ import Tabs, { tabsClasses } from "@mui/material/Tabs";
4
+ import Tab, { tabClasses } from "@mui/material/Tab";
5
+ import Box from "@mui/material/Box";
6
+
7
+ export const TableTabsRoot = styled(Tabs)(({ theme }) => ({
8
+ minHeight: theme.spacing(3.5),
9
+
10
+ [`& .${tabsClasses.flexContainer}`]: {
11
+ minHeight: theme.spacing(3.5),
12
+ },
13
+
14
+ // hide indicator (instead of slotProps every time)
15
+ [`& .${tabsClasses.indicator}`]: {
16
+ display: "none",
17
+ },
18
+ }));
19
+
20
+ export const TableTab = styled(Tab)(({ theme }) => ({
21
+ color: theme.palette.grey[600],
22
+ padding: theme.spacing(1, 1.5),
23
+ minHeight: theme.spacing(3.5),
24
+ maxHeight: theme.spacing(3.5),
25
+ textTransform: "none",
26
+ minWidth: "unset",
27
+ whiteSpace: "nowrap",
28
+
29
+ [`&.${tabClasses.selected}`]: {
30
+ color: theme.palette.text.primary,
31
+ fontWeight: 700,
32
+ },
33
+ }));
34
+
35
+ export const TableTabCount = styled(Box, {
36
+ shouldForwardProp: (prop) => prop !== "selected",
37
+ })<{ selected?: boolean }>(({ theme, selected }) => ({
38
+ padding: theme.spacing(0.25),
39
+ borderRadius: theme.shape.borderRadius,
40
+ border: `1px solid ${
41
+ selected ? theme.palette.text.primary : theme.palette.grey[700]
42
+ }`,
43
+ color: selected ? theme.palette.common.white : theme.palette.text.primary,
44
+ backgroundColor: selected ? theme.palette.text.primary : "transparent",
45
+ fontWeight: selected ? 500 : 400,
46
+ lineHeight: 1,
47
+ minWidth: 20,
48
+ textAlign: "center",
49
+ }));
@@ -14,11 +14,11 @@ export const useDetailsQueryAPI = (value: string | undefined) => {
14
14
  return { detailsQuery };
15
15
  };
16
16
 
17
- export const useFetchData = (entity_type: string) => {
17
+ export const useFetchData = (entity_type: string, payload?: any) => {
18
18
  // First query to get meta data
19
19
  const metaQuery = useQuery({
20
- queryKey: ["meta", entity_type],
21
- queryFn: () => entityTableFilterMaster(entity_type),
20
+ queryKey: ["meta", entity_type, payload],
21
+ queryFn: () => entityTableFilterMaster(entity_type, payload),
22
22
  });
23
23
 
24
24
  return { metaQuery };
@@ -27,10 +27,14 @@ export const entityTableMetaMaster = async (entity_type: string) => {
27
27
  }
28
28
  };
29
29
 
30
- export const entityTableFilterMaster = async (entity_type: string) => {
30
+ export const entityTableFilterMaster = async (
31
+ entity_type: string,
32
+ payload?: any
33
+ ) => {
31
34
  try {
32
35
  const response = await api.post(
33
- `/meta/get-table-data?entity_type=${entity_type}&list_type=${entity_type}`
36
+ `/meta/get-table-data?entity_type=${entity_type}&list_type=${entity_type}`,
37
+ payload
34
38
  );
35
39
 
36
40
  // const filteredData = {
@@ -215,6 +219,6 @@ export const getAttributes = async (entity_type: string) => {
215
219
  };
216
220
 
217
221
  export const getTableTabs = async (payload: any) => {
218
- const response = await api.post(`filter/get-tabs-data`, payload);
222
+ const response = await api.post(`filter/adm/tabs`, payload);
219
223
  return response.data;
220
224
  };
@@ -111,3 +111,47 @@ api.interceptors.request.use(
111
111
  return Promise.reject(error);
112
112
  }
113
113
  );
114
+
115
+ export const formatTableHeaders = (columns: any) => {
116
+ const mapped = columns.map((col: any) => {
117
+ const meta =
118
+ col.attribute_key === "status" ||
119
+ col.attribute_key === "lead_status" ||
120
+ col.attribute_key === "flag" ||
121
+ col.attribute_key === "invitation_status"
122
+ ? { type: "custom", propName: "renderStatus", align: col.align }
123
+ : col.attribute_key === "profile_image" ||
124
+ col.attribute_key === "short_logo"
125
+ ? {
126
+ type: "custom",
127
+ propName: "profileImageFetch",
128
+ align: col.align,
129
+ }
130
+ : col.attribute_key === "start_date" || col.attribute_key === "end_date"
131
+ ? { type: "custom", propName: "dateFormater", align: col.align }
132
+ : col.attribute_key === "action"
133
+ ? { type: "custom", propName: "renderAction", align: col.align }
134
+ : col.attribute_key === "code"
135
+ ? {
136
+ type: "custom",
137
+ propName: "drillCellRenderer",
138
+ align: col.align,
139
+ }
140
+ : col.attribute_key === "primary_mobile"
141
+ ? {
142
+ type: "custom",
143
+ propName: "apiCallonClick",
144
+ align: col.align,
145
+ }
146
+ : undefined;
147
+
148
+ return {
149
+ header: col.name ?? "",
150
+ accessorKey: col.attribute_key ?? "",
151
+ size: col.size,
152
+ meta,
153
+ };
154
+ });
155
+
156
+ return mapped;
157
+ };
@@ -95,7 +95,7 @@ export interface CraftTableProps<T> {
95
95
  filterOptions?: FilterOptionsProps;
96
96
  settingsOptions?: settingsOptionsProps;
97
97
  craftTableFilterSettingsOptions?: craftTableFilterSettingsOptionsProps;
98
- activeTab?: string;
98
+ activeTab?: any;
99
99
  }
100
100
  export interface CraftTableComponentProps<T> {
101
101
  table: Table<T>;
@@ -115,6 +115,6 @@ export interface TableHeaderProps<T> {
115
115
  activeTab?: string;
116
116
  featureOptions: CraftTableFeatureProps;
117
117
  tableStates: CraftTableOptionsProps;
118
- filterSettingStates: craftTableFilterSettingsOptionsProps;
118
+ filterSettingStates?: craftTableFilterSettingsOptionsProps;
119
119
  onSaveSettings?: (columnId: string) => void;
120
120
  }
@@ -6,7 +6,11 @@ import {
6
6
  useDetailsQueryAPI,
7
7
  useFetchData,
8
8
  } from "../listing/libs/hooks/useEntityTableHooks";
9
- import { ENTITY_TYPE, MAPPED_ENTITY_TYPE } from "../listing/libs/utils/common";
9
+ import {
10
+ ENTITY_TYPE,
11
+ formatTableHeaders,
12
+ MAPPED_ENTITY_TYPE,
13
+ } from "../listing/libs/utils/common";
10
14
  import {
11
15
  useCommonFilterDropdownAPI,
12
16
  useEntityTableAPI,
@@ -54,8 +58,30 @@ function ListingView() {
54
58
  filterSettingStates;
55
59
 
56
60
  const { defaultColumns } = useDefaultColumns();
61
+ const { data: getSettingsAPIData } = useGetNavigationLayoutAPI(ENTITY_TYPE);
62
+ const tabsPaylod = {
63
+ entity_type: ENTITY_TYPE,
64
+ defaultTabsConfig: {
65
+ attribute: "status",
66
+ },
67
+ };
57
68
 
58
- const { metaQuery } = useFetchData(ENTITY_TYPE);
69
+ const { tableTabs } = useGetTableTabs(tabsPaylod);
70
+ const tabsData = tableTabs;
71
+
72
+ const { metaQuery } = useFetchData(ENTITY_TYPE, {
73
+ tabs: {
74
+ columnName:
75
+ getSettingsAPIData?.mapped_json?.quick_tab?.attribute || "status",
76
+ sortBy: getSettingsAPIData?.mapped_json?.quick_tab?.sorting || "ASC",
77
+ value:
78
+ selectedTab?.tab_name?.toLowerCase() === "all"
79
+ ? tabsData?.find((tab: any) => tab?.tab_name?.toLowerCase() === "all")
80
+ ?.tab_value
81
+ : selectedTab?.tab_value,
82
+ name: selectedTab?.tab_name,
83
+ },
84
+ });
59
85
 
60
86
  const { detailsQuery } = useDetailsQueryAPI(
61
87
  filterMaster?.saved_filters?.selectedId
@@ -86,93 +112,14 @@ function ListingView() {
86
112
  column: filterSettingStates?.quickTabStates?.attribute,
87
113
  sort_by: filterSettingStates?.quickTabStates?.sorting,
88
114
  });
89
- const tabsPaylod = {
90
- entity_type: ENTITY_TYPE,
91
- defaultTabsConfig: {
92
- attribute: "status",
93
- },
94
- };
95
-
96
- const { tableTabs } = useGetTableTabs(tabsPaylod);
97
115
 
98
116
  const queryClient = useQueryClient();
99
- const { data: getSettingsAPIData } = useGetNavigationLayoutAPI(ENTITY_TYPE);
100
117
 
101
118
  const fetchMeta = async () => {
102
- try {
103
- const { res: allColumns } = await entityTableMetaMaster(ENTITY_TYPE);
104
-
105
- const savedColumnSettings = filterSettingStates.settingsData?.column;
106
-
107
- const getOrderedColumns = (
108
- showList: { value: string }[],
109
- filteredColumns: any[]
110
- ) => {
111
- // Build ordered columns using showList and filteredColumns
112
- // const orderedColumns = showList
113
- // ?.map((showItem) => {
114
- // return filteredColumns.find(
115
- // (col) => col?.accessorKey === showItem?.value
116
- // );
117
- // })
118
- // ?.filter((col): col is ColumnDef<any> => col !== undefined); // Ensure non-undefined columns are returned
119
-
120
- // didnt know what above code was doing so rewrote it as below
121
- // const res = showList.map((item: any) => ({
122
- // id: item.value,
123
- // accessorKey: item.value,
124
- // header: item.label,
125
- // }));
126
-
127
- // return res;
128
- return allColumns;
129
- };
119
+ const res = formatTableHeaders(metaQuery?.data?.column_list || []);
120
+ console.log("res", res);
130
121
 
131
- setColumns(allColumns);
132
-
133
- // if (
134
- // savedColumnSettings &&
135
- // !savedColumnSettings.isDefault &&
136
- // savedColumnSettings.tabs
137
- // ) {
138
- // // Tab-wise view: find the active tab and use its show_list
139
- // const activeTabSettings = savedColumnSettings.tabs.find(
140
- // (tab) => tab.tab_name?.value == selectedTab.toLowerCase()
141
- // );
142
-
143
- // if (activeTabSettings?.show_list) {
144
- // const visibleColumns = new Set(
145
- // activeTabSettings.show_list.map((c) => c.value)
146
- // );
147
-
148
- // // First, filter columns based on visibleColumns
149
- // const filteredColumns = allColumns.filter((col: any) =>
150
- // visibleColumns.has(col?.accessorKey)
151
- // );
152
- // setColumns(
153
- // getOrderedColumns(activeTabSettings.show_list, filteredColumns)
154
- // );
155
- // } else {
156
- // // Fallback if no specific settings for the active tab are found
157
- // setColumns(allColumns);
158
- // }
159
- // } else if (savedColumnSettings && savedColumnSettings.show_list) {
160
- // // Default view: use the main show_list
161
- // const visibleColumns = new Set(
162
- // savedColumnSettings.show_list.map((c) => c.value)
163
- // );
164
- // const filtered = allColumns.filter((col: any) =>
165
- // visibleColumns.has(col?.accessorKey)
166
- // );
167
-
168
- // setColumns(getOrderedColumns(savedColumnSettings.show_list, filtered));
169
- // } else {
170
- // // No settings found, use all columns
171
- // setColumns(allColumns);
172
- // }
173
- } catch (error) {
174
- console.error("Failed to fetch metadata:", error);
175
- }
122
+ setColumns(res);
176
123
  };
177
124
 
178
125
  useEffect(() => {
@@ -208,7 +155,6 @@ function ListingView() {
208
155
 
209
156
  //For server side sorting
210
157
  const enableServerSideSorting = true;
211
- const tabsData = tableTabs?.data;
212
158
 
213
159
  const { tableData, isTableDataPending } = useEntityTableAPI({
214
160
  page: 0,
@@ -400,8 +346,8 @@ function ListingView() {
400
346
  mapped_json: data,
401
347
  type: "filter",
402
348
  };
403
-
404
349
  await saveLayoutAPI(payload);
350
+ queryClient.invalidateQueries({ queryKey: ["tableTabs"] });
405
351
  };
406
352
 
407
353
  const handleSaveSettingsData = (settingsData: SettingsDataProps) => {
@@ -534,7 +480,6 @@ function ListingView() {
534
480
  leftSideComponent: (
535
481
  <>
536
482
  <TableTabs
537
- columns={columns}
538
483
  settingsOptions={{
539
484
  showIcon: true,
540
485
  onClick: () => setShowListViewSettings(!showListViewSettings),
@@ -573,9 +518,15 @@ function ListingView() {
573
518
  ),
574
519
  searchValue: searchTerm,
575
520
  onSearchChange: (val) => setSearchTerm(val),
576
- showFilterToggle: true,
521
+ showFilterToggle: false,
577
522
  onFilterButtonClick: () =>
578
523
  tableStates.setShowTableFilter(!tableStates.showTableFilter),
524
+ showColumnToggle: false,
525
+ showSearch: false,
526
+ showChangeLayoutToggle: false,
527
+ showSortingToggle: false,
528
+ // viewMoreToggle: true,
529
+ // showCompactTableToggle: false,
579
530
  }}
580
531
  />
581
532
  );