oa-componentbook 1.0.1-stage.95 → 1.0.1-stage.97
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-upload/CustomUpload.js +0 -3
- package/build/global-css/commonStyles.js +1 -1
- package/build/index.js +0 -35
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +7 -12
- 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-map-base-location/AddressDetails.js +6 -5
- package/build/widgets/oa-widget-map-base-location/AddressForm.js +26 -3
- package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +5 -3
- package/build/widgets/oa-widget-notes/NotesWidget.js +1 -2
- package/package.json +2 -2
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +0 -281
- package/build/dev/oa-component-document-viewer/styles.js +0 -12
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +0 -130
- package/build/dev/oa-widget-document-side-drawer/styles.js +0 -12
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +0 -374
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +0 -164
|
@@ -1,281 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,130 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|