rez-table-listing-mui 1.0.50 → 1.2.1

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.0.50",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
package/src/App.tsx CHANGED
@@ -85,12 +85,12 @@ function App() {
85
85
  ) => {
86
86
  // Build ordered columns using showList and filteredColumns
87
87
  return showList
88
- .map((showItem) => {
88
+ ?.map((showItem) => {
89
89
  return filteredColumns.find(
90
- (col) => col.accessorKey === showItem.value
90
+ (col) => col?.accessorKey === showItem?.value
91
91
  );
92
92
  })
93
- .filter((col): col is ColumnDef<any> => col !== undefined); // Ensure non-undefined columns are returned
93
+ ?.filter((col): col is ColumnDef<any> => col !== undefined); // Ensure non-undefined columns are returned
94
94
  };
95
95
 
96
96
  if (
@@ -110,7 +110,7 @@ function App() {
110
110
 
111
111
  // First, filter columns based on visibleColumns
112
112
  const filteredColumns = allColumns.filter((col: any) =>
113
- visibleColumns.has(col.accessorKey)
113
+ visibleColumns.has(col?.accessorKey)
114
114
  );
115
115
  setColumns(
116
116
  getOrderedColumns(activeTabSettings.show_list, filteredColumns)
@@ -125,7 +125,7 @@ function App() {
125
125
  savedColumnSettings.show_list.map((c) => c.value)
126
126
  );
127
127
  const filtered = allColumns.filter((col: any) =>
128
- visibleColumns.has(col.accessorKey)
128
+ visibleColumns.has(col?.accessorKey)
129
129
  );
130
130
 
131
131
  setColumns(
@@ -42,46 +42,48 @@ function TableWrapper<T>({
42
42
  const [metaColumns, setMetaColumns] = useState<ColumnDef<T>[]>([]);
43
43
 
44
44
  useEffect(() => {
45
- const updatedColumns = columns
46
- .filter((col) => {
47
- const accessorKey =
48
- "accessorKey" in col
49
- ? (col as { accessorKey: string }).accessorKey
50
- : undefined;
51
- return typeof shouldHideColumn === "function"
52
- ? !shouldHideColumn(accessorKey)
53
- : true;
54
- })
55
- .map((col, index) => {
56
- const id =
57
- "accessorKey" in col
58
- ? (col as { accessorKey: string }).accessorKey
59
- : `col_${index}`;
60
-
61
- const cell = (ctx: any) => {
62
- if (col.meta?.type === "custom" && col?.meta?.propName) {
63
- const customFn = customRenderFn?.[col.meta.propName];
64
- return typeof customFn === "function"
65
- ? customFn({
66
- value: ctx.getValue(),
67
- row: ctx.row,
68
- table: ctx.table.getRowModel().rows,
69
- })
70
- : ctx.getValue();
71
- }
72
-
73
- if (typeof col.cell === "function") {
74
- return col.cell(ctx);
75
- }
76
-
77
- return ctx.getValue();
78
- };
79
-
80
- return { ...col, id, cell };
81
- });
82
-
83
- setMetaColumns(updatedColumns);
84
- }, [columns, tableStates]);
45
+ if (columns?.length > 0) {
46
+ const updatedColumns = columns
47
+ ?.filter((col) => {
48
+ const accessorKey =
49
+ "accessorKey" in col
50
+ ? (col as { accessorKey: string })?.accessorKey
51
+ : undefined;
52
+ return typeof shouldHideColumn === "function"
53
+ ? !shouldHideColumn(accessorKey)
54
+ : true;
55
+ })
56
+ ?.map((col, index) => {
57
+ const id =
58
+ "accessorKey" in col
59
+ ? (col as { accessorKey: string })?.accessorKey
60
+ : `col_${index}`;
61
+
62
+ const cell = (ctx: any) => {
63
+ if (col?.meta?.type === "custom" && col?.meta?.propName) {
64
+ const customFn = customRenderFn?.[col?.meta?.propName];
65
+ return typeof customFn === "function"
66
+ ? customFn({
67
+ value: ctx?.getValue(),
68
+ row: ctx?.row,
69
+ table: ctx?.table?.getRowModel()?.rows,
70
+ })
71
+ : ctx?.getValue();
72
+ }
73
+
74
+ if (typeof col?.cell === "function") {
75
+ return col?.cell(ctx);
76
+ }
77
+
78
+ return ctx?.getValue();
79
+ };
80
+
81
+ return { ...col, id, cell };
82
+ });
83
+
84
+ setMetaColumns(updatedColumns);
85
+ }
86
+ }, [columns]);
85
87
 
86
88
  const [columnOrder, setColumnOrder] = useState<string[]>(() =>
87
89
  metaColumns.map((c) => c.id!)
@@ -9,7 +9,7 @@ const LoginButton = () => {
9
9
  setLoading(true);
10
10
  try {
11
11
  const response = await axios.post(
12
- "http://localhost:4010/api/auth/login",
12
+ "http://localhost:6010/api/auth/login",
13
13
  {
14
14
  email_id: "darshil@rezolut.in",
15
15
  password: "Admin@123",
@@ -84,7 +84,7 @@ export const ENTITY_TYPE = "NTM";
84
84
 
85
85
  // API INTEGRATION
86
86
  export const api = axios.create({
87
- baseURL: "http://localhost:4010/api",
87
+ baseURL: "http://localhost:6010/api",
88
88
  timeout: 10000,
89
89
  headers: {
90
90
  "Content-Type": "application/json",