ordering-ui-admin-external 1.43.54 → 1.43.55
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/_bundles/{ordering-ui-admin.29d9fb7b8d8bbd05195a.js → ordering-ui-admin.a4c16500259261bd14ca.js} +2 -2
- package/_modules/components/Orders/OrdersExportCSV/index.js +35 -2
- package/_modules/components/Orders/OrdersExportCSV/styles.js +8 -5
- package/package.json +2 -2
- package/src/components/Orders/OrdersExportCSV/index.js +25 -2
- package/src/components/Orders/OrdersExportCSV/styles.js +5 -1
- /package/_bundles/{ordering-ui-admin.29d9fb7b8d8bbd05195a.js.LICENSE.txt → ordering-ui-admin.a4c16500259261bd14ca.js.LICENSE.txt} +0 -0
|
@@ -42,6 +42,13 @@ var ExportCSVUI = function ExportCSVUI(props) {
|
|
|
42
42
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
43
|
modalOpen = _useState4[0],
|
|
44
44
|
setModalOpen = _useState4[1];
|
|
45
|
+
var _useState5 = (0, _react.useState)({
|
|
46
|
+
open: false,
|
|
47
|
+
content: []
|
|
48
|
+
}),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
alertState = _useState6[0],
|
|
51
|
+
setAlertState = _useState6[1];
|
|
45
52
|
var handleExportAll = function handleExportAll() {
|
|
46
53
|
setPopoverOpen(false);
|
|
47
54
|
getCSV(false);
|
|
@@ -53,6 +60,12 @@ var ExportCSVUI = function ExportCSVUI(props) {
|
|
|
53
60
|
var closePopover = function closePopover() {
|
|
54
61
|
setPopoverOpen(false);
|
|
55
62
|
};
|
|
63
|
+
var closeAlert = function closeAlert() {
|
|
64
|
+
setAlertState({
|
|
65
|
+
open: false,
|
|
66
|
+
content: []
|
|
67
|
+
});
|
|
68
|
+
};
|
|
56
69
|
(0, _react.useEffect)(function () {
|
|
57
70
|
if (!popoverOpen) return;
|
|
58
71
|
document.addEventListener('click', closePopover);
|
|
@@ -61,6 +74,12 @@ var ExportCSVUI = function ExportCSVUI(props) {
|
|
|
61
74
|
};
|
|
62
75
|
}, [popoverOpen]);
|
|
63
76
|
(0, _react.useEffect)(function () {
|
|
77
|
+
if (actionStatus !== null && actionStatus !== void 0 && actionStatus.error) {
|
|
78
|
+
setAlertState({
|
|
79
|
+
open: true,
|
|
80
|
+
content: actionStatus === null || actionStatus === void 0 ? void 0 : actionStatus.error
|
|
81
|
+
});
|
|
82
|
+
}
|
|
64
83
|
if (!(actionStatus !== null && actionStatus !== void 0 && actionStatus.result) || actionStatus !== null && actionStatus !== void 0 && actionStatus.error) return;
|
|
65
84
|
setModalOpen(true);
|
|
66
85
|
}, [actionStatus]);
|
|
@@ -71,7 +90,9 @@ var ExportCSVUI = function ExportCSVUI(props) {
|
|
|
71
90
|
onClick: function onClick() {
|
|
72
91
|
return setPopoverOpen(!popoverOpen);
|
|
73
92
|
}
|
|
74
|
-
}, width > 600 && t('CSV', 'CSV'), /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.Download, null)), popoverOpen && /*#__PURE__*/_react.default.createElement(_styles2.PopoverContainer,
|
|
93
|
+
}, width > 600 && t('CSV', 'CSV'), /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.Download, null)), popoverOpen && /*#__PURE__*/_react.default.createElement(_styles2.PopoverContainer, {
|
|
94
|
+
disabled: actionStatus.loading
|
|
95
|
+
}, /*#__PURE__*/_react.default.createElement(_styles2.Item, {
|
|
75
96
|
onClick: function onClick() {
|
|
76
97
|
return handleExportAll();
|
|
77
98
|
}
|
|
@@ -98,7 +119,19 @@ var ExportCSVUI = function ExportCSVUI(props) {
|
|
|
98
119
|
onClick: function onClick() {
|
|
99
120
|
return setModalOpen(false);
|
|
100
121
|
}
|
|
101
|
-
}, t('OK', 'OK'))))
|
|
122
|
+
}, t('OK', 'OK')))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
|
|
123
|
+
title: t('CSV_ORDERS', 'Csv orders'),
|
|
124
|
+
content: alertState === null || alertState === void 0 ? void 0 : alertState.content,
|
|
125
|
+
acceptText: t('ACCEPT', 'Accept'),
|
|
126
|
+
open: alertState === null || alertState === void 0 ? void 0 : alertState.open,
|
|
127
|
+
onClose: function onClose() {
|
|
128
|
+
return closeAlert();
|
|
129
|
+
},
|
|
130
|
+
onAccept: function onAccept() {
|
|
131
|
+
return closeAlert();
|
|
132
|
+
},
|
|
133
|
+
closeOnBackdrop: false
|
|
134
|
+
}));
|
|
102
135
|
};
|
|
103
136
|
var OrdersExportCSV = exports.OrdersExportCSV = function OrdersExportCSV(props) {
|
|
104
137
|
var ExportCSVControlProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PopoverContainer = exports.Item = exports.ExportContainer = exports.ExportCSVResult = exports.ErrorMessage = void 0;
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
10
10
|
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); }
|
|
11
11
|
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 && {}.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; }
|
|
12
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -17,19 +17,22 @@ var ExportContainer = exports.ExportContainer = _styledComponents.default.div(_t
|
|
|
17
17
|
var _props$theme2;
|
|
18
18
|
return (_props$theme2 = props.theme) !== null && _props$theme2 !== void 0 && _props$theme2.rtl ? (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-right: 5px;\n "]))) : (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: 5px;\n "])));
|
|
19
19
|
});
|
|
20
|
-
var PopoverContainer = exports.PopoverContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: absolute;\n margin-top: 5px;\n padding: 5px 0;\n background: ", ";\n box-shadow: 0 6px 12px rgba(0,0,0,.175);\n z-index:
|
|
20
|
+
var PopoverContainer = exports.PopoverContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: absolute;\n margin-top: 5px;\n padding: 5px 0;\n background: ", ";\n box-shadow: 0 6px 12px rgba(0,0,0,.175);\n z-index: 1100;\n\n ", "\n\n ", "\n"])), function (props) {
|
|
21
21
|
var _props$theme$colors;
|
|
22
22
|
return ((_props$theme$colors = props.theme.colors) === null || _props$theme$colors === void 0 ? void 0 : _props$theme$colors.backgroundPage) || '#FFF';
|
|
23
23
|
}, function (props) {
|
|
24
24
|
var _props$theme3;
|
|
25
25
|
return (_props$theme3 = props.theme) !== null && _props$theme3 !== void 0 && _props$theme3.rtl ? (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n left: 14px;\n "]))) : (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n right: 14px;\n "])));
|
|
26
|
+
}, function (_ref) {
|
|
27
|
+
var disabled = _ref.disabled;
|
|
28
|
+
return disabled && (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n pointer-events: none;\n "])));
|
|
26
29
|
});
|
|
27
|
-
var Item = exports.Item = _styledComponents.default.div(
|
|
28
|
-
var ExportCSVResult = exports.ExportCSVResult = _styledComponents.default.div(
|
|
30
|
+
var Item = exports.Item = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 3px 20px;\n white-space: nowrap;\n cursor: pointer;\n &:hover {\n background-color: #F2F2F2;\n }\n"])));
|
|
31
|
+
var ExportCSVResult = exports.ExportCSVResult = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n\n h1 {\n font-size: 24px;\n color: ", ";\n }\n\n button {\n width: 100%;\n padding-top: 5px;\n padding-bottom: 5px;\n margin-top: 20px;\n }\n"])), function (props) {
|
|
29
32
|
var _props$theme$colors2;
|
|
30
33
|
return (_props$theme$colors2 = props.theme.colors) === null || _props$theme$colors2 === void 0 ? void 0 : _props$theme$colors2.headingColor;
|
|
31
34
|
});
|
|
32
|
-
var ErrorMessage = exports.ErrorMessage = _styledComponents.default.p(
|
|
35
|
+
var ErrorMessage = exports.ErrorMessage = _styledComponents.default.p(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n text-align: center;\n margin: 5px 0;\n color: ", ";\n"])), function (props) {
|
|
33
36
|
var _props$theme$colors3;
|
|
34
37
|
return (_props$theme$colors3 = props.theme.colors) === null || _props$theme$colors3 === void 0 ? void 0 : _props$theme$colors3.headingColor;
|
|
35
38
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-admin-external",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.55",
|
|
4
4
|
"description": "Ordering UI Admin Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
84
|
"moment": "^2.29.1",
|
|
85
85
|
"moment-range": "^4.0.2",
|
|
86
|
-
"ordering-components-admin-external": "1.43.
|
|
86
|
+
"ordering-components-admin-external": "1.43.36",
|
|
87
87
|
"polished": "^3.6.7",
|
|
88
88
|
"prop-types": "^15.7.2",
|
|
89
89
|
"react-big-calendar": "^1.4.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useLanguage, ExportCSV as ExportCSVController } from 'ordering-components-admin-external'
|
|
3
|
-
import { Modal, SpinnerLoader } from '../../Shared'
|
|
3
|
+
import { Alert, Modal, SpinnerLoader } from '../../Shared'
|
|
4
4
|
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
5
5
|
import { Button } from '../../../styles'
|
|
6
6
|
import { Download } from 'react-bootstrap-icons'
|
|
@@ -20,6 +20,7 @@ const ExportCSVUI = (props) => {
|
|
|
20
20
|
const { width } = useWindowSize()
|
|
21
21
|
const [popoverOpen, setPopoverOpen] = useState(false)
|
|
22
22
|
const [modalOpen, setModalOpen] = useState(false)
|
|
23
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
23
24
|
|
|
24
25
|
const handleExportAll = () => {
|
|
25
26
|
setPopoverOpen(false)
|
|
@@ -35,6 +36,13 @@ const ExportCSVUI = (props) => {
|
|
|
35
36
|
setPopoverOpen(false)
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
const closeAlert = () => {
|
|
40
|
+
setAlertState({
|
|
41
|
+
open: false,
|
|
42
|
+
content: []
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
useEffect(() => {
|
|
39
47
|
if (!popoverOpen) return
|
|
40
48
|
document.addEventListener('click', closePopover)
|
|
@@ -42,6 +50,12 @@ const ExportCSVUI = (props) => {
|
|
|
42
50
|
}, [popoverOpen])
|
|
43
51
|
|
|
44
52
|
useEffect(() => {
|
|
53
|
+
if (actionStatus?.error) {
|
|
54
|
+
setAlertState({
|
|
55
|
+
open: true,
|
|
56
|
+
content: actionStatus?.error
|
|
57
|
+
})
|
|
58
|
+
}
|
|
45
59
|
if (!actionStatus?.result || actionStatus?.error) return
|
|
46
60
|
setModalOpen(true)
|
|
47
61
|
}, [actionStatus])
|
|
@@ -59,7 +73,7 @@ const ExportCSVUI = (props) => {
|
|
|
59
73
|
<Download />
|
|
60
74
|
</Button>
|
|
61
75
|
{popoverOpen && (
|
|
62
|
-
<PopoverContainer>
|
|
76
|
+
<PopoverContainer disabled={actionStatus.loading}>
|
|
63
77
|
<Item onClick={() => handleExportAll()}>
|
|
64
78
|
{t('EXPORT_ALL', 'Export all')}
|
|
65
79
|
</Item>
|
|
@@ -92,6 +106,15 @@ const ExportCSVUI = (props) => {
|
|
|
92
106
|
</Button>
|
|
93
107
|
</ExportCSVResult>
|
|
94
108
|
</Modal>
|
|
109
|
+
<Alert
|
|
110
|
+
title={t('CSV_ORDERS', 'Csv orders')}
|
|
111
|
+
content={alertState?.content}
|
|
112
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
113
|
+
open={alertState?.open}
|
|
114
|
+
onClose={() => closeAlert()}
|
|
115
|
+
onAccept={() => closeAlert()}
|
|
116
|
+
closeOnBackdrop={false}
|
|
117
|
+
/>
|
|
95
118
|
</>
|
|
96
119
|
)
|
|
97
120
|
}
|
|
@@ -26,13 +26,17 @@ export const PopoverContainer = styled.div`
|
|
|
26
26
|
padding: 5px 0;
|
|
27
27
|
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
28
28
|
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
|
29
|
-
z-index:
|
|
29
|
+
z-index: 1100;
|
|
30
30
|
|
|
31
31
|
${props => props.theme?.rtl ? css`
|
|
32
32
|
left: 14px;
|
|
33
33
|
` : css`
|
|
34
34
|
right: 14px;
|
|
35
35
|
`}
|
|
36
|
+
|
|
37
|
+
${({ disabled }) => disabled && css`
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
`}
|
|
36
40
|
`
|
|
37
41
|
|
|
38
42
|
export const Item = styled.div`
|