cloudmr-ux 2.0.7 → 3.0.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/README.md +24 -24
- package/dist/CmrComponents/CmrButton/CmrButton.css +0 -0
- package/dist/CmrComponents/CmrButton/CmrButton.d.ts +4 -0
- package/dist/CmrComponents/CmrButton/CmrButton.js +30 -0
- package/dist/CmrComponents/CmrButton/index.d.ts +1 -0
- package/dist/CmrComponents/CmrButton/index.js +1 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.css +29 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.d.ts +14 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.js +30 -0
- package/dist/CmrComponents/CmrCheckbox/index.d.ts +1 -0
- package/dist/CmrComponents/CmrCheckbox/index.js +1 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.d.ts +8 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.js +29 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.scss +27 -0
- package/dist/CmrComponents/CmrInput/CmrInput.css +27 -0
- package/dist/CmrComponents/CmrInput/CmrInput.d.ts +17 -0
- package/dist/CmrComponents/CmrInput/CmrInput.js +29 -0
- package/dist/CmrComponents/CmrInput/index.d.ts +1 -0
- package/dist/CmrComponents/CmrInput/index.js +1 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.css +25 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.d.ts +15 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.js +37 -0
- package/dist/CmrComponents/CmrRadioGroup/index.d.ts +1 -0
- package/dist/CmrComponents/CmrRadioGroup/index.js +1 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.css +1 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.d.ts +24 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.js +46 -0
- package/dist/CmrComponents/CmrSelect/index.d.ts +1 -0
- package/dist/CmrComponents/CmrSelect/index.js +1 -0
- package/dist/CmrComponents/checkbox/Checkbox.css +8 -0
- package/dist/CmrComponents/checkbox/Checkbox.d.ts +15 -0
- package/dist/CmrComponents/checkbox/Checkbox.js +25 -0
- package/dist/CmrComponents/collapse/Collapse.css +3 -0
- package/dist/CmrComponents/collapse/Collapse.d.ts +18 -0
- package/dist/CmrComponents/collapse/Collapse.js +87 -0
- package/dist/CmrComponents/dialogue/Confirmation.d.ts +20 -0
- package/dist/CmrComponents/dialogue/Confirmation.js +36 -0
- package/dist/CmrComponents/dialogue/DeletionDialog.d.ts +4 -0
- package/dist/CmrComponents/dialogue/DeletionDialog.js +39 -0
- package/dist/CmrComponents/dialogue/EditConfirmation.d.ts +13 -0
- package/dist/CmrComponents/dialogue/EditConfirmation.js +45 -0
- package/dist/CmrComponents/double-slider/DualSlider.d.ts +21 -0
- package/dist/CmrComponents/double-slider/DualSlider.js +152 -0
- package/dist/CmrComponents/double-slider/InvertibleDualSlider.d.ts +24 -0
- package/dist/CmrComponents/double-slider/InvertibleDualSlider.js +174 -0
- package/dist/CmrComponents/gui-slider/ControlledSlider.d.ts +9 -0
- package/dist/CmrComponents/gui-slider/ControlledSlider.js +96 -0
- package/dist/CmrComponents/gui-slider/Slider.d.ts +20 -0
- package/dist/CmrComponents/gui-slider/Slider.js +127 -0
- package/dist/CmrComponents/header/Header.d.ts +17 -0
- package/dist/CmrComponents/header/Header.js +90 -0
- package/dist/CmrComponents/header/Header.scss +32 -0
- package/dist/CmrComponents/input-number/InputNumber.css +0 -0
- package/dist/CmrComponents/input-number/InputNumber.d.ts +17 -0
- package/dist/CmrComponents/input-number/InputNumber.js +30 -0
- package/dist/CmrComponents/label/Label.css +13 -0
- package/dist/CmrComponents/label/Label.d.ts +9 -0
- package/dist/CmrComponents/label/Label.js +18 -0
- package/dist/CmrComponents/panel/Panel.css +5 -0
- package/dist/CmrComponents/panel/Panel.d.ts +12 -0
- package/dist/CmrComponents/panel/Panel.js +42 -0
- package/dist/CmrComponents/rename/edit.d.ts +7 -0
- package/dist/CmrComponents/rename/edit.js +117 -0
- package/dist/CmrComponents/select-upload/SelectUpload.css +26 -0
- package/dist/CmrComponents/select-upload/SelectUpload.d.ts +33 -0
- package/dist/CmrComponents/select-upload/SelectUpload.js +90 -0
- package/dist/CmrComponents/tk-dualrange/TKDualRange.d.ts +17 -0
- package/dist/CmrComponents/tk-dualrange/TKDualRange.js +65 -0
- package/dist/CmrComponents/tk-dualrange/tk-dual-range.css +140 -0
- package/dist/CmrComponents/tooltip/Tooltip.css +0 -0
- package/dist/CmrComponents/tooltip/Tooltip.d.ts +18 -0
- package/dist/CmrComponents/tooltip/Tooltip.js +30 -0
- package/dist/CmrComponents/upload/Upload.css +5 -0
- package/dist/CmrComponents/upload/Upload.d.ts +80 -0
- package/dist/CmrComponents/upload/Upload.js +185 -0
- package/dist/CmrComponents/upload/UploadWindow.d.ts +15 -0
- package/dist/CmrComponents/upload/UploadWindow.js +286 -0
- package/dist/CmrTable/CmrTable.css +26 -0
- package/dist/CmrTable/CmrTable.d.ts +13 -0
- package/dist/CmrTable/CmrTable.js +47 -0
- package/dist/CmrTabs/CmrTabs.d.ts +7 -0
- package/dist/CmrTabs/CmrTabs.js +64 -0
- package/dist/CmrTabs/tab.model.d.ts +12 -0
- package/dist/CmrTabs/tab.model.js +1 -0
- package/dist/core/app/main/Main.d.ts +6 -0
- package/dist/core/app/main/Main.js +18 -0
- package/dist/core/app/results/Logs.d.ts +1 -0
- package/dist/core/app/results/Logs.js +33 -0
- package/dist/core/app/results/PreprocessJob.d.ts +1 -0
- package/dist/core/app/results/PreprocessJob.js +100 -0
- package/dist/core/app/results/Results.d.ts +15 -0
- package/dist/core/app/results/Results.js +372 -0
- package/dist/core/app/results/Results.scss +92 -0
- package/dist/core/app/results/Rois.d.ts +11 -0
- package/dist/core/app/results/Rois.js +269 -0
- package/dist/core/app/settings/Settings.d.ts +1 -0
- package/dist/core/app/settings/Settings.js +109 -0
- package/dist/core/app/signin/ForgotPassword.d.ts +3 -0
- package/dist/core/app/signin/ForgotPassword.js +142 -0
- package/dist/core/app/signin/Register.d.ts +3 -0
- package/dist/core/app/signin/Register.js +126 -0
- package/dist/core/app/signin/Signin.d.ts +5 -0
- package/dist/core/app/signin/Signin.js +84 -0
- package/dist/core/app/signin/Signin.scss +86 -0
- package/dist/core/app/upload/Upload.d.ts +3 -0
- package/dist/core/app/upload/Upload.js +261 -0
- package/dist/core/app/upload/Upload.scss +0 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.d.ts +8 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.js +29 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.scss +27 -0
- package/dist/core/common/components/NiivueTools/Niivue.css +8 -0
- package/dist/core/common/components/NiivueTools/Niivue.d.ts +14 -0
- package/dist/core/common/components/NiivueTools/Niivue.js +1270 -0
- package/dist/core/common/components/NiivueTools/NiivuePatcher.js +1875 -0
- package/dist/core/common/components/NiivueTools/components/ColorPicker.d.ts +5 -0
- package/dist/core/common/components/NiivueTools/components/ColorPicker.js +68 -0
- package/dist/core/common/components/NiivueTools/components/DrawPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/DrawPlatte.js +88 -0
- package/dist/core/common/components/NiivueTools/components/DrawToolKit.d.ts +32 -0
- package/dist/core/common/components/NiivueTools/components/DrawToolKit.js +164 -0
- package/dist/core/common/components/NiivueTools/components/EraserPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/EraserPlatte.js +43 -0
- package/dist/core/common/components/NiivueTools/components/Layer.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/Layer.js +117 -0
- package/dist/core/common/components/NiivueTools/components/LayersPanel.d.ts +8 -0
- package/dist/core/common/components/NiivueTools/components/LayersPanel.js +108 -0
- package/dist/core/common/components/NiivueTools/components/LocationTable.d.ts +9 -0
- package/dist/core/common/components/NiivueTools/components/LocationTable.js +42 -0
- package/dist/core/common/components/NiivueTools/components/MaskPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/MaskPlatte.js +123 -0
- package/dist/core/common/components/NiivueTools/components/NiivuePanel.d.ts +34 -0
- package/dist/core/common/components/NiivueTools/components/NiivuePanel.js +305 -0
- package/dist/core/common/components/NiivueTools/components/NumberPicker.d.ts +8 -0
- package/dist/core/common/components/NiivueTools/components/NumberPicker.js +40 -0
- package/dist/core/common/components/NiivueTools/components/SettingsPanel.d.ts +7 -0
- package/dist/core/common/components/NiivueTools/components/SettingsPanel.js +30 -0
- package/dist/core/common/components/NiivueTools/components/Switch.d.ts +5 -0
- package/dist/core/common/components/NiivueTools/components/Switch.js +26 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.d.ts +40 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.js +184 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.scss +39 -0
- package/dist/core/common/components/NiivueTools/components/stats.d.ts +2 -0
- package/dist/core/common/components/NiivueTools/components/stats.js +13 -0
- package/dist/core/common/components/NiivueTools/index.css +14 -0
- package/dist/core/common/components/NiivueTools/util.js +309 -0
- package/dist/core/common/components/footer/Footer.d.ts +3 -0
- package/dist/core/common/components/footer/Footer.js +20 -0
- package/dist/core/common/components/footer/Footer.scss +5 -0
- package/dist/core/common/utilities/AuthenticatedRequests.d.ts +16 -0
- package/dist/core/common/utilities/AuthenticatedRequests.js +158 -0
- package/dist/core/common/utilities/CalendarHelper.d.ts +5 -0
- package/dist/core/common/utilities/CalendarHelper.js +27 -0
- package/dist/core/common/utilities/DownloadFromText.d.ts +3 -0
- package/dist/core/common/utilities/DownloadFromText.js +20 -0
- package/dist/core/common/utilities/StoreToRequest.d.ts +1 -0
- package/dist/core/common/utilities/StoreToRequest.js +4 -0
- package/dist/core/common/utilities/SystemUtilities.d.ts +4 -0
- package/dist/core/common/utilities/SystemUtilities.js +79 -0
- package/dist/core/common/utilities/file-transformation/anonymize.d.ts +1 -0
- package/dist/core/common/utilities/file-transformation/anonymize.js +114 -0
- package/dist/core/common/utilities/file-transformation/utilities.d.ts +2 -0
- package/dist/core/common/utilities/file-transformation/utilities.js +23 -0
- package/dist/core/common/utilities/index.d.ts +25 -0
- package/dist/core/common/utilities/index.js +118 -0
- package/dist/core/common/utilities/parse-jwt.d.ts +1 -0
- package/dist/core/common/utilities/parse-jwt.js +14 -0
- package/dist/core/components/PasswordRequirements.d.ts +7 -0
- package/dist/core/components/PasswordRequirements.js +30 -0
- package/dist/core/config/AppConfig.d.ts +5 -0
- package/dist/core/config/AppConfig.js +42 -0
- package/dist/core/config/types.d.ts +40 -0
- package/dist/core/config/types.js +1 -0
- package/dist/core/features/authenticate/authenticateActionCreation.d.ts +46 -0
- package/dist/core/features/authenticate/authenticateActionCreation.js +326 -0
- package/dist/core/features/authenticate/authenticateSlice.d.ts +45 -0
- package/dist/core/features/authenticate/authenticateSlice.js +203 -0
- package/dist/core/features/data/dataActionCreation.d.ts +40 -0
- package/dist/core/features/data/dataActionCreation.js +340 -0
- package/dist/core/features/data/dataSlice.d.ts +37 -0
- package/dist/core/features/data/dataSlice.js +87 -0
- package/dist/core/features/jobs/jobActionCreation.d.ts +35 -0
- package/dist/core/features/jobs/jobActionCreation.js +242 -0
- package/dist/core/features/jobs/jobsSlice.d.ts +57 -0
- package/dist/core/features/jobs/jobsSlice.js +54 -0
- package/dist/core/features/rois/resultActionCreation.d.ts +21 -0
- package/dist/core/features/rois/resultActionCreation.js +114 -0
- package/dist/core/features/rois/resultSlice.d.ts +24 -0
- package/dist/core/features/rois/resultSlice.js +68 -0
- package/dist/core/features/rois/roiTypes.d.ts +44 -0
- package/dist/core/features/rois/roiTypes.js +1 -0
- package/dist/core/features/setup/setupActionCreation.d.ts +7 -0
- package/dist/core/features/setup/setupActionCreation.js +100 -0
- package/dist/core/index.d.ts +22 -0
- package/dist/core/index.js +27 -0
- package/dist/core/store/configureStore.d.ts +13 -0
- package/dist/core/store/configureStore.js +38 -0
- package/dist/core/store/hooks.d.ts +11 -0
- package/dist/core/store/hooks.js +5 -0
- package/dist/core/utils/passwordValidation.d.ts +25 -0
- package/dist/core/utils/passwordValidation.js +19 -0
- package/dist/index.d.ts +29 -329
- package/dist/index.js +26 -1402
- package/dist/style.css +47 -0
- package/package.json +309 -41
- package/dist/index.css +0 -170
- package/dist/index.mjs +0 -1354
package/dist/index.mjs
DELETED
|
@@ -1,1354 +0,0 @@
|
|
|
1
|
-
// src/CmrComponents/CmrButton/CmrButton.tsx
|
|
2
|
-
import { Button } from "@mui/material";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var CmrButton = (props) => {
|
|
5
|
-
const { children, onClick, ...rest } = props;
|
|
6
|
-
return /* @__PURE__ */ jsx(Button, { onClick, ...rest, style: { ...props.style, textTransform: "none" }, children });
|
|
7
|
-
};
|
|
8
|
-
var CmrButton_default = CmrButton;
|
|
9
|
-
|
|
10
|
-
// src/CmrComponents/CmrCheckbox/CmrCheckbox.tsx
|
|
11
|
-
import { Checkbox } from "@mui/material";
|
|
12
|
-
import { FormControlLabel } from "@mui/material";
|
|
13
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
14
|
-
|
|
15
|
-
// src/CmrComponents/CmrInput/CmrInput.tsx
|
|
16
|
-
import { Input } from "antd";
|
|
17
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
18
|
-
var CmrInput = (props) => {
|
|
19
|
-
const { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter, ...rest } = props;
|
|
20
|
-
return /* @__PURE__ */ jsx3(
|
|
21
|
-
Input,
|
|
22
|
-
{
|
|
23
|
-
defaultValue,
|
|
24
|
-
id,
|
|
25
|
-
maxLength,
|
|
26
|
-
size,
|
|
27
|
-
value,
|
|
28
|
-
type,
|
|
29
|
-
prefix,
|
|
30
|
-
onChange,
|
|
31
|
-
onPressEnter,
|
|
32
|
-
...rest,
|
|
33
|
-
className: "cmr-input"
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/CmrComponents/CmrRadioGroup/CmrRadioGroup.tsx
|
|
39
|
-
import { useState } from "react";
|
|
40
|
-
import {
|
|
41
|
-
Radio,
|
|
42
|
-
RadioGroup,
|
|
43
|
-
FormControl,
|
|
44
|
-
FormControlLabel as FormControlLabel2,
|
|
45
|
-
FormLabel
|
|
46
|
-
} from "@mui/material";
|
|
47
|
-
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
48
|
-
var CmrRadioGroup = ({
|
|
49
|
-
options,
|
|
50
|
-
groupLabel,
|
|
51
|
-
defaultValue,
|
|
52
|
-
onChange
|
|
53
|
-
}) => {
|
|
54
|
-
const [selectedValue, setSelectedValue] = useState(defaultValue || "");
|
|
55
|
-
const handleChange = (event) => {
|
|
56
|
-
const newValue = event.target.value;
|
|
57
|
-
setSelectedValue(newValue);
|
|
58
|
-
if (onChange) {
|
|
59
|
-
onChange(newValue);
|
|
60
|
-
} else {
|
|
61
|
-
console.log("Selected Radio Value:", newValue);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return /* @__PURE__ */ jsx4("div", { className: "cmr-radio-label", children: /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", children: [
|
|
65
|
-
groupLabel && /* @__PURE__ */ jsx4(FormLabel, { component: "legend", children: groupLabel }),
|
|
66
|
-
/* @__PURE__ */ jsx4(RadioGroup, { value: selectedValue, onChange: handleChange, children: options.map((option) => /* @__PURE__ */ jsx4(
|
|
67
|
-
FormControlLabel2,
|
|
68
|
-
{
|
|
69
|
-
value: option.value,
|
|
70
|
-
control: /* @__PURE__ */ jsx4(Radio, { disabled: option.disabled }),
|
|
71
|
-
label: option.label,
|
|
72
|
-
sx: {
|
|
73
|
-
"& .MuiTypography-root": {
|
|
74
|
-
fontSize: "14.4px",
|
|
75
|
-
fontFamily: '"Source Sans 3", sans-serif'
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
option.value
|
|
80
|
-
)) })
|
|
81
|
-
] }) });
|
|
82
|
-
};
|
|
83
|
-
var CmrRadioGroup_default = CmrRadioGroup;
|
|
84
|
-
|
|
85
|
-
// src/CmrComponents/CmrSelect/CmrSelect.tsx
|
|
86
|
-
import { useEffect, useId, useMemo, useState as useState2 } from "react";
|
|
87
|
-
import ReactSelect from "react-select";
|
|
88
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
89
|
-
var baseStyles = {
|
|
90
|
-
control: (base, state) => ({
|
|
91
|
-
...base,
|
|
92
|
-
minHeight: 40,
|
|
93
|
-
borderColor: state.isFocused ? "#580F8B" : base.borderColor,
|
|
94
|
-
boxShadow: state.isFocused ? "0 0 0 1px #580F8B" : "none",
|
|
95
|
-
"&:hover": { borderColor: "#580F8B" },
|
|
96
|
-
fontFamily: "Inter, Roboto, Helvetica, Arial, sans-serif",
|
|
97
|
-
borderRadius: 4
|
|
98
|
-
}),
|
|
99
|
-
placeholder: (base) => ({
|
|
100
|
-
...base,
|
|
101
|
-
color: "rgba(0,0,0,0.6)"
|
|
102
|
-
}),
|
|
103
|
-
singleValue: (base) => ({
|
|
104
|
-
...base,
|
|
105
|
-
color: "#580F8B",
|
|
106
|
-
fontWeight: 400,
|
|
107
|
-
fontFamily: "Inter, Roboto, Helvetica, Arial, sans-serif"
|
|
108
|
-
}),
|
|
109
|
-
option: (base, state) => ({
|
|
110
|
-
...base,
|
|
111
|
-
backgroundColor: state.isFocused || state.isSelected ? "#F3E5F5" : "white",
|
|
112
|
-
color: "#000",
|
|
113
|
-
fontFamily: "Inter, Roboto, Helvetica, Arial, sans-serif",
|
|
114
|
-
cursor: state.isDisabled ? "not-allowed" : "pointer"
|
|
115
|
-
}),
|
|
116
|
-
menuPortal: (base) => ({ ...base, zIndex: 2e3 }),
|
|
117
|
-
menu: (base) => ({ ...base, zIndex: 1300 })
|
|
118
|
-
};
|
|
119
|
-
var CmrSelect = ({
|
|
120
|
-
options,
|
|
121
|
-
disabled,
|
|
122
|
-
value,
|
|
123
|
-
onChange,
|
|
124
|
-
defaultValue = "",
|
|
125
|
-
fullWidth,
|
|
126
|
-
sx,
|
|
127
|
-
className
|
|
128
|
-
}) => {
|
|
129
|
-
const isControlled = value !== void 0;
|
|
130
|
-
const [internal, setInternal] = useState2(defaultValue);
|
|
131
|
-
const currentValue = isControlled ? value : internal;
|
|
132
|
-
useEffect(() => {
|
|
133
|
-
if (isControlled)
|
|
134
|
-
setInternal(value);
|
|
135
|
-
}, [isControlled, value]);
|
|
136
|
-
const id = useId();
|
|
137
|
-
const rsValue = useMemo(
|
|
138
|
-
() => options.find((o) => o.value === currentValue) ?? null,
|
|
139
|
-
[options, currentValue]
|
|
140
|
-
);
|
|
141
|
-
const handleChange = (opt) => {
|
|
142
|
-
const next = (opt == null ? void 0 : opt.value) ?? "";
|
|
143
|
-
if (!isControlled)
|
|
144
|
-
setInternal(next);
|
|
145
|
-
onChange == null ? void 0 : onChange(next);
|
|
146
|
-
};
|
|
147
|
-
const wrapperStyle = {
|
|
148
|
-
minWidth: 200,
|
|
149
|
-
maxWidth: 400,
|
|
150
|
-
width: fullWidth ? "100%" : "auto",
|
|
151
|
-
...sx
|
|
152
|
-
};
|
|
153
|
-
return /* @__PURE__ */ jsx5("div", { className: className ?? "dropdown-select", style: wrapperStyle, children: /* @__PURE__ */ jsx5(
|
|
154
|
-
ReactSelect,
|
|
155
|
-
{
|
|
156
|
-
inputId: id,
|
|
157
|
-
isDisabled: !!disabled,
|
|
158
|
-
options: options.map((o) => ({ ...o, isDisabled: o.disabled })),
|
|
159
|
-
value: rsValue,
|
|
160
|
-
onChange: handleChange,
|
|
161
|
-
placeholder: "Select",
|
|
162
|
-
isClearable: true,
|
|
163
|
-
styles: baseStyles,
|
|
164
|
-
menuPortalTarget: document.body
|
|
165
|
-
}
|
|
166
|
-
) });
|
|
167
|
-
};
|
|
168
|
-
var CmrSelect_default = CmrSelect;
|
|
169
|
-
|
|
170
|
-
// src/CmrComponents/collapse/Collapse.tsx
|
|
171
|
-
import React3, { cloneElement } from "react";
|
|
172
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
173
|
-
var CmrCollapse = (props) => {
|
|
174
|
-
let { activeKey, defaultActiveKey, onChange, children } = props;
|
|
175
|
-
defaultActiveKey = defaultActiveKey || [];
|
|
176
|
-
const [activeKeys, setActiveKeys] = React3.useState(defaultActiveKey);
|
|
177
|
-
React3.useEffect(() => {
|
|
178
|
-
if (activeKey !== void 0 && activeKey !== activeKeys) {
|
|
179
|
-
if (Array.isArray(activeKey)) {
|
|
180
|
-
setActiveKeys(activeKey);
|
|
181
|
-
} else {
|
|
182
|
-
setActiveKeys([activeKey]);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}, [activeKey]);
|
|
186
|
-
const onToggle = (key) => {
|
|
187
|
-
const newKeys = [...activeKeys];
|
|
188
|
-
const keyIndex = newKeys.indexOf(key);
|
|
189
|
-
if (keyIndex === -1) {
|
|
190
|
-
newKeys.push(key);
|
|
191
|
-
} else {
|
|
192
|
-
newKeys.splice(keyIndex, 1);
|
|
193
|
-
}
|
|
194
|
-
setActiveKeys(newKeys);
|
|
195
|
-
if (onChange)
|
|
196
|
-
onChange(newKeys);
|
|
197
|
-
};
|
|
198
|
-
const renderChildren = () => {
|
|
199
|
-
if (!children)
|
|
200
|
-
return null;
|
|
201
|
-
if (Array.isArray(children)) {
|
|
202
|
-
return children.map((child, index) => {
|
|
203
|
-
const panelKey = index;
|
|
204
|
-
const expanded = activeKeys.includes(panelKey);
|
|
205
|
-
const header = /* @__PURE__ */ jsx6("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: child.props.header });
|
|
206
|
-
return cloneElement(child, {
|
|
207
|
-
expanded,
|
|
208
|
-
panelKey,
|
|
209
|
-
onToggle,
|
|
210
|
-
header
|
|
211
|
-
// Override header with clickable version
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
} else {
|
|
215
|
-
const panelKey = 0;
|
|
216
|
-
const expanded = activeKeys.includes(panelKey);
|
|
217
|
-
const header = /* @__PURE__ */ jsx6("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: children.props.header });
|
|
218
|
-
return cloneElement(children, {
|
|
219
|
-
expanded,
|
|
220
|
-
panelKey,
|
|
221
|
-
onToggle,
|
|
222
|
-
header
|
|
223
|
-
// Override header with clickable version
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
return /* @__PURE__ */ jsx6("div", { className: "cmr-collapse", children: /* @__PURE__ */ jsx6("div", { children: renderChildren() }) });
|
|
228
|
-
};
|
|
229
|
-
var Collapse_default = CmrCollapse;
|
|
230
|
-
|
|
231
|
-
// src/CmrComponents/panel/Panel.tsx
|
|
232
|
-
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
|
|
233
|
-
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
234
|
-
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
235
|
-
var CmrPanel = function(props) {
|
|
236
|
-
var _a, _b;
|
|
237
|
-
let { expanded, onToggle } = props;
|
|
238
|
-
const toggle = () => {
|
|
239
|
-
if (onToggle)
|
|
240
|
-
onToggle(props.panelKey);
|
|
241
|
-
};
|
|
242
|
-
return /* @__PURE__ */ jsxs2("div", { className: `card ${props.className}`, children: [
|
|
243
|
-
/* @__PURE__ */ jsx7("div", { className: "card-header", style: { background: "white", display: props.header == void 0 ? "none" : void 0 }, children: /* @__PURE__ */ jsxs2("div", { className: "row align-items-center", children: [
|
|
244
|
-
/* @__PURE__ */ jsx7("div", { className: "col", children: props.header }),
|
|
245
|
-
onToggle && /* @__PURE__ */ jsx7("div", { className: "col text-end", children: /* @__PURE__ */ jsx7(
|
|
246
|
-
"span",
|
|
247
|
-
{
|
|
248
|
-
className: "react-collapse float-end btn",
|
|
249
|
-
onClick: (e) => {
|
|
250
|
-
toggle();
|
|
251
|
-
},
|
|
252
|
-
children: !expanded ? /* @__PURE__ */ jsx7(ArrowDropDownIcon, {}) : /* @__PURE__ */ jsx7(ArrowDropUpIcon, {})
|
|
253
|
-
}
|
|
254
|
-
) })
|
|
255
|
-
] }) }),
|
|
256
|
-
!expanded ? /* @__PURE__ */ jsx7("div", { className: `card-body m-0 ${(_a = props.cardProps) == null ? void 0 : _a.className}`, style: {
|
|
257
|
-
maxHeight: "0",
|
|
258
|
-
padding: 0,
|
|
259
|
-
opacity: "0",
|
|
260
|
-
overflow: "hidden",
|
|
261
|
-
visibility: "collapse",
|
|
262
|
-
transition: "all 0.5s"
|
|
263
|
-
}, children: props.children }) : /* @__PURE__ */ jsx7("div", { className: `card-body m-4 ${(_b = props.cardProps) == null ? void 0 : _b.className}`, style: {
|
|
264
|
-
maxHeight: void 0,
|
|
265
|
-
padding: 0,
|
|
266
|
-
opacity: "1",
|
|
267
|
-
visibility: "visible",
|
|
268
|
-
transition: "all 0.5s"
|
|
269
|
-
}, children: props.children })
|
|
270
|
-
] });
|
|
271
|
-
};
|
|
272
|
-
var Panel_default = CmrPanel;
|
|
273
|
-
|
|
274
|
-
// src/CmrComponents/upload/Upload.tsx
|
|
275
|
-
import React5, { useState as useState4 } from "react";
|
|
276
|
-
import { Button as Button3 } from "@mui/material";
|
|
277
|
-
import UploadIcon from "@mui/icons-material/Upload";
|
|
278
|
-
|
|
279
|
-
// src/CmrComponents/upload/UploadWindow.tsx
|
|
280
|
-
import * as React4 from "react";
|
|
281
|
-
import Button2 from "@mui/material/Button";
|
|
282
|
-
import TextField from "@mui/material/TextField";
|
|
283
|
-
import Dialog from "@mui/material/Dialog";
|
|
284
|
-
import DialogActions from "@mui/material/DialogActions";
|
|
285
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
286
|
-
import DialogContentText from "@mui/material/DialogContentText";
|
|
287
|
-
import DialogTitle from "@mui/material/DialogTitle";
|
|
288
|
-
import Typography from "@mui/material/Typography";
|
|
289
|
-
import Box from "@mui/material/Box";
|
|
290
|
-
import { Alert, Collapse, MenuItem } from "@mui/material";
|
|
291
|
-
|
|
292
|
-
// src/CmrComponents/label/Label.tsx
|
|
293
|
-
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
294
|
-
var CmrLabel = (props) => {
|
|
295
|
-
const { children, required = false } = props;
|
|
296
|
-
return /* @__PURE__ */ jsxs3("label", { className: "cmr-label", style: { fontSize: "16px", ...props.style }, children: [
|
|
297
|
-
children,
|
|
298
|
-
required && /* @__PURE__ */ jsx8("span", { className: "asterik", children: "*" })
|
|
299
|
-
] });
|
|
300
|
-
};
|
|
301
|
-
var Label_default = CmrLabel;
|
|
302
|
-
|
|
303
|
-
// src/CmrComponents/upload/UploadWindow.tsx
|
|
304
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
305
|
-
function CmrUploadWindow({
|
|
306
|
-
upload,
|
|
307
|
-
open,
|
|
308
|
-
setOpen,
|
|
309
|
-
fileExtension,
|
|
310
|
-
template = { showFileName: true, showDatabase: true, showFileSize: true }
|
|
311
|
-
// default values
|
|
312
|
-
}) {
|
|
313
|
-
const [fileOriginalName, setFileOriginalName] = React4.useState("");
|
|
314
|
-
const [fileAlias, setFileAlias] = React4.useState("/");
|
|
315
|
-
const [fileSize, setFileSize] = React4.useState("0 MB");
|
|
316
|
-
const [warningText, setWarningText] = React4.useState("Unknown Status");
|
|
317
|
-
const [infoOpen, setInfoOpen] = React4.useState(false);
|
|
318
|
-
const [locationSelection, setLocationSelection] = React4.useState("s3");
|
|
319
|
-
const [infoStyle, setInfoStyle] = React4.useState("info");
|
|
320
|
-
const [uploadedFiles, setUploaded] = React4.useState([]);
|
|
321
|
-
const [UpBtnDisabled, setUpBtnDisabled] = React4.useState(false);
|
|
322
|
-
const [UpBtnText, setUpBtnText] = React4.useState("Upload");
|
|
323
|
-
const [uploadBoxWarning, setUploadBoxWarning] = React4.useState(void 0);
|
|
324
|
-
const handleClickOpen = () => {
|
|
325
|
-
setOpen(true);
|
|
326
|
-
};
|
|
327
|
-
const handleClose = () => {
|
|
328
|
-
setOpen(false);
|
|
329
|
-
};
|
|
330
|
-
const checkExtension2 = (filename, allowed) => {
|
|
331
|
-
if (!filename)
|
|
332
|
-
return false;
|
|
333
|
-
const name = filename.toLowerCase();
|
|
334
|
-
if (Array.isArray(allowed)) {
|
|
335
|
-
return allowed.some((ext) => name.endsWith(ext.startsWith(".") ? ext : "." + ext));
|
|
336
|
-
} else {
|
|
337
|
-
return name.endsWith(allowed.startsWith(".") ? allowed : "." + allowed);
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
const getExtension = (fileName) => {
|
|
341
|
-
if (fileName == void 0)
|
|
342
|
-
return;
|
|
343
|
-
return fileName.split(".").pop();
|
|
344
|
-
};
|
|
345
|
-
const INVALID_ALIAS_REGEX = /[ ,:%><]/;
|
|
346
|
-
const handleConfirm = () => {
|
|
347
|
-
if (uploadedFiles.length === 0) {
|
|
348
|
-
setInfoOpen(true);
|
|
349
|
-
setInfoStyle("error");
|
|
350
|
-
setWarningText("Must select files to upload!");
|
|
351
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (fileAlias.length === 0) {
|
|
355
|
-
setInfoOpen(true);
|
|
356
|
-
setInfoStyle("error");
|
|
357
|
-
setWarningText("File name can't be empty");
|
|
358
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
if (INVALID_ALIAS_REGEX.test(fileAlias)) {
|
|
362
|
-
setInfoOpen(true);
|
|
363
|
-
setInfoStyle("error");
|
|
364
|
-
setWarningText("Alias contains invalid characters ( , : % > < or spaces )");
|
|
365
|
-
setTimeout(() => setInfoOpen(false), 1e4);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
setOpen(false);
|
|
369
|
-
upload(uploadedFiles[0], fileAlias, locationSelection).then((response) => {
|
|
370
|
-
console.log(response);
|
|
371
|
-
if (response > 0) {
|
|
372
|
-
setInfoOpen(true);
|
|
373
|
-
if (response === 200) {
|
|
374
|
-
setInfoStyle("success");
|
|
375
|
-
setWarningText("Upload successful");
|
|
376
|
-
setTimeout(() => {
|
|
377
|
-
setInfoOpen(false);
|
|
378
|
-
setOpen(false);
|
|
379
|
-
}, 1e3);
|
|
380
|
-
setUpBtnDisabled(false);
|
|
381
|
-
setUpBtnText("Upload");
|
|
382
|
-
} else if (response === 413) {
|
|
383
|
-
setInfoStyle("error");
|
|
384
|
-
setWarningText("File size limit exceeded");
|
|
385
|
-
setTimeout(() => {
|
|
386
|
-
setInfoOpen(false);
|
|
387
|
-
setUpBtnDisabled(false);
|
|
388
|
-
setUpBtnText("Upload");
|
|
389
|
-
}, 2e3);
|
|
390
|
-
} else if (response === 500) {
|
|
391
|
-
setInfoStyle("error");
|
|
392
|
-
setWarningText("Internal server error");
|
|
393
|
-
setTimeout(() => {
|
|
394
|
-
setInfoOpen(false);
|
|
395
|
-
setUpBtnDisabled(false);
|
|
396
|
-
setUpBtnText("Upload");
|
|
397
|
-
}, 1500);
|
|
398
|
-
setOpen(true);
|
|
399
|
-
} else if (response === 400) {
|
|
400
|
-
setInfoStyle("warning");
|
|
401
|
-
setWarningText("File upload cancelled");
|
|
402
|
-
setTimeout(() => {
|
|
403
|
-
setInfoOpen(false);
|
|
404
|
-
setUpBtnDisabled(false);
|
|
405
|
-
setUpBtnText("Upload");
|
|
406
|
-
}, 1e3);
|
|
407
|
-
setOpen(true);
|
|
408
|
-
} else {
|
|
409
|
-
setInfoStyle("warning");
|
|
410
|
-
setWarningText("Unknown status");
|
|
411
|
-
setTimeout(() => {
|
|
412
|
-
setInfoOpen(false);
|
|
413
|
-
setUpBtnDisabled(false);
|
|
414
|
-
setUpBtnText("Upload");
|
|
415
|
-
}, 2e3);
|
|
416
|
-
setOpen(true);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}).catch((error) => {
|
|
420
|
-
setUpBtnDisabled(false);
|
|
421
|
-
setUpBtnText("Upload");
|
|
422
|
-
setInfoOpen(true);
|
|
423
|
-
setInfoStyle("error");
|
|
424
|
-
setWarningText("Upload unsuccessful: " + error.message);
|
|
425
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
426
|
-
console.error("Error:", error);
|
|
427
|
-
});
|
|
428
|
-
setUpBtnDisabled(true);
|
|
429
|
-
setUpBtnText("Uploading");
|
|
430
|
-
};
|
|
431
|
-
const changeFileName = (e) => {
|
|
432
|
-
setFileAlias(e.target.value);
|
|
433
|
-
};
|
|
434
|
-
function loadFiles(files) {
|
|
435
|
-
if (files.length == 0) {
|
|
436
|
-
setInfoOpen(true);
|
|
437
|
-
setInfoStyle("warning");
|
|
438
|
-
setWarningText("No file selected");
|
|
439
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
if (files.length > 1) {
|
|
443
|
-
setInfoOpen(true);
|
|
444
|
-
setInfoStyle("warning");
|
|
445
|
-
setWarningText("Only accepts one file at a time");
|
|
446
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
let file = files[0];
|
|
450
|
-
setUploaded([file]);
|
|
451
|
-
function readFile(file2) {
|
|
452
|
-
setFileOriginalName(file2.name);
|
|
453
|
-
setFileAlias(file2.name);
|
|
454
|
-
const units = [
|
|
455
|
-
"B",
|
|
456
|
-
"KB",
|
|
457
|
-
"MB",
|
|
458
|
-
"GB",
|
|
459
|
-
"TB",
|
|
460
|
-
"PB",
|
|
461
|
-
"EB",
|
|
462
|
-
"ZB",
|
|
463
|
-
"YB"
|
|
464
|
-
];
|
|
465
|
-
let numberOfBytes = file2.size;
|
|
466
|
-
const exponent = Math.min(
|
|
467
|
-
Math.floor(Math.log(numberOfBytes) / Math.log(1024)),
|
|
468
|
-
units.length - 1
|
|
469
|
-
);
|
|
470
|
-
const approx = numberOfBytes / 1024 ** exponent;
|
|
471
|
-
const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(3)} ${units[exponent]}`;
|
|
472
|
-
setFileSize(output);
|
|
473
|
-
}
|
|
474
|
-
readFile(file);
|
|
475
|
-
}
|
|
476
|
-
let initialized = false;
|
|
477
|
-
let fileInput = (inputRef) => {
|
|
478
|
-
if (initialized)
|
|
479
|
-
return;
|
|
480
|
-
inputRef.addEventListener("dragover", function(e) {
|
|
481
|
-
e.stopPropagation();
|
|
482
|
-
e.preventDefault();
|
|
483
|
-
if (e.dataTransfer.files) {
|
|
484
|
-
let draggedFiles = e.dataTransfer.files;
|
|
485
|
-
if (draggedFiles.length > 1) {
|
|
486
|
-
setUploadBoxWarning("Only one file can be uploaded at a time");
|
|
487
|
-
} else if (fileExtension != void 0 && draggedFiles.length !== 0 && !checkExtension2(draggedFiles[0].name, fileExtension)) {
|
|
488
|
-
setUploadBoxWarning(
|
|
489
|
-
`Only accepting files with extension(s): ${Array.isArray(fileExtension) ? fileExtension.join(", ") : fileExtension}`
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
e.dataTransfer.dropEffect = "copy";
|
|
494
|
-
});
|
|
495
|
-
inputRef.addEventListener("drop", function(e) {
|
|
496
|
-
e.stopPropagation();
|
|
497
|
-
e.preventDefault();
|
|
498
|
-
setTimeout(() => {
|
|
499
|
-
setUploadBoxWarning(void 0);
|
|
500
|
-
}, 1e4);
|
|
501
|
-
let files = e.dataTransfer.files;
|
|
502
|
-
if (files.length > 1) {
|
|
503
|
-
setInfoOpen(true);
|
|
504
|
-
setInfoStyle("warning");
|
|
505
|
-
setWarningText("Only one file can be uploaded at a time");
|
|
506
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
507
|
-
return;
|
|
508
|
-
} else if (fileExtension !== void 0 && !checkExtension2(files[0].name, fileExtension)) {
|
|
509
|
-
setInfoOpen(true);
|
|
510
|
-
setInfoStyle("warning");
|
|
511
|
-
setWarningText(
|
|
512
|
-
`Only accepting files with extension(s): ${Array.isArray(fileExtension) ? fileExtension.join(", ") : fileExtension}`
|
|
513
|
-
);
|
|
514
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
loadFiles(files);
|
|
518
|
-
});
|
|
519
|
-
inputRef.addEventListener("dragleave", () => {
|
|
520
|
-
setUploadBoxWarning(void 0);
|
|
521
|
-
});
|
|
522
|
-
initialized = true;
|
|
523
|
-
};
|
|
524
|
-
const fileInputClick = (e) => {
|
|
525
|
-
const fileElem = document.getElementById("file-window");
|
|
526
|
-
e.preventDefault();
|
|
527
|
-
if (fileElem) {
|
|
528
|
-
fileElem.click();
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
const loadSelectedFiles = (e) => {
|
|
532
|
-
e.preventDefault();
|
|
533
|
-
const fileElem = document.getElementById("file-window");
|
|
534
|
-
loadFiles(fileElem.files);
|
|
535
|
-
};
|
|
536
|
-
return /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsxs4(Dialog, { open, onClose: handleClose, children: [
|
|
537
|
-
/* @__PURE__ */ jsx9(DialogTitle, { children: "File Upload" }),
|
|
538
|
-
/* @__PURE__ */ jsxs4(DialogContent, { children: [
|
|
539
|
-
/* @__PURE__ */ jsx9(DialogContentText, {}),
|
|
540
|
-
/* @__PURE__ */ jsxs4(DialogContent, { dividers: true, children: [
|
|
541
|
-
/* @__PURE__ */ jsx9(
|
|
542
|
-
Box,
|
|
543
|
-
{
|
|
544
|
-
width: 500,
|
|
545
|
-
height: 250,
|
|
546
|
-
style: {
|
|
547
|
-
borderStyle: "dashed",
|
|
548
|
-
borderRadius: "5pt",
|
|
549
|
-
borderColor: uploadBoxWarning == void 0 ? "lightGray" : "#BA3C3C"
|
|
550
|
-
},
|
|
551
|
-
children: /* @__PURE__ */ jsx9(Typography, { component: "div", style: { height: "100%" }, children: /* @__PURE__ */ jsxs4(
|
|
552
|
-
Box,
|
|
553
|
-
{
|
|
554
|
-
style: {
|
|
555
|
-
display: "flex",
|
|
556
|
-
flexDirection: "column",
|
|
557
|
-
justifyContent: "center",
|
|
558
|
-
alignItems: "center",
|
|
559
|
-
height: "100%"
|
|
560
|
-
},
|
|
561
|
-
onClick: fileInputClick,
|
|
562
|
-
ref: fileInput,
|
|
563
|
-
children: [
|
|
564
|
-
/* @__PURE__ */ jsxs4(Typography, { variant: "body1", align: "center", style: { marginTop: "auto" }, children: [
|
|
565
|
-
"Drag & Drop or Click to Upload Your File Here ",
|
|
566
|
-
/* @__PURE__ */ jsx9("sup", { children: "*" })
|
|
567
|
-
] }),
|
|
568
|
-
/* @__PURE__ */ jsx9(Typography, { variant: "body2", align: "center", style: { marginTop: "auto", fontSize: "0.8rem", fontStyle: "italic" }, children: "* Warning: The file you are uploading may contain sensitive information protected under privacy laws. Please ensure all PHI is anonymized before proceeding.Before proceeding. The user is the sole responsible for data anonymization." })
|
|
569
|
-
]
|
|
570
|
-
}
|
|
571
|
-
) })
|
|
572
|
-
}
|
|
573
|
-
),
|
|
574
|
-
/* @__PURE__ */ jsx9(
|
|
575
|
-
"input",
|
|
576
|
-
{
|
|
577
|
-
type: "file",
|
|
578
|
-
id: "file-window",
|
|
579
|
-
multiple: true,
|
|
580
|
-
accept: fileExtension === void 0 ? "*" : Array.isArray(fileExtension) ? fileExtension.join(",") : fileExtension,
|
|
581
|
-
style: { display: "none" },
|
|
582
|
-
onChange: loadSelectedFiles
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
/* @__PURE__ */ jsxs4(Box, { component: "form", sx: { "& .MuiTextField-root": { m: 2, width: "25ch", mb: 0 } }, children: [
|
|
586
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
587
|
-
template.showFileName && /* @__PURE__ */ jsx9(
|
|
588
|
-
TextField,
|
|
589
|
-
{
|
|
590
|
-
required: true,
|
|
591
|
-
style: { marginTop: "30px" },
|
|
592
|
-
label: `File Alias:`,
|
|
593
|
-
value: fileAlias,
|
|
594
|
-
variant: "standard",
|
|
595
|
-
onChange: changeFileName
|
|
596
|
-
}
|
|
597
|
-
),
|
|
598
|
-
fileOriginalName != "" && /* @__PURE__ */ jsx9(Label_default, { style: { marginLeft: "16px", fontSize: "9pt", color: "#267833" }, children: fileOriginalName }),
|
|
599
|
-
template.showDatabase && /* @__PURE__ */ jsx9(
|
|
600
|
-
TextField,
|
|
601
|
-
{
|
|
602
|
-
select: true,
|
|
603
|
-
label: "Database:",
|
|
604
|
-
defaultValue: "s3",
|
|
605
|
-
helperText: "Upstream Storage Location",
|
|
606
|
-
variant: "standard",
|
|
607
|
-
children: [{ value: "s3", label: "S3" }].map((option) => /* @__PURE__ */ jsx9(MenuItem, { value: option.value, children: option.label }, option.value))
|
|
608
|
-
}
|
|
609
|
-
)
|
|
610
|
-
] }),
|
|
611
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
612
|
-
template.showFileSize && /* @__PURE__ */ jsx9(
|
|
613
|
-
TextField,
|
|
614
|
-
{
|
|
615
|
-
label: "File Size:",
|
|
616
|
-
value: fileSize,
|
|
617
|
-
InputProps: {
|
|
618
|
-
readOnly: true
|
|
619
|
-
},
|
|
620
|
-
variant: "standard"
|
|
621
|
-
}
|
|
622
|
-
),
|
|
623
|
-
/* @__PURE__ */ jsx9(Collapse, { in: infoOpen, children: /* @__PURE__ */ jsx9(Alert, { severity: infoStyle, sx: { m: 1 }, children: warningText }) })
|
|
624
|
-
] })
|
|
625
|
-
] })
|
|
626
|
-
] }),
|
|
627
|
-
/* @__PURE__ */ jsxs4(DialogActions, { children: [
|
|
628
|
-
/* @__PURE__ */ jsx9(
|
|
629
|
-
Button2,
|
|
630
|
-
{
|
|
631
|
-
variant: "outlined",
|
|
632
|
-
disabled: UpBtnDisabled,
|
|
633
|
-
onClick: handleClose,
|
|
634
|
-
children: "Cancel"
|
|
635
|
-
}
|
|
636
|
-
),
|
|
637
|
-
/* @__PURE__ */ jsx9(
|
|
638
|
-
Button2,
|
|
639
|
-
{
|
|
640
|
-
variant: "contained",
|
|
641
|
-
disabled: UpBtnDisabled,
|
|
642
|
-
onClick: handleConfirm,
|
|
643
|
-
children: UpBtnText
|
|
644
|
-
}
|
|
645
|
-
)
|
|
646
|
-
] })
|
|
647
|
-
] })
|
|
648
|
-
] }) });
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// src/CmrComponents/upload/Upload.tsx
|
|
652
|
-
import axios from "axios";
|
|
653
|
-
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
654
|
-
var CmrUpload = (props) => {
|
|
655
|
-
let [open, setOpen] = useState4(false);
|
|
656
|
-
let [uploading, setUploading] = useState4(false);
|
|
657
|
-
let [progress, setProgress] = useState4(0);
|
|
658
|
-
let [uploadedFile, setUploadedFile] = useState4(void 0);
|
|
659
|
-
const upload = async (file, fileAlias, fileDatabase) => {
|
|
660
|
-
setUploading(true);
|
|
661
|
-
const onProgress = (progress2) => {
|
|
662
|
-
let percentage = progress2 * 99;
|
|
663
|
-
props.uploadProgressed && props.uploadProgressed(+percentage.toFixed(2));
|
|
664
|
-
setProgress(+percentage.toFixed(2));
|
|
665
|
-
};
|
|
666
|
-
if (props.uploadStarted)
|
|
667
|
-
props.uploadStarted();
|
|
668
|
-
let status = 0;
|
|
669
|
-
if (props.beforeUpload != void 0 && !await props.beforeUpload(file)) {
|
|
670
|
-
if (props.uploadEnded)
|
|
671
|
-
props.uploadEnded();
|
|
672
|
-
setUploading(false);
|
|
673
|
-
return 200;
|
|
674
|
-
}
|
|
675
|
-
if (props.preprocess) {
|
|
676
|
-
let processed = await props.preprocess(file);
|
|
677
|
-
if (processed == void 0)
|
|
678
|
-
return failUpload();
|
|
679
|
-
if (typeof processed == "number") {
|
|
680
|
-
setUploading(false);
|
|
681
|
-
return processed;
|
|
682
|
-
}
|
|
683
|
-
file = processed;
|
|
684
|
-
}
|
|
685
|
-
if (props.uploadHandler != void 0) {
|
|
686
|
-
status = await props.uploadHandler(file, fileAlias, fileDatabase, onProgress, props.onUploaded);
|
|
687
|
-
setUploadedFile(props.reusable ? void 0 : file.name);
|
|
688
|
-
} else if (props.createPayload) {
|
|
689
|
-
let payload = await props.createPayload(file, fileAlias, fileDatabase);
|
|
690
|
-
if (payload == void 0) {
|
|
691
|
-
return failUpload();
|
|
692
|
-
}
|
|
693
|
-
payload.config.onUploadProgress = (progressEvent) => {
|
|
694
|
-
if (progressEvent.total == void 0)
|
|
695
|
-
return;
|
|
696
|
-
onProgress(progressEvent.loaded / progressEvent.total);
|
|
697
|
-
};
|
|
698
|
-
const res = await axios.post(payload.destination, payload.lambdaFile, payload.config);
|
|
699
|
-
status = res.status;
|
|
700
|
-
if (status === 200) {
|
|
701
|
-
console.log(res.data);
|
|
702
|
-
await axios.put(res.data.upload_url, payload.file, {
|
|
703
|
-
headers: {
|
|
704
|
-
"Content-Type": payload.file.type
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
await props.onUploaded(res, payload.file);
|
|
708
|
-
setUploadedFile(props.reusable ? void 0 : payload.file.name);
|
|
709
|
-
}
|
|
710
|
-
} else {
|
|
711
|
-
return failUpload();
|
|
712
|
-
}
|
|
713
|
-
if (props.uploadEnded)
|
|
714
|
-
props.uploadEnded();
|
|
715
|
-
setUploading(false);
|
|
716
|
-
setProgress(0);
|
|
717
|
-
return status;
|
|
718
|
-
};
|
|
719
|
-
function failUpload() {
|
|
720
|
-
setUploading(false);
|
|
721
|
-
setProgress(0);
|
|
722
|
-
if (props.uploadFailed)
|
|
723
|
-
return props.uploadFailed();
|
|
724
|
-
return 0;
|
|
725
|
-
}
|
|
726
|
-
return /* @__PURE__ */ jsxs5(React5.Fragment, { children: [
|
|
727
|
-
!uploading ? /* @__PURE__ */ jsxs5(
|
|
728
|
-
Button3,
|
|
729
|
-
{
|
|
730
|
-
fullWidth: props.fullWidth,
|
|
731
|
-
style: props.style,
|
|
732
|
-
variant: uploadedFile == void 0 ? "contained" : "outlined",
|
|
733
|
-
onClick: () => {
|
|
734
|
-
setOpen(true);
|
|
735
|
-
},
|
|
736
|
-
color: props.color || "primary",
|
|
737
|
-
sx: props.sx,
|
|
738
|
-
children: [
|
|
739
|
-
/* @__PURE__ */ jsx10(UploadIcon, { className: "me-2" }),
|
|
740
|
-
props.changeNameAfterUpload ? uploadedFile === void 0 ? props.uploadButtonName ? props.uploadButtonName : "Upload" : uploadedFile : props.uploadButtonName ? props.uploadButtonName : "Upload",
|
|
741
|
-
" "
|
|
742
|
-
]
|
|
743
|
-
}
|
|
744
|
-
) : /* @__PURE__ */ jsxs5(Button3, { fullWidth: props.fullWidth, style: props.style, variant: "contained", sx: { overflowWrap: "inherit" }, color: "primary", disabled: true, children: [
|
|
745
|
-
"Uploading ",
|
|
746
|
-
progress,
|
|
747
|
-
"%"
|
|
748
|
-
] }),
|
|
749
|
-
/* @__PURE__ */ jsx10(
|
|
750
|
-
CmrUploadWindow,
|
|
751
|
-
{
|
|
752
|
-
open,
|
|
753
|
-
setOpen,
|
|
754
|
-
upload,
|
|
755
|
-
fileExtension: props.fileExtension,
|
|
756
|
-
template: { showFileName: true, showFileSize: true }
|
|
757
|
-
}
|
|
758
|
-
)
|
|
759
|
-
] });
|
|
760
|
-
};
|
|
761
|
-
CmrUpload.defaultProps = {
|
|
762
|
-
changeNameAfterUpload: true
|
|
763
|
-
};
|
|
764
|
-
var Upload_default = CmrUpload;
|
|
765
|
-
|
|
766
|
-
// src/CmrComponents/rename/edit.tsx
|
|
767
|
-
import * as React6 from "react";
|
|
768
|
-
import { Typography as Typography2 } from "@mui/material";
|
|
769
|
-
import TextField2 from "@mui/material/TextField";
|
|
770
|
-
import Dialog2 from "@mui/material/Dialog";
|
|
771
|
-
import DialogActions2 from "@mui/material/DialogActions";
|
|
772
|
-
import DialogContent2 from "@mui/material/DialogContent";
|
|
773
|
-
import DialogTitle2 from "@mui/material/DialogTitle";
|
|
774
|
-
import { useEffect as useEffect2 } from "react";
|
|
775
|
-
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
776
|
-
function CmrNameDialog(props) {
|
|
777
|
-
let { originalName, open, setOpen } = props;
|
|
778
|
-
const [helperText, setHelperText] = React6.useState("");
|
|
779
|
-
const [text, setText] = React6.useState(originalName);
|
|
780
|
-
const [error, setError] = React6.useState(false);
|
|
781
|
-
const renamingCallback = props.renamingCallback;
|
|
782
|
-
const handleClose = () => {
|
|
783
|
-
setOpen(false);
|
|
784
|
-
};
|
|
785
|
-
useEffect2(() => {
|
|
786
|
-
checkError(originalName);
|
|
787
|
-
}, [originalName]);
|
|
788
|
-
const handleConfirm = async () => {
|
|
789
|
-
if (await renamingCallback(text))
|
|
790
|
-
handleClose();
|
|
791
|
-
};
|
|
792
|
-
const handleTextFieldChange = (e) => {
|
|
793
|
-
setText(e.target.value);
|
|
794
|
-
checkError(e.target.value);
|
|
795
|
-
};
|
|
796
|
-
const checkError = (text2) => {
|
|
797
|
-
const fileNameRegex = /^[a-zA-Z0-9_\-]+\.[a-zA-Z]{1,5}$/;
|
|
798
|
-
let newExtension = text2.split(".").pop();
|
|
799
|
-
let orgExtension = originalName.indexOf(".") >= 0 ? originalName.split(".").pop() : "?";
|
|
800
|
-
if (!fileNameRegex.test(text2)) {
|
|
801
|
-
setError(true);
|
|
802
|
-
if (text2.indexOf(".") < 0) {
|
|
803
|
-
setHelperText("Invalid file name, needs a valid extension.");
|
|
804
|
-
} else {
|
|
805
|
-
setHelperText("Invalid file name, please check.");
|
|
806
|
-
}
|
|
807
|
-
} else if (newExtension !== orgExtension) {
|
|
808
|
-
setHelperText(`You are modifying your file extension from .${orgExtension} to .${newExtension}.`);
|
|
809
|
-
setError(false);
|
|
810
|
-
} else {
|
|
811
|
-
setError(false);
|
|
812
|
-
setHelperText("");
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
return /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsxs6(
|
|
816
|
-
Dialog2,
|
|
817
|
-
{
|
|
818
|
-
open,
|
|
819
|
-
onClose: handleClose,
|
|
820
|
-
fullWidth: true,
|
|
821
|
-
maxWidth: "xs",
|
|
822
|
-
children: [
|
|
823
|
-
/* @__PURE__ */ jsx11(DialogTitle2, { children: /* @__PURE__ */ jsxs6(Typography2, { children: [
|
|
824
|
-
" Rename the File ",
|
|
825
|
-
originalName,
|
|
826
|
-
" as:"
|
|
827
|
-
] }) }),
|
|
828
|
-
/* @__PURE__ */ jsx11(DialogContent2, { children: /* @__PURE__ */ jsx11(
|
|
829
|
-
TextField2,
|
|
830
|
-
{
|
|
831
|
-
autoFocus: true,
|
|
832
|
-
margin: "dense",
|
|
833
|
-
id: "name",
|
|
834
|
-
defaultValue: originalName,
|
|
835
|
-
onFocus: (event) => {
|
|
836
|
-
event.target.select();
|
|
837
|
-
},
|
|
838
|
-
fullWidth: true,
|
|
839
|
-
inputProps: { style: { fontSize: "16px" } },
|
|
840
|
-
variant: "standard",
|
|
841
|
-
onChange: handleTextFieldChange,
|
|
842
|
-
error,
|
|
843
|
-
helperText
|
|
844
|
-
}
|
|
845
|
-
) }),
|
|
846
|
-
/* @__PURE__ */ jsxs6(DialogActions2, { children: [
|
|
847
|
-
/* @__PURE__ */ jsx11(CmrButton_default, { variant: "outlined", onClick: handleClose, children: "Cancel" }),
|
|
848
|
-
/* @__PURE__ */ jsx11(CmrButton_default, { variant: "contained", color: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
849
|
-
] })
|
|
850
|
-
]
|
|
851
|
-
}
|
|
852
|
-
) });
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
// src/CmrComponents/dialogue/Confirmation.tsx
|
|
856
|
-
import Dialog3 from "@mui/material/Dialog";
|
|
857
|
-
import DialogActions3 from "@mui/material/DialogActions";
|
|
858
|
-
import DialogContent3 from "@mui/material/DialogContent";
|
|
859
|
-
import DialogContentText2 from "@mui/material/DialogContentText";
|
|
860
|
-
import DialogTitle3 from "@mui/material/DialogTitle";
|
|
861
|
-
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
862
|
-
function CmrConfirmation({
|
|
863
|
-
name,
|
|
864
|
-
message,
|
|
865
|
-
cancelText = "Cancel",
|
|
866
|
-
confirmText = "Confirm",
|
|
867
|
-
color,
|
|
868
|
-
open,
|
|
869
|
-
setOpen,
|
|
870
|
-
confirmCallback = () => {
|
|
871
|
-
},
|
|
872
|
-
cancelCallback = () => {
|
|
873
|
-
},
|
|
874
|
-
cancellable = false,
|
|
875
|
-
width,
|
|
876
|
-
extraButtons = []
|
|
877
|
-
}) {
|
|
878
|
-
const handleClose = () => {
|
|
879
|
-
setOpen(false);
|
|
880
|
-
};
|
|
881
|
-
const handleConfirm = () => {
|
|
882
|
-
confirmCallback();
|
|
883
|
-
handleClose();
|
|
884
|
-
};
|
|
885
|
-
const handleCancel = () => {
|
|
886
|
-
cancelCallback();
|
|
887
|
-
handleClose();
|
|
888
|
-
};
|
|
889
|
-
return /* @__PURE__ */ jsxs7(Dialog3, { open, onClose: handleClose, children: [
|
|
890
|
-
/* @__PURE__ */ jsx12(DialogTitle3, { children: name ? name : "Confirmation" }),
|
|
891
|
-
/* @__PURE__ */ jsxs7(DialogContent3, { sx: { width }, children: [
|
|
892
|
-
/* @__PURE__ */ jsx12(DialogContentText2, { alignContent: "center", children: message }),
|
|
893
|
-
/* @__PURE__ */ jsxs7(DialogActions3, { className: "mt-4", children: [
|
|
894
|
-
cancellable && /* @__PURE__ */ jsx12(CmrButton_default, { variant: "outlined", onClick: handleCancel, children: cancelText }),
|
|
895
|
-
extraButtons.map((btn, idx) => /* @__PURE__ */ jsx12(
|
|
896
|
-
CmrButton_default,
|
|
897
|
-
{
|
|
898
|
-
variant: "outlined",
|
|
899
|
-
color: btn.color || "success",
|
|
900
|
-
onClick: () => {
|
|
901
|
-
btn.onClick();
|
|
902
|
-
handleClose();
|
|
903
|
-
},
|
|
904
|
-
children: btn.text
|
|
905
|
-
},
|
|
906
|
-
idx
|
|
907
|
-
)),
|
|
908
|
-
/* @__PURE__ */ jsx12(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
|
|
909
|
-
] })
|
|
910
|
-
] })
|
|
911
|
-
] });
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// src/CmrComponents/dialogue/DeletionDialog.tsx
|
|
915
|
-
import * as React7 from "react";
|
|
916
|
-
import TextField3 from "@mui/material/TextField";
|
|
917
|
-
import Dialog4 from "@mui/material/Dialog";
|
|
918
|
-
import DialogActions4 from "@mui/material/DialogActions";
|
|
919
|
-
import DialogContent4 from "@mui/material/DialogContent";
|
|
920
|
-
import DialogContentText3 from "@mui/material/DialogContentText";
|
|
921
|
-
import DialogTitle4 from "@mui/material/DialogTitle";
|
|
922
|
-
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
923
|
-
function CmrDeletionDialog(props) {
|
|
924
|
-
const [open, setOpen] = React7.useState(true);
|
|
925
|
-
const [text, setText] = React7.useState("");
|
|
926
|
-
const handleClickOpen = () => {
|
|
927
|
-
setOpen(true);
|
|
928
|
-
};
|
|
929
|
-
const handleClose = () => {
|
|
930
|
-
setOpen(false);
|
|
931
|
-
};
|
|
932
|
-
const handleConfirm = () => {
|
|
933
|
-
if (text === props.name) {
|
|
934
|
-
props.deletionCallback();
|
|
935
|
-
setOpen(false);
|
|
936
|
-
}
|
|
937
|
-
};
|
|
938
|
-
const handleTextFieldChange = (e) => {
|
|
939
|
-
setText(e.target.value);
|
|
940
|
-
};
|
|
941
|
-
return /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsxs8(Dialog4, { open, onClose: handleClose, children: [
|
|
942
|
-
/* @__PURE__ */ jsx13(DialogTitle4, { children: "Confirmation" }),
|
|
943
|
-
/* @__PURE__ */ jsxs8(DialogContent4, { children: [
|
|
944
|
-
/* @__PURE__ */ jsx13(DialogContentText3, { children: "To delete the files, please type your full name below and confirm." }),
|
|
945
|
-
/* @__PURE__ */ jsx13(
|
|
946
|
-
TextField3,
|
|
947
|
-
{
|
|
948
|
-
autoFocus: true,
|
|
949
|
-
margin: "dense",
|
|
950
|
-
id: "name",
|
|
951
|
-
type: "email",
|
|
952
|
-
placeholder: props.name,
|
|
953
|
-
fullWidth: true,
|
|
954
|
-
inputProps: { style: { fontSize: "16pt" } },
|
|
955
|
-
variant: "standard",
|
|
956
|
-
onChange: handleTextFieldChange
|
|
957
|
-
}
|
|
958
|
-
)
|
|
959
|
-
] }),
|
|
960
|
-
/* @__PURE__ */ jsxs8(DialogActions4, { children: [
|
|
961
|
-
/* @__PURE__ */ jsx13("button", { className: "btn btn-secondary", onClick: handleClose, children: "Cancel" }),
|
|
962
|
-
/* @__PURE__ */ jsx13("button", { className: "btn btn-danger", onClick: handleConfirm, children: "Confirm" })
|
|
963
|
-
] })
|
|
964
|
-
] }) });
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
// src/CmrComponents/dialogue/EditConfirmation.tsx
|
|
968
|
-
import * as React8 from "react";
|
|
969
|
-
import TextField4 from "@mui/material/TextField";
|
|
970
|
-
import Dialog5 from "@mui/material/Dialog";
|
|
971
|
-
import DialogActions5 from "@mui/material/DialogActions";
|
|
972
|
-
import DialogContent5 from "@mui/material/DialogContent";
|
|
973
|
-
import DialogContentText4 from "@mui/material/DialogContentText";
|
|
974
|
-
import DialogTitle5 from "@mui/material/DialogTitle";
|
|
975
|
-
import { InputAdornment } from "@mui/material";
|
|
976
|
-
import { useEffect as useEffect3 } from "react";
|
|
977
|
-
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
978
|
-
function CmrEditConfirmation({
|
|
979
|
-
name,
|
|
980
|
-
message,
|
|
981
|
-
defaultText = "",
|
|
982
|
-
color,
|
|
983
|
-
open,
|
|
984
|
-
setOpen,
|
|
985
|
-
confirmCallback = () => {
|
|
986
|
-
},
|
|
987
|
-
cancellable = false,
|
|
988
|
-
cancelCallback = () => {
|
|
989
|
-
},
|
|
990
|
-
suffix = ""
|
|
991
|
-
}) {
|
|
992
|
-
const [text, setText] = React8.useState(defaultText);
|
|
993
|
-
useEffect3(() => {
|
|
994
|
-
if (open)
|
|
995
|
-
setText(defaultText);
|
|
996
|
-
}, [open]);
|
|
997
|
-
const handleClose = () => {
|
|
998
|
-
setOpen(false);
|
|
999
|
-
};
|
|
1000
|
-
const handleConfirm = () => {
|
|
1001
|
-
confirmCallback(text + suffix);
|
|
1002
|
-
handleClose();
|
|
1003
|
-
};
|
|
1004
|
-
const handleCancel = () => {
|
|
1005
|
-
cancelCallback(text + suffix);
|
|
1006
|
-
handleClose();
|
|
1007
|
-
};
|
|
1008
|
-
return /* @__PURE__ */ jsxs9(Dialog5, { maxWidth: "xs", fullWidth: true, open, onClose: handleCancel, children: [
|
|
1009
|
-
/* @__PURE__ */ jsx14(DialogTitle5, { children: name ? name : "Confirmation" }),
|
|
1010
|
-
/* @__PURE__ */ jsxs9(DialogContent5, { children: [
|
|
1011
|
-
/* @__PURE__ */ jsx14(DialogContentText4, { alignContent: "center", children: message }),
|
|
1012
|
-
/* @__PURE__ */ jsx14(DialogActions5, { children: /* @__PURE__ */ jsx14(
|
|
1013
|
-
TextField4,
|
|
1014
|
-
{
|
|
1015
|
-
fullWidth: true,
|
|
1016
|
-
variant: "standard",
|
|
1017
|
-
InputProps: {
|
|
1018
|
-
endAdornment: /* @__PURE__ */ jsx14(InputAdornment, { position: "end", sx: { whiteSpace: "nowrap" }, children: suffix })
|
|
1019
|
-
},
|
|
1020
|
-
defaultValue: text,
|
|
1021
|
-
onChange: (e) => setText(e.target.value)
|
|
1022
|
-
}
|
|
1023
|
-
) }),
|
|
1024
|
-
/* @__PURE__ */ jsxs9(DialogActions5, { children: [
|
|
1025
|
-
cancellable && /* @__PURE__ */ jsx14(CmrButton_default, { variant: "outlined", onClick: handleCancel, children: "Cancel" }),
|
|
1026
|
-
/* @__PURE__ */ jsx14(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: "Confirm" })
|
|
1027
|
-
] })
|
|
1028
|
-
] })
|
|
1029
|
-
] });
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
// src/CmrTabs/CmrTabs.tsx
|
|
1033
|
-
import * as React9 from "react";
|
|
1034
|
-
import Tabs from "@mui/material/Tabs";
|
|
1035
|
-
import Tab from "@mui/material/Tab";
|
|
1036
|
-
import Container from "@mui/material/Container";
|
|
1037
|
-
import Typography3 from "@mui/material/Typography";
|
|
1038
|
-
import Box3 from "@mui/material/Box";
|
|
1039
|
-
import { cloneElement as cloneElement2 } from "react";
|
|
1040
|
-
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1041
|
-
function CustomTabPanel(props) {
|
|
1042
|
-
const { children, value, index, ...other } = props;
|
|
1043
|
-
return /* @__PURE__ */ jsx15(
|
|
1044
|
-
"div",
|
|
1045
|
-
{
|
|
1046
|
-
role: "tabpanel",
|
|
1047
|
-
hidden: value !== index,
|
|
1048
|
-
id: `simple-tabpanel-${index}`,
|
|
1049
|
-
"aria-labelledby": `simple-tab-${index}`,
|
|
1050
|
-
...other,
|
|
1051
|
-
children: /* @__PURE__ */ jsx15(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx15(Typography3, { children }) })
|
|
1052
|
-
}
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
function a11yProps(index) {
|
|
1056
|
-
return {
|
|
1057
|
-
id: `simple-tab-${index}`,
|
|
1058
|
-
"aria-controls": `simple-tabpanel-${index}`
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
function CmrTabs(props) {
|
|
1062
|
-
const [value, setValue] = React9.useState(0);
|
|
1063
|
-
const handleChange = (event, newValue) => {
|
|
1064
|
-
setValue(newValue);
|
|
1065
|
-
if (props.onTabSelected)
|
|
1066
|
-
props.onTabSelected(newValue);
|
|
1067
|
-
};
|
|
1068
|
-
return /* @__PURE__ */ jsxs10(
|
|
1069
|
-
Container,
|
|
1070
|
-
{
|
|
1071
|
-
maxWidth: "lg",
|
|
1072
|
-
sx: {
|
|
1073
|
-
flex: 1,
|
|
1074
|
-
display: "flex",
|
|
1075
|
-
flexDirection: "column",
|
|
1076
|
-
mt: 4
|
|
1077
|
-
},
|
|
1078
|
-
children: [
|
|
1079
|
-
/* @__PURE__ */ jsx15(Box3, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ jsx15(
|
|
1080
|
-
Tabs,
|
|
1081
|
-
{
|
|
1082
|
-
value,
|
|
1083
|
-
onChange: handleChange,
|
|
1084
|
-
"aria-label": "basic tabs example",
|
|
1085
|
-
textColor: "inherit",
|
|
1086
|
-
TabIndicatorProps: {
|
|
1087
|
-
style: {
|
|
1088
|
-
backgroundColor: "#580F8B"
|
|
1089
|
-
}
|
|
1090
|
-
},
|
|
1091
|
-
children: props.tabList.map((tab, index) => /* @__PURE__ */ jsx15(Tab, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
|
|
1092
|
-
}
|
|
1093
|
-
) }),
|
|
1094
|
-
props.tabList.map(
|
|
1095
|
-
(tab, index) => /* @__PURE__ */ jsx15(CustomTabPanel, { value, index, children: cloneElement2(tab.children, {
|
|
1096
|
-
visible: value == index
|
|
1097
|
-
}) })
|
|
1098
|
-
)
|
|
1099
|
-
]
|
|
1100
|
-
}
|
|
1101
|
-
);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
// src/CmrComponents/checkbox/Checkbox.tsx
|
|
1105
|
-
import { Checkbox as Checkbox2 } from "@mui/material";
|
|
1106
|
-
import { FormControlLabel as FormControlLabel3 } from "@mui/material";
|
|
1107
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1108
|
-
var CmrCheckbox = (props) => {
|
|
1109
|
-
const { defaultChecked, onChange, children, ...rest } = props;
|
|
1110
|
-
return /* @__PURE__ */ jsx16(
|
|
1111
|
-
FormControlLabel3,
|
|
1112
|
-
{
|
|
1113
|
-
disabled: props.disabled,
|
|
1114
|
-
style: props.style,
|
|
1115
|
-
className: props.className,
|
|
1116
|
-
control: /* @__PURE__ */ jsx16(Checkbox2, { style: props.style, checked: props.checked, defaultChecked, onChange }),
|
|
1117
|
-
label: /* @__PURE__ */ jsx16(Label_default, { children: props.children }),
|
|
1118
|
-
sx: props.sx,
|
|
1119
|
-
labelPlacement: "end"
|
|
1120
|
-
}
|
|
1121
|
-
);
|
|
1122
|
-
};
|
|
1123
|
-
var Checkbox_default = CmrCheckbox;
|
|
1124
|
-
|
|
1125
|
-
// src/CmrComponents/input-number/InputNumber.tsx
|
|
1126
|
-
import { InputNumber } from "antd";
|
|
1127
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1128
|
-
var CmrInputNumber = (props) => {
|
|
1129
|
-
const { defaultValue, style, max, min, value, onChange, children, ...rest } = props;
|
|
1130
|
-
return /* @__PURE__ */ jsx17(InputNumber, { defaultValue, max, style, min, value, onChange, ...rest, children });
|
|
1131
|
-
};
|
|
1132
|
-
var InputNumber_default = CmrInputNumber;
|
|
1133
|
-
|
|
1134
|
-
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1135
|
-
import React10, { Fragment } from "react";
|
|
1136
|
-
import { Button as Button4 } from "@mui/material";
|
|
1137
|
-
import Select from "react-select";
|
|
1138
|
-
import Dialog6 from "@mui/material/Dialog";
|
|
1139
|
-
import DialogTitle6 from "@mui/material/DialogTitle";
|
|
1140
|
-
import DialogContent6 from "@mui/material/DialogContent";
|
|
1141
|
-
import DialogContentText5 from "@mui/material/DialogContentText";
|
|
1142
|
-
import Box4 from "@mui/material/Box";
|
|
1143
|
-
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1144
|
-
function checkExtension(filename, allowed) {
|
|
1145
|
-
if (!filename || !allowed)
|
|
1146
|
-
return true;
|
|
1147
|
-
const name = filename.toLowerCase();
|
|
1148
|
-
if (Array.isArray(allowed)) {
|
|
1149
|
-
return allowed.some((ext) => name.endsWith(ext.startsWith(".") ? ext : "." + ext));
|
|
1150
|
-
} else {
|
|
1151
|
-
return name.endsWith(allowed.startsWith(".") ? allowed : "." + allowed);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
var CMRSelectUpload = (props) => {
|
|
1155
|
-
let [open, setOpen] = React10.useState(false);
|
|
1156
|
-
let [fileIndex, selectFileIndex] = React10.useState(-1);
|
|
1157
|
-
let [uploading, setUploading] = React10.useState(false);
|
|
1158
|
-
const [progress, setProgress] = React10.useState(0);
|
|
1159
|
-
const handleClickOpen = () => {
|
|
1160
|
-
selectFileIndex(-1);
|
|
1161
|
-
setOpen(true);
|
|
1162
|
-
};
|
|
1163
|
-
const handleClose = () => {
|
|
1164
|
-
setOpen(false);
|
|
1165
|
-
};
|
|
1166
|
-
const onSet = () => {
|
|
1167
|
-
props.onSelected(props.fileSelection[fileIndex]);
|
|
1168
|
-
setOpen(false);
|
|
1169
|
-
};
|
|
1170
|
-
const selectionDialog = /* @__PURE__ */ jsxs11(Dialog6, { open, onClose: handleClose, children: [
|
|
1171
|
-
/* @__PURE__ */ jsx18(DialogTitle6, { children: "Select or Upload" }),
|
|
1172
|
-
/* @__PURE__ */ jsxs11(DialogContent6, { sx: { width: 520 }, children: [
|
|
1173
|
-
/* @__PURE__ */ jsx18(DialogContentText5, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
|
|
1174
|
-
/* @__PURE__ */ jsx18(Box4, { sx: { p: 1 }, children: /* @__PURE__ */ jsx18(
|
|
1175
|
-
Select,
|
|
1176
|
-
{
|
|
1177
|
-
classNamePrefix: "cmr-select",
|
|
1178
|
-
isDisabled: uploading,
|
|
1179
|
-
options: props.fileSelection.filter((file) => checkExtension(file.fileName, props.fileExtension)).map((file) => ({
|
|
1180
|
-
value: file.id,
|
|
1181
|
-
label: file.fileName
|
|
1182
|
-
})),
|
|
1183
|
-
placeholder: "Select a Stored File",
|
|
1184
|
-
onChange: (selected) => {
|
|
1185
|
-
if (selected) {
|
|
1186
|
-
const index = props.fileSelection.findIndex((file) => file.id === selected.value);
|
|
1187
|
-
selectFileIndex(index);
|
|
1188
|
-
} else {
|
|
1189
|
-
selectFileIndex(-1);
|
|
1190
|
-
}
|
|
1191
|
-
},
|
|
1192
|
-
menuPortalTarget: document.body,
|
|
1193
|
-
menuPosition: "fixed",
|
|
1194
|
-
styles: props.selectStyles
|
|
1195
|
-
}
|
|
1196
|
-
) }),
|
|
1197
|
-
/* @__PURE__ */ jsxs11(Box4, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1198
|
-
/* @__PURE__ */ jsx18(Button4, { fullWidth: true, sx: { marginRight: "8px" }, variant: "outlined", onClick: handleClose, children: " Cancel" }),
|
|
1199
|
-
fileIndex !== -1 && !uploading && /* @__PURE__ */ jsx18(Button4, { fullWidth: true, variant: "contained", onClick: onSet, children: "OK" }),
|
|
1200
|
-
fileIndex == -1 && /* @__PURE__ */ jsx18(
|
|
1201
|
-
Upload_default,
|
|
1202
|
-
{
|
|
1203
|
-
...props,
|
|
1204
|
-
color: "info",
|
|
1205
|
-
fullWidth: true,
|
|
1206
|
-
onUploaded: (res, file) => {
|
|
1207
|
-
console.log("calling Setup level on uploaded");
|
|
1208
|
-
console.log(props.onUploaded);
|
|
1209
|
-
selectFileIndex(props.fileSelection.length);
|
|
1210
|
-
props.onUploaded(res, file);
|
|
1211
|
-
setOpen(false);
|
|
1212
|
-
},
|
|
1213
|
-
fileExtension: props.fileExtension,
|
|
1214
|
-
uploadHandler: props.uploadHandler,
|
|
1215
|
-
uploadStarted: () => {
|
|
1216
|
-
setUploading(true);
|
|
1217
|
-
props.onSelected(void 0);
|
|
1218
|
-
},
|
|
1219
|
-
uploadProgressed: (progress2) => {
|
|
1220
|
-
setOpen(false);
|
|
1221
|
-
setProgress(progress2);
|
|
1222
|
-
},
|
|
1223
|
-
uploadEnded: () => setUploading(false)
|
|
1224
|
-
}
|
|
1225
|
-
)
|
|
1226
|
-
] })
|
|
1227
|
-
] })
|
|
1228
|
-
] });
|
|
1229
|
-
return /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
1230
|
-
uploading ? /* @__PURE__ */ jsxs11(Button4, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
|
|
1231
|
-
"Uploading ",
|
|
1232
|
-
progress,
|
|
1233
|
-
"%"
|
|
1234
|
-
] }) : /* @__PURE__ */ jsx18(
|
|
1235
|
-
Button4,
|
|
1236
|
-
{
|
|
1237
|
-
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1238
|
-
color: "info",
|
|
1239
|
-
onClick: handleClickOpen,
|
|
1240
|
-
sx: { marginRight: "10pt" },
|
|
1241
|
-
style: { ...props.style, textTransform: "none" },
|
|
1242
|
-
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1243
|
-
}
|
|
1244
|
-
),
|
|
1245
|
-
selectionDialog
|
|
1246
|
-
] });
|
|
1247
|
-
};
|
|
1248
|
-
var SelectUpload_default = CMRSelectUpload;
|
|
1249
|
-
|
|
1250
|
-
// src/CmrComponents/tooltip/Tooltip.tsx
|
|
1251
|
-
import { Tooltip } from "antd";
|
|
1252
|
-
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1253
|
-
var CmrTooltip = (props) => {
|
|
1254
|
-
const {
|
|
1255
|
-
arrowPointAtCenter,
|
|
1256
|
-
autoAdjustOverflow,
|
|
1257
|
-
color,
|
|
1258
|
-
defaultVisible,
|
|
1259
|
-
mouseEnterDelay,
|
|
1260
|
-
mouseLeaveDelay,
|
|
1261
|
-
overlayClassName,
|
|
1262
|
-
placement,
|
|
1263
|
-
visible,
|
|
1264
|
-
...rest
|
|
1265
|
-
} = props;
|
|
1266
|
-
return /* @__PURE__ */ jsx19(
|
|
1267
|
-
Tooltip,
|
|
1268
|
-
{
|
|
1269
|
-
arrowPointAtCenter,
|
|
1270
|
-
autoAdjustOverflow,
|
|
1271
|
-
color,
|
|
1272
|
-
defaultVisible,
|
|
1273
|
-
mouseEnterDelay,
|
|
1274
|
-
mouseLeaveDelay,
|
|
1275
|
-
overlayClassName,
|
|
1276
|
-
placement,
|
|
1277
|
-
visible,
|
|
1278
|
-
...rest
|
|
1279
|
-
}
|
|
1280
|
-
);
|
|
1281
|
-
};
|
|
1282
|
-
var Tooltip_default = CmrTooltip;
|
|
1283
|
-
|
|
1284
|
-
// src/CmrTable/CmrTable.tsx
|
|
1285
|
-
import { DataGrid } from "@mui/x-data-grid";
|
|
1286
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1287
|
-
var CmrTable = (props) => {
|
|
1288
|
-
const {
|
|
1289
|
-
dataSource,
|
|
1290
|
-
columns,
|
|
1291
|
-
idAlias,
|
|
1292
|
-
className,
|
|
1293
|
-
onRowSelectionModelChange,
|
|
1294
|
-
style,
|
|
1295
|
-
showCheckbox = true,
|
|
1296
|
-
...rest
|
|
1297
|
-
} = props;
|
|
1298
|
-
return /* @__PURE__ */ jsx20("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx20(
|
|
1299
|
-
DataGrid,
|
|
1300
|
-
{
|
|
1301
|
-
rows: dataSource ? dataSource.map((row) => ({
|
|
1302
|
-
id: idAlias ? row[idAlias] : row["id"],
|
|
1303
|
-
...row
|
|
1304
|
-
})) : [],
|
|
1305
|
-
columns,
|
|
1306
|
-
checkboxSelection: showCheckbox,
|
|
1307
|
-
onRowSelectionModelChange,
|
|
1308
|
-
initialState: {
|
|
1309
|
-
pagination: {
|
|
1310
|
-
paginationModel: { pageSize: 50, page: 0 }
|
|
1311
|
-
}
|
|
1312
|
-
},
|
|
1313
|
-
sx: {
|
|
1314
|
-
"& .MuiDataGrid-columnHeaders": {
|
|
1315
|
-
backgroundColor: "#F3E5F5",
|
|
1316
|
-
color: "#333"
|
|
1317
|
-
},
|
|
1318
|
-
"& .MuiDataGrid-columnHeaders .MuiSvgIcon-root": {
|
|
1319
|
-
color: "#580f8b"
|
|
1320
|
-
},
|
|
1321
|
-
"& .MuiDataGrid-columnHeaderTitle": {
|
|
1322
|
-
fontWeight: "bold"
|
|
1323
|
-
}
|
|
1324
|
-
},
|
|
1325
|
-
localeText: { noRowsLabel: "No Rows" },
|
|
1326
|
-
...rest
|
|
1327
|
-
}
|
|
1328
|
-
) });
|
|
1329
|
-
};
|
|
1330
|
-
var CmrTable_default = CmrTable;
|
|
1331
|
-
|
|
1332
|
-
// src/index.ts
|
|
1333
|
-
var CmrTable2 = CmrTable_default;
|
|
1334
|
-
export {
|
|
1335
|
-
SelectUpload_default as CMRSelectUpload,
|
|
1336
|
-
Upload_default as CMRUpload,
|
|
1337
|
-
CmrButton_default as CmrButton,
|
|
1338
|
-
Checkbox_default as CmrCheckbox,
|
|
1339
|
-
Collapse_default as CmrCollapse,
|
|
1340
|
-
CmrConfirmation,
|
|
1341
|
-
CmrDeletionDialog,
|
|
1342
|
-
CmrEditConfirmation,
|
|
1343
|
-
CmrInput,
|
|
1344
|
-
InputNumber_default as CmrInputNumber,
|
|
1345
|
-
Label_default as CmrLabel,
|
|
1346
|
-
CmrNameDialog,
|
|
1347
|
-
Panel_default as CmrPanel,
|
|
1348
|
-
CmrRadioGroup_default as CmrRadioGroup,
|
|
1349
|
-
CmrSelect_default as CmrSelect,
|
|
1350
|
-
CmrTable2 as CmrTable,
|
|
1351
|
-
CmrTabs,
|
|
1352
|
-
Tooltip_default as CmrTooltip,
|
|
1353
|
-
CmrUploadWindow
|
|
1354
|
-
};
|