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.
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/App.tsx +80 -35
- package/src/assets/svg.tsx +5 -5
- package/src/components/filter/components/attributes-filter.tsx +78 -52
- package/src/components/filter/components/forms/components/Date.tsx +175 -66
- package/src/components/filter/components/forms/components/Dropdown.tsx +36 -3
- package/src/components/filter/components/forms/components/Filter-criteria.tsx +1 -1
- package/src/components/filter/components/forms/components/Multi-Select.tsx +62 -34
- package/src/components/filter/components/forms/index.tsx +20 -2
- package/src/components/filter/components/saved-filter.tsx +63 -9
- package/src/components/filter/index.tsx +3 -3
- package/src/components/filter/style.ts +1 -1
- package/src/components/index-table.tsx +42 -40
- package/src/components/index.scss +1 -1
- package/src/components/login/index.tsx +1 -1
- package/src/components/table-settings/common/info-alert.tsx +37 -0
- package/src/components/table-settings/common/listing-values.tsx +63 -48
- package/src/components/table-settings/components/column.tsx +210 -170
- package/src/components/table-settings/components/quick-tab.tsx +277 -153
- package/src/components/table-settings/components/sorting.tsx +135 -109
- package/src/components/table-settings/components/toggle-button-switch.tsx +2 -2
- package/src/components/table-settings/index.tsx +3 -5
- package/src/components/table-settings/style.ts +1 -0
- package/src/components/topbar/index.tsx +3 -1
- package/src/libs/hooks/useEntityTableAPI.tsx +1 -16
- package/src/libs/utils/apiColumn.ts +1 -11
- package/src/libs/utils/common.ts +4 -3
- package/src/types/filter-settings.ts +11 -0
- 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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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!)
|
|
@@ -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 {
|
|
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
|
-
|
|
89
|
-
<Box sx={
|
|
90
|
-
<
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
{searchTerm !== undefined && setSearchTerm !== undefined && (
|
|
118
|
+
<CustomSearch value={searchTerm} onChange={setSearchTerm} />
|
|
119
|
+
)}
|
|
107
120
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
<
|
|
146
|
+
<ListingValuesContent
|
|
117
147
|
key={item.id}
|
|
118
|
-
|
|
148
|
+
item={item}
|
|
119
149
|
containerId={containerId}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
item={item}
|
|
123
|
-
containerId={containerId}
|
|
124
|
-
onItemToggle={onItemToggle}
|
|
125
|
-
/>
|
|
126
|
-
</DraggableListItem>
|
|
150
|
+
onItemToggle={onItemToggle}
|
|
151
|
+
/>
|
|
127
152
|
))}
|
|
128
153
|
</Box>
|
|
129
|
-
|
|
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
|
-
|
|
157
|
+
{AlertComponenet && AlertComponenet}
|
|
158
|
+
</>
|
|
144
159
|
)}
|
|
145
160
|
</Grid>
|
|
146
161
|
);
|