UNPKG

@tsed/schema-formio

Version:

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

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