contentoh-components-library 21.4.97 → 21.4.99
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/dist/components/atoms/ObservationFlag/index.js +12 -5
- package/dist/components/molecules/ProductNameHeader/index.js +6 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -2
- package/dist/components/organisms/Modal/index.js +1 -1
- package/dist/components/pages/RetailerProductEdition/index.js +20 -1
- package/package.json +1 -1
- package/src/components/atoms/ObservationFlag/index.js +11 -5
- package/src/components/molecules/ProductNameHeader/index.js +5 -1
- package/src/components/organisms/FullProductNameHeader/index.js +6 -1
- package/src/components/organisms/Modal/index.js +1 -1
- package/src/components/pages/RetailerProductEdition/index.js +21 -0
|
@@ -46,7 +46,9 @@ var ObservationFlag = function ObservationFlag(_ref) {
|
|
|
46
46
|
contentObservation = _ref.contentObservation,
|
|
47
47
|
dataProduct = _ref.dataProduct,
|
|
48
48
|
isObservationVisible = _ref.isObservationVisible,
|
|
49
|
-
toggleObservation = _ref.toggleObservation
|
|
49
|
+
toggleObservation = _ref.toggleObservation,
|
|
50
|
+
handleClickOutside = _ref.handleClickOutside,
|
|
51
|
+
hideObservation = _ref.hideObservation;
|
|
50
52
|
var PriorityFlags = (_PriorityFlags = {}, (0, _defineProperty2.default)(_PriorityFlags, "none", _noPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "low", _lowPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "medium", _mediumPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "high", _highPriority.default), _PriorityFlags); // const [isObservationVisible, setObservationVisible] = useState(false);
|
|
51
53
|
|
|
52
54
|
var _useState = (0, _react.useState)(contentObservation || ""),
|
|
@@ -86,9 +88,14 @@ var ObservationFlag = function ObservationFlag(_ref) {
|
|
|
86
88
|
};
|
|
87
89
|
}, [isObservationVisible]);
|
|
88
90
|
(0, _react.useEffect)(function () {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
document.addEventListener("click", handleClickOutside);
|
|
92
|
+
return function () {
|
|
93
|
+
document.removeEventListener("click", handleClickOutside);
|
|
94
|
+
};
|
|
95
|
+
}, [isObservationVisible, handleClickOutside]);
|
|
96
|
+
(0, _react.useEffect)(function () {
|
|
97
|
+
setMaterial(contentObservation || "");
|
|
98
|
+
}, [contentObservation]);
|
|
92
99
|
(0, _react.useEffect)(function () {
|
|
93
100
|
setCurrentObservation(observation);
|
|
94
101
|
}, [observation]);
|
|
@@ -126,7 +133,7 @@ var ObservationFlag = function ObservationFlag(_ref) {
|
|
|
126
133
|
setShowModal(true);
|
|
127
134
|
setModalData(response.data.statusCode === 200 ? succesResponse : errorResponse);
|
|
128
135
|
setCurrentObservation(material !== "" ? "high" : "low");
|
|
129
|
-
|
|
136
|
+
hideObservation();
|
|
130
137
|
return _context.abrupt("return", response);
|
|
131
138
|
|
|
132
139
|
case 14:
|
|
@@ -28,7 +28,9 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
|
|
|
28
28
|
productObservation = _ref.productObservation,
|
|
29
29
|
dataProduct = _ref.dataProduct,
|
|
30
30
|
isObservationVisible = _ref.isObservationVisible,
|
|
31
|
-
toggleObservation = _ref.toggleObservation
|
|
31
|
+
toggleObservation = _ref.toggleObservation,
|
|
32
|
+
handleClickOutside = _ref.handleClickOutside,
|
|
33
|
+
hideObservation = _ref.hideObservation;
|
|
32
34
|
var typeFlag = productObservation !== null && productObservation !== "" ? "high" : "low";
|
|
33
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
34
36
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
|
|
@@ -45,7 +47,9 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
|
|
|
45
47
|
contentObservation: productObservation,
|
|
46
48
|
dataProduct: dataProduct,
|
|
47
49
|
isObservationVisible: isObservationVisible,
|
|
48
|
-
toggleObservation: toggleObservation
|
|
50
|
+
toggleObservation: toggleObservation,
|
|
51
|
+
handleClickOutside: handleClickOutside,
|
|
52
|
+
hideObservation: hideObservation
|
|
49
53
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
|
|
50
54
|
headerType: "date-header",
|
|
51
55
|
text: date
|
|
@@ -37,7 +37,9 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
37
37
|
showApproveRejectAll = _ref.showApproveRejectAll,
|
|
38
38
|
productObservation = _ref.productObservation,
|
|
39
39
|
isObservationVisible = _ref.isObservationVisible,
|
|
40
|
-
toggleObservation = _ref.toggleObservation
|
|
40
|
+
toggleObservation = _ref.toggleObservation,
|
|
41
|
+
handleClickOutside = _ref.handleClickOutside,
|
|
42
|
+
hideObservation = _ref.hideObservation;
|
|
41
43
|
|
|
42
44
|
var _useState = (0, _react.useState)([]),
|
|
43
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -75,7 +77,9 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
75
77
|
date: getTime((headerData === null || headerData === void 0 ? void 0 : (_headerData$article2 = headerData.article) === null || _headerData$article2 === void 0 ? void 0 : _headerData$article2.timestamp) || (headerData === null || headerData === void 0 ? void 0 : headerData.timestamp)),
|
|
76
78
|
dataProduct: headerData,
|
|
77
79
|
isObservationVisible: isObservationVisible,
|
|
78
|
-
toggleObservation: toggleObservation
|
|
80
|
+
toggleObservation: toggleObservation,
|
|
81
|
+
handleClickOutside: handleClickOutside,
|
|
82
|
+
hideObservation: hideObservation
|
|
79
83
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
80
84
|
className: "features-bar-container",
|
|
81
85
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FeaturesBar.FeaturesBar, {
|
|
@@ -516,6 +516,23 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
516
516
|
setObservationVisible(!isObservationVisible);
|
|
517
517
|
};
|
|
518
518
|
|
|
519
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
520
|
+
if (isObservationVisible && !event.target.closest(".Observation") && !event.target.closest(".Container")) {
|
|
521
|
+
hideObservation();
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
(0, _react.useEffect)(function () {
|
|
526
|
+
document.addEventListener("click", handleClickOutside);
|
|
527
|
+
return function () {
|
|
528
|
+
document.removeEventListener("click", handleClickOutside);
|
|
529
|
+
};
|
|
530
|
+
}, [isObservationVisible]);
|
|
531
|
+
|
|
532
|
+
var hideObservation = function hideObservation() {
|
|
533
|
+
setObservationVisible(false);
|
|
534
|
+
};
|
|
535
|
+
|
|
519
536
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
520
537
|
var _ref3, id_article;
|
|
521
538
|
|
|
@@ -2033,7 +2050,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2033
2050
|
setValRejAll(true);
|
|
2034
2051
|
},
|
|
2035
2052
|
isObservationVisible: isObservationVisible,
|
|
2036
|
-
toggleObservation: toggleObservation
|
|
2053
|
+
toggleObservation: toggleObservation,
|
|
2054
|
+
handleClickOutside: handleClickOutside,
|
|
2055
|
+
hideObservation: hideObservation
|
|
2037
2056
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
2038
2057
|
tabsSections: tabsSections,
|
|
2039
2058
|
status: retailerStatus,
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ export const ObservationFlag = ({
|
|
|
13
13
|
observation,
|
|
14
14
|
contentObservation,
|
|
15
15
|
dataProduct,
|
|
16
|
-
isObservationVisible, toggleObservation,
|
|
16
|
+
isObservationVisible, toggleObservation,handleClickOutside,hideObservation
|
|
17
17
|
}) => {
|
|
18
18
|
const PriorityFlags = {
|
|
19
19
|
["none"]: without,
|
|
@@ -48,10 +48,16 @@ export const ObservationFlag = ({
|
|
|
48
48
|
document.removeEventListener("click", handleClickOutside);
|
|
49
49
|
};
|
|
50
50
|
}, [isObservationVisible]);
|
|
51
|
-
|
|
52
51
|
useEffect(() => {
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
document.addEventListener("click", handleClickOutside);
|
|
53
|
+
return () => {
|
|
54
|
+
document.removeEventListener("click", handleClickOutside);
|
|
55
|
+
};
|
|
56
|
+
}, [isObservationVisible, handleClickOutside]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setMaterial(contentObservation || "");
|
|
60
|
+
}, [contentObservation]);
|
|
55
61
|
|
|
56
62
|
useEffect(() => {
|
|
57
63
|
setCurrentObservation(observation);
|
|
@@ -88,7 +94,7 @@ export const ObservationFlag = ({
|
|
|
88
94
|
response.data.statusCode === 200 ? succesResponse : errorResponse
|
|
89
95
|
);
|
|
90
96
|
setCurrentObservation(material !== "" ? "high" : "low");
|
|
91
|
-
|
|
97
|
+
hideObservation();
|
|
92
98
|
return response;
|
|
93
99
|
} catch (err) {
|
|
94
100
|
console.log(err);
|
|
@@ -14,7 +14,9 @@ export const ProductNameHeader = ({
|
|
|
14
14
|
productObservation,
|
|
15
15
|
dataProduct,
|
|
16
16
|
isObservationVisible,
|
|
17
|
-
toggleObservation
|
|
17
|
+
toggleObservation,
|
|
18
|
+
handleClickOutside,
|
|
19
|
+
hideObservation
|
|
18
20
|
}) => {
|
|
19
21
|
const typeFlag =
|
|
20
22
|
productObservation !== null && productObservation !== "" ? "high" : "low";
|
|
@@ -34,6 +36,8 @@ toggleObservation
|
|
|
34
36
|
dataProduct={dataProduct}
|
|
35
37
|
isObservationVisible ={isObservationVisible}
|
|
36
38
|
toggleObservation = {toggleObservation}
|
|
39
|
+
handleClickOutside = {handleClickOutside}
|
|
40
|
+
hideObservation={hideObservation}
|
|
37
41
|
/>
|
|
38
42
|
<ScreenHeader headerType={"date-header"} text={date} />
|
|
39
43
|
</Container>
|
|
@@ -19,7 +19,9 @@ export const FullProductNameHeader = ({
|
|
|
19
19
|
showApproveRejectAll,
|
|
20
20
|
productObservation,
|
|
21
21
|
isObservationVisible,
|
|
22
|
-
toggleObservation
|
|
22
|
+
toggleObservation,
|
|
23
|
+
handleClickOutside,
|
|
24
|
+
hideObservation
|
|
23
25
|
}) => {
|
|
24
26
|
const [retailers, setRetailers] = useState([]);
|
|
25
27
|
|
|
@@ -60,6 +62,9 @@ export const FullProductNameHeader = ({
|
|
|
60
62
|
dataProduct={headerData}
|
|
61
63
|
isObservationVisible ={isObservationVisible}
|
|
62
64
|
toggleObservation = {toggleObservation}
|
|
65
|
+
handleClickOutside ={handleClickOutside}
|
|
66
|
+
hideObservation={hideObservation}
|
|
67
|
+
|
|
63
68
|
/>
|
|
64
69
|
<div className="features-bar-container">
|
|
65
70
|
<FeaturesBar
|
|
@@ -236,7 +236,26 @@ export const RetailerProductEdition = ({
|
|
|
236
236
|
const toggleObservation = () => {
|
|
237
237
|
setObservationVisible(!isObservationVisible);
|
|
238
238
|
};
|
|
239
|
+
const handleClickOutside = (event) => {
|
|
240
|
+
if (
|
|
241
|
+
isObservationVisible &&
|
|
242
|
+
!event.target.closest(".Observation") &&
|
|
243
|
+
!event.target.closest(".Container")
|
|
244
|
+
) {
|
|
245
|
+
hideObservation();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
239
248
|
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
document.addEventListener("click", handleClickOutside);
|
|
251
|
+
return () => {
|
|
252
|
+
document.removeEventListener("click", handleClickOutside);
|
|
253
|
+
};
|
|
254
|
+
}, [isObservationVisible]);
|
|
255
|
+
|
|
256
|
+
const hideObservation = () => {
|
|
257
|
+
setObservationVisible(false);
|
|
258
|
+
};
|
|
240
259
|
|
|
241
260
|
useEffect(async () => {
|
|
242
261
|
const { id_article } = product?.article || {};
|
|
@@ -1371,6 +1390,8 @@ export const RetailerProductEdition = ({
|
|
|
1371
1390
|
}}
|
|
1372
1391
|
isObservationVisible={isObservationVisible}
|
|
1373
1392
|
toggleObservation={toggleObservation}
|
|
1393
|
+
handleClickOutside={handleClickOutside}
|
|
1394
|
+
hideObservation={hideObservation}
|
|
1374
1395
|
/>
|
|
1375
1396
|
<FullTabsMenu
|
|
1376
1397
|
tabsSections={tabsSections}
|