@dexteel/mesf-core 6.2.0 → 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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "6.2.0"
2
+ ".": "6.2.1"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
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)
4
11
 
5
12
 
package/dist/index.esm.js CHANGED
@@ -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 (isClosing)
15445
+ if (isDeleting)
15447
15446
  return;
15448
15447
  onClose(false);
15449
15448
  };
15450
15449
  var handleConfirm = function () {
15451
- if (isClosing)
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: isClosing }, "Cancel"),
15465
- React__default.createElement(Button, { onClick: handleConfirm, color: "secondary", variant: "contained", disabled: isClosing, startIcon: isDeleting && React__default.createElement(CircularProgress, { size: "1rem" }) }, "Delete"))));
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) {
@@ -15739,36 +15737,17 @@ var AttachmentModal = function (_a) {
15739
15737
  var extension = fileName.toLowerCase().split(".").pop() || "";
15740
15738
  return PREVIEWABLE_EXTENSIONS.includes(extension);
15741
15739
  };
15742
- var handleDownloadAttachment = function (attachment) { return __awaiter(void 0, void 0, void 0, function () {
15743
- var response, blob, url, link, error_4;
15744
- return __generator(this, function (_a) {
15745
- switch (_a.label) {
15746
- case 0:
15747
- _a.trys.push([0, 3, , 4]);
15748
- return [4 /*yield*/, fetch(attachment.URL)];
15749
- case 1:
15750
- response = _a.sent();
15751
- return [4 /*yield*/, response.blob()];
15752
- case 2:
15753
- blob = _a.sent();
15754
- url = window.URL.createObjectURL(blob);
15755
- link = document.createElement("a");
15756
- link.href = url;
15757
- link.download = attachment.FileName || attachment.AttachmentName;
15758
- document.body.appendChild(link);
15759
- link.click();
15760
- document.body.removeChild(link);
15761
- window.URL.revokeObjectURL(url);
15762
- return [3 /*break*/, 4];
15763
- case 3:
15764
- error_4 = _a.sent();
15765
- console.error("Download failed:", error_4);
15766
- setError("Failed to download file: ".concat(error_4));
15767
- return [3 /*break*/, 4];
15768
- case 4: return [2 /*return*/];
15769
- }
15770
- });
15771
- }); };
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);
15748
+ document.body.appendChild(link);
15749
+ link.click();
15750
+ };
15772
15751
  var onDrop = useCallback(function (acceptedFiles) {
15773
15752
  if (isEditing) {
15774
15753
  handleFileUpload(acceptedFiles);
@@ -15806,7 +15785,7 @@ var AttachmentModal = function (_a) {
15806
15785
  React__default.createElement(AttachFile, null)),
15807
15786
  React__default.createElement(ListItemText, { primary: attachment.AttachmentName, secondary: "Added by ".concat(attachment.CreatedBy, " on ").concat(attachment.CreationTime.toLocaleDateString()) }),
15808
15787
  React__default.createElement(ListItemSecondaryAction, null,
15809
- isPreviewable(attachment.FileName || attachment.AttachmentName) && (React__default.createElement(IconButton$1, { component: "a", href: attachment.URL, target: "_blank", rel: "noopener noreferrer", title: "Preview", size: "small", style: { marginRight: 8 } },
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 } },
15810
15789
  React__default.createElement(Visibility, null))),
15811
15790
  React__default.createElement(IconButton$1, { onClick: function () { return handleDownloadAttachment(attachment); }, title: "Download", size: "small", style: { marginRight: isEditing ? 8 : 0 } },
15812
15791
  React__default.createElement(GetApp, null)),