rez-table-listing-mui 1.3.16 → 1.3.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez-table-listing-mui",
3
- "version": "1.3.16",
3
+ "version": "1.3.18",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
@@ -82,10 +82,10 @@ const Kanban = ({
82
82
 
83
83
  metaData?.swim_lanes.forEach((swimLane: SwimLane) => {
84
84
  swimLane.sub_lanes
85
- ?.filter((subLane) => subLane.lane_id === laneId)
85
+ ?.filter((subLane) => subLane.lane_id == laneId)
86
86
  ?.forEach((subLane) => {
87
87
  data?.forEach((lead: any) => {
88
- if (lead?.stage_id === subLane?.id && !seenLeadIds.has(lead?.id)) {
88
+ if (lead?.stage_id == subLane?.id && !seenLeadIds.has(lead?.id)) {
89
89
  seenLeadIds.add(lead.id);
90
90
  count++;
91
91
  }
@@ -220,7 +220,7 @@ const Kanban = ({
220
220
  {swim_lane?.sub_lanes
221
221
  ?.filter(
222
222
  (sub_lane: SubLane) =>
223
- sub_lane.lane_id.toString() === lane?.id
223
+ sub_lane.lane_id.toString() == lane?.id
224
224
  )
225
225
  ?.map((sub_section: SubLane) => {
226
226
  const subLaneKey = `${swim_lane?.id}-${lane?.id}-${sub_section?.id}`;
@@ -230,7 +230,7 @@ const Kanban = ({
230
230
  expanded={
231
231
  data?.filter(
232
232
  (lead: any) =>
233
- lead?.stage_id === sub_section?.id &&
233
+ lead?.stage_id == sub_section?.id &&
234
234
  lead?.lead_status_id == swim_lane?.id
235
235
  )?.length === 0
236
236
  ? false
@@ -261,7 +261,7 @@ const Kanban = ({
261
261
  display:
262
262
  data?.filter(
263
263
  (lead: any) =>
264
- lead?.stage_id ===
264
+ lead?.stage_id ==
265
265
  sub_section?.id &&
266
266
  lead?.lead_status_id ==
267
267
  swim_lane?.id
@@ -290,9 +290,8 @@ const Kanban = ({
290
290
  >
291
291
  {data?.filter(
292
292
  (lead: any) =>
293
- lead?.stage_id ===
294
- sub_section?.id &&
295
- lead?.lead_status_id ===
293
+ lead?.stage_id == sub_section?.id &&
294
+ lead?.lead_status_id ==
296
295
  swim_lane?.id
297
296
  )?.length || 0}
298
297
  </Box>
@@ -313,8 +312,7 @@ const Kanban = ({
313
312
  const leadsForThisSubLane =
314
313
  data?.filter(
315
314
  (lead: any) =>
316
- lead?.stage_id ===
317
- sub_section?.id &&
315
+ lead?.stage_id == sub_section?.id &&
318
316
  lead?.lead_status_id ==
319
317
  swim_lane?.id &&
320
318
  lead?.stage_group_id == lane?.id
@@ -210,3 +210,28 @@
210
210
  }
211
211
  }
212
212
  }
213
+ // Full screen styles fixes
214
+
215
+ :fullscreen {
216
+ width: 100vw !important;
217
+ height: 100vh !important;
218
+ display: flex !important;
219
+ flex-direction: column !important;
220
+ background: var(--white);
221
+ overflow: hidden;
222
+ }
223
+
224
+ :-webkit-full-screen {
225
+ width: 100vw !important;
226
+ height: 100vh !important;
227
+ display: flex !important;
228
+ flex-direction: column !important;
229
+ background: var(--white);
230
+ overflow: hidden;
231
+ }
232
+
233
+ // .ts__table__wrapper.is-fullscreen {
234
+ // height: calc(100vh - 56px);
235
+ // max-height: none;
236
+ // overflow-y: auto;
237
+ // }
@@ -7,30 +7,72 @@ const LoginButton = () => {
7
7
 
8
8
  const handleLogin = async () => {
9
9
  setLoading(true);
10
- try {
11
- const response = await axios.post(
12
- "http://localhost:4010/api/auth/login",
13
- {
14
- email_id: "test@gmail.com",
15
- password: "Admin@123",
16
- }
17
- );
18
-
19
- const token = response.data.accessToken;
20
-
21
- if (token) {
22
- localStorage.setItem("authToken", token);
23
- alert("Login successful");
24
- window.location.reload(); // reload app to re-trigger axios with token
25
- } else {
26
- alert("Token not found in response.");
27
- }
28
- } catch (error) {
29
- console.error("Login failed:", error);
30
- alert("Login failed. Check console for details.");
31
- } finally {
32
- setLoading(false);
33
- }
10
+ const api_url = "https://api.eth-qa.rezolut.in/api/admin/auth";
11
+ const email_id = "saurabh.mishra@rezolut.in";
12
+ const email_otp = "123456";
13
+ const sub_domain = "nair";
14
+
15
+ setLoading(true);
16
+
17
+ await axios
18
+ .post(`${api_url}/sso/check-email`, {
19
+ email_id: email_id,
20
+ subdomain: sub_domain,
21
+ })
22
+ .then(async (emailAPIResponse) => {
23
+ console.log(emailAPIResponse.data);
24
+
25
+ await axios
26
+ .post(`${api_url}/sso/otp/generate`, {
27
+ identifier: email_id,
28
+ service: "email",
29
+ })
30
+ .then(async (otpAPIResponse) => {
31
+ await axios
32
+ .post(`${api_url}/verify-otp`, {
33
+ fcm_token: "",
34
+ identifier: email_id,
35
+ otp: email_otp,
36
+ otp_id: otpAPIResponse.data.otp_id,
37
+ reset: true,
38
+ service: "email",
39
+ subdomain: "nair",
40
+ })
41
+ .then((otpVerifyResponse) => {
42
+ console.log(otpVerifyResponse.data);
43
+ const token = otpVerifyResponse.data.accessToken;
44
+
45
+ if (token) {
46
+ localStorage.setItem("authToken", token);
47
+ alert("Login successful");
48
+ window.location.reload(); // reload app to re-trigger axios with token
49
+ } else {
50
+ alert("Token not found in response.");
51
+ }
52
+ })
53
+ .catch((error) => {
54
+ console.error("Login failed:", error);
55
+ alert("Login failed. Check console for details.");
56
+ })
57
+ .finally(() => {
58
+ setLoading(false);
59
+ });
60
+ })
61
+ .catch((error) => {
62
+ console.error("Login failed:", error);
63
+ alert("Login failed. Check console for details.");
64
+ })
65
+ .finally(() => {
66
+ setLoading(false);
67
+ });
68
+ })
69
+ .catch((error) => {
70
+ console.error("Login failed:", error);
71
+ alert("Login failed. Check console for details.");
72
+ })
73
+ .finally(() => {
74
+ setLoading(false);
75
+ });
34
76
  };
35
77
 
36
78
  return (
@@ -7,7 +7,13 @@ function TableHeadPin<T>({ header }: TableHeaderProps<T>) {
7
7
  {/* <IconPinOutline /> */}
8
8
  </div>
9
9
  ) : (
10
- <div className="ts--head--button" onClick={() => header.column.pin(false)}>
10
+ <div
11
+ className="ts--head--button"
12
+ onClick={(e) => {
13
+ e.stopPropagation();
14
+ header.column.pin(false);
15
+ }}
16
+ >
11
17
  <IconPinOffOutline />
12
18
  </div>
13
19
  );
@@ -16,13 +16,12 @@ import DraggableListItem from "./draggable-listitem.tsx";
16
16
  import { listingValuesStyles } from "../style.ts";
17
17
  import Loader from "../../common/loader/loader.tsx";
18
18
  import { ClosedEyeIcon, EyeIcon } from "../../../../assets/svg.tsx";
19
- import InfoAlert from "./info-alert.tsx";
20
19
  import React from "react";
21
20
  ``;
22
21
 
23
22
  interface FilterValue {
24
- id: string;
25
23
  label: string;
24
+ value: string;
26
25
  }
27
26
 
28
27
  interface ListingValuesProps {
@@ -34,7 +33,10 @@ interface ListingValuesProps {
34
33
  setSearchTerm?: React.Dispatch<React.SetStateAction<string>>;
35
34
  containerId: string;
36
35
  tabsApiDataLoading?: boolean;
37
- onItemToggle: (itemId: string, fromContainerId: string) => void;
36
+ onItemToggle: (
37
+ item: { label: string; value: string },
38
+ fromContainerId: string
39
+ ) => void;
38
40
  enableDragAndDrop?: boolean;
39
41
  isQuickTabActive?: boolean;
40
42
  AlertComponenet?: React.ReactNode;
@@ -47,7 +49,10 @@ const ListingValuesContent = ({
47
49
  }: {
48
50
  item: FilterValue;
49
51
  containerId: string;
50
- onItemToggle: (itemId: string, fromContainerId: string) => void;
52
+ onItemToggle: (
53
+ item: { label: string; value: string },
54
+ fromContainerId: string
55
+ ) => void;
51
56
  }) => {
52
57
  return (
53
58
  <Box
@@ -61,10 +66,7 @@ const ListingValuesContent = ({
61
66
  }}
62
67
  >
63
68
  <Typography>{item.label}</Typography>
64
- <IconButton
65
- size="small"
66
- onClick={() => onItemToggle(item.id, containerId)}
67
- >
69
+ <IconButton size="small" onClick={() => onItemToggle(item, containerId)}>
68
70
  {containerId === "tabs" ? <EyeIcon /> : <ClosedEyeIcon />}
69
71
  </IconButton>
70
72
  </Box>
@@ -121,14 +123,14 @@ const ListingValues = ({
121
123
  <Box ref={setNodeRef} sx={listingValuesStyles.draggableContainer}>
122
124
  {enableDragAndDrop ? (
123
125
  <SortableContext
124
- items={filteredValues.map((item) => item.id)}
126
+ items={filteredValues.map((item) => item.value)}
125
127
  strategy={verticalListSortingStrategy}
126
128
  >
127
129
  <Box sx={listingValuesStyles.draggableCover}>
128
130
  {filteredValues.map((item) => (
129
131
  <DraggableListItem
130
- key={item.id}
131
- id={item.id}
132
+ key={item.value}
133
+ id={item.value}
132
134
  containerId={containerId}
133
135
  >
134
136
  <ListingValuesContent
@@ -142,14 +144,15 @@ const ListingValues = ({
142
144
  </SortableContext>
143
145
  ) : (
144
146
  <Box sx={listingValuesStyles.draggableCover}>
145
- {filteredValues.map((item) => (
146
- <ListingValuesContent
147
- key={item.id}
148
- item={item}
149
- containerId={containerId}
150
- onItemToggle={onItemToggle}
151
- />
152
- ))}
147
+ {filteredValues?.length > 0 &&
148
+ filteredValues.map((item) => (
149
+ <ListingValuesContent
150
+ key={item.value}
151
+ item={item}
152
+ containerId={containerId}
153
+ onItemToggle={onItemToggle}
154
+ />
155
+ ))}
153
156
  </Box>
154
157
  )}
155
158
  </Box>
@@ -194,13 +194,13 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
194
194
  const { showList, hideList } = getCurrentLists();
195
195
 
196
196
  const showListValues = showList.map((item) => ({
197
- id: item.value,
197
+ value: item.value,
198
198
  label: item.label,
199
199
  visible: true,
200
200
  }));
201
201
 
202
202
  const hideListValues = hideList.map((item) => ({
203
- id: item.value,
203
+ value: item.value,
204
204
  label: item.label,
205
205
  visible: false,
206
206
  }));
@@ -209,18 +209,21 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
209
209
  value.label.toLowerCase().includes(searchTerm.toLowerCase())
210
210
  );
211
211
 
212
- const handleItemToggle = (itemId: string, fromContainerId: string) => {
212
+ const handleItemToggle = (
213
+ item: { label: string; value: string },
214
+ fromContainerId: string
215
+ ) => {
213
216
  let newShowList = [...showList];
214
217
  let newHideList = [...hideList];
215
218
 
216
219
  if (fromContainerId === "tabs") {
217
- const idx = newShowList.findIndex((item) => item.value === itemId);
220
+ const idx = newShowList.findIndex((i) => i.value === item.value);
218
221
  if (idx > -1) {
219
222
  const [moved] = newShowList.splice(idx, 1);
220
223
  newHideList.push(moved);
221
224
  }
222
225
  } else if (fromContainerId === "list") {
223
- const idx = newHideList.findIndex((item) => item.value === itemId);
226
+ const idx = newHideList.findIndex((i) => i.value === item.value);
224
227
  if (idx > -1) {
225
228
  const [moved] = newHideList.splice(idx, 1);
226
229
  newShowList.push(moved);
@@ -378,9 +381,11 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
378
381
  <Box sx={{ flex: 1 }}>
379
382
  {!isColumnDefault && hasShowListQuickTabs && (
380
383
  <CustomTabs value={selectedTabIndex} onChange={handleTabChange}>
381
- {quickTabStates?.show_list?.map((tab) => (
382
- <Tab key={tab} label={tab} />
383
- ))}
384
+ {quickTabStates?.show_list?.map(
385
+ (tab: { label: string; value: string }) => (
386
+ <Tab key={tab?.value} label={tab?.label} />
387
+ )
388
+ )}
384
389
  </CustomTabs>
385
390
  )}
386
391
 
@@ -40,7 +40,7 @@ const GroupBy = ({
40
40
  }: {
41
41
  filterSettingStates: craftTableFilterSettingsOptionsProps;
42
42
  columnsData: any;
43
- tabsApiData?: string[];
43
+ tabsApiData?: { label: string; value: string }[];
44
44
  tabsApiDataLoading?: boolean;
45
45
  }) => {
46
46
  const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
@@ -39,7 +39,7 @@ const Lane = ({
39
39
  }: {
40
40
  filterSettingStates: craftTableFilterSettingsOptionsProps;
41
41
  columnsData: any;
42
- tabsApiData?: string[];
42
+ tabsApiData?: { label: string; value: string }[];
43
43
  tabsApiDataLoading?: boolean;
44
44
  }) => {
45
45
  const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
@@ -58,9 +58,7 @@ const QuickTab = ({
58
58
  ...prev,
59
59
  quick_tab: {
60
60
  ...prev?.quick_tab,
61
- attribute: columnsData?.column_list?.filter(
62
- (item) => item.datasource_list
63
- )[0]?.attribute_key,
61
+ attribute: columnsData[0]?.value,
64
62
  sorting: "asc",
65
63
  },
66
64
  }));
@@ -82,6 +80,15 @@ const QuickTab = ({
82
80
  }));
83
81
 
84
82
  setCurrentQuickAttribute(settingsData?.quick_tab?.attribute || "");
83
+ } else {
84
+ setSettingsData((prev) => ({
85
+ ...prev,
86
+ quick_tab: {
87
+ ...prev?.quick_tab,
88
+ hide_list: [],
89
+ show_list: [],
90
+ },
91
+ }));
85
92
  }
86
93
  }, [tabsApiData]);
87
94
 
@@ -150,14 +157,8 @@ const QuickTab = ({
150
157
  ];
151
158
 
152
159
  // Convert show_list/hide_list to FilterValue[] for rendering only
153
- const showListValues = (quickTabStates?.show_list || [])?.map((id) => ({
154
- id,
155
- label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
156
- }));
157
- const hideListValues = (quickTabStates?.hide_list || []).map((id) => ({
158
- id,
159
- label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
160
- }));
160
+ const showListValues = quickTabStates?.show_list || [];
161
+ const hideListValues = quickTabStates?.hide_list || [];
161
162
 
162
163
  const sensors = useSensors(
163
164
  useSensor(MouseSensor),
@@ -179,15 +180,16 @@ const QuickTab = ({
179
180
  let newShowList = [...(quickTabStates.show_list ?? [])];
180
181
  let newHideList = [...(quickTabStates.hide_list ?? [])];
181
182
  if (currentContainer === "list") {
182
- const oldIndex = newHideList.indexOf(String(active.id));
183
- const newIndex = newHideList.indexOf(String(over.id));
183
+ // const oldIndex = newHideList.indexOf(String(active.id));
184
+ const oldIndex = newHideList.findIndex((i) => i.value === active.id);
185
+ const newIndex = newHideList.findIndex((i) => i.value === over.id); //newHideList.indexOf(String(over.id));
184
186
  if (oldIndex !== -1 && newIndex !== -1) {
185
187
  const [removed] = newHideList.splice(oldIndex, 1);
186
188
  newHideList.splice(newIndex, 0, removed);
187
189
  }
188
190
  } else {
189
- const oldIndex = newShowList.indexOf(String(active.id));
190
- const newIndex = newShowList.indexOf(String(over.id));
191
+ const oldIndex = newShowList.findIndex((i) => i.value === active.id); //newShowList.indexOf(String(active.id));
192
+ const newIndex = newShowList.findIndex((i) => i.value === over.id); //newShowList.indexOf(String(over.id));
191
193
  if (oldIndex !== -1 && newIndex !== -1) {
192
194
  const [removed] = newShowList.splice(oldIndex, 1);
193
195
  newShowList.splice(newIndex, 0, removed);
@@ -210,17 +212,27 @@ const QuickTab = ({
210
212
  if (newShowList.length >= 5) return; // prevent overflow
211
213
  // Move from hide to show
212
214
 
213
- const idx = newHideList.indexOf(String(active.id));
215
+ const idx = newHideList.findIndex((i) => i.value === String(active.id)); //newHideList.indexOf(String(active.id));
214
216
  if (idx !== -1) {
215
217
  newHideList.splice(idx, 1);
216
- newShowList.push(String(active.id));
218
+ newShowList.push({
219
+ value: String(active.id),
220
+ label:
221
+ tabsApiData?.find((i) => i.value === String(active.id))?.label ??
222
+ "",
223
+ });
217
224
  }
218
225
  } else if (currentContainer === "tabs" && overContainer === "list") {
219
226
  // Move from show to hide
220
- const idx = newShowList.indexOf(String(active.id));
227
+ const idx = newShowList.findIndex((i) => i.value === String(active.id)); //newShowList.indexOf(String(active.id));
221
228
  if (idx !== -1) {
222
229
  newShowList.splice(idx, 1);
223
- newHideList.push(String(active.id));
230
+ newHideList.push({
231
+ value: String(active.id),
232
+ label:
233
+ tabsApiData?.find((i) => i.value === String(active.id))?.label ??
234
+ "",
235
+ });
224
236
  }
225
237
  }
226
238
 
@@ -256,7 +268,7 @@ const QuickTab = ({
256
268
  ...prev?.quick_tab,
257
269
  show_list: [...currentShowList, ...limitedHideList],
258
270
  hide_list: currentHideList.filter(
259
- (item) => !limitedHideList.includes(item)
271
+ (item) => !limitedHideList.find((i) => i.value === item.value)
260
272
  ),
261
273
  },
262
274
  }));
@@ -298,24 +310,27 @@ const QuickTab = ({
298
310
  }));
299
311
  };
300
312
 
301
- const handleItemToggle = (itemId: string, fromContainerId: string) => {
313
+ const handleItemToggle = (
314
+ item: { label: string; value: string },
315
+ fromContainerId: string
316
+ ) => {
302
317
  const toShowList = [...(quickTabStates.show_list ?? [])];
303
318
  const toHideList = [...(quickTabStates.hide_list ?? [])];
304
319
 
305
320
  if (fromContainerId === "list") {
306
321
  if (toShowList.length >= 5) return; // prevent overflow
307
322
  // Move from hide_list to show_list
308
- const index = toHideList.indexOf(itemId);
323
+ const index = toHideList.findIndex((i) => i.value == item.value);
309
324
  if (index > -1) {
310
325
  toHideList.splice(index, 1);
311
- toShowList.push(itemId);
326
+ toShowList.push(item);
312
327
  }
313
328
  } else if (fromContainerId === "tabs") {
314
329
  // Move from show_list to hide_list
315
- const index = toShowList.indexOf(itemId);
330
+ const index = toShowList.indexOf(item);
316
331
  if (index > -1) {
317
332
  toShowList.splice(index, 1);
318
- toHideList.push(itemId);
333
+ toHideList.push(item);
319
334
  }
320
335
  }
321
336
 
@@ -362,16 +377,11 @@ const QuickTab = ({
362
377
  }
363
378
  MenuProps={{ container: fullscreenContainer }}
364
379
  >
365
- {columnsData?.column_list
366
- ?.filter((col) => col.datasource_list != null)
367
- .map((column) => (
368
- <MenuItem
369
- key={column?.attribute_key}
370
- value={column?.attribute_key}
371
- >
372
- {column?.name}
373
- </MenuItem>
374
- ))}
380
+ {columnsData?.map((column: any) => (
381
+ <MenuItem key={column?.value} value={column?.value}>
382
+ {column?.label}
383
+ </MenuItem>
384
+ ))}
375
385
  </Select>
376
386
  </FormControl>
377
387
  <FormControl