oa-componentbook 1.0.1-stage.43 → 1.0.1-stage.430
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-accordion/Accordion.js +131 -40
- package/build/components/oa-component-accordion/styles.js +2 -2
- package/build/components/oa-component-button/CustomButton.js +24 -19
- package/build/components/oa-component-button/styles.js +1 -1
- package/build/components/oa-component-checkbox/CustomCheckBox.js +20 -17
- package/build/components/oa-component-checkbox/styles.js +1 -1
- package/build/components/oa-component-datepicker/CustomDatePicker.js +37 -26
- package/build/components/oa-component-drawer/CustomDrawer.js +2 -0
- package/build/components/oa-component-dropdown/CustomDropdown.js +16 -4
- package/build/components/oa-component-icons/MaterialIcon.js +1 -1
- package/build/components/oa-component-info/CustomInfo.js +9 -4
- package/build/components/oa-component-info/styles.js +3 -3
- package/build/components/oa-component-modal/CustomModal.js +59 -48
- package/build/components/oa-component-modal/styles.js +3 -2
- package/build/components/oa-component-pagination/CustomPagination.js +111 -0
- package/build/components/oa-component-pagination/styles.js +12 -0
- package/build/components/oa-component-select/CustomSelect.js +130 -56
- package/build/components/oa-component-steps/CustomSteps.js +117 -0
- package/build/components/oa-component-steps/styles.js +12 -0
- package/build/components/oa-component-table/CustomTable.js +28 -5
- package/build/components/oa-component-table/CustomTableV1.js +612 -0
- package/build/components/oa-component-table/styles.js +1 -1
- package/build/components/oa-component-table/stylesV1.js +19 -0
- package/build/components/oa-component-tabs/CustomTabs.js +1 -1
- package/build/components/oa-component-tag/CustomTag.js +29 -11
- package/build/components/oa-component-tag/styles.js +30 -3
- package/build/components/oa-component-textarea/CustomTextArea.js +161 -0
- package/build/components/oa-component-textarea/constants.js +39 -0
- package/build/components/oa-component-textarea/styles.js +12 -3
- package/build/components/oa-component-tooltip/CustomTooltip.js +8 -4
- package/build/components/oa-component-upload/CustomUpload.js +129 -42
- package/build/components/oa-component-viewer/CustomViewer.js +17 -11
- package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +367 -0
- package/build/dev/oa-component-document-viewer/styles.js +12 -0
- package/build/dev/oa-component-upload/CustomUpload.js +135 -47
- package/build/dev/oa-component-upload/styles.js +2 -2
- package/build/dev/oa-widget-document-modal/DocumentSideModal.js +166 -0
- package/build/dev/oa-widget-document-modal/styles.js +12 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +196 -0
- package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
- package/build/global-css/GlobalCss.js +2 -1
- package/build/global-css/GridLayout.js +1 -1
- package/build/global-css/commonStyles.js +11 -0
- package/build/images/Car.png +0 -0
- package/build/images/TwoWheeler.png +0 -0
- package/build/images/astronaut_emptystate.png +0 -0
- package/build/images/exportGrp01.png +0 -0
- package/build/images/exportGrp02.png +0 -0
- package/build/images/exportGrp03.png +0 -0
- package/build/images/outOfStock.png +0 -0
- package/build/index.js +110 -5
- package/build/layout/DetailDataLayout/DetailDataLayout.js +20 -0
- package/build/layout/DetailDataLayout/components/Form.js +22 -0
- package/build/layout/DetailDataLayout/components/Header.js +32 -0
- package/build/layout/DetailDataLayout/style.css +9 -0
- package/build/layout/DetailDataLayout/styles.js +12 -0
- package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +262 -0
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +68 -0
- package/build/layout/EntityOverviewLayout/styles.js +13 -0
- package/build/layout/GenricLayOut/GenricLayOut.js +2389 -0
- package/build/layout/GenricLayOut/components/AppliedFilters.js +90 -0
- package/build/layout/GenricLayOut/components/CardList.js +34 -0
- package/build/layout/GenricLayOut/components/DropdownSearch.js +48 -0
- package/build/layout/GenricLayOut/components/Header.js +74 -0
- package/build/layout/GenricLayOut/components/Modal.js +96 -0
- package/build/layout/GenricLayOut/components/ProfileSection.js +219 -0
- package/build/layout/GenricLayOut/components/Search.js +51 -0
- package/build/layout/GenricLayOut/components/StaticFilter.css +73 -0
- package/build/layout/GenricLayOut/components/StaticFilter.js +37 -0
- package/build/layout/GenricLayOut/reducer/layoutReducer.js +306 -0
- package/build/layout/GenricLayOut/resolver/staticConfigResolver.js +98 -0
- package/build/layout/GenricLayOut/styles.js +42 -0
- package/build/utils/download-file.js +23 -0
- package/build/widgets/oa-form-widget/FormWidget.js +576 -0
- package/build/widgets/oa-form-widget/FormWidgetStyle.js +18 -0
- package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +80 -16
- package/build/widgets/oa-widget-add-spare-part/AddSparePartWidget.js +50 -7
- package/build/widgets/oa-widget-address/AddressWidget.js +12 -17
- package/build/widgets/oa-widget-approval/ApprovalWidget.js +19 -11
- package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +492 -0
- package/build/widgets/oa-widget-approval/styles.js +2 -2
- package/build/widgets/oa-widget-chat/ChatWidget.js +5 -5
- package/build/widgets/oa-widget-close-claim/CloseClaimWidget.js +17 -5
- package/build/widgets/oa-widget-collapsible-key-value/CollapsibleKeyValueWidget.js +396 -0
- package/build/widgets/oa-widget-collapsible-key-value/styles.js +16 -0
- package/build/widgets/oa-widget-content-panel/ContentPanel.js +82 -0
- package/build/widgets/oa-widget-content-panel/styles.js +12 -0
- package/build/widgets/oa-widget-customer-rating-card/CustomerRatingCard.js +5 -5
- package/build/widgets/oa-widget-detailcard/styles.js +1 -1
- package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +6 -9
- package/build/widgets/oa-widget-dropdown-search-input/DropdownSearchInput.js +53 -19
- package/build/widgets/oa-widget-dropdown-search-input/styles.js +1 -1
- package/build/widgets/oa-widget-guide/GuideWidget.js +70 -0
- package/build/widgets/oa-widget-guide/GuideWidgetStyle.js +12 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationDeleteBiker.js +24 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModal.js +34 -0
- package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModalStyle.js +13 -0
- package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +99 -57
- package/build/widgets/oa-widget-image-carousel/styles.js +16 -5
- package/build/widgets/oa-widget-image-gallery/FullscreenViewer.js +169 -0
- package/build/widgets/oa-widget-image-gallery/ImageGallery.js +87 -0
- package/build/widgets/oa-widget-image-gallery/ThumbnailGrid.js +146 -0
- package/build/widgets/oa-widget-image-gallery/imageCache.js +15 -0
- package/build/widgets/oa-widget-image-gallery/imageGalleryStyle.js +16 -0
- package/build/widgets/oa-widget-item-info-card/InfoCardListWidget.js +60 -0
- package/build/widgets/oa-widget-item-info-card/ItemInfoCardWidget.js +83 -0
- package/build/widgets/oa-widget-item-info-card/styles.css +50 -0
- package/build/widgets/oa-widget-item-info-card/styles.js +14 -0
- package/build/widgets/oa-widget-key-value/KeyValueWidget.js +46 -12
- package/build/widgets/oa-widget-key-value/styles.js +1 -1
- package/build/widgets/oa-widget-kpi/KPICardWidget.js +86 -0
- package/build/widgets/oa-widget-kpi/styles.js +12 -0
- package/build/widgets/oa-widget-map-base-location/AddressDetails.js +21 -7
- package/build/widgets/oa-widget-map-base-location/AddressForm.js +32 -5
- package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +9 -3
- package/build/widgets/oa-widget-map-base-location/MapComponent.js +17 -2
- package/build/widgets/oa-widget-membershipcard/MembershipCard.js +14 -3
- package/build/widgets/oa-widget-membershipcard/styles.js +1 -1
- package/build/widgets/oa-widget-notes/NotesWidget.js +32 -30
- package/build/widgets/oa-widget-notes/styles.js +4 -3
- package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +165 -0
- package/build/widgets/oa-widget-profile-data/styles.js +13 -0
- package/build/widgets/oa-widget-progressive-steps/ProgressiveStepsWidget.js +362 -0
- package/build/widgets/oa-widget-progressive-steps/styles.js +12 -0
- package/build/widgets/oa-widget-reimbursement-breakup/ReimbursementBreakupWidget.js +18 -9
- package/build/widgets/oa-widget-reimbursement-breakup/styles.js +1 -1
- package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
- package/build/widgets/oa-widget-select-list-item-modal/SelectListItemModal.js +91 -0
- package/build/widgets/oa-widget-sidebar/SidebarWidget.js +175 -0
- package/build/widgets/oa-widget-sidebar/components/Header.js +33 -0
- package/build/widgets/oa-widget-sidebar/styles.js +13 -0
- package/build/widgets/oa-widget-spare-part/SparePartsWidget.js +63 -35
- package/build/widgets/oa-widget-track-shipment/TrackShipmentWidget.js +28 -6
- package/build/widgets/oa-widget-track-shipment-list/TrackShipmentWidgetList.js +103 -0
- package/build/widgets/oa-widget-track-shipment-list/fn.js +81 -0
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +354 -0
- package/build/widgets/oa-widget-user-management/styles.js +15 -0
- package/package.json +3 -1
- package/build/components/oa-component-textarea/TextArea.js +0 -74
- package/build/dev/oa-widget-track-shipment/TrackShipmentWidget.js +0 -195
- /package/build/{dev/oa-widget-track-shipment → widgets/oa-widget-track-shipment-list}/styles.js +0 -0
|
@@ -18,7 +18,10 @@ var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorV
|
|
|
18
18
|
var _handIcon = _interopRequireDefault(require("../../images/hand-icon.svg"));
|
|
19
19
|
var _PdfSampleImage = _interopRequireDefault(require("../../images/PdfSampleImage.png"));
|
|
20
20
|
var _styles = require("./styles");
|
|
21
|
-
const _excluded = ["uploadedDocuments", "handleCustomOnChange", "multipleDoc", "showDelete", "formName", "getPreview", "isMandatory", "noOfUpload", "downloadCallback", "showDownloadButton", "showDeleteButton", "deleteHandler", "showRoateButton", "showZoomInButton", "showZoomOutButton"];
|
|
21
|
+
const _excluded = ["uploadedDocuments", "handleCustomOnChange", "multipleDoc", "showDelete", "formName", "getPreview", "isMandatory", "noOfUpload", "downloadCallback", "showDownloadButton", "showDeleteButton", "deleteHandler", "showRoateButton", "showZoomInButton", "showZoomOutButton", "uploadButtonConfig", "notShowPreviewButton", "removeHandler", "listType", "deleteModalConfig"];
|
|
22
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
23
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
|
|
24
|
+
/* eslint-disable */
|
|
22
25
|
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
26
|
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
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -44,18 +47,18 @@ const getBase64 = file => new Promise((resolve, reject) => {
|
|
|
44
47
|
* @returns {undefined}
|
|
45
48
|
*/
|
|
46
49
|
const downloadFile = (base64String, fileName) => {
|
|
47
|
-
const link = document.createElement(
|
|
50
|
+
const link = document.createElement("a");
|
|
48
51
|
link.href = base64String;
|
|
49
|
-
link.download = fileName ||
|
|
52
|
+
link.download = fileName || "download";
|
|
50
53
|
link.click();
|
|
51
54
|
};
|
|
52
55
|
function isImageFile(fileName) {
|
|
53
56
|
var _fileName$split;
|
|
54
57
|
// Extract the file extension from the file name
|
|
55
|
-
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split(
|
|
58
|
+
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split(".")) === null || _fileName$split === void 0 || (_fileName$split = _fileName$split.pop()) === null || _fileName$split === void 0 ? void 0 : _fileName$split.toLowerCase();
|
|
56
59
|
|
|
57
60
|
// Define an array of image file extensions
|
|
58
|
-
const imageFileExtensions = [
|
|
61
|
+
const imageFileExtensions = ["jpg", "jpeg", "png"];
|
|
59
62
|
|
|
60
63
|
// Check if the file extension is in the array of image file extensions
|
|
61
64
|
if (imageFileExtensions.indexOf(fileExtension) !== -1) {
|
|
@@ -94,24 +97,35 @@ function DocumentUpload(_ref) {
|
|
|
94
97
|
deleteHandler,
|
|
95
98
|
showRoateButton,
|
|
96
99
|
showZoomInButton,
|
|
97
|
-
showZoomOutButton
|
|
100
|
+
showZoomOutButton,
|
|
101
|
+
uploadButtonConfig,
|
|
102
|
+
notShowPreviewButton,
|
|
103
|
+
removeHandler = () => {},
|
|
104
|
+
listType,
|
|
105
|
+
deleteModalConfig
|
|
98
106
|
} = _ref,
|
|
99
107
|
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
100
108
|
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
101
109
|
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
102
|
-
const [previewTitle, setPreviewTitle] = (0, _react.useState)(
|
|
110
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)("");
|
|
103
111
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
104
112
|
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
105
113
|
const [deleteConfirmation, setDeleteConfirmation] = (0, _react.useState)(false);
|
|
106
114
|
const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
|
|
107
115
|
const [selectedDocumentData, setSelectedDocumentData] = (0, _react.useState)({});
|
|
116
|
+
const [isError, setIsError] = (0, _react.useState)(false);
|
|
117
|
+
const uploadRef = _react.default.useRef(null);
|
|
108
118
|
(0, _react.useEffect)(() => {
|
|
109
119
|
setFileList(uploadedDocuments);
|
|
110
120
|
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
111
121
|
const handlePreview = async file => {
|
|
122
|
+
// Don't show preview if notShowPreviewButton is true
|
|
123
|
+
if (notShowPreviewButton) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
112
126
|
if (file !== null && file !== void 0 && file.originFileObj) {
|
|
113
127
|
setPreviewImage(file);
|
|
114
|
-
} else if ((file === null || file === void 0 ? void 0 : file.fileType) ===
|
|
128
|
+
} else if ((file === null || file === void 0 ? void 0 : file.fileType) === "thumbnail") {
|
|
115
129
|
const url = await getPreview();
|
|
116
130
|
setPreviewImage(url);
|
|
117
131
|
} else {
|
|
@@ -126,16 +140,32 @@ function DocumentUpload(_ref) {
|
|
|
126
140
|
fileList: newFileList,
|
|
127
141
|
file
|
|
128
142
|
} = _ref2;
|
|
143
|
+
if (antDesignProps !== null && antDesignProps !== void 0 && antDesignProps.customRequest) {
|
|
144
|
+
const isError = newFileList.some(f => (f === null || f === void 0 ? void 0 : f.status) === "error");
|
|
145
|
+
if (isError) {
|
|
146
|
+
setFileList([]);
|
|
147
|
+
setIsError(true);
|
|
148
|
+
setLoading(false);
|
|
149
|
+
return;
|
|
150
|
+
} else {
|
|
151
|
+
setIsError(false);
|
|
152
|
+
}
|
|
153
|
+
setFileList(newFileList);
|
|
154
|
+
const isUploading = newFileList.some(f => f.status === "uploading");
|
|
155
|
+
setLoading(isUploading);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Default behavior for non-custom uploads
|
|
129
160
|
const modifiedList = await Promise.all(newFileList.map(async files => {
|
|
130
161
|
let modifiedFile = files;
|
|
131
162
|
setLoading(true);
|
|
132
163
|
try {
|
|
133
164
|
if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
|
|
134
165
|
await handleCustomOnChange(files);
|
|
135
|
-
modifiedFile.status =
|
|
166
|
+
modifiedFile.status = "done";
|
|
136
167
|
if (!isImageFile(file === null || file === void 0 ? void 0 : file.name)) {
|
|
137
168
|
modifiedFile.url = _PdfSampleImage.default;
|
|
138
|
-
// delete modifiedFile?.type;
|
|
139
169
|
}
|
|
140
170
|
}
|
|
141
171
|
} catch (error) {
|
|
@@ -147,48 +177,93 @@ function DocumentUpload(_ref) {
|
|
|
147
177
|
const tempList = modifiedList === null || modifiedList === void 0 ? void 0 : modifiedList.filter(Boolean);
|
|
148
178
|
setFileList(tempList);
|
|
149
179
|
};
|
|
180
|
+
const getUploadButtonIcon = () => {
|
|
181
|
+
if ((uploadButtonConfig === null || uploadButtonConfig === void 0 ? void 0 : uploadButtonConfig.icon) === "PlusOutlined") {
|
|
182
|
+
return /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null);
|
|
183
|
+
}
|
|
184
|
+
return /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null);
|
|
185
|
+
};
|
|
150
186
|
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
151
187
|
style: {
|
|
152
188
|
border: 0,
|
|
153
|
-
background:
|
|
189
|
+
background: "none"
|
|
154
190
|
},
|
|
155
191
|
type: "button"
|
|
156
|
-
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) :
|
|
157
|
-
/*#__PURE__*/
|
|
158
|
-
// <CustomIcon
|
|
159
|
-
// className="UploadImg"
|
|
160
|
-
// alt="phone img"
|
|
161
|
-
// src={offerImg}
|
|
162
|
-
// />
|
|
163
|
-
_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
192
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) : getUploadButtonIcon(), /*#__PURE__*/_react.default.createElement("div", null, uploadButtonConfig !== null && uploadButtonConfig !== void 0 && uploadButtonConfig.text ? uploadButtonConfig === null || uploadButtonConfig === void 0 ? void 0 : uploadButtonConfig.text : "Upload"));
|
|
164
193
|
const DeleteFile = async () => {
|
|
165
|
-
await deleteHandler(selectedFile
|
|
194
|
+
await deleteHandler(selectedFile, isEmptyFileList => {
|
|
195
|
+
if (isEmptyFileList) {
|
|
196
|
+
setFileList([]);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
166
199
|
setDeleteConfirmation(false);
|
|
167
200
|
if (showDeleteButton) {
|
|
168
201
|
setPreviewOpen(false);
|
|
169
202
|
}
|
|
170
203
|
};
|
|
171
204
|
const handleRemove = file => new Promise((resolve, reject) => {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
205
|
+
// If file is uploading, cancel immediately without confirmation
|
|
206
|
+
if ((file === null || file === void 0 ? void 0 : file.status) === "uploading") {
|
|
207
|
+
// Remove file from list immediately to cancel upload
|
|
208
|
+
const newFileList = fileList.filter(f => f.uid !== file.uid);
|
|
209
|
+
setFileList(newFileList);
|
|
210
|
+
resolve(true); // Allow removal
|
|
211
|
+
if (removeHandler) removeHandler(file);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// If file is done or error, show confirmation modal
|
|
216
|
+
if ((file === null || file === void 0 ? void 0 : file.status) === "done" || (file === null || file === void 0 ? void 0 : file.status) === "error") {
|
|
217
|
+
setSelectedFile(file);
|
|
218
|
+
setDeleteConfirmation(true);
|
|
219
|
+
resolve(false); // Prevent removal until confirmed
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Default: allow removal
|
|
224
|
+
resolve(true);
|
|
175
225
|
});
|
|
176
226
|
const handleModalDeleteButton = file => {
|
|
177
227
|
setSelectedFile(file);
|
|
178
228
|
setDeleteConfirmation(true);
|
|
179
229
|
};
|
|
230
|
+
|
|
231
|
+
// Get the appropriate remove icon based on file status
|
|
232
|
+
const getRemoveIcon = file => {
|
|
233
|
+
// Show cross icon during upload (to cancel)
|
|
234
|
+
if ((file === null || file === void 0 ? void 0 : file.status) === "uploading") {
|
|
235
|
+
return /*#__PURE__*/_react.default.createElement(_icons.CloseOutlined, null);
|
|
236
|
+
}
|
|
237
|
+
// Show delete icon after upload is done or if upload failed
|
|
238
|
+
if ((file === null || file === void 0 ? void 0 : file.status) === "done" || (file === null || file === void 0 ? void 0 : file.status) === "error") {
|
|
239
|
+
return /*#__PURE__*/_react.default.createElement(_icons.DeleteOutlined, null);
|
|
240
|
+
}
|
|
241
|
+
// Default to delete icon
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_icons.DeleteOutlined, null);
|
|
243
|
+
};
|
|
180
244
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.MainStyleSec, null, /*#__PURE__*/_react.default.createElement(_styles.StyledSection, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
181
|
-
|
|
245
|
+
onClick: listType === "picture" ? () => {
|
|
246
|
+
var _inst$upload, _inst$nativeElement, _inst$nativeElement$q, _inst$querySelector, _input$click;
|
|
247
|
+
if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) >= noOfUpload) return;
|
|
248
|
+
const inst = uploadRef.current;
|
|
249
|
+
if (inst !== null && inst !== void 0 && inst.onClick) {
|
|
250
|
+
inst.onClick();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const input = (inst === null || inst === void 0 || (_inst$upload = inst.upload) === null || _inst$upload === void 0 ? void 0 : _inst$upload.input) || (inst === null || inst === void 0 ? void 0 : inst.fileInput) || (inst === null || inst === void 0 || (_inst$nativeElement = inst.nativeElement) === null || _inst$nativeElement === void 0 || (_inst$nativeElement$q = _inst$nativeElement.querySelector) === null || _inst$nativeElement$q === void 0 ? void 0 : _inst$nativeElement$q.call(_inst$nativeElement, 'input[type="file"]')) || (inst === null || inst === void 0 || (_inst$querySelector = inst.querySelector) === null || _inst$querySelector === void 0 ? void 0 : _inst$querySelector.call(inst, 'input[type="file"]'));
|
|
254
|
+
input === null || input === void 0 || (_input$click = input.click) === null || _input$click === void 0 || _input$click.call(input);
|
|
255
|
+
} : null,
|
|
256
|
+
className: listType === "picture" ? "uploadSecPad ".concat(isError && "errorBorder") : "uploadDiv"
|
|
182
257
|
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
183
258
|
theme: {
|
|
184
259
|
token: {
|
|
185
|
-
colorBorder: _ColorVariablesMap.default[
|
|
260
|
+
colorBorder: _ColorVariablesMap.default["--color-divider"],
|
|
186
261
|
borderRadiusLG: 4,
|
|
187
|
-
colorPrimaryHover: _ColorVariablesMap.default[
|
|
188
|
-
colorPrimaryBorder: _ColorVariablesMap.default[
|
|
189
|
-
colorFillAlter: _ColorVariablesMap.default[
|
|
190
|
-
colorError: _ColorVariablesMap.default[
|
|
191
|
-
colorText: _ColorVariablesMap.default[
|
|
262
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
263
|
+
colorPrimaryBorder: _ColorVariablesMap.default["--color-divider"],
|
|
264
|
+
colorFillAlter: _ColorVariablesMap.default["--color-secondary-background"],
|
|
265
|
+
colorError: _ColorVariablesMap.default["--color-negative"],
|
|
266
|
+
colorText: _ColorVariablesMap.default["--color-secondary-content"]
|
|
192
267
|
}
|
|
193
268
|
}
|
|
194
269
|
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
@@ -196,24 +271,30 @@ function DocumentUpload(_ref) {
|
|
|
196
271
|
rules: [{
|
|
197
272
|
validator: (rule, value) => {
|
|
198
273
|
if (isMandatory && !(value !== null && value !== void 0 && value.length)) {
|
|
199
|
-
|
|
274
|
+
if (typeof value === "object" && Object.keys(value).length > 0) {
|
|
275
|
+
return Promise.resolve();
|
|
276
|
+
}
|
|
277
|
+
return Promise.reject(new Error("Please upload the document."));
|
|
200
278
|
}
|
|
201
279
|
return Promise.resolve();
|
|
202
280
|
}
|
|
203
281
|
}]
|
|
204
282
|
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, _extends({
|
|
205
|
-
|
|
206
|
-
|
|
283
|
+
onClick: e => e.stopPropagation(),
|
|
284
|
+
ref: uploadRef,
|
|
285
|
+
listType: listType ? listType : "picture-card",
|
|
207
286
|
fileList: fileList,
|
|
208
|
-
onPreview: handlePreview,
|
|
287
|
+
onPreview: notShowPreviewButton ? undefined : handlePreview,
|
|
209
288
|
onChange: handleChange,
|
|
210
289
|
onRemove: handleRemove,
|
|
211
290
|
showUploadList: {
|
|
212
291
|
showDownloadIcon: false,
|
|
213
|
-
showRemoveIcon: showDelete,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
292
|
+
showRemoveIcon: showDelete !== undefined ? showDelete : true,
|
|
293
|
+
showPreviewIcon: !notShowPreviewButton,
|
|
294
|
+
removeIcon: file => getRemoveIcon(file),
|
|
295
|
+
previewIcon: notShowPreviewButton ? false : /*#__PURE__*/_react.default.createElement(_icons.EyeFilled, null)
|
|
296
|
+
},
|
|
297
|
+
maxCount: noOfUpload
|
|
217
298
|
}, antDesignProps), (fileList === null || fileList === void 0 ? void 0 : fileList.length) >= noOfUpload ? null : uploadButton)))))), previewOpen && /*#__PURE__*/_react.default.createElement(_CustomViewer.default, {
|
|
218
299
|
open: previewOpen,
|
|
219
300
|
previewFile: previewImage,
|
|
@@ -230,15 +311,17 @@ function DocumentUpload(_ref) {
|
|
|
230
311
|
}), deleteConfirmation && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
231
312
|
buttonConfig: [{
|
|
232
313
|
callback: () => DeleteFile(),
|
|
233
|
-
label:
|
|
234
|
-
type:
|
|
314
|
+
label: "Yes, Delete",
|
|
315
|
+
type: "danger-primary"
|
|
235
316
|
}],
|
|
236
|
-
imgSrc: _handIcon.default,
|
|
317
|
+
imgSrc: deleteModalConfig !== null && deleteModalConfig !== void 0 && deleteModalConfig.deleteImage ? deleteModalConfig.deleteImage : _handIcon.default,
|
|
237
318
|
open: deleteConfirmation,
|
|
238
|
-
onCancel: () =>
|
|
239
|
-
|
|
319
|
+
onCancel: () => {
|
|
320
|
+
setDeleteConfirmation(false);
|
|
321
|
+
},
|
|
322
|
+
title: deleteModalConfig !== null && deleteModalConfig !== void 0 && deleteModalConfig.title ? deleteModalConfig.title : "Delete Item?",
|
|
240
323
|
className: "delete-modal-confirmation"
|
|
241
|
-
}, "This action will permanently delete the selected item"));
|
|
324
|
+
}, deleteModalConfig !== null && deleteModalConfig !== void 0 && deleteModalConfig.body ? deleteModalConfig.body : "This action will permanently delete the selected item"));
|
|
242
325
|
}
|
|
243
326
|
DocumentUpload.propTypes = {
|
|
244
327
|
uploadedDocuments: _propTypes.default.array,
|
|
@@ -259,12 +342,15 @@ DocumentUpload.propTypes = {
|
|
|
259
342
|
showDeleteButton: _propTypes.default.bool,
|
|
260
343
|
showRoateButton: _propTypes.default.bool,
|
|
261
344
|
showZoomInButton: _propTypes.default.bool,
|
|
262
|
-
showZoomOutButton: _propTypes.default.bool
|
|
345
|
+
showZoomOutButton: _propTypes.default.bool,
|
|
346
|
+
uploadButtonConfig: _propTypes.default.object,
|
|
347
|
+
// Config for upload button text
|
|
348
|
+
notShowPreviewButton: _propTypes.default.bool // Hide preview button
|
|
263
349
|
};
|
|
264
350
|
DocumentUpload.defaultProps = {
|
|
265
351
|
uploadedDocuments: [],
|
|
266
352
|
handleCustomOnChange: () => {},
|
|
267
|
-
formName:
|
|
353
|
+
formName: "",
|
|
268
354
|
multipleDoc: 0,
|
|
269
355
|
showDelete: true,
|
|
270
356
|
getPreview: () => {},
|
|
@@ -277,6 +363,8 @@ DocumentUpload.defaultProps = {
|
|
|
277
363
|
showDownloadButton: true,
|
|
278
364
|
showRoateButton: true,
|
|
279
365
|
showZoomInButton: true,
|
|
280
|
-
showZoomOutButton: true
|
|
366
|
+
showZoomOutButton: true,
|
|
367
|
+
uploadButtonConfig: null,
|
|
368
|
+
notShowPreviewButton: false
|
|
281
369
|
};
|
|
282
370
|
var _default = exports.default = DocumentUpload;
|
|
@@ -9,5 +9,5 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
9
9
|
var _templateObject, _templateObject2;
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
-
const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-upload-list{\n
|
|
13
|
-
const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2{\n margin: 0;\n }\n \n @media only screen and (max-width: 600px) {\n
|
|
12
|
+
const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-upload-list {\n display: flex !important;\n gap: 16px !important;\n flex-wrap: wrap !important;\n }\n .ant-upload-wrapper .ant-upload-list::before {\n display: none;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload.ant-upload-select,\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item-container {\n width: 96px;\n height: 96px;\n margin-block: 0;\n margin-inline: 0;\n }\n .ant-upload-select button > span.UploadImg {\n width: 24px !important;\n height: 24px;\n }\n .ant-upload-select button > span.UploadImg > img {\n width: 100% !important;\n }\n .ant-upload-list-item-container:last-child {\n margin: 0 !important;\n }\n .ant-form-item {\n margin-bottom: 0;\n }\n .ant-upload button {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n }\n\n .uploadSecPad div {\n padding: 0 0 8px;\n }\n .anticon-upload {\n font-size: 24px;\n }\n .ant-upload-disabled .button {\n cursor: not-allowed;\n }\n .uploadSecPad {\n width: 100%;\n }\n .uploadSecPad div:last-child {\n padding: 0;\n }\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,\n .ant-upload-list-item-A {\n border: 1px solid var(--color-divider) !important;\n }\n\n .ant-upload-list-item-actions {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n\n .ant-upload-list-item-actions button {\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n }\n .ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover {\n background: #212121;\n }\n .ant-upload-list-item-actions a {\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n\n .ant-upload-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item {\n opacity: 1 !important;\n }\n\n @media only screen and (max-width: 600px) {\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item-container,\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload.ant-upload-select {\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item::before,\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item-actions,\n .ant-upload-wrapper\n .ant-upload-list\n .ant-upload-list-item\n .ant-upload-list-item-actions\n .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n align-items: center;\n justify-content: center;\n width: 16px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item-actions\n .anticon-eye,\n .ant-upload-wrapper.ant-upload-picture-card-wrapper\n .ant-upload-list.ant-upload-list-picture-card\n .ant-upload-list-item-actions\n .anticon-delete {\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0px !important;\n padding: 0px !important;\n color: #fff;\n }\n }\n"])));
|
|
13
|
+
const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .errorBorder {\n border: 1px dashed #de350b !important;\n }\n\n .uploadSecPad .ant-upload-list-picture {\n padding: 0 !important;\n gap: 0 !important;\n }\n\n .uploadSecPad\n .ant-upload-wrapper\n .ant-upload-list.ant-upload-list-picture\n .ant-upload-list-item\n .ant-upload-list-item-progress {\n bottom: -2px;\n width: calc(100% - 24px);\n margin-top: 0;\n padding-inline-start: 34px;\n }\n\n .uploadSecPad .ant-upload-list-item-thumbnail {\n line-height: normal !important;\n width: 24px !important;\n height: 24px !important;\n padding: 0;\n }\n\n .uploadSecPad .ant-upload-list-item-thumbnail .anticon-file,\n .uploadSecPad .ant-upload-list-item-thumbnail .anticon-loading {\n font-size: 24px !important;\n color: #014fc5 !important;\n }\n\n .uploadSecPad .ant-upload-list-picture .ant-upload-list-item-done {\n border: none !important;\n margin: 0;\n padding: 0;\n height: auto;\n }\n\n .uploadSecPad .ant-upload-list-item-actions button,\n .uploadSecPad .ant-upload-list-item-actions button:hover {\n background: transparent !important;\n }\n\n .uploadSecPad .ant-upload-list-item-actions button .anticon-delete svg {\n color: #de350b;\n font-size: 18px;\n }\n\n .uploadSecPad\n .ant-upload-wrapper\n .ant-upload-list.ant-upload-list-picture\n .ant-upload-list-item-uploading\n .ant-upload-list-item-name {\n color: #014fc5;\n }\n .uploadSecPad {\n width: 100%;\n border-radius: 4px;\n border: 1px dashed #014fc5;\n background: #f6f6f6;\n padding: 24px 16px;\n cursor: pointer;\n }\n\n .uploadSecPad .ant-upload-list-item-container {\n width: 100%;\n }\n\n .uploadSecPad button {\n display: flex;\n flex-direction: row;\n gap: 8px;\n padding: 0;\n margin: 0;\n color: #014fc5;\n cursor: pointer;\n }\n .uploadSecPad .ant-form-item-control-input {\n min-height: auto;\n }\n .uploadSecPad .ant-upload-select {\n padding: 0px;\n }\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2 {\n margin: 0;\n }\n\n .uploadSecPad\n .ant-upload-wrapper\n .ant-upload-list.ant-upload-list-picture\n .ant-upload-list-item {\n height: auto;\n padding: 0;\n border: none;\n border-radius: 0;\n border-style: none !important;\n margin: 0;\n }\n\n @media only screen and (max-width: 600px) {\n .ant-upload-list-item-actions button {\n height: 16px !important;\n width: 16px !important;\n justify-content: center;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n width: 16px !important;\n align-items: center;\n justify-content: center;\n }\n .ant-upload-list-item-actions {\n gap: 8px;\n }\n .ant-upload button span + div {\n display: none;\n }\n }\n"])));
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
require("core-js/modules/es.array.includes.js");
|
|
11
|
+
require("core-js/modules/es.string.includes.js");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _styles = require("./styles.js");
|
|
14
|
+
var _CustomCheckBox = _interopRequireDefault(require("../../components/oa-component-checkbox/CustomCheckBox"));
|
|
15
|
+
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
16
|
+
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
17
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
18
|
+
var _CustomDocumentViewer = _interopRequireDefault(require("../oa-component-document-viewer/CustomDocumentViewer"));
|
|
19
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
20
|
+
var _reactPdf = require("react-pdf");
|
|
21
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
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); } /* eslint-disable */
|
|
26
|
+
_reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_reactPdf.pdfjs.version, "/pdf.worker.min.js");
|
|
27
|
+
function DocumentSideModal(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
headerIcon,
|
|
30
|
+
headerText,
|
|
31
|
+
infoIcon,
|
|
32
|
+
infoText,
|
|
33
|
+
onClose,
|
|
34
|
+
customDocumentViewerProps,
|
|
35
|
+
initialSelectedPages,
|
|
36
|
+
initialSlide,
|
|
37
|
+
updateSelectedPages,
|
|
38
|
+
maxPages
|
|
39
|
+
} = _ref;
|
|
40
|
+
const [carouselPageNumber, setcarouselPageNumber] = (0, _react.useState)(initialSlide !== null && initialSlide !== void 0 ? initialSlide : 0);
|
|
41
|
+
const [selectedPages, setSelectedPages] = (0, _react.useState)([]); //selected page
|
|
42
|
+
|
|
43
|
+
(0, _react.useEffect)(() => {
|
|
44
|
+
if (initialSelectedPages) {
|
|
45
|
+
setSelectedPages(initialSelectedPages);
|
|
46
|
+
}
|
|
47
|
+
}, [initialSelectedPages]);
|
|
48
|
+
(0, _react.useEffect)(() => {
|
|
49
|
+
document.body.style.overflow = "hidden";
|
|
50
|
+
return () => {
|
|
51
|
+
document.body.style.overflow = "";
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
const pageRefs = (0, _react.useRef)([]);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Handles the checkbox change event.
|
|
58
|
+
* @param {boolean} checked if the checkbox is checked or not.
|
|
59
|
+
* The function will add or remove the current page number from the selectedPages state
|
|
60
|
+
* depending on the checked status. If the checkbox is checked and the selectedPages state
|
|
61
|
+
* length is less than maxPages (default 2), it will add the current page number to the selectedPages state.
|
|
62
|
+
* If the checkbox is unchecked, it will remove the current page number from the selectedPages state.
|
|
63
|
+
*/
|
|
64
|
+
const handleCheckboxChange = checked => {
|
|
65
|
+
setSelectedPages(prevSelectedPages => {
|
|
66
|
+
if (checked) {
|
|
67
|
+
if (!prevSelectedPages.includes(carouselPageNumber) && prevSelectedPages.length < maxPages) {
|
|
68
|
+
return [...prevSelectedPages, carouselPageNumber];
|
|
69
|
+
}
|
|
70
|
+
return prevSelectedPages;
|
|
71
|
+
} else {
|
|
72
|
+
return prevSelectedPages.filter(page => page !== carouselPageNumber);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Updates the current carousel page number.
|
|
79
|
+
*
|
|
80
|
+
* @param {number} value - The new page number to set for the carousel.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
const setcarouselPageNumberHandler = value => {
|
|
84
|
+
setcarouselPageNumber(value);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Deletes the page from selectedPages state.
|
|
89
|
+
* @param {number} pageNumber - The page number to delete from the selectedPages state.
|
|
90
|
+
*/
|
|
91
|
+
const deleteSelectedPage = pageNumber => {
|
|
92
|
+
setSelectedPages(prevSelected => {
|
|
93
|
+
return prevSelected === null || prevSelected === void 0 ? void 0 : prevSelected.filter(item => item !== pageNumber);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const isPageSelected = (0, _react.useMemo)(() => selectedPages === null || selectedPages === void 0 ? void 0 : selectedPages.includes(carouselPageNumber), [selectedPages, carouselPageNumber]);
|
|
97
|
+
const disableCheckbox = (0, _react.useMemo)(() => !isPageSelected && selectedPages.length >= maxPages, [isPageSelected, selectedPages]);
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_styles.Wrapper, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: "deviceName"
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
101
|
+
className: "type-t2-700",
|
|
102
|
+
color: "primary-background"
|
|
103
|
+
}, headerText), /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
style: {
|
|
105
|
+
cursor: "pointer"
|
|
106
|
+
}
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
108
|
+
icon: _Close.default,
|
|
109
|
+
size: 20,
|
|
110
|
+
onClick: onClose
|
|
111
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "previewSec"
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomDocumentViewer.default, _extends({}, customDocumentViewerProps, {
|
|
114
|
+
setcarouselPageNumberHandler: setcarouselPageNumberHandler,
|
|
115
|
+
initialSlide: initialSlide,
|
|
116
|
+
selectedPages: selectedPages,
|
|
117
|
+
isFooterVisible: selectedPages.length > 0 // <-- new prop
|
|
118
|
+
,
|
|
119
|
+
carouselPageNumber: carouselPageNumber,
|
|
120
|
+
deleteSelectedPage: deleteSelectedPage
|
|
121
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
+
className: "footerSec"
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "containerWidth"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
|
|
126
|
+
label: "Select Page ".concat(carouselPageNumber + 1),
|
|
127
|
+
checked: isPageSelected,
|
|
128
|
+
disabled: disableCheckbox,
|
|
129
|
+
onChange: e => handleCheckboxChange(e.target.checked)
|
|
130
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: "padding-top-4"
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
133
|
+
className: "type-b3-400",
|
|
134
|
+
color: disableCheckbox ? "warning" : "secondary-content"
|
|
135
|
+
}, "(Maximum ".concat(maxPages, " pages can be selected)")))), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
136
|
+
label: selectedPages.length === 0 ? "Selected" : "".concat(selectedPages.length, " ").concat(selectedPages.length > 1 ? "" : "", " Selected"),
|
|
137
|
+
disabled: selectedPages.length === 0,
|
|
138
|
+
onClick: () => updateSelectedPages(selectedPages)
|
|
139
|
+
}))));
|
|
140
|
+
}
|
|
141
|
+
DocumentSideModal.propTypes = {
|
|
142
|
+
headerText: _propTypes.default.string,
|
|
143
|
+
initialSlide: _propTypes.default.number,
|
|
144
|
+
initialSelectedPages: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
145
|
+
headerIcon: _propTypes.default.elementType,
|
|
146
|
+
// assuming it's a component like an Icon
|
|
147
|
+
infoIcon: _propTypes.default.elementType,
|
|
148
|
+
infoText: _propTypes.default.string,
|
|
149
|
+
onClose: _propTypes.default.func.isRequired,
|
|
150
|
+
customDocumentViewerProps: _propTypes.default.object,
|
|
151
|
+
updateSelectedPages: _propTypes.default.func.isRequired,
|
|
152
|
+
maxPages: _propTypes.default.number
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// ✅ Default Props
|
|
156
|
+
DocumentSideModal.defaultProps = {
|
|
157
|
+
headerText: "",
|
|
158
|
+
initialSelectedPages: [],
|
|
159
|
+
initialSlide: 0,
|
|
160
|
+
headerIcon: null,
|
|
161
|
+
infoIcon: null,
|
|
162
|
+
infoText: "",
|
|
163
|
+
customDocumentViewerProps: {},
|
|
164
|
+
maxPages: 2
|
|
165
|
+
};
|
|
166
|
+
var _default = exports.default = DocumentSideModal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Wrapper = 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 Wrapper = exports.Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.previewSec > div,.previewSec > div > div,.react-pdf__Document .ant-carousel,.slick-list,.slick-track,.slick-slide,.slick-slide > div,.slick-slide > div > div{\nheight: 100%;\n}\n.react-pdf__Document{\nheight: 100% !important;\noverflow: hidden !important;\nposition: relative;\n}\n.imgViewer .react-pdf__Page canvas{\n height: 100% !important;\n width: 100% !important;\n}\n.slick-slider{\n height: 100%;\n}\n display: flex;\n flex-direction: column;\n height: 100dvh;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1000;\n background: rgba(0, 0, 0, 0.70);\n @media screen and (-webkit-min-device-pixel-ratio: 0) {\n @supports (-webkit-overflow-scrolling: touch) {\n height: auto;\n}\n}\n@media only screen and (max-width: 600px) {\n height: auto;\n}\n \n .react-pdf__Page{\n display: flex !important;\n justify-content: center;\n \n align-items: top;\n\n }\n .carouselFooter{\n height: 88px !important;\n width: 100%;\n color: #fff;\n position: fixed;\n bottom: 72px;\n display: flex;\n align-items: center;\n background: rgba(0, 0, 0, 0.70);\n box-shadow: 0px -4px 12px 0px rgba(0, 0, 0, 0.14);\n \n }\n .footerContainer{\n max-width: 768px;\n margin: 0 auto;\n display: flex;\n gap: 20px;\n width: 100%;\n }\n .imgViewer{\n position: relative;\n width: 56px;\n height: 56px;\n border: 1px solid var(--color-primary-background);\n border-radius: 8px;\n }\n // .imgViewer .react-pdf__Page canvas{\n // position: absolute;\n // top: 0;\n // width: 100%;\n // }\n .imgViewer .react-pdf__Document{\n position: absolute;\n top: 0;\n width: 100%;\n border-radius: 8px;\n }\n .imgViewer svg{\n position: absolute;\n right: -9px;\n color: #fff;\n top: -9px;\n z-index: 9;\n background: var(--color-primary);\n border-radius: 50%;\n cursor: pointer;\n font-weight: bolder;\n padding: 2px;\n }\n .slick-prev, .slick-next{\n display: flex !important;\n }\n .ant-carousel .slick-prev::after, .ant-carousel .slick-next::after {\n display: none;\n }\n .ant-carousel .slick-next:hover,.slick-prev:hover{\n color: #fff;\n background: #212121;\n }\n .ant-carousel .slick-next::before ,.ant-carousel .slick-prev::before {display: none;}\n .slick-slide > div > div{\n display: flex !important;\n flex-direction: column-reverse;\n justify-content: center;\n align-items: center;\n padding: 0px 0 0;\n }\n .slick-disabled{\n display: none !important;\n }\n // .react-transform-component{\n // height: calc(100vh - 178px) !important;\n // }\n \n .react-pdf__Page canvas{\n width: max-content !important;\n height: calc(100dvh - 72px - 48px) !important;\n }\n .react-transform-wrapper{\n overflow-y: hidden !important;\n padding: 0 !important;\n height: 100% !important;\n }\n // .react-pdf__Page__textContent{\n // height: 80% !important;\n // width: auto !important;\n // }\n .deviceName{\n height: 48px;\n background: #212121;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .deviceName svg{\n position: absolute;\n right: 24px;\n top: 16px;\n color: #FFF;\n }\n .infoSec{\n background: var(--color-background-warning);\n height: 48px;\n color:#212121;\n align-items: center;\n justify-content: center;\n \n }\n .containerWidth{\n max-width: 768px;\n margin: 0 auto;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 0 !important;\n }\n .containerWidth div{\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .previewSec{\n flex: 1;\n overflow: hidden;\n }\n .withFooter{\n margin: 0 0 84px !important;\n }\n .customDocumentViewerOverlay{\n display: flex;\n flex-direction: column-reverse;\n height: calc(100vh - 180px);\n width: 100%;\n align-items: anchor-center;\n }\n .pageNumber{\n white-space: nowrap;\n }\n .customDocumentViewerOverlayHeader{\n position: fixed !important;\n bottom: 82px !important;\n }\n .controlsWithFooter .customDocumentViewerOverlayHeader{\n bottom: 170px !important;\n }\n .footerSec{\n background: var(--color-primary-background);\n height: 72px;\n }\n .footerSec .containerWidth{\n height: 72px;\n }\n .footerSec .containerWidth div{\n flex-direction: column;\n align-items: flex-start;\n gap: 0;\n }\n\n @media only screen and (max-width: 600px) {\n \n .deviceName {\n justify-content: start;\n padding: 0 16px;\n}\n .footerSec{\n padding: 0 16px;\n }\n .carouselFooter{\n display: flex;\n height: 72px;\n justify-content: flex-start;\n align-items: center;\n}\n .footerContainer{\n padding: 0 16px;\n width: 100%;\n }\n .infoSec{\n padding: 0 16px;\n }\n}\n"])));
|
|
12
|
+
var _default = exports.default = Wrapper;
|