@orderingstack/front-components-product-configurator 1.4.2-beta.27 → 1.4.2-beta.29

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.es.js CHANGED
@@ -8998,6 +8998,25 @@ const selectUnselectProduct = (setValue, getValues, product, isChecked, unregist
8998
8998
  }
8999
8999
  }
9000
9000
  };
9001
+ const findProductInParentProductBySelCtx = (parent, selCtx) => {
9002
+ var _a;
9003
+ if (!parent.items || isEmpty(parent.items)) {
9004
+ return null;
9005
+ }
9006
+ for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
9007
+ const prod = parent.items[i2];
9008
+ if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
9009
+ return prod;
9010
+ }
9011
+ if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
9012
+ const found = findProductInParentProductBySelCtx(prod, selCtx);
9013
+ if (found) {
9014
+ return found;
9015
+ }
9016
+ }
9017
+ }
9018
+ return null;
9019
+ };
9001
9020
  function useMenuProduct(product, parentAttrs, nestedLvl) {
9002
9021
  var _a;
9003
9022
  const { id, selCtx, emit = {}, fltCtx } = product;
@@ -9096,6 +9115,11 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
9096
9115
  const {
9097
9116
  target: { checked, name: selCtx2, defaultValue: productId }
9098
9117
  } = e2;
9118
+ for (const key of Object.keys(selected || {})) {
9119
+ if (isRadio && key !== (product == null ? void 0 : product.selCtx) && (key == null ? void 0 : key.includes(product.selCtx)) && findProductInParentProductBySelCtx(product, key)) {
9120
+ setValue(`selected.${key}`, false);
9121
+ }
9122
+ }
9099
9123
  selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
9100
9124
  if (isRadio) {
9101
9125
  console.log("handleOnInputChange radio", selCtx2, productId);