oa-componentbook 1.0.1-stage.98 → 1.0.1-stage.99
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/components/oa-component-modal/styles.js +1 -1
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +281 -0
- package/build/dev/oa-component-document-viewer/styles.js +12 -0
- package/build/dev/oa-component-upload/CustomUpload.js +3 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +130 -0
- package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
- package/build/global-css/commonStyles.js +1 -1
- package/build/index.js +35 -0
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +376 -0
- package/build/widgets/oa-widget-approval/styles.js +2 -2
- package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +6 -6
- package/build/widgets/oa-widget-notes/NotesWidget.js +2 -1
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
- package/package.json +1 -1
|
@@ -10,4 +10,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
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
|
const ButtonContainer = exports.ButtonContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: flex-end;\n margin: 24px 0 0;\n @media (max-width: 768px) {\n justify-content: space-between;\n button{\n width: 100%;\n }\n }\n"])));
|
|
12
12
|
const DescriptionContainer = exports.DescriptionContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 12px 0 0;\n"])));
|
|
13
|
-
const TitleContainer = exports.TitleContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n flex-direction: column;\n margin: 0 0 16px;\n\n img {\n height: 36px;\n width: 36px;\n }\n"])));
|
|
13
|
+
const TitleContainer = exports.TitleContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n flex-direction: column;\n margin: 0 0 16px;\n padding: 0 42px 0 0;\n\n img {\n height: 36px;\n width: 36px;\n }\n"])));
|
|
@@ -0,0 +1,281 @@
|
|
|
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/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/es.promise.js");
|
|
10
|
+
require("core-js/modules/web.url.js");
|
|
11
|
+
require("core-js/modules/web.url-search-params.js");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _reactPdf = require("react-pdf");
|
|
15
|
+
var _icons = require("@material-ui/icons");
|
|
16
|
+
var _RotateRight = _interopRequireDefault(require("@material-ui/icons/RotateRight"));
|
|
17
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
19
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
|
+
var _system = require("@material-ui/system");
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
/* eslint-disable */
|
|
25
|
+
|
|
26
|
+
_reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_reactPdf.pdfjs.version, "/pdf.worker.js");
|
|
27
|
+
const ZOOM_STEP = 0.2;
|
|
28
|
+
const MIN_ZOOM = 0.5;
|
|
29
|
+
const MAX_ZOOM = 3.0;
|
|
30
|
+
function CustomDocumentViewer(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
fileType,
|
|
33
|
+
fileUrl,
|
|
34
|
+
onDownload,
|
|
35
|
+
hideZoom,
|
|
36
|
+
hideDownload,
|
|
37
|
+
hidePageNumber,
|
|
38
|
+
hideRotate,
|
|
39
|
+
documentViewerOverlayHeight,
|
|
40
|
+
docHeight
|
|
41
|
+
} = _ref;
|
|
42
|
+
const [totalPages, setTotalPages] = (0, _react.useState)(null);
|
|
43
|
+
const [scale, setScale] = (0, _react.useState)(1.0);
|
|
44
|
+
const [currentPage, setCurrentPage] = (0, _react.useState)(1);
|
|
45
|
+
// For image rotation.
|
|
46
|
+
const [rotation, setRotation] = (0, _react.useState)(0);
|
|
47
|
+
const containerRef = (0, _react.useRef)(null);
|
|
48
|
+
const pageRefs = (0, _react.useRef)([]);
|
|
49
|
+
|
|
50
|
+
// When the document loads, update total pages (for PDFs).
|
|
51
|
+
const onDocumentLoadSuccess = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
numPages
|
|
54
|
+
} = _ref2;
|
|
55
|
+
setTotalPages(numPages);
|
|
56
|
+
};
|
|
57
|
+
// Zoom handlers.
|
|
58
|
+
const handleZoomIn = (0, _react.useCallback)(() => setScale(prev => Math.min(prev + ZOOM_STEP, MAX_ZOOM)), []);
|
|
59
|
+
const handleZoomOut = (0, _react.useCallback)(() => setScale(prev => Math.max(prev - ZOOM_STEP, MIN_ZOOM)), []);
|
|
60
|
+
const handleResetZoom = (0, _react.useCallback)(() => setScale(1.0), []);
|
|
61
|
+
|
|
62
|
+
// Single rotation handler for images – rotates 90° clockwise each click.
|
|
63
|
+
const handleRotate = (0, _react.useCallback)(() => {
|
|
64
|
+
setRotation(prev => prev + 90);
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
// Default download function; can be overridden by passing an onDownload prop.
|
|
68
|
+
const defaultDownload = (0, _react.useCallback)(() => {
|
|
69
|
+
if (fileType === "image") {
|
|
70
|
+
// Fetch the image as a blob to force download.
|
|
71
|
+
fetch(fileUrl, {
|
|
72
|
+
mode: "cors"
|
|
73
|
+
}).then(res => res.blob()).then(blob => {
|
|
74
|
+
const url = window.URL.createObjectURL(blob);
|
|
75
|
+
const link = document.createElement("a");
|
|
76
|
+
link.href = url;
|
|
77
|
+
link.download = fileUrl.split("/").pop();
|
|
78
|
+
document.body.appendChild(link);
|
|
79
|
+
link.click();
|
|
80
|
+
document.body.removeChild(link);
|
|
81
|
+
window.URL.revokeObjectURL(url);
|
|
82
|
+
}).catch(error => {
|
|
83
|
+
console.error("Image download failed:", error);
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
// For PDFs and other file types, use the standard download.
|
|
87
|
+
const link = document.createElement("a");
|
|
88
|
+
link.href = fileUrl;
|
|
89
|
+
link.download = fileUrl.split("/").pop();
|
|
90
|
+
document.body.appendChild(link);
|
|
91
|
+
link.click();
|
|
92
|
+
document.body.removeChild(link);
|
|
93
|
+
}
|
|
94
|
+
}, [fileUrl, fileType]);
|
|
95
|
+
const handleDownload = onDownload || defaultDownload;
|
|
96
|
+
|
|
97
|
+
// Enable dragging when zoomed in.
|
|
98
|
+
(0, _react.useEffect)(() => {
|
|
99
|
+
const container = containerRef.current;
|
|
100
|
+
if (!container) return;
|
|
101
|
+
let isDragging = false;
|
|
102
|
+
let startX;
|
|
103
|
+
let startY;
|
|
104
|
+
let scrollLeft;
|
|
105
|
+
let scrollTop;
|
|
106
|
+
const onMouseDown = e => {
|
|
107
|
+
if (scale > 1.0) {
|
|
108
|
+
isDragging = true;
|
|
109
|
+
container.style.cursor = "grabbing";
|
|
110
|
+
startX = e.pageX;
|
|
111
|
+
startY = e.pageY;
|
|
112
|
+
scrollLeft = container.scrollLeft;
|
|
113
|
+
scrollTop = container.scrollTop;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const onMouseMove = e => {
|
|
117
|
+
if (!isDragging) return;
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
const deltaX = e.pageX - startX;
|
|
120
|
+
const deltaY = e.pageY - startY;
|
|
121
|
+
container.scrollLeft = scrollLeft - deltaX;
|
|
122
|
+
container.scrollTop = scrollTop - deltaY;
|
|
123
|
+
};
|
|
124
|
+
const onMouseUp = function onMouseUp() {
|
|
125
|
+
isDragging = false;
|
|
126
|
+
container.style.cursor = scale > 1.0 ? "grab" : "auto";
|
|
127
|
+
};
|
|
128
|
+
container.addEventListener("mousedown", onMouseDown);
|
|
129
|
+
container.addEventListener("mousemove", onMouseMove);
|
|
130
|
+
container.addEventListener("mouseup", onMouseUp);
|
|
131
|
+
container.addEventListener("mouseleave", onMouseUp);
|
|
132
|
+
return () => {
|
|
133
|
+
container.removeEventListener("mousedown", onMouseDown);
|
|
134
|
+
container.removeEventListener("mousemove", onMouseMove);
|
|
135
|
+
container.removeEventListener("mouseup", onMouseUp);
|
|
136
|
+
container.removeEventListener("mouseleave", onMouseUp);
|
|
137
|
+
};
|
|
138
|
+
}, [scale]);
|
|
139
|
+
|
|
140
|
+
// (Optional) Scroll event to update the current page (for PDFs).
|
|
141
|
+
const handleScroll = () => {
|
|
142
|
+
const container = containerRef.current;
|
|
143
|
+
if (!container) return;
|
|
144
|
+
const containerRect = container.getBoundingClientRect();
|
|
145
|
+
let closestPage = 1;
|
|
146
|
+
let minDistance = Infinity;
|
|
147
|
+
pageRefs.current.forEach((ref, index) => {
|
|
148
|
+
if (ref) {
|
|
149
|
+
const rect = ref.getBoundingClientRect();
|
|
150
|
+
const distance = Math.abs(rect.top - containerRect.top);
|
|
151
|
+
if (distance < minDistance) {
|
|
152
|
+
minDistance = distance;
|
|
153
|
+
closestPage = index + 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
setCurrentPage(closestPage);
|
|
158
|
+
};
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_styles.default, {
|
|
160
|
+
documentViewerOverlayHeight: documentViewerOverlayHeight
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
162
|
+
ref: containerRef,
|
|
163
|
+
className: "customDocumentViewerOverlay ".concat(docHeight),
|
|
164
|
+
style: {
|
|
165
|
+
cursor: scale > 1.0 ? "grab" : "auto"
|
|
166
|
+
},
|
|
167
|
+
onScroll: handleScroll
|
|
168
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
+
className: "customDocumentViewerOverlayHeader"
|
|
170
|
+
}, fileType === "pdf" && !hidePageNumber ? /*#__PURE__*/_react.default.createElement("div", {
|
|
171
|
+
className: "pageNumber"
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
173
|
+
className: "type-button-500",
|
|
174
|
+
color: "primary-background"
|
|
175
|
+
}, "Page ", currentPage, " of ", totalPages)) : fileType === "image" && !hideRotate ? /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
className: "pageNumber"
|
|
177
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
178
|
+
color: "primary-background",
|
|
179
|
+
size: 24,
|
|
180
|
+
icon: _RotateRight.default,
|
|
181
|
+
onClick: handleRotate,
|
|
182
|
+
style: {
|
|
183
|
+
cursor: "pointer"
|
|
184
|
+
}
|
|
185
|
+
})) : null, !hideZoom && /*#__PURE__*/_react.default.createElement("div", {
|
|
186
|
+
className: "customDocumentViewerOverlayHeaderIcons"
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
188
|
+
color: "primary-background",
|
|
189
|
+
size: 24,
|
|
190
|
+
icon: _icons.RemoveRounded,
|
|
191
|
+
onClick: handleZoomOut,
|
|
192
|
+
style: {
|
|
193
|
+
cursor: scale === MIN_ZOOM ? "not-allowed" : "pointer"
|
|
194
|
+
}
|
|
195
|
+
}), /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
196
|
+
color: "primary-background",
|
|
197
|
+
size: 24,
|
|
198
|
+
icon: _icons.ZoomInRounded,
|
|
199
|
+
onClick: handleResetZoom,
|
|
200
|
+
style: {
|
|
201
|
+
cursor: scale === 1.0 ? "not-allowed" : "pointer"
|
|
202
|
+
}
|
|
203
|
+
}), /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
204
|
+
color: "primary-background",
|
|
205
|
+
size: 24,
|
|
206
|
+
icon: _icons.AddRounded,
|
|
207
|
+
onClick: handleZoomIn,
|
|
208
|
+
style: {
|
|
209
|
+
cursor: scale === MAX_ZOOM ? "not-allowed" : "pointer"
|
|
210
|
+
}
|
|
211
|
+
})), !hideDownload && /*#__PURE__*/_react.default.createElement("div", {
|
|
212
|
+
className: "downloadIcon"
|
|
213
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
214
|
+
color: "primary-background",
|
|
215
|
+
size: 24,
|
|
216
|
+
icon: _icons.GetAppRounded,
|
|
217
|
+
onClick: handleDownload
|
|
218
|
+
}))), fileType === "pdf" && /*#__PURE__*/_react.default.createElement("div", {
|
|
219
|
+
style: {
|
|
220
|
+
transform: "scale(".concat(scale, ")"),
|
|
221
|
+
transformOrigin: "top center"
|
|
222
|
+
}
|
|
223
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
224
|
+
file: fileUrl,
|
|
225
|
+
onLoadSuccess: onDocumentLoadSuccess
|
|
226
|
+
}, Array.from({
|
|
227
|
+
length: totalPages
|
|
228
|
+
}, (_, index) => /*#__PURE__*/_react.default.createElement("div", {
|
|
229
|
+
key: "page_".concat(index + 1),
|
|
230
|
+
ref: el => pageRefs.current[index] = el,
|
|
231
|
+
style: {
|
|
232
|
+
marginBottom: "20px",
|
|
233
|
+
display: "flex",
|
|
234
|
+
justifyContent: "center"
|
|
235
|
+
}
|
|
236
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Page, {
|
|
237
|
+
pageNumber: index + 1,
|
|
238
|
+
scale: 1.0
|
|
239
|
+
}))))), fileType === "image" && /*#__PURE__*/_react.default.createElement("div", {
|
|
240
|
+
className: "oaImgCenter",
|
|
241
|
+
style: {
|
|
242
|
+
transform: "scale(".concat(scale, ") rotate(").concat(rotation, "deg)"),
|
|
243
|
+
transformOrigin: scale > 1.4 ? "left top" : "center center"
|
|
244
|
+
}
|
|
245
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
246
|
+
src: fileUrl,
|
|
247
|
+
alt: "document",
|
|
248
|
+
style: {
|
|
249
|
+
transition: "transform 0.3s ease-in-out",
|
|
250
|
+
maxWidth: "100%",
|
|
251
|
+
maxHeight: "80vh"
|
|
252
|
+
}
|
|
253
|
+
})))));
|
|
254
|
+
}
|
|
255
|
+
CustomDocumentViewer.propTypes = {
|
|
256
|
+
fileType: _propTypes.default.string.isRequired,
|
|
257
|
+
// "pdf" or "image"
|
|
258
|
+
fileUrl: _propTypes.default.string.isRequired,
|
|
259
|
+
onDownload: _propTypes.default.func,
|
|
260
|
+
// Optional custom download function
|
|
261
|
+
hideZoom: _propTypes.default.bool,
|
|
262
|
+
// If true, hide zoom controls (for PDFs)
|
|
263
|
+
hideDownload: _propTypes.default.bool,
|
|
264
|
+
// If true, hide download button
|
|
265
|
+
hidePageNumber: _propTypes.default.bool,
|
|
266
|
+
// If true, hide page number display (for PDFs)
|
|
267
|
+
hideRotate: _propTypes.default.bool,
|
|
268
|
+
// If true, hide rotate control (for images)
|
|
269
|
+
documentViewerOverlayHeight: _propTypes.default.string,
|
|
270
|
+
docHeight: _propTypes.default.string
|
|
271
|
+
};
|
|
272
|
+
CustomDocumentViewer.defaultProps = {
|
|
273
|
+
onDownload: null,
|
|
274
|
+
hideZoom: false,
|
|
275
|
+
hideDownload: false,
|
|
276
|
+
hidePageNumber: false,
|
|
277
|
+
hideRotate: false,
|
|
278
|
+
documentViewerOverlayHeight: "100vh",
|
|
279
|
+
docHeight: ""
|
|
280
|
+
};
|
|
281
|
+
var _default = exports.default = CustomDocumentViewer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
const DocumentViewerContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .customDocumentViewerOverlay {\n background-color: var(--color-primary-content);\n height: ", ";\n display: flex;\n justify-content: flex-start;\n width: 100%;\n padding: 0;\n margin: 0;\n flex-direction: column;\n overflow: auto;\n align-items: center; position: relative;\n }\n\n .documentPdfHeight{height:calc(100vh - 114px);}\n\n .customDocumentViewerOverlayHeader {\n position: fixed;\n padding: 0 16px;\n bottom: 74px;\n left: auto;\n right: auto;\n border-radius: 4px;\n z-index: 99;\n background: rgba(0, 0, 0, 0.7);\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.34);\n display: flex;\n align-items: center;\n justify-content: center;\n height: 40px;\n top:auto;\n }\n .customDocumentViewerOverlayHeaderIcons {\n display: flex;\n padding: 8px 0;\n flex-direction: row;\n gap: 16px;\n }\n\n .downloadIcon {\n border-left: solid 1px #fff;\n padding-left: 16px;\n margin-left: 16px;\n height: 100%;\n align-items: center;\n display: flex;\n }\n .pageNumber {\n border-right: solid 1px #fff;\n padding-right: 16px;\n margin-right: 16px;\n height: 100%;\n align-items: center;\n display: flex;\n }\n .ant-radio-group {\n display: flex;\n white-space: nowrap;\n }\n .oaImgCenter{\n height: calc(-114px + 100vh);\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n }\n"])), props => props.documentViewerOverlayHeight);
|
|
12
|
+
var _default = exports.default = DocumentViewerContainer;
|
|
@@ -196,6 +196,9 @@ function DocumentUpload(_ref) {
|
|
|
196
196
|
rules: [{
|
|
197
197
|
validator: (rule, value) => {
|
|
198
198
|
if (isMandatory && !(value !== null && value !== void 0 && value.length)) {
|
|
199
|
+
if (typeof value === 'object' && Object.keys(value).length > 0) {
|
|
200
|
+
return Promise.resolve();
|
|
201
|
+
}
|
|
199
202
|
return Promise.reject(new Error('Please upload the document.'));
|
|
200
203
|
}
|
|
201
204
|
return Promise.resolve();
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
require("react-pdf/dist/esm/Page/AnnotationLayer.css");
|
|
10
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
11
|
+
var _CustomDrawer = _interopRequireDefault(require("../../components/oa-component-drawer/CustomDrawer"));
|
|
12
|
+
var _CustomDocumentViewer = _interopRequireDefault(require("../oa-component-document-viewer/CustomDocumentViewer"));
|
|
13
|
+
var _CustomTag = _interopRequireDefault(require("../../components/oa-component-tag/CustomTag"));
|
|
14
|
+
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
15
|
+
var _CustomTooltip = _interopRequireDefault(require("../../components/oa-component-tooltip/CustomTooltip"));
|
|
16
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
17
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
18
|
+
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
19
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
|
+
const _excluded = ["title", "handleCloseDrawer", "documentConfig", "drawerWidth", "drawerButtonConfig", "drawerTagConfig", "onlyDocumentView"];
|
|
21
|
+
/* eslint-disable */
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
function DocumentSideDrawer(_ref) {
|
|
26
|
+
var _drawerTagConfig$view;
|
|
27
|
+
let {
|
|
28
|
+
title,
|
|
29
|
+
handleCloseDrawer,
|
|
30
|
+
documentConfig,
|
|
31
|
+
drawerWidth,
|
|
32
|
+
drawerButtonConfig,
|
|
33
|
+
drawerTagConfig,
|
|
34
|
+
onlyDocumentView
|
|
35
|
+
} = _ref,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
// Calculate the drawer width based on documentConfig or fallback to 480
|
|
38
|
+
const calculatedWidth = drawerWidth !== null && drawerWidth !== void 0 ? drawerWidth : documentConfig ? 1200 : 480;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
40
|
+
buttonConfig: drawerButtonConfig,
|
|
41
|
+
"data-test": "document-side-drawer",
|
|
42
|
+
rootClassName: "documentDrawer",
|
|
43
|
+
width: calculatedWidth,
|
|
44
|
+
onClose: handleCloseDrawer,
|
|
45
|
+
title: title
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
+
className: "viewerContainer"
|
|
48
|
+
}, documentConfig && /*#__PURE__*/_react.default.createElement(_CustomDocumentViewer.default, documentConfig), !onlyDocumentView && /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: "rightContSection"
|
|
50
|
+
}, drawerTagConfig && /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: "grayBoxSec"
|
|
52
|
+
}, drawerTagConfig.heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
53
|
+
className: "type-t2-700",
|
|
54
|
+
color: "primary-content"
|
|
55
|
+
}, drawerTagConfig.heading), /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
+
className: "margin-top-12 statusSec"
|
|
57
|
+
}, drawerTagConfig.tag && (
|
|
58
|
+
// Conditionally render CustomTag or Typography based on tag type
|
|
59
|
+
drawerTagConfig.tag.type ? /*#__PURE__*/_react.default.createElement(_CustomTag.default, {
|
|
60
|
+
label: drawerTagConfig.tag.label,
|
|
61
|
+
type: drawerTagConfig.tag.type
|
|
62
|
+
}) : /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
63
|
+
typography: "type-button-500"
|
|
64
|
+
}, drawerTagConfig.tag.label)), ((_drawerTagConfig$view = drawerTagConfig.viewDetails) === null || _drawerTagConfig$view === void 0 || (_drawerTagConfig$view = _drawerTagConfig$view.items) === null || _drawerTagConfig$view === void 0 ? void 0 : _drawerTagConfig$view.length) > 0 && /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
|
|
65
|
+
overlayClassName: "multipleDocumentTooltip",
|
|
66
|
+
isDisplayed: true,
|
|
67
|
+
title: ((_drawerTagConfig$view2, _drawerTagConfig$view3, _drawerTagConfig$view4, _drawerTagConfig$view5) => {
|
|
68
|
+
const totalItems = (_drawerTagConfig$view2 = drawerTagConfig.viewDetails) === null || _drawerTagConfig$view2 === void 0 ? void 0 : _drawerTagConfig$view2.items.length;
|
|
69
|
+
const numColumns = totalItems === 1 ? 1 : 2; // 1 column if only 1 item, else 2 columns
|
|
70
|
+
|
|
71
|
+
const col1Size = Math.ceil(totalItems / numColumns); // First column gets extra if odd
|
|
72
|
+
const col2Size = totalItems - col1Size; // Remaining items go to second column
|
|
73
|
+
|
|
74
|
+
const columns = [(_drawerTagConfig$view3 = drawerTagConfig.viewDetails) === null || _drawerTagConfig$view3 === void 0 ? void 0 : _drawerTagConfig$view3.items.slice(0, col1Size), // First column
|
|
75
|
+
(_drawerTagConfig$view4 = drawerTagConfig.viewDetails) === null || _drawerTagConfig$view4 === void 0 ? void 0 : _drawerTagConfig$view4.items.slice(col1Size) // Second column
|
|
76
|
+
];
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ((_drawerTagConfig$view5 = drawerTagConfig.viewDetails) === null || _drawerTagConfig$view5 === void 0 ? void 0 : _drawerTagConfig$view5.title) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
78
|
+
typography: "type-sl1-700",
|
|
79
|
+
color: "secondary-content"
|
|
80
|
+
}, drawerTagConfig.viewDetails.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
+
className: "tooltip-grid",
|
|
82
|
+
style: {
|
|
83
|
+
flexDirection: totalItems === 1 ? "column" : "row",
|
|
84
|
+
// Single column if only 1 item
|
|
85
|
+
width: totalItems === 1 ? "100%" : "auto" // Full width if only 1 item
|
|
86
|
+
}
|
|
87
|
+
}, columns.map((columnItems, colIndex) => /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
+
key: "col-".concat(colIndex),
|
|
89
|
+
className: "tooltip-column"
|
|
90
|
+
}, columnItems.map(item => /*#__PURE__*/_react.default.createElement("li", {
|
|
91
|
+
key: item.title,
|
|
92
|
+
className: "tooltip-item"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
94
|
+
size: 20,
|
|
95
|
+
icon: item.type === "positive" ? _Check.default : _Close.default,
|
|
96
|
+
color: item.type === "positive" ? "positive" : "negative"
|
|
97
|
+
}), /*#__PURE__*/_react.default.createElement("p", null, item.title)))))));
|
|
98
|
+
})()
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
100
|
+
type: "text-only",
|
|
101
|
+
label: drawerTagConfig.viewDetails.label
|
|
102
|
+
})))), props.children))));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Define the prop types to enforce correct data types for the props
|
|
106
|
+
DocumentSideDrawer.propTypes = {
|
|
107
|
+
title: _propTypes.default.string,
|
|
108
|
+
handleCloseDrawer: _propTypes.default.func,
|
|
109
|
+
documentConfig: _propTypes.default.object,
|
|
110
|
+
// Pass the document configuration as an object
|
|
111
|
+
drawerWidth: _propTypes.default.string,
|
|
112
|
+
// Optional custom drawer width
|
|
113
|
+
drawerButtonConfig: _propTypes.default.object,
|
|
114
|
+
// Button configuration for the drawer
|
|
115
|
+
drawerTagConfig: _propTypes.default.object,
|
|
116
|
+
// Tag configuration (heading, tag, viewDetails)
|
|
117
|
+
onlyDocumentView: _propTypes.default.bool // Optional prop to render only document viewer
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Default props to provide fallback values for optional props
|
|
121
|
+
DocumentSideDrawer.defaultProps = {
|
|
122
|
+
title: "",
|
|
123
|
+
handleCloseDrawer: () => {},
|
|
124
|
+
documentConfig: null,
|
|
125
|
+
drawerWidth: null,
|
|
126
|
+
drawerButtonConfig: null,
|
|
127
|
+
drawerTagConfig: null,
|
|
128
|
+
onlyDocumentView: false
|
|
129
|
+
};
|
|
130
|
+
var _default = exports.default = DocumentSideDrawer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
const ViewerContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .viewerContainer > div {\n flex: 1;\n box-sizing: border-box;\n }\n .viewerContainer {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n }\n .rightContSection {\n display: flex;\n flex-direction: column;\n padding: 24px;\n }\n .grayBoxSec {\n border-radius: 8px;\n background: #f6f6f6;\n padding: 12px 16px;\n }\n .statusSec {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n .statusSec button {\n margin-left: 8px;\n }\n"])));
|
|
12
|
+
var _default = exports.default = ViewerContainer;
|
|
@@ -7,5 +7,5 @@ exports.default = void 0;
|
|
|
7
7
|
var _styledComponents = require("styled-components");
|
|
8
8
|
var _templateObject;
|
|
9
9
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
|
-
const CommonStyles = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-modal .ant-modal-content {\n padding: 24px 24px 32px;\n border-radius: 12px;\n }\n .ant-select-dropdown .ant-select-item{\n min-height: auto !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-message{\n margin-bottom: 0 !important;\n }\n .ant-notification .ant-notification-notice-wrapper{\n background: transparent;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-close{\n position: inherit !important;\n width: 24px !important;\n height: 24px !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-closable .ant-notification-notice-message {\n padding-inline-end: 0px !important;\n}\n .ant-notification-notice-close > button{\n width: 24px !important;\n height: 24px !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice {\n display: flex;\n align-items: center;\n gap: 12px;\n justify-content: space-between;\n }\n @media (max-width: 372px) {\n .ant-picker-date-panel .ant-picker-body{\n padding: 8px !important;\n }\n }\n@media (max-width: 600px) {\n .ant-drawer .ant-drawer-header,.ant-drawer .ant-drawer-body{\n padding: 16px !important;\n }\n .ant-drawer .ant-drawer-footer {\n padding: 12px 16px;\n }\n .ant-picker-dropdown .ant-picker-date-panel{\n width: 100%;\n }\n .ant-picker-dropdown .ant-picker-time-panel-column {\n overflow-y: auto;\n}\n.ant-picker-dropdown .ant-picker-time-panel-column::-webkit-scrollbar {\n width: 2px;\n }\n\n .ant-modal-root .ant-modal-wrap {\n position: fixed;\n overflow: inherit;\n }\n .ant-modal-root .ant-modal-centered .ant-modal{\n vertical-align: middle;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100% !important;\n max-width: 100%!important;\n // transform-origin: bottom !important;\n //animation-duration: 0s !important;\n animation-name: slideUp;\n animation-duration: 0.2s;\n transition: .3s ease-in-out;\n animation-timing-function: ease-in;\n }\n @keyframes slideUp {\n 0%,\n 50% {\n transform: translateY(100%);\n opacity: 0;\n }\n \n 60%,\n 100% {\n transform: translateY(0);\n opacity: 1;\n \n }\n }\n .ant-modal .ant-modal-content {\n bottom: -8px;\n left: 0;\n position: absolute;\n right: 0;\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n .ant-modal .ant-modal-body{\n max-height: calc(90vh - 126px);\n overflow: auto;\n padding-right: 16px;\n }\n .ant-modal-footer{\n padding-right: 16px !important;\n }\n .ant-modal .ant-modal-content{\n padding: 24px 16px 32px;\n padding-right: 0;\n }\n}\n\n.ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{\n padding: 12px 24px;\n}\n.ant-dropdown-menu{\n min-width: 256px;\n top: 4px;\n}\n.ant-space-item span{\n line-height: 0 !important;\n display: flex;\n}\n.ant-select-dropdown{border-radius: 4px; padding:8px 0 !important;\n background: var(--color-primary-background) ;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);}\n\n.ant-select-dropdown .ant-select-item { \n min-height: auto;\n padding: 12px 16px;\n color: var(--color-primary-content) ;\n line-height: 20px;\n border-radius: 0px;\n}\n\n.label-date-dropdown {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n}\n\n.ant-select-dropdown .ant-select-item-option-active span{ color: var(--color-primary) !important;}\n.ant-picker-range {opacity: 0;}\n.ant-picker-dropdown-range { padding: 0; }\n\n.fadeImg{\n position: relative;\n width: 100%;\n max-height: 300px;\n overflow-x: auto;\n}\n.overLayImg{\n background: rgb(0 0 0 / 40%);\n border-radius: 12px 12px 0px 0px;\n overflow: hidden;\n}\n \n.OaTooltip .ant-tooltip-inner{\n padding: 24px 16px;\n background: #fff;\n color: #212121;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n width: 348px;\n border-radius: 12px;\n}\n.OaTooltip .ant-tooltip-arrow:before{\n background: #fff !important;\n}\n.OaFooterBtn{\n display: flex;\n justify-content: end;\n}\n.OaTooltip{\n max-width: 348px !important;\n}\n.paddingBot .ant-drawer-body{\n padding-bottom: 100px !important;\n}\n.react-transform-component,.react-transform-wrapper,.react-transform-component > div{\n width: 100%;\n}\n.ascCollapse .ant-collapse-arrow{\n transform: rotate(90deg);\n color: var(--color-primary) !important;\n font-size: 14px !important;\n}\n.gappingIcons{\n display: flex;\n gap: 16px;\n}\n.imageZoom .ant-modal-body > div{\n height: 350px;\n overflow-y: auto;\n margin: 30px 0px 0px;\n padding: 0px 8px 0 0;;\n \n}\n/* width */\n.imageZoom ::-webkit-scrollbar {\n width: 8px;\n height: 100px;\n border-radius: 8px;\n}\n\n/* Track */\n.imageZoom ::-webkit-scrollbar-track {\n background: #f6f6f6; \n border-radius: 8px;\n}\n \n/* Handle */\n.imageZoom ::-webkit-scrollbar-thumb {\n background: #888; \n border-radius: 8px;\n height: 100px;\n}\n\n/* Handle on hover */\n.imageZoom ::-webkit-scrollbar-thumb:hover {\n background: #555; \n}\n .modalImg{\n width: 100%;\n }\n.overflowScroll{\n position: relative;\n}\n.ascCollapse .ant-collapse-header{\n border-radius: 4px !important;\n background: var(--color-secondary-background);\n}\n.ascCollapse,.ant-collapse{\n overflow: hidden;\n}\n.ascCollapse .totalVal{\n display: flex;\n gap: 12px;\n}\n.ascCollapse.ant-collapse-item-active .ant-collapse-arrow{\n transform: rotate(180deg) !important;\n}.mobilesIcons li.ant-dropdown-menu-item > svg {\n display: none\n}\n .ant-notification-notice-close svg{\n font-size: 24px !important;\n height: auto;\n }\n @media only screen and (max-width: 574px) {\n .ant-steps-item-tail{\n inset-inline-start: 78px !important;\n \n }\n}\n @media only screen and (max-width: 480px) {\n .ant-steps-item-tail{\n inset-inline-start: 60px !important;\n \n }\n}\n@media only screen and (max-width: 600px) {\n \n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-body {\n padding: 8px;\n }\n .ant-picker-dropdown { width: 100%; left: 0 !important; }\n .mobilesIcons li.ant-dropdown-menu-item > svg {\n display: block;\n}\n.imageZoom .ant-modal-body>div{\n height: auto;\n overflow-y: auto;\n}\n.imageZoom .ant-modal-footer{\n padding-right: 16px !important;\n}\n .fadeImg{\n max-height: auto;\n }\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content th {\n width: 24px; font-size: 12px; font-weight: bold; }\n\n .ant-picker-dropdown .ant-picker-content th {\n height: 24px;\n }\n .ant-picker-dropdown .ant-picker-content td {\n font-size: 12px;\n }\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content {\n width: 100%;\n }\n\n}\n.ant-picker .ant-picker-clear{\n font-size: 20px;\n}\n"])));
|
|
10
|
+
const CommonStyles = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.tooltip-grid {\n display: flex;\n align-items: flex-start;\n padding: 8px 0 0;\n gap: 0px 32px;\n}\n\n.tooltip-column {\n display: flex;\n flex-direction: column;\n width: 280px;\n}\n\n\n.multipleDocumentTooltip .ant-tooltip-inner{\n padding: 16px;\n background: #fff;\n color: #212121;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n width: max-content;\n border-radius: 12px;\n min-width: 300px;\n\n}\n .multipleDocumentTooltip .ant-tooltip-arrow:before{\n background: #fff;\n }\n .multipleDocumentTooltip li.tooltip-item{\n display: flex;\n gap: 8px;\n align-items: flex-start;\n color: #212121;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px; \n padding: 8px 0;\n // width: max-content;\n }\n .tooltip-item p{\n margin: 0;\n }\n .multipleDocumentTooltip ul .headingName{\n color: #717171;\n font-size: 12px;\n font-style: normal;\n font-weight: 700;\n line-height: 16px; \n letter-spacing: 0.24px;\n text-transform: uppercase;\n padding: 0 0 16px;\n }\n .multipleDocumentTooltip .flexWrap{\n display: flex;\n flex-wrap: wrap;\n column-count: 1;\n column-gap: 8px;\n list-style: none;\n justify-content: space-between;\n }\n.ant-modal .ant-modal-content {\n padding: 24px 24px 32px;\n border-radius: 12px;\n }\n .ant-select-dropdown .ant-select-item{\n min-height: auto !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-message{\n margin-bottom: 0 !important;\n }\n .ant-notification .ant-notification-notice-wrapper{\n background: transparent;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-close{\n position: inherit !important;\n width: 24px !important;\n height: 24px !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice-closable .ant-notification-notice-message {\n padding-inline-end: 0px !important;\n}\n .ant-notification-notice-close > button{\n width: 24px !important;\n height: 24px !important;\n }\n .ant-notification .ant-notification-notice-wrapper .ant-notification-notice {\n display: flex;\n align-items: center;\n gap: 12px;\n justify-content: space-between;\n }\n .documentDrawer .ant-drawer-body{\n overflow: hidden;\n padding: 0;\n }\n .documentDrawer .rightContSection {\n overflow-y: scroll;\n height: calc(100vh - 114px);\n }\n .documentDrawer .ant-radio-group{\n display: flex;\n white-space: nowrap;\n }\n .documentDrawer .ant-drawer-content-wrapper{\n width: 100% !important;\n }\n .documentDrawer .ant-select-selector .ant-select-selection-item > span{\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 269px;\n display: block;\n }\n @media (max-width: 372px) {\n .ant-picker-date-panel .ant-picker-body{\n padding: 8px !important;\n }\n }\n@media (max-width: 600px) {\n .ant-drawer .ant-drawer-header,.ant-drawer .ant-drawer-body{\n padding: 16px !important;\n }\n .ant-drawer .ant-drawer-footer {\n padding: 12px 16px;\n }\n .ant-picker-dropdown .ant-picker-date-panel{\n width: 100%;\n }\n .ant-picker-dropdown .ant-picker-time-panel-column {\n overflow-y: auto;\n}\n.ant-picker-dropdown .ant-picker-time-panel-column::-webkit-scrollbar {\n width: 2px;\n }\n\n .ant-modal-root .ant-modal-wrap {\n position: fixed;\n overflow: inherit;\n }\n .ant-modal-root .ant-modal-centered .ant-modal{\n vertical-align: middle;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100% !important;\n max-width: 100%!important;\n // transform-origin: bottom !important;\n //animation-duration: 0s !important;\n animation-name: slideUp;\n animation-duration: 0.2s;\n transition: .3s ease-in-out;\n animation-timing-function: ease-in;\n }\n @keyframes slideUp {\n 0%,\n 50% {\n transform: translateY(100%);\n opacity: 0;\n }\n \n 60%,\n 100% {\n transform: translateY(0);\n opacity: 1;\n \n }\n }\n .ant-modal .ant-modal-content {\n bottom: -8px;\n left: 0;\n position: absolute;\n right: 0;\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n .ant-modal .ant-modal-body{\n max-height: calc(90vh - 126px);\n overflow: auto;\n padding-right: 16px;\n }\n .ant-modal-footer{\n padding-right: 16px !important;\n }\n .ant-modal .ant-modal-content{\n padding: 24px 16px 32px;\n padding-right: 0;\n }\n}\n\n.ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{\n padding: 12px 24px;\n}\n.ant-dropdown-menu{\n min-width: 256px;\n top: 4px;\n}\n.ant-space-item span{\n line-height: 0 !important;\n display: flex;\n}\n.ant-select-dropdown{border-radius: 4px; padding:8px 0 !important;\n background: var(--color-primary-background) ;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);}\n\n.ant-select-dropdown .ant-select-item { \n min-height: auto;\n padding: 12px 16px;\n color: var(--color-primary-content) ;\n line-height: 20px;\n border-radius: 0px;\n}\n\n.label-date-dropdown {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n}\n\n.ant-select-dropdown .ant-select-item-option-active span{ color: var(--color-primary) !important;}\n.ant-picker-range {opacity: 0;}\n.ant-picker-dropdown-range { padding: 0; }\n\n.fadeImg{\n position: relative;\n width: 100%;\n max-height: 300px;\n overflow-x: auto;\n}\n.overLayImg{\n background: rgb(0 0 0 / 40%);\n border-radius: 12px 12px 0px 0px;\n overflow: hidden;\n}\n \n.OaTooltip .ant-tooltip-inner{\n padding: 24px 16px;\n background: #fff;\n color: #212121;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n width: 348px;\n border-radius: 12px;\n}\n.OaTooltip .ant-tooltip-arrow:before{\n background: #fff !important;\n}\n.OaFooterBtn{\n display: flex;\n justify-content: end;\n}\n.OaTooltip{\n max-width: 348px !important;\n}\n.paddingBot .ant-drawer-body{\n padding-bottom: 100px !important;\n}\n.react-transform-component,.react-transform-wrapper,.react-transform-component > div{\n width: 100%;\n}\n.ascCollapse .ant-collapse-arrow{\n transform: rotate(90deg);\n color: var(--color-primary) !important;\n font-size: 14px !important;\n}\n.gappingIcons{\n display: flex;\n gap: 16px;\n}\n.imageZoom .ant-modal-body > div{\n height: 350px;\n overflow-y: auto;\n margin: 30px 0px 0px;\n padding: 0px 8px 0 0;;\n \n}\n/* width */\n.imageZoom ::-webkit-scrollbar {\n width: 8px;\n height: 100px;\n border-radius: 8px;\n}\n\n/* Track */\n.imageZoom ::-webkit-scrollbar-track {\n background: #f6f6f6; \n border-radius: 8px;\n}\n \n/* Handle */\n.imageZoom ::-webkit-scrollbar-thumb {\n background: #888; \n border-radius: 8px;\n height: 100px;\n}\n\n/* Handle on hover */\n.imageZoom ::-webkit-scrollbar-thumb:hover {\n background: #555; \n}\n .modalImg{\n width: 100%;\n }\n.overflowScroll{\n position: relative;\n}\n.ascCollapse .ant-collapse-header{\n border-radius: 4px !important;\n background: var(--color-secondary-background);\n}\n.ascCollapse,.ant-collapse{\n overflow: hidden;\n}\n.ascCollapse .totalVal{\n display: flex;\n gap: 12px;\n}\n.ascCollapse.ant-collapse-item-active .ant-collapse-arrow{\n transform: rotate(180deg) !important;\n}.mobilesIcons li.ant-dropdown-menu-item > svg {\n display: none\n}\n .ant-notification-notice-close svg{\n font-size: 24px !important;\n height: auto;\n }\n @media only screen and (max-width: 574px) {\n .ant-steps-item-tail{\n inset-inline-start: 78px !important;\n \n }\n}\n @media only screen and (max-width: 480px) {\n .ant-steps-item-tail{\n inset-inline-start: 60px !important;\n \n }\n}\n@media only screen and (max-width: 600px) {\n \n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-body {\n padding: 8px;\n }\n .ant-picker-dropdown { width: 100%; left: 0 !important; }\n .mobilesIcons li.ant-dropdown-menu-item > svg {\n display: block;\n}\n.imageZoom .ant-modal-body>div{\n height: auto;\n overflow-y: auto;\n}\n.imageZoom .ant-modal-footer{\n padding-right: 16px !important;\n}\n .fadeImg{\n max-height: auto;\n }\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content th {\n width: 24px; font-size: 12px; font-weight: bold; }\n\n .ant-picker-dropdown .ant-picker-content th {\n height: 24px;\n }\n .ant-picker-dropdown .ant-picker-content td {\n font-size: 12px;\n }\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content {\n width: 100%;\n }\n\n}\n.ant-picker .ant-picker-clear{\n font-size: 20px;\n}\n\n"])));
|
|
11
11
|
var _default = exports.default = CommonStyles;
|
package/build/index.js
CHANGED
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "ApprovalWidget", {
|
|
|
35
35
|
return _ApprovalWidget.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "ApprovalWidgetNew", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _ApprovalWidgetNew.default;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
38
44
|
Object.defineProperty(exports, "BarChart", {
|
|
39
45
|
enumerable: true,
|
|
40
46
|
get: function get() {
|
|
@@ -119,6 +125,12 @@ Object.defineProperty(exports, "CustomDetails", {
|
|
|
119
125
|
return _CustomDetails.default;
|
|
120
126
|
}
|
|
121
127
|
});
|
|
128
|
+
Object.defineProperty(exports, "CustomDocumentViewer", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function get() {
|
|
131
|
+
return _CustomDocumentViewer.default;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
122
134
|
Object.defineProperty(exports, "CustomDrawer", {
|
|
123
135
|
enumerable: true,
|
|
124
136
|
get: function get() {
|
|
@@ -311,6 +323,12 @@ Object.defineProperty(exports, "DocUploadWidget", {
|
|
|
311
323
|
return _DocUploadWidget.default;
|
|
312
324
|
}
|
|
313
325
|
});
|
|
326
|
+
Object.defineProperty(exports, "DocumentSideDrawer", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
get: function get() {
|
|
329
|
+
return _DocumentSideDrawer.default;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
314
332
|
Object.defineProperty(exports, "DropdownSearchInput", {
|
|
315
333
|
enumerable: true,
|
|
316
334
|
get: function get() {
|
|
@@ -335,6 +353,12 @@ Object.defineProperty(exports, "FeedbackWidget", {
|
|
|
335
353
|
return _FeedbackWidget.default;
|
|
336
354
|
}
|
|
337
355
|
});
|
|
356
|
+
Object.defineProperty(exports, "GenericUpload", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function get() {
|
|
359
|
+
return _ReUploadDrawer.default;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
338
362
|
Object.defineProperty(exports, "GlobalCss", {
|
|
339
363
|
enumerable: true,
|
|
340
364
|
get: function get() {
|
|
@@ -545,6 +569,12 @@ Object.defineProperty(exports, "colorOptions", {
|
|
|
545
569
|
return _colorOptions.colorOptions;
|
|
546
570
|
}
|
|
547
571
|
});
|
|
572
|
+
Object.defineProperty(exports, "customForm", {
|
|
573
|
+
enumerable: true,
|
|
574
|
+
get: function get() {
|
|
575
|
+
return _antd.Form;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
548
578
|
Object.defineProperty(exports, "getCheckboxTheme", {
|
|
549
579
|
enumerable: true,
|
|
550
580
|
get: function get() {
|
|
@@ -563,6 +593,8 @@ Object.defineProperty(exports, "typographyOptions", {
|
|
|
563
593
|
return _typographyOptions.typographyOptions;
|
|
564
594
|
}
|
|
565
595
|
});
|
|
596
|
+
var _antd = require("antd");
|
|
597
|
+
var _ReUploadDrawer = _interopRequireDefault(require("./widgets/oa-widget-reupload-drawer/ReUploadDrawer"));
|
|
566
598
|
var _Accordion = _interopRequireDefault(require("./components/oa-component-accordion/Accordion"));
|
|
567
599
|
var _CustomDetails = _interopRequireDefault(require("./widgets/oa-widget-custom-details/CustomDetails"));
|
|
568
600
|
var _DocUploadWidget = _interopRequireDefault(require("./widgets/oa-widget-document-upload/DocUploadWidget"));
|
|
@@ -616,6 +648,7 @@ var _AddressWidget = _interopRequireDefault(require("./widgets/oa-widget-address
|
|
|
616
648
|
var _AddSparePartWidget = _interopRequireDefault(require("./widgets/oa-widget-add-spare-part/AddSparePartWidget"));
|
|
617
649
|
var _AddSparePartCollapseWidget = _interopRequireDefault(require("./widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget"));
|
|
618
650
|
var _ApprovalWidget = _interopRequireDefault(require("./widgets/oa-widget-approval/ApprovalWidget"));
|
|
651
|
+
var _ApprovalWidgetNew = _interopRequireDefault(require("./widgets/oa-widget-approval/ApprovalWidgetNew"));
|
|
619
652
|
var _CloseClaimWidget = _interopRequireDefault(require("./widgets/oa-widget-close-claim/CloseClaimWidget"));
|
|
620
653
|
var _KeyValueWidget = _interopRequireDefault(require("./widgets/oa-widget-key-value/KeyValueWidget"));
|
|
621
654
|
var _NotesWidget = _interopRequireDefault(require("./widgets/oa-widget-notes/NotesWidget"));
|
|
@@ -652,6 +685,8 @@ var _MapBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-map-b
|
|
|
652
685
|
var _CustomTimeline2 = _interopRequireDefault(require("./dev/oa-component-timeline/CustomTimeline"));
|
|
653
686
|
var _DocUploadCardWidget2 = _interopRequireDefault(require("./dev/oa-widget-document-upload-card/DocUploadCardWidget"));
|
|
654
687
|
var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/CustomUpload"));
|
|
688
|
+
var _DocumentSideDrawer = _interopRequireDefault(require("./dev/oa-widget-document-side-drawer/DocumentSideDrawer"));
|
|
689
|
+
var _CustomDocumentViewer = _interopRequireDefault(require("./dev/oa-component-document-viewer/CustomDocumentViewer"));
|
|
655
690
|
var _PaymentAndConsent = _interopRequireDefault(require("./layout/paymentAndConsent/PaymentAndConsent"));
|
|
656
691
|
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); }
|
|
657
692
|
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; }
|
|
@@ -0,0 +1,376 @@
|
|
|
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.symbol.description.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _CheckCircle = _interopRequireDefault(require("@material-ui/icons/CheckCircle"));
|
|
15
|
+
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
16
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
17
|
+
var _UploadDownloadWidget = _interopRequireDefault(require("../oa-widget-upload-download/UploadDownloadWidget"));
|
|
18
|
+
var _styles = require("./styles");
|
|
19
|
+
var _CustomRadio = _interopRequireDefault(require("../../components/oa-component-radio/CustomRadio"));
|
|
20
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
21
|
+
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
22
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
23
|
+
var _CustomTag = _interopRequireDefault(require("../../components/oa-component-tag/CustomTag"));
|
|
24
|
+
var _CustomTooltip = _interopRequireDefault(require("../../components/oa-component-tooltip/CustomTooltip"));
|
|
25
|
+
const _excluded = ["children", "description", "docDetails", "multipleDocDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test", "form", "columnDynamicCssClass", "tooltipPlacement"];
|
|
26
|
+
/* eslint-disable */
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {import('../../components/oa-component-upload/CustomUpload').DocumentDetails} DocumentDetails
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Object} ApprovalForm
|
|
37
|
+
* @property {boolean} [disabled=false] Whether the approval form is disabled.
|
|
38
|
+
* @property {boolean} [hidden=false] Whether the approval form is hidden.
|
|
39
|
+
* @property {boolean} [invisible=false] Whether the approval form is invisible (preserving layout).
|
|
40
|
+
* @property {boolean} [isApproved] Initial value for the approval status.
|
|
41
|
+
* @property {string} [remarks] Initial value for the remarks.
|
|
42
|
+
*
|
|
43
|
+
* @typedef {Object} Props
|
|
44
|
+
* @property {React.ReactNode} [children] Content to be rendered inside the ApprovalWidget.
|
|
45
|
+
* @property {string} [description] Description for the widget.
|
|
46
|
+
* @property {DocumentDetails} [docDetails] Document details for the widget.
|
|
47
|
+
* @property {ApprovalForm} [approvalForm] Form data for approval.
|
|
48
|
+
* @property {boolean} [isMandatory=false] Whether the widget is mandatory.
|
|
49
|
+
* @property {boolean} [hasDivider=false] Display a divider line beneath the widget.
|
|
50
|
+
* @property {boolean} [isQuestionStyleWidget=false] Whether the widget has a question-style layout.
|
|
51
|
+
* @property {string|number} questionId Identifier for the question.
|
|
52
|
+
* @property {string} title Title of the widget.
|
|
53
|
+
* @property {Function} [viewOnClick] Callback function for the view action.
|
|
54
|
+
* @property {string} ['data-test'] Data test string to be applied to the outermost element.
|
|
55
|
+
*/
|
|
56
|
+
function ApprovalWidget(_ref) {
|
|
57
|
+
var _approvalForm$disable2, _actionContent$label, _approvalForm$disable3, _approvalForm$disable4, _approvalForm$disable5, _approvalForm$remarks, _approvalForm$disable6, _approvalForm$disable7, _approvalForm$disable8, _approvalForm$disable9, _approvalForm$disable10;
|
|
58
|
+
let {
|
|
59
|
+
children,
|
|
60
|
+
description,
|
|
61
|
+
docDetails,
|
|
62
|
+
multipleDocDetails,
|
|
63
|
+
approvalForm,
|
|
64
|
+
isMandatory,
|
|
65
|
+
hasDivider,
|
|
66
|
+
isQuestionStyleWidget,
|
|
67
|
+
questionId,
|
|
68
|
+
title,
|
|
69
|
+
viewOnClick,
|
|
70
|
+
actionRenderType,
|
|
71
|
+
actionContent,
|
|
72
|
+
systemStatus,
|
|
73
|
+
documentTitle,
|
|
74
|
+
descriptionTitle,
|
|
75
|
+
"data-test": dataTest,
|
|
76
|
+
form,
|
|
77
|
+
columnDynamicCssClass,
|
|
78
|
+
tooltipPlacement
|
|
79
|
+
} = _ref,
|
|
80
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
81
|
+
const getInitialValue = isApproved => {
|
|
82
|
+
switch (isApproved) {
|
|
83
|
+
case true:
|
|
84
|
+
return 1;
|
|
85
|
+
case false:
|
|
86
|
+
return 0;
|
|
87
|
+
default:
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const [isApproved, setIsApproved] = (0, _react.useState)(getInitialValue(approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.isApproved));
|
|
92
|
+
const [radioButtonValue, setRadioButtonValue] = (0, _react.useState)(null);
|
|
93
|
+
const getFieldDecorator = form === null || form === void 0 ? void 0 : form.getFieldDecorator;
|
|
94
|
+
const onRadioChange = event => setIsApproved(event.target.value);
|
|
95
|
+
const onChangeRadioWithForm = event => setRadioButtonValue(event.target.value);
|
|
96
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: "row"
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: columnDynamicCssClass === null || columnDynamicCssClass === void 0 ? void 0 : columnDynamicCssClass.firstColumn
|
|
100
|
+
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
101
|
+
className: "type-button-500"
|
|
102
|
+
}, title, isMandatory && /*#__PURE__*/_react.default.createElement(_styles.RedText, null, "*"))), description && /*#__PURE__*/_react.default.createElement(_styles.Styledescription, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
103
|
+
typography: "type-b2-400",
|
|
104
|
+
color: "secondary-content"
|
|
105
|
+
}, descriptionTitle), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
106
|
+
typography: "type-b2-400",
|
|
107
|
+
color: "primary-content"
|
|
108
|
+
}, description)), !isQuestionStyleWidget && ((multipleDocDetails === null || multipleDocDetails === void 0 ? void 0 : multipleDocDetails.length) > 0 ? multipleDocDetails.map(docDetails => {
|
|
109
|
+
var _approvalForm$disable;
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
+
className: "oaCustomerResponse"
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
113
|
+
typography: "type-b2-400",
|
|
114
|
+
color: "secondary-content"
|
|
115
|
+
}, docDetails.documentTitle, " \xA0"), /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
116
|
+
disabled: (_approvalForm$disable = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable !== void 0 ? _approvalForm$disable : false,
|
|
117
|
+
"data-test": dataTest ? "".concat(dataTest, "--upload-download-widget") : undefined
|
|
118
|
+
}, docDetails, {
|
|
119
|
+
formName: isMandatory ? "file-".concat(questionId) : undefined
|
|
120
|
+
})));
|
|
121
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
+
className: "oaCustomerResponse"
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
124
|
+
typography: "type-b2-400",
|
|
125
|
+
color: "secondary-content"
|
|
126
|
+
}, documentTitle, " \xA0"), /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
127
|
+
disabled: (_approvalForm$disable2 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable2 !== void 0 ? _approvalForm$disable2 : false,
|
|
128
|
+
"data-test": dataTest ? "".concat(dataTest, "--upload-download-widget") : undefined
|
|
129
|
+
}, docDetails, {
|
|
130
|
+
formName: isMandatory ? "file-".concat(questionId) : undefined
|
|
131
|
+
})))), children && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children), viewOnClick && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
132
|
+
className: "view-button",
|
|
133
|
+
"data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
|
|
134
|
+
onClick: () => viewOnClick(questionId),
|
|
135
|
+
type: "text-only",
|
|
136
|
+
label:
|
|
137
|
+
// isQuestionStyleWidget
|
|
138
|
+
// ? "View Previous Description"
|
|
139
|
+
// :
|
|
140
|
+
"View History"
|
|
141
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
+
className: columnDynamicCssClass === null || columnDynamicCssClass === void 0 ? void 0 : columnDynamicCssClass.secondColumn
|
|
143
|
+
}, systemStatus === null || systemStatus === void 0 ? void 0 : systemStatus.map(status => {
|
|
144
|
+
var _status$items;
|
|
145
|
+
return /*#__PURE__*/_react.default.createElement("div", null, status.renderType === "text" && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
146
|
+
typography: "type-b2-400",
|
|
147
|
+
color: "secondary-content"
|
|
148
|
+
}, status.label), status.renderType === "tag" && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomTag.default, status)), status.renderType === "toolTip" && ((_status$items = status.items) === null || _status$items === void 0 ? void 0 : _status$items.length) > 0 && /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
|
|
149
|
+
overlayClassName: "multipleDocumentTooltip",
|
|
150
|
+
isDisplayed: true,
|
|
151
|
+
placement: status.tooltipPlacement // Pass placement as a prop
|
|
152
|
+
,
|
|
153
|
+
title: (() => {
|
|
154
|
+
const totalItems = status.items.length;
|
|
155
|
+
const numColumns = totalItems === 1 ? 1 : 2; // 1 column if only 1 item, else 2 columns
|
|
156
|
+
|
|
157
|
+
const col1Size = Math.ceil(totalItems / numColumns); // First column gets extra if odd
|
|
158
|
+
const col2Size = totalItems - col1Size; // Remaining items go to second column
|
|
159
|
+
|
|
160
|
+
const columns = [status.items.slice(0, col1Size),
|
|
161
|
+
// First column
|
|
162
|
+
status.items.slice(col1Size) // Second column
|
|
163
|
+
];
|
|
164
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (status === null || status === void 0 ? void 0 : status.title) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
165
|
+
typography: "type-sl1-700",
|
|
166
|
+
color: "secondary-content"
|
|
167
|
+
}, status.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
+
className: "tooltip-grid",
|
|
169
|
+
style: {
|
|
170
|
+
flexDirection: totalItems === 1 ? "column" : "row",
|
|
171
|
+
// Make it single column if only 1 item
|
|
172
|
+
width: totalItems === 1 ? "100%" : "auto" // Full width if only 1 item
|
|
173
|
+
}
|
|
174
|
+
}, columns.map((columnItems, colIndex) => /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
key: "col-".concat(colIndex),
|
|
176
|
+
className: "tooltip-column"
|
|
177
|
+
}, columnItems.map(item => /*#__PURE__*/_react.default.createElement("li", {
|
|
178
|
+
key: item.title,
|
|
179
|
+
className: "tooltip-item"
|
|
180
|
+
}, !(status !== null && status !== void 0 && status.hideIcon) && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
181
|
+
size: 20,
|
|
182
|
+
icon: item.type === "positive" ? _Check.default : _Close.default,
|
|
183
|
+
color: item.type === "positive" ? "positive" : "negative"
|
|
184
|
+
}), /*#__PURE__*/_react.default.createElement("p", null, item.title)))))));
|
|
185
|
+
})()
|
|
186
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
187
|
+
type: "text-only",
|
|
188
|
+
label: status.label
|
|
189
|
+
})));
|
|
190
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
191
|
+
className: columnDynamicCssClass === null || columnDynamicCssClass === void 0 ? void 0 : columnDynamicCssClass.thirdColumn
|
|
192
|
+
}, actionRenderType === "text" && /*#__PURE__*/_react.default.createElement("div", {
|
|
193
|
+
className: "oaActionText"
|
|
194
|
+
}, (actionContent === null || actionContent === void 0 ? void 0 : actionContent.icon) && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
195
|
+
icon: _CheckCircle.default,
|
|
196
|
+
size: 20,
|
|
197
|
+
color: "secondary-content"
|
|
198
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
199
|
+
typography: "type-b2-400",
|
|
200
|
+
color: "secondary-content"
|
|
201
|
+
}, (_actionContent$label = actionContent === null || actionContent === void 0 ? void 0 : actionContent.label) !== null && _actionContent$label !== void 0 ? _actionContent$label : "-")), actionRenderType === "button" && /*#__PURE__*/_react.default.createElement(_CustomButton.default, _extends({
|
|
202
|
+
disabled: (_approvalForm$disable3 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable3 !== void 0 ? _approvalForm$disable3 : false
|
|
203
|
+
}, actionContent)), actionRenderType === "radio" &&
|
|
204
|
+
/*#__PURE__*/
|
|
205
|
+
//className="col-sm-12 col-md-4 col-lg-4"
|
|
206
|
+
_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
207
|
+
name: "isApproved-".concat(questionId),
|
|
208
|
+
className: "custom-radio-group",
|
|
209
|
+
initialValue: isApproved,
|
|
210
|
+
rules: [{
|
|
211
|
+
required: true,
|
|
212
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
213
|
+
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
214
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
215
|
+
}]
|
|
216
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
217
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
218
|
+
onChange: onRadioChange,
|
|
219
|
+
value: isApproved
|
|
220
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
221
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-yes") : undefined,
|
|
222
|
+
disabled: (_approvalForm$disable4 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable4 !== void 0 ? _approvalForm$disable4 : false,
|
|
223
|
+
label: "Mark as Approved",
|
|
224
|
+
value: 1
|
|
225
|
+
}), /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
226
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-no") : undefined,
|
|
227
|
+
disabled: (_approvalForm$disable5 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable5 !== void 0 ? _approvalForm$disable5 : false,
|
|
228
|
+
label: "Mark as Pending",
|
|
229
|
+
value: 0
|
|
230
|
+
}))), isApproved === 0 && /*#__PURE__*/_react.default.createElement("section", null, /*#__PURE__*/_react.default.createElement("h5", {
|
|
231
|
+
className: "type-b2-400"
|
|
232
|
+
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
233
|
+
name: "remarks-".concat(questionId),
|
|
234
|
+
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
|
|
235
|
+
rules: [{
|
|
236
|
+
required: true,
|
|
237
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
238
|
+
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
239
|
+
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
240
|
+
}]
|
|
241
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
242
|
+
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
243
|
+
disabled: (_approvalForm$disable6 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable6 !== void 0 ? _approvalForm$disable6 : false
|
|
244
|
+
})))), actionRenderType === "buttonWithForm" && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
245
|
+
validateStatus: form.getFieldError("validateDocumentButton#".concat(questionId)) ? "error" : "",
|
|
246
|
+
help: /*#__PURE__*/_react.default.createElement("div", {
|
|
247
|
+
className: "errorForRtv"
|
|
248
|
+
}, form.getFieldError("validateDocumentButton#".concat(questionId)) || "")
|
|
249
|
+
}, getFieldDecorator("validateDocumentButton#".concat(questionId), {
|
|
250
|
+
rules: isMandatory ? [{
|
|
251
|
+
required: true,
|
|
252
|
+
message: "This field is required"
|
|
253
|
+
}] : []
|
|
254
|
+
})( /*#__PURE__*/_react.default.createElement(_CustomButton.default, _extends({}, actionContent, {
|
|
255
|
+
disabled: (_approvalForm$disable7 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable7 !== void 0 ? _approvalForm$disable7 : false
|
|
256
|
+
})))), actionRenderType === "radioWithForm" && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
257
|
+
className: "custom-radio-group",
|
|
258
|
+
validateStatus: form.getFieldError("icQues_status_".concat(questionId)) ? "error" : "",
|
|
259
|
+
help: form.getFieldError("icQues_status_".concat(questionId)) || ""
|
|
260
|
+
}, getFieldDecorator("icQues_status_".concat(questionId), {
|
|
261
|
+
rules: isMandatory ? [{
|
|
262
|
+
required: true,
|
|
263
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
264
|
+
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
265
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
266
|
+
}] : []
|
|
267
|
+
})( /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
268
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
269
|
+
onChange: onChangeRadioWithForm,
|
|
270
|
+
value: radioButtonValue
|
|
271
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
272
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-yes") : undefined,
|
|
273
|
+
label: "Mark as Approved",
|
|
274
|
+
value: "Complete",
|
|
275
|
+
disabled: (_approvalForm$disable8 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable8 !== void 0 ? _approvalForm$disable8 : false
|
|
276
|
+
}), /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
277
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-no") : undefined,
|
|
278
|
+
label: "Mark as Pending",
|
|
279
|
+
value: "Incomplete",
|
|
280
|
+
disabled: (_approvalForm$disable9 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable9 !== void 0 ? _approvalForm$disable9 : false
|
|
281
|
+
})))), form.getFieldValue("icQues_status_".concat(questionId)) == "Incomplete" && /*#__PURE__*/_react.default.createElement("section", null, /*#__PURE__*/_react.default.createElement("h5", {
|
|
282
|
+
className: "type-b2-400"
|
|
283
|
+
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
284
|
+
validateStatus: form.getFieldError("icQues_remarks_".concat(questionId)) ? "error" : "",
|
|
285
|
+
help: form.getFieldError("icQues_remarks_".concat(questionId)) || ""
|
|
286
|
+
}, getFieldDecorator("icQues_remarks_".concat(questionId), {
|
|
287
|
+
rules: isMandatory ? [{
|
|
288
|
+
required: true,
|
|
289
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
290
|
+
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
291
|
+
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
292
|
+
}] : []
|
|
293
|
+
})( /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
294
|
+
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
295
|
+
disabled: (_approvalForm$disable10 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable10 !== void 0 ? _approvalForm$disable10 : false
|
|
296
|
+
}))))), actionRenderType === "buttonWithFormV4" && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
297
|
+
name: "validateDocumentButton#".concat(questionId),
|
|
298
|
+
initialValue: approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.isApproved,
|
|
299
|
+
rules: isMandatory ? [{
|
|
300
|
+
required: true,
|
|
301
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
302
|
+
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
303
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
304
|
+
}] : []
|
|
305
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, actionContent)))), hasDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
|
|
306
|
+
}
|
|
307
|
+
ApprovalWidget.propTypes = {
|
|
308
|
+
children: _propTypes.default.node,
|
|
309
|
+
"data-test": _propTypes.default.string,
|
|
310
|
+
description: _propTypes.default.string,
|
|
311
|
+
// Leave description optional
|
|
312
|
+
docDetails: _propTypes.default.shape({
|
|
313
|
+
multiple: _propTypes.default.bool,
|
|
314
|
+
onUpload: _propTypes.default.func,
|
|
315
|
+
uploadedDocuments: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
316
|
+
name: _propTypes.default.string,
|
|
317
|
+
onDelete: _propTypes.default.func,
|
|
318
|
+
onDownload: _propTypes.default.func
|
|
319
|
+
}))
|
|
320
|
+
}),
|
|
321
|
+
multipleDocDetails: _propTypes.default.array,
|
|
322
|
+
hasDivider: _propTypes.default.bool,
|
|
323
|
+
// Leave hasDivider optional,
|
|
324
|
+
approvalForm: _propTypes.default.shape({
|
|
325
|
+
disabled: _propTypes.default.bool,
|
|
326
|
+
hidden: _propTypes.default.bool,
|
|
327
|
+
invisible: _propTypes.default.bool,
|
|
328
|
+
isApproved: _propTypes.default.bool,
|
|
329
|
+
remarks: _propTypes.default.string
|
|
330
|
+
}),
|
|
331
|
+
isMandatory: _propTypes.default.bool,
|
|
332
|
+
isQuestionStyleWidget: _propTypes.default.bool,
|
|
333
|
+
questionId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
334
|
+
title: _propTypes.default.string.isRequired,
|
|
335
|
+
// Make title required
|
|
336
|
+
viewOnClick: _propTypes.default.func,
|
|
337
|
+
actionRenderType: _propTypes.default.string,
|
|
338
|
+
actionContent: _propTypes.default.shape({
|
|
339
|
+
label: _propTypes.default.string
|
|
340
|
+
}),
|
|
341
|
+
systemStatus: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
342
|
+
renderType: _propTypes.default.string,
|
|
343
|
+
label: _propTypes.default.string,
|
|
344
|
+
title: _propTypes.default.string
|
|
345
|
+
})),
|
|
346
|
+
documentTitle: _propTypes.default.string,
|
|
347
|
+
descriptionTitle: _propTypes.default.string,
|
|
348
|
+
form: _propTypes.default.object,
|
|
349
|
+
tooltipPlacement: _propTypes.default.string,
|
|
350
|
+
columnDynamicCssClass: _propTypes.default.object
|
|
351
|
+
};
|
|
352
|
+
ApprovalWidget.defaultProps = {
|
|
353
|
+
children: null,
|
|
354
|
+
"data-test": undefined,
|
|
355
|
+
description: "",
|
|
356
|
+
docDetails: {},
|
|
357
|
+
approvalForm: {},
|
|
358
|
+
isMandatory: false,
|
|
359
|
+
hasDivider: false,
|
|
360
|
+
isQuestionStyleWidget: false,
|
|
361
|
+
viewOnClick: undefined,
|
|
362
|
+
actionRenderType: undefined,
|
|
363
|
+
actionContent: {},
|
|
364
|
+
systemStatus: [],
|
|
365
|
+
documentTitle: "",
|
|
366
|
+
descriptionTitle: "",
|
|
367
|
+
form: null,
|
|
368
|
+
tooltipPlacement: "bottom",
|
|
369
|
+
// Default placement
|
|
370
|
+
columnDynamicCssClass: {
|
|
371
|
+
firstColumn: "col-sm-12 col-md-5 col-lg-5",
|
|
372
|
+
secondColumn: "col-sm-12 col-md-4 col-lg-4 flexCol8",
|
|
373
|
+
thirdColumn: "col-sm-12 col-md-3 col-lg-3"
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
var _default = exports.default = ApprovalWidget;
|
|
@@ -8,6 +8,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
8
8
|
var _templateObject, _templateObject2, _templateObject3;
|
|
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
|
-
const Styledescription = exports.Styledescription = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 0 8px;\n"])));
|
|
12
|
-
const StyledContainer = exports.StyledContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 0 16px;\
|
|
11
|
+
const Styledescription = exports.Styledescription = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // padding: 0 0 8px;\n"])));
|
|
12
|
+
const StyledContainer = exports.StyledContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 0 16px;\n label.ant-radio-wrapper:first-child {\n margin-inline-end: 16px;\n }\n .ant-radio-wrapper {\n white-space: nowrap;\n }\n .paddind-bottom-4 {\n padding: 0 0 4px;\n }\n .container {\n margin-bottom: 16px;\n }\n\n .view-button {\n justify-content: start;\n }\n .ant-form-item.custom-radio-group {\n margin-bottom: 12px;\n }\n\n .ant-divider-horizontal {\n margin: 16px 0px 0px;\n }\n\n .ant-form-item .ant-form-item-control-input {\n min-height: auto;\n }\n\n .ant-radio-group-outline {\n display: flex;\n justify-content: start;\n }\n\n textarea {\n padding: 16px;\n min-height: 88px;\n resize: none;\n border-radius: 4px;\n border: 1px solid var(--color-placeholder-text);\n }\n\n h5 {\n margin: 0 0 4px;\n color: var(--color-primary-content);\n }\n\n radiofield label {\n white-space: nowrap;\n }\n\n docdetailstag a {\n white-space: nowrap;\n }\n .oaCustomerResponse {\n display: flex;\n align-items: center;\n align-items: flex-start;\n }\n .oaCustomerResponse button{\n padding: 0;\n }\n .oaCustomerResponse section {\n padding: 0;\n }\n .oaActionText {\n display: flex;\n gap: 4px;\n align-items: center;\n height: fit-content;\n }\n .flexCol8 {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n .flexCol12 {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n .flexCol12 button{\n padding: 0;\n }\n"])));
|
|
13
13
|
const RedText = exports.RedText = _styledComponents.default.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-block;\n color: red;\n margin-left: 4px;\n"])));
|
|
@@ -86,8 +86,8 @@ function DocumentUpload(props) {
|
|
|
86
86
|
const handleCancel = () => setPreviewOpen(false);
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
* Determines if the given file is an image file based on its file extension.
|
|
90
|
+
*/
|
|
91
91
|
function isImageFile(fileName) {
|
|
92
92
|
var _fileName$split;
|
|
93
93
|
// Extract the file extension from the file name
|
|
@@ -192,10 +192,10 @@ function DocumentUpload(props) {
|
|
|
192
192
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
193
193
|
color: "secondary-content",
|
|
194
194
|
className: "type-b2-400"
|
|
195
|
-
}, subText)), infoText && /*#__PURE__*/_react.default.createElement(
|
|
196
|
-
color: "
|
|
197
|
-
|
|
198
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
195
|
+
}, subText)), infoText && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
196
|
+
color: "negative",
|
|
197
|
+
className: "type-b2-400"
|
|
198
|
+
}, infoText)), /*#__PURE__*/_react.default.createElement("div", {
|
|
199
199
|
className: "uploadDiv"
|
|
200
200
|
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
201
201
|
theme: {
|
|
@@ -76,7 +76,8 @@ function NotesWidget(_ref) {
|
|
|
76
76
|
value: noteInputValue,
|
|
77
77
|
onChange: event => setNoteInputValue(event.target.value),
|
|
78
78
|
onBlur: handleBlur,
|
|
79
|
-
placeholder: "Type here .."
|
|
79
|
+
placeholder: "Type here ..",
|
|
80
|
+
maxLength: 500
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/es.array.includes.js");
|
|
9
|
+
require("core-js/modules/es.string.includes.js");
|
|
10
|
+
require("core-js/modules/es.promise.js");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
var _InfoOutlined = _interopRequireDefault(require("@material-ui/icons/InfoOutlined"));
|
|
16
|
+
var _CustomDrawer = _interopRequireDefault(require("../../components/oa-component-drawer/CustomDrawer"));
|
|
17
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
18
|
+
var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
|
|
19
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
20
|
+
var _CustomUpload = _interopRequireDefault(require("../../dev/oa-component-upload/CustomUpload"));
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
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); }
|
|
23
|
+
function GenericUpload(_ref) {
|
|
24
|
+
var _config$documents;
|
|
25
|
+
let {
|
|
26
|
+
config,
|
|
27
|
+
uploadHandler,
|
|
28
|
+
deleteHandler: _deleteHandler,
|
|
29
|
+
downloadHandler,
|
|
30
|
+
previewHandler,
|
|
31
|
+
visible,
|
|
32
|
+
onClose,
|
|
33
|
+
validationConfig = {
|
|
34
|
+
maxSize: 5,
|
|
35
|
+
allowedTypes: ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'],
|
|
36
|
+
customValidation: null
|
|
37
|
+
},
|
|
38
|
+
uploadedDocuments,
|
|
39
|
+
showDelete = true,
|
|
40
|
+
showPreview = false,
|
|
41
|
+
form
|
|
42
|
+
} = _ref;
|
|
43
|
+
const validateFile = (file, docTypeId) => {
|
|
44
|
+
const isValidType = validationConfig.allowedTypes.includes(file.type);
|
|
45
|
+
if (!isValidType) {
|
|
46
|
+
form.setFields([{
|
|
47
|
+
name: docTypeId,
|
|
48
|
+
errors: ["Only ".concat(validationConfig.allowedTypes.map(type => type.split('/')[1].toUpperCase()).join('/'), " files are allowed!")]
|
|
49
|
+
}]);
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const isValidSize = file.size / 1024 / 1024 < validationConfig.maxSize;
|
|
53
|
+
if (!isValidSize) {
|
|
54
|
+
form.setFields([{
|
|
55
|
+
name: docTypeId,
|
|
56
|
+
errors: ["File must be smaller than ".concat(validationConfig.maxSize, "MB!")]
|
|
57
|
+
}]);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (validationConfig.customValidation) {
|
|
61
|
+
return validationConfig.customValidation(file, docTypeId);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
const handleUpload = async (file, docTypeId, documentId) => {
|
|
66
|
+
if (!validateFile(file, docTypeId)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return uploadHandler(file, docTypeId, documentId);
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
72
|
+
title: config.title,
|
|
73
|
+
width: config.width,
|
|
74
|
+
open: visible,
|
|
75
|
+
onClose: onClose,
|
|
76
|
+
buttonConfig: config.buttonConfig
|
|
77
|
+
}, config.systemInfo && /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: "margin-bottom-32"
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomInfo.default, _extends({}, config.systemInfo, {
|
|
80
|
+
iconConfig: {
|
|
81
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
82
|
+
icon: _InfoOutlined.default,
|
|
83
|
+
size: 24,
|
|
84
|
+
color: "negative"
|
|
85
|
+
}),
|
|
86
|
+
position: 'left'
|
|
87
|
+
}
|
|
88
|
+
}))), (config === null || config === void 0 ? void 0 : config.heading) && /*#__PURE__*/_react.default.createElement("div", {
|
|
89
|
+
className: "padding-bottom-32"
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
91
|
+
className: "type-t1-500",
|
|
92
|
+
color: "primary-content"
|
|
93
|
+
}, config.heading, ' ')), /*#__PURE__*/_react.default.createElement(_antd.Form, {
|
|
94
|
+
form: form
|
|
95
|
+
}, (_config$documents = config.documents) === null || _config$documents === void 0 ? void 0 : _config$documents.map(item => /*#__PURE__*/_react.default.createElement("div", {
|
|
96
|
+
key: item.docTypeId
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: "padding-bottom-4"
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
100
|
+
typography: "type-b2-500",
|
|
101
|
+
color: "primary-content"
|
|
102
|
+
}, item === null || item === void 0 ? void 0 : item.docName)), /*#__PURE__*/_react.default.createElement(_CustomUpload.default, {
|
|
103
|
+
isMandatory: true,
|
|
104
|
+
handleCustomOnChange: (file, status) => handleUpload(file, item.docTypeId, item.documentId),
|
|
105
|
+
formName: item.docTypeId,
|
|
106
|
+
uploadedDocuments: uploadedDocuments && uploadedDocuments[item.docTypeId] ? [uploadedDocuments[item.docTypeId]] : [],
|
|
107
|
+
deleteHandler: selectedFile => _deleteHandler(item.docTypeId),
|
|
108
|
+
downloadCallback: file => downloadHandler(item.docTypeId),
|
|
109
|
+
getPreview: previewHandler || (() => {}),
|
|
110
|
+
showDelete: showDelete,
|
|
111
|
+
showPreview: showPreview,
|
|
112
|
+
accept: validationConfig.allowedTypes.join(', '),
|
|
113
|
+
docName: item.docName
|
|
114
|
+
})))));
|
|
115
|
+
}
|
|
116
|
+
GenericUpload.propTypes = {
|
|
117
|
+
config: _propTypes.default.shape({
|
|
118
|
+
title: _propTypes.default.string.isRequired,
|
|
119
|
+
width: _propTypes.default.number,
|
|
120
|
+
buttonConfig: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
121
|
+
callback: _propTypes.default.func,
|
|
122
|
+
label: _propTypes.default.string,
|
|
123
|
+
type: _propTypes.default.string
|
|
124
|
+
})),
|
|
125
|
+
systemInfo: _propTypes.default.shape({
|
|
126
|
+
title: _propTypes.default.string,
|
|
127
|
+
color: _propTypes.default.string,
|
|
128
|
+
description: _propTypes.default.node
|
|
129
|
+
}),
|
|
130
|
+
heading: _propTypes.default.string,
|
|
131
|
+
documents: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
132
|
+
title: _propTypes.default.string,
|
|
133
|
+
docTypeId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
134
|
+
docName: _propTypes.default.string
|
|
135
|
+
}))
|
|
136
|
+
}).isRequired,
|
|
137
|
+
uploadHandler: _propTypes.default.func.isRequired,
|
|
138
|
+
deleteHandler: _propTypes.default.func.isRequired,
|
|
139
|
+
downloadHandler: _propTypes.default.func.isRequired,
|
|
140
|
+
previewHandler: _propTypes.default.func,
|
|
141
|
+
validationConfig: _propTypes.default.shape({
|
|
142
|
+
maxSize: _propTypes.default.number,
|
|
143
|
+
allowedTypes: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
144
|
+
customValidation: _propTypes.default.func
|
|
145
|
+
}),
|
|
146
|
+
uploadedDocuments: _propTypes.default.object,
|
|
147
|
+
showDelete: _propTypes.default.bool,
|
|
148
|
+
showPreview: _propTypes.default.bool,
|
|
149
|
+
form: _propTypes.default.object.isRequired,
|
|
150
|
+
visible: _propTypes.default.bool.isRequired,
|
|
151
|
+
onClose: _propTypes.default.func.isRequired
|
|
152
|
+
};
|
|
153
|
+
GenericUpload.defaultProps = {
|
|
154
|
+
previewHandler: () => {},
|
|
155
|
+
validationConfig: {
|
|
156
|
+
maxSize: 5,
|
|
157
|
+
allowedTypes: ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'],
|
|
158
|
+
customValidation: null
|
|
159
|
+
},
|
|
160
|
+
uploadedDocuments: {},
|
|
161
|
+
showDelete: true,
|
|
162
|
+
showPreview: false
|
|
163
|
+
};
|
|
164
|
+
var _default = exports.default = GenericUpload;
|