@evenicanpm/portal-table-ui 1.6.0 → 1.8.0
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 +4 -4
- package/src/auth/auth-context.tsx +15 -9
- package/src/features/table/components/dashboard/table/bulk-action-button.tsx +76 -0
- package/src/features/table/components/dashboard/table/data-mask-map.ts +1 -1
- package/src/features/table/components/dashboard/table/details/details.tsx +63 -35
- package/src/features/table/components/dashboard/table/details/rows/downloads.tsx +0 -1
- package/src/features/table/components/dashboard/table/details/rows/primitive.tsx +0 -1
- package/src/features/table/components/dashboard/table/details/rows/table.tsx +0 -1
- package/src/features/table/components/dashboard/table/details/templates/invoice-details.tsx +440 -0
- package/src/features/table/components/dashboard/table/details/templates/template-registry.ts +39 -0
- package/src/features/table/components/dashboard/table/filter-render-map.tsx +2 -1
- package/src/features/table/components/dashboard/table/filters/date-filter.tsx +5 -5
- package/src/features/table/components/dashboard/table/filters/status-filter.tsx +2 -2
- package/src/features/table/components/dashboard/table/no-results.tsx +1 -1
- package/src/features/table/components/dashboard/table/table-header.tsx +41 -5
- package/src/features/table/components/dashboard/table/table-row/action-button.tsx +32 -24
- package/src/features/table/components/dashboard/table/table-row/table-row.tsx +60 -13
- package/src/features/table/components/dashboard/table/table-row-skeleton.tsx +0 -1
- package/src/features/table/components/dashboard/table/table.tsx +143 -30
- package/src/features/table/components/dashboard/table/use-select-rows.ts +53 -0
- package/src/features/table/components/dashboard/table-dashboard.tsx +2 -2
- package/src/features/table/logic/resolvers.ts +43 -0
- package/src/features/table/types/schemas.ts +39 -0
- package/src/index.ts +1 -2
- package/dist/auth/auth-context.d.ts +0 -36
- package/dist/features/settings/index.d.ts +0 -2
- package/dist/features/table/components/dashboard/index.d.ts +0 -1
- package/dist/features/table/components/dashboard/table/actions.d.ts +0 -14
- package/dist/features/table/components/dashboard/table/data-mask-map.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/details/details.d.ts +0 -27
- package/dist/features/table/components/dashboard/table/details/index.d.ts +0 -1
- package/dist/features/table/components/dashboard/table/details/label.d.ts +0 -5
- package/dist/features/table/components/dashboard/table/details/rows/downloads.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/details/rows/index.d.ts +0 -3
- package/dist/features/table/components/dashboard/table/details/rows/primitive.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/details/rows/table.d.ts +0 -17
- package/dist/features/table/components/dashboard/table/details/styles.d.ts +0 -10
- package/dist/features/table/components/dashboard/table/filter-render-map.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/filters/date-filter.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/filters/status-filter.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/index.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/no-results.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/status-pill.d.ts +0 -8
- package/dist/features/table/components/dashboard/table/table-header.d.ts +0 -16
- package/dist/features/table/components/dashboard/table/table-input.d.ts +0 -11
- package/dist/features/table/components/dashboard/table/table-row/action-button.d.ts +0 -8
- package/dist/features/table/components/dashboard/table/table-row/table-row.d.ts +0 -32
- package/dist/features/table/components/dashboard/table/table-row-skeleton.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/table.d.ts +0 -18
- package/dist/features/table/components/dashboard/table-dashboard.d.ts +0 -22
- package/dist/features/table/index.d.ts +0 -8
- package/dist/features/table/logic/index.d.ts +0 -23
- package/dist/features/table/logic/resolvers.d.ts +0 -21
- package/dist/features/table/logic/transformers.d.ts +0 -35
- package/dist/features/table/logic/types.d.ts +0 -8
- package/dist/features/table/types/handlers.d.ts +0 -53
- package/dist/features/table/types/index.d.ts +0 -69
- package/dist/features/table/types/queries.d.ts +0 -27
- package/dist/features/table/types/schemas.d.ts +0 -31
- package/dist/index.d.ts +0 -63
- package/dist/portal.d.ts +0 -38
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/features/table/components/dashboard/table/actions.ts +0 -59
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
|
|
2
|
-
import { UseMutationOptions, mutationOptions } from "@tanstack/react-query";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Map of action types -> MUI Icons
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export const actionIconMap: Record<string, typeof FileDownloadOutlinedIcon> = {
|
|
10
|
-
download: FileDownloadOutlinedIcon,
|
|
11
|
-
archive: FileDownloadOutlinedIcon,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Don't like this type but required for map below.
|
|
15
|
-
type MutationFactory = (
|
|
16
|
-
resourceName: string,
|
|
17
|
-
docId: string,
|
|
18
|
-
) => UseMutationOptions<any, any, any, any>;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export const actionMutationMap: Record<string, MutationFactory> = {
|
|
24
|
-
download: (resourceName: string, docId: string) =>
|
|
25
|
-
mutationOptions({
|
|
26
|
-
mutationKey: [resourceName, "download", docId],
|
|
27
|
-
mutationFn: async (input: { docId: number }) => {
|
|
28
|
-
const res = await fetch(
|
|
29
|
-
`/api/resource/${resourceName}/download?docId=${encodeURIComponent(String(input.docId))}`,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
if (!res.ok) {
|
|
33
|
-
const text = await res.text().catch(() => "");
|
|
34
|
-
throw new Error(text || `Download failed (${res.status})`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const blob = await res.blob();
|
|
38
|
-
|
|
39
|
-
const disposition = res.headers.get("content-disposition") || "";
|
|
40
|
-
const match = /filename\*?=(?:UTF-8'')?["']?([^"';]+)["']?/i.exec(
|
|
41
|
-
disposition,
|
|
42
|
-
);
|
|
43
|
-
const filename = match
|
|
44
|
-
? decodeURIComponent(match[1])
|
|
45
|
-
: `${resourceName}-${input.docId}.pdf`;
|
|
46
|
-
|
|
47
|
-
const href = URL.createObjectURL(blob);
|
|
48
|
-
const a = document.createElement("a");
|
|
49
|
-
a.href = href;
|
|
50
|
-
a.download = filename;
|
|
51
|
-
document.body.appendChild(a);
|
|
52
|
-
a.click();
|
|
53
|
-
a.remove();
|
|
54
|
-
URL.revokeObjectURL(href);
|
|
55
|
-
|
|
56
|
-
return true;
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
};
|