import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'; import { default as OptionSetter } from '../setter/OptionSetter'; import RuleSetter from '../setter/RuleSetter'; const FormCheckboxMeta: IPublicTypeComponentMetadata = { componentName: 'FormCheckbox', title: '复选', docUrl: '', screenshot: '', devMode: 'proCode', category: '表单组件', group: '精选组件', npm: { package: 'temp-materials', version: '0.1.2', exportName: 'FormCheckbox', main: 'src\\index.tsx', destructuring: true, subName: '', }, configure: { props: [ { title: { label:'标题', tip:'表单项名称,后续生成表格时,转化为表格列名' }, name: 'title', setter: 'StringSetter', defaultValue: '复选', }, // 列数 { title: { label:'列数', tip:'设置组件自身的布局,可选择继承表单组件的值,有限度高于表单组件布局属性' }, name: 'column', setter: { componentName: 'RadioGroupSetter', props: { options: [ { label: '一栏', value: 24, }, { label: '两栏', value: 12, }, { label: '继承', value: 0, }, ], }, }, }, // 状态 { title: { label:"状态", tip:'禁用模式禁止用户手动录入参数' }, name: 'status', setter: { componentName: 'RadioGroupSetter', props: { options: [ { label: '普通', value: 'normal', }, { label: '只读', value: 'readonly', }, ], }, isRequired: true, initialValue: 'normal', }, }, // 排列方式 { title: { label:'排列方式', tip:'设置选项的排列方式' }, name: 'direction', setter: { componentName: 'RadioGroupSetter', props: { options: [ { value: 'horizontal', title: '水平排列', }, { value: 'vertical', title: '垂直排列', }, ], }, }, }, // 选项类型 { display: 'block', title: { label:'选项类型', tip:'可通过手动录入,api调用等方式设置选项' }, name: 'options', setter: { componentName: OptionSetter, props: { type: 'checkbox', }, }, }, // 校验规则 { display: 'block', title: { label:'校验', tip:'可选择内置的校验规则' }, name: 'rules', setter: { componentName: RuleSetter, props: { type: ['REQUIRED', 'MAXLEN'], }, }, }, ], supports: { // style: true, }, component: { nestingRule: { parentWhitelist: ['Form'], }, }, }, }; const snippets: IPublicTypeSnippet[] = [ { title: '复选', screenshot: '', schema: { componentName: 'FormCheckbox', props: { // 后端识别类型 fieldType: 'array', direction: 'horizontal', status: 'normal', }, }, }, ]; export default { ...FormCheckboxMeta, snippets, };