组件 schema 补充

This commit is contained in:
金禅 2020-08-04 12:35:24 +08:00
parent 553f924889
commit 6a2541fd4e
3 changed files with 241 additions and 39 deletions

View File

@ -657,8 +657,21 @@
{ {
"name": "dataIndex", "name": "dataIndex",
"propType": "string" "propType": "string"
},
{
"name": "cell",
"propType": "func"
} }
] ],
"configure": {
"props": {
"isExtends": true,
"override": [{
"name": "cell",
"setter": "JsonSetter"
}]
}
}
}, },
{ {
"componentName": "Badge", "componentName": "Badge",
@ -1184,7 +1197,12 @@
"propType": "bool", "propType": "bool",
"defaultValue": false "defaultValue": false
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "Breadcrumb", "componentName": "Breadcrumb",
@ -1443,6 +1461,11 @@
"name": "rtl", "name": "rtl",
"propType": "bool" "propType": "bool"
}, },
{
"name": "children",
"title": "内容",
"propType": "array"
},
{ {
"name": "type", "name": "type",
"title": "类型", "title": "类型",
@ -1571,10 +1594,6 @@
"name": "onMouseUp", "name": "onMouseUp",
"propType": "func" "propType": "func"
}, },
{
"name": "children",
"propType": "array"
},
{ {
"name": "style", "name": "style",
"propType": "object", "propType": "object",
@ -7533,11 +7552,16 @@
"name": "popupProps", "name": "popupProps",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "Item", "componentName": "Nav.Item",
"title": "Item", "title": "Nav.Item",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -8234,7 +8258,7 @@
}, },
{ {
"name": "color", "name": "color",
"propType": "string", "propType": "color",
"description": "进度条颜色, 显示优先级: color > progressive > state" "description": "进度条颜色, 显示优先级: color > progressive > state"
}, },
{ {
@ -10278,8 +10302,8 @@
] ]
}, },
{ {
"componentName": "TabItem", "componentName": "Tab.Item",
"title": "TabItem", "title": "Tab.Item",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -10338,8 +10362,8 @@
] ]
}, },
{ {
"componentName": "TabItem", "componentName": "Tab.TabPane",
"title": "TabItem", "title": "Tab.TabPane",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -12043,8 +12067,8 @@
] ]
}, },
{ {
"componentName": "Selecter", "componentName": "Upload.Selecter",
"title": "Selecter", "title": "Upload.Selecter",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -12124,8 +12148,8 @@
] ]
}, },
{ {
"componentName": "Dragger", "componentName": "Upload.Dragger",
"title": "Dragger", "title": "Upload.Dragger",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -12200,8 +12224,8 @@
] ]
}, },
{ {
"componentName": "List", "componentName": "Upload.List",
"title": "List", "title": "Upload.List",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -12282,10 +12306,7 @@
}, },
{ {
"name": "children", "name": "children",
"propType": { "propType": "node"
"type": "instanceOf",
"value": "node"
}
}, },
{ {
"name": "uploader", "name": "uploader",
@ -12637,6 +12658,94 @@
"isContainer": true "isContainer": true
} }
} }
},
{
"componentName": "List",
"title": "List",
"docUrl": "",
"screenshot": "",
"npm": {
"package": "@alifd/next",
"version": "1.19.18",
"exportName": "List",
"main": "src/index.js",
"destructuring": true,
"subName": ""
},
"props": [
{
"name": "prefix",
"propType": "string",
"defaultValue": "next-"
},
{
"name": "style",
"propType": "object"
},
{
"name": "header",
"propType": "node"
},
{
"name": "size",
"propType": {
"type": "oneOf",
"value": [
"small",
"medium"
]
}
},
{
"name": "footer",
"propType": "node"
},
{
"name": "divider",
"propType": "node"
}
],
"configure": {
"component": {
"isContainer": true
}
}
},
{
"componentName": "List.Item",
"title": "List.Item",
"docUrl": "",
"screenshot": "",
"npm": {
"package": "@alifd/next",
"version": "1.19.18",
"exportName": "List",
"main": "src/index.js",
"destructuring": true,
"subName": "Item"
},
"props": [
{
"name": "style",
"propType": "object"
},
{
"name": "title",
"propType": "node"
},
{
"name": "description",
"propType": "node"
},
{
"name": "media",
"propType": "node"
},
{
"name": "extra",
"propType": "node"
}
]
} }
], ],
"componentList": [ "componentList": [
@ -12958,6 +13067,22 @@
} }
} }
] ]
},{
"componentName": "List.Item",
"title": "列表项",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "列表项",
"screenshot": "",
"schema": {
"componentName": "List.Item",
"props": {}
}
}
]
}, },
{ {
"componentName": "Menu", "componentName": "Menu",
@ -13182,6 +13307,25 @@
} }
} }
] ]
},
{
"componentName": "TreeNode",
"title": "树形控件节点",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "树形控件节点",
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_tree.png",
"schema": {
"componentName": "TreeNode",
"props": {
"prefix": "next-"
}
}
}
]
} }
], ],
"icon": "" "icon": ""
@ -13655,6 +13799,35 @@
} }
] ]
}, },
{
"componentName": "Nav.Item",
"title": "导航Item",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "导航",
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_nav.png",
"schema": {
"componentName": "Nav.Item",
"props": {
"prefix": "next-",
"type": "normal",
"direction": "ver",
"hozAlign": "left",
"mode": "inline",
"triggerType": "click",
"inlineIndent": 20,
"openMode": "multiple",
"defaultSelectedKeys": [],
"popupAlign": "follow",
"hasArrow": true
}
}
}
]
},
{ {
"componentName": "Pagination", "componentName": "Pagination",
"title": "翻页器", "title": "翻页器",
@ -13731,6 +13904,27 @@
} }
} }
] ]
},
{
"componentName": "Tab.Item",
"title": "选项卡Item",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "选项卡",
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_tab.png",
"schema": {
"componentName": "Tab.Item",
"props": {
"prefix": "next-",
"title": "",
"closeable": true
}
}
}
]
} }
], ],
"icon": "" "icon": ""

View File

@ -47,6 +47,12 @@ function propTypeToSetter(propType: PropType): SetterType {
isRequired, isRequired,
initialValue: '', initialValue: '',
}; };
case 'color':
return {
componentName: 'ColorSetter',
isRequired,
initialValue: '',
};
case 'number': case 'number':
return { return {
@ -84,20 +90,20 @@ function propTypeToSetter(propType: PropType): SetterType {
initialValue: dataSource[0] ? dataSource[0].value : null, initialValue: dataSource[0] ? dataSource[0].value : null,
}; };
case 'element': // case 'element':
case 'node': // TODO: use Mixin // case 'node': // TODO: use Mixin
return { // return {
// slotSetter // // slotSetter
componentName: 'NodeSetter', // componentName: 'NodeSetter',
props: { // props: {
mode: typeName, // mode: typeName,
}, // },
isRequired, // isRequired,
initialValue: { // initialValue: {
type: 'JSSlot', // type: 'JSSlot',
value: '', // value: '',
}, // },
}; // };
case 'shape': case 'shape':
case 'exact': case 'exact':
const items = ((propType as any).value || []).map((item: any) => propConfigToFieldConfig(item)); const items = ((propType as any).value || []).map((item: any) => propConfigToFieldConfig(item));

View File

@ -196,6 +196,9 @@ export default class BaseRender extends PureComponent {
}; };
getSchemaChildren = (schema) => { getSchemaChildren = (schema) => {
if (!schema || !schema.props) {
return schema?.children;
}
let _children = schema.children; let _children = schema.children;
if (!_children) return schema.props.children; if (!_children) return schema.props.children;
if (schema.props.children && schema.props.children.length) { if (schema.props.children && schema.props.children.length) {
@ -255,7 +258,6 @@ export default class BaseRender extends PureComponent {
return schema; return schema;
} }
if (!isSchema(schema)) return null; if (!isSchema(schema)) return null;
let Comp = components[schema.componentName] || engine.getNotFoundComponent(); let Comp = components[schema.componentName] || engine.getNotFoundComponent();
if (schema.hidden) { if (schema.hidden) {