wcz-test 6.24.1 → 6.24.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/dist/ApprovalStatus-BtAVFn5p.js +8 -0
- package/dist/ApprovalStatus-BtAVFn5p.js.map +1 -0
- package/dist/{node_modules/react/cjs/react-jsx-runtime.development.js → DialogsContext-BKtkEAfL.js} +48 -4
- package/dist/DialogsContext-BKtkEAfL.js.map +1 -0
- package/dist/{hooks/DialogsHooks.js → DialogsHooks-BQVpqCq9.js} +4 -7
- package/dist/DialogsHooks-BQVpqCq9.js.map +1 -0
- package/dist/FileHooks-Cg9ver7z.js +3478 -0
- package/dist/FileHooks-Cg9ver7z.js.map +1 -0
- package/dist/{models/file/FileMeta.js → FileMeta-G1oT3mYK.js} +2 -2
- package/dist/FileMeta-G1oT3mYK.js.map +1 -0
- package/dist/{components/router/RouterListItemButton.js → RouterListItemButton-IUVgwnz3.js} +4 -4
- package/dist/RouterListItemButton-IUVgwnz3.js.map +1 -0
- package/dist/client.js +4 -4
- package/dist/compiler-runtime-BGHur82y.js +46 -0
- package/dist/compiler-runtime-BGHur82y.js.map +1 -0
- package/dist/components.js +1486 -15
- package/dist/components.js.map +1 -1
- package/dist/{env.js → env-gsqZ6zZD.js} +3 -3
- package/dist/env-gsqZ6zZD.js.map +1 -0
- package/dist/exports/client.d.ts +17 -4
- package/dist/exports/components.d.ts +44 -14
- package/dist/exports/hooks.d.ts +23 -4
- package/dist/exports/index.d.ts +17 -4
- package/dist/exports/models.d.ts +107 -25
- package/dist/exports/queries.d.ts +95 -4
- package/dist/exports/server.d.ts +14 -4
- package/dist/exports/utils.d.ts +11 -3
- package/dist/exports/vite.d.ts +5 -1
- package/dist/hooks.js +1000 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +1752 -4
- package/dist/index.js.map +1 -1
- package/dist/models.js +159 -10
- package/dist/models.js.map +1 -1
- package/dist/queries.js +935 -14
- package/dist/queries.js.map +1 -1
- package/dist/{lib/queryClient.js → queryClient-CNvC95mU.js} +2 -2
- package/dist/queryClient-CNvC95mU.js.map +1 -0
- package/dist/server.js +84 -1
- package/dist/server.js.map +1 -1
- package/dist/{lib/auth/session.js → session-vW7WZadj.js} +23 -8
- package/dist/session-vW7WZadj.js.map +1 -0
- package/dist/{lib/utils.js → utils-MD9YwOtu.js} +9 -9
- package/dist/utils-MD9YwOtu.js.map +1 -0
- package/dist/utils.js +2 -2
- package/dist/vite.js +61 -1
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/_virtual/compiler-runtime.js +0 -6
- package/dist/_virtual/compiler-runtime.js.map +0 -1
- package/dist/_virtual/compiler-runtime2.js +0 -5
- package/dist/_virtual/compiler-runtime2.js.map +0 -1
- package/dist/_virtual/jsx-runtime.js +0 -6
- package/dist/_virtual/jsx-runtime.js.map +0 -1
- package/dist/_virtual/jsx-runtime2.js +0 -5
- package/dist/_virtual/jsx-runtime2.js.map +0 -1
- package/dist/_virtual/react-compiler-runtime.development.js +0 -5
- package/dist/_virtual/react-compiler-runtime.development.js.map +0 -1
- package/dist/_virtual/react-compiler-runtime.production.js +0 -5
- package/dist/_virtual/react-compiler-runtime.production.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.development.js +0 -5
- package/dist/_virtual/react-jsx-runtime.development.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.production.js +0 -5
- package/dist/_virtual/react-jsx-runtime.production.js.map +0 -1
- package/dist/components/core/AppTitle.d.ts +0 -2
- package/dist/components/core/AppTitle.js +0 -23
- package/dist/components/core/AppTitle.js.map +0 -1
- package/dist/components/core/Fullscreen.d.ts +0 -3
- package/dist/components/core/Fullscreen.js +0 -104
- package/dist/components/core/Fullscreen.js.map +0 -1
- package/dist/components/core/Layout.d.ts +0 -8
- package/dist/components/core/Layout.js +0 -214
- package/dist/components/core/Layout.js.map +0 -1
- package/dist/components/core/ToolbarAccount.d.ts +0 -2
- package/dist/components/core/ToolbarAccount.js +0 -582
- package/dist/components/core/ToolbarAccount.js.map +0 -1
- package/dist/components/core/TypographyWithIcon.d.ts +0 -7
- package/dist/components/core/TypographyWithIcon.js +0 -117
- package/dist/components/core/TypographyWithIcon.js.map +0 -1
- package/dist/components/core/navigation/NavigationList.d.ts +0 -22
- package/dist/components/core/navigation/NavigationList.js +0 -166
- package/dist/components/core/navigation/NavigationList.js.map +0 -1
- package/dist/components/core/navigation/NavigationListItem.d.ts +0 -16
- package/dist/components/core/navigation/NavigationListItem.js +0 -467
- package/dist/components/core/navigation/NavigationListItem.js.map +0 -1
- package/dist/components/core/navigation/NavigationRail.d.ts +0 -12
- package/dist/components/core/navigation/NavigationRail.js +0 -141
- package/dist/components/core/navigation/NavigationRail.js.map +0 -1
- package/dist/components/data-grid/ChipInputCell.d.ts +0 -9
- package/dist/components/data-grid/ChipInputCell.js +0 -95
- package/dist/components/data-grid/ChipInputCell.js.map +0 -1
- package/dist/components/data-grid/EditableColumnHeader.d.ts +0 -2
- package/dist/components/data-grid/EditableColumnHeader.js +0 -30
- package/dist/components/data-grid/EditableColumnHeader.js.map +0 -1
- package/dist/components/file/Dropzone.d.ts +0 -8
- package/dist/components/file/Dropzone.js +0 -151
- package/dist/components/file/Dropzone.js.map +0 -1
- package/dist/components/file/FileViewer.d.ts +0 -20
- package/dist/components/file/FileViewer.js +0 -127
- package/dist/components/file/FileViewer.js.map +0 -1
- package/dist/components/file/fileViewer/FileViewerGrid.d.ts +0 -17
- package/dist/components/file/fileViewer/FileViewerGrid.js +0 -282
- package/dist/components/file/fileViewer/FileViewerGrid.js.map +0 -1
- package/dist/components/file/fileViewer/FileViewerList.d.ts +0 -12
- package/dist/components/file/fileViewer/FileViewerList.js +0 -191
- package/dist/components/file/fileViewer/FileViewerList.js.map +0 -1
- package/dist/components/file/fileViewer/ImageViewer.d.ts +0 -6
- package/dist/components/file/fileViewer/ImageViewer.js +0 -75
- package/dist/components/file/fileViewer/ImageViewer.js.map +0 -1
- package/dist/components/file/fileViewer/common/ActionsMenu.d.ts +0 -15
- package/dist/components/file/fileViewer/common/ActionsMenu.js +0 -159
- package/dist/components/file/fileViewer/common/ActionsMenu.js.map +0 -1
- package/dist/components/form/FormAutocomplete.d.ts +0 -7
- package/dist/components/form/FormAutocomplete.js +0 -80
- package/dist/components/form/FormAutocomplete.js.map +0 -1
- package/dist/components/form/FormCheckbox.d.ts +0 -7
- package/dist/components/form/FormCheckbox.js +0 -81
- package/dist/components/form/FormCheckbox.js.map +0 -1
- package/dist/components/form/FormDatePicker.d.ts +0 -8
- package/dist/components/form/FormDatePicker.js +0 -77
- package/dist/components/form/FormDatePicker.js.map +0 -1
- package/dist/components/form/FormDateRangePicker.d.ts +0 -8
- package/dist/components/form/FormDateRangePicker.js +0 -77
- package/dist/components/form/FormDateRangePicker.js.map +0 -1
- package/dist/components/form/FormDateTimePicker.d.ts +0 -8
- package/dist/components/form/FormDateTimePicker.js +0 -77
- package/dist/components/form/FormDateTimePicker.js.map +0 -1
- package/dist/components/form/FormDateTimeRangePicker.d.ts +0 -8
- package/dist/components/form/FormDateTimeRangePicker.js +0 -77
- package/dist/components/form/FormDateTimeRangePicker.js.map +0 -1
- package/dist/components/form/FormNumberField.d.ts +0 -9
- package/dist/components/form/FormNumberField.js +0 -73
- package/dist/components/form/FormNumberField.js.map +0 -1
- package/dist/components/form/FormRadioGroup.d.ts +0 -13
- package/dist/components/form/FormRadioGroup.js +0 -113
- package/dist/components/form/FormRadioGroup.js.map +0 -1
- package/dist/components/form/FormSlider.d.ts +0 -7
- package/dist/components/form/FormSlider.js +0 -94
- package/dist/components/form/FormSlider.js.map +0 -1
- package/dist/components/form/FormSubmitButton.d.ts +0 -4
- package/dist/components/form/FormSubmitButton.js +0 -50
- package/dist/components/form/FormSubmitButton.js.map +0 -1
- package/dist/components/form/FormSwitch.d.ts +0 -7
- package/dist/components/form/FormSwitch.js +0 -81
- package/dist/components/form/FormSwitch.js.map +0 -1
- package/dist/components/form/FormTextField.d.ts +0 -7
- package/dist/components/form/FormTextField.js +0 -52
- package/dist/components/form/FormTextField.js.map +0 -1
- package/dist/components/form/FormTimePicker.d.ts +0 -8
- package/dist/components/form/FormTimePicker.js +0 -77
- package/dist/components/form/FormTimePicker.js.map +0 -1
- package/dist/components/form/FormTimeRangePicker.d.ts +0 -8
- package/dist/components/form/FormTimeRangePicker.js +0 -77
- package/dist/components/form/FormTimeRangePicker.js.map +0 -1
- package/dist/components/router/RouterButton.d.ts +0 -6
- package/dist/components/router/RouterButton.js +0 -35
- package/dist/components/router/RouterButton.js.map +0 -1
- package/dist/components/router/RouterError.d.ts +0 -7
- package/dist/components/router/RouterError.js +0 -62
- package/dist/components/router/RouterError.js.map +0 -1
- package/dist/components/router/RouterGridActionsCellItem.d.ts +0 -6
- package/dist/components/router/RouterGridActionsCellItem.js +0 -35
- package/dist/components/router/RouterGridActionsCellItem.js.map +0 -1
- package/dist/components/router/RouterIconButton.d.ts +0 -6
- package/dist/components/router/RouterIconButton.js +0 -35
- package/dist/components/router/RouterIconButton.js.map +0 -1
- package/dist/components/router/RouterLink.d.ts +0 -6
- package/dist/components/router/RouterLink.js +0 -35
- package/dist/components/router/RouterLink.js.map +0 -1
- package/dist/components/router/RouterListItemButton.d.ts +0 -6
- package/dist/components/router/RouterListItemButton.js.map +0 -1
- package/dist/components/router/RouterNotFound.d.ts +0 -1
- package/dist/components/router/RouterNotFound.js +0 -53
- package/dist/components/router/RouterNotFound.js.map +0 -1
- package/dist/components/router/RouterTab.d.ts +0 -6
- package/dist/components/router/RouterTab.js +0 -35
- package/dist/components/router/RouterTab.js.map +0 -1
- package/dist/contexts/DialogsContext.d.ts +0 -6
- package/dist/contexts/DialogsContext.js +0 -6
- package/dist/contexts/DialogsContext.js.map +0 -1
- package/dist/contexts/FileContext.d.ts +0 -13
- package/dist/contexts/FileContext.js +0 -14
- package/dist/contexts/FileContext.js.map +0 -1
- package/dist/env.d.ts +0 -13
- package/dist/env.js.map +0 -1
- package/dist/hooks/DialogsHooks.d.ts +0 -42
- package/dist/hooks/DialogsHooks.js.map +0 -1
- package/dist/hooks/FormHooks.d.ts +0 -52
- package/dist/hooks/FormHooks.js +0 -55
- package/dist/hooks/FormHooks.js.map +0 -1
- package/dist/lib/auth/api.d.ts +0 -3
- package/dist/lib/auth/api.js +0 -91
- package/dist/lib/auth/api.js.map +0 -1
- package/dist/lib/auth/entra.d.ts +0 -2
- package/dist/lib/auth/entra.js +0 -7
- package/dist/lib/auth/entra.js.map +0 -1
- package/dist/lib/auth/graph.d.ts +0 -17
- package/dist/lib/auth/graph.js +0 -72
- package/dist/lib/auth/graph.js.map +0 -1
- package/dist/lib/auth/session.d.ts +0 -24
- package/dist/lib/auth/session.js.map +0 -1
- package/dist/lib/queryClient.d.ts +0 -2
- package/dist/lib/queryClient.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -52
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/vite-plugin.d.ts +0 -2
- package/dist/lib/vite-plugin.js +0 -65
- package/dist/lib/vite-plugin.js.map +0 -1
- package/dist/middleware/auth.d.ts +0 -22
- package/dist/models/Navigation.d.ts +0 -18
- package/dist/models/User.d.ts +0 -16
- package/dist/models/User.js +0 -18
- package/dist/models/User.js.map +0 -1
- package/dist/models/approval/Approval.d.ts +0 -177
- package/dist/models/approval/Approval.js +0 -81
- package/dist/models/approval/Approval.js.map +0 -1
- package/dist/models/approval/ApprovalEmployee.d.ts +0 -7
- package/dist/models/approval/ApprovalEmployee.js +0 -10
- package/dist/models/approval/ApprovalEmployee.js.map +0 -1
- package/dist/models/approval/ApprovalFlow.d.ts +0 -49
- package/dist/models/approval/ApprovalFlow.js +0 -15
- package/dist/models/approval/ApprovalFlow.js.map +0 -1
- package/dist/models/approval/ApprovalFlowStep.d.ts +0 -29
- package/dist/models/approval/ApprovalFlowStep.js +0 -17
- package/dist/models/approval/ApprovalFlowStep.js.map +0 -1
- package/dist/models/approval/ApprovalRequestType.d.ts +0 -5
- package/dist/models/approval/ApprovalRequestType.js +0 -6
- package/dist/models/approval/ApprovalRequestType.js.map +0 -1
- package/dist/models/approval/ApprovalStatus.d.ts +0 -9
- package/dist/models/approval/ApprovalStatus.js +0 -6
- package/dist/models/approval/ApprovalStatus.js.map +0 -1
- package/dist/models/approval/ApprovalStepResult.d.ts +0 -11
- package/dist/models/approval/ApprovalStepResult.js +0 -6
- package/dist/models/approval/ApprovalStepResult.js.map +0 -1
- package/dist/models/approval/StepApprovalOrder.d.ts +0 -6
- package/dist/models/approval/StepApprovalOrder.js +0 -6
- package/dist/models/approval/StepApprovalOrder.js.map +0 -1
- package/dist/models/email/Email.d.ts +0 -13
- package/dist/models/email/Email.js +0 -14
- package/dist/models/email/Email.js.map +0 -1
- package/dist/models/email/EmailAttachment.d.ts +0 -6
- package/dist/models/email/EmailAttachment.js +0 -9
- package/dist/models/email/EmailAttachment.js.map +0 -1
- package/dist/models/file/FileActions.d.ts +0 -6
- package/dist/models/file/FileMeta.d.ts +0 -15
- package/dist/models/file/FileMeta.js.map +0 -1
- package/dist/models/peoplesoft/Department.d.ts +0 -58
- package/dist/models/peoplesoft/Department.js +0 -19
- package/dist/models/peoplesoft/Department.js.map +0 -1
- package/dist/models/peoplesoft/Employee.d.ts +0 -46
- package/dist/models/peoplesoft/Employee.js +0 -43
- package/dist/models/peoplesoft/Employee.js.map +0 -1
- package/dist/models/peoplesoft/EmployeeCategoryGroup.d.ts +0 -6
- package/dist/models/peoplesoft/EmployeeCategoryGroup.js +0 -6
- package/dist/models/peoplesoft/EmployeeCategoryGroup.js.map +0 -1
- package/dist/models/peoplesoft/EmployeeStatus.d.ts +0 -6
- package/dist/models/peoplesoft/EmployeeStatus.js +0 -6
- package/dist/models/peoplesoft/EmployeeStatus.js.map +0 -1
- package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +0 -22
- package/dist/node_modules/react/cjs/react-compiler-runtime.development.js.map +0 -1
- package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +0 -16
- package/dist/node_modules/react/cjs/react-compiler-runtime.production.js.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -33
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +0 -1
- package/dist/node_modules/react/compiler-runtime.js +0 -18
- package/dist/node_modules/react/compiler-runtime.js.map +0 -1
- package/dist/node_modules/react/jsx-runtime.js +0 -18
- package/dist/node_modules/react/jsx-runtime.js.map +0 -1
- package/dist/providers/DialogsProvider.d.ts +0 -5
- package/dist/providers/DialogsProvider.js +0 -79
- package/dist/providers/DialogsProvider.js.map +0 -1
- package/dist/providers/LayoutProvider.d.ts +0 -11
- package/dist/providers/LayoutProvider.js +0 -94
- package/dist/providers/LayoutProvider.js.map +0 -1
- package/dist/queries/ApprovalHooks.d.ts +0 -338
- package/dist/queries/ApprovalHooks.js +0 -326
- package/dist/queries/ApprovalHooks.js.map +0 -1
- package/dist/queries/FileHooks.d.ts +0 -151
- package/dist/queries/FileHooks.js +0 -493
- package/dist/queries/FileHooks.js.map +0 -1
- package/dist/queries/PeopleSoftHooks.d.ts +0 -537
- package/dist/queries/PeopleSoftHooks.js +0 -628
- package/dist/queries/PeopleSoftHooks.js.map +0 -1
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { c as compilerRuntimeExports } from "../../../_virtual/compiler-runtime.js";
|
|
3
|
-
import MoreVert from "@mui/icons-material/MoreVert";
|
|
4
|
-
import { Stack, ImageListItemBar, IconButton, Tooltip, Box, ImageListItem } from "@mui/material";
|
|
5
|
-
import { grey } from "@mui/material/colors";
|
|
6
|
-
import { useState, useEffect, Fragment } from "react";
|
|
7
|
-
import { useInView } from "react-intersection-observer";
|
|
8
|
-
import { ActionsMenu } from "./common/ActionsMenu.js";
|
|
9
|
-
import { useFile } from "../../../contexts/FileContext.js";
|
|
10
|
-
import { useGetFileThumbnail, useOpenFile, useDownloadFile } from "../../../queries/FileHooks.js";
|
|
11
|
-
const IMAGE_SIZE = 150;
|
|
12
|
-
const FileViewerGrid = (t0) => {
|
|
13
|
-
const $ = compilerRuntimeExports.c(12);
|
|
14
|
-
const {
|
|
15
|
-
sx,
|
|
16
|
-
size,
|
|
17
|
-
itemBar
|
|
18
|
-
} = t0;
|
|
19
|
-
const {
|
|
20
|
-
fileMetas
|
|
21
|
-
} = useFile();
|
|
22
|
-
let t1;
|
|
23
|
-
if ($[0] !== sx) {
|
|
24
|
-
t1 = {
|
|
25
|
-
overflow: "auto",
|
|
26
|
-
...sx
|
|
27
|
-
};
|
|
28
|
-
$[0] = sx;
|
|
29
|
-
$[1] = t1;
|
|
30
|
-
} else {
|
|
31
|
-
t1 = $[1];
|
|
32
|
-
}
|
|
33
|
-
let t2;
|
|
34
|
-
if ($[2] !== fileMetas || $[3] !== itemBar || $[4] !== size) {
|
|
35
|
-
let t32;
|
|
36
|
-
if ($[6] !== itemBar || $[7] !== size) {
|
|
37
|
-
t32 = (fileMeta) => /* @__PURE__ */ jsxRuntimeExports.jsx(GridFileViewerItem, { meta: fileMeta, size, itemBar }, fileMeta.id);
|
|
38
|
-
$[6] = itemBar;
|
|
39
|
-
$[7] = size;
|
|
40
|
-
$[8] = t32;
|
|
41
|
-
} else {
|
|
42
|
-
t32 = $[8];
|
|
43
|
-
}
|
|
44
|
-
t2 = fileMetas.map(t32);
|
|
45
|
-
$[2] = fileMetas;
|
|
46
|
-
$[3] = itemBar;
|
|
47
|
-
$[4] = size;
|
|
48
|
-
$[5] = t2;
|
|
49
|
-
} else {
|
|
50
|
-
t2 = $[5];
|
|
51
|
-
}
|
|
52
|
-
let t3;
|
|
53
|
-
if ($[9] !== t1 || $[10] !== t2) {
|
|
54
|
-
t3 = /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { direction: "row", spacing: 1, sx: t1, children: t2 });
|
|
55
|
-
$[9] = t1;
|
|
56
|
-
$[10] = t2;
|
|
57
|
-
$[11] = t3;
|
|
58
|
-
} else {
|
|
59
|
-
t3 = $[11];
|
|
60
|
-
}
|
|
61
|
-
return t3;
|
|
62
|
-
};
|
|
63
|
-
const GridFileViewerItem = (t0) => {
|
|
64
|
-
const $ = compilerRuntimeExports.c(47);
|
|
65
|
-
const {
|
|
66
|
-
meta,
|
|
67
|
-
size,
|
|
68
|
-
itemBar
|
|
69
|
-
} = t0;
|
|
70
|
-
const {
|
|
71
|
-
setImageId,
|
|
72
|
-
actions
|
|
73
|
-
} = useFile();
|
|
74
|
-
const [showItemBar, setShowItemBar] = useState(itemBar === "always");
|
|
75
|
-
const [menu, setMenu] = useState(null);
|
|
76
|
-
const {
|
|
77
|
-
ref,
|
|
78
|
-
inView
|
|
79
|
-
} = useInView();
|
|
80
|
-
let t1;
|
|
81
|
-
let t2;
|
|
82
|
-
if ($[0] !== itemBar) {
|
|
83
|
-
t1 = () => {
|
|
84
|
-
setShowItemBar(itemBar === "always");
|
|
85
|
-
};
|
|
86
|
-
t2 = [itemBar];
|
|
87
|
-
$[0] = itemBar;
|
|
88
|
-
$[1] = t1;
|
|
89
|
-
$[2] = t2;
|
|
90
|
-
} else {
|
|
91
|
-
t1 = $[1];
|
|
92
|
-
t2 = $[2];
|
|
93
|
-
}
|
|
94
|
-
useEffect(t1, t2);
|
|
95
|
-
let t3;
|
|
96
|
-
if ($[3] !== meta) {
|
|
97
|
-
t3 = {
|
|
98
|
-
meta
|
|
99
|
-
};
|
|
100
|
-
$[3] = meta;
|
|
101
|
-
$[4] = t3;
|
|
102
|
-
} else {
|
|
103
|
-
t3 = $[4];
|
|
104
|
-
}
|
|
105
|
-
let t4;
|
|
106
|
-
if ($[5] !== inView) {
|
|
107
|
-
t4 = {
|
|
108
|
-
enabled: inView
|
|
109
|
-
};
|
|
110
|
-
$[5] = inView;
|
|
111
|
-
$[6] = t4;
|
|
112
|
-
} else {
|
|
113
|
-
t4 = $[6];
|
|
114
|
-
}
|
|
115
|
-
const {
|
|
116
|
-
data: source
|
|
117
|
-
} = useGetFileThumbnail(t3, t4);
|
|
118
|
-
let t5;
|
|
119
|
-
if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
120
|
-
t5 = () => setShowItemBar(true);
|
|
121
|
-
$[7] = t5;
|
|
122
|
-
} else {
|
|
123
|
-
t5 = $[7];
|
|
124
|
-
}
|
|
125
|
-
const handleOnMouseEnter = t5;
|
|
126
|
-
let t6;
|
|
127
|
-
if ($[8] !== itemBar) {
|
|
128
|
-
t6 = () => itemBar !== "always" && setShowItemBar(false);
|
|
129
|
-
$[8] = itemBar;
|
|
130
|
-
$[9] = t6;
|
|
131
|
-
} else {
|
|
132
|
-
t6 = $[9];
|
|
133
|
-
}
|
|
134
|
-
const handleOnMouseLeave = t6;
|
|
135
|
-
let t7;
|
|
136
|
-
if ($[10] !== menu) {
|
|
137
|
-
t7 = (event) => {
|
|
138
|
-
setMenu(menu === null ? {
|
|
139
|
-
mouseX: event.clientX,
|
|
140
|
-
mouseY: event.clientY
|
|
141
|
-
} : null);
|
|
142
|
-
setTimeout(() => setShowItemBar(true));
|
|
143
|
-
};
|
|
144
|
-
$[10] = menu;
|
|
145
|
-
$[11] = t7;
|
|
146
|
-
} else {
|
|
147
|
-
t7 = $[11];
|
|
148
|
-
}
|
|
149
|
-
const openMenu = t7;
|
|
150
|
-
const {
|
|
151
|
-
mutate: openFile
|
|
152
|
-
} = useOpenFile();
|
|
153
|
-
const {
|
|
154
|
-
mutate: download
|
|
155
|
-
} = useDownloadFile();
|
|
156
|
-
let t8;
|
|
157
|
-
if ($[12] !== download || $[13] !== meta || $[14] !== openFile || $[15] !== setImageId) {
|
|
158
|
-
t8 = () => {
|
|
159
|
-
switch (meta.mediaType) {
|
|
160
|
-
case "image": {
|
|
161
|
-
return setImageId(meta.id);
|
|
162
|
-
}
|
|
163
|
-
case "application": {
|
|
164
|
-
return openFile(meta);
|
|
165
|
-
}
|
|
166
|
-
case "video": {
|
|
167
|
-
return openFile(meta);
|
|
168
|
-
}
|
|
169
|
-
default: {
|
|
170
|
-
return download(meta);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
$[12] = download;
|
|
175
|
-
$[13] = meta;
|
|
176
|
-
$[14] = openFile;
|
|
177
|
-
$[15] = setImageId;
|
|
178
|
-
$[16] = t8;
|
|
179
|
-
} else {
|
|
180
|
-
t8 = $[16];
|
|
181
|
-
}
|
|
182
|
-
const onClick = t8;
|
|
183
|
-
const t9 = size ?? IMAGE_SIZE;
|
|
184
|
-
const t10 = size ?? IMAGE_SIZE;
|
|
185
|
-
let t11;
|
|
186
|
-
if ($[17] !== t10 || $[18] !== t9) {
|
|
187
|
-
t11 = {
|
|
188
|
-
width: t9,
|
|
189
|
-
height: t10
|
|
190
|
-
};
|
|
191
|
-
$[17] = t10;
|
|
192
|
-
$[18] = t9;
|
|
193
|
-
$[19] = t11;
|
|
194
|
-
} else {
|
|
195
|
-
t11 = $[19];
|
|
196
|
-
}
|
|
197
|
-
const t12 = "thumbnail-" + meta.id;
|
|
198
|
-
const t13 = size ?? IMAGE_SIZE;
|
|
199
|
-
const t14 = size ?? IMAGE_SIZE;
|
|
200
|
-
let t15;
|
|
201
|
-
if ($[20] !== t13 || $[21] !== t14) {
|
|
202
|
-
t15 = {
|
|
203
|
-
cursor: "pointer",
|
|
204
|
-
objectFit: "contain",
|
|
205
|
-
width: t13,
|
|
206
|
-
height: t14
|
|
207
|
-
};
|
|
208
|
-
$[20] = t13;
|
|
209
|
-
$[21] = t14;
|
|
210
|
-
$[22] = t15;
|
|
211
|
-
} else {
|
|
212
|
-
t15 = $[22];
|
|
213
|
-
}
|
|
214
|
-
let t16;
|
|
215
|
-
if ($[23] !== onClick || $[24] !== source || $[25] !== t12 || $[26] !== t15) {
|
|
216
|
-
t16 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { component: "img", src: source, loading: "lazy", alt: t12, onClick, sx: t15 });
|
|
217
|
-
$[23] = onClick;
|
|
218
|
-
$[24] = source;
|
|
219
|
-
$[25] = t12;
|
|
220
|
-
$[26] = t15;
|
|
221
|
-
$[27] = t16;
|
|
222
|
-
} else {
|
|
223
|
-
t16 = $[27];
|
|
224
|
-
}
|
|
225
|
-
let t17;
|
|
226
|
-
if ($[28] !== actions || $[29] !== itemBar || $[30] !== meta.fileName || $[31] !== openMenu || $[32] !== showItemBar) {
|
|
227
|
-
t17 = itemBar !== "hidden" && showItemBar && /* @__PURE__ */ jsxRuntimeExports.jsx(ImageListItemBar, { title: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: meta.fileName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { children: meta.fileName }) }), actionIcon: (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { sx: {
|
|
228
|
-
color: grey[100]
|
|
229
|
-
}, onClick: openMenu, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreVert, {}) }) });
|
|
230
|
-
$[28] = actions;
|
|
231
|
-
$[29] = itemBar;
|
|
232
|
-
$[30] = meta.fileName;
|
|
233
|
-
$[31] = openMenu;
|
|
234
|
-
$[32] = showItemBar;
|
|
235
|
-
$[33] = t17;
|
|
236
|
-
} else {
|
|
237
|
-
t17 = $[33];
|
|
238
|
-
}
|
|
239
|
-
let t18;
|
|
240
|
-
if ($[34] !== handleOnMouseLeave || $[35] !== ref || $[36] !== t11 || $[37] !== t16 || $[38] !== t17) {
|
|
241
|
-
t18 = /* @__PURE__ */ jsxRuntimeExports.jsxs(ImageListItem, { sx: t11, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, ref, children: [
|
|
242
|
-
t16,
|
|
243
|
-
t17
|
|
244
|
-
] });
|
|
245
|
-
$[34] = handleOnMouseLeave;
|
|
246
|
-
$[35] = ref;
|
|
247
|
-
$[36] = t11;
|
|
248
|
-
$[37] = t16;
|
|
249
|
-
$[38] = t17;
|
|
250
|
-
$[39] = t18;
|
|
251
|
-
} else {
|
|
252
|
-
t18 = $[39];
|
|
253
|
-
}
|
|
254
|
-
let t19;
|
|
255
|
-
if ($[40] !== actions || $[41] !== menu || $[42] !== meta) {
|
|
256
|
-
t19 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsxRuntimeExports.jsx(ActionsMenu, { meta, menu, setMenu });
|
|
257
|
-
$[40] = actions;
|
|
258
|
-
$[41] = menu;
|
|
259
|
-
$[42] = meta;
|
|
260
|
-
$[43] = t19;
|
|
261
|
-
} else {
|
|
262
|
-
t19 = $[43];
|
|
263
|
-
}
|
|
264
|
-
let t20;
|
|
265
|
-
if ($[44] !== t18 || $[45] !== t19) {
|
|
266
|
-
t20 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
|
|
267
|
-
t18,
|
|
268
|
-
t19
|
|
269
|
-
] });
|
|
270
|
-
$[44] = t18;
|
|
271
|
-
$[45] = t19;
|
|
272
|
-
$[46] = t20;
|
|
273
|
-
} else {
|
|
274
|
-
t20 = $[46];
|
|
275
|
-
}
|
|
276
|
-
return t20;
|
|
277
|
-
};
|
|
278
|
-
export {
|
|
279
|
-
FileViewerGrid,
|
|
280
|
-
GridFileViewerItem
|
|
281
|
-
};
|
|
282
|
-
//# sourceMappingURL=FileViewerGrid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewerGrid.js","sources":["../../../../src/components/file/fileViewer/FileViewerGrid.tsx"],"sourcesContent":["import MoreVert from \"@mui/icons-material/MoreVert\";\nimport { Box, IconButton, ImageListItem, ImageListItemBar, Stack, Tooltip } from \"@mui/material\";\nimport { grey } from \"@mui/material/colors\";\nimport React, { Fragment, useEffect, useState } from \"react\";\nimport { useInView } from \"react-intersection-observer\";\nimport { ActionsMenu } from \"./common/ActionsMenu\";\nimport type { SxProps, Theme } from \"@mui/material\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { useFile } from \"~/contexts/FileContext\";\nimport { useDownloadFile, useGetFileThumbnail, useOpenFile } from \"~/queries/FileHooks\";\n\nconst IMAGE_SIZE = 150;\n\ntype FileViewerGridItemBar = \"hidden\" | \"always\" | \"onMouseEnter\";\n\nexport interface FileViewerGridProps {\n size?: number;\n itemBar?: FileViewerGridItemBar;\n sx?: SxProps<Theme>;\n}\n\nexport const FileViewerGrid: React.FC<FileViewerGridProps> = ({ sx, size, itemBar }) => {\n const { fileMetas } = useFile();\n\n return (\n <Stack direction=\"row\" spacing={1} sx={{ overflow: \"auto\", ...sx }}>\n {fileMetas.map(fileMeta => (\n <GridFileViewerItem\n key={fileMeta.id}\n meta={fileMeta}\n size={size}\n itemBar={itemBar}\n />\n ))}\n </Stack>\n );\n};\n\ninterface GridFileViewerItemProps {\n meta: FileMeta;\n size?: number;\n itemBar?: FileViewerGridItemBar;\n}\n\nexport const GridFileViewerItem: React.FC<GridFileViewerItemProps> = ({ meta, size, itemBar }) => {\n const { setImageId, actions } = useFile();\n const [showItemBar, setShowItemBar] = useState<boolean>(itemBar === \"always\");\n const [menu, setMenu] = useState<{ mouseX: number; mouseY: number; } | null>(null);\n const { ref, inView } = useInView();\n\n useEffect(() => {\n setShowItemBar(itemBar === \"always\");\n }, [itemBar]);\n\n const { data: source } = useGetFileThumbnail({ meta }, { enabled: inView });\n\n const handleOnMouseEnter = () => setShowItemBar(true);\n const handleOnMouseLeave = () => itemBar !== \"always\" && setShowItemBar(false);\n\n const openMenu = (event: React.MouseEvent) => {\n setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY, } : null);\n setTimeout(() => setShowItemBar(true));\n };\n\n const { mutate: openFile } = useOpenFile();\n const { mutate: download } = useDownloadFile();\n\n const onClick = () => {\n switch (meta.mediaType) {\n case \"image\": { return setImageId(meta.id); }\n case \"application\": { return openFile(meta); }\n case \"video\": { return openFile(meta); }\n default: { return download(meta); }\n }\n };\n\n return (\n <Fragment>\n <ImageListItem sx={{ width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }} onMouseEnter={handleOnMouseEnter} onMouseLeave={handleOnMouseLeave} ref={ref}>\n <Box\n component=\"img\"\n src={source}\n loading=\"lazy\"\n alt={\"thumbnail-\" + meta.id}\n onClick={onClick}\n sx={{ cursor: \"pointer\", objectFit: \"contain\", width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }}\n />\n {(itemBar !== \"hidden\" && showItemBar) &&\n <ImageListItemBar\n title={\n <Tooltip title={meta.fileName}>\n <Box>\n {meta.fileName}\n </Box>\n </Tooltip>\n }\n actionIcon={\n (actions?.download !== false || actions.delete !== false) &&\n <IconButton sx={{ color: grey[100] }} onClick={openMenu}>\n <MoreVert />\n </IconButton>\n }\n />\n }\n </ImageListItem>\n\n {(actions?.download !== false || actions.delete !== false) && <ActionsMenu meta={meta} menu={menu} setMenu={setMenu} />}\n </Fragment>\n );\n};\n"],"names":["IMAGE_SIZE","FileViewerGrid","t0","$","_c","sx","size","itemBar","fileMetas","useFile","t1","overflow","t2","t3","fileMeta","jsx","id","map","GridFileViewerItem","meta","setImageId","actions","showItemBar","setShowItemBar","useState","menu","setMenu","ref","inView","useInView","useEffect","t4","enabled","data","source","useGetFileThumbnail","t5","Symbol","for","handleOnMouseEnter","t6","handleOnMouseLeave","t7","event","mouseX","clientX","mouseY","clientY","setTimeout","openMenu","mutate","openFile","useOpenFile","download","useDownloadFile","t8","mediaType","onClick","t9","t10","t11","width","height","t12","t13","t14","t15","cursor","objectFit","t16","t17","fileName","delete","color","grey","t18","jsxs","t19","t20"],"mappings":";;;;;;;;;;AAWA,MAAMA,aAAa;AAUZ,MAAMC,iBAAgDC,CAAAA,OAAA;AAAA,QAAAC,IAAAC,uBAAAA,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL;AAC1D,QAAA;AAAA,IAAAM;AAAAA,EAAAA,IAAsBC,QAAAA;AAAU,MAAAC;AAAA,MAAAP,SAAAE,IAAA;AAGWK,SAAA;AAAA,MAAAC,UAAY;AAAA,MAAM,GAA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E;AAAAA,EAAA,OAAA;AAAAA,UAAA1E,EAAA,EAAA;AAAA,EAAA;AAAA,MAAA2E;AAAA,MAAA3E,EAAA,EAAA,MAAAwE,OAAAxE,UAAA0E,KAAA;AA7B3HC,iDAAC,UAAA,EACGH,UAAAA;AAAAA,MAAAA;AAAAA,MA4BCE;AAAAA,IAAAA,GACL;AAAW1E,YAAAwE;AAAAxE,YAAA0E;AAAA1E,YAAA2E;AAAAA,EAAA,OAAA;AAAAA,UAAA3E,EAAA,EAAA;AAAA,EAAA;AAAA,SA9BX2E;AA8BW;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { SxProps, Theme } from '@mui/material';
|
|
3
|
-
import { FileMeta } from '../../../models/file/FileMeta';
|
|
4
|
-
export interface FileViewerListProps {
|
|
5
|
-
sx?: SxProps<Theme>;
|
|
6
|
-
}
|
|
7
|
-
export declare const FileViewerList: FC<FileViewerListProps>;
|
|
8
|
-
interface ListFileViewerItemProps {
|
|
9
|
-
meta: FileMeta;
|
|
10
|
-
}
|
|
11
|
-
export declare const ListFileViewerItem: React.FC<ListFileViewerItemProps>;
|
|
12
|
-
export {};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { c as compilerRuntimeExports } from "../../../_virtual/compiler-runtime.js";
|
|
3
|
-
import AttachFile from "@mui/icons-material/AttachFile";
|
|
4
|
-
import Image from "@mui/icons-material/Image";
|
|
5
|
-
import MoreVert from "@mui/icons-material/MoreVert";
|
|
6
|
-
import SmartDisplay from "@mui/icons-material/SmartDisplay";
|
|
7
|
-
import { ListItemIcon, IconButton, ListItemButton, List, ListItemText } from "@mui/material";
|
|
8
|
-
import { useState, Fragment } from "react";
|
|
9
|
-
import { ActionsMenu } from "./common/ActionsMenu.js";
|
|
10
|
-
import { useFile } from "../../../contexts/FileContext.js";
|
|
11
|
-
import { useOpenFile, useDownloadFile } from "../../../queries/FileHooks.js";
|
|
12
|
-
const FileViewerList = (t0) => {
|
|
13
|
-
const $ = compilerRuntimeExports.c(5);
|
|
14
|
-
const {
|
|
15
|
-
sx
|
|
16
|
-
} = t0;
|
|
17
|
-
const {
|
|
18
|
-
fileMetas
|
|
19
|
-
} = useFile();
|
|
20
|
-
let t1;
|
|
21
|
-
if ($[0] !== fileMetas) {
|
|
22
|
-
t1 = fileMetas.map(_temp);
|
|
23
|
-
$[0] = fileMetas;
|
|
24
|
-
$[1] = t1;
|
|
25
|
-
} else {
|
|
26
|
-
t1 = $[1];
|
|
27
|
-
}
|
|
28
|
-
let t2;
|
|
29
|
-
if ($[2] !== sx || $[3] !== t1) {
|
|
30
|
-
t2 = /* @__PURE__ */ jsxRuntimeExports.jsx(List, { dense: true, sx, children: t1 });
|
|
31
|
-
$[2] = sx;
|
|
32
|
-
$[3] = t1;
|
|
33
|
-
$[4] = t2;
|
|
34
|
-
} else {
|
|
35
|
-
t2 = $[4];
|
|
36
|
-
}
|
|
37
|
-
return t2;
|
|
38
|
-
};
|
|
39
|
-
const ListFileViewerItem = (t0) => {
|
|
40
|
-
const $ = compilerRuntimeExports.c(29);
|
|
41
|
-
const {
|
|
42
|
-
meta
|
|
43
|
-
} = t0;
|
|
44
|
-
const {
|
|
45
|
-
setImageId,
|
|
46
|
-
actions
|
|
47
|
-
} = useFile();
|
|
48
|
-
const [menu, setMenu] = useState(null);
|
|
49
|
-
let t1;
|
|
50
|
-
if ($[0] !== menu) {
|
|
51
|
-
t1 = (event) => {
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
setMenu(menu === null ? {
|
|
54
|
-
mouseX: event.clientX,
|
|
55
|
-
mouseY: event.clientY
|
|
56
|
-
} : null);
|
|
57
|
-
};
|
|
58
|
-
$[0] = menu;
|
|
59
|
-
$[1] = t1;
|
|
60
|
-
} else {
|
|
61
|
-
t1 = $[1];
|
|
62
|
-
}
|
|
63
|
-
const openMenu = t1;
|
|
64
|
-
const {
|
|
65
|
-
mutate: openFile
|
|
66
|
-
} = useOpenFile();
|
|
67
|
-
const {
|
|
68
|
-
mutate: download
|
|
69
|
-
} = useDownloadFile();
|
|
70
|
-
let t2;
|
|
71
|
-
if ($[2] !== download || $[3] !== meta || $[4] !== openFile || $[5] !== setImageId) {
|
|
72
|
-
t2 = () => {
|
|
73
|
-
switch (meta.mediaType) {
|
|
74
|
-
case "image": {
|
|
75
|
-
return setImageId(meta.id);
|
|
76
|
-
}
|
|
77
|
-
case "application": {
|
|
78
|
-
return openFile(meta);
|
|
79
|
-
}
|
|
80
|
-
case "video": {
|
|
81
|
-
return openFile(meta);
|
|
82
|
-
}
|
|
83
|
-
default: {
|
|
84
|
-
return download(meta);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
$[2] = download;
|
|
89
|
-
$[3] = meta;
|
|
90
|
-
$[4] = openFile;
|
|
91
|
-
$[5] = setImageId;
|
|
92
|
-
$[6] = t2;
|
|
93
|
-
} else {
|
|
94
|
-
t2 = $[6];
|
|
95
|
-
}
|
|
96
|
-
const onClick = t2;
|
|
97
|
-
let t3;
|
|
98
|
-
if ($[7] !== meta.mediaType) {
|
|
99
|
-
t3 = () => {
|
|
100
|
-
switch (meta.mediaType) {
|
|
101
|
-
case "image": {
|
|
102
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Image, {});
|
|
103
|
-
}
|
|
104
|
-
case "video": {
|
|
105
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SmartDisplay, {});
|
|
106
|
-
}
|
|
107
|
-
default: {
|
|
108
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(AttachFile, {});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
$[7] = meta.mediaType;
|
|
113
|
-
$[8] = t3;
|
|
114
|
-
} else {
|
|
115
|
-
t3 = $[8];
|
|
116
|
-
}
|
|
117
|
-
const icon = t3;
|
|
118
|
-
let t4;
|
|
119
|
-
if ($[9] !== icon) {
|
|
120
|
-
t4 = /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemIcon, { children: icon() });
|
|
121
|
-
$[9] = icon;
|
|
122
|
-
$[10] = t4;
|
|
123
|
-
} else {
|
|
124
|
-
t4 = $[10];
|
|
125
|
-
}
|
|
126
|
-
const t5 = `${meta.fileName}.${meta.fileExtension}`;
|
|
127
|
-
let t6;
|
|
128
|
-
if ($[11] !== t5) {
|
|
129
|
-
t6 = /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemText, { primary: t5 });
|
|
130
|
-
$[11] = t5;
|
|
131
|
-
$[12] = t6;
|
|
132
|
-
} else {
|
|
133
|
-
t6 = $[12];
|
|
134
|
-
}
|
|
135
|
-
let t7;
|
|
136
|
-
if ($[13] !== actions || $[14] !== openMenu) {
|
|
137
|
-
t7 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreVert, {}) });
|
|
138
|
-
$[13] = actions;
|
|
139
|
-
$[14] = openMenu;
|
|
140
|
-
$[15] = t7;
|
|
141
|
-
} else {
|
|
142
|
-
t7 = $[15];
|
|
143
|
-
}
|
|
144
|
-
let t8;
|
|
145
|
-
if ($[16] !== meta.id || $[17] !== onClick || $[18] !== t4 || $[19] !== t6 || $[20] !== t7) {
|
|
146
|
-
t8 = /* @__PURE__ */ jsxRuntimeExports.jsxs(ListItemButton, { onClick, children: [
|
|
147
|
-
t4,
|
|
148
|
-
t6,
|
|
149
|
-
t7
|
|
150
|
-
] }, meta.id);
|
|
151
|
-
$[16] = meta.id;
|
|
152
|
-
$[17] = onClick;
|
|
153
|
-
$[18] = t4;
|
|
154
|
-
$[19] = t6;
|
|
155
|
-
$[20] = t7;
|
|
156
|
-
$[21] = t8;
|
|
157
|
-
} else {
|
|
158
|
-
t8 = $[21];
|
|
159
|
-
}
|
|
160
|
-
let t9;
|
|
161
|
-
if ($[22] !== actions || $[23] !== menu || $[24] !== meta) {
|
|
162
|
-
t9 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsxRuntimeExports.jsx(ActionsMenu, { meta, menu, setMenu });
|
|
163
|
-
$[22] = actions;
|
|
164
|
-
$[23] = menu;
|
|
165
|
-
$[24] = meta;
|
|
166
|
-
$[25] = t9;
|
|
167
|
-
} else {
|
|
168
|
-
t9 = $[25];
|
|
169
|
-
}
|
|
170
|
-
let t10;
|
|
171
|
-
if ($[26] !== t8 || $[27] !== t9) {
|
|
172
|
-
t10 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
|
|
173
|
-
t8,
|
|
174
|
-
t9
|
|
175
|
-
] });
|
|
176
|
-
$[26] = t8;
|
|
177
|
-
$[27] = t9;
|
|
178
|
-
$[28] = t10;
|
|
179
|
-
} else {
|
|
180
|
-
t10 = $[28];
|
|
181
|
-
}
|
|
182
|
-
return t10;
|
|
183
|
-
};
|
|
184
|
-
function _temp(fileMeta) {
|
|
185
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ListFileViewerItem, { meta: fileMeta }, fileMeta.id);
|
|
186
|
-
}
|
|
187
|
-
export {
|
|
188
|
-
FileViewerList,
|
|
189
|
-
ListFileViewerItem
|
|
190
|
-
};
|
|
191
|
-
//# sourceMappingURL=FileViewerList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewerList.js","sources":["../../../../src/components/file/fileViewer/FileViewerList.tsx"],"sourcesContent":["import AttachFile from \"@mui/icons-material/AttachFile\";\nimport Image from \"@mui/icons-material/Image\";\nimport MoreVert from \"@mui/icons-material/MoreVert\";\nimport SmartDisplay from \"@mui/icons-material/SmartDisplay\";\nimport { IconButton, List, ListItemButton, ListItemIcon, ListItemText } from \"@mui/material\";\nimport { Fragment, useState } from \"react\";\nimport { ActionsMenu } from \"./common/ActionsMenu\";\nimport type { FC } from \"react\";\nimport type { SxProps, Theme } from \"@mui/material\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { useFile } from \"~/contexts/FileContext\";\nimport { useDownloadFile, useOpenFile } from \"~/queries/FileHooks\";\n\nexport interface FileViewerListProps {\n sx?: SxProps<Theme>;\n}\n\nexport const FileViewerList: FC<FileViewerListProps> = ({ sx }) => {\n const { fileMetas } = useFile();\n\n return (\n <List dense sx={sx}>\n {fileMetas.map(fileMeta =>\n <ListFileViewerItem\n key={fileMeta.id}\n meta={fileMeta}\n />\n )}\n </List>\n );\n};\n\ninterface ListFileViewerItemProps {\n meta: FileMeta;\n}\n\nexport const ListFileViewerItem: React.FC<ListFileViewerItemProps> = ({ meta }) => {\n const { setImageId, actions } = useFile();\n const [menu, setMenu] = useState<{ mouseX: number; mouseY: number; } | null>(null);\n\n const openMenu = (event: React.MouseEvent) => {\n event.stopPropagation();\n setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY, } : null);\n };\n\n const { mutate: openFile } = useOpenFile();\n const { mutate: download } = useDownloadFile();\n\n const onClick = () => {\n switch (meta.mediaType) {\n case \"image\": { return setImageId(meta.id); }\n case \"application\": { return openFile(meta); }\n case \"video\": { return openFile(meta); }\n default: { return download(meta); }\n }\n };\n\n const icon = () => {\n switch (meta.mediaType) {\n case \"image\": {\n return <Image />;\n }\n case \"video\": {\n return <SmartDisplay />;\n }\n default: {\n return <AttachFile />;\n }\n }\n };\n\n return (\n <Fragment>\n <ListItemButton key={meta.id} onClick={onClick}>\n <ListItemIcon>\n {icon()}\n </ListItemIcon>\n <ListItemText primary={`${meta.fileName}.${meta.fileExtension}`} />\n {(actions?.download !== false || actions.delete !== false) &&\n <IconButton edge=\"end\" onClick={openMenu}>\n <MoreVert />\n </IconButton>\n }\n </ListItemButton>\n\n {(actions?.download !== false || actions.delete !== false) && <ActionsMenu meta={meta} menu={menu} setMenu={setMenu} />}\n </Fragment>\n );\n};\n"],"names":["FileViewerList","t0","$","_c","sx","fileMetas","useFile","t1","map","_temp","t2","ListFileViewerItem","meta","setImageId","actions","menu","setMenu","useState","event","stopPropagation","mouseX","clientX","mouseY","clientY","openMenu","mutate","openFile","useOpenFile","download","useDownloadFile","mediaType","id","onClick","t3","icon","t4","jsx","t5","fileName","fileExtension","t6","t7","delete","t8","jsxs","t9","t10","fileMeta"],"mappings":";;;;;;;;;;;AAiBO,MAAMA,iBAA0CC,CAAAA,OAAA;AAAA,QAAAC,IAAAC,uBAAAA,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AACpD,QAAA;AAAA,IAAAI;AAAAA,EAAAA,IAAsBC,QAAAA;AAAU,MAAAC;AAAA,MAAAL,SAAAG,WAAA;AAIvBE,SAAAF,UAASG,IAAKC,KAKf;AAACP,WAAAG;AAAAH,WAAAK;AAAAA,EAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAQ;AAAA,MAAAR,EAAA,CAAA,MAAAE,MAAAF,SAAAK,IAAA;AANLG,+CAAC,MAAA,EAAK,OAAA,MAAUN,IACXG,UAAAA,IAML;AAAOL,WAAAE;AAAAF,WAAAK;AAAAL,WAAAQ;AAAAA,EAAA,OAAA;AAAAA,SAAAR,EAAA,CAAA;AAAA,EAAA;AAAA,SAPPQ;AAOO;AAQR,MAAMC,qBAAwDV,CAAAA,OAAA;AAAA,QAAAC,IAAAC,uBAAAA,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAS;AAAAA,EAAAA,IAAAX;AAClE,QAAA;AAAA,IAAAY;AAAAA,IAAAC;AAAAA,EAAAA,IAAgCR,QAAAA;AAChC,QAAA,CAAAS,MAAAC,OAAA,IAAwBC,SAAqD,IAAI;AAAE,MAAAV;AAAA,MAAAL,SAAAa,MAAA;AAElER,SAAAW,CAAAA,UAAA;AACbA,YAAKC,gBAAAA;AACLH,cAAQD,SAAS,OAAT;AAAA,QAAAK,QAA0BF,MAAKG;AAAAA,QAAQC,QAAUJ,MAAKK;AAAAA,MAAAA,IAAtD,IAAwE;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C,YAAAuC;AAAAvC,YAAAyC;AAAAA,EAAA,OAAA;AAAAA,SAAAzC,EAAA,EAAA;AAAA,EAAA;AAAA,MAAA2C;AAAA,MAAA3C,EAAA,EAAA,MAAAY,WAAAZ,UAAAa,QAAAb,EAAA,EAAA,MAAAU,MAAA;AAEhBiC,UAAC/B,SAAOc,aAAe,SAASd,QAAO4B,WAAY,UAAUN,kCAAAA,IAAC,aAAA,EAAkBxB,MAAYG,MAAeC,QAAAA,CAAO;AAAId,YAAAY;AAAAZ,YAAAa;AAAAb,YAAAU;AAAAV,YAAA2C;AAAAA,EAAA,OAAA;AAAAA,SAAA3C,EAAA,EAAA;AAAA,EAAA;AAAA,MAAA4C;AAAA,MAAA5C,EAAA,EAAA,MAAAyC,MAAAzC,UAAA2C,IAAA;AAb3HC,iDAAC,UAAA,EACGH,UAAAA;AAAAA,MAAAA;AAAAA,MAYCE;AAAAA,IAAAA,GACL;AAAW3C,YAAAyC;AAAAzC,YAAA2C;AAAA3C,YAAA4C;AAAAA,EAAA,OAAA;AAAAA,UAAA5C,EAAA,EAAA;AAAA,EAAA;AAAA,SAdX4C;AAcW;AArEoC,SAAArC,MAAAsC,UAAA;AAAA,SAMvCX,kCAAAA,IAAC,oBAAA,EAESW,MAAAA,SAAAA,GADDA,SAAQhB,EACC;AAChB;"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import Close from "@mui/icons-material/Close";
|
|
3
|
-
import { Dialog, Box, Fab } from "@mui/material";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { useFile } from "../../../contexts/FileContext.js";
|
|
6
|
-
import { useGetFile } from "../../../queries/FileHooks.js";
|
|
7
|
-
const ImageViewer = ({
|
|
8
|
-
metaId
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
fileMetas,
|
|
12
|
-
setImageId
|
|
13
|
-
} = useFile();
|
|
14
|
-
const meta = fileMetas.find((m) => m.id === metaId);
|
|
15
|
-
const {
|
|
16
|
-
data: source
|
|
17
|
-
} = useGetFile({
|
|
18
|
-
meta
|
|
19
|
-
});
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (metaId) globalThis.addEventListener("keydown", handleOnKeydown);
|
|
22
|
-
return () => {
|
|
23
|
-
globalThis.removeEventListener("keydown", handleOnKeydown);
|
|
24
|
-
};
|
|
25
|
-
}, [metaId]);
|
|
26
|
-
const handleOnKeydown = (event) => {
|
|
27
|
-
const images = fileMetas.filter((m_0) => m_0.mediaType === "image");
|
|
28
|
-
const imageIndex = images.findIndex((m_1) => m_1.id === metaId);
|
|
29
|
-
switch (event.key) {
|
|
30
|
-
case "ArrowLeft": {
|
|
31
|
-
return handleOnArrowLeft(images, imageIndex);
|
|
32
|
-
}
|
|
33
|
-
case "ArrowRight": {
|
|
34
|
-
return handleOnArrowRight(images, imageIndex);
|
|
35
|
-
}
|
|
36
|
-
case "Backspace":
|
|
37
|
-
case "Escape": {
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
return onClose();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const handleOnArrowLeft = (images_0, index) => {
|
|
44
|
-
if (index > 0) {
|
|
45
|
-
const previousFile = images_0[index - 1];
|
|
46
|
-
setImageId(previousFile.id);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const handleOnArrowRight = (images_1, index_0) => {
|
|
50
|
-
if (index_0 < images_1.length - 1) {
|
|
51
|
-
const nextFile = images_1[index_0 + 1];
|
|
52
|
-
setImageId(nextFile.id);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const onClose = () => setImageId("");
|
|
56
|
-
if (!metaId) return null;
|
|
57
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: true, onClose, maxWidth: "xl", children: [
|
|
58
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Box, { component: "img", src: source, alt: metaId, sx: {
|
|
59
|
-
maxWidth: "100vw",
|
|
60
|
-
maxHeight: {
|
|
61
|
-
xs: "calc(100vh - 56px)",
|
|
62
|
-
sm: "calc(100vh - 64px)"
|
|
63
|
-
}
|
|
64
|
-
} }),
|
|
65
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Fab, { size: "medium", onClick: onClose, sx: {
|
|
66
|
-
position: "fixed",
|
|
67
|
-
top: 8,
|
|
68
|
-
right: 8
|
|
69
|
-
}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Close, {}) })
|
|
70
|
-
] });
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
ImageViewer
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=ImageViewer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ImageViewer.js","sources":["../../../../src/components/file/fileViewer/ImageViewer.tsx"],"sourcesContent":["import Close from \"@mui/icons-material/Close\";\nimport { Box, Dialog, Fab } from \"@mui/material\";\nimport React, { useEffect } from \"react\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { useFile } from \"~/contexts/FileContext\";\nimport { useGetFile } from \"~/queries/FileHooks\";\n\ninterface ImageViewerProps {\n metaId: string;\n}\n\nexport const ImageViewer: React.FC<ImageViewerProps> = ({ metaId }) => {\n const { fileMetas, setImageId } = useFile();\n\n const meta = fileMetas.find(m => m.id === metaId)!;\n\n const { data: source } = useGetFile({ meta });\n\n useEffect(() => {\n if (metaId)\n globalThis.addEventListener(\"keydown\", handleOnKeydown);\n\n return () => { globalThis.removeEventListener(\"keydown\", handleOnKeydown); };\n }, [metaId]);\n\n const handleOnKeydown = (event: KeyboardEvent) => {\n const images: Array<FileMeta> = fileMetas.filter(m => m.mediaType === \"image\");\n const imageIndex: number = images.findIndex(m => m.id === metaId);\n\n switch (event.key) {\n case \"ArrowLeft\": {\n return handleOnArrowLeft(images, imageIndex);\n }\n case \"ArrowRight\": {\n return handleOnArrowRight(images, imageIndex);\n }\n case \"Backspace\":\n case \"Escape\": {\n event.preventDefault();\n return onClose();\n }\n }\n };\n\n const handleOnArrowLeft = (images: Array<FileMeta>, index: number) => {\n if (index > 0) {\n const previousFile: FileMeta = images[index - 1];\n setImageId(previousFile.id);\n }\n };\n\n const handleOnArrowRight = (images: Array<FileMeta>, index: number) => {\n if (index < images.length - 1) {\n const nextFile: FileMeta = images[index + 1];\n setImageId(nextFile.id);\n }\n };\n\n const onClose = () => setImageId(\"\");\n\n if (!metaId) return null;\n\n return (\n <Dialog open onClose={onClose} maxWidth=\"xl\">\n <Box component=\"img\" src={source} alt={metaId} sx={{ maxWidth: \"100vw\", maxHeight: { xs: \"calc(100vh - 56px)\", sm: \"calc(100vh - 64px)\" } }} />\n\n <Fab size=\"medium\" onClick={onClose} sx={{ position: \"fixed\", top: 8, right: 8 }}>\n <Close />\n </Fab>\n </Dialog>\n );\n};\n"],"names":["ImageViewer","metaId","fileMetas","setImageId","useFile","meta","find","m","id","data","source","useGetFile","useEffect","globalThis","addEventListener","handleOnKeydown","removeEventListener","event","images","filter","mediaType","imageIndex","findIndex","key","handleOnArrowLeft","handleOnArrowRight","preventDefault","onClose","index","previousFile","length","nextFile","jsx","maxWidth","maxHeight","xs","sm","position","top","right"],"mappings":";;;;;;AAWO,MAAMA,cAA0CA,CAAC;AAAA,EAAEC;AAAO,MAAM;AACnE,QAAM;AAAA,IAAEC;AAAAA,IAAWC;AAAAA,EAAAA,IAAeC,QAAAA;AAElC,QAAMC,OAAOH,UAAUI,KAAKC,CAAAA,MAAKA,EAAEC,OAAOP,MAAM;AAEhD,QAAM;AAAA,IAAEQ,MAAMC;AAAAA,EAAAA,IAAWC,WAAW;AAAA,IAAEN;AAAAA,EAAAA,CAAM;AAE5CO,YAAU,MAAM;AACZ,QAAIX,OACAY,YAAWC,iBAAiB,WAAWC,eAAe;AAE1D,WAAO,MAAM;AAAEF,iBAAWG,oBAAoB,WAAWD,eAAe;AAAA,IAAG;AAAA,EAC/E,GAAG,CA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U,UAAU;AAAA,MAASC,KAAK;AAAA,MAAGC,OAAO;AAAA,IAAA,GACzE,UAAAP,kCAAAA,IAAC,OAAA,CAAA,CAAK,EAAA,CACV;AAAA,EAAA,GACJ;AAER;"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { FileMeta } from '../../../../models/file/FileMeta';
|
|
3
|
-
interface ActionsMenuProps {
|
|
4
|
-
meta: FileMeta;
|
|
5
|
-
menu: {
|
|
6
|
-
mouseX: number;
|
|
7
|
-
mouseY: number;
|
|
8
|
-
} | null;
|
|
9
|
-
setMenu: (menu: {
|
|
10
|
-
mouseX: number;
|
|
11
|
-
mouseY: number;
|
|
12
|
-
} | null) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const ActionsMenu: FC<ActionsMenuProps>;
|
|
15
|
-
export {};
|