@evenicanpm/portal-table-ui 2.2.1 → 2.2.2
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": "@evenicanpm/portal-table-ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"@tanstack/react-query": "^5.90.11",
|
|
48
48
|
"date-fns": "^4.1.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "eb81763cdb511681ffaf1da5140e957afa149816"
|
|
51
51
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import FlagIcon from "@mui/icons-material/Flag";
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
5
|
+
Button,
|
|
5
6
|
Card,
|
|
6
7
|
Divider,
|
|
7
8
|
Paper,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
Typography,
|
|
16
17
|
useMediaQuery,
|
|
17
18
|
useTheme,
|
|
18
|
-
Button,
|
|
19
19
|
} from "@mui/material";
|
|
20
20
|
import Grid2 from "@mui/material/Grid2";
|
|
21
21
|
import { StatusPill } from "../../status-pill";
|
|
@@ -289,6 +289,7 @@ export const InvoiceDetailsTemplate = ({
|
|
|
289
289
|
<Button
|
|
290
290
|
onClick={handleOnClick}
|
|
291
291
|
variant="outlined"
|
|
292
|
+
size="small"
|
|
292
293
|
sx={{ "@media print": { display: "none" } }}
|
|
293
294
|
>
|
|
294
295
|
Print Invoice
|
|
@@ -32,6 +32,11 @@ export type DocumentTableProps = {
|
|
|
32
32
|
queryKey: QueryKey;
|
|
33
33
|
queryFn: () => Promise<Types.Queries.TableConfig>;
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
selectedDocument?: string | number | null;
|
|
37
|
+
setSelectedDocument?: React.Dispatch<
|
|
38
|
+
React.SetStateAction<string | number | null>
|
|
39
|
+
>;
|
|
35
40
|
};
|
|
36
41
|
|
|
37
42
|
/**
|
|
@@ -44,11 +49,20 @@ export default function DocumentTable({
|
|
|
44
49
|
pageSize,
|
|
45
50
|
setPageSize,
|
|
46
51
|
viewConfigQuery,
|
|
52
|
+
selectedDocument: selectedDocumentProp,
|
|
53
|
+
setSelectedDocument: setSelectedDocumentProp,
|
|
47
54
|
}: Readonly<DocumentTableProps>) {
|
|
48
55
|
const [page, setPage] = useState(0);
|
|
49
|
-
const [
|
|
56
|
+
const [selectedDocumentLocal, setSelectedDocumentLocal] = useState<
|
|
50
57
|
string | number | null
|
|
51
58
|
>(null);
|
|
59
|
+
|
|
60
|
+
const selectedDocument =
|
|
61
|
+
selectedDocumentProp !== undefined
|
|
62
|
+
? selectedDocumentProp
|
|
63
|
+
: selectedDocumentLocal;
|
|
64
|
+
const setSelectedDocument =
|
|
65
|
+
setSelectedDocumentProp ?? setSelectedDocumentLocal;
|
|
52
66
|
const [filters, setFilters] = useState<Record<string, string>>({});
|
|
53
67
|
const [searchTerm, setSearchTerm] = useState("");
|
|
54
68
|
|
|
@@ -19,6 +19,11 @@ export interface TableProps {
|
|
|
19
19
|
queryFn: () => Promise<Types.Queries.TableConfig>;
|
|
20
20
|
};
|
|
21
21
|
resources: Types.Schemas.Resource[];
|
|
22
|
+
|
|
23
|
+
selectedDocument?: string | number | null;
|
|
24
|
+
setSelectedDocument?: React.Dispatch<
|
|
25
|
+
React.SetStateAction<string | number | null>
|
|
26
|
+
>;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
/**
|
|
@@ -28,7 +33,12 @@ export interface TableProps {
|
|
|
28
33
|
*
|
|
29
34
|
* @params props
|
|
30
35
|
*/
|
|
31
|
-
export const TableDashboard = ({
|
|
36
|
+
export const TableDashboard = ({
|
|
37
|
+
resources,
|
|
38
|
+
viewConfigQuery,
|
|
39
|
+
selectedDocument,
|
|
40
|
+
setSelectedDocument,
|
|
41
|
+
}: TableProps) => {
|
|
32
42
|
const [value, setValue] = useState(resources[0]?.name);
|
|
33
43
|
const [pageSize, setPageSize] = useState(5); // better if this is global to not reset when switching tables
|
|
34
44
|
|
|
@@ -67,6 +77,8 @@ export const TableDashboard = ({ resources, viewConfigQuery }: TableProps) => {
|
|
|
67
77
|
resource={resource}
|
|
68
78
|
pageSize={pageSize}
|
|
69
79
|
setPageSize={setPageSize}
|
|
80
|
+
selectedDocument={selectedDocument}
|
|
81
|
+
setSelectedDocument={setSelectedDocument}
|
|
70
82
|
/>
|
|
71
83
|
{/* CHILD TABLE */}
|
|
72
84
|
{resource.children?.length ? (
|