oa-componentbook 1.0.1-stage.51 → 1.0.1-stage.52
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-document-viewer/CustomDocumentViewer.js +275 -0
- package/build/dev/oa-component-document-viewer/styles.js +12 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +86 -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 +28 -0
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +257 -0
- package/build/widgets/oa-widget-approval/styles.js +2 -2
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +160 -0
- package/package.json +2 -2
|
@@ -0,0 +1,275 @@
|
|
|
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
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
_reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_reactPdf.pdfjs.version, "/pdf.worker.js");
|
|
24
|
+
const ZOOM_STEP = 0.2;
|
|
25
|
+
const MIN_ZOOM = 0.5;
|
|
26
|
+
const MAX_ZOOM = 3.0;
|
|
27
|
+
function CustomDocumentViewer(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
fileType,
|
|
30
|
+
fileUrl,
|
|
31
|
+
onDownload,
|
|
32
|
+
hideZoom,
|
|
33
|
+
hideDownload,
|
|
34
|
+
hidePageNumber,
|
|
35
|
+
hideRotate,
|
|
36
|
+
documentViewerOverlayHeight
|
|
37
|
+
} = _ref;
|
|
38
|
+
const [totalPages, setTotalPages] = (0, _react.useState)(null);
|
|
39
|
+
const [scale, setScale] = (0, _react.useState)(1.0);
|
|
40
|
+
const [currentPage, setCurrentPage] = (0, _react.useState)(1);
|
|
41
|
+
// For image rotation.
|
|
42
|
+
const [rotation, setRotation] = (0, _react.useState)(0);
|
|
43
|
+
const containerRef = (0, _react.useRef)(null);
|
|
44
|
+
const pageRefs = (0, _react.useRef)([]);
|
|
45
|
+
|
|
46
|
+
// When the document loads, update total pages (for PDFs).
|
|
47
|
+
const onDocumentLoadSuccess = _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
numPages
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return setTotalPages(numPages);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Zoom handlers.
|
|
55
|
+
const handleZoomIn = (0, _react.useCallback)(() => setScale(prev => Math.min(prev + ZOOM_STEP, MAX_ZOOM)), []);
|
|
56
|
+
const handleZoomOut = (0, _react.useCallback)(() => setScale(prev => Math.max(prev - ZOOM_STEP, MIN_ZOOM)), []);
|
|
57
|
+
const handleResetZoom = (0, _react.useCallback)(() => setScale(1.0), []);
|
|
58
|
+
|
|
59
|
+
// Single rotation handler for images – rotates 90° clockwise each click.
|
|
60
|
+
const handleRotate = (0, _react.useCallback)(() => {
|
|
61
|
+
setRotation(prev => prev + 90);
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
// Default download function; can be overridden by passing an onDownload prop.
|
|
65
|
+
const defaultDownload = (0, _react.useCallback)(() => {
|
|
66
|
+
if (fileType === "image") {
|
|
67
|
+
// Fetch the image as a blob to force download.
|
|
68
|
+
fetch(fileUrl, {
|
|
69
|
+
mode: "cors"
|
|
70
|
+
}).then(res => res.blob()).then(blob => {
|
|
71
|
+
const url = window.URL.createObjectURL(blob);
|
|
72
|
+
const link = document.createElement("a");
|
|
73
|
+
link.href = url;
|
|
74
|
+
link.download = fileUrl.split("/").pop();
|
|
75
|
+
document.body.appendChild(link);
|
|
76
|
+
link.click();
|
|
77
|
+
document.body.removeChild(link);
|
|
78
|
+
window.URL.revokeObjectURL(url);
|
|
79
|
+
}).catch(error => {
|
|
80
|
+
console.error("Image download failed:", error);
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
// For PDFs and other file types, use the standard download.
|
|
84
|
+
const link = document.createElement("a");
|
|
85
|
+
link.href = fileUrl;
|
|
86
|
+
link.download = fileUrl.split("/").pop();
|
|
87
|
+
document.body.appendChild(link);
|
|
88
|
+
link.click();
|
|
89
|
+
document.body.removeChild(link);
|
|
90
|
+
}
|
|
91
|
+
}, [fileUrl, fileType]);
|
|
92
|
+
const handleDownload = onDownload || defaultDownload;
|
|
93
|
+
|
|
94
|
+
// Enable dragging when zoomed in.
|
|
95
|
+
(0, _react.useEffect)(function () {
|
|
96
|
+
const container = containerRef.current;
|
|
97
|
+
if (!container) return;
|
|
98
|
+
let isDragging = false;
|
|
99
|
+
let startX;
|
|
100
|
+
let startY;
|
|
101
|
+
let scrollLeft;
|
|
102
|
+
let scrollTop;
|
|
103
|
+
const onMouseDown = e => {
|
|
104
|
+
if (scale > 1.0) {
|
|
105
|
+
isDragging = true;
|
|
106
|
+
container.style.cursor = "grabbing";
|
|
107
|
+
startX = e.pageX;
|
|
108
|
+
startY = e.pageY;
|
|
109
|
+
scrollLeft = container.scrollLeft;
|
|
110
|
+
scrollTop = container.scrollTop;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const onMouseMove = e => {
|
|
114
|
+
if (!isDragging) return;
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
container.scrollLeft = scrollLeft - (e.pageX - startX);
|
|
117
|
+
container.scrollTop = scrollTop - (e.pageY - startY);
|
|
118
|
+
};
|
|
119
|
+
const onMouseUp = () => {
|
|
120
|
+
isDragging = false;
|
|
121
|
+
container.style.cursor = scale > 1.0 ? "grab" : "auto";
|
|
122
|
+
};
|
|
123
|
+
container.addEventListener("mousedown", onMouseDown);
|
|
124
|
+
container.addEventListener("mousemove", onMouseMove);
|
|
125
|
+
container.addEventListener("mouseup", onMouseUp);
|
|
126
|
+
container.addEventListener("mouseleave", onMouseUp);
|
|
127
|
+
return () => {
|
|
128
|
+
container.removeEventListener("mousedown", onMouseDown);
|
|
129
|
+
container.removeEventListener("mousemove", onMouseMove);
|
|
130
|
+
container.removeEventListener("mouseup", onMouseUp);
|
|
131
|
+
container.removeEventListener("mouseleave", onMouseUp);
|
|
132
|
+
};
|
|
133
|
+
}, [scale]);
|
|
134
|
+
|
|
135
|
+
// (Optional) Scroll event to update the current page (for PDFs).
|
|
136
|
+
const handleScroll = () => {
|
|
137
|
+
const container = containerRef.current;
|
|
138
|
+
if (!container) return;
|
|
139
|
+
const containerRect = container.getBoundingClientRect();
|
|
140
|
+
let closestPage = 1;
|
|
141
|
+
let minDistance = Infinity;
|
|
142
|
+
pageRefs.current.forEach((ref, index) => {
|
|
143
|
+
if (ref) {
|
|
144
|
+
const rect = ref.getBoundingClientRect();
|
|
145
|
+
const distance = Math.abs(rect.top - containerRect.top);
|
|
146
|
+
if (distance < minDistance) {
|
|
147
|
+
minDistance = distance;
|
|
148
|
+
closestPage = index + 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
setCurrentPage(closestPage);
|
|
153
|
+
};
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
155
|
+
className: "myChotaModal"
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.default, {
|
|
157
|
+
documentViewerOverlayHeight: documentViewerOverlayHeight
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
+
ref: containerRef,
|
|
160
|
+
className: "customDocumentViewerOverlay",
|
|
161
|
+
style: {
|
|
162
|
+
cursor: scale > 1.0 ? "grab" : "auto"
|
|
163
|
+
},
|
|
164
|
+
onScroll: handleScroll
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: "customDocumentViewerOverlayHeader"
|
|
167
|
+
}, fileType === "pdf" && !hidePageNumber ? /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
+
className: "pageNumber"
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
170
|
+
className: "type-button-500",
|
|
171
|
+
color: "primary-background"
|
|
172
|
+
}, "Page ", currentPage, " of ", totalPages)) : fileType === "image" && !hideRotate ? /*#__PURE__*/_react.default.createElement("div", {
|
|
173
|
+
className: "pageNumber"
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
175
|
+
color: "primary-background",
|
|
176
|
+
size: 24,
|
|
177
|
+
icon: _RotateRight.default,
|
|
178
|
+
onClick: handleRotate,
|
|
179
|
+
style: {
|
|
180
|
+
cursor: "pointer"
|
|
181
|
+
}
|
|
182
|
+
})) : null, !hideZoom && /*#__PURE__*/_react.default.createElement("div", {
|
|
183
|
+
className: "customDocumentViewerOverlayHeaderIcons"
|
|
184
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
185
|
+
color: "primary-background",
|
|
186
|
+
size: 24,
|
|
187
|
+
icon: _icons.RemoveRounded,
|
|
188
|
+
onClick: handleZoomOut,
|
|
189
|
+
style: {
|
|
190
|
+
cursor: scale === MIN_ZOOM ? "not-allowed" : "pointer"
|
|
191
|
+
}
|
|
192
|
+
}), /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
193
|
+
color: "primary-background",
|
|
194
|
+
size: 24,
|
|
195
|
+
icon: _icons.ZoomInRounded,
|
|
196
|
+
onClick: handleResetZoom,
|
|
197
|
+
style: {
|
|
198
|
+
cursor: scale === 1.0 ? "not-allowed" : "pointer"
|
|
199
|
+
}
|
|
200
|
+
}), /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
201
|
+
color: "primary-background",
|
|
202
|
+
size: 24,
|
|
203
|
+
icon: _icons.AddRounded,
|
|
204
|
+
onClick: handleZoomIn,
|
|
205
|
+
style: {
|
|
206
|
+
cursor: scale === MAX_ZOOM ? "not-allowed" : "pointer"
|
|
207
|
+
}
|
|
208
|
+
})), !hideDownload && /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
className: "downloadIcon"
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
211
|
+
color: "primary-background",
|
|
212
|
+
size: 24,
|
|
213
|
+
icon: _icons.GetAppRounded,
|
|
214
|
+
onClick: handleDownload
|
|
215
|
+
}))), fileType === "pdf" && /*#__PURE__*/_react.default.createElement("div", {
|
|
216
|
+
style: {
|
|
217
|
+
transform: "scale(".concat(scale, ")"),
|
|
218
|
+
transformOrigin: "top center"
|
|
219
|
+
}
|
|
220
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
221
|
+
file: fileUrl,
|
|
222
|
+
onLoadSuccess: onDocumentLoadSuccess
|
|
223
|
+
}, Array.from({
|
|
224
|
+
length: totalPages
|
|
225
|
+
}, (_, index) => /*#__PURE__*/_react.default.createElement("div", {
|
|
226
|
+
key: "page_".concat(index + 1),
|
|
227
|
+
ref: el => pageRefs.current[index] = el,
|
|
228
|
+
style: {
|
|
229
|
+
marginBottom: "20px",
|
|
230
|
+
display: "flex",
|
|
231
|
+
justifyContent: "center"
|
|
232
|
+
}
|
|
233
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Page, {
|
|
234
|
+
pageNumber: index + 1,
|
|
235
|
+
scale: 1.0
|
|
236
|
+
}))))), fileType === "image" && /*#__PURE__*/_react.default.createElement("div", {
|
|
237
|
+
style: {
|
|
238
|
+
transform: "scale(".concat(scale, ") rotate(").concat(rotation, "deg)"),
|
|
239
|
+
transformOrigin: "center center"
|
|
240
|
+
}
|
|
241
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
242
|
+
src: fileUrl,
|
|
243
|
+
alt: "document",
|
|
244
|
+
style: {
|
|
245
|
+
transition: "transform 0.3s ease-in-out",
|
|
246
|
+
maxWidth: "100%",
|
|
247
|
+
maxHeight: "80vh"
|
|
248
|
+
}
|
|
249
|
+
})))));
|
|
250
|
+
}
|
|
251
|
+
CustomDocumentViewer.propTypes = {
|
|
252
|
+
fileType: _propTypes.default.string.isRequired,
|
|
253
|
+
// "pdf" or "image"
|
|
254
|
+
fileUrl: _propTypes.default.string.isRequired,
|
|
255
|
+
onDownload: _propTypes.default.func,
|
|
256
|
+
// Optional custom download function
|
|
257
|
+
hideZoom: _propTypes.default.bool,
|
|
258
|
+
// If true, hide zoom controls (for PDFs)
|
|
259
|
+
hideDownload: _propTypes.default.bool,
|
|
260
|
+
// If true, hide download button
|
|
261
|
+
hidePageNumber: _propTypes.default.bool,
|
|
262
|
+
// If true, hide page number display (for PDFs)
|
|
263
|
+
hideRotate: _propTypes.default.bool,
|
|
264
|
+
// If true, hide rotate control (for images)
|
|
265
|
+
documentViewerOverlayHeight: _propTypes.default.string
|
|
266
|
+
};
|
|
267
|
+
CustomDocumentViewer.defaultProps = {
|
|
268
|
+
onDownload: null,
|
|
269
|
+
hideZoom: false,
|
|
270
|
+
hideDownload: false,
|
|
271
|
+
hidePageNumber: false,
|
|
272
|
+
hideRotate: false,
|
|
273
|
+
documentViewerOverlayHeight: "100vh"
|
|
274
|
+
};
|
|
275
|
+
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: scroll;\n align-items: center;\n }\n\n .customDocumentViewerOverlayHeader {\n position: absolute;\n padding: 0 16px;\n bottom: 12px;\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 }\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"])), props => props.documentViewerOverlayHeight);
|
|
12
|
+
var _default = exports.default = DocumentViewerContainer;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _styles = _interopRequireDefault(require("./styles"));
|
|
16
|
+
const _excluded = ["title", "handleCloseDrawer", "documentConfig", "drawerWidth", "drawerButtonConfig", "drawerTagConfig"];
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function DocumentSideDrawer(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
title,
|
|
23
|
+
handleCloseDrawer,
|
|
24
|
+
documentConfig,
|
|
25
|
+
drawerWidth,
|
|
26
|
+
drawerButtonConfig,
|
|
27
|
+
drawerTagConfig
|
|
28
|
+
} = _ref,
|
|
29
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
// Calculate the drawer width based on documentConfig or fallback to 480
|
|
31
|
+
const calculatedWidth = drawerWidth !== null && drawerWidth !== void 0 ? drawerWidth : documentConfig ? 1200 : 480;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
33
|
+
buttonConfig: drawerButtonConfig,
|
|
34
|
+
"data-test": "document-side-drawer",
|
|
35
|
+
width: calculatedWidth,
|
|
36
|
+
onClose: handleCloseDrawer,
|
|
37
|
+
title: title
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
className: "viewerContainer"
|
|
40
|
+
}, documentConfig && /*#__PURE__*/_react.default.createElement(_CustomDocumentViewer.default, documentConfig), /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
className: "rightContSection"
|
|
42
|
+
}, drawerTagConfig && /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: "grayBoxSec"
|
|
44
|
+
}, drawerTagConfig.heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
45
|
+
className: "type-t2-700",
|
|
46
|
+
color: "primary-content"
|
|
47
|
+
}, drawerTagConfig.heading), /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: "margin-top-16 statusSec"
|
|
49
|
+
}, drawerTagConfig.tag && (
|
|
50
|
+
// Conditionally render CustomTag or Typography based on tag type
|
|
51
|
+
drawerTagConfig.tag.type ? /*#__PURE__*/_react.default.createElement(_CustomTag.default, {
|
|
52
|
+
label: drawerTagConfig.tag.label,
|
|
53
|
+
type: drawerTagConfig.tag.type
|
|
54
|
+
}) : /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
55
|
+
typography: "type-button-500"
|
|
56
|
+
}, drawerTagConfig.tag.label)), drawerTagConfig.viewDetails && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
57
|
+
"data-test": "button",
|
|
58
|
+
label: drawerTagConfig.viewDetails.label,
|
|
59
|
+
onClick: function noRefCheck() {},
|
|
60
|
+
type: "text-only"
|
|
61
|
+
}))), props.children))));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Define the prop types to enforce correct data types for the props
|
|
65
|
+
DocumentSideDrawer.propTypes = {
|
|
66
|
+
title: _propTypes.default.string,
|
|
67
|
+
handleCloseDrawer: _propTypes.default.func,
|
|
68
|
+
documentConfig: _propTypes.default.object,
|
|
69
|
+
// Pass the document configuration as an object
|
|
70
|
+
drawerWidth: _propTypes.default.string,
|
|
71
|
+
// Optional custom drawer width
|
|
72
|
+
drawerButtonConfig: _propTypes.default.object,
|
|
73
|
+
// Button configuration for the drawer
|
|
74
|
+
drawerTagConfig: _propTypes.default.object // Tag configuration (heading, tag, viewDetails)
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Default props to provide fallback values for optional props
|
|
78
|
+
DocumentSideDrawer.defaultProps = {
|
|
79
|
+
title: "",
|
|
80
|
+
handleCloseDrawer: () => {},
|
|
81
|
+
documentConfig: null,
|
|
82
|
+
drawerWidth: null,
|
|
83
|
+
drawerButtonConfig: null,
|
|
84
|
+
drawerTagConfig: null
|
|
85
|
+
};
|
|
86
|
+
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.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 .multipleDocumentTooltip ul{\n margin: 0;\n padding: 0;\n list-style: none\n }\n .multipleDocumentTooltip ul li{\n display: flex;\n gap: 8px;\n align-items: center;\n color: #212121;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px; \n width: 47%;\n padding: 8px 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"])));
|
|
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() {
|
|
@@ -311,6 +317,12 @@ Object.defineProperty(exports, "DocUploadWidget", {
|
|
|
311
317
|
return _DocUploadWidget.default;
|
|
312
318
|
}
|
|
313
319
|
});
|
|
320
|
+
Object.defineProperty(exports, "DocumentSideDrawer", {
|
|
321
|
+
enumerable: true,
|
|
322
|
+
get: function get() {
|
|
323
|
+
return _DocumentSideDrawer.default;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
314
326
|
Object.defineProperty(exports, "DropdownSearchInput", {
|
|
315
327
|
enumerable: true,
|
|
316
328
|
get: function get() {
|
|
@@ -335,6 +347,12 @@ Object.defineProperty(exports, "FeedbackWidget", {
|
|
|
335
347
|
return _FeedbackWidget.default;
|
|
336
348
|
}
|
|
337
349
|
});
|
|
350
|
+
Object.defineProperty(exports, "GenericUpload", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _ReUploadDrawer.default;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
338
356
|
Object.defineProperty(exports, "GlobalCss", {
|
|
339
357
|
enumerable: true,
|
|
340
358
|
get: function get() {
|
|
@@ -545,6 +563,12 @@ Object.defineProperty(exports, "colorOptions", {
|
|
|
545
563
|
return _colorOptions.colorOptions;
|
|
546
564
|
}
|
|
547
565
|
});
|
|
566
|
+
Object.defineProperty(exports, "customForm", {
|
|
567
|
+
enumerable: true,
|
|
568
|
+
get: function get() {
|
|
569
|
+
return _antd.Form;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
548
572
|
Object.defineProperty(exports, "getCheckboxTheme", {
|
|
549
573
|
enumerable: true,
|
|
550
574
|
get: function get() {
|
|
@@ -563,6 +587,8 @@ Object.defineProperty(exports, "typographyOptions", {
|
|
|
563
587
|
return _typographyOptions.typographyOptions;
|
|
564
588
|
}
|
|
565
589
|
});
|
|
590
|
+
var _antd = require("antd");
|
|
591
|
+
var _ReUploadDrawer = _interopRequireDefault(require("./widgets/oa-widget-reupload-drawer/ReUploadDrawer"));
|
|
566
592
|
var _Accordion = _interopRequireDefault(require("./components/oa-component-accordion/Accordion"));
|
|
567
593
|
var _CustomDetails = _interopRequireDefault(require("./widgets/oa-widget-custom-details/CustomDetails"));
|
|
568
594
|
var _DocUploadWidget = _interopRequireDefault(require("./widgets/oa-widget-document-upload/DocUploadWidget"));
|
|
@@ -616,6 +642,7 @@ var _AddressWidget = _interopRequireDefault(require("./widgets/oa-widget-address
|
|
|
616
642
|
var _AddSparePartWidget = _interopRequireDefault(require("./widgets/oa-widget-add-spare-part/AddSparePartWidget"));
|
|
617
643
|
var _AddSparePartCollapseWidget = _interopRequireDefault(require("./widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget"));
|
|
618
644
|
var _ApprovalWidget = _interopRequireDefault(require("./widgets/oa-widget-approval/ApprovalWidget"));
|
|
645
|
+
var _ApprovalWidgetNew = _interopRequireDefault(require("./widgets/oa-widget-approval/ApprovalWidgetNew"));
|
|
619
646
|
var _CloseClaimWidget = _interopRequireDefault(require("./widgets/oa-widget-close-claim/CloseClaimWidget"));
|
|
620
647
|
var _KeyValueWidget = _interopRequireDefault(require("./widgets/oa-widget-key-value/KeyValueWidget"));
|
|
621
648
|
var _NotesWidget = _interopRequireDefault(require("./widgets/oa-widget-notes/NotesWidget"));
|
|
@@ -652,6 +679,7 @@ var _MapBaseLocation = _interopRequireDefault(require("./widgets/oa-widget-map-b
|
|
|
652
679
|
var _CustomTimeline2 = _interopRequireDefault(require("./dev/oa-component-timeline/CustomTimeline"));
|
|
653
680
|
var _DocUploadCardWidget2 = _interopRequireDefault(require("./dev/oa-widget-document-upload-card/DocUploadCardWidget"));
|
|
654
681
|
var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/CustomUpload"));
|
|
682
|
+
var _DocumentSideDrawer = _interopRequireDefault(require("./dev/oa-widget-document-side-drawer/DocumentSideDrawer"));
|
|
655
683
|
var _PaymentAndConsent = _interopRequireDefault(require("./layout/paymentAndConsent/PaymentAndConsent"));
|
|
656
684
|
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
685
|
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,257 @@
|
|
|
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", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test"];
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {import('../../components/oa-component-upload/CustomUpload').DocumentDetails} DocumentDetails
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} ApprovalForm
|
|
36
|
+
* @property {boolean} [disabled=false] Whether the approval form is disabled.
|
|
37
|
+
* @property {boolean} [hidden=false] Whether the approval form is hidden.
|
|
38
|
+
* @property {boolean} [invisible=false] Whether the approval form is invisible (preserving layout).
|
|
39
|
+
* @property {boolean} [isApproved] Initial value for the approval status.
|
|
40
|
+
* @property {string} [remarks] Initial value for the remarks.
|
|
41
|
+
*
|
|
42
|
+
* @typedef {Object} Props
|
|
43
|
+
* @property {React.ReactNode} [children] Content to be rendered inside the ApprovalWidget.
|
|
44
|
+
* @property {string} [description] Description for the widget.
|
|
45
|
+
* @property {DocumentDetails} [docDetails] Document details for the widget.
|
|
46
|
+
* @property {ApprovalForm} [approvalForm] Form data for approval.
|
|
47
|
+
* @property {boolean} [isMandatory=false] Whether the widget is mandatory.
|
|
48
|
+
* @property {boolean} [hasDivider=false] Display a divider line beneath the widget.
|
|
49
|
+
* @property {boolean} [isQuestionStyleWidget=false] Whether the widget has a question-style layout.
|
|
50
|
+
* @property {string|number} questionId Identifier for the question.
|
|
51
|
+
* @property {string} title Title of the widget.
|
|
52
|
+
* @property {Function} [viewOnClick] Callback function for the view action.
|
|
53
|
+
* @property {string} ['data-test'] Data test string to be applied to the outermost element.
|
|
54
|
+
*/
|
|
55
|
+
function ApprovalWidget(_ref) {
|
|
56
|
+
var _approvalForm$disable, _actionContent$label, _approvalForm$disable2, _approvalForm$disable3, _approvalForm$remarks, _approvalForm$disable4;
|
|
57
|
+
let {
|
|
58
|
+
children,
|
|
59
|
+
description,
|
|
60
|
+
docDetails,
|
|
61
|
+
approvalForm,
|
|
62
|
+
isMandatory,
|
|
63
|
+
hasDivider,
|
|
64
|
+
isQuestionStyleWidget,
|
|
65
|
+
questionId,
|
|
66
|
+
title,
|
|
67
|
+
viewOnClick,
|
|
68
|
+
actionRenderType,
|
|
69
|
+
actionContent,
|
|
70
|
+
systemStatus,
|
|
71
|
+
documentTitle,
|
|
72
|
+
descriptionTitle,
|
|
73
|
+
'data-test': dataTest
|
|
74
|
+
} = _ref,
|
|
75
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
76
|
+
const getInitialValue = isApproved => {
|
|
77
|
+
switch (isApproved) {
|
|
78
|
+
case true:
|
|
79
|
+
return 1;
|
|
80
|
+
case false:
|
|
81
|
+
return 0;
|
|
82
|
+
default:
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const [isApproved, setIsApproved] = (0, _react.useState)(getInitialValue(approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.isApproved));
|
|
87
|
+
const onRadioChange = event => setIsApproved(event.target.value);
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
89
|
+
className: "row"
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: approvalForm.hidden ? 'col-sm-12 col-md-12 col-lg-12' : 'col-sm-12 col-md-7 col-lg-7 gutter'
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: "row"
|
|
94
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: isQuestionStyleWidget ? 'col-sm-12 col-md-12 col-lg-12' : 'col-sm-12 col-md-9 col-lg-9 gutter flexCol12'
|
|
96
|
+
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
97
|
+
className: "type-b2-400"
|
|
98
|
+
}, title, isMandatory && /*#__PURE__*/_react.default.createElement(_styles.RedText, null, "*"))), description && /*#__PURE__*/_react.default.createElement(_styles.Styledescription, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
99
|
+
typography: "type-b2-400",
|
|
100
|
+
color: "secondary-content"
|
|
101
|
+
}, descriptionTitle), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
102
|
+
typography: "type-b2-400",
|
|
103
|
+
color: "secondary-content"
|
|
104
|
+
}, description)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: "oaCustomerResponse"
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
107
|
+
typography: "type-b2-400",
|
|
108
|
+
color: "secondary-content"
|
|
109
|
+
}, documentTitle, ' ', "\xA0"), /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
110
|
+
disabled: (_approvalForm$disable = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable !== void 0 ? _approvalForm$disable : false,
|
|
111
|
+
"data-test": dataTest ? "".concat(dataTest, "--upload-download-widget") : undefined
|
|
112
|
+
}, docDetails, {
|
|
113
|
+
formName: isMandatory ? "file-".concat(questionId) : undefined
|
|
114
|
+
}))), viewOnClick && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
115
|
+
className: "view-button",
|
|
116
|
+
"data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
|
|
117
|
+
onClick: () => viewOnClick(questionId),
|
|
118
|
+
type: "text-only",
|
|
119
|
+
label: isQuestionStyleWidget ? 'View Previous Description' : 'View History'
|
|
120
|
+
}), children)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
className: "col-sm-12 col-md-3 col-lg-3 flexCol8"
|
|
122
|
+
}, systemStatus === null || systemStatus === void 0 ? void 0 : systemStatus.map(status => /*#__PURE__*/_react.default.createElement("div", null, status.renderType === 'text' && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
123
|
+
typography: "type-b2-400",
|
|
124
|
+
color: "secondary-content"
|
|
125
|
+
}, status.label), status.renderType === 'tag' && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomTag.default, status)), status.renderType === 'toolTip' && /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
|
|
126
|
+
overlayClassName: "multipleDocumentTooltip",
|
|
127
|
+
isDisplayed: true,
|
|
128
|
+
title: /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
+
className: "headingName"
|
|
130
|
+
}, "Model response"), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: "flexWrap"
|
|
132
|
+
}, [...Array(5)].map((_, index) => /*#__PURE__*/_react.default.createElement("li", {
|
|
133
|
+
key: "".concat(index + 5, "_close")
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
135
|
+
size: 20,
|
|
136
|
+
icon: _Close.default,
|
|
137
|
+
color: "negative"
|
|
138
|
+
}), ' ', status.title)), [...Array(2)].map((_, index) => /*#__PURE__*/_react.default.createElement("li", {
|
|
139
|
+
key: "".concat(index + 5, "_positive")
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
141
|
+
size: 20,
|
|
142
|
+
icon: _Check.default,
|
|
143
|
+
color: "positive"
|
|
144
|
+
}), ' ', status.title))))
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
146
|
+
type: "text-only",
|
|
147
|
+
label: status.label
|
|
148
|
+
}))))))), approvalForm.invisible && /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
className: "col-sm-12 col-md-5 col-lg-5"
|
|
150
|
+
}) || !approvalForm.hidden && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, actionRenderType === 'text' && /*#__PURE__*/_react.default.createElement("div", {
|
|
151
|
+
className: "oaActionText"
|
|
152
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
153
|
+
icon: _CheckCircle.default,
|
|
154
|
+
color: "secondary-content"
|
|
155
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
156
|
+
typography: "type-b2-400",
|
|
157
|
+
color: "secondary-content"
|
|
158
|
+
}, (_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, actionContent), actionRenderType === 'radio' && /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
+
className: "col-sm-12 col-md-5 col-lg-5"
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
161
|
+
name: "isApproved-".concat(questionId),
|
|
162
|
+
className: "custom-radio-group",
|
|
163
|
+
initialValue: isApproved,
|
|
164
|
+
rules: [{
|
|
165
|
+
required: true,
|
|
166
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
167
|
+
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
168
|
+
}, "Approval status needs to be selected.") : 'Approval status needs to be selected.'
|
|
169
|
+
}]
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
171
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
172
|
+
onChange: onRadioChange,
|
|
173
|
+
value: isApproved
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
175
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-yes") : undefined,
|
|
176
|
+
disabled: (_approvalForm$disable2 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable2 !== void 0 ? _approvalForm$disable2 : false,
|
|
177
|
+
label: "Mark as Approved",
|
|
178
|
+
value: 1
|
|
179
|
+
}), /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
180
|
+
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-no") : undefined,
|
|
181
|
+
disabled: (_approvalForm$disable3 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable3 !== void 0 ? _approvalForm$disable3 : false,
|
|
182
|
+
label: "Mark as Pending",
|
|
183
|
+
value: 0
|
|
184
|
+
}))), isApproved === 0 && /*#__PURE__*/_react.default.createElement("section", null, /*#__PURE__*/_react.default.createElement("h5", {
|
|
185
|
+
className: "type-b2-400"
|
|
186
|
+
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
187
|
+
name: "remarks-".concat(questionId),
|
|
188
|
+
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : '',
|
|
189
|
+
rules: [{
|
|
190
|
+
required: true,
|
|
191
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
192
|
+
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
193
|
+
}, "Remarks cannot be empty.") : 'Remarks cannot be empty.'
|
|
194
|
+
}]
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
196
|
+
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
197
|
+
disabled: (_approvalForm$disable4 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable4 !== void 0 ? _approvalForm$disable4 : false
|
|
198
|
+
}))))) || undefined), hasDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
|
|
199
|
+
}
|
|
200
|
+
ApprovalWidget.propTypes = {
|
|
201
|
+
children: _propTypes.default.node,
|
|
202
|
+
'data-test': _propTypes.default.string,
|
|
203
|
+
description: _propTypes.default.string,
|
|
204
|
+
// Leave description optional
|
|
205
|
+
docDetails: _propTypes.default.shape({
|
|
206
|
+
multiple: _propTypes.default.bool,
|
|
207
|
+
onUpload: _propTypes.default.func,
|
|
208
|
+
uploadedDocuments: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
209
|
+
name: _propTypes.default.string,
|
|
210
|
+
onDelete: _propTypes.default.func,
|
|
211
|
+
onDownload: _propTypes.default.func
|
|
212
|
+
}))
|
|
213
|
+
}),
|
|
214
|
+
hasDivider: _propTypes.default.bool,
|
|
215
|
+
// Leave hasDivider optional,
|
|
216
|
+
approvalForm: _propTypes.default.shape({
|
|
217
|
+
disabled: _propTypes.default.bool,
|
|
218
|
+
hidden: _propTypes.default.bool,
|
|
219
|
+
invisible: _propTypes.default.bool,
|
|
220
|
+
isApproved: _propTypes.default.bool,
|
|
221
|
+
remarks: _propTypes.default.string
|
|
222
|
+
}),
|
|
223
|
+
isMandatory: _propTypes.default.bool,
|
|
224
|
+
isQuestionStyleWidget: _propTypes.default.bool,
|
|
225
|
+
questionId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
226
|
+
title: _propTypes.default.string.isRequired,
|
|
227
|
+
// Make title required
|
|
228
|
+
viewOnClick: _propTypes.default.func,
|
|
229
|
+
actionRenderType: _propTypes.default.string,
|
|
230
|
+
actionContent: _propTypes.default.shape({
|
|
231
|
+
label: _propTypes.default.string
|
|
232
|
+
}),
|
|
233
|
+
systemStatus: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
234
|
+
renderType: _propTypes.default.string,
|
|
235
|
+
label: _propTypes.default.string,
|
|
236
|
+
title: _propTypes.default.string
|
|
237
|
+
})),
|
|
238
|
+
documentTitle: _propTypes.default.string,
|
|
239
|
+
descriptionTitle: _propTypes.default.string
|
|
240
|
+
};
|
|
241
|
+
ApprovalWidget.defaultProps = {
|
|
242
|
+
children: null,
|
|
243
|
+
'data-test': undefined,
|
|
244
|
+
description: '',
|
|
245
|
+
docDetails: {},
|
|
246
|
+
approvalForm: {},
|
|
247
|
+
isMandatory: false,
|
|
248
|
+
hasDivider: false,
|
|
249
|
+
isQuestionStyleWidget: false,
|
|
250
|
+
viewOnClick: undefined,
|
|
251
|
+
actionRenderType: undefined,
|
|
252
|
+
actionContent: {},
|
|
253
|
+
systemStatus: [],
|
|
254
|
+
documentTitle: '',
|
|
255
|
+
descriptionTitle: ''
|
|
256
|
+
};
|
|
257
|
+
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 }\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"])));
|
|
13
13
|
const RedText = exports.RedText = _styledComponents.default.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-block;\n color: red;\n margin-left: 4px;\n"])));
|
|
@@ -0,0 +1,160 @@
|
|
|
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 _CustomDrawer = _interopRequireDefault(require("../../components/oa-component-drawer/CustomDrawer"));
|
|
16
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
17
|
+
var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
19
|
+
var _CustomUpload = _interopRequireDefault(require("../../dev/oa-component-upload/CustomUpload"));
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
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); }
|
|
22
|
+
function GenericUpload(_ref) {
|
|
23
|
+
var _config$documents;
|
|
24
|
+
let {
|
|
25
|
+
config,
|
|
26
|
+
uploadHandler,
|
|
27
|
+
deleteHandler: _deleteHandler,
|
|
28
|
+
downloadHandler,
|
|
29
|
+
previewHandler,
|
|
30
|
+
visible,
|
|
31
|
+
onClose,
|
|
32
|
+
validationConfig = {
|
|
33
|
+
maxSize: 5,
|
|
34
|
+
allowedTypes: ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'],
|
|
35
|
+
customValidation: null
|
|
36
|
+
},
|
|
37
|
+
uploadedDocuments,
|
|
38
|
+
showDelete = true,
|
|
39
|
+
showPreview = false,
|
|
40
|
+
form
|
|
41
|
+
} = _ref;
|
|
42
|
+
const validateFile = (file, docTypeId) => {
|
|
43
|
+
const isValidType = validationConfig.allowedTypes.includes(file.type);
|
|
44
|
+
if (!isValidType) {
|
|
45
|
+
form.setFields([{
|
|
46
|
+
name: docTypeId,
|
|
47
|
+
errors: ["Only ".concat(validationConfig.allowedTypes.map(type => type.split('/')[1].toUpperCase()).join('/'), " files are allowed!")]
|
|
48
|
+
}]);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const isValidSize = file.size / 1024 / 1024 < validationConfig.maxSize;
|
|
52
|
+
if (!isValidSize) {
|
|
53
|
+
form.setFields([{
|
|
54
|
+
name: docTypeId,
|
|
55
|
+
errors: ["File must be smaller than ".concat(validationConfig.maxSize, "MB!")]
|
|
56
|
+
}]);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (validationConfig.customValidation) {
|
|
60
|
+
return validationConfig.customValidation(file, docTypeId);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
const handleUpload = async (file, docTypeId) => {
|
|
65
|
+
if (!validateFile(file, docTypeId)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return uploadHandler(file, docTypeId);
|
|
69
|
+
};
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
71
|
+
title: config.title,
|
|
72
|
+
width: config.width,
|
|
73
|
+
open: visible,
|
|
74
|
+
onClose: onClose,
|
|
75
|
+
buttonConfig: config.buttonConfig
|
|
76
|
+
}, config.systemInfo && /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: "margin-bottom-32"
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomInfo.default, _extends({}, config.systemInfo, {
|
|
79
|
+
iconConfig: {
|
|
80
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
81
|
+
icon: _Info.default
|
|
82
|
+
}),
|
|
83
|
+
position: 'left'
|
|
84
|
+
}
|
|
85
|
+
}))), (config === null || config === void 0 ? void 0 : config.heading) && /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: "padding-bottom-32"
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
88
|
+
className: "type-t1-500",
|
|
89
|
+
color: "primary-content"
|
|
90
|
+
}, config.heading, ' ')), /*#__PURE__*/_react.default.createElement(_antd.Form, {
|
|
91
|
+
form: form
|
|
92
|
+
}, (_config$documents = config.documents) === null || _config$documents === void 0 ? void 0 : _config$documents.map(item => /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
key: item.docTypeId
|
|
94
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "padding-bottom-4"
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
97
|
+
typography: "type-b2-500",
|
|
98
|
+
color: "primary-content"
|
|
99
|
+
}, item === null || item === void 0 ? void 0 : item.docName)), /*#__PURE__*/_react.default.createElement(_CustomUpload.default, {
|
|
100
|
+
handleCustomOnChange: (file, status) => handleUpload(file, item.docTypeId),
|
|
101
|
+
formName: item.docTypeId,
|
|
102
|
+
uploadedDocuments: uploadedDocuments && uploadedDocuments[item.docTypeId] ? [uploadedDocuments[item.docTypeId]] : [],
|
|
103
|
+
deleteHandler: selectedFile => _deleteHandler(item.docTypeId),
|
|
104
|
+
downloadCallback: file => downloadHandler(item.docTypeId),
|
|
105
|
+
getPreview: previewHandler || (() => {}),
|
|
106
|
+
showDelete: showDelete,
|
|
107
|
+
showPreview: showPreview,
|
|
108
|
+
accept: validationConfig.allowedTypes.join(', '),
|
|
109
|
+
docName: item.docName
|
|
110
|
+
})))));
|
|
111
|
+
}
|
|
112
|
+
GenericUpload.propTypes = {
|
|
113
|
+
config: _propTypes.default.shape({
|
|
114
|
+
title: _propTypes.default.string.isRequired,
|
|
115
|
+
width: _propTypes.default.number,
|
|
116
|
+
buttonConfig: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
117
|
+
callback: _propTypes.default.func,
|
|
118
|
+
label: _propTypes.default.string,
|
|
119
|
+
type: _propTypes.default.string
|
|
120
|
+
})),
|
|
121
|
+
systemInfo: _propTypes.default.shape({
|
|
122
|
+
title: _propTypes.default.string,
|
|
123
|
+
color: _propTypes.default.string,
|
|
124
|
+
description: _propTypes.default.node
|
|
125
|
+
}),
|
|
126
|
+
heading: _propTypes.default.string,
|
|
127
|
+
documents: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
128
|
+
title: _propTypes.default.string,
|
|
129
|
+
docTypeId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
130
|
+
docName: _propTypes.default.string
|
|
131
|
+
}))
|
|
132
|
+
}).isRequired,
|
|
133
|
+
uploadHandler: _propTypes.default.func.isRequired,
|
|
134
|
+
deleteHandler: _propTypes.default.func.isRequired,
|
|
135
|
+
downloadHandler: _propTypes.default.func.isRequired,
|
|
136
|
+
previewHandler: _propTypes.default.func,
|
|
137
|
+
validationConfig: _propTypes.default.shape({
|
|
138
|
+
maxSize: _propTypes.default.number,
|
|
139
|
+
allowedTypes: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
140
|
+
customValidation: _propTypes.default.func
|
|
141
|
+
}),
|
|
142
|
+
uploadedDocuments: _propTypes.default.object,
|
|
143
|
+
showDelete: _propTypes.default.bool,
|
|
144
|
+
showPreview: _propTypes.default.bool,
|
|
145
|
+
form: _propTypes.default.object.isRequired,
|
|
146
|
+
visible: _propTypes.default.bool.isRequired,
|
|
147
|
+
onClose: _propTypes.default.func.isRequired
|
|
148
|
+
};
|
|
149
|
+
GenericUpload.defaultProps = {
|
|
150
|
+
previewHandler: () => {},
|
|
151
|
+
validationConfig: {
|
|
152
|
+
maxSize: 5,
|
|
153
|
+
allowedTypes: ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'],
|
|
154
|
+
customValidation: null
|
|
155
|
+
},
|
|
156
|
+
uploadedDocuments: {},
|
|
157
|
+
showDelete: true,
|
|
158
|
+
showPreview: false
|
|
159
|
+
};
|
|
160
|
+
var _default = exports.default = GenericUpload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oa-componentbook",
|
|
3
|
-
"version": "1.0.1-stage.
|
|
3
|
+
"version": "1.0.1-stage.52",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable components",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"storybook": "storybook dev -p 6006",
|
|
73
73
|
"build-storybook": "storybook build",
|
|
74
74
|
"update-package-lock": "npm i --package-lock-only",
|
|
75
|
-
"lint": "eslint src
|
|
75
|
+
"lint": "eslint \"src/**/*.{js,jsx}\"",
|
|
76
76
|
"lint-fix": "npm run lint -- --fix",
|
|
77
77
|
"lint-fix-quiet": "npm run lint-fix -- --quiet",
|
|
78
78
|
"pre-commit": "./pre-commit.sh"
|