UNPKG

@ywfe/materials-design

Version:
507 lines (504 loc) 14.5 kB
import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'; import { IPublicTypeSnippetMore } from '../_base'; const YwEmpSelectorMeta: IPublicTypeComponentMetadata = { componentName: 'YwEmpSelector', title: 'YwEmpSelector', docUrl: '', screenshot: '', devMode: 'proCode', group: '基础组件', category: '表单', npm: { package: '@ywfe/materials-design', version: '0.0.1-beta.6', exportName: 'YwEmpSelector', main: 'src/index.tsx', destructuring: true, subName: '', }, configure: { props: [ { title: { label: '打开弹窗函数', tip: 'openEmpSelector | 打开弹窗函数', }, name: 'openEmpSelector', description: '打开弹窗函数', setter: { componentName: 'MixedSetter', props: { defaultValue: () => ({ type: 'JSFunction', schema: { title: 'onOk', type: 'JSFunction', async: false, properties: { input: { type: 'object', properties: { value: { type: 'boolean', defaultValue: false, }, }, required: ['value'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'SetStateFunction', extraProps: { state: 'isShowEmpSelector', value: '{{value}}', }, }, }, ], }, }, required: ['input', 'body'], }, }), setters: ['SchemaFunctionSetter'], }, }, }, { title: { label: '标题', tip: 'title | 标题', }, name: 'title', description: '标题', setter: { componentName: 'StringSetter', isRequired: true, initialValue: '请选择联系人', }, }, { title: { label: '按钮文案', tip: 'btnText | 标题', }, name: 'btnText', description: '按钮文案', setter: { componentName: 'StringSetter', isRequired: true, initialValue: '请选择联系人', }, }, { title: { label: '最大数量限制', tip: 'maxItems | 最大数量限制', }, name: 'maxItems', description: '最大数量限制', setter: { componentName: 'NumberSetter', isRequired: true, initialValue: 30, }, }, { title: { label: '宽度', tip: 'width | 宽度', }, name: 'width', description: '宽度', setter: { componentName: 'StringSetter', isRequired: true, }, }, { title: { label: '确认按钮文字', tip: 'okText | 确认按钮文字', }, name: 'okText', description: '确认按钮文字', setter: { componentName: 'StringSetter', isRequired: true, }, }, { title: { label: '取消按钮文字', tip: 'cancelText | 取消按钮文字', }, name: 'cancelText', description: '取消按钮文字', setter: { componentName: 'StringSetter', isRequired: true, }, }, { title: { label: '确认按钮类型', tip: 'okType | 确认按钮类型', }, name: 'okType', description: '确认按钮类型', setter: { componentName: 'StringSetter', isRequired: true, }, }, { title: { label: '对话框是否可见', tip: 'visible | 对话框是否可见' }, name: 'visible', setter: 'BoolSetter', defaultValue: { type: 'JSExpression', value: 'this.state.isShowEmpSelector', }, }, { title: { label: '点击蒙层是否允许关闭', tip: 'maskClosable | 点击蒙层是否允许关闭' }, name: 'maskClosable', setter: 'BoolSetter', defaultValue: true, }, { title: { label: '关闭是否清空初始值', tip: 'clearValueOnClose | 关闭是否清空初始值' }, name: 'clearValueOnClose', setter: 'BoolSetter', defaultValue: true, }, { title: { label: '强制渲染 Modal', tip: 'forceRender | 强制渲染 Modal' }, name: 'forceRender', setter: 'BoolSetter', defaultValue: true, }, { title: { label: '最大可选数量', tip: 'maxItems | 最大可选数量' }, name: 'maxItems', setter: { componentName: 'NumberSetter', initialValue: 3, }, }, { title: { label: '确定按钮 loading', tip: 'confirmLoading | 确定按钮 loading' }, name: 'confirmLoading', setter: 'BoolSetter', defaultValue: true, }, { title: { label: '是否显示右上角的关闭按钮', tip: 'closable | 是否显示右上角的关闭按钮' }, name: 'closable', setter: 'BoolSetter', defaultValue: true, }, { title: { label: '垂直居中', tip: 'centered | 垂直居中' }, name: 'centered', setter: 'BoolSetter', defaultValue: true, }, { name: 'getOrgList', title: { label: '组织架构接口配置', tip: 'getOrgList | 组织架构接口配置' }, supportVariable: false, defaultValue: () => ({ type: 'JSFunction', schema: { title: 'getOrgList', type: 'JSFunction', name: 'getOrgList', async: true, properties: { input: { type: 'object', properties: { params: { type: 'object', defaultValue: {}, }, }, required: ['params'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'RequestFunction', variable: 'result', returnResult: '0', extraProps: { apiId: 'API_88_59642_323217f643c3e3f1fe7532e72ac01bb0748c97be', params: {}, }, }, }, ], }, }, required: ['input', 'body'], }, }), setter: { componentName: 'SchemaFunctionSetter', }, }, { title: { label: '人员接口配置', tip: 'getDataSource | 人员接口配置' }, name: 'getDataSource', defaultValue: () => ({ type: 'JSFunction', schema: { title: 'getDataSource', type: 'JSFunction', name: 'getDataSource', async: true, properties: { input: { type: 'object', properties: { value: { type: 'string', defaultValue: '', }, }, required: ['value'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'RequestFunction', variable: 'result', extraProps: { apiId: 'API_88_59650_323217f643c3e3f1fe7532e72ac01bb0748c97be', params: { keyword: '{{value}}' }, }, }, }, ], }, }, required: ['input', 'body'], }, }), setter: { componentName: 'SchemaFunctionSetter', }, }, { title: { label: '通过部门id查询下级用户', tip: 'getUserListForOrg | 通过部门id查询下级用户', }, name: 'getUserListForOrg', // setter: { // componentName: 'VariableSetter', // }, defaultValue: () => ({ type: 'JSFunction', schema: { title: 'getUserListForOrg', type: 'JSFunction', name: 'getUserListForOrg', async: true, properties: { input: { type: 'object', properties: { params: { type: 'object', defaultValue: '', }, }, required: ['params'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'RequestFunction', variable: 'result', extraProps: { apiId: 'API_88_59658_323217f643c3e3f1fe7532e72ac01bb0748c97be', params: { orgId: '{{params.orgIds}}' }, }, }, }, ], }, }, required: ['input', 'body'], }, }), setter: { componentName: 'SchemaFunctionSetter', }, }, { title: { label: '字段映射', tip: 'fieldNames | 字段映射' }, name: 'fieldNames', setter: { componentName: 'ObjectSetter', props: { config: { items: [ { name: 'label', title: { label: '名称', tip: 'label | 名称' }, propType: 'string', setter: { componentName: 'StringSetter', isRequired: true, initialValue: 'userName', }, }, { name: 'value', title: { label: '值', tip: 'value | 值' }, propType: 'string', setter: { componentName: 'StringSetter', isRequired: true, initialValue: 'userId', }, }, ], }, }, }, }, { name: 'onOk', title: '确认回调', supportVariable: false, setter: { componentName: 'MixedSetter', props: { defaultValue: () => ({ type: 'JSFunction', schema: { title: 'onOk', type: 'JSFunction', async: false, properties: { input: { type: 'object', properties: { values: { type: 'object', defaultValue: {}, }, }, required: ['values'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'SetStateFunction', extraProps: { state: 'empData', value: '{{values}}', }, }, }, ], }, }, required: ['input', 'body'], }, }), setters: ['SchemaFunctionSetter'], }, }, }, { name: 'onCancel', title: '取消回调', supportVariable: false, setter: { componentName: 'MixedSetter', props: { defaultValue: () => ({ type: 'JSFunction', schema: { title: 'onCancel', type: 'JSFunction', async: false, properties: { input: { type: 'object', properties: { value: { type: 'boolean', defaultValue: false, }, }, required: ['value'], }, body: { type: 'array', items: [ { type: 'Function', properties: { template: 'SetStateFunction', extraProps: { state: 'isShowEmpSelector', value: '{{value}}', }, }, }, ], }, }, required: ['input', 'body'], }, }), setters: ['SchemaFunctionSetter'], }, }, }, ], supports: { style: true, }, component: { isContainer: false, }, }, }; const snippets: IPublicTypeSnippetMore[] = [ { title: '人员选择(可选部门)', svgId: 'icon-renyuanxuanzejibumen', screenshot: 'https://yw-fed-static.oss-cn-hangzhou.aliyuncs.com/lowcode/orgSelector', schema: { componentName: 'YwEmpSelector', props: {}, }, }, ]; export default { ...YwEmpSelectorMeta, snippets, };