import { FormItem, FormConfig } from '@/components/form-render/form-render-types'

export const config: FormConfig = {
	layout: 'horizontal',
	colon: true,
	hideRequiredMark: false,
	labelAlign: 'right',
	scrollToFirstError: false,
	validateOnRuleChange: true,
	labelCol: {
		span: 4,
		offset: 0,
	},
}

export const formItems: FormItem[] = [
	{
		group: 'form',
		type: 'input',
		config: {
			autoLink: true,
			hasFeedback: false,
			label: '数据key',
			name: 'key',
			required: true,
		},
		properties: {
			type: 'text',
			allowClear: true,
			bordered: true,
			showCount: true,
			placeholder: '请输入数据key',
		},
		rules: [],
	},
	{
		group: 'form',
		type: 'input',
		config: {
			autoLink: true,
			hasFeedback: false,
			label: '数据值',
			name: 'value',
			required: true,
		},
		properties: {
			type: 'text',
			allowClear: true,
			bordered: true,
			showCount: true,
			placeholder: '请输入数据值',
		},
		rules: [],
	},
	{
		type: 'input-number',
		group: 'form',
		config: {
			autoLink: true,
			hasFeedback: false,
			label: '序号',
			name: 'index',
		},
		properties: {
			controls: true,
			placeholder: '请输入数据排序',
		},
		rules: [],
	},
	{
		type: 'textarea',
		group: 'form',
		config: {
			autoLink: true,
			hasFeedback: false,
			label: '数据描述',
			name: 'description',
		},
		properties: {
			size: 'default',
			visibilityToggle: true,
			allowClear: true,
			bordered: true,
			showCount: true,
			autoSize: {
				minRows: 2,
				maxRows: 6,
			},
			minRows: 2,
			maxRows: 6,
			placeholder: '请输入数据描述',
		},
		rules: [],
	},
	{
		type: 'switch',
		group: 'form',
		config: {
			autoLink: true,
			hasFeedback: false,
			label: '禁用',
			name: 'disabled',
		},
		properties: {
			checkedChildren: '禁用',
			unCheckedChildren: '启用',
		},
		rules: [],
	},
]
