@dexteel/mesf-core 6.1.4 → 6.2.1
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/index.esm.js +39 -37
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.2.1](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.2.0...mesf-core-v6.2.1) (2025-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **logbook:** fix attachment download and delete dialog state management ([95c588e](https://github.com/dexteel/mesf-core-frontend/commit/95c588ef9071a1872fe201ea825e0f7e0636cf35))
|
|
9
|
+
|
|
10
|
+
## [6.2.0](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.4...mesf-core-v6.2.0) (2025-10-27)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **Logbook:** add preview and download functionality for attachments ([4502347](https://github.com/dexteel/mesf-core-frontend/commit/4502347138321f1edb6539693121f8add29a7147))
|
|
16
|
+
|
|
3
17
|
## [6.1.4](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.3...mesf-core-v6.1.4) (2025-10-24)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import React__default, { createContext, useContext, useState, useRef, useEffect,
|
|
|
8
8
|
import IconButton from '@material-ui/core/IconButton';
|
|
9
9
|
import CloseIcon from '@material-ui/icons/Close';
|
|
10
10
|
import Alert$3 from '@material-ui/lab/Alert';
|
|
11
|
-
import { ArrowRight, ArrowBackRounded, ArrowForwardRounded, SkipNext, ChevronLeft, ChevronRight, Send, Menu as Menu$1, People, Storage, Group, Assignment, Chat, Timeline, ViewList, Build, Settings as Settings$2, AttachFile, CloudUpload, GetApp, Delete } from '@material-ui/icons';
|
|
11
|
+
import { ArrowRight, ArrowBackRounded, ArrowForwardRounded, SkipNext, ChevronLeft, ChevronRight, Send, Menu as Menu$1, People, Storage, Group, Assignment, Chat, Timeline, ViewList, Build, Settings as Settings$2, AttachFile, CloudUpload, Visibility, GetApp, Delete } from '@material-ui/icons';
|
|
12
12
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
13
13
|
import moment$9 from 'moment-timezone';
|
|
14
14
|
import { useParams, useNavigate, useSearchParams, Link, Navigate, Routes, Route, useLocation, BrowserRouter } from 'react-router-dom';
|
|
@@ -15441,16 +15441,14 @@ var useEntrySubmission = function (_a) {
|
|
|
15441
15441
|
|
|
15442
15442
|
var DeleteAttachmentConfirmationDialog = function (_a) {
|
|
15443
15443
|
var open = _a.open, attachmentName = _a.attachmentName, onClose = _a.onClose, _b = _a.isDeleting, isDeleting = _b === void 0 ? false : _b;
|
|
15444
|
-
var _c = useState(false), isClosing = _c[0], setIsClosing = _c[1];
|
|
15445
15444
|
var handleCancel = function () {
|
|
15446
|
-
if (
|
|
15445
|
+
if (isDeleting)
|
|
15447
15446
|
return;
|
|
15448
15447
|
onClose(false);
|
|
15449
15448
|
};
|
|
15450
15449
|
var handleConfirm = function () {
|
|
15451
|
-
if (
|
|
15450
|
+
if (isDeleting)
|
|
15452
15451
|
return;
|
|
15453
|
-
setIsClosing(true);
|
|
15454
15452
|
onClose(true);
|
|
15455
15453
|
};
|
|
15456
15454
|
return (React__default.createElement(Dialog$1, { open: open, onClose: handleCancel, "aria-labelledby": "delete-attachment-dialog-title", "aria-describedby": "delete-attachment-dialog-description" },
|
|
@@ -15461,8 +15459,8 @@ var DeleteAttachmentConfirmationDialog = function (_a) {
|
|
|
15461
15459
|
React__default.createElement("b", null, attachmentName),
|
|
15462
15460
|
"? This action cannot be undone.")),
|
|
15463
15461
|
React__default.createElement(DialogActions$1, null,
|
|
15464
|
-
React__default.createElement(Button, { onClick: handleCancel, color: "default", disabled:
|
|
15465
|
-
React__default.createElement(Button, { onClick: handleConfirm, color: "secondary", variant: "contained", disabled:
|
|
15462
|
+
React__default.createElement(Button, { onClick: handleCancel, color: "default", disabled: isDeleting }, "Cancel"),
|
|
15463
|
+
React__default.createElement(Button, { onClick: handleConfirm, color: "secondary", variant: "contained", disabled: isDeleting, startIcon: isDeleting && React__default.createElement(CircularProgress, { size: "1rem" }) }, "Delete"))));
|
|
15466
15464
|
};
|
|
15467
15465
|
|
|
15468
15466
|
var useStyles$2 = makeStyles$1(function (theme) {
|
|
@@ -15505,6 +15503,7 @@ var useStyles$2 = makeStyles$1(function (theme) {
|
|
|
15505
15503
|
},
|
|
15506
15504
|
});
|
|
15507
15505
|
});
|
|
15506
|
+
var PREVIEWABLE_EXTENSIONS = ["jpg", "jpeg", "png", "pdf"];
|
|
15508
15507
|
var AttachmentModal = function (_a) {
|
|
15509
15508
|
var open = _a.open, onClose = _a.onClose, entryId = _a.entryId, isEditing = _a.isEditing, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted;
|
|
15510
15509
|
var classes = useStyles$2();
|
|
@@ -15553,9 +15552,11 @@ var AttachmentModal = function (_a) {
|
|
|
15553
15552
|
// Mutations
|
|
15554
15553
|
var uploadMutation = useMutation(upsertEntryAttachment, {
|
|
15555
15554
|
onSuccess: function () {
|
|
15556
|
-
queryClient.invalidateQueries(
|
|
15557
|
-
|
|
15558
|
-
|
|
15555
|
+
queryClient.invalidateQueries({
|
|
15556
|
+
queryKey: ["entryAttachments", currentEntryId],
|
|
15557
|
+
});
|
|
15558
|
+
queryClient.invalidateQueries({ queryKey: ["entries"] });
|
|
15559
|
+
queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
|
|
15559
15560
|
},
|
|
15560
15561
|
onError: function (error) {
|
|
15561
15562
|
setError(error.message);
|
|
@@ -15566,9 +15567,11 @@ var AttachmentModal = function (_a) {
|
|
|
15566
15567
|
return deleteEntryAttachment(entryAttachmentId, uploadFileId);
|
|
15567
15568
|
}, {
|
|
15568
15569
|
onSuccess: function () {
|
|
15569
|
-
queryClient.invalidateQueries(
|
|
15570
|
-
|
|
15571
|
-
|
|
15570
|
+
queryClient.invalidateQueries({
|
|
15571
|
+
queryKey: ["entryAttachments", currentEntryId],
|
|
15572
|
+
});
|
|
15573
|
+
queryClient.invalidateQueries({ queryKey: ["entries"] });
|
|
15574
|
+
queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
|
|
15572
15575
|
},
|
|
15573
15576
|
onError: function (error) {
|
|
15574
15577
|
setError(error.message);
|
|
@@ -15608,9 +15611,11 @@ var AttachmentModal = function (_a) {
|
|
|
15608
15611
|
// Then create the attachment record
|
|
15609
15612
|
_b.sent();
|
|
15610
15613
|
// Invalidate queries for the specific entry and the main entries lists
|
|
15611
|
-
queryClient.invalidateQueries(
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
+
queryClient.invalidateQueries({
|
|
15615
|
+
queryKey: ["entryAttachments", targetEntryId],
|
|
15616
|
+
});
|
|
15617
|
+
queryClient.invalidateQueries({ queryKey: ["entries"] });
|
|
15618
|
+
queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
|
|
15614
15619
|
_b.label = 5;
|
|
15615
15620
|
case 5:
|
|
15616
15621
|
_i++;
|
|
@@ -15727,21 +15732,22 @@ var AttachmentModal = function (_a) {
|
|
|
15727
15732
|
}
|
|
15728
15733
|
setAttachmentToDelete(null);
|
|
15729
15734
|
};
|
|
15730
|
-
//
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
link.href =
|
|
15738
|
-
|
|
15739
|
-
|
|
15735
|
+
// Check if file can be previewed in browser
|
|
15736
|
+
var isPreviewable = function (fileName) {
|
|
15737
|
+
var extension = fileName.toLowerCase().split(".").pop() || "";
|
|
15738
|
+
return PREVIEWABLE_EXTENSIONS.includes(extension);
|
|
15739
|
+
};
|
|
15740
|
+
var handleDownloadAttachment = function (attachment) {
|
|
15741
|
+
var link = document.createElement("a");
|
|
15742
|
+
link.href = attachment.URL;
|
|
15743
|
+
console.log("attachment", attachment);
|
|
15744
|
+
console.log("attachment.URL", attachment.URL);
|
|
15745
|
+
console.log("link.href", link.href);
|
|
15746
|
+
link.setAttribute("target", "_blank");
|
|
15747
|
+
link.setAttribute("download", attachment.AttachmentName);
|
|
15740
15748
|
document.body.appendChild(link);
|
|
15741
15749
|
link.click();
|
|
15742
|
-
document.body.removeChild(link);
|
|
15743
15750
|
};
|
|
15744
|
-
*/
|
|
15745
15751
|
var onDrop = useCallback(function (acceptedFiles) {
|
|
15746
15752
|
if (isEditing) {
|
|
15747
15753
|
handleFileUpload(acceptedFiles);
|
|
@@ -15779,13 +15785,9 @@ var AttachmentModal = function (_a) {
|
|
|
15779
15785
|
React__default.createElement(AttachFile, null)),
|
|
15780
15786
|
React__default.createElement(ListItemText, { primary: attachment.AttachmentName, secondary: "Added by ".concat(attachment.CreatedBy, " on ").concat(attachment.CreationTime.toLocaleDateString()) }),
|
|
15781
15787
|
React__default.createElement(ListItemSecondaryAction, null,
|
|
15782
|
-
React__default.createElement("a",
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
borderRadius: "50%",
|
|
15786
|
-
color: "inherit",
|
|
15787
|
-
textDecoration: "none",
|
|
15788
|
-
}, className: "MuiButtonBase-root MuiIconButton-root" },
|
|
15788
|
+
isPreviewable(attachment.AttachmentName) && (React__default.createElement(IconButton$1, { component: "a", href: attachment.URL, target: "_blank", rel: "noopener noreferrer", title: "Preview", size: "small", style: { marginRight: 8 } },
|
|
15789
|
+
React__default.createElement(Visibility, null))),
|
|
15790
|
+
React__default.createElement(IconButton$1, { onClick: function () { return handleDownloadAttachment(attachment); }, title: "Download", size: "small", style: { marginRight: isEditing ? 8 : 0 } },
|
|
15789
15791
|
React__default.createElement(GetApp, null)),
|
|
15790
15792
|
isEditing && (React__default.createElement(IconButton$1, { edge: "end", onClick: function () {
|
|
15791
15793
|
return handleDeleteAttachment(attachment.EntryAttachmentId, attachment.UploadFileId, attachment.AttachmentName);
|
|
@@ -16716,7 +16718,7 @@ var routeLogbookEntry = "/logbook/entry";
|
|
|
16716
16718
|
var LogbookPage$1 = function () {
|
|
16717
16719
|
return (React__default.createElement(React__default.Fragment, null,
|
|
16718
16720
|
React__default.createElement(HelmetDexteel, { title: "Logbook Entry" }),
|
|
16719
|
-
React__default.createElement(Grid, { container: true, style: { padding: 20 } },
|
|
16721
|
+
React__default.createElement(Grid, { container: true, style: { padding: 20 }, onContextMenu: function (e) { return e.preventDefault(); } },
|
|
16720
16722
|
React__default.createElement(Logbook$1, null))));
|
|
16721
16723
|
};
|
|
16722
16724
|
|
|
@@ -17311,7 +17313,7 @@ var routeLogbookReport = "/logbook/report";
|
|
|
17311
17313
|
var LogbookPage = function () {
|
|
17312
17314
|
return (React__default.createElement(React__default.Fragment, null,
|
|
17313
17315
|
React__default.createElement(HelmetDexteel, { title: "Logbook Report" }),
|
|
17314
|
-
React__default.createElement(Grid, { container: true, style: { padding: 20 } },
|
|
17316
|
+
React__default.createElement(Grid, { container: true, style: { padding: 20 }, onContextMenu: function (e) { return e.preventDefault(); } },
|
|
17315
17317
|
React__default.createElement(Logbook, null))));
|
|
17316
17318
|
};
|
|
17317
17319
|
|