
META-INF.resources.js.components.ObjectField.Tabs.BasicInfo.BasicInfoTab.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 {Input, SidebarCategory} from '@liferay/object-js-components-web';
import classNames from 'classnames';
import {ILearnResourceContext} from 'frontend-js-components-web';
import React, {ElementType, useState} from 'react';
import {AutoIncrementFormBase} from '../../AutoIncrementFormBase';
import {ObjectFieldErrors} from '../../ObjectFieldFormBase';
import {AggregationFilterContainer} from './AggregationFilterContainer';
import {BasicInfoContainer} from './BasicInfoContainer';
import {FormulaContainer} from './FormulaContainer';
import {SearchableContainer} from './SearchableContainer';
import {TranslationOptionsContainer} from './TranslationOptionsContainer';
export interface AggregationFilters {
defaultSort?: boolean;
fieldLabel?: string;
filterBy?: string;
filterType?: string;
label?: LocalizedValue;
objectFieldBusinessType?: string;
objectFieldName: string;
priority?: number;
sortOrder?: string;
type?: string;
value?: string;
valueList?: LabelValueObject[];
}
interface BasicInfoTabProps {
baseResourceURL: string;
containerWrapper: ElementType;
dbObjectFieldRequired?: boolean;
errors: ObjectFieldErrors;
filterOperators: TFilterOperators;
handleChange: React.ChangeEventHandler;
learnResources: ILearnResourceContext;
modelBuilder?: boolean;
objectDefinition?: ObjectDefinition;
objectFieldBusinessTypes: ObjectFieldBusinessType[];
objectRelationshipId: number;
onSubmit?: (editedObjectField?: Partial) => void;
readOnly: boolean;
setDbObjectFieldRequired?: (value: boolean) => void;
setValues: (values: Partial) => void;
sidebarElements: SidebarCategory[];
values: Partial;
workflowStatuses: LabelValueObject[];
}
export function BasicInfoTab({
baseResourceURL,
containerWrapper: ContainerWrapper,
dbObjectFieldRequired,
errors,
filterOperators,
handleChange,
learnResources,
modelBuilder = false,
objectDefinition,
objectFieldBusinessTypes,
objectRelationshipId,
onSubmit,
readOnly,
setDbObjectFieldRequired,
setValues,
sidebarElements,
values,
workflowStatuses,
}: BasicInfoTabProps) {
const [aggregationFilters, setAggregationFilters] = useState<
AggregationFilters[]
>([]);
const [creationLanguageId2, setCreationLanguageId2] =
useState();
const [
objectDefinitionExternalReferenceCode2,
setObjectDefinitionExternalReferenceCode2,
] = useState();
const isApproved = objectDefinition?.status!.label === 'approved';
return (
<>
{values.businessType === 'AutoIncrement' && (
)}
{values.businessType === 'Aggregation' &&
objectDefinition?.externalReferenceCode !==
objectDefinitionExternalReferenceCode2 && (
)}
{values.businessType === 'Formula' && (
)}
{values.DBType !== 'Blob' && values.businessType !== 'Formula' && (
)}
{
event.stopPropagation();
if (onSubmit) {
onSubmit();
}
}}
onChange={handleChange}
value={values.externalReferenceCode}
/>
>
);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy