diff --git a/packages/demo/public/assets.json b/packages/demo/public/assets.json index de23a2dc8..608c377fc 100644 --- a/packages/demo/public/assets.json +++ b/packages/demo/public/assets.json @@ -657,8 +657,21 @@ { "name": "dataIndex", "propType": "string" + }, + { + "name": "cell", + "propType": "func" } - ] + ], + "configure": { + "props": { + "isExtends": true, + "override": [{ + "name": "cell", + "setter": "JsonSetter" + }] + } + } }, { "componentName": "Badge", @@ -1184,7 +1197,12 @@ "propType": "bool", "defaultValue": false } - ] + ], + "configure": { + "component": { + "isContainer": true + } + } }, { "componentName": "Breadcrumb", @@ -1443,6 +1461,11 @@ "name": "rtl", "propType": "bool" }, + { + "name": "children", + "title": "内容", + "propType": "array" + }, { "name": "type", "title": "类型", @@ -1571,10 +1594,6 @@ "name": "onMouseUp", "propType": "func" }, - { - "name": "children", - "propType": "array" - }, { "name": "style", "propType": "object", @@ -7533,11 +7552,16 @@ "name": "popupProps", "propType": "object" } - ] + ], + "configure": { + "component": { + "isContainer": true + } + } }, { - "componentName": "Item", - "title": "Item", + "componentName": "Nav.Item", + "title": "Nav.Item", "docUrl": "", "screenshot": "", "npm": { @@ -8234,7 +8258,7 @@ }, { "name": "color", - "propType": "string", + "propType": "color", "description": "进度条颜色, 显示优先级: color > progressive > state" }, { @@ -10278,8 +10302,8 @@ ] }, { - "componentName": "TabItem", - "title": "TabItem", + "componentName": "Tab.Item", + "title": "Tab.Item", "docUrl": "", "screenshot": "", "npm": { @@ -10338,8 +10362,8 @@ ] }, { - "componentName": "TabItem", - "title": "TabItem", + "componentName": "Tab.TabPane", + "title": "Tab.TabPane", "docUrl": "", "screenshot": "", "npm": { @@ -12043,8 +12067,8 @@ ] }, { - "componentName": "Selecter", - "title": "Selecter", + "componentName": "Upload.Selecter", + "title": "Upload.Selecter", "docUrl": "", "screenshot": "", "npm": { @@ -12124,8 +12148,8 @@ ] }, { - "componentName": "Dragger", - "title": "Dragger", + "componentName": "Upload.Dragger", + "title": "Upload.Dragger", "docUrl": "", "screenshot": "", "npm": { @@ -12200,8 +12224,8 @@ ] }, { - "componentName": "List", - "title": "List", + "componentName": "Upload.List", + "title": "Upload.List", "docUrl": "", "screenshot": "", "npm": { @@ -12282,10 +12306,7 @@ }, { "name": "children", - "propType": { - "type": "instanceOf", - "value": "node" - } + "propType": "node" }, { "name": "uploader", @@ -12637,6 +12658,94 @@ "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": [ @@ -12958,6 +13067,22 @@ } } ] + },{ + "componentName": "List.Item", + "title": "列表项", + "icon": "", + "package": "@alife/next", + "library": "Next", + "snippets": [ + { + "title": "列表项", + "screenshot": "", + "schema": { + "componentName": "List.Item", + "props": {} + } + } + ] }, { "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": "" @@ -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", "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": "" diff --git a/packages/editor-skeleton/src/transducers/parse-props.ts b/packages/editor-skeleton/src/transducers/parse-props.ts index a47e8e74a..850624b86 100644 --- a/packages/editor-skeleton/src/transducers/parse-props.ts +++ b/packages/editor-skeleton/src/transducers/parse-props.ts @@ -47,6 +47,12 @@ function propTypeToSetter(propType: PropType): SetterType { isRequired, initialValue: '', }; + case 'color': + return { + componentName: 'ColorSetter', + isRequired, + initialValue: '', + }; case 'number': return { @@ -84,20 +90,20 @@ function propTypeToSetter(propType: PropType): SetterType { initialValue: dataSource[0] ? dataSource[0].value : null, }; - case 'element': - case 'node': // TODO: use Mixin - return { - // slotSetter - componentName: 'NodeSetter', - props: { - mode: typeName, - }, - isRequired, - initialValue: { - type: 'JSSlot', - value: '', - }, - }; + // case 'element': + // case 'node': // TODO: use Mixin + // return { + // // slotSetter + // componentName: 'NodeSetter', + // props: { + // mode: typeName, + // }, + // isRequired, + // initialValue: { + // type: 'JSSlot', + // value: '', + // }, + // }; case 'shape': case 'exact': const items = ((propType as any).value || []).map((item: any) => propConfigToFieldConfig(item)); diff --git a/packages/react-renderer/src/renderer/base.jsx b/packages/react-renderer/src/renderer/base.jsx index 68c659987..f5f68837f 100644 --- a/packages/react-renderer/src/renderer/base.jsx +++ b/packages/react-renderer/src/renderer/base.jsx @@ -196,6 +196,9 @@ export default class BaseRender extends PureComponent { }; getSchemaChildren = (schema) => { + if (!schema || !schema.props) { + return schema?.children; + } let _children = schema.children; if (!_children) return schema.props.children; if (schema.props.children && schema.props.children.length) { @@ -255,7 +258,6 @@ export default class BaseRender extends PureComponent { return schema; } if (!isSchema(schema)) return null; - let Comp = components[schema.componentName] || engine.getNotFoundComponent(); if (schema.hidden) {