umwd-components 0.1.674 → 0.1.681
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/.ai/form-patterns.instruction.md +0 -0
- package/.ai/form-patterns.prompt.md +0 -0
- package/dist/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/components/common/EnhancedTable/EnhancedTable.js +7 -0
- package/dist/src/components/common/EnhancedTable/EnhancedTableFilterRow.js +6 -0
- package/dist/src/components/common/EnhancedTable/EnhancedTableHead.js +6 -0
- package/dist/src/components/common/EnhancedTable/EnhancedTableToolbar.js +6 -0
- package/dist/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/src/data/loaders/e-commerce/getSingleCustomer.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/{e-commerce → common}/EnhancedTable/EnhancedTable.d.ts +1 -1
- package/dist/types/components/common/EnhancedTable/EnhancedTableFilterRow.d.ts +13 -0
- package/dist/types/components/{e-commerce → common}/EnhancedTable/EnhancedTableHead.d.ts +1 -1
- package/dist/types/components/{e-commerce → common}/EnhancedTable/EnhancedTableRow.d.ts +1 -1
- package/dist/types/components/{e-commerce → common}/EnhancedTable/EnhancedTableToolbar.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/types/{e-commerce → common}/enhancedTable/types.d.ts +10 -0
- package/dist/types/types/e-commerce/customer/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/components/{e-commerce → common}/EnhancedTable/EnhancedTable.tsx +59 -7
- package/src/components/common/EnhancedTable/EnhancedTableFilterRow.tsx +121 -0
- package/src/components/{e-commerce → common}/EnhancedTable/EnhancedTableHead.tsx +22 -20
- package/src/components/{e-commerce → common}/EnhancedTable/EnhancedTableRow.tsx +1 -1
- package/src/components/{e-commerce → common}/EnhancedTable/EnhancedTableToolbar.tsx +20 -2
- package/src/components/e-commerce/customer/CustomerProfileDisplay.tsx +154 -56
- package/src/components/logistics/vendor/EditVendorForm.tsx +2 -1
- package/src/data/loaders/e-commerce/getSingleCustomer.ts +2 -0
- package/src/index.ts +4 -4
- package/src/types/{e-commerce → common}/enhancedTable/types.ts +8 -0
- package/src/types/e-commerce/customer/types.ts +4 -0
- package/src/types/logistics/Ipo/PreReport.ts +0 -0
- package/src/types/logistics/Ipo/index.ts +0 -0
- package/dist/src/components/e-commerce/EnhancedTable/EnhancedTable.js +0 -7
- package/dist/src/components/e-commerce/EnhancedTable/EnhancedTableHead.js +0 -6
- package/dist/src/components/e-commerce/EnhancedTable/EnhancedTableToolbar.js +0 -6
- /package/dist/src/components/{e-commerce → common}/EnhancedTable/EnhancedTableRow.js +0 -0
- /package/dist/types/components/{e-commerce → common}/EnhancedTable/utils.d.ts +0 -0
- /package/src/components/{e-commerce → common}/EnhancedTable/utils.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EnhancedTableProps } from "../../../types/
|
|
2
|
+
import { EnhancedTableProps } from "../../../types/common/enhancedTable/types";
|
|
3
3
|
declare function EnhancedTable(props: EnhancedTableProps): React.JSX.Element;
|
|
4
4
|
export default EnhancedTable;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HeadCell } from "../../../types/common/enhancedTable/types";
|
|
3
|
+
interface EnhancedTableFilterRowProps {
|
|
4
|
+
headCells: HeadCell[];
|
|
5
|
+
filters: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
onFilterChange: (columnId: string, value: string) => void;
|
|
9
|
+
withSelection?: boolean;
|
|
10
|
+
withSubRows?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function EnhancedTableFilterRow({ headCells, filters, onFilterChange, withSelection, withSubRows, }: EnhancedTableFilterRowProps): React.JSX.Element;
|
|
13
|
+
export default EnhancedTableFilterRow;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EnhancedTableHeadProps } from "../../../types/
|
|
2
|
+
import { EnhancedTableHeadProps } from "../../../types/common/enhancedTable/types";
|
|
3
3
|
declare function EnhancedTableHead(props: EnhancedTableHeadProps): React.JSX.Element;
|
|
4
4
|
export default EnhancedTableHead;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EnhancedTableRowProps } from "../../../types/
|
|
2
|
+
import { EnhancedTableRowProps } from "../../../types/common/enhancedTable/types";
|
|
3
3
|
declare function EnhancedTableRow(props: EnhancedTableRowProps, index: number): React.JSX.Element;
|
|
4
4
|
export default EnhancedTableRow;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EnhancedTableToolbarProps } from "../../../types/
|
|
2
|
+
import { EnhancedTableToolbarProps } from "../../../types/common/enhancedTable/types";
|
|
3
3
|
declare function EnhancedTableToolbar(props: EnhancedTableToolbarProps): React.JSX.Element;
|
|
4
4
|
export default EnhancedTableToolbar;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ export { getHomePageData as getHomePageData, getAllPages as getAllPages, getNavi
|
|
|
28
28
|
export { getSinglePage as getSinglePage } from "./data/loaders/page-elements/getSinglePage";
|
|
29
29
|
export { default as PageBuilder } from "./components/page-builder/PageBuilder";
|
|
30
30
|
export { updatePageAction as updatePageAction } from "./data/actions/pagebuilder-actions";
|
|
31
|
-
export { default as EnhancedTable } from "./components/
|
|
32
|
-
export { default as EnhancedTableRow } from "./components/
|
|
33
|
-
export { default as EnhancedTableHead } from "./components/
|
|
34
|
-
export { default as EnhancedTableToolbar } from "./components/
|
|
31
|
+
export { default as EnhancedTable } from "./components/common/EnhancedTable/EnhancedTable";
|
|
32
|
+
export { default as EnhancedTableRow } from "./components/common/EnhancedTable/EnhancedTableRow";
|
|
33
|
+
export { default as EnhancedTableHead } from "./components/common/EnhancedTable/EnhancedTableHead";
|
|
34
|
+
export { default as EnhancedTableToolbar } from "./components/common/EnhancedTable/EnhancedTableToolbar";
|
|
35
35
|
export { default as ProductCard } from "./components/e-commerce/products/ProductCard";
|
|
36
36
|
export { default as Price } from "./components/e-commerce/products/Price";
|
|
37
37
|
export { default as ProductCategoryCard } from "./components/e-commerce/products/ProductCategoryCard";
|
|
@@ -6,6 +6,9 @@ export interface HeadCell {
|
|
|
6
6
|
numeric: boolean;
|
|
7
7
|
align?: "left" | "right" | "center";
|
|
8
8
|
sortable?: boolean;
|
|
9
|
+
filterable?: boolean;
|
|
10
|
+
filterType?: "text" | "select" | "date";
|
|
11
|
+
filterOptions?: string[];
|
|
9
12
|
}
|
|
10
13
|
export type Data = {
|
|
11
14
|
id: number;
|
|
@@ -42,10 +45,14 @@ export interface EnhancedTableHeadProps {
|
|
|
42
45
|
numSelected: number;
|
|
43
46
|
onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
|
|
44
47
|
onSelectAllClick: (event: React.MouseEvent<unknown>) => void;
|
|
48
|
+
onFilterChange?: (columnId: string, value: string) => void;
|
|
45
49
|
order: Order;
|
|
46
50
|
orderBy: string;
|
|
47
51
|
rowCount: number;
|
|
48
52
|
headCells: HeadCell[];
|
|
53
|
+
filters?: {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
};
|
|
49
56
|
withSelection?: boolean;
|
|
50
57
|
withSubRows?: boolean;
|
|
51
58
|
}
|
|
@@ -55,6 +62,9 @@ export interface EnhancedTableToolbarProps {
|
|
|
55
62
|
title?: string;
|
|
56
63
|
functions?: func[];
|
|
57
64
|
selectFunctions?: selectFunc[];
|
|
65
|
+
showFilters?: boolean;
|
|
66
|
+
onToggleFilters?: () => void;
|
|
67
|
+
hasFilterableColumns?: boolean;
|
|
58
68
|
}
|
|
59
69
|
export interface EnhancedTableRowProps {
|
|
60
70
|
row: Data[number];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BusinessCredentialsWithJSONProps } from "../BusinessCredentialsProps";
|
|
2
2
|
import { AddressProps } from "../../AddressProps";
|
|
3
|
+
import { Opo } from "../opo/types";
|
|
4
|
+
import { Iro } from "../iro/types";
|
|
3
5
|
export type CustomerLabel = {
|
|
4
6
|
id: number;
|
|
5
7
|
title: string;
|
|
@@ -23,4 +25,10 @@ export interface CustomerProfileProps {
|
|
|
23
25
|
delivery_address: AddressProps;
|
|
24
26
|
billing_address: AddressProps;
|
|
25
27
|
business_credentials: BusinessCredentialsWithJSONProps;
|
|
28
|
+
orders: {
|
|
29
|
+
data: Opo[];
|
|
30
|
+
};
|
|
31
|
+
returns: {
|
|
32
|
+
data: Iro[];
|
|
33
|
+
};
|
|
26
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React, { useState, useEffect } from "react";
|
|
3
|
+
import React, { useState, useEffect, useMemo } from "react";
|
|
4
4
|
import Box from "@mui/material/Box";
|
|
5
5
|
import Table from "@mui/material/Table";
|
|
6
6
|
import TableBody from "@mui/material/TableBody";
|
|
@@ -11,12 +11,13 @@ import TableRow from "@mui/material/TableRow";
|
|
|
11
11
|
import Paper from "@mui/material/Paper";
|
|
12
12
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
13
13
|
import Switch from "@mui/material/Switch";
|
|
14
|
-
import { Order } from "../../../types/
|
|
14
|
+
import { Order } from "../../../types/common/enhancedTable/types";
|
|
15
15
|
import EnhancedTableHead from "./EnhancedTableHead";
|
|
16
16
|
import EnhancedTableToolbar from "./EnhancedTableToolbar";
|
|
17
17
|
import EnhancedTableRow from "./EnhancedTableRow";
|
|
18
|
+
import EnhancedTableFilterRow from "./EnhancedTableFilterRow";
|
|
18
19
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
19
|
-
import { EnhancedTableProps } from "../../../types/
|
|
20
|
+
import { EnhancedTableProps } from "../../../types/common/enhancedTable/types";
|
|
20
21
|
|
|
21
22
|
function EnhancedTable(props: EnhancedTableProps) {
|
|
22
23
|
const {
|
|
@@ -41,6 +42,22 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
41
42
|
const [page, setPage] = useState(0);
|
|
42
43
|
const [dense, setDense] = useState(false);
|
|
43
44
|
const [rowsPerPage, setRowsPerPage] = useState(5);
|
|
45
|
+
const [showFilters, setShowFilters] = useState(false);
|
|
46
|
+
const [filters, setFilters] = useState<{ [key: string]: string }>(() => {
|
|
47
|
+
const params = new URLSearchParams(searchParams?.toString());
|
|
48
|
+
const initialFilters: { [key: string]: string } = {};
|
|
49
|
+
headCells.forEach((cell) => {
|
|
50
|
+
if (cell.filterable) {
|
|
51
|
+
const filterValue = params.get(`filter[${cell.id}]`);
|
|
52
|
+
if (filterValue) {
|
|
53
|
+
initialFilters[cell.id] = filterValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return initialFilters;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const hasFilterableColumns = headCells.some((cell) => cell.filterable);
|
|
44
61
|
|
|
45
62
|
const handleRequestSort = (
|
|
46
63
|
e: React.MouseEvent<unknown>,
|
|
@@ -96,7 +113,13 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
96
113
|
setDense(event.target.checked);
|
|
97
114
|
};
|
|
98
115
|
|
|
99
|
-
const
|
|
116
|
+
const handleFilterChange = (columnId: string, value: string) => {
|
|
117
|
+
setFilters((prev) => ({
|
|
118
|
+
...prev,
|
|
119
|
+
[columnId]: value,
|
|
120
|
+
}));
|
|
121
|
+
setPage(0); // Reset to first page when filter changes
|
|
122
|
+
};
|
|
100
123
|
|
|
101
124
|
// Avoid a layout jump when reaching the last page with empty rows.
|
|
102
125
|
const emptyRows =
|
|
@@ -107,6 +130,8 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
107
130
|
useEffect(() => {
|
|
108
131
|
if (searchParams) {
|
|
109
132
|
const params = new URLSearchParams(searchParams);
|
|
133
|
+
|
|
134
|
+
// Handle sorting params
|
|
110
135
|
if (order) {
|
|
111
136
|
params.set("order", order);
|
|
112
137
|
} else {
|
|
@@ -117,6 +142,8 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
117
142
|
} else {
|
|
118
143
|
params.delete("orderBy");
|
|
119
144
|
}
|
|
145
|
+
|
|
146
|
+
// Handle pagination params
|
|
120
147
|
if (page) {
|
|
121
148
|
params.set("page", page.toString());
|
|
122
149
|
} else {
|
|
@@ -127,9 +154,19 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
127
154
|
} else {
|
|
128
155
|
params.delete("rowsPerPage");
|
|
129
156
|
}
|
|
157
|
+
|
|
158
|
+
// Handle filter params
|
|
159
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
160
|
+
if (value) {
|
|
161
|
+
params.set(`filter[${key}]`, value);
|
|
162
|
+
} else {
|
|
163
|
+
params.delete(`filter[${key}]`);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
130
167
|
replace(`${pathname}?${params.toString()}`);
|
|
131
168
|
}
|
|
132
|
-
}, [order, orderBy, page, rowsPerPage]);
|
|
169
|
+
}, [order, orderBy, page, rowsPerPage, filters]);
|
|
133
170
|
|
|
134
171
|
return (
|
|
135
172
|
<Box sx={{ width: "100%" }}>
|
|
@@ -140,6 +177,9 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
140
177
|
title={title}
|
|
141
178
|
functions={functions}
|
|
142
179
|
selectFunctions={selectFunctions}
|
|
180
|
+
showFilters={showFilters}
|
|
181
|
+
onToggleFilters={() => setShowFilters(!showFilters)}
|
|
182
|
+
hasFilterableColumns={hasFilterableColumns}
|
|
143
183
|
/>
|
|
144
184
|
<TableContainer>
|
|
145
185
|
<Table
|
|
@@ -153,12 +193,24 @@ function EnhancedTable(props: EnhancedTableProps) {
|
|
|
153
193
|
orderBy={orderBy}
|
|
154
194
|
onSelectAllClick={handleSelectAllClick}
|
|
155
195
|
onRequestSort={handleRequestSort}
|
|
156
|
-
|
|
196
|
+
onFilterChange={handleFilterChange}
|
|
197
|
+
filters={filters}
|
|
198
|
+
rowCount={data.length}
|
|
157
199
|
headCells={headCells}
|
|
158
200
|
withSelection={withSelection}
|
|
159
201
|
withSubRows={Boolean(subHeadCells && subHeadCells.length > 0)}
|
|
160
|
-
/>
|
|
202
|
+
/>{" "}
|
|
203
|
+
{showFilters && hasFilterableColumns && (
|
|
204
|
+
<EnhancedTableFilterRow
|
|
205
|
+
headCells={headCells}
|
|
206
|
+
filters={filters}
|
|
207
|
+
onFilterChange={handleFilterChange}
|
|
208
|
+
withSelection={withSelection}
|
|
209
|
+
withSubRows={Boolean(subHeadCells && subHeadCells.length > 0)}
|
|
210
|
+
/>
|
|
211
|
+
)}
|
|
161
212
|
<TableBody>
|
|
213
|
+
{" "}
|
|
162
214
|
{data &&
|
|
163
215
|
data.map((row, index) => {
|
|
164
216
|
return (
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TableRow from "@mui/material/TableRow";
|
|
3
|
+
import TableCell from "@mui/material/TableCell";
|
|
4
|
+
import TextField from "@mui/material/TextField";
|
|
5
|
+
import Select from "@mui/material/Select";
|
|
6
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
7
|
+
import { HeadCell } from "../../../types/common/enhancedTable/types";
|
|
8
|
+
|
|
9
|
+
interface EnhancedTableFilterRowProps {
|
|
10
|
+
headCells: HeadCell[];
|
|
11
|
+
filters: { [key: string]: string };
|
|
12
|
+
onFilterChange: (columnId: string, value: string) => void;
|
|
13
|
+
withSelection?: boolean;
|
|
14
|
+
withSubRows?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function EnhancedTableFilterRow({
|
|
18
|
+
headCells,
|
|
19
|
+
filters,
|
|
20
|
+
onFilterChange,
|
|
21
|
+
withSelection,
|
|
22
|
+
withSubRows,
|
|
23
|
+
}: EnhancedTableFilterRowProps) {
|
|
24
|
+
const [draftFilters, setDraftFilters] = React.useState<{
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
}>(filters);
|
|
27
|
+
|
|
28
|
+
const handleSubmit = (columnId: string, value: string) => {
|
|
29
|
+
onFilterChange(columnId, value);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<TableRow>
|
|
34
|
+
{withSelection && <TableCell padding="checkbox" />}
|
|
35
|
+
{withSubRows && <TableCell />}
|
|
36
|
+
{headCells.map((headCell) => (
|
|
37
|
+
<TableCell
|
|
38
|
+
key={headCell.id}
|
|
39
|
+
align={headCell.numeric ? "right" : "left"}
|
|
40
|
+
padding={headCell.disablePadding ? "none" : "normal"}
|
|
41
|
+
>
|
|
42
|
+
{" "}
|
|
43
|
+
{headCell.filterable &&
|
|
44
|
+
(() => {
|
|
45
|
+
const currentValue = draftFilters[headCell.id] || "";
|
|
46
|
+
|
|
47
|
+
switch (headCell.filterType) {
|
|
48
|
+
case "select":
|
|
49
|
+
return (
|
|
50
|
+
<Select
|
|
51
|
+
size="small"
|
|
52
|
+
value={currentValue}
|
|
53
|
+
onChange={(e) => {
|
|
54
|
+
const value = e.target.value;
|
|
55
|
+
setDraftFilters((prev) => ({
|
|
56
|
+
...prev,
|
|
57
|
+
[headCell.id]: value,
|
|
58
|
+
}));
|
|
59
|
+
handleSubmit(headCell.id, value); // For select, we submit immediately
|
|
60
|
+
}}
|
|
61
|
+
fullWidth
|
|
62
|
+
>
|
|
63
|
+
<MenuItem value="">All</MenuItem>
|
|
64
|
+
{headCell.filterOptions?.map((option) => (
|
|
65
|
+
<MenuItem key={option} value={option}>
|
|
66
|
+
{option}
|
|
67
|
+
</MenuItem>
|
|
68
|
+
))}
|
|
69
|
+
</Select>
|
|
70
|
+
);
|
|
71
|
+
case "date":
|
|
72
|
+
return (
|
|
73
|
+
<TextField
|
|
74
|
+
type="date"
|
|
75
|
+
size="small"
|
|
76
|
+
value={currentValue}
|
|
77
|
+
onChange={(e) =>
|
|
78
|
+
setDraftFilters((prev) => ({
|
|
79
|
+
...prev,
|
|
80
|
+
[headCell.id]: e.target.value,
|
|
81
|
+
}))
|
|
82
|
+
}
|
|
83
|
+
onBlur={() => handleSubmit(headCell.id, currentValue)}
|
|
84
|
+
onKeyPress={(e) => {
|
|
85
|
+
if (e.key === "Enter") {
|
|
86
|
+
handleSubmit(headCell.id, currentValue);
|
|
87
|
+
}
|
|
88
|
+
}}
|
|
89
|
+
fullWidth
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
default:
|
|
93
|
+
return (
|
|
94
|
+
<TextField
|
|
95
|
+
size="small"
|
|
96
|
+
placeholder={`Filter ${headCell.label}`}
|
|
97
|
+
value={currentValue}
|
|
98
|
+
onChange={(e) =>
|
|
99
|
+
setDraftFilters((prev) => ({
|
|
100
|
+
...prev,
|
|
101
|
+
[headCell.id]: e.target.value,
|
|
102
|
+
}))
|
|
103
|
+
}
|
|
104
|
+
onBlur={() => handleSubmit(headCell.id, currentValue)}
|
|
105
|
+
onKeyPress={(e) => {
|
|
106
|
+
if (e.key === "Enter") {
|
|
107
|
+
handleSubmit(headCell.id, currentValue);
|
|
108
|
+
}
|
|
109
|
+
}}
|
|
110
|
+
fullWidth
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
})()}
|
|
115
|
+
</TableCell>
|
|
116
|
+
))}
|
|
117
|
+
</TableRow>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default EnhancedTableFilterRow;
|
|
@@ -5,9 +5,8 @@ import TableCell from "@mui/material/TableCell";
|
|
|
5
5
|
import TableHead from "@mui/material/TableHead";
|
|
6
6
|
import TableRow from "@mui/material/TableRow";
|
|
7
7
|
import TableSortLabel from "@mui/material/TableSortLabel";
|
|
8
|
-
// import { visuallyHidden } from "@mui/utils";
|
|
9
8
|
import { visuallyHidden } from "@mui/utils";
|
|
10
|
-
import { EnhancedTableHeadProps } from "../../../types/
|
|
9
|
+
import { EnhancedTableHeadProps } from "../../../types/common/enhancedTable/types";
|
|
11
10
|
|
|
12
11
|
function EnhancedTableHead(props: EnhancedTableHeadProps) {
|
|
13
12
|
const {
|
|
@@ -52,24 +51,27 @@ function EnhancedTableHead(props: EnhancedTableHeadProps) {
|
|
|
52
51
|
padding={headCell.disablePadding ? "none" : "normal"}
|
|
53
52
|
sortDirection={orderBy === headCell.id ? order : false}
|
|
54
53
|
>
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
{" "}
|
|
55
|
+
<Box>
|
|
56
|
+
{headCell.sortable !== false ? (
|
|
57
|
+
<TableSortLabel
|
|
58
|
+
active={orderBy === headCell.id}
|
|
59
|
+
direction={orderBy === headCell.id ? order : "asc"}
|
|
60
|
+
onClick={createSortHandler(headCell.id)}
|
|
61
|
+
>
|
|
62
|
+
{headCell.label}
|
|
63
|
+
{orderBy === headCell.id ? (
|
|
64
|
+
<Box component="span" sx={visuallyHidden}>
|
|
65
|
+
{order === "desc"
|
|
66
|
+
? "sorted descending"
|
|
67
|
+
: "sorted ascending"}
|
|
68
|
+
</Box>
|
|
69
|
+
) : null}
|
|
70
|
+
</TableSortLabel>
|
|
71
|
+
) : (
|
|
72
|
+
<span>{headCell.label}</span>
|
|
73
|
+
)}
|
|
74
|
+
</Box>
|
|
73
75
|
</TableCell>
|
|
74
76
|
))}
|
|
75
77
|
</TableRow>
|
|
@@ -11,7 +11,7 @@ import TableBody from "@mui/material/TableBody";
|
|
|
11
11
|
import Checkbox from "@mui/material/Checkbox";
|
|
12
12
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
13
13
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
14
|
-
import { EnhancedTableRowProps } from "../../../types/
|
|
14
|
+
import { EnhancedTableRowProps } from "../../../types/common/enhancedTable/types";
|
|
15
15
|
|
|
16
16
|
function EnhancedTableRow(props: EnhancedTableRowProps, index: number) {
|
|
17
17
|
const {
|
|
@@ -3,11 +3,21 @@ import Toolbar from "@mui/material/Toolbar";
|
|
|
3
3
|
import Typography from "@mui/material/Typography";
|
|
4
4
|
import IconButton from "@mui/material/IconButton";
|
|
5
5
|
import Tooltip from "@mui/material/Tooltip";
|
|
6
|
+
import FilterListIcon from "@mui/icons-material/FilterList";
|
|
6
7
|
import { alpha } from "@mui/material/styles";
|
|
7
|
-
import { EnhancedTableToolbarProps } from "../../../types/
|
|
8
|
+
import { EnhancedTableToolbarProps } from "../../../types/common/enhancedTable/types";
|
|
8
9
|
|
|
9
10
|
function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
|
|
10
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
title,
|
|
13
|
+
selected,
|
|
14
|
+
setSelected,
|
|
15
|
+
functions,
|
|
16
|
+
selectFunctions,
|
|
17
|
+
showFilters,
|
|
18
|
+
onToggleFilters,
|
|
19
|
+
hasFilterableColumns,
|
|
20
|
+
} = props;
|
|
11
21
|
|
|
12
22
|
const numSelected = selected.length;
|
|
13
23
|
|
|
@@ -62,6 +72,7 @@ function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
|
|
|
62
72
|
</>
|
|
63
73
|
) : (
|
|
64
74
|
<>
|
|
75
|
+
{" "}
|
|
65
76
|
{functions &&
|
|
66
77
|
functions.map((func, index) => (
|
|
67
78
|
<Tooltip key={index} title={func.label}>
|
|
@@ -70,6 +81,13 @@ function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
|
|
|
70
81
|
</IconButton>
|
|
71
82
|
</Tooltip>
|
|
72
83
|
))}
|
|
84
|
+
{hasFilterableColumns && (
|
|
85
|
+
<Tooltip title="Filter list">
|
|
86
|
+
<IconButton onClick={onToggleFilters}>
|
|
87
|
+
<FilterListIcon color={showFilters ? "primary" : "inherit"} />
|
|
88
|
+
</IconButton>
|
|
89
|
+
</Tooltip>
|
|
90
|
+
)}
|
|
73
91
|
</>
|
|
74
92
|
)}
|
|
75
93
|
</Toolbar>
|