oa-componentbook 0.18.310 → 0.18.313
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/build/dev/oa-component-upload/CustomUpload.js +282 -0
- package/build/dev/oa-component-upload/styles.js +13 -0
- package/build/dev/oa-component-viewer/CustomViewer.js +326 -0
- package/build/dev/oa-component-viewer/styles.js +14 -0
- package/build/dev/oa-widget-document-upload-card/DocUploadCardWidget.js +179 -0
- package/build/dev/oa-widget-document-upload-card/styles.js +13 -0
- package/build/index.js +14 -0
- package/build/widgets/oa-widget-input-pattern-pin/CustomPinPatternCaptureWidget.js +2 -2
- package/build/widgets/oa-widget-input-pattern-pin/styles.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/es.promise.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _icons = require("@ant-design/icons");
|
|
12
|
+
var _antd = require("antd");
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _CustomModal = _interopRequireDefault(require("../../components/oa-component-modal/CustomModal"));
|
|
16
|
+
var _CustomViewer = _interopRequireDefault(require("../../components/oa-component-viewer/CustomViewer"));
|
|
17
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
18
|
+
var _handIcon = _interopRequireDefault(require("../../images/hand-icon.svg"));
|
|
19
|
+
var _PdfSampleImage = _interopRequireDefault(require("../../images/PdfSampleImage.png"));
|
|
20
|
+
var _styles = require("./styles");
|
|
21
|
+
const _excluded = ["uploadedDocuments", "handleCustomOnChange", "multipleDoc", "showDelete", "formName", "getPreview", "isMandatory", "noOfUpload", "downloadCallback", "showDownloadButton", "showDeleteButton", "deleteHandler", "showRoateButton", "showZoomInButton", "showZoomOutButton"];
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
26
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
+
/**
|
|
29
|
+
* Takes a file and returns a Promise that resolves with the file as a base64 encoded string.
|
|
30
|
+
* The Promise is rejected if there is an error reading the file.
|
|
31
|
+
* @param {File} file The file to be converted to base64
|
|
32
|
+
* @returns {Promise<string>} A Promise that resolves with the file as a base64 encoded string
|
|
33
|
+
*/
|
|
34
|
+
const getBase64 = file => new Promise((resolve, reject) => {
|
|
35
|
+
const reader = new FileReader();
|
|
36
|
+
reader.readAsDataURL(file);
|
|
37
|
+
reader.onload = () => resolve(reader.result);
|
|
38
|
+
reader.onerror = error => reject(error);
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Downloads a file from a base64 encoded string.
|
|
42
|
+
* @param {string} base64String The base64 encoded string of the file to be downloaded
|
|
43
|
+
* @param {string} [fileName] The name of the file to be downloaded. If not provided, the file will be downloaded with the name 'download'.
|
|
44
|
+
* @returns {undefined}
|
|
45
|
+
*/
|
|
46
|
+
const downloadFile = (base64String, fileName) => {
|
|
47
|
+
const link = document.createElement('a');
|
|
48
|
+
link.href = base64String;
|
|
49
|
+
link.download = fileName || 'download';
|
|
50
|
+
link.click();
|
|
51
|
+
};
|
|
52
|
+
function isImageFile(fileName) {
|
|
53
|
+
var _fileName$split;
|
|
54
|
+
// Extract the file extension from the file name
|
|
55
|
+
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split('.')) === null || _fileName$split === void 0 || (_fileName$split = _fileName$split.pop()) === null || _fileName$split === void 0 ? void 0 : _fileName$split.toLowerCase();
|
|
56
|
+
|
|
57
|
+
// Define an array of image file extensions
|
|
58
|
+
const imageFileExtensions = ['jpg', 'jpeg', 'png'];
|
|
59
|
+
|
|
60
|
+
// Check if the file extension is in the array of image file extensions
|
|
61
|
+
if (imageFileExtensions.indexOf(fileExtension) !== -1) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* DocumentUpload is a component that allows users to upload documents. It takes a number of props which control its behavior.
|
|
68
|
+
* @param {object} props The props passed to the component
|
|
69
|
+
* @param {array} [props.uploadedDocuments=[]] An array of documents that have already been uploaded
|
|
70
|
+
* @param {function} props.handleCustomOnChange A function that is called whenever the list of uploaded documents changes
|
|
71
|
+
* @param {number} [props.multipleDoc=0] The maximum number of documents that can be uploaded. If set to 0, there is no limit
|
|
72
|
+
* @param {boolean} [props.showDelete=false] Whether or not to show a delete button next to each uploaded document
|
|
73
|
+
* @param {string} [props.formName] The name of the form field that the uploaded documents should be associated with
|
|
74
|
+
* @param {function} [props.getPreview] A function that is called whenever the user clicks on an uploaded document. It should return a Promise that resolves with the URL of the document
|
|
75
|
+
* @param {boolean} [props.isMandatory=false] Whether or not the component is mandatory
|
|
76
|
+
* @param {number} [props.noOfUpload=1] The number of document that can be uploaded.
|
|
77
|
+
* @param {function} [props.downloadCallback] A function that is called whenever the user clicks on the download button. It should return a Promise that resolves with the URL of the document
|
|
78
|
+
* @param {function} [props.deleteHandler] A function that is called whenever the user clicks on the delete button. It should return a Promise that resolves with the deleted document
|
|
79
|
+
* @returns {object} A React component
|
|
80
|
+
*/
|
|
81
|
+
function DocumentUpload(_ref) {
|
|
82
|
+
let {
|
|
83
|
+
uploadedDocuments = [],
|
|
84
|
+
handleCustomOnChange,
|
|
85
|
+
multipleDoc,
|
|
86
|
+
showDelete,
|
|
87
|
+
formName,
|
|
88
|
+
getPreview,
|
|
89
|
+
isMandatory,
|
|
90
|
+
noOfUpload,
|
|
91
|
+
downloadCallback,
|
|
92
|
+
showDownloadButton,
|
|
93
|
+
showDeleteButton,
|
|
94
|
+
deleteHandler,
|
|
95
|
+
showRoateButton,
|
|
96
|
+
showZoomInButton,
|
|
97
|
+
showZoomOutButton
|
|
98
|
+
} = _ref,
|
|
99
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
100
|
+
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
101
|
+
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
102
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)('');
|
|
103
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
104
|
+
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
105
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, _react.useState)(false);
|
|
106
|
+
const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
|
|
107
|
+
const [selectedDocumentData, setSelectedDocumentData] = (0, _react.useState)({});
|
|
108
|
+
(0, _react.useEffect)(() => {
|
|
109
|
+
setFileList(uploadedDocuments);
|
|
110
|
+
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
111
|
+
const handlePreview = async file => {
|
|
112
|
+
if (file !== null && file !== void 0 && file.originFileObj) {
|
|
113
|
+
setPreviewImage(file);
|
|
114
|
+
} else if ((file === null || file === void 0 ? void 0 : file.fileType) === 'thumbnail') {
|
|
115
|
+
const url = await getPreview();
|
|
116
|
+
setPreviewImage(url);
|
|
117
|
+
} else {
|
|
118
|
+
setPreviewImage(file === null || file === void 0 ? void 0 : file.url);
|
|
119
|
+
}
|
|
120
|
+
setPreviewTitle(file === null || file === void 0 ? void 0 : file.name);
|
|
121
|
+
setPreviewOpen(true);
|
|
122
|
+
setSelectedDocumentData(file);
|
|
123
|
+
};
|
|
124
|
+
const handleChange = async _ref2 => {
|
|
125
|
+
let {
|
|
126
|
+
fileList: newFileList,
|
|
127
|
+
file
|
|
128
|
+
} = _ref2;
|
|
129
|
+
const modifiedList = await Promise.all(newFileList.map(async files => {
|
|
130
|
+
let modifiedFile = files;
|
|
131
|
+
setLoading(true);
|
|
132
|
+
try {
|
|
133
|
+
if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
|
|
134
|
+
await handleCustomOnChange(files);
|
|
135
|
+
modifiedFile.status = 'done';
|
|
136
|
+
if (!isImageFile(file === null || file === void 0 ? void 0 : file.name)) {
|
|
137
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
138
|
+
// delete modifiedFile?.type;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
modifiedFile = null;
|
|
143
|
+
}
|
|
144
|
+
setLoading(false);
|
|
145
|
+
return modifiedFile;
|
|
146
|
+
}));
|
|
147
|
+
const tempList = modifiedList === null || modifiedList === void 0 ? void 0 : modifiedList.filter(Boolean);
|
|
148
|
+
setFileList(tempList);
|
|
149
|
+
};
|
|
150
|
+
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
151
|
+
style: {
|
|
152
|
+
border: 0,
|
|
153
|
+
background: 'none'
|
|
154
|
+
},
|
|
155
|
+
type: "button"
|
|
156
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) :
|
|
157
|
+
/*#__PURE__*/
|
|
158
|
+
// <CustomIcon
|
|
159
|
+
// className="UploadImg"
|
|
160
|
+
// alt="phone img"
|
|
161
|
+
// src={offerImg}
|
|
162
|
+
// />
|
|
163
|
+
_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
164
|
+
const DeleteFile = async () => {
|
|
165
|
+
await deleteHandler(selectedFile);
|
|
166
|
+
setDeleteConfirmation(false);
|
|
167
|
+
if (showDeleteButton) {
|
|
168
|
+
setPreviewOpen(false);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const handleRemove = file => new Promise((resolve, reject) => {
|
|
172
|
+
setSelectedFile(file);
|
|
173
|
+
setDeleteConfirmation(true);
|
|
174
|
+
resolve(false);
|
|
175
|
+
});
|
|
176
|
+
const handleModalDeleteButton = file => {
|
|
177
|
+
setSelectedFile(file);
|
|
178
|
+
setDeleteConfirmation(true);
|
|
179
|
+
};
|
|
180
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.MainStyleSec, null, /*#__PURE__*/_react.default.createElement(_styles.StyledSection, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
181
|
+
className: "uploadDiv"
|
|
182
|
+
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
183
|
+
theme: {
|
|
184
|
+
token: {
|
|
185
|
+
colorBorder: _ColorVariablesMap.default['--color-divider'],
|
|
186
|
+
borderRadiusLG: 4,
|
|
187
|
+
colorPrimaryHover: _ColorVariablesMap.default['--color-primary'],
|
|
188
|
+
colorPrimaryBorder: _ColorVariablesMap.default['--color-divider'],
|
|
189
|
+
colorFillAlter: _ColorVariablesMap.default['--color-secondary-background'],
|
|
190
|
+
colorError: _ColorVariablesMap.default['--color-negative'],
|
|
191
|
+
colorText: _ColorVariablesMap.default['--color-secondary-content']
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
195
|
+
name: formName,
|
|
196
|
+
rules: [{
|
|
197
|
+
validator: (rule, value) => {
|
|
198
|
+
if (isMandatory && !(value !== null && value !== void 0 && value.length)) {
|
|
199
|
+
return Promise.reject(new Error('Please upload the document.'));
|
|
200
|
+
}
|
|
201
|
+
return Promise.resolve();
|
|
202
|
+
}
|
|
203
|
+
}]
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, _extends({
|
|
205
|
+
customRequest: () => {},
|
|
206
|
+
listType: "picture-card",
|
|
207
|
+
fileList: fileList,
|
|
208
|
+
onPreview: handlePreview,
|
|
209
|
+
onChange: handleChange,
|
|
210
|
+
onRemove: handleRemove,
|
|
211
|
+
showUploadList: {
|
|
212
|
+
showDownloadIcon: false,
|
|
213
|
+
showRemoveIcon: showDelete,
|
|
214
|
+
removeIcon: /*#__PURE__*/_react.default.createElement(_icons.DeleteFilled, null),
|
|
215
|
+
previewIcon: /*#__PURE__*/_react.default.createElement(_icons.EyeFilled, null)
|
|
216
|
+
}
|
|
217
|
+
}, antDesignProps), (fileList === null || fileList === void 0 ? void 0 : fileList.length) >= noOfUpload ? null : uploadButton)))))), previewOpen && /*#__PURE__*/_react.default.createElement(_CustomViewer.default, {
|
|
218
|
+
open: previewOpen,
|
|
219
|
+
previewFile: previewImage,
|
|
220
|
+
title: previewTitle,
|
|
221
|
+
onCancel: () => setPreviewOpen(false),
|
|
222
|
+
downloadCallback: downloadCallback,
|
|
223
|
+
deleteCallback: handleModalDeleteButton,
|
|
224
|
+
selectedDocumentData: selectedDocumentData,
|
|
225
|
+
showDownloadButton: showDownloadButton,
|
|
226
|
+
showDeleteButton: showDeleteButton,
|
|
227
|
+
showRoateButton: showRoateButton,
|
|
228
|
+
showZoomInButton: showZoomInButton,
|
|
229
|
+
showZoomOutButton: showZoomOutButton
|
|
230
|
+
}), deleteConfirmation && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
231
|
+
buttonConfig: [{
|
|
232
|
+
callback: () => DeleteFile(),
|
|
233
|
+
label: 'Yes, Delete',
|
|
234
|
+
type: 'danger-primary'
|
|
235
|
+
}],
|
|
236
|
+
imgSrc: _handIcon.default,
|
|
237
|
+
open: deleteConfirmation,
|
|
238
|
+
onCancel: () => setDeleteConfirmation(false),
|
|
239
|
+
title: "Delete Item?",
|
|
240
|
+
className: "delete-modal-confirmation"
|
|
241
|
+
}, "This action will permanently delete the selected item"));
|
|
242
|
+
}
|
|
243
|
+
DocumentUpload.propTypes = {
|
|
244
|
+
uploadedDocuments: _propTypes.default.array,
|
|
245
|
+
handleCustomOnChange: _propTypes.default.func,
|
|
246
|
+
deleteHandler: _propTypes.default.func,
|
|
247
|
+
formName: _propTypes.default.string,
|
|
248
|
+
showDelete: _propTypes.default.bool,
|
|
249
|
+
multipleDoc: _propTypes.default.number,
|
|
250
|
+
getPreview: _propTypes.default.func,
|
|
251
|
+
// Define the getPreview prop type
|
|
252
|
+
isMandatory: _propTypes.default.bool,
|
|
253
|
+
noOfUpload: _propTypes.default.number,
|
|
254
|
+
downloadCallback: _propTypes.default.func,
|
|
255
|
+
// function will be used to download the document
|
|
256
|
+
deleteCallback: _propTypes.default.func,
|
|
257
|
+
// function will be used to delete the document
|
|
258
|
+
showDownloadButton: _propTypes.default.bool,
|
|
259
|
+
showDeleteButton: _propTypes.default.bool,
|
|
260
|
+
showRoateButton: _propTypes.default.bool,
|
|
261
|
+
showZoomInButton: _propTypes.default.bool,
|
|
262
|
+
showZoomOutButton: _propTypes.default.bool
|
|
263
|
+
};
|
|
264
|
+
DocumentUpload.defaultProps = {
|
|
265
|
+
uploadedDocuments: [],
|
|
266
|
+
handleCustomOnChange: () => {},
|
|
267
|
+
formName: '',
|
|
268
|
+
multipleDoc: 0,
|
|
269
|
+
showDelete: true,
|
|
270
|
+
getPreview: () => {},
|
|
271
|
+
isMandatory: true,
|
|
272
|
+
deleteHandler: () => {},
|
|
273
|
+
noOfUpload: 1,
|
|
274
|
+
downloadCallback: () => {},
|
|
275
|
+
deleteCallback: () => {},
|
|
276
|
+
showDeleteButton: false,
|
|
277
|
+
showDownloadButton: true,
|
|
278
|
+
showRoateButton: true,
|
|
279
|
+
showZoomInButton: true,
|
|
280
|
+
showZoomOutButton: true
|
|
281
|
+
};
|
|
282
|
+
var _default = exports.default = DocumentUpload;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSection = exports.MainStyleSec = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2;
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-upload-list{\n display: flex !important;\n gap: 16px !important;\n flex-wrap: wrap !important;\n}\n.ant-upload-wrapper .ant-upload-list::before {\n display: none;\n}\n.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 96px;\n height: 96px;\n margin-block: 0;\n margin-inline: 0;\n}\n.ant-upload-select button > span.UploadImg{\n width: 24px !important;\n height: 24px;\n}\n.ant-upload-select button > span.UploadImg > img{\n width: 100% !important;\n}\n.ant-upload-list-item-container:last-child{\n margin: 0 !important;\n}\n.ant-form-item{\n margin-bottom: 0;\n}\n.ant-upload button{\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n} \n\n.uploadSecPad div{\n padding: 0 0 8px;\n}\n.anticon-upload{\n font-size: 24px;\n}\n.ant-upload-disabled .button{\n cursor: not-allowed;\n}\n.uploadSecPad{\n width: 100%;\n}\n.uploadSecPad div:last-child{\n padding: 0;\n}\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,.ant-upload-list-item-A{\n border: 1px solid var(--color-divider) !important;\n }\n \n .ant-upload-list-item-actions{\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n \n.ant-upload-list-item-actions button{\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n}\n.ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover{\n background: #212121;\n}\n .ant-upload-list-item-actions a{\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n \n .ant-upload-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item{\n opacity: 1 !important;\n }\n \n @media only screen and (max-width: 600px) {\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item::before,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions,.ant-upload-wrapper .ant-upload-list .ant-upload-list-item .ant-upload-list-item-actions .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n align-items: center;\n justify-content: center;\n width: 16px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0px !important;\n padding: 0px !important;\n color: #fff;\n}\n }\n"])));
|
|
13
|
+
const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2{\n margin: 0;\n }\n \n @media only screen and (max-width: 600px) {\n \n .ant-upload-list-item-actions button {\n height: 16px!important;\n width: 16px !important;\n justify-content: center;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n width: 16px !important;\n align-items: center;\n justify-content: center;\n}\n .ant-upload-list-item-actions {\n gap: 8px;\n }\n .ant-upload button span + div{\n display: none;\n }\n }\n"])));
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
require("core-js/modules/web.url.js");
|
|
11
|
+
require("core-js/modules/web.url-search-params.js");
|
|
12
|
+
require("core-js/modules/es.array.includes.js");
|
|
13
|
+
var _Add = _interopRequireDefault(require("@material-ui/icons/Add"));
|
|
14
|
+
var _ArrowBackIos = _interopRequireDefault(require("@material-ui/icons/ArrowBackIos"));
|
|
15
|
+
var _ArrowForwardIos = _interopRequireDefault(require("@material-ui/icons/ArrowForwardIos"));
|
|
16
|
+
var _DeleteOutline = _interopRequireDefault(require("@material-ui/icons/DeleteOutline"));
|
|
17
|
+
var _Remove = _interopRequireDefault(require("@material-ui/icons/Remove"));
|
|
18
|
+
var _Rotate90DegreesCcw = _interopRequireDefault(require("@material-ui/icons/Rotate90DegreesCcw"));
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
var _reactPdf = require("react-pdf");
|
|
22
|
+
require("react-pdf/dist/esm/Page/AnnotationLayer.css");
|
|
23
|
+
var _reactZoomPanPinch = require("react-zoom-pan-pinch");
|
|
24
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
25
|
+
var _CustomLoader = _interopRequireDefault(require("../../components/oa-component-loader/CustomLoader"));
|
|
26
|
+
var _CustomModal = _interopRequireDefault(require("../../components/oa-component-modal/CustomModal"));
|
|
27
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
28
|
+
var _styles = require("./styles");
|
|
29
|
+
const _excluded = ["downloadCallback", "deleteCallback", "title", "selectedDocumentData", "previewFile", "fileName", "showDownloadButton", "showDeleteButton", "showRoateButton", "showZoomInButton", "showZoomOutButton"],
|
|
30
|
+
_excluded2 = ["zoomIn", "zoomOut"];
|
|
31
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
32
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
+
_reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_reactPdf.pdfjs.version, "/pdf.worker.js");
|
|
38
|
+
const supportedImage = ['png', 'jpeg', 'jpg'];
|
|
39
|
+
const supportedPdf = ['pdf'];
|
|
40
|
+
const supportedVideos = ['mp4', 'mkv', 'webm'];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Renders content based on the specified format.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} format - The format of the content to render ('PDF' or 'IMAGE').
|
|
46
|
+
* @param {boolean} file - Indicates if a file is present.
|
|
47
|
+
* @param {string} url - The URL of the file to render.
|
|
48
|
+
* @param {number} pageNumber - The page number to render for PDF files.
|
|
49
|
+
* @param {function} onDocumentLoadSuccess - Callback function to handle successful document load.
|
|
50
|
+
*
|
|
51
|
+
* @returns {React.ReactElement} - A React element representing the rendered content.
|
|
52
|
+
* If the format is 'PDF' and a file is present, it renders a PDF document.
|
|
53
|
+
* If the format is 'IMAGE' and a file is present, it renders an image.
|
|
54
|
+
* Displays a loader if the file is not present.
|
|
55
|
+
* Returns a message for unsupported file formats.
|
|
56
|
+
*/
|
|
57
|
+
const renderContent = (format, file, url, pageNumber, onDocumentLoadSuccess) => {
|
|
58
|
+
if (format === 'PDF') {
|
|
59
|
+
return file ? /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
60
|
+
file: url,
|
|
61
|
+
onLoadSuccess: onDocumentLoadSuccess
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Page, {
|
|
63
|
+
pageNumber: pageNumber
|
|
64
|
+
})) : /*#__PURE__*/_react.default.createElement(_CustomLoader.default, null);
|
|
65
|
+
}
|
|
66
|
+
if (format === 'IMAGE') {
|
|
67
|
+
return file ? /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
className: "overflowScroll"
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
70
|
+
alt: "example",
|
|
71
|
+
style: {
|
|
72
|
+
width: '100%'
|
|
73
|
+
},
|
|
74
|
+
src: url
|
|
75
|
+
})) : /*#__PURE__*/_react.default.createElement(_CustomLoader.default, null);
|
|
76
|
+
}
|
|
77
|
+
if (format === 'VIDEO') {
|
|
78
|
+
return file ? /*#__PURE__*/_react.default.createElement("video", {
|
|
79
|
+
controls: true,
|
|
80
|
+
style: {
|
|
81
|
+
width: '100%'
|
|
82
|
+
},
|
|
83
|
+
src: url
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement("track", {
|
|
85
|
+
kind: "captions"
|
|
86
|
+
})) : /*#__PURE__*/_react.default.createElement(_CustomLoader.default, null);
|
|
87
|
+
}
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "Unsupported file format");
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Component that renders controls for zooming, rotating and navigating through the pages of a PDF document.
|
|
93
|
+
*
|
|
94
|
+
* @param {function} setRotationDegree - Callback function to change the rotation degree of the document.
|
|
95
|
+
* @param {number} pageNumber - The current page number of the document.
|
|
96
|
+
* @param {number} numPages - The total number of pages in the document.
|
|
97
|
+
* @param {function} setPageNumber - Callback function to change the current page number of the document.
|
|
98
|
+
* @param {function} getFileFormat - Function that returns the format of the document ('PDF' or 'IMAGE').
|
|
99
|
+
* @param {function} handleZoomIn - Callback function to handle zooming in.
|
|
100
|
+
* @param {function} handleZoomOut - Callback function to handle zooming out.
|
|
101
|
+
*
|
|
102
|
+
* @returns {React.ReactElement} - A React element that renders the controls.
|
|
103
|
+
*/
|
|
104
|
+
function Controls(_ref) {
|
|
105
|
+
let {
|
|
106
|
+
setRotationDegree,
|
|
107
|
+
pageNumber,
|
|
108
|
+
numPages,
|
|
109
|
+
setPageNumber,
|
|
110
|
+
getFileFormat,
|
|
111
|
+
handleZoomIn,
|
|
112
|
+
handleZoomOut,
|
|
113
|
+
showRoateButton,
|
|
114
|
+
showZoomInButton,
|
|
115
|
+
showZoomOutButton
|
|
116
|
+
} = _ref;
|
|
117
|
+
const rotate = () => {
|
|
118
|
+
setRotationDegree(prevRotationDegree => prevRotationDegree + 90);
|
|
119
|
+
};
|
|
120
|
+
const handleKeyPress = (event, callback) => {
|
|
121
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
122
|
+
callback();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledZoom, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
|
+
className: "flextBodyContain"
|
|
127
|
+
}, showZoomInButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
role: "button",
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
onClick: handleZoomIn,
|
|
131
|
+
onKeyDown: event => handleKeyPress(event, handleZoomIn),
|
|
132
|
+
className: "iconWidthPad"
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
134
|
+
size: 18,
|
|
135
|
+
icon: _Add.default,
|
|
136
|
+
color: "primary"
|
|
137
|
+
})), showZoomOutButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
138
|
+
role: "button",
|
|
139
|
+
tabIndex: 0,
|
|
140
|
+
onClick: handleZoomOut,
|
|
141
|
+
onKeyDown: event => handleKeyPress(event, handleZoomOut),
|
|
142
|
+
className: "iconWidthPad"
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
144
|
+
size: 18,
|
|
145
|
+
icon: _Remove.default,
|
|
146
|
+
color: "primary"
|
|
147
|
+
}))), getFileFormat === 'PDF' && /*#__PURE__*/_react.default.createElement("div", {
|
|
148
|
+
className: "flextBodyContain pdfFlexStyles"
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
150
|
+
type: "button",
|
|
151
|
+
tabIndex: 0,
|
|
152
|
+
onClick: () => setPageNumber(pageNumber - 1),
|
|
153
|
+
onKeyDown: event => handleKeyPress(event, () => setPageNumber(pageNumber - 1)),
|
|
154
|
+
className: "iconWidthPad iconWidthPadPdf",
|
|
155
|
+
disabled: pageNumber <= 1
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
157
|
+
size: 18,
|
|
158
|
+
icon: _ArrowBackIos.default
|
|
159
|
+
})), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
160
|
+
className: "type-b2-400",
|
|
161
|
+
color: "primary-content"
|
|
162
|
+
}, "Page", ' ', pageNumber, ' ', "of", ' ', numPages), /*#__PURE__*/_react.default.createElement("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
tabIndex: 0,
|
|
165
|
+
onClick: () => setPageNumber(pageNumber + 1),
|
|
166
|
+
onKeyDown: event => handleKeyPress(event, () => setPageNumber(pageNumber + 1)),
|
|
167
|
+
className: "iconWidthPad iconWidthPadPdf",
|
|
168
|
+
disabled: pageNumber >= numPages
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
170
|
+
size: 18,
|
|
171
|
+
icon: _ArrowForwardIos.default
|
|
172
|
+
}))), showRoateButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
173
|
+
role: "button",
|
|
174
|
+
tabIndex: 0,
|
|
175
|
+
onClick: rotate,
|
|
176
|
+
onKeyDown: event => handleKeyPress(event, rotate),
|
|
177
|
+
className: "iconWidthPad posroated"
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
179
|
+
size: 18,
|
|
180
|
+
icon: _Rotate90DegreesCcw.default,
|
|
181
|
+
color: "primary"
|
|
182
|
+
})));
|
|
183
|
+
}
|
|
184
|
+
Controls.propTypes = {
|
|
185
|
+
setRotationDegree: _propTypes.default.func.isRequired,
|
|
186
|
+
pageNumber: _propTypes.default.number.isRequired,
|
|
187
|
+
numPages: _propTypes.default.number.isRequired,
|
|
188
|
+
setPageNumber: _propTypes.default.func.isRequired,
|
|
189
|
+
getFileFormat: _propTypes.default.string.isRequired,
|
|
190
|
+
handleZoomIn: _propTypes.default.func.isRequired,
|
|
191
|
+
handleZoomOut: _propTypes.default.func.isRequired,
|
|
192
|
+
showRoateButton: _propTypes.default.bool.isRequired,
|
|
193
|
+
showZoomInButton: _propTypes.default.bool.isRequired,
|
|
194
|
+
showZoomOutButton: _propTypes.default.bool.isRequired
|
|
195
|
+
};
|
|
196
|
+
function CustomViewer(_ref2) {
|
|
197
|
+
let {
|
|
198
|
+
downloadCallback,
|
|
199
|
+
deleteCallback,
|
|
200
|
+
title,
|
|
201
|
+
selectedDocumentData,
|
|
202
|
+
previewFile,
|
|
203
|
+
fileName = 'download',
|
|
204
|
+
showDownloadButton,
|
|
205
|
+
showDeleteButton,
|
|
206
|
+
showRoateButton,
|
|
207
|
+
showZoomInButton,
|
|
208
|
+
showZoomOutButton
|
|
209
|
+
} = _ref2,
|
|
210
|
+
antDesignProps = _objectWithoutProperties(_ref2, _excluded);
|
|
211
|
+
const [rotationDegree, setRotationDegree] = (0, _react.useState)(0);
|
|
212
|
+
const [numPages, setNumPages] = (0, _react.useState)(null);
|
|
213
|
+
const [pageNumber, setPageNumber] = (0, _react.useState)(1);
|
|
214
|
+
const [initialScale, setInitialScale] = (0, _react.useState)(1);
|
|
215
|
+
const [scale, setScale] = (0, _react.useState)(1);
|
|
216
|
+
const onDocumentLoadSuccess = _ref3 => {
|
|
217
|
+
let {
|
|
218
|
+
numPages: pages
|
|
219
|
+
} = _ref3;
|
|
220
|
+
setNumPages(pages);
|
|
221
|
+
setPageNumber(1);
|
|
222
|
+
};
|
|
223
|
+
const handleZoomIn = () => {
|
|
224
|
+
setScale(scale + 0.1);
|
|
225
|
+
};
|
|
226
|
+
const handleZoomOut = () => {
|
|
227
|
+
if (scale > initialScale) {
|
|
228
|
+
setScale(scale - 0.1);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const getUrl = (0, _react.useMemo)(() => {
|
|
232
|
+
if (typeof previewFile === 'string') {
|
|
233
|
+
return previewFile;
|
|
234
|
+
}
|
|
235
|
+
if (typeof previewFile === 'object' && previewFile) {
|
|
236
|
+
return URL.createObjectURL(previewFile.originFileObj);
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
}, [previewFile]);
|
|
240
|
+
const getFileFormat = (0, _react.useMemo)(() => {
|
|
241
|
+
var _title$split, _previewFile$type;
|
|
242
|
+
const fileExtension = typeof previewFile === 'string' ? title === null || title === void 0 || (_title$split = title.split('.')) === null || _title$split === void 0 || (_title$split = _title$split.pop()) === null || _title$split === void 0 ? void 0 : _title$split.toLowerCase() : previewFile === null || previewFile === void 0 || (_previewFile$type = previewFile.type) === null || _previewFile$type === void 0 ? void 0 : _previewFile$type.split('/')[1];
|
|
243
|
+
if (supportedImage.includes(fileExtension)) {
|
|
244
|
+
return 'IMAGE';
|
|
245
|
+
}
|
|
246
|
+
if (supportedPdf.includes(fileExtension)) {
|
|
247
|
+
return 'PDF';
|
|
248
|
+
}
|
|
249
|
+
if (supportedVideos.includes(fileExtension)) {
|
|
250
|
+
return 'VIDEO';
|
|
251
|
+
}
|
|
252
|
+
return 'UNSUPPORTED';
|
|
253
|
+
}, [previewFile, title]);
|
|
254
|
+
return /*#__PURE__*/_react.default.createElement(_CustomModal.default, _extends({
|
|
255
|
+
width: 860,
|
|
256
|
+
className: "imageZoom",
|
|
257
|
+
buttonConfig: [...(showDownloadButton ? [{
|
|
258
|
+
callback: () => {
|
|
259
|
+
downloadCallback(selectedDocumentData);
|
|
260
|
+
},
|
|
261
|
+
label: 'Download'
|
|
262
|
+
}] : []), ...(showDeleteButton ? [{
|
|
263
|
+
callback: () => {
|
|
264
|
+
deleteCallback(selectedDocumentData);
|
|
265
|
+
},
|
|
266
|
+
label: 'Delete',
|
|
267
|
+
type: 'danger-text-only',
|
|
268
|
+
iconConfig: {
|
|
269
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
270
|
+
icon: _DeleteOutline.default,
|
|
271
|
+
size: 24
|
|
272
|
+
}),
|
|
273
|
+
position: 'left'
|
|
274
|
+
}
|
|
275
|
+
}] : [])]
|
|
276
|
+
}, antDesignProps), /*#__PURE__*/_react.default.createElement(_reactZoomPanPinch.TransformWrapper, null, _ref4 => {
|
|
277
|
+
let {
|
|
278
|
+
zoomIn,
|
|
279
|
+
zoomOut
|
|
280
|
+
} = _ref4,
|
|
281
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
282
|
+
return /*#__PURE__*/_react.default.createElement(_styles.PdfStyles, null, /*#__PURE__*/_react.default.createElement(Controls, {
|
|
283
|
+
setRotationDegree: setRotationDegree,
|
|
284
|
+
pageNumber: pageNumber,
|
|
285
|
+
numPages: numPages,
|
|
286
|
+
setPageNumber: setPageNumber,
|
|
287
|
+
getFileFormat: getFileFormat,
|
|
288
|
+
handleZoomIn: handleZoomIn,
|
|
289
|
+
handleZoomOut: handleZoomOut,
|
|
290
|
+
showRoateButton: showRoateButton,
|
|
291
|
+
showZoomInButton: showZoomInButton,
|
|
292
|
+
showZoomOutButton: showZoomOutButton
|
|
293
|
+
}), /*#__PURE__*/_react.default.createElement(_reactZoomPanPinch.TransformComponent, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
294
|
+
style: {
|
|
295
|
+
transform: "rotate(".concat(rotationDegree, "deg) scale(").concat(scale, ")")
|
|
296
|
+
}
|
|
297
|
+
}, renderContent(getFileFormat, previewFile, getUrl, pageNumber, onDocumentLoadSuccess))));
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
CustomViewer.propTypes = {
|
|
301
|
+
title: _propTypes.default.string.isRequired,
|
|
302
|
+
previewFile: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]).isRequired,
|
|
303
|
+
fileName: _propTypes.default.string,
|
|
304
|
+
antDesignProps: _propTypes.default.object,
|
|
305
|
+
downloadCallback: _propTypes.default.func,
|
|
306
|
+
selectedDocumentData: _propTypes.default.object,
|
|
307
|
+
showDownloadButton: _propTypes.default.bool,
|
|
308
|
+
showDeleteButton: _propTypes.default.bool,
|
|
309
|
+
deleteCallback: _propTypes.default.func,
|
|
310
|
+
showRoateButton: _propTypes.default.bool,
|
|
311
|
+
showZoomInButton: _propTypes.default.bool,
|
|
312
|
+
showZoomOutButton: _propTypes.default.bool
|
|
313
|
+
};
|
|
314
|
+
CustomViewer.defaultProps = {
|
|
315
|
+
fileName: 'download',
|
|
316
|
+
antDesignProps: {},
|
|
317
|
+
downloadCallback: () => {},
|
|
318
|
+
selectedDocumentData: {},
|
|
319
|
+
showDownloadButton: true,
|
|
320
|
+
showDeleteButton: false,
|
|
321
|
+
deleteCallback: () => {},
|
|
322
|
+
showRoateButton: true,
|
|
323
|
+
showZoomInButton: true,
|
|
324
|
+
showZoomOutButton: true
|
|
325
|
+
};
|
|
326
|
+
var _default = exports.default = CustomViewer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mainStyle = exports.StyledZoom = exports.PdfStyles = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
const mainStyle = exports.mainStyle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\nposition: relative;\nbackground: red;\n"])));
|
|
13
|
+
const StyledZoom = exports.StyledZoom = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n.flextBodyContain{\n position: absolute;\n right: 52px;\n bottom: 116px;\n flex-direction: column;\n z-index: 9999;\n display: flex;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n}\n.posroated{\n position: absolute;\n right: 52px;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n top: 68px;\n z-index: 999;\n border-radius: 4px;\n}\n.iconWidthPad{\n cursor: pointer;\n background: var(--color-primary-background); \n padding: 6px;\n height: 32px;\n width: 32px;\n border-bottom: 1px solid var(--color-divider);\n}\n.iconWidthPad:last-child{\n border: none;\n}\n@media screen and (max-width: 992px) {\n .posroated,.flextBodyContain{\n right: 38px;\n }\n }\n"])));
|
|
14
|
+
const PdfStyles = exports.PdfStyles = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\ncanvas{\n margin: 0 auto;\n}\n.pdfFlexStyles{\n left: 0;\n right: 0;\n bottom: 92px;\n width: fit-content;\n display: flex;\n flex-direction: row;\n align-items: center;\n background: #fff;\n margin-left: auto;\n margin-right: auto;\n padding: 8px;\n gap: 12px;\n}\n.iconWidthPadPdf {\n width: auto;\n height: auto;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n border: none;\n border-bottom: none;\n}\n\nbutton:disabled {\n color: var(--color-disabled-button);\n cursor: not-allowed; \n border:none;\n }\n button{\n color: var(--color-primary-content);\n }\n@media screen and (max-width: 600px) {\n\n canvas {\n width: 100% !important;\n height: auto !important;\n }\n }\n"])));
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/es.promise.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _icons = require("@ant-design/icons");
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
|
|
15
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
16
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
17
|
+
var _styles = require("./styles");
|
|
18
|
+
var _PdfSampleImage = _interopRequireDefault(require("../../images/PdfSampleImage.png"));
|
|
19
|
+
var _upload = _interopRequireDefault(require("../../images/upload.svg"));
|
|
20
|
+
var _CustomIcon = _interopRequireDefault(require("../../components/oa-component-icons/CustomIcon"));
|
|
21
|
+
var _CustomUpload = _interopRequireDefault(require("../../components/oa-component-upload/CustomUpload"));
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
/**
|
|
26
|
+
* Takes a file and returns a Promise that resolves with the file as a base64 encoded string.
|
|
27
|
+
* The Promise is rejected if there is an error reading the file.
|
|
28
|
+
* @param {File} file The file to be converted to base64
|
|
29
|
+
* @returns {Promise<string>} A Promise that resolves with the file as a base64 encoded string
|
|
30
|
+
*/
|
|
31
|
+
const getBase64 = file => new Promise((resolve, reject) => {
|
|
32
|
+
const reader = new FileReader();
|
|
33
|
+
reader.readAsDataURL(file);
|
|
34
|
+
reader.onload = () => resolve(reader.result);
|
|
35
|
+
reader.onerror = error => reject(error);
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Downloads a file from a base64 encoded string.
|
|
39
|
+
* @param {string} base64String The base64 encoded string of the file to be downloaded
|
|
40
|
+
* @param {string} [fileName] The name of the file to be downloaded. If not provided, the file will be downloaded with the name 'download'.
|
|
41
|
+
* @returns {undefined}
|
|
42
|
+
*/
|
|
43
|
+
const downloadFile = (base64String, fileName) => {
|
|
44
|
+
const link = document.createElement('a');
|
|
45
|
+
link.href = base64String;
|
|
46
|
+
link.download = fileName || 'download';
|
|
47
|
+
link.click();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A component that allows users to upload documents.
|
|
52
|
+
* The component displays the uploaded documents in a list.
|
|
53
|
+
* The component also allows users to delete the uploaded documents.
|
|
54
|
+
* @param {object} props The props passed to the component
|
|
55
|
+
* @param {array} [props.uploadedDocuments=[]] An array of documents that have already been uploaded
|
|
56
|
+
* @param {function} props.onChange A function that is called whenever the list of uploaded documents changes
|
|
57
|
+
* @param {number} [props.multipleDoc=0] The maximum number of documents that can be uploaded. If set to 0, there is no limit
|
|
58
|
+
* @param {boolean} [props.showDelete=false] Whether or not to show a delete button next to each uploaded document
|
|
59
|
+
* @param {string} [props.subText] A string that is displayed below the heading
|
|
60
|
+
* @param {string} [props.heading] A string that is displayed above the upload button
|
|
61
|
+
* @param {string} [props.formName] The name of the form field that the uploaded documents should be associated with
|
|
62
|
+
* @param {function} [props.getPreview] A function that is called whenever the user clicks on an uploaded document. It should return a Promise that resolves with the URL of the document
|
|
63
|
+
* @param {string} [props.infoText] A string that is displayed below the subText
|
|
64
|
+
* @param {boolean} [props.isMandatory=false] Whether or not the component is mandatory
|
|
65
|
+
* @returns {object} A React component
|
|
66
|
+
*/
|
|
67
|
+
function DocumentUploadCard(props) {
|
|
68
|
+
const {
|
|
69
|
+
uploadedDocuments = [],
|
|
70
|
+
multipleDoc,
|
|
71
|
+
showDelete,
|
|
72
|
+
subText,
|
|
73
|
+
heading,
|
|
74
|
+
formName,
|
|
75
|
+
getPreview,
|
|
76
|
+
infoText,
|
|
77
|
+
isMandatory
|
|
78
|
+
} = props;
|
|
79
|
+
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
80
|
+
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
81
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)('');
|
|
82
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
83
|
+
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
84
|
+
const handleCancel = () => setPreviewOpen(false);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Determines if the given file is an image file based on its file extension.
|
|
88
|
+
* @param {string} fileName The name of the file to check
|
|
89
|
+
* @returns {boolean} Whether or not the file is an image file
|
|
90
|
+
*/
|
|
91
|
+
function isImageFile(fileName) {
|
|
92
|
+
var _fileName$split;
|
|
93
|
+
// Extract the file extension from the file name
|
|
94
|
+
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split('.')) === null || _fileName$split === void 0 || (_fileName$split = _fileName$split.pop()) === null || _fileName$split === void 0 ? void 0 : _fileName$split.toLowerCase();
|
|
95
|
+
|
|
96
|
+
// Define an array of image file extensions
|
|
97
|
+
const imageFileExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg'];
|
|
98
|
+
|
|
99
|
+
// Check if the file extension is in the array of image file extensions
|
|
100
|
+
if (imageFileExtensions.indexOf(fileExtension) !== -1) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
(0, _react.useEffect)(() => {
|
|
106
|
+
setFileList(uploadedDocuments);
|
|
107
|
+
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
108
|
+
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
109
|
+
style: {
|
|
110
|
+
border: 0,
|
|
111
|
+
background: 'none'
|
|
112
|
+
},
|
|
113
|
+
type: "button"
|
|
114
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) : /*#__PURE__*/_react.default.createElement(_CustomIcon.default, {
|
|
115
|
+
className: "UploadImg",
|
|
116
|
+
alt: "phone img",
|
|
117
|
+
src: _upload.default
|
|
118
|
+
}), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_styles.MainStyleSec, null, /*#__PURE__*/_react.default.createElement(_styles.StyledSection, null, (heading || subText) && /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
className: "uploadSecPad"
|
|
121
|
+
}, heading && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
122
|
+
color: "primary-content",
|
|
123
|
+
className: "type-t2-700"
|
|
124
|
+
}, heading, isMandatory && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
125
|
+
color: "negative"
|
|
126
|
+
}, " *"))), typeof subText === 'string' && /*#__PURE__*/_react.default.createElement("div", {
|
|
127
|
+
style: {
|
|
128
|
+
whiteSpace: 'pre-line'
|
|
129
|
+
}
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
131
|
+
color: "secondary-content",
|
|
132
|
+
className: "type-b2-400"
|
|
133
|
+
}, subText)), /*#__PURE__*/_react.default.isValidElement(subText) && /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
style: {
|
|
135
|
+
whiteSpace: 'pre-line'
|
|
136
|
+
}
|
|
137
|
+
}, subText), infoText && /*#__PURE__*/_react.default.createElement(_CustomInfo.default, {
|
|
138
|
+
color: "background-warning",
|
|
139
|
+
description: infoText
|
|
140
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
+
className: "uploadDiv "
|
|
142
|
+
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
143
|
+
theme: {
|
|
144
|
+
token: {
|
|
145
|
+
colorBorder: _ColorVariablesMap.default['--color-divider'],
|
|
146
|
+
borderRadiusLG: 4,
|
|
147
|
+
colorPrimaryHover: _ColorVariablesMap.default['--color-primary'],
|
|
148
|
+
colorPrimaryBorder: _ColorVariablesMap.default['--color-divider'],
|
|
149
|
+
colorFillAlter: _ColorVariablesMap.default['--color-secondary-background'],
|
|
150
|
+
colorError: _ColorVariablesMap.default['--color-negative'],
|
|
151
|
+
colorText: _ColorVariablesMap.default['--color-secondary-content']
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomUpload.default, props)))));
|
|
155
|
+
}
|
|
156
|
+
DocumentUploadCard.propTypes = {
|
|
157
|
+
uploadedDocuments: _propTypes.default.array,
|
|
158
|
+
subText: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
159
|
+
heading: _propTypes.default.string,
|
|
160
|
+
formName: _propTypes.default.string,
|
|
161
|
+
infoText: _propTypes.default.string,
|
|
162
|
+
showDelete: _propTypes.default.bool,
|
|
163
|
+
multipleDoc: _propTypes.default.number,
|
|
164
|
+
getPreview: _propTypes.default.func,
|
|
165
|
+
// Define the getPreview prop type
|
|
166
|
+
isMandatory: _propTypes.default.bool
|
|
167
|
+
};
|
|
168
|
+
DocumentUploadCard.defaultProps = {
|
|
169
|
+
uploadedDocuments: [],
|
|
170
|
+
subText: '',
|
|
171
|
+
heading: '',
|
|
172
|
+
formName: '',
|
|
173
|
+
infoText: '',
|
|
174
|
+
multipleDoc: 0,
|
|
175
|
+
showDelete: true,
|
|
176
|
+
getPreview: () => {},
|
|
177
|
+
isMandatory: true
|
|
178
|
+
};
|
|
179
|
+
var _default = exports.default = DocumentUploadCard;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSection = exports.MainStyleSec = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2;
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
+
const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-form-item{\n margin-bottom: 0;\n}\n.ant-upload button{\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n} \n.uploadDiv{\n width: 96px;\n position: relative;\n}\n.uploadDiv em{\n position: absolute;\n right: -9px;\n top: -9px;\n font-style: normal;\n width: 20px;\n height: 20px;\n background: var(--color-warning);\n z-index: 9;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n color: #fff;\n font-size: 12px;\n line-height: 0;\n}\n.UploadImg img{\n height: 24px;\n width: 24px;\n\n}\n.UploadImg{\n justify-content: center;\n cursor: pointer;\n}\n.uploadSecPad div{\n padding: 0 0 8px;\n}\n.anticon-upload{\n font-size: 24px;\n}\n.uploadSecPad{\n width: 100%;\n}\n.uploadSecPad div:last-child{\n padding: 0;\n}\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,.ant-upload-list-item-A{\n border: 1px solid var(--color-divider) !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item:hover::before{\n opacity: 1 !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item:hover::before ant-upload-list-item-actions > a\n {\n background: red !important;\n }\n .ant-upload-list-item-actions{\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item::before{\n background: transparent;\n opacity: 1;\n }\n.ant-upload-list-item-actions button{\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n}\n.ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover{\n background: #212121;\n}\n .ant-upload-list-item-actions a{\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions,.ant-upload-wrapper .ant-upload-list .ant-upload-list-item .ant-upload-list-item-actions .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item{\n opacity: 1 !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete{\n color: #fff;\n }\n @media only screen and (max-width: 600px) {\n .uploadDiv {\n width: 64px;\n }\n .uploadDiv em{\n width: 16px;\n height: 16px;\n }\n }\n"])));
|
|
13
|
+
const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2{\n margin: 0;\n }\n .ant-upload-select, .ant-upload-wrapper, .ant-upload-wrapper, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 96px;\n height: 96px;\n margin: 0;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 96px !important;\n height: 96px !important;\n margin: 0;\n }\n @media only screen and (max-width: 600px) {\n .ant-upload-select, .ant-upload-wrapper, .ant-upload-wrapper, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 64px !important;\n height: 64px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete{\n font-size:12px;\n margin: 0 !important;\n padding: 0 !important;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .ant-upload-list-item-actions button {\n height: 16px!important;\n width: 16px !important;\n justify-content: center;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n width: 16px !important;\n align-items: center;\n justify-content: center;\n}\n .ant-upload-list-item-actions {\n gap: 8px;\n }\n .ant-upload button span + div{\n display: none;\n }\n }\n"])));
|
package/build/index.js
CHANGED
|
@@ -275,6 +275,12 @@ Object.defineProperty(exports, "CustomUpload", {
|
|
|
275
275
|
return _CustomUpload.default;
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
+
Object.defineProperty(exports, "CustomUploadDev", {
|
|
279
|
+
enumerable: true,
|
|
280
|
+
get: function get() {
|
|
281
|
+
return _CustomUpload2.default;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
278
284
|
Object.defineProperty(exports, "CustomerRatingCard", {
|
|
279
285
|
enumerable: true,
|
|
280
286
|
get: function get() {
|
|
@@ -293,6 +299,12 @@ Object.defineProperty(exports, "DocUploadCardWidget", {
|
|
|
293
299
|
return _DocUploadCardWidget.default;
|
|
294
300
|
}
|
|
295
301
|
});
|
|
302
|
+
Object.defineProperty(exports, "DocUploadCardWidgetDev", {
|
|
303
|
+
enumerable: true,
|
|
304
|
+
get: function get() {
|
|
305
|
+
return _DocUploadCardWidget2.default;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
296
308
|
Object.defineProperty(exports, "DocUploadWidget", {
|
|
297
309
|
enumerable: true,
|
|
298
310
|
get: function get() {
|
|
@@ -618,6 +630,8 @@ var _PincodeBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-p
|
|
|
618
630
|
var _MapBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-map-base-location/MapBaseLocation"));
|
|
619
631
|
var _CustomTimeline2 = _interopRequireDefault(require("./dev/oa-component-timeline/CustomTimeline"));
|
|
620
632
|
var _TrackShipmentWidget2 = _interopRequireDefault(require("./dev/oa-widget-track-shipment/TrackShipmentWidget"));
|
|
633
|
+
var _DocUploadCardWidget2 = _interopRequireDefault(require("./dev/oa-widget-document-upload-card/DocUploadCardWidget"));
|
|
634
|
+
var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/CustomUpload"));
|
|
621
635
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
622
636
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
623
637
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -332,7 +332,7 @@ function CustomPinPatternCaptureWidget(_ref) {
|
|
|
332
332
|
onChange: patternArray => setPattern(patternArray),
|
|
333
333
|
onFinish: () => handlePatternComplete(pattern),
|
|
334
334
|
disabled: (prePopulatedPattern === null || prePopulatedPattern === void 0 ? void 0 : prePopulatedPattern.length) > 0
|
|
335
|
-
}), renderNumbersOnDots())), showButtons && /*#__PURE__*/_react.default.createElement("div", {
|
|
335
|
+
}), renderNumbersOnDots())), /*#__PURE__*/_react.default.createElement("div", null, showButtons && /*#__PURE__*/_react.default.createElement("div", {
|
|
336
336
|
className: "buttonAlign"
|
|
337
337
|
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
338
338
|
type: "text-only",
|
|
@@ -353,7 +353,7 @@ function CustomPinPatternCaptureWidget(_ref) {
|
|
|
353
353
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
354
354
|
className: "type-b3-400",
|
|
355
355
|
color: "secondary-content"
|
|
356
|
-
}, "Note: Your device PIN/Pattern is 100% secure with us. It will only be used to check your device condition during repair.")))), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
356
|
+
}, "Note: Your device PIN/Pattern is 100% secure with us. It will only be used to check your device condition during repair."))))), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
357
357
|
buttonConfig: [{
|
|
358
358
|
callback: onCancelOfMisMatchModal,
|
|
359
359
|
label: 'Redraw pattern',
|
|
@@ -9,4 +9,4 @@ var _templateObject;
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
11
|
var _default = exports.default = {};
|
|
12
|
-
const StyleContainer = exports.StyleContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-width: 600px;\n width: 100%;\n margin: 0 auto;\n text-align: center;\n position: relative;\n.react-pattern-lock__pattern-wrapper.error .react-pattern-lock__point-wrapper.selected .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: black !important;\n}\n .pattern-container {\n position: relative;\n }\n .numbers-overlay {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n right: 0;\n width: 300px;\n height: 300px;\n margin: 0 auto;\n }\n .dot-number {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100px;\n height: 100px;\n }\n .react-pattern-lock__point-wrapper{\n z-index: 9;\n }\n.flexAlignPattern{\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100vh - 0px);\n gap: 24px;\n}\n .flexAlignPattern .ant-form-item{\n text-align: left;\n }\n .ant-form-item-explain-error{\n color: var(--color-negative) !important;\n }\n .cancelIcon{\n position: absolute;\n right: 16px;\n cursor: pointer;\n }\n.react-pattern-lock__pattern-wrapper .selected .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: #0275DA !important;\n min-width: 20px !important;\n min-height: 20px !important;\n}\n .react-pattern-lock__point-inner{\n background: #0275DA;\n min-width: 20px !important;\n min-height: 20px !important;\n }\n\n .posRelative{\n position: relative;\n }\n .disabled .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: var(--color-placeholder-text) !important;\n min-width: 12px !important;\n min-height: 12px !important;\n z-index: 2;\n}\n .greyDisabledDots .react-pattern-lock__point-inner{\n background: var(--color-placeholder-text);\n } \n .dot-number span{\n width: 16px;\n height: 16px;\n background: var(--color-divider);\n z-index: 2;\n font-size: 11px;\n font-style: normal;\n font-weight: 700;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n color: #717171;\n line-height: 0;\n z-index: 9;\n }\n .activedotoverlay span{\n background: #0275DA;\n color: #fff;\n }\n.react-pattern-lock__pattern-wrapper.error .react-pattern-lock__connector-wrapper .react-pattern-lock__connector {\n background: black !important;\n}\n .buttonAlign{\n display: flex;\n justify-content: space-between;\n gap: 16px;\n padding: 0 24px;\n }\n .buttonAlign button{\n width: 100%;\n }\n .textInfo{\n padding: 12px;\n border-top: 1px solid #D9D9D9;\n text-align: left;\n margin:
|
|
12
|
+
const StyleContainer = exports.StyleContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-width: 600px;\n width: 100%;\n margin: 0 auto;\n text-align: center;\n position: relative;\n.react-pattern-lock__pattern-wrapper.error .react-pattern-lock__point-wrapper.selected .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: black !important;\n}\n .pattern-container {\n position: relative;\n }\n .numbers-overlay {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n right: 0;\n width: 300px;\n height: 300px;\n margin: 0 auto;\n }\n .dot-number {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100px;\n height: 100px;\n }\n .react-pattern-lock__point-wrapper{\n z-index: 9;\n }\n.flexAlignPattern{\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100vh - 0px);\n gap: 24px;\n}\n .flexAlignPattern .ant-form-item{\n text-align: left;\n }\n .ant-form-item-explain-error{\n color: var(--color-negative) !important;\n }\n .cancelIcon{\n position: absolute;\n right: 16px;\n cursor: pointer;\n }\n.react-pattern-lock__pattern-wrapper .selected .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: #0275DA !important;\n min-width: 20px !important;\n min-height: 20px !important;\n}\n .react-pattern-lock__point-inner{\n background: #0275DA;\n min-width: 20px !important;\n min-height: 20px !important;\n }\n\n .posRelative{\n position: relative;\n }\n .disabled .react-pattern-lock__point .react-pattern-lock__point-inner {\n background: var(--color-placeholder-text) !important;\n min-width: 12px !important;\n min-height: 12px !important;\n z-index: 2;\n}\n .greyDisabledDots .react-pattern-lock__point-inner{\n background: var(--color-placeholder-text);\n } \n .dot-number span{\n width: 16px;\n height: 16px;\n background: var(--color-divider);\n z-index: 2;\n font-size: 11px;\n font-style: normal;\n font-weight: 700;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n color: #717171;\n line-height: 0;\n z-index: 9;\n }\n .activedotoverlay span{\n background: #0275DA;\n color: #fff;\n }\n.react-pattern-lock__pattern-wrapper.error .react-pattern-lock__connector-wrapper .react-pattern-lock__connector {\n background: black !important;\n}\n .buttonAlign{\n display: flex;\n justify-content: space-between;\n gap: 16px;\n padding: 0 24px;\n }\n .buttonAlign button{\n width: 100%;\n }\n .textInfo{\n padding: 12px;\n border-top: 1px solid #D9D9D9;\n text-align: left;\n margin: 32px 0 0;\n text-align: left;\n }\n .alignLeft{\n text-align: left;\n }\n .selected .react-pattern-lock__point{\n width: 28px !important;\n height: 28px !important;\n background: #DEF1FB !important;\n border-radius: 50% !important;\n }\n.react-pattern-lock__pattern-wrapper{\nmargin: 0 auto;}\n.react-pattern-lock__pattern-wrapper .react-pattern-lock__connector-wrapper .react-pattern-lock__connector {\n background: #0275DA !important;\n}\n @media screen and (-webkit-min-device-pixel-ratio: 0) {\n @supports (-webkit-overflow-scrolling: touch) {\n .react-pattern-lock__pattern-wrapper{\n width: 274px !important;\n height: 274px !important;\n }\n}\n }\n"])));
|