rez-table-listing-mui 1.0.49 → 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.
Files changed (32) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/package.json +1 -1
  5. package/src/App.tsx +80 -35
  6. package/src/assets/svg.tsx +5 -5
  7. package/src/components/filter/components/attributes-filter.tsx +78 -52
  8. package/src/components/filter/components/forms/components/Date.tsx +175 -66
  9. package/src/components/filter/components/forms/components/Dropdown.tsx +36 -3
  10. package/src/components/filter/components/forms/components/Filter-criteria.tsx +1 -1
  11. package/src/components/filter/components/forms/components/Multi-Select.tsx +62 -34
  12. package/src/components/filter/components/forms/index.tsx +20 -2
  13. package/src/components/filter/components/saved-filter.tsx +63 -9
  14. package/src/components/filter/index.tsx +3 -3
  15. package/src/components/filter/style.ts +1 -1
  16. package/src/components/index-table.tsx +42 -40
  17. package/src/components/index.scss +1 -1
  18. package/src/components/login/index.tsx +1 -1
  19. package/src/components/table-settings/common/info-alert.tsx +37 -0
  20. package/src/components/table-settings/common/listing-values.tsx +63 -48
  21. package/src/components/table-settings/components/column.tsx +210 -170
  22. package/src/components/table-settings/components/quick-tab.tsx +277 -153
  23. package/src/components/table-settings/components/sorting.tsx +135 -109
  24. package/src/components/table-settings/components/toggle-button-switch.tsx +2 -2
  25. package/src/components/table-settings/index.tsx +3 -5
  26. package/src/components/table-settings/style.ts +1 -0
  27. package/src/components/topbar/index.tsx +3 -1
  28. package/src/libs/hooks/useEntityTableAPI.tsx +1 -16
  29. package/src/libs/utils/apiColumn.ts +1 -11
  30. package/src/libs/utils/common.ts +4 -3
  31. package/src/types/filter-settings.ts +11 -0
  32. package/src/types/filter.ts +1 -2
@@ -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!)
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  .ts__table__main {
49
- flex-grow: 1;
49
+ flex: 1;
50
50
  min-width: 0;
51
51
  }
52
52
 
@@ -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",
@@ -0,0 +1,37 @@
1
+ import { Alert, Box } from "@mui/material";
2
+
3
+ interface InfoAlertProps {
4
+ message: string;
5
+ width?: string | number;
6
+ top?: number | string;
7
+ color?: string;
8
+ zIndex?: number;
9
+ position?: "absolute" | "relative" | "fixed" | "sticky";
10
+ }
11
+
12
+ const InfoAlert = ({
13
+ message,
14
+ width = "100%",
15
+ top = 10,
16
+ color = "#088AB2",
17
+ zIndex = 0,
18
+ position = "absolute",
19
+ }: InfoAlertProps) => {
20
+ return (
21
+ <Box
22
+ sx={{
23
+ fontSize: "12px",
24
+ color,
25
+ width,
26
+ height: "fit-content",
27
+ position,
28
+ zIndex,
29
+ top,
30
+ }}
31
+ >
32
+ <Alert severity="info">{message}</Alert>
33
+ </Box>
34
+ );
35
+ };
36
+
37
+ export default InfoAlert;
@@ -1,4 +1,11 @@
1
- import { Box, Button, Grid, IconButton, Typography } from "@mui/material";
1
+ import {
2
+ Alert,
3
+ Box,
4
+ Button,
5
+ Grid,
6
+ IconButton,
7
+ Typography,
8
+ } from "@mui/material";
2
9
  import CustomSearch from "../../filter/components/search/index.tsx";
3
10
  import {
4
11
  SortableContext,
@@ -9,6 +16,8 @@ import DraggableListItem from "./draggable-listitem.tsx";
9
16
  import { listingValuesStyles } from "../style.ts";
10
17
  import Loader from "../../common/loader/loader.tsx";
11
18
  import { ClosedEyeIcon, EyeIcon } from "../../../assets/svg.tsx";
19
+ import InfoAlert from "./info-alert.tsx";
20
+ import React from "react";
12
21
  ``;
13
22
 
14
23
  interface FilterValue {
@@ -27,6 +36,8 @@ interface ListingValuesProps {
27
36
  tabsApiDataLoading?: boolean;
28
37
  onItemToggle: (itemId: string, fromContainerId: string) => void;
29
38
  enableDragAndDrop?: boolean;
39
+ isQuickTabActive?: boolean;
40
+ AlertComponenet?: React.ReactNode;
30
41
  }
31
42
 
32
43
  const ListingValuesContent = ({
@@ -71,6 +82,7 @@ const ListingValues = ({
71
82
  tabsApiDataLoading,
72
83
  onItemToggle,
73
84
  enableDragAndDrop = true,
85
+ AlertComponenet,
74
86
  }: ListingValuesProps) => {
75
87
  const { setNodeRef } = useDroppable({
76
88
  id: containerId,
@@ -85,62 +97,65 @@ const ListingValues = ({
85
97
  {tabsApiDataLoading ? (
86
98
  <Loader />
87
99
  ) : (
88
- <Box sx={{ p: 2 }}>
89
- <Box sx={listingValuesStyles.headerContainer}>
90
- <Typography variant="h6" sx={listingValuesStyles.heading}>
91
- {headerText}
92
- </Typography>
93
- <Button
94
- onClick={onClick}
95
- variant="text"
96
- size="small"
97
- sx={listingValuesStyles.button}
98
- disabled={filteredValues.length === 0}
99
- >
100
- {buttonText}
101
- </Button>
102
- </Box>
100
+ <>
101
+ <Box sx={{ p: 2, zIndex: 10 }}>
102
+ <Box sx={listingValuesStyles.headerContainer}>
103
+ <Typography variant="h6" sx={listingValuesStyles.heading}>
104
+ {headerText}
105
+ </Typography>
106
+ <Button
107
+ onClick={onClick}
108
+ variant="text"
109
+ size="small"
110
+ sx={listingValuesStyles.button}
111
+ disabled={filteredValues.length === 0}
112
+ >
113
+ {buttonText}
114
+ </Button>
115
+ </Box>
103
116
 
104
- {searchTerm !== undefined && setSearchTerm !== undefined && (
105
- <CustomSearch value={searchTerm} onChange={setSearchTerm} />
106
- )}
117
+ {searchTerm !== undefined && setSearchTerm !== undefined && (
118
+ <CustomSearch value={searchTerm} onChange={setSearchTerm} />
119
+ )}
107
120
 
108
- <Box ref={setNodeRef} sx={listingValuesStyles.draggableContainer}>
109
- {enableDragAndDrop ? (
110
- <SortableContext
111
- items={filteredValues.map((item) => item.id)}
112
- strategy={verticalListSortingStrategy}
113
- >
121
+ <Box ref={setNodeRef} sx={listingValuesStyles.draggableContainer}>
122
+ {enableDragAndDrop ? (
123
+ <SortableContext
124
+ items={filteredValues.map((item) => item.id)}
125
+ strategy={verticalListSortingStrategy}
126
+ >
127
+ <Box sx={listingValuesStyles.draggableCover}>
128
+ {filteredValues.map((item) => (
129
+ <DraggableListItem
130
+ key={item.id}
131
+ id={item.id}
132
+ containerId={containerId}
133
+ >
134
+ <ListingValuesContent
135
+ item={item}
136
+ containerId={containerId}
137
+ onItemToggle={onItemToggle}
138
+ />
139
+ </DraggableListItem>
140
+ ))}
141
+ </Box>
142
+ </SortableContext>
143
+ ) : (
114
144
  <Box sx={listingValuesStyles.draggableCover}>
115
145
  {filteredValues.map((item) => (
116
- <DraggableListItem
146
+ <ListingValuesContent
117
147
  key={item.id}
118
- id={item.id}
148
+ item={item}
119
149
  containerId={containerId}
120
- >
121
- <ListingValuesContent
122
- item={item}
123
- containerId={containerId}
124
- onItemToggle={onItemToggle}
125
- />
126
- </DraggableListItem>
150
+ onItemToggle={onItemToggle}
151
+ />
127
152
  ))}
128
153
  </Box>
129
- </SortableContext>
130
- ) : (
131
- <Box sx={listingValuesStyles.draggableCover}>
132
- {filteredValues.map((item) => (
133
- <ListingValuesContent
134
- key={item.id}
135
- item={item}
136
- containerId={containerId}
137
- onItemToggle={onItemToggle}
138
- />
139
- ))}
140
- </Box>
141
- )}
154
+ )}
155
+ </Box>
142
156
  </Box>
143
- </Box>
157
+ {AlertComponenet && AlertComponenet}
158
+ </>
144
159
  )}
145
160
  </Grid>
146
161
  );