cloudmr-ux 1.2.2 → 1.2.3
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/index.css +15 -15
- package/dist/index.d.ts +110 -96
- package/dist/index.js +784 -780
- package/dist/index.mjs +780 -777
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -47,7 +47,8 @@ __export(src_exports, {
|
|
|
47
47
|
CmrSelect: () => CmrSelect_default,
|
|
48
48
|
CmrTable: () => CmrTable2,
|
|
49
49
|
CmrTabs: () => CmrTabs,
|
|
50
|
-
CmrTooltip: () => Tooltip_default
|
|
50
|
+
CmrTooltip: () => Tooltip_default,
|
|
51
|
+
CmrUploadWindow: () => CmrUploadWindow
|
|
51
52
|
});
|
|
52
53
|
module.exports = __toCommonJS(src_exports);
|
|
53
54
|
|
|
@@ -260,865 +261,867 @@ var CmrPanel = function(props) {
|
|
|
260
261
|
};
|
|
261
262
|
var Panel_default = CmrPanel;
|
|
262
263
|
|
|
263
|
-
// src/CmrComponents/
|
|
264
|
-
var import_react4 = __toESM(require("react"));
|
|
265
|
-
var import_material7 = require("@mui/material");
|
|
266
|
-
|
|
267
|
-
// src/CmrComponents/upload/UploadWindow.tsx
|
|
264
|
+
// src/CmrComponents/rename/edit.tsx
|
|
268
265
|
var React4 = __toESM(require("react"));
|
|
269
|
-
var
|
|
266
|
+
var import_material6 = require("@mui/material");
|
|
270
267
|
var import_TextField = __toESM(require("@mui/material/TextField"));
|
|
271
268
|
var import_Dialog = __toESM(require("@mui/material/Dialog"));
|
|
272
269
|
var import_DialogActions = __toESM(require("@mui/material/DialogActions"));
|
|
273
270
|
var import_DialogContent = __toESM(require("@mui/material/DialogContent"));
|
|
274
|
-
var import_DialogContentText = __toESM(require("@mui/material/DialogContentText"));
|
|
275
271
|
var import_DialogTitle = __toESM(require("@mui/material/DialogTitle"));
|
|
276
|
-
var
|
|
277
|
-
var import_Box = __toESM(require("@mui/material/Box"));
|
|
278
|
-
var import_material6 = require("@mui/material");
|
|
279
|
-
|
|
280
|
-
// src/CmrComponents/label/Label.tsx
|
|
272
|
+
var import_react4 = require("react");
|
|
281
273
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
274
|
+
function CmrNameDialog(props) {
|
|
275
|
+
let { originalName, open, setOpen } = props;
|
|
276
|
+
const [helperText, setHelperText] = React4.useState("");
|
|
277
|
+
const [text, setText] = React4.useState(originalName);
|
|
278
|
+
const [error, setError] = React4.useState(false);
|
|
279
|
+
const renamingCallback = props.renamingCallback;
|
|
280
|
+
const handleClose = () => {
|
|
281
|
+
setOpen(false);
|
|
282
|
+
};
|
|
283
|
+
(0, import_react4.useEffect)(() => {
|
|
284
|
+
checkError(originalName);
|
|
285
|
+
}, [originalName]);
|
|
286
|
+
const handleConfirm = async () => {
|
|
287
|
+
if (await renamingCallback(text))
|
|
288
|
+
handleClose();
|
|
289
|
+
};
|
|
290
|
+
const handleTextFieldChange = (e) => {
|
|
291
|
+
setText(e.target.value);
|
|
292
|
+
checkError(e.target.value);
|
|
293
|
+
};
|
|
294
|
+
const checkError = (text2) => {
|
|
295
|
+
const fileNameRegex = /^[a-zA-Z0-9_\-]+\.[a-zA-Z]{1,5}$/;
|
|
296
|
+
let newExtension = text2.split(".").pop();
|
|
297
|
+
let orgExtension = originalName.indexOf(".") >= 0 ? originalName.split(".").pop() : "?";
|
|
298
|
+
if (!fileNameRegex.test(text2)) {
|
|
299
|
+
setError(true);
|
|
300
|
+
if (text2.indexOf(".") < 0) {
|
|
301
|
+
setHelperText("Invalid file name, needs a valid extension.");
|
|
302
|
+
} else {
|
|
303
|
+
setHelperText("Invalid file name, please check.");
|
|
304
|
+
}
|
|
305
|
+
} else if (newExtension !== orgExtension) {
|
|
306
|
+
setHelperText(`You are modifying your file extension from .${orgExtension} to .${newExtension}.`);
|
|
307
|
+
setError(false);
|
|
308
|
+
} else {
|
|
309
|
+
setError(false);
|
|
310
|
+
setHelperText("");
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
314
|
+
import_Dialog.default,
|
|
315
|
+
{
|
|
316
|
+
open,
|
|
317
|
+
onClose: handleClose,
|
|
318
|
+
fullWidth: true,
|
|
319
|
+
maxWidth: "xs",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_DialogTitle.default, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Typography, { children: [
|
|
322
|
+
' Rename "',
|
|
323
|
+
originalName,
|
|
324
|
+
'" as:'
|
|
325
|
+
] }) }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_DialogContent.default, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
327
|
+
import_TextField.default,
|
|
328
|
+
{
|
|
329
|
+
autoFocus: true,
|
|
330
|
+
margin: "dense",
|
|
331
|
+
id: "name",
|
|
332
|
+
defaultValue: originalName,
|
|
333
|
+
onFocus: (event) => {
|
|
334
|
+
event.target.select();
|
|
335
|
+
},
|
|
336
|
+
fullWidth: true,
|
|
337
|
+
inputProps: { style: { fontSize: "16px" } },
|
|
338
|
+
variant: "standard",
|
|
339
|
+
onChange: handleTextFieldChange,
|
|
340
|
+
error,
|
|
341
|
+
helperText
|
|
342
|
+
}
|
|
343
|
+
) }),
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_DialogActions.default, { children: [
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CmrButton_default, { variant: "outlined", onClick: handleClose, children: "Cancel" }),
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CmrButton_default, { variant: "contained", color: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
347
|
+
] })
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
) });
|
|
351
|
+
}
|
|
290
352
|
|
|
291
|
-
// src/CmrComponents/
|
|
353
|
+
// src/CmrComponents/dialogue/Confirmation.tsx
|
|
354
|
+
var React5 = __toESM(require("react"));
|
|
355
|
+
var import_Dialog2 = __toESM(require("@mui/material/Dialog"));
|
|
356
|
+
var import_DialogActions2 = __toESM(require("@mui/material/DialogActions"));
|
|
357
|
+
var import_DialogContent2 = __toESM(require("@mui/material/DialogContent"));
|
|
358
|
+
var import_DialogContentText = __toESM(require("@mui/material/DialogContentText"));
|
|
359
|
+
var import_DialogTitle2 = __toESM(require("@mui/material/DialogTitle"));
|
|
292
360
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
293
|
-
function
|
|
294
|
-
|
|
361
|
+
function CmrConfirmation({
|
|
362
|
+
name,
|
|
363
|
+
message,
|
|
364
|
+
cancelText = "Cancel",
|
|
365
|
+
color,
|
|
295
366
|
open,
|
|
296
367
|
setOpen,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
368
|
+
confirmCallback = () => {
|
|
369
|
+
},
|
|
370
|
+
confirmText = "Confirm",
|
|
371
|
+
cancellable = false,
|
|
372
|
+
cancelCallback = () => {
|
|
373
|
+
},
|
|
374
|
+
width
|
|
300
375
|
}) {
|
|
301
|
-
const [
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
376
|
+
const [text, setText] = React5.useState("");
|
|
377
|
+
const handleClose = () => {
|
|
378
|
+
setOpen(false);
|
|
379
|
+
};
|
|
380
|
+
const handleConfirm = () => {
|
|
381
|
+
confirmCallback();
|
|
382
|
+
handleClose();
|
|
383
|
+
};
|
|
384
|
+
const handleCancel = () => {
|
|
385
|
+
cancelCallback();
|
|
386
|
+
handleClose();
|
|
387
|
+
};
|
|
388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_Dialog2.default, { open, onClose: handleClose, children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_DialogTitle2.default, { children: name ? name : "Confirmation" }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_DialogContent2.default, { sx: { width }, children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_DialogContentText.default, { alignContent: "center", children: message }),
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_DialogActions2.default, { className: "mt-4", children: [
|
|
393
|
+
cancellable && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: cancelText }),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
|
|
395
|
+
] })
|
|
396
|
+
] })
|
|
397
|
+
] });
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/CmrComponents/dialogue/DeletionDialog.tsx
|
|
401
|
+
var React6 = __toESM(require("react"));
|
|
402
|
+
var import_TextField2 = __toESM(require("@mui/material/TextField"));
|
|
403
|
+
var import_Dialog3 = __toESM(require("@mui/material/Dialog"));
|
|
404
|
+
var import_DialogActions3 = __toESM(require("@mui/material/DialogActions"));
|
|
405
|
+
var import_DialogContent3 = __toESM(require("@mui/material/DialogContent"));
|
|
406
|
+
var import_DialogContentText2 = __toESM(require("@mui/material/DialogContentText"));
|
|
407
|
+
var import_DialogTitle3 = __toESM(require("@mui/material/DialogTitle"));
|
|
408
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
409
|
+
function CmrDeletionDialog(props) {
|
|
410
|
+
const [open, setOpen] = React6.useState(true);
|
|
411
|
+
const [text, setText] = React6.useState("");
|
|
312
412
|
const handleClickOpen = () => {
|
|
313
413
|
setOpen(true);
|
|
314
414
|
};
|
|
315
415
|
const handleClose = () => {
|
|
316
416
|
setOpen(false);
|
|
317
417
|
};
|
|
318
|
-
const getExtension = (fileName) => {
|
|
319
|
-
if (fileName == void 0)
|
|
320
|
-
return;
|
|
321
|
-
return fileName.split(".").pop();
|
|
322
|
-
};
|
|
323
418
|
const handleConfirm = () => {
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
setWarningText("Must select files to upload!");
|
|
328
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (fileAlias.length === 0) {
|
|
332
|
-
setInfoOpen(true);
|
|
333
|
-
setInfoStyle("error");
|
|
334
|
-
setWarningText("File name can't be empty");
|
|
335
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
336
|
-
return;
|
|
419
|
+
if (text === props.name) {
|
|
420
|
+
props.deletionCallback();
|
|
421
|
+
setOpen(false);
|
|
337
422
|
}
|
|
338
|
-
setOpen(false);
|
|
339
|
-
upload(uploadedFiles[0], fileAlias, locationSelection).then((response) => {
|
|
340
|
-
console.log(response);
|
|
341
|
-
if (response > 0) {
|
|
342
|
-
setInfoOpen(true);
|
|
343
|
-
if (response === 200) {
|
|
344
|
-
setInfoStyle("success");
|
|
345
|
-
setWarningText("Upload successful");
|
|
346
|
-
setTimeout(() => {
|
|
347
|
-
setInfoOpen(false);
|
|
348
|
-
setOpen(false);
|
|
349
|
-
}, 1e3);
|
|
350
|
-
setUpBtnDisabled(false);
|
|
351
|
-
setUpBtnText("Upload");
|
|
352
|
-
} else if (response === 413) {
|
|
353
|
-
setInfoStyle("error");
|
|
354
|
-
setWarningText("File size limit exceeded");
|
|
355
|
-
setTimeout(() => {
|
|
356
|
-
setInfoOpen(false);
|
|
357
|
-
setUpBtnDisabled(false);
|
|
358
|
-
setUpBtnText("Upload");
|
|
359
|
-
}, 2e3);
|
|
360
|
-
} else if (response === 500) {
|
|
361
|
-
setInfoStyle("error");
|
|
362
|
-
setWarningText("Internal server error");
|
|
363
|
-
setTimeout(() => {
|
|
364
|
-
setInfoOpen(false);
|
|
365
|
-
setUpBtnDisabled(false);
|
|
366
|
-
setUpBtnText("Upload");
|
|
367
|
-
}, 1500);
|
|
368
|
-
setOpen(true);
|
|
369
|
-
} else if (response === 400) {
|
|
370
|
-
setInfoStyle("warning");
|
|
371
|
-
setWarningText("File upload cancelled");
|
|
372
|
-
setTimeout(() => {
|
|
373
|
-
setInfoOpen(false);
|
|
374
|
-
setUpBtnDisabled(false);
|
|
375
|
-
setUpBtnText("Upload");
|
|
376
|
-
}, 1e3);
|
|
377
|
-
setOpen(true);
|
|
378
|
-
} else {
|
|
379
|
-
setInfoStyle("warning");
|
|
380
|
-
setWarningText("Unknown status");
|
|
381
|
-
setTimeout(() => {
|
|
382
|
-
setInfoOpen(false);
|
|
383
|
-
setUpBtnDisabled(false);
|
|
384
|
-
setUpBtnText("Upload");
|
|
385
|
-
}, 2e3);
|
|
386
|
-
setOpen(true);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}).catch((error) => {
|
|
390
|
-
setUpBtnDisabled(false);
|
|
391
|
-
setUpBtnText("Upload");
|
|
392
|
-
setInfoOpen(true);
|
|
393
|
-
setInfoStyle("error");
|
|
394
|
-
setWarningText("Upload unsuccessful: " + error.message);
|
|
395
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
396
|
-
console.error("Error:", error);
|
|
397
|
-
});
|
|
398
|
-
setUpBtnDisabled(true);
|
|
399
|
-
setUpBtnText("Uploading");
|
|
400
423
|
};
|
|
401
|
-
const
|
|
402
|
-
|
|
424
|
+
const handleTextFieldChange = (e) => {
|
|
425
|
+
setText(e.target.value);
|
|
403
426
|
};
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
"GB",
|
|
429
|
-
"TB",
|
|
430
|
-
"PB",
|
|
431
|
-
"EB",
|
|
432
|
-
"ZB",
|
|
433
|
-
"YB"
|
|
434
|
-
];
|
|
435
|
-
let numberOfBytes = file2.size;
|
|
436
|
-
const exponent = Math.min(
|
|
437
|
-
Math.floor(Math.log(numberOfBytes) / Math.log(1024)),
|
|
438
|
-
units.length - 1
|
|
439
|
-
);
|
|
440
|
-
const approx = numberOfBytes / 1024 ** exponent;
|
|
441
|
-
const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(3)} ${units[exponent]}`;
|
|
442
|
-
setFileSize(output);
|
|
443
|
-
}
|
|
444
|
-
readFile(file);
|
|
445
|
-
}
|
|
446
|
-
let initialized = false;
|
|
447
|
-
let fileInput = (inputRef) => {
|
|
448
|
-
if (initialized)
|
|
449
|
-
return;
|
|
450
|
-
inputRef.addEventListener("dragover", function(e) {
|
|
451
|
-
e.stopPropagation();
|
|
452
|
-
e.preventDefault();
|
|
453
|
-
if (e.dataTransfer.files) {
|
|
454
|
-
let draggedFiles = e.dataTransfer.files;
|
|
455
|
-
if (draggedFiles.length > 1) {
|
|
456
|
-
setUploadBoxWarning("Only one file can be uploaded at a time");
|
|
457
|
-
} else if (fileExtension != void 0 && draggedFiles.length != 0 && getExtension(draggedFiles[0].name) != fileExtension) {
|
|
458
|
-
setUploadBoxWarning(`Only accepting files with extension ${fileExtension}`);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
e.dataTransfer.dropEffect = "copy";
|
|
462
|
-
});
|
|
463
|
-
inputRef.addEventListener("drop", function(e) {
|
|
464
|
-
e.stopPropagation();
|
|
465
|
-
e.preventDefault();
|
|
466
|
-
setUploadBoxWarning(void 0);
|
|
467
|
-
let files = e.dataTransfer.files;
|
|
468
|
-
if (files.length > 1) {
|
|
469
|
-
setInfoOpen(true);
|
|
470
|
-
setInfoStyle("warning");
|
|
471
|
-
setWarningText("Only one file can be uploaded at a time");
|
|
472
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
473
|
-
return;
|
|
474
|
-
} else if (fileExtension != void 0 && `.${getExtension(files[0].name)}` != fileExtension) {
|
|
475
|
-
setInfoOpen(true);
|
|
476
|
-
setInfoStyle("warning");
|
|
477
|
-
setWarningText(`Only accepting files with extension ${fileExtension}`);
|
|
478
|
-
setTimeout(() => setInfoOpen(false), 2500);
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
loadFiles(files);
|
|
482
|
-
});
|
|
483
|
-
inputRef.addEventListener("dragleave", () => {
|
|
484
|
-
setUploadBoxWarning(void 0);
|
|
485
|
-
});
|
|
486
|
-
initialized = true;
|
|
487
|
-
};
|
|
488
|
-
const fileInputClick = (e) => {
|
|
489
|
-
const fileElem = document.getElementById("file-window");
|
|
490
|
-
e.preventDefault();
|
|
491
|
-
if (fileElem) {
|
|
492
|
-
fileElem.click();
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
const loadSelectedFiles = (e) => {
|
|
496
|
-
e.preventDefault();
|
|
497
|
-
const fileElem = document.getElementById("file-window");
|
|
498
|
-
loadFiles(fileElem.files);
|
|
499
|
-
};
|
|
500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_Dialog.default, { open, onClose: handleClose, children: [
|
|
501
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_DialogTitle.default, { children: "File Upload" }),
|
|
502
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_DialogContent.default, { children: [
|
|
503
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_DialogContentText.default, {}),
|
|
504
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_DialogContent.default, { dividers: true, children: [
|
|
505
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
506
|
-
import_Box.default,
|
|
507
|
-
{
|
|
508
|
-
width: 500,
|
|
509
|
-
height: 250,
|
|
510
|
-
style: {
|
|
511
|
-
borderStyle: "dashed",
|
|
512
|
-
borderRadius: "5pt",
|
|
513
|
-
borderColor: uploadBoxWarning == void 0 ? "lightGray" : "#BA3C3C"
|
|
514
|
-
},
|
|
515
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Typography.default, { component: "div", style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
516
|
-
import_Box.default,
|
|
517
|
-
{
|
|
518
|
-
style: {
|
|
519
|
-
display: "flex",
|
|
520
|
-
flexDirection: "column",
|
|
521
|
-
justifyContent: "center",
|
|
522
|
-
alignItems: "center",
|
|
523
|
-
height: "100%"
|
|
524
|
-
},
|
|
525
|
-
onClick: fileInputClick,
|
|
526
|
-
ref: fileInput,
|
|
527
|
-
children: [
|
|
528
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_Typography.default, { variant: "body1", align: "center", style: { marginTop: "auto" }, children: [
|
|
529
|
-
"Drag & Drop or Click to Upload Your File Here ",
|
|
530
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("sup", { children: "*" })
|
|
531
|
-
] }),
|
|
532
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Typography.default, { 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." })
|
|
533
|
-
]
|
|
534
|
-
}
|
|
535
|
-
) })
|
|
536
|
-
}
|
|
537
|
-
),
|
|
538
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
539
|
-
"input",
|
|
540
|
-
{
|
|
541
|
-
type: "file",
|
|
542
|
-
id: "file-window",
|
|
543
|
-
multiple: true,
|
|
544
|
-
accept: fileExtension == void 0 ? "*" : fileExtension,
|
|
545
|
-
style: { display: "none" },
|
|
546
|
-
onChange: loadSelectedFiles
|
|
547
|
-
}
|
|
548
|
-
),
|
|
549
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_Box.default, { component: "form", sx: { "& .MuiTextField-root": { m: 2, width: "25ch", mb: 0 } }, children: [
|
|
550
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
551
|
-
template.showFileName && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
552
|
-
import_TextField.default,
|
|
553
|
-
{
|
|
554
|
-
required: true,
|
|
555
|
-
style: { marginTop: "30px" },
|
|
556
|
-
label: `File Alias:`,
|
|
557
|
-
value: fileAlias,
|
|
558
|
-
variant: "standard",
|
|
559
|
-
onChange: changeFileName
|
|
560
|
-
}
|
|
561
|
-
),
|
|
562
|
-
fileOriginalName != "" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label_default, { style: { marginLeft: "16px", fontSize: "9pt", color: "#267833" }, children: fileOriginalName }),
|
|
563
|
-
template.showDatabase && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
564
|
-
import_TextField.default,
|
|
565
|
-
{
|
|
566
|
-
select: true,
|
|
567
|
-
label: "Database:",
|
|
568
|
-
defaultValue: "s3",
|
|
569
|
-
helperText: "Upstream Storage Location",
|
|
570
|
-
variant: "standard",
|
|
571
|
-
children: [{ value: "s3", label: "S3" }].map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.MenuItem, { value: option.value, children: option.label }, option.value))
|
|
572
|
-
}
|
|
573
|
-
)
|
|
574
|
-
] }),
|
|
575
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
576
|
-
template.showFileSize && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
577
|
-
import_TextField.default,
|
|
578
|
-
{
|
|
579
|
-
label: "File Size:",
|
|
580
|
-
value: fileSize,
|
|
581
|
-
InputProps: {
|
|
582
|
-
readOnly: true
|
|
583
|
-
},
|
|
584
|
-
variant: "standard"
|
|
585
|
-
}
|
|
586
|
-
),
|
|
587
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Collapse, { in: infoOpen, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Alert, { severity: infoStyle, sx: { m: 1 }, children: warningText }) })
|
|
588
|
-
] })
|
|
589
|
-
] })
|
|
590
|
-
] }),
|
|
591
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_DialogActions.default, { children: [
|
|
592
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
593
|
-
import_Button.default,
|
|
594
|
-
{
|
|
595
|
-
color: "inherit",
|
|
596
|
-
sx: { color: "#333" },
|
|
597
|
-
disabled: UpBtnDisabled,
|
|
598
|
-
onClick: handleClose,
|
|
599
|
-
children: "Cancel"
|
|
600
|
-
}
|
|
601
|
-
),
|
|
602
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
603
|
-
import_Button.default,
|
|
604
|
-
{
|
|
605
|
-
variant: "contained",
|
|
606
|
-
disabled: UpBtnDisabled,
|
|
607
|
-
onClick: handleConfirm,
|
|
608
|
-
children: UpBtnText
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
] })
|
|
612
|
-
] })
|
|
613
|
-
] }) });
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// src/CmrComponents/upload/Upload.tsx
|
|
617
|
-
var import_axios = __toESM(require("axios"));
|
|
618
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
619
|
-
var CmrUpload = (props) => {
|
|
620
|
-
let [open, setOpen] = (0, import_react4.useState)(false);
|
|
621
|
-
let [uploading, setUploading] = (0, import_react4.useState)(false);
|
|
622
|
-
let [progress, setProgress] = (0, import_react4.useState)(0);
|
|
623
|
-
let [uploadedFile, setUploadedFile] = (0, import_react4.useState)(void 0);
|
|
624
|
-
const upload = async (file, fileAlias, fileDatabase) => {
|
|
625
|
-
setUploading(true);
|
|
626
|
-
const onProgress = (progress2) => {
|
|
627
|
-
let percentage = progress2 * 99;
|
|
628
|
-
props.uploadProgressed && props.uploadProgressed(+percentage.toFixed(2));
|
|
629
|
-
setProgress(+percentage.toFixed(2));
|
|
630
|
-
};
|
|
631
|
-
if (props.uploadStarted)
|
|
632
|
-
props.uploadStarted();
|
|
633
|
-
let status = 0;
|
|
634
|
-
if (props.beforeUpload != void 0 && !await props.beforeUpload(file)) {
|
|
635
|
-
if (props.uploadEnded)
|
|
636
|
-
props.uploadEnded();
|
|
637
|
-
setUploading(false);
|
|
638
|
-
return 200;
|
|
639
|
-
}
|
|
640
|
-
if (props.preprocess) {
|
|
641
|
-
let processed = await props.preprocess(file);
|
|
642
|
-
if (processed == void 0)
|
|
643
|
-
return failUpload();
|
|
644
|
-
if (typeof processed == "number") {
|
|
645
|
-
setUploading(false);
|
|
646
|
-
return processed;
|
|
647
|
-
}
|
|
648
|
-
file = processed;
|
|
649
|
-
}
|
|
650
|
-
if (props.uploadHandler != void 0) {
|
|
651
|
-
status = await props.uploadHandler(file, fileAlias, fileDatabase, onProgress, props.onUploaded);
|
|
652
|
-
setUploadedFile(props.reusable ? void 0 : file.name);
|
|
653
|
-
} else if (props.createPayload) {
|
|
654
|
-
let payload = await props.createPayload(file, fileAlias, fileDatabase);
|
|
655
|
-
if (payload == void 0) {
|
|
656
|
-
return failUpload();
|
|
657
|
-
}
|
|
658
|
-
payload.config.onUploadProgress = (progressEvent) => {
|
|
659
|
-
if (progressEvent.total == void 0)
|
|
660
|
-
return;
|
|
661
|
-
onProgress(progressEvent.loaded / progressEvent.total);
|
|
662
|
-
};
|
|
663
|
-
const res = await import_axios.default.post(payload.destination, payload.lambdaFile, payload.config);
|
|
664
|
-
status = res.status;
|
|
665
|
-
if (status === 200) {
|
|
666
|
-
console.log(res.data);
|
|
667
|
-
await import_axios.default.put(res.data.upload_url, payload.file, {
|
|
668
|
-
headers: {
|
|
669
|
-
"Content-Type": payload.file.type
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
await props.onUploaded(res, payload.file);
|
|
673
|
-
setUploadedFile(props.reusable ? void 0 : payload.file.name);
|
|
674
|
-
}
|
|
675
|
-
} else {
|
|
676
|
-
return failUpload();
|
|
677
|
-
}
|
|
678
|
-
if (props.uploadEnded)
|
|
679
|
-
props.uploadEnded();
|
|
680
|
-
setUploading(false);
|
|
681
|
-
setProgress(0);
|
|
682
|
-
return status;
|
|
683
|
-
};
|
|
684
|
-
function failUpload() {
|
|
685
|
-
setUploading(false);
|
|
686
|
-
setProgress(0);
|
|
687
|
-
if (props.uploadFailed)
|
|
688
|
-
return props.uploadFailed();
|
|
689
|
-
return 0;
|
|
690
|
-
}
|
|
691
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react4.default.Fragment, { children: [
|
|
692
|
-
!uploading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
693
|
-
import_material7.Button,
|
|
694
|
-
{
|
|
695
|
-
fullWidth: props.fullWidth,
|
|
696
|
-
style: props.style,
|
|
697
|
-
variant: uploadedFile == void 0 ? "contained" : "outlined",
|
|
698
|
-
onClick: () => {
|
|
699
|
-
setOpen(true);
|
|
700
|
-
},
|
|
701
|
-
color: props.color || "primary",
|
|
702
|
-
sx: props.sx,
|
|
703
|
-
children: [
|
|
704
|
-
props.changeNameAfterUpload ? uploadedFile === void 0 ? props.uploadButtonName ? props.uploadButtonName : "Upload" : uploadedFile : props.uploadButtonName ? props.uploadButtonName : "Upload",
|
|
705
|
-
" "
|
|
706
|
-
]
|
|
707
|
-
}
|
|
708
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_material7.Button, { fullWidth: props.fullWidth, style: props.style, variant: "contained", sx: { overflowWrap: "inherit" }, color: "primary", disabled: true, children: [
|
|
709
|
-
"Uploading ",
|
|
710
|
-
progress,
|
|
711
|
-
"%"
|
|
712
|
-
] }),
|
|
713
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
714
|
-
UploadWindow,
|
|
715
|
-
{
|
|
716
|
-
open,
|
|
717
|
-
setOpen,
|
|
718
|
-
upload,
|
|
719
|
-
fileExtension: props.fileExtension,
|
|
720
|
-
template: { showFileName: true, showFileSize: true }
|
|
721
|
-
}
|
|
722
|
-
)
|
|
723
|
-
] });
|
|
724
|
-
};
|
|
725
|
-
CmrUpload.defaultProps = {
|
|
726
|
-
changeNameAfterUpload: true
|
|
727
|
-
};
|
|
728
|
-
var Upload_default = CmrUpload;
|
|
729
|
-
|
|
730
|
-
// src/CmrComponents/rename/edit.tsx
|
|
731
|
-
var React6 = __toESM(require("react"));
|
|
732
|
-
var import_material8 = require("@mui/material");
|
|
733
|
-
var import_TextField2 = __toESM(require("@mui/material/TextField"));
|
|
734
|
-
var import_Dialog2 = __toESM(require("@mui/material/Dialog"));
|
|
735
|
-
var import_DialogActions2 = __toESM(require("@mui/material/DialogActions"));
|
|
736
|
-
var import_DialogContent2 = __toESM(require("@mui/material/DialogContent"));
|
|
737
|
-
var import_DialogTitle2 = __toESM(require("@mui/material/DialogTitle"));
|
|
738
|
-
var import_react5 = require("react");
|
|
739
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
740
|
-
function CmrNameDialog(props) {
|
|
741
|
-
let { originalName, open, setOpen } = props;
|
|
742
|
-
const [helperText, setHelperText] = React6.useState("");
|
|
743
|
-
const [text, setText] = React6.useState(originalName);
|
|
744
|
-
const [error, setError] = React6.useState(false);
|
|
745
|
-
const renamingCallback = props.renamingCallback;
|
|
746
|
-
const handleClose = () => {
|
|
747
|
-
setOpen(false);
|
|
748
|
-
};
|
|
749
|
-
(0, import_react5.useEffect)(() => {
|
|
750
|
-
checkError(originalName);
|
|
751
|
-
}, [originalName]);
|
|
752
|
-
const handleConfirm = async () => {
|
|
753
|
-
if (await renamingCallback(text))
|
|
754
|
-
handleClose();
|
|
755
|
-
};
|
|
756
|
-
const handleTextFieldChange = (e) => {
|
|
757
|
-
setText(e.target.value);
|
|
758
|
-
checkError(e.target.value);
|
|
759
|
-
};
|
|
760
|
-
const checkError = (text2) => {
|
|
761
|
-
const fileNameRegex = /^[a-zA-Z0-9_\-]+\.[a-zA-Z]{1,5}$/;
|
|
762
|
-
let newExtension = text2.split(".").pop();
|
|
763
|
-
let orgExtension = originalName.indexOf(".") >= 0 ? originalName.split(".").pop() : "?";
|
|
764
|
-
if (!fileNameRegex.test(text2)) {
|
|
765
|
-
setError(true);
|
|
766
|
-
if (text2.indexOf(".") < 0) {
|
|
767
|
-
setHelperText("Invalid file name, needs a valid extension.");
|
|
768
|
-
} else {
|
|
769
|
-
setHelperText("Invalid file name, please check.");
|
|
770
|
-
}
|
|
771
|
-
} else if (newExtension !== orgExtension) {
|
|
772
|
-
setHelperText(`You are modifying your file extension from .${orgExtension} to .${newExtension}.`);
|
|
773
|
-
setError(false);
|
|
774
|
-
} else {
|
|
775
|
-
setError(false);
|
|
776
|
-
setHelperText("");
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
780
|
-
import_Dialog2.default,
|
|
781
|
-
{
|
|
782
|
-
open,
|
|
783
|
-
onClose: handleClose,
|
|
784
|
-
fullWidth: true,
|
|
785
|
-
maxWidth: "xs",
|
|
786
|
-
children: [
|
|
787
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_DialogTitle2.default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.Typography, { children: [
|
|
788
|
-
' Rename "',
|
|
789
|
-
originalName,
|
|
790
|
-
'" as:'
|
|
791
|
-
] }) }),
|
|
792
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_DialogContent2.default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
793
|
-
import_TextField2.default,
|
|
794
|
-
{
|
|
795
|
-
autoFocus: true,
|
|
796
|
-
margin: "dense",
|
|
797
|
-
id: "name",
|
|
798
|
-
defaultValue: originalName,
|
|
799
|
-
onFocus: (event) => {
|
|
800
|
-
event.target.select();
|
|
801
|
-
},
|
|
802
|
-
fullWidth: true,
|
|
803
|
-
inputProps: { style: { fontSize: "16px" } },
|
|
804
|
-
variant: "standard",
|
|
805
|
-
onChange: handleTextFieldChange,
|
|
806
|
-
error,
|
|
807
|
-
helperText
|
|
808
|
-
}
|
|
809
|
-
) }),
|
|
810
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_DialogActions2.default, { children: [
|
|
811
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "outlined", onClick: handleClose, children: "Cancel" }),
|
|
812
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "contained", color: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
813
|
-
] })
|
|
814
|
-
]
|
|
815
|
-
}
|
|
816
|
-
) });
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_Dialog3.default, { open, onClose: handleClose, children: [
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_DialogTitle3.default, { children: "Confirmation" }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_DialogContent3.default, { children: [
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_DialogContentText2.default, { children: "To delete the files, please type your full name below and confirm." }),
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
432
|
+
import_TextField2.default,
|
|
433
|
+
{
|
|
434
|
+
autoFocus: true,
|
|
435
|
+
margin: "dense",
|
|
436
|
+
id: "name",
|
|
437
|
+
type: "email",
|
|
438
|
+
placeholder: props.name,
|
|
439
|
+
fullWidth: true,
|
|
440
|
+
inputProps: { style: { fontSize: "16pt" } },
|
|
441
|
+
variant: "standard",
|
|
442
|
+
onChange: handleTextFieldChange
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] }),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_DialogActions3.default, { children: [
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "btn btn-secondary", onClick: handleClose, children: "Cancel" }),
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "btn btn-danger", onClick: handleConfirm, children: "Confirm" })
|
|
449
|
+
] })
|
|
450
|
+
] }) });
|
|
817
451
|
}
|
|
818
452
|
|
|
819
|
-
// src/CmrComponents/dialogue/
|
|
453
|
+
// src/CmrComponents/dialogue/EditConfirmation.tsx
|
|
820
454
|
var React7 = __toESM(require("react"));
|
|
821
|
-
var
|
|
822
|
-
var
|
|
823
|
-
var
|
|
824
|
-
var
|
|
825
|
-
var
|
|
826
|
-
var
|
|
827
|
-
|
|
455
|
+
var import_TextField3 = __toESM(require("@mui/material/TextField"));
|
|
456
|
+
var import_Dialog4 = __toESM(require("@mui/material/Dialog"));
|
|
457
|
+
var import_DialogActions4 = __toESM(require("@mui/material/DialogActions"));
|
|
458
|
+
var import_DialogContent4 = __toESM(require("@mui/material/DialogContent"));
|
|
459
|
+
var import_DialogContentText3 = __toESM(require("@mui/material/DialogContentText"));
|
|
460
|
+
var import_DialogTitle4 = __toESM(require("@mui/material/DialogTitle"));
|
|
461
|
+
var import_material7 = require("@mui/material");
|
|
462
|
+
var import_react5 = require("react");
|
|
463
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
464
|
+
function CmrEditConfirmation({
|
|
828
465
|
name,
|
|
829
466
|
message,
|
|
830
|
-
|
|
467
|
+
defaultText = "",
|
|
831
468
|
color,
|
|
832
469
|
open,
|
|
833
470
|
setOpen,
|
|
834
471
|
confirmCallback = () => {
|
|
835
472
|
},
|
|
836
|
-
confirmText = "Confirm",
|
|
837
473
|
cancellable = false,
|
|
838
474
|
cancelCallback = () => {
|
|
839
475
|
},
|
|
840
|
-
|
|
476
|
+
suffix = ""
|
|
841
477
|
}) {
|
|
842
|
-
const [text, setText] = React7.useState(
|
|
478
|
+
const [text, setText] = React7.useState(defaultText);
|
|
479
|
+
(0, import_react5.useEffect)(() => {
|
|
480
|
+
if (open)
|
|
481
|
+
setText(defaultText);
|
|
482
|
+
}, [open]);
|
|
843
483
|
const handleClose = () => {
|
|
844
484
|
setOpen(false);
|
|
845
485
|
};
|
|
846
486
|
const handleConfirm = () => {
|
|
847
|
-
confirmCallback();
|
|
487
|
+
confirmCallback(text + suffix);
|
|
848
488
|
handleClose();
|
|
849
489
|
};
|
|
850
490
|
const handleCancel = () => {
|
|
851
|
-
cancelCallback();
|
|
491
|
+
cancelCallback(text + suffix);
|
|
852
492
|
handleClose();
|
|
853
493
|
};
|
|
854
|
-
return /* @__PURE__ */ (0,
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
857
|
-
/* @__PURE__ */ (0,
|
|
858
|
-
/* @__PURE__ */ (0,
|
|
859
|
-
|
|
860
|
-
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_Dialog4.default, { maxWidth: "xs", fullWidth: true, open, onClose: handleCancel, children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_DialogTitle4.default, { children: name ? name : "Confirmation" }),
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_DialogContent4.default, { children: [
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_DialogContentText3.default, { alignContent: "center", children: message }),
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_DialogActions4.default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
499
|
+
import_TextField3.default,
|
|
500
|
+
{
|
|
501
|
+
fullWidth: true,
|
|
502
|
+
variant: "standard",
|
|
503
|
+
InputProps: {
|
|
504
|
+
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material7.InputAdornment, { position: "end", sx: { whiteSpace: "nowrap" }, children: suffix })
|
|
505
|
+
},
|
|
506
|
+
defaultValue: text,
|
|
507
|
+
onChange: (e) => setText(e.target.value)
|
|
508
|
+
}
|
|
509
|
+
) }),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_DialogActions4.default, { children: [
|
|
511
|
+
cancellable && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: "Cancel" }),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: "Confirm" })
|
|
861
513
|
] })
|
|
862
514
|
] })
|
|
863
515
|
] });
|
|
864
516
|
}
|
|
865
517
|
|
|
866
|
-
// src/
|
|
518
|
+
// src/CmrTabs/CmrTabs.tsx
|
|
867
519
|
var React8 = __toESM(require("react"));
|
|
868
|
-
var
|
|
869
|
-
var
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
var
|
|
873
|
-
var
|
|
874
|
-
var
|
|
875
|
-
function
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
props.deletionCallback();
|
|
887
|
-
setOpen(false);
|
|
520
|
+
var import_Tabs = __toESM(require("@mui/material/Tabs"));
|
|
521
|
+
var import_Tab = __toESM(require("@mui/material/Tab"));
|
|
522
|
+
var import_Container = __toESM(require("@mui/material/Container"));
|
|
523
|
+
var import_Typography = __toESM(require("@mui/material/Typography"));
|
|
524
|
+
var import_Box = __toESM(require("@mui/material/Box"));
|
|
525
|
+
var import_react6 = require("react");
|
|
526
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
527
|
+
function CustomTabPanel(props) {
|
|
528
|
+
const { children, value, index, ...other } = props;
|
|
529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
530
|
+
"div",
|
|
531
|
+
{
|
|
532
|
+
role: "tabpanel",
|
|
533
|
+
hidden: value !== index,
|
|
534
|
+
id: `simple-tabpanel-${index}`,
|
|
535
|
+
"aria-labelledby": `simple-tab-${index}`,
|
|
536
|
+
...other,
|
|
537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Box.default, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Typography.default, { children }) })
|
|
888
538
|
}
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
function a11yProps(index) {
|
|
542
|
+
return {
|
|
543
|
+
id: `simple-tab-${index}`,
|
|
544
|
+
"aria-controls": `simple-tabpanel-${index}`
|
|
889
545
|
};
|
|
890
|
-
|
|
891
|
-
|
|
546
|
+
}
|
|
547
|
+
function CmrTabs(props) {
|
|
548
|
+
const [value, setValue] = React8.useState(0);
|
|
549
|
+
const handleChange = (event, newValue) => {
|
|
550
|
+
setValue(newValue);
|
|
551
|
+
if (props.onTabSelected)
|
|
552
|
+
props.onTabSelected(newValue);
|
|
892
553
|
};
|
|
893
|
-
return /* @__PURE__ */ (0,
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
555
|
+
import_Container.default,
|
|
556
|
+
{
|
|
557
|
+
maxWidth: "lg",
|
|
558
|
+
sx: {
|
|
559
|
+
flex: 1,
|
|
560
|
+
display: "flex",
|
|
561
|
+
flexDirection: "column",
|
|
562
|
+
mt: 4
|
|
563
|
+
},
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Box.default, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
566
|
+
import_Tabs.default,
|
|
567
|
+
{
|
|
568
|
+
value,
|
|
569
|
+
onChange: handleChange,
|
|
570
|
+
"aria-label": "basic tabs example",
|
|
571
|
+
textColor: "inherit",
|
|
572
|
+
TabIndicatorProps: {
|
|
573
|
+
style: {
|
|
574
|
+
backgroundColor: "#580F8B"
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
children: props.tabList.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Tab.default, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
|
|
578
|
+
}
|
|
579
|
+
) }),
|
|
580
|
+
props.tabList.map(
|
|
581
|
+
(tab, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CustomTabPanel, { value, index, children: (0, import_react6.cloneElement)(tab.children, {
|
|
582
|
+
visible: value == index
|
|
583
|
+
}) })
|
|
584
|
+
)
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
);
|
|
917
588
|
}
|
|
918
589
|
|
|
919
|
-
// src/CmrComponents/
|
|
920
|
-
var
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
|
|
926
|
-
|
|
590
|
+
// src/CmrComponents/checkbox/Checkbox.tsx
|
|
591
|
+
var import_material8 = require("@mui/material");
|
|
592
|
+
|
|
593
|
+
// src/CmrComponents/label/Label.tsx
|
|
594
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
595
|
+
var CmrLabel = (props) => {
|
|
596
|
+
const { children, required = false } = props;
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "cmr-label", style: { fontSize: "16px", ...props.style }, children: [
|
|
598
|
+
children,
|
|
599
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "asterik", children: "*" })
|
|
600
|
+
] });
|
|
601
|
+
};
|
|
602
|
+
var Label_default = CmrLabel;
|
|
603
|
+
|
|
604
|
+
// src/CmrComponents/checkbox/Checkbox.tsx
|
|
927
605
|
var import_material9 = require("@mui/material");
|
|
928
|
-
var import_react6 = require("react");
|
|
929
606
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
607
|
+
var CmrCheckbox = (props) => {
|
|
608
|
+
const { defaultChecked, onChange, children, ...rest } = props;
|
|
609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
610
|
+
import_material9.FormControlLabel,
|
|
611
|
+
{
|
|
612
|
+
disabled: props.disabled,
|
|
613
|
+
style: props.style,
|
|
614
|
+
className: props.className,
|
|
615
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material8.Checkbox, { style: props.style, checked: props.checked, defaultChecked, onChange }),
|
|
616
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label_default, { children: props.children }),
|
|
617
|
+
sx: props.sx,
|
|
618
|
+
labelPlacement: "end"
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
};
|
|
622
|
+
var Checkbox_default = CmrCheckbox;
|
|
623
|
+
|
|
624
|
+
// src/CmrComponents/input-number/InputNumber.tsx
|
|
625
|
+
var import_antd2 = require("antd");
|
|
626
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
627
|
+
var CmrInputNumber = (props) => {
|
|
628
|
+
const { defaultValue, style, max, min, value, onChange, children, ...rest } = props;
|
|
629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_antd2.InputNumber, { defaultValue, max, style, min, value, onChange, ...rest, children });
|
|
630
|
+
};
|
|
631
|
+
var InputNumber_default = CmrInputNumber;
|
|
632
|
+
|
|
633
|
+
// src/CmrComponents/tooltip/Tooltip.tsx
|
|
634
|
+
var import_antd3 = require("antd");
|
|
635
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
636
|
+
var CmrTooltip = (props) => {
|
|
637
|
+
const {
|
|
638
|
+
arrowPointAtCenter,
|
|
639
|
+
autoAdjustOverflow,
|
|
640
|
+
color,
|
|
641
|
+
defaultVisible,
|
|
642
|
+
mouseEnterDelay,
|
|
643
|
+
mouseLeaveDelay,
|
|
644
|
+
overlayClassName,
|
|
645
|
+
placement,
|
|
646
|
+
visible,
|
|
647
|
+
...rest
|
|
648
|
+
} = props;
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
650
|
+
import_antd3.Tooltip,
|
|
651
|
+
{
|
|
652
|
+
arrowPointAtCenter,
|
|
653
|
+
autoAdjustOverflow,
|
|
654
|
+
color,
|
|
655
|
+
defaultVisible,
|
|
656
|
+
mouseEnterDelay,
|
|
657
|
+
mouseLeaveDelay,
|
|
658
|
+
overlayClassName,
|
|
659
|
+
placement,
|
|
660
|
+
visible,
|
|
661
|
+
...rest
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
};
|
|
665
|
+
var Tooltip_default = CmrTooltip;
|
|
666
|
+
|
|
667
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
668
|
+
var import_react8 = __toESM(require("react"));
|
|
669
|
+
|
|
670
|
+
// src/CmrComponents/upload/Upload.tsx
|
|
671
|
+
var import_react7 = __toESM(require("react"));
|
|
672
|
+
var import_material11 = require("@mui/material");
|
|
673
|
+
|
|
674
|
+
// src/CmrComponents/upload/UploadWindow.tsx
|
|
675
|
+
var React9 = __toESM(require("react"));
|
|
676
|
+
var import_Button = __toESM(require("@mui/material/Button"));
|
|
677
|
+
var import_TextField4 = __toESM(require("@mui/material/TextField"));
|
|
678
|
+
var import_Dialog5 = __toESM(require("@mui/material/Dialog"));
|
|
679
|
+
var import_DialogActions5 = __toESM(require("@mui/material/DialogActions"));
|
|
680
|
+
var import_DialogContent5 = __toESM(require("@mui/material/DialogContent"));
|
|
681
|
+
var import_DialogContentText4 = __toESM(require("@mui/material/DialogContentText"));
|
|
682
|
+
var import_DialogTitle5 = __toESM(require("@mui/material/DialogTitle"));
|
|
683
|
+
var import_Typography2 = __toESM(require("@mui/material/Typography"));
|
|
684
|
+
var import_Box2 = __toESM(require("@mui/material/Box"));
|
|
685
|
+
var import_material10 = require("@mui/material");
|
|
686
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
687
|
+
function CmrUploadWindow({
|
|
688
|
+
upload,
|
|
935
689
|
open,
|
|
936
690
|
setOpen,
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
cancelCallback = () => {
|
|
941
|
-
},
|
|
942
|
-
suffix = ""
|
|
691
|
+
fileExtension,
|
|
692
|
+
template = { showFileName: true, showDatabase: true, showFileSize: true }
|
|
693
|
+
// default values
|
|
943
694
|
}) {
|
|
944
|
-
const [
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
695
|
+
const [fileOriginalName, setFileOriginalName] = React9.useState("");
|
|
696
|
+
const [fileAlias, setFileAlias] = React9.useState("/");
|
|
697
|
+
const [fileSize, setFileSize] = React9.useState("0 MB");
|
|
698
|
+
const [warningText, setWarningText] = React9.useState("Unknown Status");
|
|
699
|
+
const [infoOpen, setInfoOpen] = React9.useState(false);
|
|
700
|
+
const [locationSelection, setLocationSelection] = React9.useState("s3");
|
|
701
|
+
const [infoStyle, setInfoStyle] = React9.useState("info");
|
|
702
|
+
const [uploadedFiles, setUploaded] = React9.useState([]);
|
|
703
|
+
const [UpBtnDisabled, setUpBtnDisabled] = React9.useState(false);
|
|
704
|
+
const [UpBtnText, setUpBtnText] = React9.useState("Upload");
|
|
705
|
+
const [uploadBoxWarning, setUploadBoxWarning] = React9.useState(void 0);
|
|
706
|
+
const handleClickOpen = () => {
|
|
707
|
+
setOpen(true);
|
|
708
|
+
};
|
|
949
709
|
const handleClose = () => {
|
|
950
710
|
setOpen(false);
|
|
951
711
|
};
|
|
712
|
+
const getExtension = (fileName) => {
|
|
713
|
+
if (fileName == void 0)
|
|
714
|
+
return;
|
|
715
|
+
return fileName.split(".").pop();
|
|
716
|
+
};
|
|
952
717
|
const handleConfirm = () => {
|
|
953
|
-
|
|
954
|
-
|
|
718
|
+
if (uploadedFiles.length === 0) {
|
|
719
|
+
setInfoOpen(true);
|
|
720
|
+
setInfoStyle("error");
|
|
721
|
+
setWarningText("Must select files to upload!");
|
|
722
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
if (fileAlias.length === 0) {
|
|
726
|
+
setInfoOpen(true);
|
|
727
|
+
setInfoStyle("error");
|
|
728
|
+
setWarningText("File name can't be empty");
|
|
729
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
setOpen(false);
|
|
733
|
+
upload(uploadedFiles[0], fileAlias, locationSelection).then((response) => {
|
|
734
|
+
console.log(response);
|
|
735
|
+
if (response > 0) {
|
|
736
|
+
setInfoOpen(true);
|
|
737
|
+
if (response === 200) {
|
|
738
|
+
setInfoStyle("success");
|
|
739
|
+
setWarningText("Upload successful");
|
|
740
|
+
setTimeout(() => {
|
|
741
|
+
setInfoOpen(false);
|
|
742
|
+
setOpen(false);
|
|
743
|
+
}, 1e3);
|
|
744
|
+
setUpBtnDisabled(false);
|
|
745
|
+
setUpBtnText("Upload");
|
|
746
|
+
} else if (response === 413) {
|
|
747
|
+
setInfoStyle("error");
|
|
748
|
+
setWarningText("File size limit exceeded");
|
|
749
|
+
setTimeout(() => {
|
|
750
|
+
setInfoOpen(false);
|
|
751
|
+
setUpBtnDisabled(false);
|
|
752
|
+
setUpBtnText("Upload");
|
|
753
|
+
}, 2e3);
|
|
754
|
+
} else if (response === 500) {
|
|
755
|
+
setInfoStyle("error");
|
|
756
|
+
setWarningText("Internal server error");
|
|
757
|
+
setTimeout(() => {
|
|
758
|
+
setInfoOpen(false);
|
|
759
|
+
setUpBtnDisabled(false);
|
|
760
|
+
setUpBtnText("Upload");
|
|
761
|
+
}, 1500);
|
|
762
|
+
setOpen(true);
|
|
763
|
+
} else if (response === 400) {
|
|
764
|
+
setInfoStyle("warning");
|
|
765
|
+
setWarningText("File upload cancelled");
|
|
766
|
+
setTimeout(() => {
|
|
767
|
+
setInfoOpen(false);
|
|
768
|
+
setUpBtnDisabled(false);
|
|
769
|
+
setUpBtnText("Upload");
|
|
770
|
+
}, 1e3);
|
|
771
|
+
setOpen(true);
|
|
772
|
+
} else {
|
|
773
|
+
setInfoStyle("warning");
|
|
774
|
+
setWarningText("Unknown status");
|
|
775
|
+
setTimeout(() => {
|
|
776
|
+
setInfoOpen(false);
|
|
777
|
+
setUpBtnDisabled(false);
|
|
778
|
+
setUpBtnText("Upload");
|
|
779
|
+
}, 2e3);
|
|
780
|
+
setOpen(true);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}).catch((error) => {
|
|
784
|
+
setUpBtnDisabled(false);
|
|
785
|
+
setUpBtnText("Upload");
|
|
786
|
+
setInfoOpen(true);
|
|
787
|
+
setInfoStyle("error");
|
|
788
|
+
setWarningText("Upload unsuccessful: " + error.message);
|
|
789
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
790
|
+
console.error("Error:", error);
|
|
791
|
+
});
|
|
792
|
+
setUpBtnDisabled(true);
|
|
793
|
+
setUpBtnText("Uploading");
|
|
955
794
|
};
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
handleClose();
|
|
795
|
+
const changeFileName = (e) => {
|
|
796
|
+
setFileAlias(e.target.value);
|
|
959
797
|
};
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
fullWidth: true,
|
|
968
|
-
variant: "standard",
|
|
969
|
-
InputProps: {
|
|
970
|
-
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material9.InputAdornment, { position: "end", sx: { whiteSpace: "nowrap" }, children: suffix })
|
|
971
|
-
},
|
|
972
|
-
defaultValue: text,
|
|
973
|
-
onChange: (e) => setText(e.target.value)
|
|
974
|
-
}
|
|
975
|
-
) }),
|
|
976
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_DialogActions5.default, { children: [
|
|
977
|
-
cancellable && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: "Cancel" }),
|
|
978
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: "Confirm" })
|
|
979
|
-
] })
|
|
980
|
-
] })
|
|
981
|
-
] });
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
// src/CmrTabs/CmrTabs.tsx
|
|
985
|
-
var React10 = __toESM(require("react"));
|
|
986
|
-
var import_Tabs = __toESM(require("@mui/material/Tabs"));
|
|
987
|
-
var import_Tab = __toESM(require("@mui/material/Tab"));
|
|
988
|
-
var import_Container = __toESM(require("@mui/material/Container"));
|
|
989
|
-
var import_Typography2 = __toESM(require("@mui/material/Typography"));
|
|
990
|
-
var import_Box2 = __toESM(require("@mui/material/Box"));
|
|
991
|
-
var import_react7 = require("react");
|
|
992
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
993
|
-
function CustomTabPanel(props) {
|
|
994
|
-
const { children, value, index, ...other } = props;
|
|
995
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
996
|
-
"div",
|
|
997
|
-
{
|
|
998
|
-
role: "tabpanel",
|
|
999
|
-
hidden: value !== index,
|
|
1000
|
-
id: `simple-tabpanel-${index}`,
|
|
1001
|
-
"aria-labelledby": `simple-tab-${index}`,
|
|
1002
|
-
...other,
|
|
1003
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Box2.default, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Typography2.default, { children }) })
|
|
798
|
+
function loadFiles(files) {
|
|
799
|
+
if (files.length == 0) {
|
|
800
|
+
setInfoOpen(true);
|
|
801
|
+
setInfoStyle("warning");
|
|
802
|
+
setWarningText("No file selected");
|
|
803
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
804
|
+
return;
|
|
1004
805
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
806
|
+
if (files.length > 1) {
|
|
807
|
+
setInfoOpen(true);
|
|
808
|
+
setInfoStyle("warning");
|
|
809
|
+
setWarningText("Only accepts one file at a time");
|
|
810
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
let file = files[0];
|
|
814
|
+
setUploaded([file]);
|
|
815
|
+
function readFile(file2) {
|
|
816
|
+
setFileOriginalName(file2.name);
|
|
817
|
+
setFileAlias(file2.name);
|
|
818
|
+
const units = [
|
|
819
|
+
"B",
|
|
820
|
+
"KB",
|
|
821
|
+
"MB",
|
|
822
|
+
"GB",
|
|
823
|
+
"TB",
|
|
824
|
+
"PB",
|
|
825
|
+
"EB",
|
|
826
|
+
"ZB",
|
|
827
|
+
"YB"
|
|
828
|
+
];
|
|
829
|
+
let numberOfBytes = file2.size;
|
|
830
|
+
const exponent = Math.min(
|
|
831
|
+
Math.floor(Math.log(numberOfBytes) / Math.log(1024)),
|
|
832
|
+
units.length - 1
|
|
833
|
+
);
|
|
834
|
+
const approx = numberOfBytes / 1024 ** exponent;
|
|
835
|
+
const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(3)} ${units[exponent]}`;
|
|
836
|
+
setFileSize(output);
|
|
837
|
+
}
|
|
838
|
+
readFile(file);
|
|
839
|
+
}
|
|
840
|
+
let initialized = false;
|
|
841
|
+
let fileInput = (inputRef) => {
|
|
842
|
+
if (initialized)
|
|
843
|
+
return;
|
|
844
|
+
inputRef.addEventListener("dragover", function(e) {
|
|
845
|
+
e.stopPropagation();
|
|
846
|
+
e.preventDefault();
|
|
847
|
+
if (e.dataTransfer.files) {
|
|
848
|
+
let draggedFiles = e.dataTransfer.files;
|
|
849
|
+
if (draggedFiles.length > 1) {
|
|
850
|
+
setUploadBoxWarning("Only one file can be uploaded at a time");
|
|
851
|
+
} else if (fileExtension != void 0 && draggedFiles.length != 0 && getExtension(draggedFiles[0].name) != fileExtension) {
|
|
852
|
+
setUploadBoxWarning(`Only accepting files with extension ${fileExtension}`);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
e.dataTransfer.dropEffect = "copy";
|
|
856
|
+
});
|
|
857
|
+
inputRef.addEventListener("drop", function(e) {
|
|
858
|
+
e.stopPropagation();
|
|
859
|
+
e.preventDefault();
|
|
860
|
+
setUploadBoxWarning(void 0);
|
|
861
|
+
let files = e.dataTransfer.files;
|
|
862
|
+
if (files.length > 1) {
|
|
863
|
+
setInfoOpen(true);
|
|
864
|
+
setInfoStyle("warning");
|
|
865
|
+
setWarningText("Only one file can be uploaded at a time");
|
|
866
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
867
|
+
return;
|
|
868
|
+
} else if (fileExtension != void 0 && `.${getExtension(files[0].name)}` != fileExtension) {
|
|
869
|
+
setInfoOpen(true);
|
|
870
|
+
setInfoStyle("warning");
|
|
871
|
+
setWarningText(`Only accepting files with extension ${fileExtension}`);
|
|
872
|
+
setTimeout(() => setInfoOpen(false), 2500);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
loadFiles(files);
|
|
876
|
+
});
|
|
877
|
+
inputRef.addEventListener("dragleave", () => {
|
|
878
|
+
setUploadBoxWarning(void 0);
|
|
879
|
+
});
|
|
880
|
+
initialized = true;
|
|
1011
881
|
};
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
props.onTabSelected(newValue);
|
|
882
|
+
const fileInputClick = (e) => {
|
|
883
|
+
const fileElem = document.getElementById("file-window");
|
|
884
|
+
e.preventDefault();
|
|
885
|
+
if (fileElem) {
|
|
886
|
+
fileElem.click();
|
|
887
|
+
}
|
|
1019
888
|
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
import_Tabs.default,
|
|
889
|
+
const loadSelectedFiles = (e) => {
|
|
890
|
+
e.preventDefault();
|
|
891
|
+
const fileElem = document.getElementById("file-window");
|
|
892
|
+
loadFiles(fileElem.files);
|
|
893
|
+
};
|
|
894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Dialog5.default, { open, onClose: handleClose, children: [
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_DialogTitle5.default, { children: "File Upload" }),
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_DialogContent5.default, { children: [
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_DialogContentText4.default, {}),
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_DialogContent5.default, { dividers: true, children: [
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
900
|
+
import_Box2.default,
|
|
1033
901
|
{
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
backgroundColor: "#580F8B"
|
|
1041
|
-
}
|
|
902
|
+
width: 500,
|
|
903
|
+
height: 250,
|
|
904
|
+
style: {
|
|
905
|
+
borderStyle: "dashed",
|
|
906
|
+
borderRadius: "5pt",
|
|
907
|
+
borderColor: uploadBoxWarning == void 0 ? "lightGray" : "#BA3C3C"
|
|
1042
908
|
},
|
|
1043
|
-
children:
|
|
909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Typography2.default, { component: "div", style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
910
|
+
import_Box2.default,
|
|
911
|
+
{
|
|
912
|
+
style: {
|
|
913
|
+
display: "flex",
|
|
914
|
+
flexDirection: "column",
|
|
915
|
+
justifyContent: "center",
|
|
916
|
+
alignItems: "center",
|
|
917
|
+
height: "100%"
|
|
918
|
+
},
|
|
919
|
+
onClick: fileInputClick,
|
|
920
|
+
ref: fileInput,
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Typography2.default, { variant: "body1", align: "center", style: { marginTop: "auto" }, children: [
|
|
923
|
+
"Drag & Drop or Click to Upload Your File Here ",
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("sup", { children: "*" })
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Typography2.default, { 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." })
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
) })
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
933
|
+
"input",
|
|
934
|
+
{
|
|
935
|
+
type: "file",
|
|
936
|
+
id: "file-window",
|
|
937
|
+
multiple: true,
|
|
938
|
+
accept: fileExtension == void 0 ? "*" : fileExtension,
|
|
939
|
+
style: { display: "none" },
|
|
940
|
+
onChange: loadSelectedFiles
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Box2.default, { component: "form", sx: { "& .MuiTextField-root": { m: 2, width: "25ch", mb: 0 } }, children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
945
|
+
template.showFileName && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
946
|
+
import_TextField4.default,
|
|
947
|
+
{
|
|
948
|
+
required: true,
|
|
949
|
+
style: { marginTop: "30px" },
|
|
950
|
+
label: `File Alias:`,
|
|
951
|
+
value: fileAlias,
|
|
952
|
+
variant: "standard",
|
|
953
|
+
onChange: changeFileName
|
|
954
|
+
}
|
|
955
|
+
),
|
|
956
|
+
fileOriginalName != "" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label_default, { style: { marginLeft: "16px", fontSize: "9pt", color: "#267833" }, children: fileOriginalName }),
|
|
957
|
+
template.showDatabase && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
958
|
+
import_TextField4.default,
|
|
959
|
+
{
|
|
960
|
+
select: true,
|
|
961
|
+
label: "Database:",
|
|
962
|
+
defaultValue: "s3",
|
|
963
|
+
helperText: "Upstream Storage Location",
|
|
964
|
+
variant: "standard",
|
|
965
|
+
children: [{ value: "s3", label: "S3" }].map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material10.MenuItem, { value: option.value, children: option.label }, option.value))
|
|
966
|
+
}
|
|
967
|
+
)
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
970
|
+
template.showFileSize && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
971
|
+
import_TextField4.default,
|
|
972
|
+
{
|
|
973
|
+
label: "File Size:",
|
|
974
|
+
value: fileSize,
|
|
975
|
+
InputProps: {
|
|
976
|
+
readOnly: true
|
|
977
|
+
},
|
|
978
|
+
variant: "standard"
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material10.Collapse, { in: infoOpen, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material10.Alert, { severity: infoStyle, sx: { m: 1 }, children: warningText }) })
|
|
982
|
+
] })
|
|
983
|
+
] })
|
|
984
|
+
] }),
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_DialogActions5.default, { children: [
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
987
|
+
import_Button.default,
|
|
988
|
+
{
|
|
989
|
+
color: "inherit",
|
|
990
|
+
sx: { color: "#333" },
|
|
991
|
+
disabled: UpBtnDisabled,
|
|
992
|
+
onClick: handleClose,
|
|
993
|
+
children: "Cancel"
|
|
994
|
+
}
|
|
995
|
+
),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
997
|
+
import_Button.default,
|
|
998
|
+
{
|
|
999
|
+
variant: "contained",
|
|
1000
|
+
disabled: UpBtnDisabled,
|
|
1001
|
+
onClick: handleConfirm,
|
|
1002
|
+
children: UpBtnText
|
|
1044
1003
|
}
|
|
1045
|
-
) }),
|
|
1046
|
-
props.tabList.map(
|
|
1047
|
-
(tab, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CustomTabPanel, { value, index, children: (0, import_react7.cloneElement)(tab.children, {
|
|
1048
|
-
visible: value == index
|
|
1049
|
-
}) })
|
|
1050
1004
|
)
|
|
1051
|
-
]
|
|
1052
|
-
}
|
|
1053
|
-
);
|
|
1005
|
+
] })
|
|
1006
|
+
] })
|
|
1007
|
+
] }) });
|
|
1054
1008
|
}
|
|
1055
1009
|
|
|
1056
|
-
// src/CmrComponents/
|
|
1057
|
-
var
|
|
1058
|
-
var import_material11 = require("@mui/material");
|
|
1059
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1060
|
-
var CmrCheckbox = (props) => {
|
|
1061
|
-
const { defaultChecked, onChange, children, ...rest } = props;
|
|
1062
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1063
|
-
import_material11.FormControlLabel,
|
|
1064
|
-
{
|
|
1065
|
-
disabled: props.disabled,
|
|
1066
|
-
style: props.style,
|
|
1067
|
-
className: props.className,
|
|
1068
|
-
control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material10.Checkbox, { style: props.style, checked: props.checked, defaultChecked, onChange }),
|
|
1069
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { children: props.children }),
|
|
1070
|
-
sx: props.sx,
|
|
1071
|
-
labelPlacement: "end"
|
|
1072
|
-
}
|
|
1073
|
-
);
|
|
1074
|
-
};
|
|
1075
|
-
var Checkbox_default = CmrCheckbox;
|
|
1076
|
-
|
|
1077
|
-
// src/CmrComponents/input-number/InputNumber.tsx
|
|
1078
|
-
var import_antd2 = require("antd");
|
|
1079
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1080
|
-
var CmrInputNumber = (props) => {
|
|
1081
|
-
const { defaultValue, style, max, min, value, onChange, children, ...rest } = props;
|
|
1082
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd2.InputNumber, { defaultValue, max, style, min, value, onChange, ...rest, children });
|
|
1083
|
-
};
|
|
1084
|
-
var InputNumber_default = CmrInputNumber;
|
|
1085
|
-
|
|
1086
|
-
// src/CmrComponents/tooltip/Tooltip.tsx
|
|
1087
|
-
var import_antd3 = require("antd");
|
|
1010
|
+
// src/CmrComponents/upload/Upload.tsx
|
|
1011
|
+
var import_axios = __toESM(require("axios"));
|
|
1088
1012
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1089
|
-
var
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
{
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
mouseEnterDelay,
|
|
1110
|
-
mouseLeaveDelay,
|
|
1111
|
-
overlayClassName,
|
|
1112
|
-
placement,
|
|
1113
|
-
visible,
|
|
1114
|
-
...rest
|
|
1013
|
+
var CmrUpload = (props) => {
|
|
1014
|
+
let [open, setOpen] = (0, import_react7.useState)(false);
|
|
1015
|
+
let [uploading, setUploading] = (0, import_react7.useState)(false);
|
|
1016
|
+
let [progress, setProgress] = (0, import_react7.useState)(0);
|
|
1017
|
+
let [uploadedFile, setUploadedFile] = (0, import_react7.useState)(void 0);
|
|
1018
|
+
const upload = async (file, fileAlias, fileDatabase) => {
|
|
1019
|
+
setUploading(true);
|
|
1020
|
+
const onProgress = (progress2) => {
|
|
1021
|
+
let percentage = progress2 * 99;
|
|
1022
|
+
props.uploadProgressed && props.uploadProgressed(+percentage.toFixed(2));
|
|
1023
|
+
setProgress(+percentage.toFixed(2));
|
|
1024
|
+
};
|
|
1025
|
+
if (props.uploadStarted)
|
|
1026
|
+
props.uploadStarted();
|
|
1027
|
+
let status = 0;
|
|
1028
|
+
if (props.beforeUpload != void 0 && !await props.beforeUpload(file)) {
|
|
1029
|
+
if (props.uploadEnded)
|
|
1030
|
+
props.uploadEnded();
|
|
1031
|
+
setUploading(false);
|
|
1032
|
+
return 200;
|
|
1115
1033
|
}
|
|
1116
|
-
|
|
1034
|
+
if (props.preprocess) {
|
|
1035
|
+
let processed = await props.preprocess(file);
|
|
1036
|
+
if (processed == void 0)
|
|
1037
|
+
return failUpload();
|
|
1038
|
+
if (typeof processed == "number") {
|
|
1039
|
+
setUploading(false);
|
|
1040
|
+
return processed;
|
|
1041
|
+
}
|
|
1042
|
+
file = processed;
|
|
1043
|
+
}
|
|
1044
|
+
if (props.uploadHandler != void 0) {
|
|
1045
|
+
status = await props.uploadHandler(file, fileAlias, fileDatabase, onProgress, props.onUploaded);
|
|
1046
|
+
setUploadedFile(props.reusable ? void 0 : file.name);
|
|
1047
|
+
} else if (props.createPayload) {
|
|
1048
|
+
let payload = await props.createPayload(file, fileAlias, fileDatabase);
|
|
1049
|
+
if (payload == void 0) {
|
|
1050
|
+
return failUpload();
|
|
1051
|
+
}
|
|
1052
|
+
payload.config.onUploadProgress = (progressEvent) => {
|
|
1053
|
+
if (progressEvent.total == void 0)
|
|
1054
|
+
return;
|
|
1055
|
+
onProgress(progressEvent.loaded / progressEvent.total);
|
|
1056
|
+
};
|
|
1057
|
+
const res = await import_axios.default.post(payload.destination, payload.lambdaFile, payload.config);
|
|
1058
|
+
status = res.status;
|
|
1059
|
+
if (status === 200) {
|
|
1060
|
+
console.log(res.data);
|
|
1061
|
+
await import_axios.default.put(res.data.upload_url, payload.file, {
|
|
1062
|
+
headers: {
|
|
1063
|
+
"Content-Type": payload.file.type
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
await props.onUploaded(res, payload.file);
|
|
1067
|
+
setUploadedFile(props.reusable ? void 0 : payload.file.name);
|
|
1068
|
+
}
|
|
1069
|
+
} else {
|
|
1070
|
+
return failUpload();
|
|
1071
|
+
}
|
|
1072
|
+
if (props.uploadEnded)
|
|
1073
|
+
props.uploadEnded();
|
|
1074
|
+
setUploading(false);
|
|
1075
|
+
setProgress(0);
|
|
1076
|
+
return status;
|
|
1077
|
+
};
|
|
1078
|
+
function failUpload() {
|
|
1079
|
+
setUploading(false);
|
|
1080
|
+
setProgress(0);
|
|
1081
|
+
if (props.uploadFailed)
|
|
1082
|
+
return props.uploadFailed();
|
|
1083
|
+
return 0;
|
|
1084
|
+
}
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react7.default.Fragment, { children: [
|
|
1086
|
+
!uploading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1087
|
+
import_material11.Button,
|
|
1088
|
+
{
|
|
1089
|
+
fullWidth: props.fullWidth,
|
|
1090
|
+
style: props.style,
|
|
1091
|
+
variant: uploadedFile == void 0 ? "contained" : "outlined",
|
|
1092
|
+
onClick: () => {
|
|
1093
|
+
setOpen(true);
|
|
1094
|
+
},
|
|
1095
|
+
color: props.color || "primary",
|
|
1096
|
+
sx: props.sx,
|
|
1097
|
+
children: [
|
|
1098
|
+
props.changeNameAfterUpload ? uploadedFile === void 0 ? props.uploadButtonName ? props.uploadButtonName : "Upload" : uploadedFile : props.uploadButtonName ? props.uploadButtonName : "Upload",
|
|
1099
|
+
" "
|
|
1100
|
+
]
|
|
1101
|
+
}
|
|
1102
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material11.Button, { fullWidth: props.fullWidth, style: props.style, variant: "contained", sx: { overflowWrap: "inherit" }, color: "primary", disabled: true, children: [
|
|
1103
|
+
"Uploading ",
|
|
1104
|
+
progress,
|
|
1105
|
+
"%"
|
|
1106
|
+
] }),
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1108
|
+
CmrUploadWindow,
|
|
1109
|
+
{
|
|
1110
|
+
open,
|
|
1111
|
+
setOpen,
|
|
1112
|
+
upload,
|
|
1113
|
+
fileExtension: props.fileExtension,
|
|
1114
|
+
template: { showFileName: true, showFileSize: true }
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1117
|
+
] });
|
|
1117
1118
|
};
|
|
1118
|
-
|
|
1119
|
+
CmrUpload.defaultProps = {
|
|
1120
|
+
changeNameAfterUpload: true
|
|
1121
|
+
};
|
|
1122
|
+
var Upload_default = CmrUpload;
|
|
1119
1123
|
|
|
1120
1124
|
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1121
|
-
var import_react8 = __toESM(require("react"));
|
|
1122
1125
|
var import_material12 = require("@mui/material");
|
|
1123
1126
|
var import_Select = __toESM(require("@mui/material/Select"));
|
|
1124
1127
|
var import_Dialog6 = __toESM(require("@mui/material/Dialog"));
|
|
@@ -1274,5 +1277,6 @@ var CmrTable2 = CmrTable_default;
|
|
|
1274
1277
|
CmrSelect,
|
|
1275
1278
|
CmrTable,
|
|
1276
1279
|
CmrTabs,
|
|
1277
|
-
CmrTooltip
|
|
1280
|
+
CmrTooltip,
|
|
1281
|
+
CmrUploadWindow
|
|
1278
1282
|
});
|