UNPKG

@ywfe/materials-design

Version:
229 lines (226 loc) 5.76 kB
import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'; import { YwButtonBaseProps } from '../_base'; import { hideProp } from '../_utils'; const YwButtonMeta: IPublicTypeComponentMetadata = { componentName: 'YwButton', title: '按钮', docUrl: '', screenshot: '', devMode: 'proCode', group: '基础组件', category: '基础元素', npm: { package: '@ywfe/materials-design', version: '0.1.0', exportName: 'YwButton', main: 'src/index.tsx', destructuring: true, subName: '', }, configure: { props: [ { title: { label: '组件唯一标识', tip: '_flag | 组件唯一标识', }, condition: hideProp, name: '_flag', description: '组件唯一标识', setter: { componentName: 'StringSetter', isRequired: true, initialValue: '', }, }, ...YwButtonBaseProps, { title: { label: '尺寸', tip: 'size | 尺寸', }, supportVariable: false, name: 'size', setter: { componentName: 'RadioGroupSetter', props: { dataSource: [ { label: 'small', value: 'small', }, { label: 'middle', value: 'middle', }, { label: 'large', value: 'large', }, ], options: [ { label: 'small', value: 'small', }, { label: 'middle', value: 'middle', }, { label: 'large', value: 'large', }, ], }, initialValue: 'middle', }, }, { title: { label: '禁用状态', tip: 'disabled | 禁用状态', }, name: 'disabled', description: '禁用状态', setter: { componentName: 'MixedSetter', props: { setters: [ { componentName: 'BoolSetter', isRequired: false, initialValue: false, }, { componentName: 'FunctionSetter', isRequired: false, }, ], }, }, }, { title: { label: '是否展示为加载按钮', tip: 'loading | 是否展示为加载按钮', }, name: 'loading', setter: { componentName: 'MixedSetter', props: { setters: [ { componentName: 'BoolSetter', isRequired: false, initialValue: false, }, ], }, }, }, { title: { label: '自定义按钮', tip: 'children | 自定义按钮', }, supportVariable: false, isHigher: true, name: 'children', description: '自定义按钮', setter: [ { componentName: 'SlotSetter', props: { mode: 'node', }, isRequired: false, initialValue: { type: 'JSSlot', value: null, }, }, ], }, { title: { label: '点击事件', tip: 'onClick | 点击事件' }, name: 'onClick', // "setter": DispatchSetter, setter: { componentName: 'MixedSetter', props: { setters: [ { componentName: 'ObjectSetter', props: { config: { items: [ { name: 'type', title: { label: '事件类型', tip: 'type | 事件类型', }, setter: 'StringSetter', isRequired: true, }, { name: 'data', title: { label: '参数', tip: 'data | 参数', }, setter: 'StringSetter', isRequired: true, }, { name: 'path', title: { label: '标识', tip: 'path | 标识', }, setter: 'StringSetter', isRequired: false, }, ], }, }, isRequired: false, initialValue: null, }, // { // "componentName": DispatchSetter, // "isRequired": false, // }, { componentName: 'FunctionSetter', isRequired: false, }, ], }, }, }, ], supports: { style: true, className: true, }, component: { isContainer: false, }, }, }; const snippets: IPublicTypeSnippet[] = [ { title: '按钮', screenshot: 'https://yw-fed-static.oss-cn-hangzhou.aliyuncs.com/lowcode/button', schema: { componentName: 'YwButton', props: {}, }, }, ]; export default { ...YwButtonMeta, snippets, };