oa-componentbook 1.0.1-stage.45 → 1.0.1-stage.450
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 +147 -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-document-details-panel/DocumentDetailsPanel.js +154 -0
- 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-progress-bar/CustomProgressBar.js +8 -4
- 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 +613 -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-table-with-search-and-filter/TableWithSearchAndFilter.js +469 -0
- package/build/components/oa-component-table-with-search-and-filter/styles.js +23 -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 +116 -29
- 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 +200 -0
- package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
- package/build/dev/oa-widget-document-viewer-with-details/DocumentViewerWithDetails.js +123 -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 +131 -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 +403 -0
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +85 -0
- package/build/layout/EntityOverviewLayout/styles.js +13 -0
- package/build/layout/GenricLayOut/GenricLayOut.js +2421 -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 +310 -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 +577 -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 +74 -48
- 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 +407 -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
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("core-js/modules/es.string.trim.js");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _SendRounded = _interopRequireDefault(require("@material-ui/icons/SendRounded"));
|
|
15
|
+
var _styles = _interopRequireWildcard(require("./styles"));
|
|
16
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
17
|
+
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
const _excluded = ["rows", "placeholder", "maxLength", "className", "variant"],
|
|
20
|
+
_excluded2 = ["minRows", "maxRows", "sendIconConfig", "onSend", "value", "onChange", "disabled"];
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
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); }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
/**
|
|
28
|
+
* A custom text area component.
|
|
29
|
+
*
|
|
30
|
+
* The component includes the following properties:
|
|
31
|
+
* - `rows`: The number of rows for the text area (used for default variant).
|
|
32
|
+
* - `placeholder`: The placeholder text for the text area.
|
|
33
|
+
* - `maxLength`: The maximum length of the input value.
|
|
34
|
+
* - `className`: Additional CSS class to apply to the text area.
|
|
35
|
+
* - `variant`: 'default' or 'gradient' - determines the styling variant.
|
|
36
|
+
* - `minRows`: Initial line height for gradient variant (default: 1).
|
|
37
|
+
* - `maxRows`: Maximum rows before scrolling starts for gradient variant (default: null for unlimited).
|
|
38
|
+
* - `sendIconConfig`: Object with `show` (boolean, default: false) and `disabled` (boolean, default: false) for gradient variant only.
|
|
39
|
+
* - `onSend`: Callback function called when send icon is clicked (gradient variant only).
|
|
40
|
+
* - `antDesignProps`: Any other props to pass to the antd Input.TextArea component.
|
|
41
|
+
*
|
|
42
|
+
* The component will apply the following styles:
|
|
43
|
+
* - A dark grey background when the component is disabled.
|
|
44
|
+
* - A dark grey text color when the component is disabled.
|
|
45
|
+
* - A custom style class of `custom-textarea` to the outer element.
|
|
46
|
+
* - Gradient border and auto-growing height for gradient variant.
|
|
47
|
+
*
|
|
48
|
+
* The component will also apply the following props to the antd Input.TextArea component:
|
|
49
|
+
* - `rows` (for default variant) or `minRows`/`maxRows` (for gradient variant)
|
|
50
|
+
* - `placeholder`
|
|
51
|
+
* - `maxLength`
|
|
52
|
+
* - `className` (appended to the outer element)
|
|
53
|
+
* - Any other props passed in the `antDesignProps` object
|
|
54
|
+
*/
|
|
55
|
+
function CustomTextArea(_ref) {
|
|
56
|
+
let {
|
|
57
|
+
rows,
|
|
58
|
+
placeholder,
|
|
59
|
+
maxLength,
|
|
60
|
+
className,
|
|
61
|
+
variant = 'default'
|
|
62
|
+
} = _ref,
|
|
63
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
+
// Render gradient variant
|
|
65
|
+
if (variant === 'gradient') {
|
|
66
|
+
// Extract gradient-specific props from antDesignProps
|
|
67
|
+
const _ref2 = antDesignProps || {},
|
|
68
|
+
{
|
|
69
|
+
minRows = _constants.DEFAULT_MIN_ROWS,
|
|
70
|
+
maxRows = _constants.DEFAULT_MAX_ROWS,
|
|
71
|
+
sendIconConfig = _constants.DEFAULT_SEND_ICON_CONFIG,
|
|
72
|
+
onSend,
|
|
73
|
+
value,
|
|
74
|
+
onChange,
|
|
75
|
+
disabled
|
|
76
|
+
} = _ref2,
|
|
77
|
+
restAntDesignProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
78
|
+
|
|
79
|
+
// Handle send icon click - gradient variant only
|
|
80
|
+
// Use value prop directly - no internal state management
|
|
81
|
+
const handleSendClick = () => {
|
|
82
|
+
const currentValue = value || '';
|
|
83
|
+
// Only allow click if textarea is enabled, icon config is not disabled, and has content
|
|
84
|
+
if (onSend && !disabled && !sendIconConfig.disabled && currentValue.trim()) {
|
|
85
|
+
onSend(currentValue);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Determine if send icon should be enabled - gradient variant only
|
|
90
|
+
// Icon is enabled if: textarea is enabled AND config says it's not disabled AND there's content
|
|
91
|
+
// Use value prop directly - no internal state
|
|
92
|
+
const currentValue = value || '';
|
|
93
|
+
const isSendEnabled = !disabled && !sendIconConfig.disabled && currentValue.trim().length > 0;
|
|
94
|
+
|
|
95
|
+
// Determine if icon should be shown - only for gradient variant
|
|
96
|
+
// Hidden by default, only show when explicitly requested via sendIconConfig.show
|
|
97
|
+
const shouldShowIcon = sendIconConfig.show;
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
99
|
+
theme: {
|
|
100
|
+
token: {
|
|
101
|
+
colorBgContainerDisabled: _ColorVariablesMap.default['--color-divider'],
|
|
102
|
+
colorTextDisabled: _ColorVariablesMap.default['--color-secondary-content']
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.TextAreaWrapper, {
|
|
106
|
+
className: className,
|
|
107
|
+
$disabled: disabled
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
|
|
109
|
+
placeholder: placeholder,
|
|
110
|
+
maxLength: maxLength,
|
|
111
|
+
className: "custom-textarea-gradient",
|
|
112
|
+
value: value,
|
|
113
|
+
onChange: onChange,
|
|
114
|
+
disabled: disabled,
|
|
115
|
+
autoSize: maxRows ? {
|
|
116
|
+
minRows,
|
|
117
|
+
maxRows
|
|
118
|
+
} : {
|
|
119
|
+
minRows
|
|
120
|
+
}
|
|
121
|
+
}, restAntDesignProps)), shouldShowIcon && /*#__PURE__*/_react.default.createElement(_styles.SendIconWrapper, {
|
|
122
|
+
className: disabled || sendIconConfig.disabled || !isSendEnabled ? 'icon-disabled' : 'icon-enabled'
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
124
|
+
icon: _SendRounded.default,
|
|
125
|
+
size: 24,
|
|
126
|
+
color: isSendEnabled ? 'primary' : 'placeholder-text',
|
|
127
|
+
onClick: handleSendClick
|
|
128
|
+
}))));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Render default variant (existing behavior - completely unchanged)
|
|
132
|
+
// All props including value, onChange pass through naturally via antDesignProps
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
134
|
+
theme: {
|
|
135
|
+
token: {
|
|
136
|
+
colorBgContainerDisabled: _ColorVariablesMap.default['--color-divider'],
|
|
137
|
+
colorTextDisabled: _ColorVariablesMap.default['--color-secondary-content']
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
|
|
141
|
+
rows: rows,
|
|
142
|
+
placeholder: placeholder,
|
|
143
|
+
maxLength: maxLength,
|
|
144
|
+
className: "custom-textarea ".concat(className)
|
|
145
|
+
}, antDesignProps)));
|
|
146
|
+
}
|
|
147
|
+
CustomTextArea.propTypes = {
|
|
148
|
+
rows: _propTypes.default.number,
|
|
149
|
+
placeholder: _propTypes.default.string,
|
|
150
|
+
maxLength: _propTypes.default.number,
|
|
151
|
+
className: _propTypes.default.string,
|
|
152
|
+
variant: _propTypes.default.oneOf(['default', 'gradient'])
|
|
153
|
+
};
|
|
154
|
+
CustomTextArea.defaultProps = {
|
|
155
|
+
rows: _constants.DEFAULT_ROWS,
|
|
156
|
+
placeholder: null,
|
|
157
|
+
maxLength: 5000,
|
|
158
|
+
className: '',
|
|
159
|
+
variant: 'default'
|
|
160
|
+
};
|
|
161
|
+
var _default = exports.default = CustomTextArea;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TEXTAREA_SHADOW = exports.TEXTAREA_BORDER_RADIUS = exports.SEND_ICON_SIZE = exports.GRADIENT_BORDER_COLORS = exports.DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_ROWS = exports.DEFAULT_MIN_ROWS = exports.DEFAULT_MAX_ROWS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Constants for CustomTextArea component
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Default values for textarea configuration
|
|
12
|
+
const DEFAULT_MIN_ROWS = exports.DEFAULT_MIN_ROWS = 1;
|
|
13
|
+
const DEFAULT_MAX_ROWS = exports.DEFAULT_MAX_ROWS = null; // null means unlimited growth
|
|
14
|
+
const DEFAULT_ROWS = exports.DEFAULT_ROWS = 2;
|
|
15
|
+
|
|
16
|
+
// Gradient border colors
|
|
17
|
+
const GRADIENT_BORDER_COLORS = exports.GRADIENT_BORDER_COLORS = {
|
|
18
|
+
top: '#0098FF',
|
|
19
|
+
// Blue
|
|
20
|
+
middle: '#9A6CFF',
|
|
21
|
+
// Purple
|
|
22
|
+
bottom: '#FB6252' // Coral/Orange-Red
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Shadow styles
|
|
26
|
+
const TEXTAREA_SHADOW = exports.TEXTAREA_SHADOW = '0px 2px 10px rgba(0, 0, 0, 0.14)';
|
|
27
|
+
|
|
28
|
+
// Border radius
|
|
29
|
+
const TEXTAREA_BORDER_RADIUS = exports.TEXTAREA_BORDER_RADIUS = '12px';
|
|
30
|
+
|
|
31
|
+
// Icon sizes
|
|
32
|
+
const SEND_ICON_SIZE = exports.SEND_ICON_SIZE = 24;
|
|
33
|
+
|
|
34
|
+
// Default send icon configuration
|
|
35
|
+
const DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_SEND_ICON_CONFIG = {
|
|
36
|
+
show: false,
|
|
37
|
+
// Hidden by default - only show when explicitly requested
|
|
38
|
+
disabled: false
|
|
39
|
+
};
|
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.TextAreaWrapper = exports.SendIconWrapper = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
var _antd = require("antd");
|
|
9
|
-
var
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
13
|
const {
|
|
13
14
|
TextArea: AntdTextArea
|
|
14
15
|
} = _antd.Input;
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
// Default textarea styles (existing)
|
|
18
|
+
const StyledTextArea = (0, _styledComponents.default)(AntdTextArea)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-textarea {\n padding: 16px;\n resize: none;\n border-radius: 4px;\n max-height: 92px;\n border: 1px solid var(--color-placeholder-text);\n }\n &.custom-textarea:hover {\n border: 1px solid var(--color-primary);\n }\n &.custom-textarea:focus-within {\n box-shadow: 0px 0px 4px 0px rgba(1, 79, 197, 0.90);\n }\n\n /* Gradient variant styles */\n &.custom-textarea-gradient {\n padding: 16px 48px 16px 16px;\n resize: none;\n border-radius: calc(", " - 2px);\n border: none;\n background: var(--color-primary-background);\n font-size: 16px;\n line-height: 24px;\n color: var(--color-primary-content);\n min-height: auto !important;\n box-shadow: none;\n width: 100%;\n }\n\n &.custom-textarea-gradient::placeholder {\n color: var(--color-secondary-content);\n }\n\n &.custom-textarea-gradient:hover {\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus {\n outline: none;\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus-within {\n box-shadow: none;\n }\n"])), _constants.TEXTAREA_BORDER_RADIUS);
|
|
19
|
+
|
|
20
|
+
// Wrapper for gradient variant with gradient border
|
|
21
|
+
const TextAreaWrapper = exports.TextAreaWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n display: block;\n width: 100%;\n border-radius: ", ";\n padding: 2px;\n background: ", ";\n box-shadow: ", ";\n opacity: ", ";\n"])), _constants.TEXTAREA_BORDER_RADIUS, props => props.$disabled ? 'var(--color-divider)' : "linear-gradient(\n 135deg,\n ".concat(_constants.GRADIENT_BORDER_COLORS.top, " 0%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.middle, " 50%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.bottom, " 100%\n )"), props => props.$disabled ? 'none' : _constants.TEXTAREA_SHADOW, props => props.$disabled ? 0.6 : 1);
|
|
22
|
+
|
|
23
|
+
// Send icon wrapper positioned absolutely
|
|
24
|
+
const SendIconWrapper = exports.SendIconWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 18px;\n right: 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10;\n pointer-events: none;\n\n button,\n svg {\n pointer-events: auto;\n }\n\n /* Icon disabled state */\n &.icon-disabled {\n opacity: 0.5;\n \n button,\n svg {\n cursor: not-allowed;\n }\n }\n\n /* Icon enabled state */\n &.icon-enabled {\n opacity: 1;\n \n button,\n svg {\n cursor: pointer;\n }\n }\n"])));
|
|
16
25
|
var _default = exports.default = StyledTextArea;
|
|
@@ -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", "showPreviewIcon", "showDownloadIcon"];
|
|
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,38 @@ 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,
|
|
114
|
+
showPreviewIcon,
|
|
115
|
+
showDownloadIcon
|
|
100
116
|
} = _ref,
|
|
101
117
|
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
102
118
|
const [previewOpen, setPreviewOpen] = (0, _react.useState)(false);
|
|
103
119
|
const [previewImage, setPreviewImage] = (0, _react.useState)(null);
|
|
104
|
-
const [previewTitle, setPreviewTitle] = (0, _react.useState)(
|
|
120
|
+
const [previewTitle, setPreviewTitle] = (0, _react.useState)("");
|
|
105
121
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
106
122
|
const [fileList, setFileList] = (0, _react.useState)(uploadedDocuments);
|
|
107
123
|
const [deleteConfirmation, setDeleteConfirmation] = (0, _react.useState)(false);
|
|
108
124
|
const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
|
|
109
125
|
const [selectedDocumentData, setSelectedDocumentData] = (0, _react.useState)({});
|
|
126
|
+
const notificationRef = (0, _react.useRef)(null);
|
|
127
|
+
const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
|
|
110
128
|
(0, _react.useEffect)(() => {
|
|
111
129
|
setFileList(uploadedDocuments);
|
|
112
130
|
}, [uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length]);
|
|
113
131
|
const handlePreview = async file => {
|
|
114
132
|
if (file !== null && file !== void 0 && file.originFileObj) {
|
|
115
133
|
setPreviewImage(file);
|
|
116
|
-
} else if ((file === null || file === void 0 ? void 0 : file.fileType) ===
|
|
134
|
+
} else if ((file === null || file === void 0 ? void 0 : file.fileType) === "thumbnail") {
|
|
117
135
|
const url = await getPreview();
|
|
118
136
|
setPreviewImage(url);
|
|
119
137
|
} else {
|
|
@@ -123,6 +141,29 @@ function DocumentUpload(_ref) {
|
|
|
123
141
|
setPreviewOpen(true);
|
|
124
142
|
setSelectedDocumentData(file);
|
|
125
143
|
};
|
|
144
|
+
const beforeUpload = (file, allowedMimeTypes, maxSizeMB) => {
|
|
145
|
+
if (allowedMimeTypes && (allowedMediaType === null || allowedMediaType === void 0 ? void 0 : allowedMediaType.length) > 0) {
|
|
146
|
+
const isAllowedType = allowedMimeTypes.includes(file.type);
|
|
147
|
+
if (!isAllowedType) {
|
|
148
|
+
openNotification({
|
|
149
|
+
description: "Only files of type: ".concat(allowedMimeTypes.join(", "), " are allowed!"),
|
|
150
|
+
type: "failure"
|
|
151
|
+
});
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (maxSizeMB) {
|
|
156
|
+
const isUnderSizeLimit = file.size / 1024 / 1024 < maxSizeMB;
|
|
157
|
+
if (!isUnderSizeLimit) {
|
|
158
|
+
openNotification({
|
|
159
|
+
description: "File must be smaller than ".concat(maxSizeMB, "MB!"),
|
|
160
|
+
type: "failure"
|
|
161
|
+
});
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
};
|
|
126
167
|
const handleChange = async _ref2 => {
|
|
127
168
|
let {
|
|
128
169
|
fileList: newFileList,
|
|
@@ -133,11 +174,33 @@ function DocumentUpload(_ref) {
|
|
|
133
174
|
setLoading(true);
|
|
134
175
|
try {
|
|
135
176
|
if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
177
|
+
if (generateS3Url) {
|
|
178
|
+
var _response, _response2, _response3;
|
|
179
|
+
if (beforeUploadFileValidations && formName && !beforeUpload(file, allowedMediaType, maxAllowedSize)) {
|
|
180
|
+
setLoading(false);
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
let response = await generateS3Url(files.name);
|
|
184
|
+
response = (_response = response) === null || _response === void 0 ? void 0 : _response.data;
|
|
185
|
+
s3ResponseReturn(response);
|
|
186
|
+
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);
|
|
187
|
+
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") {
|
|
188
|
+
var _response4;
|
|
189
|
+
modifiedFile.status = "done";
|
|
190
|
+
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;
|
|
191
|
+
if (!isImageFile(files === null || files === void 0 ? void 0 : files.name)) {
|
|
192
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
modifiedFile.status = "failed";
|
|
196
|
+
modifiedFile = null;
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
await onChange(files);
|
|
200
|
+
modifiedFile.status = "done";
|
|
201
|
+
if (!isImageFile(file === null || file === void 0 ? void 0 : file.name)) {
|
|
202
|
+
modifiedFile.url = _PdfSampleImage.default;
|
|
203
|
+
}
|
|
141
204
|
}
|
|
142
205
|
}
|
|
143
206
|
} catch (error) {
|
|
@@ -152,20 +215,25 @@ function DocumentUpload(_ref) {
|
|
|
152
215
|
const uploadButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
153
216
|
style: {
|
|
154
217
|
border: 0,
|
|
155
|
-
background:
|
|
218
|
+
background: "none"
|
|
156
219
|
},
|
|
157
220
|
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"));
|
|
221
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_icons.LoadingOutlined, null) : /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement("div", null, "Upload"));
|
|
166
222
|
const DeleteFile = async () => {
|
|
167
|
-
|
|
168
|
-
|
|
223
|
+
if (allowLocalDelete) {
|
|
224
|
+
const files = fileList;
|
|
225
|
+
const updatedFiles = files.filter(file => file.uid != selectedFile.uid);
|
|
226
|
+
const tempList = updatedFiles === null || updatedFiles === void 0 ? void 0 : updatedFiles.filter(Boolean);
|
|
227
|
+
setFileList(tempList);
|
|
228
|
+
setDeleteConfirmation(false);
|
|
229
|
+
form === null || form === void 0 || form.setFields([{
|
|
230
|
+
name: formName,
|
|
231
|
+
value: null
|
|
232
|
+
}]);
|
|
233
|
+
} else {
|
|
234
|
+
await deleteHandler(selectedFile);
|
|
235
|
+
setDeleteConfirmation(false);
|
|
236
|
+
}
|
|
169
237
|
};
|
|
170
238
|
const handleRemove = file => new Promise((resolve, reject) => {
|
|
171
239
|
setSelectedFile(file);
|
|
@@ -177,21 +245,23 @@ function DocumentUpload(_ref) {
|
|
|
177
245
|
}, multipleDoc > 0 && /*#__PURE__*/_react.default.createElement("em", null, multipleDoc), /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
178
246
|
theme: {
|
|
179
247
|
token: {
|
|
180
|
-
colorBorder: _ColorVariablesMap.default[
|
|
248
|
+
colorBorder: _ColorVariablesMap.default["--color-divider"],
|
|
181
249
|
borderRadiusLG: 4,
|
|
182
|
-
colorPrimaryHover: _ColorVariablesMap.default[
|
|
183
|
-
colorPrimaryBorder: _ColorVariablesMap.default[
|
|
184
|
-
colorFillAlter: _ColorVariablesMap.default[
|
|
185
|
-
colorError: _ColorVariablesMap.default[
|
|
186
|
-
colorText: _ColorVariablesMap.default[
|
|
250
|
+
colorPrimaryHover: _ColorVariablesMap.default["--color-primary"],
|
|
251
|
+
colorPrimaryBorder: _ColorVariablesMap.default["--color-divider"],
|
|
252
|
+
colorFillAlter: _ColorVariablesMap.default["--color-secondary-background"],
|
|
253
|
+
colorError: _ColorVariablesMap.default["--color-negative"],
|
|
254
|
+
colorText: _ColorVariablesMap.default["--color-secondary-content"]
|
|
187
255
|
}
|
|
188
256
|
}
|
|
189
257
|
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
258
|
+
label: label !== null && label !== void 0 ? label : "",
|
|
190
259
|
name: formName,
|
|
191
|
-
rules: [{
|
|
260
|
+
rules: formRules || [{
|
|
192
261
|
required: isMandatory,
|
|
193
|
-
message:
|
|
194
|
-
}]
|
|
262
|
+
message: "Required"
|
|
263
|
+
}],
|
|
264
|
+
initialValue: (uploadedDocuments === null || uploadedDocuments === void 0 ? void 0 : uploadedDocuments.length) > 0 ? fileList : []
|
|
195
265
|
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, _extends({
|
|
196
266
|
customRequest: () => {},
|
|
197
267
|
listType: "picture-card",
|
|
@@ -200,8 +270,9 @@ function DocumentUpload(_ref) {
|
|
|
200
270
|
onChange: handleChange,
|
|
201
271
|
onRemove: handleRemove,
|
|
202
272
|
showUploadList: {
|
|
203
|
-
showDownloadIcon:
|
|
273
|
+
showDownloadIcon: showDownloadIcon,
|
|
204
274
|
showRemoveIcon: showDelete,
|
|
275
|
+
showPreviewIcon: showPreviewIcon,
|
|
205
276
|
removeIcon: /*#__PURE__*/_react.default.createElement(_icons.DeleteFilled, null),
|
|
206
277
|
previewIcon: /*#__PURE__*/_react.default.createElement(_icons.EyeFilled, null)
|
|
207
278
|
}
|
|
@@ -211,18 +282,21 @@ function DocumentUpload(_ref) {
|
|
|
211
282
|
title: previewTitle,
|
|
212
283
|
onCancel: () => setPreviewOpen(false),
|
|
213
284
|
downloadCallback: downloadCallback,
|
|
214
|
-
selectedDocumentData: selectedDocumentData
|
|
285
|
+
selectedDocumentData: selectedDocumentData,
|
|
286
|
+
showDownloadIcon: showDownloadIcon
|
|
215
287
|
}), deleteConfirmation && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
216
288
|
buttonConfig: [{
|
|
217
|
-
callback: () => DeleteFile(),
|
|
218
|
-
label:
|
|
219
|
-
type:
|
|
289
|
+
callback: () => DeleteFile(previewImage),
|
|
290
|
+
label: "Yes, Delete",
|
|
291
|
+
type: "danger-primary"
|
|
220
292
|
}],
|
|
221
293
|
imgSrc: _handIcon.default,
|
|
222
294
|
open: deleteConfirmation,
|
|
223
295
|
onCancel: () => setDeleteConfirmation(false),
|
|
224
296
|
title: "Delete Item?"
|
|
225
|
-
}, "This action will permanently delete the selected item")
|
|
297
|
+
}, "This action will permanently delete the selected item"), /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
|
|
298
|
+
ref: notificationRef
|
|
299
|
+
}));
|
|
226
300
|
}
|
|
227
301
|
DocumentUpload.propTypes = {
|
|
228
302
|
uploadedDocuments: _propTypes.default.array,
|
|
@@ -235,18 +309,31 @@ DocumentUpload.propTypes = {
|
|
|
235
309
|
// Define the getPreview prop type
|
|
236
310
|
isMandatory: _propTypes.default.bool,
|
|
237
311
|
noOfUpload: _propTypes.default.number,
|
|
238
|
-
downloadCallback: _propTypes.default.func
|
|
312
|
+
downloadCallback: _propTypes.default.func,
|
|
313
|
+
// function will be used to download the document,
|
|
314
|
+
allowLocalDelete: _propTypes.default.bool,
|
|
315
|
+
formRules: _propTypes.default.array,
|
|
316
|
+
beforeUploadFileValidations: _propTypes.default.bool,
|
|
317
|
+
allowedMediaType: _propTypes.default.array,
|
|
318
|
+
maxAllowedSize: _propTypes.default.string,
|
|
319
|
+
showPreviewIcon: _propTypes.default.bool,
|
|
320
|
+
showDownloadIcon: _propTypes.default.bool
|
|
239
321
|
};
|
|
240
322
|
DocumentUpload.defaultProps = {
|
|
241
323
|
uploadedDocuments: [],
|
|
242
324
|
onChange: () => {},
|
|
243
|
-
formName:
|
|
325
|
+
formName: "",
|
|
244
326
|
multipleDoc: 0,
|
|
245
327
|
showDelete: true,
|
|
246
328
|
getPreview: () => {},
|
|
247
329
|
isMandatory: true,
|
|
248
330
|
deleteHandler: () => {},
|
|
249
331
|
noOfUpload: 1,
|
|
250
|
-
downloadCallback: () => {}
|
|
332
|
+
downloadCallback: () => {},
|
|
333
|
+
allowLocalDelete: true,
|
|
334
|
+
beforeUploadFileValidations: false,
|
|
335
|
+
allowedMediaType: [],
|
|
336
|
+
maxAllowedSize: "",
|
|
337
|
+
showPreviewIcon: true
|
|
251
338
|
};
|
|
252
339
|
var _default = exports.default = DocumentUpload;
|
|
@@ -26,7 +26,7 @@ var _common = _interopRequireDefault(require("../../utils/common"));
|
|
|
26
26
|
var _styles = require("./styles");
|
|
27
27
|
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
28
28
|
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
29
|
-
const _excluded = ["downloadCallback", "title", "selectedDocumentData", "previewFile", "fileName"],
|
|
29
|
+
const _excluded = ["downloadCallback", "title", "selectedDocumentData", "previewFile", "fileName", "showDownloadIcon"],
|
|
30
30
|
_excluded2 = ["zoomIn", "zoomOut"];
|
|
31
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
32
|
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); }
|
|
@@ -181,9 +181,11 @@ function CustomViewer(_ref2) {
|
|
|
181
181
|
title,
|
|
182
182
|
selectedDocumentData,
|
|
183
183
|
previewFile,
|
|
184
|
-
fileName = 'download'
|
|
184
|
+
fileName = 'download',
|
|
185
|
+
showDownloadIcon = true
|
|
185
186
|
} = _ref2,
|
|
186
187
|
antDesignProps = _objectWithoutProperties(_ref2, _excluded);
|
|
188
|
+
console.log(downloadCallback, title, selectedDocumentData, previewFile, fileName, antDesignProps, 'antDesignProps');
|
|
187
189
|
const [rotationDegree, setRotationDegree] = (0, _react.useState)(0);
|
|
188
190
|
const [numPages, setNumPages] = (0, _react.useState)(null);
|
|
189
191
|
const [pageNumber, setPageNumber] = (0, _react.useState)(1);
|
|
@@ -215,7 +217,7 @@ function CustomViewer(_ref2) {
|
|
|
215
217
|
}, [previewFile]);
|
|
216
218
|
const getFileFormat = (0, _react.useMemo)(() => {
|
|
217
219
|
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];
|
|
220
|
+
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
221
|
if (supportedImage.includes(fileExtension)) {
|
|
220
222
|
return 'IMAGE';
|
|
221
223
|
}
|
|
@@ -224,15 +226,17 @@ function CustomViewer(_ref2) {
|
|
|
224
226
|
}
|
|
225
227
|
return 'UNSUPPORTED';
|
|
226
228
|
}, [previewFile, title]);
|
|
229
|
+
console.log(getUrl, 'getUrl');
|
|
230
|
+
const buttonConfig = showDownloadIcon ? [{
|
|
231
|
+
callback: () => {
|
|
232
|
+
downloadCallback(selectedDocumentData);
|
|
233
|
+
},
|
|
234
|
+
label: 'Download'
|
|
235
|
+
}] : [];
|
|
227
236
|
return /*#__PURE__*/_react.default.createElement(_CustomModal.default, _extends({
|
|
228
237
|
width: 860,
|
|
229
238
|
className: "imageZoom",
|
|
230
|
-
buttonConfig:
|
|
231
|
-
callback: () => {
|
|
232
|
-
downloadCallback(selectedDocumentData);
|
|
233
|
-
},
|
|
234
|
-
label: 'Download'
|
|
235
|
-
}]
|
|
239
|
+
buttonConfig: buttonConfig
|
|
236
240
|
}, antDesignProps), /*#__PURE__*/_react.default.createElement(_reactZoomPanPinch.TransformWrapper, null, _ref4 => {
|
|
237
241
|
let {
|
|
238
242
|
zoomIn,
|
|
@@ -260,12 +264,14 @@ CustomViewer.propTypes = {
|
|
|
260
264
|
fileName: _propTypes.default.string,
|
|
261
265
|
antDesignProps: _propTypes.default.object,
|
|
262
266
|
downloadCallback: _propTypes.default.func,
|
|
263
|
-
selectedDocumentData: _propTypes.default.object
|
|
267
|
+
selectedDocumentData: _propTypes.default.object,
|
|
268
|
+
showDownloadIcon: _propTypes.default.bool
|
|
264
269
|
};
|
|
265
270
|
CustomViewer.defaultProps = {
|
|
266
271
|
fileName: 'download',
|
|
267
272
|
antDesignProps: {},
|
|
268
273
|
downloadCallback: () => {},
|
|
269
|
-
selectedDocumentData: {}
|
|
274
|
+
selectedDocumentData: {},
|
|
275
|
+
showDownloadIcon: true
|
|
270
276
|
};
|
|
271
277
|
var _default = exports.default = CustomViewer;
|