UNPKG

@tsed/schema-formio

Version:

Transform Ts.ED Schema & JsonSchema to a valid Formio schema

18 lines (13 loc) 503 B
import {cleanObject} from "@tsed/core"; import {registerFormioMapper} from "../registries/FormioMappersContainer.js"; import {getFormioProps} from "../utils/getFormioProps.js"; export function defaultToComponent(schema: any, options: any): any { const formioProps = getFormioProps(schema); return cleanObject({ ...formioProps, disabled: !!schema.readOnly, description: schema.description, defaultValue: schema.default }); } registerFormioMapper("default", defaultToComponent);