oa-componentbook 1.0.1-stage.42 → 1.0.1-stage.421
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 +123 -43
- 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-modal/CustomModal.js +55 -47
- 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 +611 -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/{TextArea.js → CustomTextArea.js} +4 -4
- package/build/components/oa-component-tooltip/CustomTooltip.js +8 -4
- package/build/components/oa-component-upload/CustomUpload.js +120 -40
- package/build/components/oa-component-viewer/CustomViewer.js +3 -1
- 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 +117 -46
- 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 +114 -2
- 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 +2386 -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 +256 -0
- package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
- 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-list/fn.js +16 -4
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +352 -0
- package/build/widgets/oa-widget-user-management/styles.js +15 -0
- package/package.json +4 -2
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.object.assign.js");
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
10
11
|
var _styles = require("./styles");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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 */
|
|
12
14
|
/**
|
|
13
15
|
* A simple tag component that displays a label.
|
|
14
16
|
*
|
|
@@ -21,28 +23,44 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
23
|
*/
|
|
22
24
|
function CustomTag(_ref) {
|
|
23
25
|
let {
|
|
24
|
-
|
|
26
|
+
"data-test": dataTest,
|
|
25
27
|
label,
|
|
26
28
|
type,
|
|
27
|
-
visible
|
|
29
|
+
visible,
|
|
30
|
+
bgColor,
|
|
31
|
+
borderColor,
|
|
32
|
+
textColor,
|
|
33
|
+
style
|
|
28
34
|
} = _ref;
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_styles.StyledTag, {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledTag, _extends({
|
|
30
36
|
"data-test": dataTest,
|
|
31
37
|
type: type,
|
|
32
|
-
visible: visible
|
|
33
|
-
|
|
38
|
+
visible: visible,
|
|
39
|
+
bgColor: bgColor,
|
|
40
|
+
borderColor: borderColor,
|
|
41
|
+
textColor: textColor
|
|
42
|
+
}, style && {
|
|
43
|
+
style
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement(_styles.CenteredTextContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
34
45
|
typography: "type-button-500"
|
|
35
46
|
}, label)));
|
|
36
47
|
}
|
|
37
48
|
CustomTag.propTypes = {
|
|
38
|
-
|
|
49
|
+
"data-test": _propTypes.default.string,
|
|
39
50
|
label: _propTypes.default.string.isRequired,
|
|
40
|
-
type: _propTypes.default.oneOf([
|
|
41
|
-
visible: _propTypes.default.bool
|
|
51
|
+
type: _propTypes.default.oneOf(["success", "pending", "failed", "recommended", "primary", "blue", "custom"]),
|
|
52
|
+
visible: _propTypes.default.bool,
|
|
53
|
+
bgColor: _propTypes.default.string,
|
|
54
|
+
borderColor: _propTypes.default.string,
|
|
55
|
+
textColor: _propTypes.default.string,
|
|
56
|
+
style: _propTypes.default.object
|
|
42
57
|
};
|
|
43
58
|
CustomTag.defaultProps = {
|
|
44
|
-
|
|
45
|
-
type:
|
|
46
|
-
visible: true
|
|
59
|
+
"data-test": null,
|
|
60
|
+
type: "",
|
|
61
|
+
visible: true,
|
|
62
|
+
bgColor: "",
|
|
63
|
+
borderColor: "",
|
|
64
|
+
textColor: ""
|
|
47
65
|
};
|
|
48
66
|
var _default = exports.default = CustomTag;
|
|
@@ -8,7 +8,13 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
8
8
|
var _templateObject, _templateObject2;
|
|
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 getColorStyles =
|
|
11
|
+
const getColorStyles = props => {
|
|
12
|
+
const {
|
|
13
|
+
type,
|
|
14
|
+
bgColor,
|
|
15
|
+
borderColor,
|
|
16
|
+
textColor
|
|
17
|
+
} = props;
|
|
12
18
|
if (type === 'success') {
|
|
13
19
|
return {
|
|
14
20
|
backgroundColor: 'var(--color-background-positive)',
|
|
@@ -16,6 +22,13 @@ const getColorStyles = type => {
|
|
|
16
22
|
textColor: 'var(--color-positive)'
|
|
17
23
|
};
|
|
18
24
|
}
|
|
25
|
+
if (type === 'primary') {
|
|
26
|
+
return {
|
|
27
|
+
backgroundColor: 'var(--color-divider)',
|
|
28
|
+
borderColor: 'var(--color-placeholder-text)',
|
|
29
|
+
textColor: 'var(--color-primary-content)'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
19
32
|
if (type === 'pending') {
|
|
20
33
|
return {
|
|
21
34
|
backgroundColor: 'var(--color-background-warning)',
|
|
@@ -37,6 +50,20 @@ const getColorStyles = type => {
|
|
|
37
50
|
textColor: 'var(--color-negative)'
|
|
38
51
|
};
|
|
39
52
|
}
|
|
53
|
+
if (type === 'blue') {
|
|
54
|
+
return {
|
|
55
|
+
backgroundColor: 'var(--color-background-info)',
|
|
56
|
+
borderColor: 'var(--color-primary)',
|
|
57
|
+
textColor: 'var(--color-primary)'
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (type === 'custom') {
|
|
61
|
+
return {
|
|
62
|
+
backgroundColor: bgColor,
|
|
63
|
+
borderColor,
|
|
64
|
+
textColor
|
|
65
|
+
};
|
|
66
|
+
}
|
|
40
67
|
return {
|
|
41
68
|
backgroundColor: '#CCCCCC',
|
|
42
69
|
borderColor: 'var(--color-primary-content)',
|
|
@@ -44,5 +71,5 @@ const getColorStyles = type => {
|
|
|
44
71
|
};
|
|
45
72
|
};
|
|
46
73
|
var _default = exports.default = {};
|
|
47
|
-
const StyledTag = exports.StyledTag = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n padding: 1px 12px;\n
|
|
48
|
-
const CenteredTextContainer = exports.CenteredTextContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n"])));
|
|
74
|
+
const StyledTag = exports.StyledTag = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n padding: 1px 12px;\n\n color: ", ";\n\n background-color: ", ";\n\n border: 1px solid ", ";\n border-radius: 4px;\n\n visibility: ", ";\n"])), props => getColorStyles(props).textColor, props => getColorStyles(props).backgroundColor, props => getColorStyles(props).borderColor, props => props.visible ? 'visible' : 'hidden');
|
|
75
|
+
const CenteredTextContainer = exports.CenteredTextContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex; white-space: nowrap;\n"])));
|
|
@@ -37,7 +37,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
37
37
|
* - `className` (appended to the outer element)
|
|
38
38
|
* - Any other props passed in the `antDesignProps` object
|
|
39
39
|
*/
|
|
40
|
-
function
|
|
40
|
+
function CustomTextArea(_ref) {
|
|
41
41
|
let {
|
|
42
42
|
rows,
|
|
43
43
|
placeholder,
|
|
@@ -59,16 +59,16 @@ function TextArea(_ref) {
|
|
|
59
59
|
className: "custom-textarea ".concat(className)
|
|
60
60
|
}, antDesignProps)));
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
CustomTextArea.propTypes = {
|
|
63
63
|
rows: _propTypes.default.number,
|
|
64
64
|
placeholder: _propTypes.default.string,
|
|
65
65
|
maxLength: _propTypes.default.number,
|
|
66
66
|
className: _propTypes.default.string
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
CustomTextArea.defaultProps = {
|
|
69
69
|
rows: 2,
|
|
70
70
|
placeholder: null,
|
|
71
71
|
maxLength: 5000,
|
|
72
72
|
className: ''
|
|
73
73
|
};
|
|
74
|
-
var _default = exports.default =
|
|
74
|
+
var _default = exports.default = CustomTextArea;
|
|
@@ -10,7 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
var _tooltipPlacementOption = require("../../global-css/tooltip-placement-option");
|
|
12
12
|
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
13
|
-
const _excluded = ["title", "placement", "children", "data-test"];
|
|
13
|
+
const _excluded = ["title", "placement", "children", "mode", "data-test"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
@@ -30,6 +30,7 @@ function CustomTooltip(_ref) {
|
|
|
30
30
|
title,
|
|
31
31
|
placement,
|
|
32
32
|
children,
|
|
33
|
+
mode,
|
|
33
34
|
'data-test': dataTest
|
|
34
35
|
} = _ref,
|
|
35
36
|
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -49,18 +50,21 @@ function CustomTooltip(_ref) {
|
|
|
49
50
|
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, _extends({
|
|
50
51
|
title: title,
|
|
51
52
|
placement: placement,
|
|
52
|
-
"data-test": dataTest
|
|
53
|
+
"data-test": dataTest,
|
|
54
|
+
overlayClassName: mode === 'light' ? 'customLightTooltip' : ''
|
|
53
55
|
}, antDesignProps), children));
|
|
54
56
|
}
|
|
55
57
|
CustomTooltip.propTypes = {
|
|
56
58
|
title: _propTypes.default.node.isRequired,
|
|
57
59
|
placement: _propTypes.default.oneOf(_tooltipPlacementOption.tooltipPlacementOptions),
|
|
58
60
|
children: _propTypes.default.node,
|
|
59
|
-
'data-test': _propTypes.default.string
|
|
61
|
+
'data-test': _propTypes.default.string,
|
|
62
|
+
mode: _propTypes.default.oneOf(['light', 'dark'])
|
|
60
63
|
};
|
|
61
64
|
CustomTooltip.defaultProps = {
|
|
62
65
|
placement: 'top',
|
|
63
66
|
children: null,
|
|
64
|
-
'data-test': null
|
|
67
|
+
'data-test': null,
|
|
68
|
+
mode: 'dark'
|
|
65
69
|
};
|
|
66
70
|
var _default = exports.default = CustomTooltip;
|
|
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
require("core-js/modules/es.promise.js");
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
require("core-js/modules/es.array.includes.js");
|
|
12
|
+
require("core-js/modules/es.string.includes.js");
|
|
11
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
15
|
var _icons = require("@ant-design/icons");
|
|
@@ -25,7 +27,9 @@ var _CustomViewer = _interopRequireDefault(require("../oa-component-viewer/Custo
|
|
|
25
27
|
var _CustomModal = _interopRequireDefault(require("../oa-component-modal/CustomModal"));
|
|
26
28
|
var _handIcon = _interopRequireDefault(require("../../images/hand-icon.svg"));
|
|
27
29
|
var _PdfSampleImage = _interopRequireDefault(require("../../images/PdfSampleImage.png"));
|
|
28
|
-
|
|
30
|
+
var _CustomNotification = _interopRequireDefault(require("../../components/oa-component-notification/CustomNotification"));
|
|
31
|
+
const _excluded = ["uploadedDocuments", "onChange", "multipleDoc", "showDelete", "formName", "getPreview", "isMandatory", "noOfUpload", "downloadCallback", "formRules", "allowLocalDelete", "deleteHandler", "s3ResponseReturn", "form", "beforeUploadFileValidations", "allowedMediaType", "maxAllowedSize", "generateS3Url", "uploadOnS3", "label"];
|
|
32
|
+
/* eslint-disable */
|
|
29
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
34
|
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); }
|
|
31
35
|
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; }
|
|
@@ -51,18 +55,18 @@ const getBase64 = file => new Promise((resolve, reject) => {
|
|
|
51
55
|
* @returns {undefined}
|
|
52
56
|
*/
|
|
53
57
|
const downloadFile = (base64String, fileName) => {
|
|
54
|
-
const link = document.createElement(
|
|
58
|
+
const link = document.createElement("a");
|
|
55
59
|
link.href = base64String;
|
|
56
|
-
link.download = fileName ||
|
|
60
|
+
link.download = fileName || "download";
|
|
57
61
|
link.click();
|
|
58
62
|
};
|
|
59
63
|
function isImageFile(fileName) {
|
|
60
64
|
var _fileName$split;
|
|
61
65
|
// Extract the file extension from the file name
|
|
62
|
-
const fileExtension = fileName === null || fileName === void 0 || (_fileName$split = fileName.split(
|
|
66
|
+
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();
|
|
63
67
|
|
|
64
68
|
// Define an array of image file extensions
|
|
65
|
-
const imageFileExtensions = [
|
|
69
|
+
const imageFileExtensions = ["jpg", "jpeg", "png"];
|
|
66
70
|
|
|
67
71
|
// Check if the file extension is in the array of image file extensions
|
|
68
72
|
if (imageFileExtensions.indexOf(fileExtension) !== -1) {
|
|
@@ -96,24 +100,36 @@ function DocumentUpload(_ref) {
|
|
|
96
100
|
isMandatory,
|
|
97
101
|
noOfUpload,
|
|
98
102
|
downloadCallback,
|
|
99
|
-
|
|
103
|
+
formRules,
|
|
104
|
+
allowLocalDelete,
|
|
105
|
+
deleteHandler,
|
|
106
|
+
s3ResponseReturn = () => {},
|
|
107
|
+
form,
|
|
108
|
+
beforeUploadFileValidations,
|
|
109
|
+
allowedMediaType,
|
|
110
|
+
maxAllowedSize,
|
|
111
|
+
generateS3Url,
|
|
112
|
+
uploadOnS3,
|
|
113
|
+
label
|
|
100
114
|
} = _ref,
|
|
101
115
|
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
102
116
|
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
103
117
|
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
104
|
-
const [previewTitle, setPreviewTitle] = (0, _react.useState)(
|
|
118
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)("");
|
|
105
119
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
106
120
|
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
107
121
|
const [deleteConfirmation, setDeleteConfirmation] = (0, _react.useState)(false);
|
|
108
122
|
const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
|
|
109
123
|
const [selectedDocumentData, setSelectedDocumentData] = (0, _react.useState)({});
|
|
124
|
+
const notificationRef = (0, _react.useRef)(null);
|
|
125
|
+
const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
|
|
110
126
|
(0, _react.useEffect)(() => {
|
|
111
127
|
setFileList(uploadedDocuments);
|
|
112
128
|
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
113
129
|
const handlePreview = async file => {
|
|
114
130
|
if (file !== null && file !== void 0 && file.originFileObj) {
|
|
115
131
|
setPreviewImage(file);
|
|
116
|
-
} else if ((file === null || file === void 0 ? void 0 : file.fileType) ===
|
|
132
|
+
} else if ((file === null || file === void 0 ? void 0 : file.fileType) === "thumbnail") {
|
|
117
133
|
const url = await getPreview();
|
|
118
134
|
setPreviewImage(url);
|
|
119
135
|
} else {
|
|
@@ -123,6 +139,29 @@ function DocumentUpload(_ref) {
|
|
|
123
139
|
setPreviewOpen(true);
|
|
124
140
|
setSelectedDocumentData(file);
|
|
125
141
|
};
|
|
142
|
+
const beforeUpload = (file, allowedMimeTypes, maxSizeMB) => {
|
|
143
|
+
if (allowedMimeTypes && (allowedMediaType === null || allowedMediaType === void 0 ? void 0 : allowedMediaType.length) > 0) {
|
|
144
|
+
const isAllowedType = allowedMimeTypes.includes(file.type);
|
|
145
|
+
if (!isAllowedType) {
|
|
146
|
+
openNotification({
|
|
147
|
+
description: "Only files of type: ".concat(allowedMimeTypes.join(", "), " are allowed!"),
|
|
148
|
+
type: "failure"
|
|
149
|
+
});
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (maxSizeMB) {
|
|
154
|
+
const isUnderSizeLimit = file.size / 1024 / 1024 < maxSizeMB;
|
|
155
|
+
if (!isUnderSizeLimit) {
|
|
156
|
+
openNotification({
|
|
157
|
+
description: "File must be smaller than ".concat(maxSizeMB, "MB!"),
|
|
158
|
+
type: "failure"
|
|
159
|
+
});
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
126
165
|
const handleChange = async _ref2 => {
|
|
127
166
|
let {
|
|
128
167
|
fileList: newFileList,
|
|
@@ -133,11 +172,33 @@ function DocumentUpload(_ref) {
|
|
|
133
172
|
setLoading(true);
|
|
134
173
|
try {
|
|
135
174
|
if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
175
|
+
if (generateS3Url) {
|
|
176
|
+
var _response, _response2, _response3;
|
|
177
|
+
if (beforeUploadFileValidations && formName && !beforeUpload(file, allowedMediaType, maxAllowedSize)) {
|
|
178
|
+
setLoading(false);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
let response = await generateS3Url(files.name);
|
|
182
|
+
response = (_response = response) === null || _response === void 0 ? void 0 : _response.data;
|
|
183
|
+
s3ResponseReturn(response);
|
|
184
|
+
await uploadOnS3((_response2 = response) === null || _response2 === void 0 || (_response2 = _response2.response) === null || _response2 === void 0 || (_response2 = _response2.data) === null || _response2 === void 0 ? void 0 : _response2.uploadUrl, files);
|
|
185
|
+
if (((_response3 = response) === null || _response3 === void 0 || (_response3 = _response3.response) === null || _response3 === void 0 || (_response3 = _response3.status) === null || _response3 === void 0 ? void 0 : _response3.toLowerCase()) == "success") {
|
|
186
|
+
var _response4;
|
|
187
|
+
modifiedFile.status = "done";
|
|
188
|
+
modifiedFile.s3Uid = (_response4 = response) === null || _response4 === void 0 || (_response4 = _response4.response) === null || _response4 === void 0 || (_response4 = _response4.data) === null || _response4 === void 0 ? void 0 : _response4.uuid;
|
|
189
|
+
if (!isImageFile(files === null || files === void 0 ? void 0 : files.name)) {
|
|
190
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
modifiedFile.status = "failed";
|
|
194
|
+
modifiedFile = null;
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
await onChange(files);
|
|
198
|
+
modifiedFile.status = "done";
|
|
199
|
+
if (!isImageFile(file === null || file === void 0 ? void 0 : file.name)) {
|
|
200
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
201
|
+
}
|
|
141
202
|
}
|
|
142
203
|
}
|
|
143
204
|
} catch (error) {
|
|
@@ -152,20 +213,25 @@ function DocumentUpload(_ref) {
|
|
|
152
213
|
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
153
214
|
style: {
|
|
154
215
|
border: 0,
|
|
155
|
-
background:
|
|
216
|
+
background: "none"
|
|
156
217
|
},
|
|
157
218
|
type: "button"
|
|
158
|
-
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) :
|
|
159
|
-
/*#__PURE__*/
|
|
160
|
-
// <CustomIcon
|
|
161
|
-
// className="UploadImg"
|
|
162
|
-
// alt="phone img"
|
|
163
|
-
// src={offerImg}
|
|
164
|
-
// />
|
|
165
|
-
_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
219
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) : /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
166
220
|
const DeleteFile = async () => {
|
|
167
|
-
|
|
168
|
-
|
|
221
|
+
if (allowLocalDelete) {
|
|
222
|
+
const files = fileList;
|
|
223
|
+
const updatedFiles = files.filter(file => file.uid != selectedFile.uid);
|
|
224
|
+
const tempList = updatedFiles === null || updatedFiles === void 0 ? void 0 : updatedFiles.filter(Boolean);
|
|
225
|
+
setFileList(tempList);
|
|
226
|
+
setDeleteConfirmation(false);
|
|
227
|
+
form === null || form === void 0 || form.setFields([{
|
|
228
|
+
name: formName,
|
|
229
|
+
value: null
|
|
230
|
+
}]);
|
|
231
|
+
} else {
|
|
232
|
+
await deleteHandler(selectedFile);
|
|
233
|
+
setDeleteConfirmation(false);
|
|
234
|
+
}
|
|
169
235
|
};
|
|
170
236
|
const handleRemove = file => new Promise((resolve, reject) => {
|
|
171
237
|
setSelectedFile(file);
|
|
@@ -177,21 +243,23 @@ function DocumentUpload(_ref) {
|
|
|
177
243
|
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
178
244
|
theme: {
|
|
179
245
|
token: {
|
|
180
|
-
colorBorder: _ColorVariablesMap.default[
|
|
246
|
+
colorBorder: _ColorVariablesMap.default["--color-divider"],
|
|
181
247
|
borderRadiusLG: 4,
|
|
182
|
-
colorPrimaryHover: _ColorVariablesMap.default[
|
|
183
|
-
colorPrimaryBorder: _ColorVariablesMap.default[
|
|
184
|
-
colorFillAlter: _ColorVariablesMap.default[
|
|
185
|
-
colorError: _ColorVariablesMap.default[
|
|
186
|
-
colorText: _ColorVariablesMap.default[
|
|
248
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
249
|
+
colorPrimaryBorder: _ColorVariablesMap.default["--color-divider"],
|
|
250
|
+
colorFillAlter: _ColorVariablesMap.default["--color-secondary-background"],
|
|
251
|
+
colorError: _ColorVariablesMap.default["--color-negative"],
|
|
252
|
+
colorText: _ColorVariablesMap.default["--color-secondary-content"]
|
|
187
253
|
}
|
|
188
254
|
}
|
|
189
255
|
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
256
|
+
label: label !== null && label !== void 0 ? label : "",
|
|
190
257
|
name: formName,
|
|
191
|
-
rules: [{
|
|
258
|
+
rules: formRules || [{
|
|
192
259
|
required: isMandatory,
|
|
193
|
-
message:
|
|
194
|
-
}]
|
|
260
|
+
message: "Required"
|
|
261
|
+
}],
|
|
262
|
+
initialValue: (uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length) > 0 ? fileList : []
|
|
195
263
|
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, _extends({
|
|
196
264
|
customRequest: () => {},
|
|
197
265
|
listType: "picture-card",
|
|
@@ -214,15 +282,17 @@ function DocumentUpload(_ref) {
|
|
|
214
282
|
selectedDocumentData: selectedDocumentData
|
|
215
283
|
}), deleteConfirmation && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
216
284
|
buttonConfig: [{
|
|
217
|
-
callback: () => DeleteFile(),
|
|
218
|
-
label:
|
|
219
|
-
type:
|
|
285
|
+
callback: () => DeleteFile(previewImage),
|
|
286
|
+
label: "Yes, Delete",
|
|
287
|
+
type: "danger-primary"
|
|
220
288
|
}],
|
|
221
289
|
imgSrc: _handIcon.default,
|
|
222
290
|
open: deleteConfirmation,
|
|
223
291
|
onCancel: () => setDeleteConfirmation(false),
|
|
224
292
|
title: "Delete Item?"
|
|
225
|
-
}, "This action will permanently delete the selected item")
|
|
293
|
+
}, "This action will permanently delete the selected item"), /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
|
|
294
|
+
ref: notificationRef
|
|
295
|
+
}));
|
|
226
296
|
}
|
|
227
297
|
DocumentUpload.propTypes = {
|
|
228
298
|
uploadedDocuments: _propTypes.default.array,
|
|
@@ -235,18 +305,28 @@ DocumentUpload.propTypes = {
|
|
|
235
305
|
// Define the getPreview prop type
|
|
236
306
|
isMandatory: _propTypes.default.bool,
|
|
237
307
|
noOfUpload: _propTypes.default.number,
|
|
238
|
-
downloadCallback: _propTypes.default.func
|
|
308
|
+
downloadCallback: _propTypes.default.func,
|
|
309
|
+
// function will be used to download the document,
|
|
310
|
+
allowLocalDelete: _propTypes.default.bool,
|
|
311
|
+
formRules: _propTypes.default.array,
|
|
312
|
+
beforeUploadFileValidations: _propTypes.default.bool,
|
|
313
|
+
allowedMediaType: _propTypes.default.array,
|
|
314
|
+
maxAllowedSize: _propTypes.default.string
|
|
239
315
|
};
|
|
240
316
|
DocumentUpload.defaultProps = {
|
|
241
317
|
uploadedDocuments: [],
|
|
242
318
|
onChange: () => {},
|
|
243
|
-
formName:
|
|
319
|
+
formName: "",
|
|
244
320
|
multipleDoc: 0,
|
|
245
321
|
showDelete: true,
|
|
246
322
|
getPreview: () => {},
|
|
247
323
|
isMandatory: true,
|
|
248
324
|
deleteHandler: () => {},
|
|
249
325
|
noOfUpload: 1,
|
|
250
|
-
downloadCallback: () => {}
|
|
326
|
+
downloadCallback: () => {},
|
|
327
|
+
allowLocalDelete: true,
|
|
328
|
+
beforeUploadFileValidations: false,
|
|
329
|
+
allowedMediaType: [],
|
|
330
|
+
maxAllowedSize: ""
|
|
251
331
|
};
|
|
252
332
|
var _default = exports.default = DocumentUpload;
|
|
@@ -184,6 +184,7 @@ function CustomViewer(_ref2) {
|
|
|
184
184
|
fileName = 'download'
|
|
185
185
|
} = _ref2,
|
|
186
186
|
antDesignProps = _objectWithoutProperties(_ref2, _excluded);
|
|
187
|
+
console.log(downloadCallback, title, selectedDocumentData, previewFile, fileName, antDesignProps, 'antDesignProps');
|
|
187
188
|
const [rotationDegree, setRotationDegree] = (0, _react.useState)(0);
|
|
188
189
|
const [numPages, setNumPages] = (0, _react.useState)(null);
|
|
189
190
|
const [pageNumber, setPageNumber] = (0, _react.useState)(1);
|
|
@@ -215,7 +216,7 @@ function CustomViewer(_ref2) {
|
|
|
215
216
|
}, [previewFile]);
|
|
216
217
|
const getFileFormat = (0, _react.useMemo)(() => {
|
|
217
218
|
var _previewFile$type;
|
|
218
|
-
const fileExtension = typeof previewFile === 'string' ? title.split('.').pop().toLowerCase() : previewFile === null || previewFile === void 0 || (_previewFile$type = previewFile.type) === null || _previewFile$type === void 0 ? void 0 : _previewFile$type.split('/')[1];
|
|
219
|
+
const fileExtension = typeof previewFile === 'string' ? title === null || title === void 0 ? void 0 : title.split('.').pop().toLowerCase() : previewFile === null || previewFile === void 0 || (_previewFile$type = previewFile.type) === null || _previewFile$type === void 0 ? void 0 : _previewFile$type.split('/')[1];
|
|
219
220
|
if (supportedImage.includes(fileExtension)) {
|
|
220
221
|
return 'IMAGE';
|
|
221
222
|
}
|
|
@@ -224,6 +225,7 @@ function CustomViewer(_ref2) {
|
|
|
224
225
|
}
|
|
225
226
|
return 'UNSUPPORTED';
|
|
226
227
|
}, [previewFile, title]);
|
|
228
|
+
console.log(getUrl, 'getUrl');
|
|
227
229
|
return /*#__PURE__*/_react.default.createElement(_CustomModal.default, _extends({
|
|
228
230
|
width: 860,
|
|
229
231
|
className: "imageZoom",
|