import { FocusEvent } from 'react'; import { TextField } from '@fluentui/react'; import { ADDITIONAL_PROPERTY_FLAG, FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString, WrapIfAdditionalTemplateProps, } from '@rjsf/utils'; export default function WrapIfAdditionalTemplate< T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any >(props: WrapIfAdditionalTemplateProps) { const { children, disabled, id, label, onDropPropertyClick, onKeyChange, readonly, registry, required, schema, style, uiSchema, } = props; const { templates, translateString } = registry; // TODO: do this better by not returning the form-group class from master. let { classNames = '' } = props; classNames = 'ms-Grid-col ms-sm12 ' + classNames.replace('form-group', ''); // Button templates are not overridden in the uiSchema const { RemoveButton } = templates.ButtonTemplates; const keyLabel = translateString(TranslatableString.KeyLabel, [label]); const additional = ADDITIONAL_PROPERTY_FLAG in schema; if (!additional) { return (
{children}
); } const handleBlur = ({ target }: FocusEvent) => onKeyChange(target.value); return (
{children}
); }