@orderingstack/front-components-product-configurator 1.7.0-beta.1 → 1.7.0-beta.2
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/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +10 -10
- package/dist/index.es.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6309,9 +6309,9 @@ const isGroupBucketCase = (group) => {
|
|
|
6309
6309
|
return false;
|
|
6310
6310
|
};
|
|
6311
6311
|
const getGroupBucketSecondChildrenValues = (group, fistProductId, fistProductValue) => {
|
|
6312
|
-
var _a, _b;
|
|
6313
|
-
const otherValue = Number((_a = group == null ? void 0 : group.attrs) == null ? void 0 : _a.qtyMax) - fistProductValue
|
|
6314
|
-
const otherProduct = (
|
|
6312
|
+
var _a, _b, _c;
|
|
6313
|
+
const otherValue = Number((_a = group == null ? void 0 : group.attrs) == null ? void 0 : _a.qtyMax) - fistProductValue < 0 ? false : `${Number((_b = group == null ? void 0 : group.attrs) == null ? void 0 : _b.qtyMax) - fistProductValue}`;
|
|
6314
|
+
const otherProduct = (_c = group == null ? void 0 : group.items) == null ? void 0 : _c.find((x2) => (x2 == null ? void 0 : x2.id) !== fistProductId);
|
|
6315
6315
|
return {
|
|
6316
6316
|
product: otherProduct,
|
|
6317
6317
|
value: otherValue
|
|
@@ -6332,7 +6332,7 @@ const getGroupBucketSecondChildrenValuesInputChange = (group, clickedProductId,
|
|
|
6332
6332
|
if (isSecondProductInState) {
|
|
6333
6333
|
return {
|
|
6334
6334
|
clickedProductValue: "1",
|
|
6335
|
-
secondProductValue: `${Number(qtyMax) - 1}`,
|
|
6335
|
+
secondProductValue: Number(qtyMax) - 1 < 0 ? false : `${Number(qtyMax) - 1}`,
|
|
6336
6336
|
secondProduct
|
|
6337
6337
|
};
|
|
6338
6338
|
}
|
|
@@ -9017,8 +9017,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9017
9017
|
const isBucketCase2 = isGroupBucketCase(parentPriduct);
|
|
9018
9018
|
if (isBucketCase2) {
|
|
9019
9019
|
const { product: secondProduct, value: secondProductValue } = getGroupBucketSecondChildrenValues(parentPriduct, id, valueNumber + 1);
|
|
9020
|
-
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`,
|
|
9021
|
-
if (secondProductValue === 0) {
|
|
9020
|
+
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`, secondProductValue);
|
|
9021
|
+
if (secondProductValue === "0" || secondProductValue === false) {
|
|
9022
9022
|
selectUnselectProduct(setValue, getValues, secondProduct, false, unregister, nestedLvl);
|
|
9023
9023
|
}
|
|
9024
9024
|
}
|
|
@@ -9038,8 +9038,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9038
9038
|
setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
|
|
9039
9039
|
if (isBucketCase) {
|
|
9040
9040
|
const { product: secondProduct, value: secondProductValue } = getGroupBucketSecondChildrenValues(parentPriduct, id, decrementedValue);
|
|
9041
|
-
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`,
|
|
9042
|
-
if (secondProductValue === 1) {
|
|
9041
|
+
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`, secondProductValue);
|
|
9042
|
+
if (secondProductValue === "1") {
|
|
9043
9043
|
selectUnselectProduct(setValue, getValues, secondProduct, true, unregister, nestedLvl);
|
|
9044
9044
|
}
|
|
9045
9045
|
}
|
|
@@ -9118,8 +9118,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9118
9118
|
if (isBucketCase) {
|
|
9119
9119
|
const { clickedProductValue, secondProductValue, secondProduct } = getGroupBucketSecondChildrenValuesInputChange(parentPriduct, id, checked, selected);
|
|
9120
9120
|
console.log("handleOnInputChange clickedProductValue", clickedProductValue, secondProductValue);
|
|
9121
|
-
setValue(`selected.${product == null ? void 0 : product.selCtx}.${product == null ? void 0 : product.id}`, clickedProductValue
|
|
9122
|
-
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`, secondProductValue
|
|
9121
|
+
setValue(`selected.${product == null ? void 0 : product.selCtx}.${product == null ? void 0 : product.id}`, clickedProductValue);
|
|
9122
|
+
setValue(`selected.${secondProduct == null ? void 0 : secondProduct.selCtx}.${secondProduct == null ? void 0 : secondProduct.id}`, secondProductValue);
|
|
9123
9123
|
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
9124
9124
|
selectUnselectProduct(setValue, getValues, secondProduct, secondProductValue !== false, unregister, nestedLvl);
|
|
9125
9125
|
return;
|