mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
24 lines
578 B
TypeScript
24 lines
578 B
TypeScript
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
import type { FormSchemaNode } from '#shared/components/Form/types.ts'
|
|
|
|
type FormSchemaOptions = {
|
|
showDirtyMark: boolean
|
|
}
|
|
|
|
export const defineFormSchema = (
|
|
schema: FormSchemaNode[],
|
|
options?: FormSchemaOptions,
|
|
): FormSchemaNode[] => {
|
|
const needGroup = schema.every((node) => !(typeof node !== 'string' && 'isLayout' in node))
|
|
|
|
if (!needGroup) return schema
|
|
return [
|
|
{
|
|
isLayout: true,
|
|
component: 'FormGroup',
|
|
props: options,
|
|
children: schema,
|
|
},
|
|
]
|
|
}
|