UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

30 lines (29 loc) 2.1 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useIntl } from 'react-intl'; import { BuilderTabs, ClearOnHide, Description, Hidden, IsSensitiveData, Key, Label, Registration, SimpleConditional, Tooltip, Translations, useDeriveComponentKey, } from '../../components/builder'; import { LABELS } from '../../components/builder/messages'; import { TabList, TabPanel, Tabs } from '../../components/formio'; import { useErrorChecker } from '../../utils/errors'; /** * Form to configure a Formio 'partners' type component. */ const EditForm = () => { const intl = useIntl(); const [isKeyManuallySetRef, generatedKey] = useDeriveComponentKey(); const { hasAnyError } = useErrorChecker(); return (_jsxs(Tabs, { children: [_jsxs(TabList, { children: [_jsx(BuilderTabs.Basic, { hasErrors: hasAnyError('label', 'key', 'description', 'tooltip', 'hidden', 'clearOnHide', 'isSensitiveData') }), _jsx(BuilderTabs.Advanced, { hasErrors: hasAnyError('conditional') }), _jsx(BuilderTabs.Registration, { hasErrors: hasAnyError('registration') }), _jsx(BuilderTabs.Translations, { hasErrors: hasAnyError('openForms.translations') })] }), _jsxs(TabPanel, { children: [_jsx(Label, {}), _jsx(Key, { isManuallySetRef: isKeyManuallySetRef, generatedValue: generatedKey }), _jsx(Description, {}), _jsx(Tooltip, {}), _jsx(Hidden, {}), _jsx(ClearOnHide, {}), _jsx(IsSensitiveData, { disabled: true })] }), _jsx(TabPanel, { children: _jsx(SimpleConditional, {}) }), _jsx(TabPanel, { children: _jsx(Registration.RegistrationAttributeSelect, {}) }), _jsx(TabPanel, { children: _jsx(Translations.ComponentTranslations, { propertyLabels: { label: intl.formatMessage(LABELS.label), description: intl.formatMessage(LABELS.description), tooltip: intl.formatMessage(LABELS.tooltip), } }) })] })); }; const defaultValues = { type: 'partners', id: '', label: '', key: '', isSensitiveData: true, defaultValue: [], }; EditForm.defaultValues = defaultValues; export default EditForm;