META-INF.resources.js.components.Form.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.shop.by.diagram.web
Show all versions of com.liferay.commerce.shop.by.diagram.web
Liferay Commerce Shop by Diagram Web
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
import ClayForm, {ClayInput} from '@clayui/form';
import {AutocompleteComponent} from 'commerce-frontend-js';
import React from 'react';
export function LinkedToCatalogProductFormGroup({updateValue, value}) {
const initialValue = value ? {...value} : null;
if (initialValue && initialValue.skuId) {
initialValue.productId = initialValue.skuId;
}
return (
{
if (
(!productId && initialValue) ||
(!initialValue && productId) ||
(initialValue && productId !== initialValue.productId)
) {
updateValue(skuProduct);
}
}}
pageSize={10}
/>
);
}
export function LinkedToDiagramFormGroup({updateValue, value}) {
const initialValue = value ? {...value} : null;
if (initialValue && !initialValue.name) {
initialValue.name = initialValue.productName;
}
return (
{
if (
(!productId && initialValue) ||
(!initialValue && productId) ||
(initialValue && productId !== initialValue.productId)
) {
updateValue(product);
}
}}
pageSize={10}
/>
);
}
export function LinkedToExternalProductFormGroup({updateValue, value}) {
return (
updateValue({sku: event.target.value})}
value={value?.sku || ''}
/>
);
}