contentoh-components-library 21.6.20 → 21.6.22
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/InheritanceTag/index.js +15 -0
- package/dist/components/molecules/TagAndInput/index.js +3 -0
- package/dist/components/molecules/TagAndInputv2/index.js +3 -0
- package/dist/components/organisms/InputGroup/index.js +17 -16
- package/dist/components/organisms/LinkVariantsModal/index.js +4 -1
- package/package.json +1 -1
- package/src/components/atoms/InheritanceTag/index.js +13 -0
- package/src/components/molecules/TagAndInput/index.js +3 -0
- package/src/components/molecules/TagAndInputv2/index.js +3 -0
- package/src/components/organisms/InputGroup/index.js +1 -0
- package/src/components/organisms/LinkVariantsModal/index.js +6 -1
|
@@ -18,12 +18,25 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
* así que es el que lleva acento y el que ofrece la acción de volver a heredar.
|
|
19
19
|
* "Heredado" es el caso normal y se mantiene discreto: si gritara en cada campo,
|
|
20
20
|
* la ficha entera se volvería ruido.
|
|
21
|
+
*
|
|
22
|
+
* Un campo VACÍO no lleva marca: no heredó nada y tampoco tiene valor propio, así
|
|
23
|
+
* que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
|
|
24
|
+
* variante sale con el chip repetido en cada campo, incluidos los obligatorios en
|
|
25
|
+
* rojo que están sin capturar, y la marca deja de distinguir nada.
|
|
26
|
+
*
|
|
27
|
+
* Tampoco la lleva un atributo NO heredable. El UPC y el SKU son la identidad del
|
|
28
|
+
* producto: el servidor los excluye de link y propagate, así que pintarlos como
|
|
29
|
+
* "Propio" y ofrecer "Volver a heredar" daría un botón incapaz de hacer nada.
|
|
21
30
|
*/
|
|
22
31
|
var InheritanceTag = function InheritanceTag(_ref) {
|
|
23
32
|
var _ref$isVariant = _ref.isVariant,
|
|
24
33
|
isVariant = _ref$isVariant === void 0 ? false : _ref$isVariant,
|
|
25
34
|
_ref$isOverridden = _ref.isOverridden,
|
|
26
35
|
isOverridden = _ref$isOverridden === void 0 ? false : _ref$isOverridden,
|
|
36
|
+
_ref$hasValue = _ref.hasValue,
|
|
37
|
+
hasValue = _ref$hasValue === void 0 ? true : _ref$hasValue,
|
|
38
|
+
_ref$inheritable = _ref.inheritable,
|
|
39
|
+
inheritable = _ref$inheritable === void 0 ? true : _ref$inheritable,
|
|
27
40
|
parentUpc = _ref.parentUpc,
|
|
28
41
|
onRestore = _ref.onRestore,
|
|
29
42
|
_ref$restoreLabel = _ref.restoreLabel,
|
|
@@ -31,6 +44,8 @@ var InheritanceTag = function InheritanceTag(_ref) {
|
|
|
31
44
|
_ref$className = _ref.className,
|
|
32
45
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
33
46
|
if (!isVariant) return null;
|
|
47
|
+
if (!hasValue) return null;
|
|
48
|
+
if (!inheritable) return null;
|
|
34
49
|
var state = isOverridden ? "own" : "inherited";
|
|
35
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
36
51
|
className: "inheritance-tag ".concat(state, " ").concat(className),
|
|
@@ -79,6 +79,7 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
79
79
|
boxOnboardingData = _ref.boxOnboardingData,
|
|
80
80
|
isVariant = _ref.isVariant,
|
|
81
81
|
isOverridden = _ref.isOverridden,
|
|
82
|
+
inheritable = _ref.inheritable,
|
|
82
83
|
parentUpc = _ref.parentUpc,
|
|
83
84
|
onRestoreInheritance = _ref.onRestoreInheritance;
|
|
84
85
|
|
|
@@ -430,6 +431,8 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
430
431
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InheritanceTag.InheritanceTag, {
|
|
431
432
|
isVariant: isVariant,
|
|
432
433
|
isOverridden: isOverridden,
|
|
434
|
+
hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
|
|
435
|
+
inheritable: inheritable,
|
|
433
436
|
parentUpc: parentUpc,
|
|
434
437
|
onRestore: onRestoreInheritance ? function () {
|
|
435
438
|
return onRestoreInheritance(inputId);
|
|
@@ -48,6 +48,7 @@ var TagAndInputv2 = function TagAndInputv2(_ref) {
|
|
|
48
48
|
showMissingChars = _ref.showMissingChars,
|
|
49
49
|
isVariant = _ref.isVariant,
|
|
50
50
|
isOverridden = _ref.isOverridden,
|
|
51
|
+
inheritable = _ref.inheritable,
|
|
51
52
|
parentUpc = _ref.parentUpc,
|
|
52
53
|
onRestoreInheritance = _ref.onRestoreInheritance;
|
|
53
54
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
@@ -70,6 +71,8 @@ var TagAndInputv2 = function TagAndInputv2(_ref) {
|
|
|
70
71
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InheritanceTag.InheritanceTag, {
|
|
71
72
|
isVariant: isVariant,
|
|
72
73
|
isOverridden: isOverridden,
|
|
74
|
+
hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
|
|
75
|
+
inheritable: inheritable,
|
|
73
76
|
parentUpc: parentUpc,
|
|
74
77
|
onRestore: onRestoreInheritance ? function () {
|
|
75
78
|
return onRestoreInheritance(inputId);
|
|
@@ -185,7 +185,7 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
185
185
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
186
186
|
className: "inputs-container",
|
|
187
187
|
children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs = inputGroup.inputs) === null || _inputGroup$inputs === void 0 ? void 0 : _inputGroup$inputs.map(function (input, index) {
|
|
188
|
-
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _dataInputs$input23, _dataInputs$input24, _variant$parent, _auditInputGroup$inpu, _auditInputGroup$inpu2;
|
|
188
|
+
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _dataInputs$input23, _dataInputs$input24, _dataInputs$input25, _variant$parent, _auditInputGroup$inpu, _auditInputGroup$inpu2;
|
|
189
189
|
|
|
190
190
|
return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
191
191
|
className: ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.id) === 6700 || ((_dataInputs$input2 = dataInputs[input]) === null || _dataInputs$input2 === void 0 ? void 0 : _dataInputs$input2.id) === 6701 ? "inputs-validation-onboarding" : "inputs-validation",
|
|
@@ -217,6 +217,7 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
217
217
|
showTooltip: true,
|
|
218
218
|
isVariant: variant === null || variant === void 0 ? void 0 : variant.isVariant,
|
|
219
219
|
isOverridden: (_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.isOverridden,
|
|
220
|
+
inheritable: (_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.inheritable,
|
|
220
221
|
parentUpc: variant === null || variant === void 0 ? void 0 : (_variant$parent = variant.parent) === null || _variant$parent === void 0 ? void 0 : _variant$parent.upc,
|
|
221
222
|
onRestoreInheritance: onRestoreInheritance,
|
|
222
223
|
auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
|
|
@@ -261,35 +262,35 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
261
262
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
262
263
|
className: "inputs-container",
|
|
263
264
|
children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs2 = inputGroup.inputs) === null || _inputGroup$inputs2 === void 0 ? void 0 : _inputGroup$inputs2.map(function (input, index) {
|
|
264
|
-
var _dataInputs$
|
|
265
|
+
var _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _dataInputs$input33, _dataInputs$input34, _auditInputs$input2, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _dataInputs$input42, _dataInputs$input43, _dataInputs$input44, _dataInputs$input45, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
|
|
265
266
|
|
|
266
267
|
return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
267
268
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
268
269
|
//disabled={input === 40001}
|
|
269
|
-
disabled: (_dataInputs$
|
|
270
|
-
inputId: (_dataInputs$
|
|
270
|
+
disabled: (_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.isApproved,
|
|
271
|
+
inputId: (_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.id,
|
|
271
272
|
version: version,
|
|
272
|
-
inputType: inputTypeValue((_dataInputs$
|
|
273
|
-
label: ((_dataInputs$
|
|
274
|
-
value: (_dataInputs$
|
|
273
|
+
inputType: inputTypeValue((_dataInputs$input30 = dataInputs[input]) === null || _dataInputs$input30 === void 0 ? void 0 : _dataInputs$input30.type),
|
|
274
|
+
label: ((_dataInputs$input31 = dataInputs[input]) === null || _dataInputs$input31 === void 0 ? void 0 : _dataInputs$input31.name) + ((_dataInputs$input32 = dataInputs[input]) !== null && _dataInputs$input32 !== void 0 && _dataInputs$input32.required ? "*" : ""),
|
|
275
|
+
value: (_dataInputs$input33 = dataInputs[input]) !== null && _dataInputs$input33 !== void 0 && _dataInputs$input33.box ? Object.values((_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.value,
|
|
275
276
|
inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
|
|
276
277
|
articleId: articleId,
|
|
277
|
-
isRequired: (_dataInputs$
|
|
278
|
-
aiGenerated: (_dataInputs$
|
|
278
|
+
isRequired: (_dataInputs$input36 = dataInputs[input]) === null || _dataInputs$input36 === void 0 ? void 0 : _dataInputs$input36.required,
|
|
279
|
+
aiGenerated: (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.ai_generated,
|
|
279
280
|
updatedDatasheets: updatedDatasheets,
|
|
280
281
|
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
281
|
-
maxChar: (_dataInputs$
|
|
282
|
-
optionList: (_dataInputs$
|
|
283
|
-
description: (_dataInputs$
|
|
282
|
+
maxChar: (_dataInputs$input38 = dataInputs[input]) !== null && _dataInputs$input38 !== void 0 && _dataInputs$input38.max_chars ? (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.max_chars : 999,
|
|
283
|
+
optionList: (_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.option_list,
|
|
284
|
+
description: (_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.description,
|
|
284
285
|
showTooltip: true,
|
|
285
286
|
inputGroup: inputGroup,
|
|
286
287
|
dataInputs: dataInputs,
|
|
287
288
|
onChange: setUpdatedBoxData,
|
|
288
289
|
auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
|
|
289
|
-
}, index + "-" + ((_dataInputs$
|
|
290
|
-
inputId: (_dataInputs$
|
|
291
|
-
isApproved: (_dataInputs$
|
|
292
|
-
comment: (_dataInputs$
|
|
290
|
+
}, index + "-" + ((_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.value) + "-" + ((_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.id) + "-" + compare), ((_dataInputs$input42 = dataInputs[input]) === null || _dataInputs$input42 === void 0 ? void 0 : _dataInputs$input42.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
291
|
+
inputId: (_dataInputs$input43 = dataInputs[input]) === null || _dataInputs$input43 === void 0 ? void 0 : _dataInputs$input43.id,
|
|
292
|
+
isApproved: (_dataInputs$input44 = dataInputs[input]) === null || _dataInputs$input44 === void 0 ? void 0 : _dataInputs$input44.isApproved,
|
|
293
|
+
comment: (_dataInputs$input45 = dataInputs[input]) === null || _dataInputs$input45 === void 0 ? void 0 : _dataInputs$input45.comment,
|
|
293
294
|
handleImgClick: handleImgClick,
|
|
294
295
|
changeImageBtn: changeImageBtn,
|
|
295
296
|
showDivState: showDivStates,
|
|
@@ -605,7 +605,10 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
605
605
|
type: "button",
|
|
606
606
|
className: "primary",
|
|
607
607
|
onClick: submit,
|
|
608
|
-
disabled: loading ||
|
|
608
|
+
disabled: loading || // Solo estorba cuando hay algo que elegir y no se eligió nada.
|
|
609
|
+
// Con el padre sin atributos heredables, ligar sigue siendo
|
|
610
|
+
// válido: se heredan imágenes, descripciones y cadenas.
|
|
611
|
+
inheritMode === "selected" && attributes.length > 0 && !chosenAttributes.length,
|
|
609
612
|
children: loading ? "Ligando…" : "Ligar"
|
|
610
613
|
})]
|
|
611
614
|
})]
|
package/package.json
CHANGED
|
@@ -9,16 +9,29 @@ import { Container } from "./styles";
|
|
|
9
9
|
* así que es el que lleva acento y el que ofrece la acción de volver a heredar.
|
|
10
10
|
* "Heredado" es el caso normal y se mantiene discreto: si gritara en cada campo,
|
|
11
11
|
* la ficha entera se volvería ruido.
|
|
12
|
+
*
|
|
13
|
+
* Un campo VACÍO no lleva marca: no heredó nada y tampoco tiene valor propio, así
|
|
14
|
+
* que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
|
|
15
|
+
* variante sale con el chip repetido en cada campo, incluidos los obligatorios en
|
|
16
|
+
* rojo que están sin capturar, y la marca deja de distinguir nada.
|
|
17
|
+
*
|
|
18
|
+
* Tampoco la lleva un atributo NO heredable. El UPC y el SKU son la identidad del
|
|
19
|
+
* producto: el servidor los excluye de link y propagate, así que pintarlos como
|
|
20
|
+
* "Propio" y ofrecer "Volver a heredar" daría un botón incapaz de hacer nada.
|
|
12
21
|
*/
|
|
13
22
|
export const InheritanceTag = ({
|
|
14
23
|
isVariant = false,
|
|
15
24
|
isOverridden = false,
|
|
25
|
+
hasValue = true,
|
|
26
|
+
inheritable = true,
|
|
16
27
|
parentUpc,
|
|
17
28
|
onRestore,
|
|
18
29
|
restoreLabel = "Volver a heredar",
|
|
19
30
|
className = "",
|
|
20
31
|
}) => {
|
|
21
32
|
if (!isVariant) return null;
|
|
33
|
+
if (!hasValue) return null;
|
|
34
|
+
if (!inheritable) return null;
|
|
22
35
|
|
|
23
36
|
const state = isOverridden ? "own" : "inherited";
|
|
24
37
|
|
|
@@ -47,6 +47,7 @@ export const TagAndInput = ({
|
|
|
47
47
|
boxOnboardingData,
|
|
48
48
|
isVariant,
|
|
49
49
|
isOverridden,
|
|
50
|
+
inheritable,
|
|
50
51
|
parentUpc,
|
|
51
52
|
onRestoreInheritance,
|
|
52
53
|
}) => {
|
|
@@ -331,6 +332,8 @@ export const TagAndInput = ({
|
|
|
331
332
|
<InheritanceTag
|
|
332
333
|
isVariant={isVariant}
|
|
333
334
|
isOverridden={isOverridden}
|
|
335
|
+
hasValue={`${value ?? ""}`.trim() !== ""}
|
|
336
|
+
inheritable={inheritable}
|
|
334
337
|
parentUpc={parentUpc}
|
|
335
338
|
onRestore={
|
|
336
339
|
onRestoreInheritance
|
|
@@ -36,6 +36,7 @@ export const TagAndInputv2 = ({
|
|
|
36
36
|
showMissingChars,
|
|
37
37
|
isVariant,
|
|
38
38
|
isOverridden,
|
|
39
|
+
inheritable,
|
|
39
40
|
parentUpc,
|
|
40
41
|
onRestoreInheritance,
|
|
41
42
|
}) => {
|
|
@@ -63,6 +64,8 @@ export const TagAndInputv2 = ({
|
|
|
63
64
|
<InheritanceTag
|
|
64
65
|
isVariant={isVariant}
|
|
65
66
|
isOverridden={isOverridden}
|
|
67
|
+
hasValue={`${value ?? ""}`.trim() !== ""}
|
|
68
|
+
inheritable={inheritable}
|
|
66
69
|
parentUpc={parentUpc}
|
|
67
70
|
onRestore={
|
|
68
71
|
onRestoreInheritance
|
|
@@ -234,6 +234,7 @@ export const InputGroup = ({
|
|
|
234
234
|
showTooltip={true}
|
|
235
235
|
isVariant={variant?.isVariant}
|
|
236
236
|
isOverridden={dataInputs[input]?.isOverridden}
|
|
237
|
+
inheritable={dataInputs[input]?.inheritable}
|
|
237
238
|
parentUpc={variant?.parent?.upc}
|
|
238
239
|
onRestoreInheritance={onRestoreInheritance}
|
|
239
240
|
auditClass={
|
|
@@ -460,7 +460,12 @@ export const LinkVariantsModal = ({
|
|
|
460
460
|
onClick={submit}
|
|
461
461
|
disabled={
|
|
462
462
|
loading ||
|
|
463
|
-
|
|
463
|
+
// Solo estorba cuando hay algo que elegir y no se eligió nada.
|
|
464
|
+
// Con el padre sin atributos heredables, ligar sigue siendo
|
|
465
|
+
// válido: se heredan imágenes, descripciones y cadenas.
|
|
466
|
+
(inheritMode === "selected" &&
|
|
467
|
+
attributes.length > 0 &&
|
|
468
|
+
!chosenAttributes.length)
|
|
464
469
|
}
|
|
465
470
|
>
|
|
466
471
|
{loading ? "Ligando…" : "Ligar"}
|