UNPKG

@ywfe/materials-design

Version:
158 lines (155 loc) 3.97 kB
import { getRefConfig } from '../../_utils'; import { IPublicTypeFieldConfig } from '@alilc/lowcode-types'; import { FormItemsProps } from '../../_base'; import { layoutConfig, sizeConfig } from '../../_base/json-form-base-props'; const refConfig = getRefConfig('json_form'); const props: IPublicTypeFieldConfig[] = [ refConfig, FormItemsProps, { name: 'initialValues', title: { label: '表单默认值', tip: 'initialValues | 表单默认值', }, setter: { componentName: 'MixedSetter', props: { setters: ['JsonSetter'], }, }, }, { name: 'onCreate', title: { label: '表单初始化函数', tip: 'onCreate | 表单初始化函数', }, setter: { componentName: 'SchemaFunctionSetter', props: { title: 'onCreate', async: true, properties: { input: { type: 'object', properties: { form: { type: 'object', }, }, required: ['form'], }, body: { type: 'array', items: [ { type: 'JSExpression', run: 'form.setInitialValues(this.initialValues)', }, ], }, }, }, }, }, { name: 'onSubmit', // display: 'block', title: { label: '提交事件', tip: 'onSubmit | 提交事件' }, setter: { componentName: 'MixedSetter', props: { setters: [ { componentName: 'SchemaFunctionSetter', props: { title: 'getDataSource', async: true, properties: { input: { type: 'object', properties: { values: { type: 'object', }, }, required: ['values'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'RequestFunction', variable: 'requestRes', extraProps: { params: '{{values}}', }, }, }, { type: 'Function', properties: { template: 'HistoryPushFunction', extraProps: { url: '', params: '{{undefined}}', hash: '{{undefined}}', }, }, }, ], }, }, }, }, ], }, }, }, { // name: 'globalConfig', title: { label: '全局配置', tip: 'globalConfig | 全局配置' }, type: 'group', display: 'accordion', items: [ { name: 'editable', title: { label: '状态', tip: 'editable | 状态' }, setter: { componentName: 'RadioGroupSetter', props: { options: [ { title: '预览态', value: false, }, { title: '编辑态', value: true, }, ], }, }, defaultValue: true, }, { name: 'disabled', title: { label: '禁用', tip: 'disabled | 禁用' }, setter: 'BoolSetter', defaultValue: false, }, sizeConfig, ...layoutConfig, { name: 'colon', title: '是否展示冒号', setter: 'BoolSetter', supportVariable: false, }, ], }, ]; export default props;