@ywfe/materials-design
Version:
YwDesign for lowcode
143 lines (138 loc) • 3.37 kB
text/typescript
import { IPublicTypeComponentMetadata } from '@alilc/lowcode-types';
import { YwButtonBaseProps, IPublicTypeSnippetMore } from '../_base';
import { getRefConfig } from '../_utils';
const refConfig = getRefConfig('button');
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: [
refConfig,
...YwButtonBaseProps,
{
title: {
label: '尺寸',
tip: 'size | 尺寸',
},
display: 'block',
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: 'loading | 是否展示为加载按钮',
},
display: 'block',
name: 'loading',
setter: {
componentName: 'BoolSetter',
isRequired: false,
initialValue: false,
},
},
{
title: { label: '点击事件', tip: 'onClick | 点击事件' },
name: 'onClick',
// "setter": DispatchSetter,
// supportVariable:false,
display: 'block',
setter: {
componentName: 'SchemaFunctionSetter',
props: {
title: 'onClick',
async: true,
properties: {
body: {
type: 'array',
items: [
{
type: 'Function',
properties: {
template: 'SetStateFunction',
extraProps: {
state: 'visible',
value: '{{true}}',
},
},
},
],
},
},
required: ['body'],
},
},
},
],
supports: {
style: true,
className: true,
},
component: {
isContainer: false,
isMinimalRenderUnit: true,
},
},
};
const snippets: IPublicTypeSnippetMore[] = [
{
title: '按钮',
svgId: 'toolbox-page-button',
screenshot: 'https://yw-fed-static.oss-cn-hangzhou.aliyuncs.com/lowcode/button',
schema: {
componentName: 'YwButton',
props: {},
},
},
];
export default {
...YwButtonMeta,
snippets,
};