@arquimedes.co/eureka-forms 1.9.127 → 1.9.128

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.
@@ -46,6 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import { isUploadedFileObject, } from '../MaterialFileUploadStep';
49
50
  import styles from './FileComponent.module.css';
50
51
  import ClearRoundedIcon from '@material-ui/icons/ClearRounded';
51
52
  import DescriptionRoundedIcon from '@material-ui/icons/DescriptionRounded';
@@ -108,12 +109,19 @@ function FileUploadComponent(_a) {
108
109
  return (_jsx("div", __assign({ className: styles.documentIcon, style: { color: formStyle.primaryColor } }, { children: _jsx(DescriptionRoundedIcon, {}) })));
109
110
  }
110
111
  };
111
- return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.iconContainer }, { children: calcIcon() })), _jsx("div", __assign({ className: fetchDownloadUrl && file.S3Key
112
+ return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.iconContainer }, { children: calcIcon() })), _jsx("div", __assign({ className: (fetchDownloadUrl && file.S3Key) ||
113
+ file.downloadUrl
112
114
  ? styles.downloadableLbl
113
115
  : styles.label, style: {
114
116
  color: error ? formStyle.errorColor : formStyle.textColor,
115
117
  }, onClick: function () {
116
- if (fetchDownloadUrl !== undefined && file.S3Key) {
118
+ if (isUploadedFileObject(file) && file.downloadUrl) {
119
+ var a = document.createElement('a');
120
+ a.href = file.downloadUrl;
121
+ a.setAttribute('download', file.fileName);
122
+ a.click();
123
+ }
124
+ else if (fetchDownloadUrl !== undefined && file.S3Key) {
117
125
  downloadFile();
118
126
  }
119
127
  } }, { children: (_c = (_b = file.file) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : file.fileName })), _jsx("div", __assign({ className: styles.deletBtn, onClick: function () {
@@ -11,6 +11,8 @@ export interface FileObject {
11
11
  export interface UploadedFileObject {
12
12
  fileName: string;
13
13
  S3Key: string;
14
+ downloadUrl?: string;
14
15
  }
16
+ export declare function isUploadedFileObject(file: UploadedFileObject | FileObject): file is UploadedFileObject;
15
17
  declare function UploadStepComponent(props: FileUploadStepProps): JSX.Element;
16
18
  export default UploadStepComponent;
@@ -74,6 +74,9 @@ import { getAcceptedExtensions } from '../../../../constants/Files/FileExtension
74
74
  import { getUploadUrls, postFile } from '../../../../controllers/FileService';
75
75
  import FileComponent from './FileComponent/FileComponent';
76
76
  import maxSize from '../../../../constants/Files/FileMaxSize';
77
+ export function isUploadedFileObject(file) {
78
+ return file.state === undefined && file.S3Key !== undefined;
79
+ }
77
80
  function FileUploadStep(_a) {
78
81
  var step = _a.step, errors = _a.errors, value = _a.value, domain = _a.domain, btnRef = _a.btnRef, postview = _a.postview, onChange = _a.onChange, editable = _a.editable, formStyle = _a.formStyle, clearErrors = _a.clearErrors, fetchDownloadUrl = _a.fetchDownloadUrl;
79
82
  var _b = useState(undefined), error = _b[0], setError = _b[1];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "1.9.127",
4
+ "version": "1.9.128",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",