contentoh-components-library 21.4.53 → 21.4.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/dist/components/molecules/TagAndInput/index.js +63 -2
- package/dist/components/organisms/Box/index.js +5 -17
- package/dist/components/organisms/InputGroup/index.js +4 -0
- package/dist/components/pages/ProviderProductEdition/index.js +4 -3
- package/package.json +1 -1
- package/src/components/molecules/TagAndInput/index.js +42 -0
- package/src/components/organisms/Box/index.js +0 -7
- package/src/components/organisms/InputGroup/index.js +5 -1
- package/src/components/pages/ProviderProductEdition/index.js +1 -1
- package/src/components/pages/ProviderProductEdition/out.json +0 -0
- package/src/components/pages/ProviderProductEdition/outTHD.json +0 -0
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.TagAndInput = void 0;
|
|
7
9
|
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
8
14
|
var _styles = require("./styles");
|
|
9
15
|
|
|
10
16
|
var _index = require("../../atoms/ScreenHeader/index");
|
|
11
17
|
|
|
12
18
|
var _index2 = require("../../atoms/GeneralInput/index");
|
|
13
19
|
|
|
20
|
+
var _react = require("react");
|
|
21
|
+
|
|
14
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
23
|
|
|
16
24
|
var TagAndInput = function TagAndInput(_ref) {
|
|
@@ -39,7 +47,47 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
39
47
|
disabled = _ref.disabled,
|
|
40
48
|
onKeyDown = _ref.onKeyDown,
|
|
41
49
|
showTooltip = _ref.showTooltip,
|
|
42
|
-
auditClass = _ref.auditClass
|
|
50
|
+
auditClass = _ref.auditClass,
|
|
51
|
+
onChange = _ref.onChange,
|
|
52
|
+
dataInputs = _ref.dataInputs,
|
|
53
|
+
inputGroup = _ref.inputGroup,
|
|
54
|
+
boxOnboardingData = _ref.boxOnboardingData;
|
|
55
|
+
|
|
56
|
+
var _useState = (0, _react.useState)(boxOnboardingData || []),
|
|
57
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
58
|
+
boxOnboardingList = _useState2[0],
|
|
59
|
+
setBoxOnboardingList = _useState2[1];
|
|
60
|
+
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
var temp = {};
|
|
63
|
+
var maxBoxId = 0;
|
|
64
|
+
inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.inputs.forEach(function (attrId) {
|
|
65
|
+
if (!dataInputs[attrId].box) return;
|
|
66
|
+
Object.entries(dataInputs[attrId].box).forEach(function (_ref2) {
|
|
67
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
68
|
+
boxId = _ref3[0],
|
|
69
|
+
value = _ref3[1];
|
|
70
|
+
|
|
71
|
+
if (boxId > maxBoxId) maxBoxId = boxId;
|
|
72
|
+
if (!temp[boxId]) temp[boxId] = {};
|
|
73
|
+
temp[boxId][attrId] = value;
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
var tempList = Object.values(temp);
|
|
77
|
+
|
|
78
|
+
if (tempList.length > 0) {
|
|
79
|
+
setBoxOnboardingList(tempList.map(function (value, index) {
|
|
80
|
+
return index === tempList.length - 1 ? {
|
|
81
|
+
value: value
|
|
82
|
+
} : {
|
|
83
|
+
value: value
|
|
84
|
+
};
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
}, []);
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
89
|
+
onChange && onChange(boxOnboardingList);
|
|
90
|
+
}, [boxOnboardingList]);
|
|
43
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
44
92
|
inputType: inputType,
|
|
45
93
|
className: "input-container",
|
|
@@ -76,7 +124,20 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
76
124
|
description: description,
|
|
77
125
|
inputOnChange: inputOnChange,
|
|
78
126
|
onKeyDown: onKeyDown,
|
|
79
|
-
auditClass: auditClass
|
|
127
|
+
auditClass: auditClass,
|
|
128
|
+
onChange: function onChange(e) {
|
|
129
|
+
setBoxOnboardingList(function (prev) {
|
|
130
|
+
return prev.map(function (box, i) {
|
|
131
|
+
if (i != index) {
|
|
132
|
+
return box;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, box), {}, {
|
|
136
|
+
value: e
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
80
141
|
})]
|
|
81
142
|
}, "generalTagInput-".concat(inputType));
|
|
82
143
|
};
|
|
@@ -37,18 +37,13 @@ var Box = function Box(_ref) {
|
|
|
37
37
|
isDeleteDisabled = _useState2[0],
|
|
38
38
|
setIsDeleteDisabled = _useState2[1];
|
|
39
39
|
|
|
40
|
-
var _useState3 = (0, _react.useState)(
|
|
41
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
42
|
-
isEditEnabled = _useState4[0],
|
|
43
|
-
setIsEditEnabled = _useState4[1];
|
|
44
|
-
|
|
45
|
-
var _useState5 = (0, _react.useState)([{
|
|
40
|
+
var _useState3 = (0, _react.useState)([{
|
|
46
41
|
showAdd: true,
|
|
47
42
|
value: {}
|
|
48
43
|
}]),
|
|
49
|
-
|
|
50
|
-
boxOnboardingList =
|
|
51
|
-
setBoxOnboardingList =
|
|
44
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
45
|
+
boxOnboardingList = _useState4[0],
|
|
46
|
+
setBoxOnboardingList = _useState4[1];
|
|
52
47
|
|
|
53
48
|
(0, _react.useEffect)(function () {
|
|
54
49
|
var temp = {};
|
|
@@ -97,10 +92,6 @@ var Box = function Box(_ref) {
|
|
|
97
92
|
}
|
|
98
93
|
};
|
|
99
94
|
|
|
100
|
-
var handleToggleEdit = function handleToggleEdit() {
|
|
101
|
-
setIsEditEnabled(!isEditEnabled);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
95
|
(0, _react.useEffect)(function () {
|
|
105
96
|
onChange && onChange(boxOnboardingList);
|
|
106
97
|
}, [boxOnboardingList]);
|
|
@@ -122,7 +113,6 @@ var Box = function Box(_ref) {
|
|
|
122
113
|
data: boxOnboarding.value,
|
|
123
114
|
dataInputs: dataInputs,
|
|
124
115
|
inputs: inputGroup.inputs,
|
|
125
|
-
isEditEnabled: isEditEnabled,
|
|
126
116
|
onChange: function onChange(e) {
|
|
127
117
|
setBoxOnboardingList(function (prev) {
|
|
128
118
|
return prev.map(function (box, i) {
|
|
@@ -143,9 +133,7 @@ var Box = function Box(_ref) {
|
|
|
143
133
|
onDelete: function onDelete() {
|
|
144
134
|
return handleDeleteBoxOnboarding(index);
|
|
145
135
|
},
|
|
146
|
-
isDeleteDisabled: isDeleteDisabled
|
|
147
|
-
onToggleEdit: handleToggleEdit,
|
|
148
|
-
isEditEnabled: isEditEnabled
|
|
136
|
+
isDeleteDisabled: isDeleteDisabled
|
|
149
137
|
}, index)]
|
|
150
138
|
})
|
|
151
139
|
});
|
|
@@ -92,6 +92,7 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
92
92
|
// }
|
|
93
93
|
// }, [showBox]);
|
|
94
94
|
|
|
95
|
+
console.log("dataInputs", dataInputs);
|
|
95
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
96
97
|
children: [inputGroup.groupId === "16" && (activeRetailer === null || activeRetailer === void 0 ? void 0 : (_activeRetailer$retai3 = activeRetailer.retailer) === null || _activeRetailer$retai3 === void 0 ? void 0 : _activeRetailer$retai3.id) === 68 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
97
98
|
className: activeSection === "Ficha técnica" ? "datasheets-layout" : "descriptions-layout",
|
|
@@ -178,6 +179,9 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
178
179
|
optionList: (_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.option_list,
|
|
179
180
|
description: (_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.description,
|
|
180
181
|
showTooltip: true,
|
|
182
|
+
inputGroup: inputGroup,
|
|
183
|
+
dataInputs: dataInputs,
|
|
184
|
+
onChange: setUpdatedBoxData,
|
|
181
185
|
auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
|
|
182
186
|
}, index + "-" + ((_dataInputs$input13 = dataInputs[input]) === null || _dataInputs$input13 === void 0 ? void 0 : _dataInputs$input13.value) + "-" + ((_dataInputs$input14 = dataInputs[input]) === null || _dataInputs$input14 === void 0 ? void 0 : _dataInputs$input14.id) + "-" + compare)
|
|
183
187
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
@@ -1240,11 +1240,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1240
1240
|
});
|
|
1241
1241
|
});
|
|
1242
1242
|
});
|
|
1243
|
-
dataObject = {
|
|
1243
|
+
dataObject = (0, _objectSpread3.default)({
|
|
1244
1244
|
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1245
|
-
articleData: updatedDatasheets
|
|
1245
|
+
articleData: updatedDatasheets
|
|
1246
|
+
}, parseBoxData.length > 0 && {
|
|
1246
1247
|
boxData: parseBoxData
|
|
1247
|
-
};
|
|
1248
|
+
});
|
|
1248
1249
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1249
1250
|
_context12.prev = 4;
|
|
1250
1251
|
_context12.next = 7;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
3
3
|
import { GeneralInput } from "../../atoms/GeneralInput/index";
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
4
5
|
|
|
5
6
|
export const TagAndInput = ({
|
|
6
7
|
inputType,
|
|
@@ -29,7 +30,38 @@ export const TagAndInput = ({
|
|
|
29
30
|
onKeyDown,
|
|
30
31
|
showTooltip,
|
|
31
32
|
auditClass,
|
|
33
|
+
onChange,
|
|
34
|
+
dataInputs,
|
|
35
|
+
inputGroup,
|
|
36
|
+
boxOnboardingData,
|
|
32
37
|
}) => {
|
|
38
|
+
const [boxOnboardingList, setBoxOnboardingList] = useState(boxOnboardingData || []);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const temp = {};
|
|
42
|
+
let maxBoxId = 0;
|
|
43
|
+
inputGroup?.inputs.forEach((attrId) => {
|
|
44
|
+
if (!dataInputs[attrId].box) return;
|
|
45
|
+
Object.entries(dataInputs[attrId].box).forEach(([boxId, value]) => {
|
|
46
|
+
if (boxId > maxBoxId) maxBoxId = boxId;
|
|
47
|
+
if (!temp[boxId]) temp[boxId] = {};
|
|
48
|
+
temp[boxId][attrId] = value;
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const tempList = Object.values(temp);
|
|
52
|
+
if (tempList.length > 0) {
|
|
53
|
+
setBoxOnboardingList(
|
|
54
|
+
tempList.map((value, index) =>
|
|
55
|
+
index === tempList.length - 1 ? {value } : { value }
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
onChange && onChange(boxOnboardingList);
|
|
63
|
+
}, [boxOnboardingList]);
|
|
64
|
+
|
|
33
65
|
return (
|
|
34
66
|
<Container
|
|
35
67
|
inputType={inputType}
|
|
@@ -70,6 +102,16 @@ export const TagAndInput = ({
|
|
|
70
102
|
inputOnChange={inputOnChange}
|
|
71
103
|
onKeyDown={onKeyDown}
|
|
72
104
|
auditClass={auditClass}
|
|
105
|
+
onChange={(e) => {
|
|
106
|
+
setBoxOnboardingList((prev) => {
|
|
107
|
+
return prev.map((box, i) => {
|
|
108
|
+
if (i != index) {
|
|
109
|
+
return box;
|
|
110
|
+
}
|
|
111
|
+
return { ...box, value: e };
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}}
|
|
73
115
|
/>
|
|
74
116
|
</Container>
|
|
75
117
|
);
|
|
@@ -6,7 +6,6 @@ import { BoxButtons } from "../../molecules/BoxButtons";
|
|
|
6
6
|
|
|
7
7
|
export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
8
8
|
const [isDeleteDisabled, setIsDeleteDisabled] = useState(true);
|
|
9
|
-
const [isEditEnabled, setIsEditEnabled] = useState(false);
|
|
10
9
|
const [boxOnboardingList, setBoxOnboardingList] = useState([
|
|
11
10
|
{
|
|
12
11
|
showAdd: true,
|
|
@@ -53,9 +52,6 @@ export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
|
53
52
|
setIsDeleteDisabled(true);
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
|
-
const handleToggleEdit = () => {
|
|
57
|
-
setIsEditEnabled(!isEditEnabled);
|
|
58
|
-
};
|
|
59
55
|
|
|
60
56
|
useEffect(() => {
|
|
61
57
|
onChange && onChange(boxOnboardingList);
|
|
@@ -79,7 +75,6 @@ export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
|
79
75
|
data={boxOnboarding.value}
|
|
80
76
|
dataInputs={dataInputs}
|
|
81
77
|
inputs={inputGroup.inputs}
|
|
82
|
-
isEditEnabled={isEditEnabled}
|
|
83
78
|
onChange={(e) => {
|
|
84
79
|
setBoxOnboardingList((prev) => {
|
|
85
80
|
return prev.map((box, i) => {
|
|
@@ -98,8 +93,6 @@ export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
|
98
93
|
onAdd={handleAddBoxOnboarding}
|
|
99
94
|
onDelete={() => handleDeleteBoxOnboarding(index)}
|
|
100
95
|
isDeleteDisabled={isDeleteDisabled}
|
|
101
|
-
onToggleEdit={handleToggleEdit}
|
|
102
|
-
isEditEnabled={isEditEnabled}
|
|
103
96
|
/>
|
|
104
97
|
</div>
|
|
105
98
|
</>
|
|
@@ -60,6 +60,7 @@ export const InputGroup = ({
|
|
|
60
60
|
// console.log("showBox es false");
|
|
61
61
|
// }
|
|
62
62
|
// }, [showBox]);
|
|
63
|
+
console.log("dataInputs",dataInputs);
|
|
63
64
|
|
|
64
65
|
return (
|
|
65
66
|
<>
|
|
@@ -228,6 +229,9 @@ export const InputGroup = ({
|
|
|
228
229
|
optionList={dataInputs[input]?.option_list}
|
|
229
230
|
description={dataInputs[input]?.description}
|
|
230
231
|
showTooltip={true}
|
|
232
|
+
inputGroup={inputGroup}
|
|
233
|
+
dataInputs={dataInputs}
|
|
234
|
+
onChange={setUpdatedBoxData}
|
|
231
235
|
auditClass={
|
|
232
236
|
compare &&
|
|
233
237
|
!isEquals(dataInputs[input].value, auditInputs[input].value)
|
|
@@ -270,4 +274,4 @@ export const InputGroup = ({
|
|
|
270
274
|
)}
|
|
271
275
|
</>
|
|
272
276
|
);
|
|
273
|
-
|
|
277
|
+
}
|
|
@@ -699,7 +699,7 @@ export const ProviderProductEdition = ({
|
|
|
699
699
|
const dataObject = {
|
|
700
700
|
articleId: product?.id_article,
|
|
701
701
|
articleData: updatedDatasheets,
|
|
702
|
-
boxData: parseBoxData,
|
|
702
|
+
...(parseBoxData.length > 0 && { boxData: parseBoxData }),
|
|
703
703
|
};
|
|
704
704
|
|
|
705
705
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
File without changes
|
|
File without changes
|