All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.components.Layout.InfoScreen.InfoScreen.tsx Maven / Gradle / Ivy

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, {ClayCheckbox} from '@clayui/form';
import {
	Card,
	Input,
	constantsUtils,
	invalidateRequired,
	stringUtils,
} from '@liferay/object-js-components-web';
import React from 'react';

import {defaultLanguageId} from '../../../utils/constants';
import {TYPES, useLayoutContext} from '../objectLayoutContext';

const InfoScreen: React.FC> = () => {
	const [{creationLanguageId, isViewOnly, objectLayout}, dispatch] =
		useLayoutContext();

	let error: string | undefined;

	if (
		invalidateRequired(
			stringUtils.getLocalizableLabel({
				fallbackLanguageId:
					creationLanguageId as Liferay.Language.Locale,
				labels: objectLayout.name,
			})
		)
	) {
		error = constantsUtils.REQUIRED_MSG;
	}

	return (
		
			 {
					dispatch({
						payload: {name: {[defaultLanguageId]: value}},
						type: TYPES.CHANGE_OBJECT_LAYOUT_NAME,
					});
				}}
				required
				value={stringUtils.getLocalizableLabel({
					fallbackLanguageId:
						creationLanguageId as Liferay.Language.Locale,
					labels: objectLayout.name,
				})}
			/>

			
				 {
						dispatch({
							payload: {checked},
							type: TYPES.SET_OBJECT_LAYOUT_AS_DEFAULT,
						});
					}}
				/>
			
		
	);
};

export default InfoScreen;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy