UNPKG

form-tdesigner

Version:

好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。

78 lines (75 loc) 2.2 kB
import unique from '@form-create/utils/lib/unique'; import {localeProps} from '../../utils'; const label = '表格表单'; const name = 'tableForm'; export default { menu: 'subform', icon: 'icon-table-form', label, name, mask: false, subForm: 'array', event: ['change', 'add', 'delete'], children: 'tableFormColumn', loadRule(rule) { if (!rule.props) rule.props = {}; const columns = rule.props.columns || []; rule.children = columns.map(column => { return { type: 'tableFormColumn', _fc_drag_tag: 'tableFormColumn', props: { label: column.label, required: column.required || false, width: column.style.width || '', color: column.style.color || '', }, children: column.rule || [] } }); delete rule.props.columns; }, parseRule(rule) { const children = rule.children || []; rule.props.columns = children.map(column => { return { label: column.props.label, required: column.props.required, style: { width: column.props.width, color: column.props.color, }, rule: column.children || [] }; }) rule.children = []; }, rule({t}) { return { type: name, field: unique(), title: t('com.tableForm.name'), info: '', props: {}, children: [] }; }, props(_, {t}) { return localeProps(t, name + '.props', [ { type: 'switch', field: 'disabled' }, { type: 'switch', field: 'filterEmptyColumn', value: true, }, { type: 'inputNumber', field: 'max', props: {min: 0} }, ]); } };