@orderingstack/front-components-product-configurator 1.4.2-beta.35 → 1.4.2-beta.37
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/MenuProduct/useMenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +23 -13
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -1
package/dist/index.es.js
CHANGED
|
@@ -9051,15 +9051,30 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9051
9051
|
}
|
|
9052
9052
|
});
|
|
9053
9053
|
const handleCounterIncrementQty = () => {
|
|
9054
|
+
var _a2, _b;
|
|
9054
9055
|
setValue(`selected.${selCtx}.${id}`, `${valueNumber + 1}`);
|
|
9056
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
9057
|
+
var _a3;
|
|
9058
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
9059
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
9060
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
9061
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${valueNumber + 1}`);
|
|
9062
|
+
});
|
|
9055
9063
|
};
|
|
9056
9064
|
const handleCounterDecrementQty = () => {
|
|
9057
|
-
var _a2, _b;
|
|
9065
|
+
var _a2, _b, _c, _d;
|
|
9058
9066
|
const decrementedValue = valueNumber - 1;
|
|
9059
9067
|
setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
|
|
9068
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
9069
|
+
var _a3;
|
|
9070
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
9071
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
9072
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
9073
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${decrementedValue}`);
|
|
9074
|
+
});
|
|
9060
9075
|
if (isCheckbox && decrementedValue === 0) {
|
|
9061
9076
|
setValue(`selected.${selCtx}.${id}`, false);
|
|
9062
|
-
(
|
|
9077
|
+
(_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
|
|
9063
9078
|
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
9064
9079
|
const cnt = getValues(formPath) || 0;
|
|
9065
9080
|
if (cnt < 2) {
|
|
@@ -9085,8 +9100,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9085
9100
|
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
9086
9101
|
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
9087
9102
|
const fltCtxPath = `filter.${fltCtx}`;
|
|
9088
|
-
(
|
|
9089
|
-
var _a3, _b2,
|
|
9103
|
+
(_d = Object.keys(emit)) == null ? void 0 : _d.forEach((emitKey) => {
|
|
9104
|
+
var _a3, _b2, _c2;
|
|
9090
9105
|
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
9091
9106
|
if (groupValue) {
|
|
9092
9107
|
if (groupValue > 1) {
|
|
@@ -9105,7 +9120,7 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9105
9120
|
if (!sameKeyOtherGroup) {
|
|
9106
9121
|
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9107
9122
|
} else {
|
|
9108
|
-
const newValue = (
|
|
9123
|
+
const newValue = (_c2 = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c2.value;
|
|
9109
9124
|
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
9110
9125
|
}
|
|
9111
9126
|
}
|
|
@@ -9120,15 +9135,12 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
|
9120
9135
|
const {
|
|
9121
9136
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
9122
9137
|
} = e2;
|
|
9123
|
-
|
|
9124
|
-
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
9125
|
-
}
|
|
9138
|
+
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
9126
9139
|
if (isRadio) {
|
|
9127
9140
|
console.log("handleOnInputChange radio", selCtx2, productId);
|
|
9128
9141
|
const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
|
|
9129
9142
|
for (const key of Object.keys(selected || {})) {
|
|
9130
9143
|
const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
|
|
9131
|
-
console.log("isImportantItem", isItemToClear);
|
|
9132
9144
|
if (isItemToClear) {
|
|
9133
9145
|
setValue(`selected.${key}`, false);
|
|
9134
9146
|
}
|
|
@@ -11029,7 +11041,6 @@ const MenuProductRoot = (props) => {
|
|
|
11029
11041
|
parentProduct: product,
|
|
11030
11042
|
rootProduct: product
|
|
11031
11043
|
}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
11032
|
-
console.log("MenuProductRootUI CHECK", MenuProductRootUI);
|
|
11033
11044
|
if (MenuProductRootUI) {
|
|
11034
11045
|
return /* @__PURE__ */ jsx(MenuProductRootUI, {
|
|
11035
11046
|
...props,
|
|
@@ -11104,8 +11115,7 @@ function ProductConfigurator(props) {
|
|
|
11104
11115
|
defaultValues: {
|
|
11105
11116
|
selected: initSelected,
|
|
11106
11117
|
filter: initFilter
|
|
11107
|
-
}
|
|
11108
|
-
shouldUnregister: false
|
|
11118
|
+
}
|
|
11109
11119
|
});
|
|
11110
11120
|
const {
|
|
11111
11121
|
getValues
|
|
@@ -11175,5 +11185,5 @@ function ProductConfigurator(props) {
|
|
|
11175
11185
|
})
|
|
11176
11186
|
});
|
|
11177
11187
|
}
|
|
11178
|
-
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, validateProductFilter };
|
|
11188
|
+
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, useStore, validateProductFilter };
|
|
11179
11189
|
//# sourceMappingURL=index.es.js.map
|