import type z from 'zod'; import type { IResourceFormFieldLayoutOptions, ITableColumnOptions, TypeFormFieldOnEffect, TypeFormSchemaScene, TypeSchemaScene, } from 'zova-module-a-openapi'; import type { TypeSchemaOrderLevel } from 'zova-module-a-openapi'; import { _generalSchemaRest, _order } from './inner.ts'; export function schemaRenderLayout( layoutOptions: IResourceFormFieldLayoutOptions, scene?: TypeFormSchemaScene, ) { return function (schema: T): T { const options = { layout: layoutOptions }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderVisible( visible: boolean = true, scene?: TypeSchemaScene, ) { return function (schema: T): T { const options = { visible }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderReadonly( readonly: boolean = true, scene?: TypeSchemaScene, ) { return function (schema: T): T { const options = { readonly }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderDisableNotifyChanged( disableNotifyChanged: boolean = true, scene?: TypeSchemaScene, ) { return function (schema: T): T { const options = { disableNotifyChanged }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderOnEffect( onEffect: TypeFormFieldOnEffect, scene?: TypeSchemaScene, ) { return function (schema: T): T { const options = { onEffect }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderFieldSource( fieldSource: string, scene?: TypeSchemaScene, ) { return function (schema: T): T { const options = { fieldSource }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderOrder( order: number, level?: TypeSchemaOrderLevel, scene?: TypeSchemaScene, ) { const orderReal = _order(order, level); return function (schema: T): T { const options = { order: orderReal }; return _generalSchemaRest(schema, options, scene); }; } export function schemaRenderColumn(options: ITableColumnOptions) { return function (schema: T): T { return schema.openapi({ rest: { table: options } }); }; }