rez-table-listing-mui 1.3.44 → 1.3.45

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 (41) hide show
  1. package/dist/index.d.ts +70 -9
  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/common/saved-filter-modal/index.tsx +517 -0
  8. package/src/listing/components/filter/components/attributes-filter.tsx +2 -2
  9. package/src/listing/components/filter/components/forms/components/Dropdown.tsx +2 -2
  10. package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +9 -7
  11. package/src/listing/components/filter/components/forms/components/Textfield.tsx +2 -4
  12. package/src/listing/components/filter/components/forms/components/filter-criteria-list.tsx +1 -0
  13. package/src/listing/components/filter/components/forms/index.tsx +23 -14
  14. package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +3 -3
  15. package/src/listing/components/filter/components/main-filter.tsx +6 -6
  16. package/src/listing/components/filter/components/saved-edit-filter.tsx +5 -3
  17. package/src/listing/components/filter/components/saved-filter.tsx +300 -124
  18. package/src/listing/components/filter/components/search/index.tsx +1 -0
  19. package/src/listing/components/filter/components/single-filter-rendering.tsx +3 -3
  20. package/src/listing/components/filter/index.tsx +130 -5
  21. package/src/listing/components/index-table.tsx +9 -0
  22. package/src/listing/components/login/index.tsx +3 -6
  23. package/src/listing/components/table-dnd.tsx +6 -0
  24. package/src/listing/components/table-head-dnd-cell.tsx +7 -0
  25. package/src/listing/components/table-head-popover.tsx +24 -3
  26. package/src/listing/components/table-head.tsx +10 -0
  27. package/src/listing/components/table-settings/components/column.tsx +85 -26
  28. package/src/listing/components/table-settings/components/quick-tab.tsx +395 -77
  29. package/src/listing/components/table-settings/components/sorting.tsx +60 -20
  30. package/src/listing/components/table-settings/index.tsx +12 -2
  31. package/src/listing/components/table.tsx +6 -0
  32. package/src/listing/libs/hooks/useEntityTableAPI.tsx +20 -5
  33. package/src/listing/libs/utils/apiColumn.ts +8 -3
  34. package/src/listing/libs/utils/common.ts +2 -1
  35. package/src/listing/libs/utils/hydrate-saved-filters.ts +2 -2
  36. package/src/listing/types/common.ts +1 -0
  37. package/src/listing/types/filter-settings.ts +8 -2
  38. package/src/listing/types/filter.ts +51 -3
  39. package/src/listing/types/table.ts +9 -0
  40. package/src/view/FIlterWrapper.tsx +15 -0
  41. package/src/view/ListingView.tsx +179 -63
@@ -15,6 +15,7 @@ import AttributesFilter from "./components/attributes-filter";
15
15
  import { filterStyles } from "./style";
16
16
  import { deepMergeObjects } from "../../libs/utils/deep-merge-objects";
17
17
  import SingleFilterRendering from "./components/single-filter-rendering";
18
+ import SavedFilterModalView from "../common/saved-filter-modal";
18
19
 
19
20
  export function TableFilter({
20
21
  onClose,
@@ -32,6 +33,8 @@ export function TableFilter({
32
33
 
33
34
  // remove this
34
35
  const [saveFilterModalOpen, setSaveFilterModalOpen] = useState(false);
36
+ const [savedFilterModalOpen, setSavedFilterModalOpen] = useState(false);
37
+
35
38
  const [deleteFilterModalOpen, setDeleteFilterModalOpen] = useState(false);
36
39
 
37
40
  const [searchTerm, setSearchTerm] = useState<string>("");
@@ -114,6 +117,97 @@ export function TableFilter({
114
117
  type: "text",
115
118
  };
116
119
 
120
+ const hasSavedFilterRecords = Boolean(columnsData?.saved_filter?.length);
121
+
122
+ // const handleSaveFilterButtonClick = () => {
123
+ // if (editMode) {
124
+ // setSavedFilterModalOpen(true);
125
+ // return;
126
+ // }
127
+
128
+ // setSavedFilterModalOpen(true);
129
+ // };
130
+
131
+ // const handleSaveFilterButtonClick = () => {
132
+ // // Reset filterMaster fields when creating a new filter
133
+ // if (!editMode) {
134
+ // setFilterMaster((prev) => ({
135
+ // ...prev,
136
+ // saved_filters: {
137
+ // selectedId: "",
138
+ // selectedName: "",
139
+ // selectedCode: "",
140
+ // description: "",
141
+ // shareWithTeam: false,
142
+ // allowTeamEdit: false,
143
+ // },
144
+ // }));
145
+ // }
146
+
147
+ // setSavedFilterModalOpen(true);
148
+ // };
149
+
150
+ const handleSaveFilterButtonClick = () => {
151
+ if (!editMode) {
152
+ setFilterMaster((prev) => {
153
+ if (!prev) return prev;
154
+
155
+ return {
156
+ ...prev,
157
+ saved_filters: {
158
+ ...prev.saved_filters,
159
+ shareWithTeam: false,
160
+ allowTeamEdit: false,
161
+ },
162
+ };
163
+ });
164
+ }
165
+
166
+ setSavedFilterModalOpen(true);
167
+ };
168
+
169
+ const handleSavedFilterModalSave = () => {
170
+ const selectedId = filterMaster?.saved_filters?.selectedId;
171
+ const selectedName = filterMaster?.saved_filters?.selectedName || "";
172
+ const description = filterMaster?.saved_filters?.description || "";
173
+
174
+ const selectedCode = filterMaster?.saved_filters?.selectedCode;
175
+
176
+ const newFilterMasterState = {
177
+ ...filterMaster,
178
+ saved_filters: {
179
+ ...(filterMaster?.saved_filters ?? {}),
180
+ selectedId,
181
+ selectedName,
182
+ selectedCode,
183
+ description,
184
+ },
185
+ } as FilterMasterStateProps;
186
+
187
+ setFilterMaster(newFilterMasterState);
188
+
189
+ const newState = {
190
+ filterMaster: newFilterMasterState,
191
+ filters,
192
+ };
193
+
194
+ onChangeFunction && onChangeFunction(newState);
195
+
196
+ if (editMode) {
197
+ onUpdateFilter && onUpdateFilter(selectedName);
198
+ const isSingleSavedFilterEditMode =
199
+ filterComponentOptions?.tabOptions?.savedFilter?.editMode;
200
+ if (!isSingleSavedFilterEditMode) {
201
+ setEditMode(false);
202
+ }
203
+ } else {
204
+ onSaveFilter && onSaveFilter(selectedName);
205
+ setTabValue(1);
206
+ }
207
+
208
+ setSavedFilterModalOpen(false);
209
+ };
210
+
117
211
  const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
118
212
  const tabType = tabMapping[newValue]?.label;
119
213
 
@@ -122,6 +216,22 @@ export function TableFilter({
122
216
  }
123
217
 
124
218
  setTabValue(newValue);
219
+ if (newValue === 0) {
220
+ setFilterMaster((prev) => {
221
+ if (!prev) return prev;
222
+ return {
223
+ ...prev,
224
+ saved_filters: {
225
+ ...(prev.saved_filters ?? {}),
226
+ selectedId: "",
227
+ selectedName: "",
228
+ description: "",
229
+ is_shared: false,
230
+ is_editable: false,
231
+ },
232
+ };
233
+ });
234
+ }
125
235
 
126
236
  if (tabType === "Filter") {
127
237
  setEditMode(false);
@@ -144,9 +254,12 @@ export function TableFilter({
144
254
 
145
255
  if (tabType?.label === "Saved Filter") {
146
256
  patches.saved_filters = {
257
+ ...(filterMaster?.saved_filters ?? {}),
147
258
  selectedId: "",
148
259
  selectedName: "",
149
260
  selectedCode: "",
261
+ is_shared: undefined,
262
+ is_editable: undefined,
150
263
  };
151
264
  } else if (tabType?.label === "Attributes") {
152
265
  patches.attributes = { radio: [], selected: "" };
@@ -218,7 +331,7 @@ export function TableFilter({
218
331
  {...commonProps}
219
332
  {...savedFilterProps}
220
333
  {...attributesProps}
221
- setSavedFilterModalOpen={setSaveFilterModalOpen}
334
+ onSaveFilterButtonClick={handleSaveFilterButtonClick}
222
335
  filterComponentOptions={finalComponentOptions}
223
336
  />
224
337
  )}
@@ -231,7 +344,7 @@ export function TableFilter({
231
344
  >
232
345
  <MainFilter
233
346
  {...commonProps}
234
- setSavedFilterModalOpen={setSaveFilterModalOpen}
347
+ onSaveFilterButtonClick={handleSaveFilterButtonClick}
235
348
  filterComponentOptions={finalComponentOptions}
236
349
  />
237
350
  </CustomTabPanel>
@@ -246,7 +359,7 @@ export function TableFilter({
246
359
  <SavedFilter
247
360
  {...commonProps}
248
361
  {...savedFilterProps}
249
- setSavedFilterModalOpen={setSaveFilterModalOpen}
362
+ onSaveFilterButtonClick={handleSaveFilterButtonClick}
250
363
  filterComponentOptions={finalComponentOptions}
251
364
  />
252
365
  </CustomTabPanel>
@@ -298,14 +411,17 @@ export function TableFilter({
298
411
  inputValue || filterMaster?.saved_filters?.selectedName;
299
412
  const selectedCode =
300
413
  filterMaster?.saved_filters?.selectedCode;
414
+ const description =
415
+ inputValue || filterMaster?.saved_filters?.description;
301
416
 
302
417
  const newFilterMasterState = {
303
418
  ...filterMaster,
304
419
  saved_filters: {
305
- ...filterMaster?.attributes,
420
+ ...(filterMaster?.saved_filters ?? {}),
306
421
  selectedId,
307
422
  selectedName,
308
423
  selectedCode,
424
+ description,
309
425
  },
310
426
  } as FilterMasterStateProps;
311
427
 
@@ -429,7 +545,7 @@ export function TableFilter({
429
545
  const newFilterMasterState = {
430
546
  ...filterMaster,
431
547
  saved_filters: {
432
- ...filterMaster?.attributes,
548
+ ...(filterMaster?.saved_filters ?? {}),
433
549
  selectedId,
434
550
  selectedName,
435
551
  selectedCode,
@@ -520,6 +636,15 @@ export function TableFilter({
520
636
  maxWidth="xs"
521
637
  />
522
638
  )}
639
+ <SavedFilterModalView
640
+ open={savedFilterModalOpen}
641
+ onClose={() => setSavedFilterModalOpen(false)}
642
+ onSave={handleSavedFilterModalSave}
643
+ filterMaster={tableStates.filterMaster}
644
+ setFilterMaster={tableStates.setFilterMaster}
645
+ hasSavedFilters={hasSavedFilterRecords}
646
+ columnsData={columnsData}
647
+ />
523
648
  </Box>
524
649
  );
525
650
  }
@@ -30,6 +30,8 @@ function TableWrapper<T>({
30
30
  data = [],
31
31
  columns = [],
32
32
  tableStates,
33
+ filterSettingStates,
34
+ onSaveSettings,
33
35
  paginationOptions,
34
36
  featureOptions,
35
37
  topbarOptions,
@@ -40,6 +42,7 @@ function TableWrapper<T>({
40
42
  shouldHideColumn,
41
43
  emptyListComponent,
42
44
  filterOptions,
45
+ activeTab,
43
46
  }: CraftTableProps<T>) {
44
47
  if (!Array.isArray(data)) {
45
48
  throw new Error("data must be an array of objects.");
@@ -322,22 +325,28 @@ function TableWrapper<T>({
322
325
  {enableColumnReordering ? (
323
326
  <TableDND
324
327
  table={table}
328
+ activeTab={activeTab}
325
329
  columnOrder={columnOrder}
326
330
  featureOptions={craftFeatureOptions}
327
331
  NestedComponent={nestedComponent}
328
332
  setColumnOrder={setColumnOrder}
329
333
  isCompactTable={isCompactTable}
330
334
  tableStates={tableStates}
335
+ filterSettingStates={filterSettingStates}
336
+ onSaveSettings={onSaveSettings}
331
337
  />
332
338
  ) : (
333
339
  <Table
334
340
  table={table}
341
+ activeTab={activeTab}
335
342
  featureOptions={craftFeatureOptions}
336
343
  NestedComponent={nestedComponent}
337
344
  columnOrder={columnOrder}
338
345
  setColumnOrder={setColumnOrder}
339
346
  isCompactTable={isCompactTable}
340
347
  tableStates={tableStates}
348
+ filterSettingStates={filterSettingStates}
349
+ onSaveSettings={onSaveSettings}
341
350
  />
342
351
  )}
343
352
  </div>
@@ -7,9 +7,9 @@ const LoginButton = () => {
7
7
 
8
8
  const handleLogin = async () => {
9
9
  setLoading(true);
10
- const api_url = "https://api.eth-qa.rezolut.in/api/admin/auth";
11
- // const api_url = "http://localhost:4011/api/admin/auth";
12
- const email_id = "kartik.shetty@rezolut.in";
10
+ // const api_url = "https://api.eth-qa.rezolut.in/api/enrol/auth";
11
+ const api_url = "http://localhost:4011/api/auth";
12
+ const email_id = "shraddha.nandurkar@rezolut.in";
13
13
  const email_otp = "123456";
14
14
  const sub_domain = "universal";
15
15
 
@@ -21,8 +21,6 @@ const LoginButton = () => {
21
21
  subdomain: sub_domain,
22
22
  })
23
23
  .then(async (emailAPIResponse) => {
24
- console.log(emailAPIResponse.data);
25
-
26
24
  await axios
27
25
  .post(`${api_url}/sso/otp/generate`, {
28
26
  identifier: email_id,
@@ -40,7 +38,6 @@ const LoginButton = () => {
40
38
  subdomain: "universal",
41
39
  })
42
40
  .then((otpVerifyResponse) => {
43
- console.log(otpVerifyResponse.data);
44
41
  const token = otpVerifyResponse.data.accessToken;
45
42
 
46
43
  if (token) {
@@ -17,12 +17,15 @@ import { arrayMove } from "@dnd-kit/sortable";
17
17
 
18
18
  function TableDND<T>({
19
19
  table,
20
+ activeTab,
20
21
  featureOptions,
21
22
  NestedComponent,
22
23
  columnOrder,
23
24
  setColumnOrder,
24
25
  isCompactTable,
25
26
  tableStates,
27
+ filterSettingStates,
28
+ onSaveSettings,
26
29
  }: CraftTableComponentProps<T>) {
27
30
  const sensors: SensorDescriptor<SensorOptions>[] = useSensors(
28
31
  useSensor(MouseSensor, {}),
@@ -50,12 +53,15 @@ function TableDND<T>({
50
53
  >
51
54
  <Table
52
55
  table={table}
56
+ activeTab={activeTab}
53
57
  featureOptions={featureOptions}
54
58
  NestedComponent={NestedComponent}
55
59
  columnOrder={columnOrder}
56
60
  setColumnOrder={setColumnOrder}
57
61
  isCompactTable={isCompactTable}
58
62
  tableStates={tableStates}
63
+ filterSettingStates={filterSettingStates}
64
+ onSaveSettings={onSaveSettings}
59
65
  />
60
66
  </DndContext>
61
67
  );
@@ -14,8 +14,11 @@ import TableHeadPopover from "./table-head-popover";
14
14
 
15
15
  function DraggableTableHeader<T>({
16
16
  header,
17
+ activeTab,
17
18
  featureOptions,
18
19
  tableStates,
20
+ filterSettingStates,
21
+ onSaveSettings,
19
22
  }: TableHeaderProps<T>) {
20
23
  const { enableColumnPinning } = featureOptions;
21
24
 
@@ -108,6 +111,7 @@ function DraggableTableHeader<T>({
108
111
  header={header}
109
112
  featureOptions={featureOptions}
110
113
  tableStates={tableStates}
114
+ filterSettingStates={filterSettingStates}
111
115
  />
112
116
  )}
113
117
 
@@ -132,9 +136,12 @@ function DraggableTableHeader<T>({
132
136
  {/* Popover */}
133
137
  <TableHeadPopover
134
138
  anchorEl={anchorEl}
139
+ activeTab={activeTab}
135
140
  onClose={handleClose}
136
141
  header={header}
137
142
  tableStates={tableStates}
143
+ filterSettingStates={filterSettingStates}
144
+ onSaveSettings={onSaveSettings}
138
145
  />
139
146
  </th>
140
147
  );
@@ -14,27 +14,45 @@ import {
14
14
  IconPinOffOutline,
15
15
  IconPinOutline,
16
16
  } from "../../assets/svg";
17
- import { CraftTableOptionsProps } from "../types/table-options";
17
+ import {
18
+ craftTableFilterSettingsOptionsProps,
19
+ CraftTableOptionsProps,
20
+ } from "../types/table-options";
18
21
  import { useFullscreenPopoverContainer } from "../libs/hooks/useFullScreen";
22
+ import { ENTITY_TYPE, MAPPED_ENTITY_TYPE } from "../libs/utils/common";
23
+ import {
24
+ ColumnTabConfigProps,
25
+ SettingsDataProps,
26
+ } from "../types/filter-settings";
27
+ import { useSaveSettingsDataAPI } from "../libs/hooks/useEntityTableAPI";
28
+ import { useQueryClient } from "@tanstack/react-query";
29
+ import { useCraftTableFilterSettings } from "../libs/hooks/useCraftTableFilterSettings";
30
+ import { ColumnItem } from "./table-settings/components/column";
19
31
 
20
32
  type Props<T> = {
21
33
  anchorEl: HTMLElement | null;
34
+ activeTab?: string;
22
35
  onClose: () => void;
23
36
  header: Header<T, unknown>;
24
37
  tableStates: CraftTableOptionsProps;
38
+ filterSettingStates: craftTableFilterSettingsOptionsProps;
39
+ onSaveSettings?: (columnId: string) => void;
25
40
  };
26
41
 
27
42
  function TableHeadPopover<T>({
28
43
  anchorEl,
44
+ activeTab,
29
45
  onClose,
30
46
  header,
31
47
  tableStates,
48
+ filterSettingStates,
49
+ onSaveSettings,
32
50
  }: Props<T>) {
33
51
  const open = Boolean(anchorEl);
34
52
  const column = header.column;
35
53
  const isPinned = column.getIsPinned() === "left";
36
54
  const { container: fullscreenContainer } = useFullscreenPopoverContainer();
37
-
55
+ const queryClient = useQueryClient();
38
56
  const { wrapColumns, setWrapColumns } = tableStates;
39
57
 
40
58
  const toggleWrapForColumn = (columnId: string) => {
@@ -44,6 +62,9 @@ function TableHeadPopover<T>({
44
62
  all_wrap: false,
45
63
  }));
46
64
  };
65
+ const handleUpdateSettings = (columnId: string) => {
66
+ onSaveSettings && onSaveSettings(columnId);
67
+ };
47
68
 
48
69
  return (
49
70
  <Popover
@@ -66,7 +87,7 @@ function TableHeadPopover<T>({
66
87
  </ListItemIcon>
67
88
  <ListItemText primary="Sort descending" />
68
89
  </ListItemButton>
69
- <ListItemButton onClick={() => column.toggleVisibility()}>
90
+ <ListItemButton onClick={() => handleUpdateSettings(column?.id)}>
70
91
  <ListItemIcon>
71
92
  <HideIcon />
72
93
  </ListItemIcon>
@@ -1,6 +1,7 @@
1
1
  import { ColumnOrderState, flexRender, Table } from "@tanstack/react-table";
2
2
  import {
3
3
  CraftTableFeatureProps,
4
+ craftTableFilterSettingsOptionsProps,
4
5
  CraftTableOptionsProps,
5
6
  } from "../types/table-options";
6
7
  import { DownArrow, UpArrow } from "../../assets/svg";
@@ -16,16 +17,22 @@ import Checkbox from "./inputs/checkbox";
16
17
 
17
18
  interface TableHeadProps<T> {
18
19
  table: Table<T>;
20
+ activeTab?: string;
19
21
  featureOptions: CraftTableFeatureProps;
20
22
  columnOrder: ColumnOrderState;
21
23
  tableStates: CraftTableOptionsProps;
24
+ filterSettingStates: craftTableFilterSettingsOptionsProps;
25
+ onSaveSettings?: (columnId: string) => void;
22
26
  }
23
27
 
24
28
  function TableHead<T>({
25
29
  table,
30
+ activeTab,
26
31
  featureOptions,
27
32
  columnOrder,
28
33
  tableStates,
34
+ filterSettingStates,
35
+ onSaveSettings,
29
36
  }: TableHeadProps<T>) {
30
37
  const {
31
38
  stickyHeader,
@@ -98,8 +105,11 @@ function TableHead<T>({
98
105
  >
99
106
  <DraggableTableHeader
100
107
  header={header}
108
+ activeTab={activeTab}
101
109
  featureOptions={featureOptions}
102
110
  tableStates={tableStates}
111
+ filterSettingStates={filterSettingStates}
112
+ onSaveSettings={onSaveSettings}
103
113
  />
104
114
  </SortableContext>
105
115
  ) : (
@@ -34,9 +34,16 @@ export interface TabData {
34
34
  interface ColumnTabProps {
35
35
  filterSettingStates: craftTableFilterSettingsOptionsProps;
36
36
  columnsData: FilterColumnsDataProps;
37
+ columnTabAttributes?: any[];
38
+ columnTabAttributesLoading?: boolean;
37
39
  }
38
40
 
39
- const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
41
+ const ColumnTab = ({
42
+ filterSettingStates,
43
+ columnsData,
44
+ columnTabAttributes,
45
+ columnTabAttributesLoading,
46
+ }: ColumnTabProps) => {
40
47
  const [searchTerm, setSearchTerm] = useState<string>("");
41
48
  const [selectedTabIndex, setSelectedTabIndex] = useState<number>(0);
42
49
 
@@ -72,7 +79,7 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
72
79
  const isTabWiseEmpty = settingsColumnState?.tabs?.length ? false : true;
73
80
 
74
81
  const mappedColumns: ColumnItem[] =
75
- columnsData?.column_list?.map((column) => ({
82
+ columnTabAttributes?.map((column) => ({
76
83
  label: column?.name,
77
84
  value: column?.attribute_key,
78
85
  })) || [];
@@ -95,19 +102,25 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
95
102
  hide_list: [],
96
103
  },
97
104
  }));
98
- } else if (!isColumnDefault && isTabWiseEmpty) {
99
- const mappedTabs: TabData[] =
100
- quickTabStates?.show_list?.map((tab) => ({
101
- tab_name: tab,
102
- show_list: mappedColumns,
103
- hide_list: [],
104
- })) || [];
105
+ } else if (!isColumnDefault) {
106
+ const mappedTabs: TabData[] = isTabWiseEmpty
107
+ ? quickTabStates?.show_list?.map((tab) => ({
108
+ tab_name: tab,
109
+ show_list: mappedColumns,
110
+ hide_list: [],
111
+ })) || []
112
+ : quickTabStates?.show_list?.map((tab, index) => ({
113
+ tab_name: tab,
114
+ show_list:
115
+ settingsColumnState?.tabs[index]?.show_list || mappedColumns,
116
+ hide_list: settingsColumnState?.tabs[index]?.hide_list || [],
117
+ })) || [];
105
118
 
106
119
  setSettingsData((prev) => ({
107
120
  ...prev,
108
121
  column: {
109
- ...prev.column,
110
- tabs: mappedTabs,
122
+ ...prev.column, // ✅ required to satisfy SettingsDataProps
123
+ tabs: mappedTabs, // updating only tabs
111
124
  },
112
125
  }));
113
126
  }
@@ -186,7 +199,13 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
186
199
  const currentTab = settingsColumnState?.tabs?.[selectedTabIndex];
187
200
  return {
188
201
  showList: currentTab?.show_list || [],
189
- hideList: currentTab?.hide_list || [],
202
+ hideList:
203
+ currentTab?.hide_list ||
204
+ columnTabAttributes?.map((column) => ({
205
+ label: column?.name,
206
+ value: column?.attribute_key,
207
+ })) ||
208
+ [],
190
209
  };
191
210
  }
192
211
  };
@@ -329,25 +348,65 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
329
348
  };
330
349
 
331
350
  const handleShowAll = () => {
332
- setSettingsData((prev) => ({
333
- ...prev,
334
- column: {
335
- ...prev.column,
351
+ if (isColumnDefault) {
352
+ // Default mode → update global lists
353
+ setSettingsData((prev) => ({
354
+ ...prev,
355
+ column: {
356
+ ...prev.column,
357
+ show_list: [...showList, ...hideList],
358
+ hide_list: [],
359
+ },
360
+ }));
361
+ } else {
362
+ // Tab mode → update only selected tab
363
+ const updatedTabs = [...(settingsColumnState.tabs || [])];
364
+
365
+ updatedTabs[selectedTabIndex] = {
366
+ ...updatedTabs[selectedTabIndex],
336
367
  show_list: [...showList, ...hideList],
337
368
  hide_list: [],
338
- },
339
- }));
369
+ };
370
+
371
+ setSettingsData((prev) => ({
372
+ ...prev,
373
+ column: {
374
+ ...prev.column,
375
+ tabs: updatedTabs,
376
+ },
377
+ }));
378
+ }
340
379
  };
341
380
 
342
381
  const handleHideAll = () => {
343
- setSettingsData((prev) => ({
344
- ...prev,
345
- column: {
346
- ...prev.column,
382
+ if (isColumnDefault) {
383
+ // Default mode → update global lists
384
+ setSettingsData((prev) => ({
385
+ ...prev,
386
+ column: {
387
+ ...prev.column,
388
+ show_list: [],
389
+ hide_list: [...hideList, ...showList],
390
+ },
391
+ }));
392
+ } else {
393
+ // Tab mode → update only selected tab
394
+ const updatedTabs = [...(settingsColumnState.tabs || [])];
395
+
396
+ updatedTabs[selectedTabIndex] = {
397
+ ...updatedTabs[selectedTabIndex],
347
398
  show_list: [],
348
399
  hide_list: [...hideList, ...showList],
349
- },
350
- }));
400
+ };
401
+
402
+ setSettingsData((prev) => ({
403
+ ...prev,
404
+ column: {
405
+ ...prev.column,
406
+ tabs: updatedTabs,
407
+ },
408
+ }));
409
+ }
351
410
  };
352
411
 
353
412
  const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
@@ -371,11 +430,11 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
371
430
  <Typography variant="subtitle2" sx={{ mb: 1 }}>
372
431
  Customize column by
373
432
  </Typography>
374
- {/* <CustomToggleSwitchButton
433
+ <CustomToggleSwitchButton
375
434
  buttons={TOGGLE_BUTTON_TABS}
376
435
  value={isColumnDefault}
377
436
  onChange={handleToggleChange}
378
- /> */}
437
+ />
379
438
  </Box>
380
439
 
381
440
  <Box sx={{ flex: 1 }}>