contentoh-components-library 21.1.15 → 21.1.16
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.
|
@@ -60,15 +60,19 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
60
60
|
value: validateInput(evt, position, inputsArray)
|
|
61
61
|
});
|
|
62
62
|
} else if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
|
|
63
|
+
var generalValue;
|
|
64
|
+
|
|
63
65
|
if ((optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0) {
|
|
64
66
|
var index = evt.target.selectedIndex;
|
|
65
67
|
var valueSelected = evt.target.value;
|
|
68
|
+
generalValue = index > 0 ? valueSelected : undefined;
|
|
66
69
|
setTextValue({
|
|
67
|
-
value:
|
|
70
|
+
value: generalValue
|
|
68
71
|
});
|
|
69
72
|
} else {
|
|
73
|
+
generalValue = inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
70
74
|
setTextValue({
|
|
71
|
-
value:
|
|
75
|
+
value: generalValue
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -77,13 +81,13 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
77
81
|
articleId: articleId,
|
|
78
82
|
versionId: version,
|
|
79
83
|
attributeId: inputId,
|
|
80
|
-
value:
|
|
84
|
+
value: generalValue
|
|
81
85
|
});else if (dataSave.some(function (e) {
|
|
82
86
|
return e.attributeId === inputId;
|
|
83
87
|
})) {
|
|
84
88
|
dataSave.forEach(function (e) {
|
|
85
89
|
if (e.attributeId === inputId) {
|
|
86
|
-
e.value =
|
|
90
|
+
e.value = generalValue;
|
|
87
91
|
}
|
|
88
92
|
});
|
|
89
93
|
} else {
|
|
@@ -91,7 +95,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
91
95
|
articleId: articleId,
|
|
92
96
|
versionId: version,
|
|
93
97
|
attributeId: inputId,
|
|
94
|
-
value:
|
|
98
|
+
value: generalValue
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
101
|
setUpdatedDatasheets(dataSave);
|
|
@@ -111,18 +115,17 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
111
115
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
112
116
|
isRequired: requiredEmpty,
|
|
113
117
|
children: [(optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
114
|
-
id: "dropdown".concat(inputId)
|
|
115
|
-
,
|
|
118
|
+
id: "dropdown".concat(inputId),
|
|
116
119
|
onChange: function onChange(e) {
|
|
117
120
|
return onHandleChange(e);
|
|
118
121
|
},
|
|
122
|
+
defaultValue: textValue.value,
|
|
119
123
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
120
124
|
value: "",
|
|
121
125
|
children: description
|
|
122
126
|
}), JSON.parse(optionList || "[]").map(function (element, index) {
|
|
123
127
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
124
128
|
value: element,
|
|
125
|
-
defaultValue: element === textValue.value ? "selected" : "",
|
|
126
129
|
children: element
|
|
127
130
|
}, element + "-" + index);
|
|
128
131
|
})]
|
|
@@ -753,16 +753,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
753
753
|
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
754
754
|
articleData: updatedDatasheets
|
|
755
755
|
};
|
|
756
|
+
console.log(updatedDatasheets, "updatedDatasheets");
|
|
756
757
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
757
|
-
_context6.prev =
|
|
758
|
-
_context6.next =
|
|
758
|
+
_context6.prev = 5;
|
|
759
|
+
_context6.next = 8;
|
|
759
760
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
760
761
|
headers: {
|
|
761
762
|
Authorization: token
|
|
762
763
|
}
|
|
763
764
|
});
|
|
764
765
|
|
|
765
|
-
case
|
|
766
|
+
case 8:
|
|
766
767
|
setMessage("Fichas técnicas guardadas");
|
|
767
768
|
|
|
768
769
|
if (productTemp.status === "ASSIGNED") {
|
|
@@ -772,20 +773,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
772
773
|
}
|
|
773
774
|
|
|
774
775
|
loadData();
|
|
775
|
-
_context6.next =
|
|
776
|
+
_context6.next = 16;
|
|
776
777
|
break;
|
|
777
778
|
|
|
778
|
-
case
|
|
779
|
-
_context6.prev =
|
|
780
|
-
_context6.t0 = _context6["catch"](
|
|
779
|
+
case 13:
|
|
780
|
+
_context6.prev = 13;
|
|
781
|
+
_context6.t0 = _context6["catch"](5);
|
|
781
782
|
console.log(_context6.t0);
|
|
782
783
|
|
|
783
|
-
case
|
|
784
|
+
case 16:
|
|
784
785
|
case "end":
|
|
785
786
|
return _context6.stop();
|
|
786
787
|
}
|
|
787
788
|
}
|
|
788
|
-
}, _callee6, null, [[
|
|
789
|
+
}, _callee6, null, [[5, 13]]);
|
|
789
790
|
}));
|
|
790
791
|
|
|
791
792
|
return function saveDatasheets() {
|
package/package.json
CHANGED
|
@@ -38,30 +38,32 @@ export const GeneralInput = ({
|
|
|
38
38
|
updatedDescriptions ||
|
|
39
39
|
inputType === "textarea"
|
|
40
40
|
) {
|
|
41
|
+
let generalValue;
|
|
41
42
|
if (optionList?.length > 0) {
|
|
42
43
|
let index = evt.target.selectedIndex;
|
|
43
44
|
let valueSelected = evt.target.value;
|
|
44
|
-
|
|
45
|
+
generalValue = index > 0 ? valueSelected : undefined;
|
|
46
|
+
setTextValue({ value: generalValue });
|
|
45
47
|
} else {
|
|
48
|
+
generalValue =
|
|
49
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
46
50
|
setTextValue({
|
|
47
|
-
value:
|
|
48
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
51
|
+
value: generalValue,
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
let dataSave = updatedDatasheets?.slice();
|
|
55
|
+
|
|
52
56
|
if (dataSave.length === 0)
|
|
53
57
|
dataSave.push({
|
|
54
58
|
articleId: articleId,
|
|
55
59
|
versionId: version,
|
|
56
60
|
attributeId: inputId,
|
|
57
|
-
value:
|
|
58
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
61
|
+
value: generalValue,
|
|
59
62
|
});
|
|
60
63
|
else if (dataSave.some((e) => e.attributeId === inputId)) {
|
|
61
64
|
dataSave.forEach((e) => {
|
|
62
65
|
if (e.attributeId === inputId) {
|
|
63
|
-
e.value =
|
|
64
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
66
|
+
e.value = generalValue;
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
69
|
} else {
|
|
@@ -69,8 +71,7 @@ export const GeneralInput = ({
|
|
|
69
71
|
articleId: articleId,
|
|
70
72
|
versionId: version,
|
|
71
73
|
attributeId: inputId,
|
|
72
|
-
value:
|
|
73
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
74
|
+
value: generalValue,
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
setUpdatedDatasheets(dataSave);
|
|
@@ -93,16 +94,12 @@ export const GeneralInput = ({
|
|
|
93
94
|
<select
|
|
94
95
|
key={`dropdownK${inputId}`}
|
|
95
96
|
id={`dropdown${inputId}`}
|
|
96
|
-
//disabled={!enableInputs}
|
|
97
97
|
onChange={(e) => onHandleChange(e)}
|
|
98
|
+
defaultValue={textValue.value}
|
|
98
99
|
>
|
|
99
100
|
<option value="">{description}</option>
|
|
100
101
|
{JSON.parse(optionList || "[]").map((element, index) => (
|
|
101
|
-
<option
|
|
102
|
-
key={element + "-" + index}
|
|
103
|
-
value={element}
|
|
104
|
-
defaultValue={element === textValue.value ? "selected" : ""}
|
|
105
|
-
>
|
|
102
|
+
<option key={element + "-" + index} value={element}>
|
|
106
103
|
{element}
|
|
107
104
|
</option>
|
|
108
105
|
))}
|
|
@@ -424,6 +424,7 @@ export const RetailerProductEdition = ({
|
|
|
424
424
|
articleId: product?.article?.id_article,
|
|
425
425
|
articleData: updatedDatasheets,
|
|
426
426
|
};
|
|
427
|
+
console.log(updatedDatasheets, "updatedDatasheets");
|
|
427
428
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
428
429
|
try {
|
|
429
430
|
await axios.put(
|