import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'; import RuleSetter from '../setter/RuleSetter'; const FormInputMeta: IPublicTypeComponentMetadata = { componentName: 'FormInput', title: '单行文本', docUrl: '', screenshot: '', devMode: 'proCode', category: '表单组件', group: '精选组件', npm: { package: 'temp-materials', version: '0.1.2', exportName: 'FormInput', 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: 'placeholder', setter: 'StringSetter', }, // 是否展示边框 { title: { label:'边框', tip:'组件是否显示边框' }, name: 'bordered', setter: 'BoolSetter', }, // 是否支持清除 { title: { label:'清除按钮', tip:'是否显示清除按钮' }, name: 'allowClear', setter: 'BoolSetter', }, // 计数器 { title: { label:'计数器', tip:"开启计数器后,会显示已经输入的文本长度" }, name: 'showCount', setter: 'BoolSetter', }, // 校验规则 { display: 'block', title: { label:'校验', tip:'可选择内置的校验规则' }, name: 'rules', setter: { componentName: RuleSetter, props: { type: ['REQUIRED', 'MINLEN', 'MAXLEN'], }, }, }, ], supports: { // style: true, }, component: { nestingRule: { parentWhitelist: ['Form'], }, }, }, }; const snippets: IPublicTypeSnippet[] = [ { title: '单行文本', screenshot: '', schema: { componentName: 'FormInput', props: { // 后端识别类型 fieldType: 'string', bordered: true, allowClear: true, status: 'normal', }, }, }, ]; export default { ...FormInputMeta, snippets, };