Merge branch 'components-panel' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into components-panel

This commit is contained in:
春希 2020-07-27 17:34:29 +08:00
commit 06583d7bce
4 changed files with 249 additions and 75 deletions

View File

@ -9,8 +9,8 @@
{ {
"title": "fusion组件库", "title": "fusion组件库",
"package": "@alifd/next", "package": "@alifd/next",
"version": "1.19.18", "version": "1.20.0",
"urls": ["https://unpkg.antfin-inc.com/@alife/next@1.19.18/dist/next.js", "https://unpkg.antfin-inc.com/@alife/next@1.19.18/dist/next.css"], "urls": ["https://unpkg.antfin-inc.com/@alifd/next@1.20.0/dist/next.js", "https://unpkg.antfin-inc.com/@alifd/next@1.20.0/dist/next.css"],
"library": "Next" "library": "Next"
}, },
{ {
@ -188,8 +188,9 @@
"propType": "object" "propType": "object"
}, },
{ {
"name": "columns", "name": "children",
"propType": "array" "propType": "array",
"description": "列"
}, },
{ {
"name": "emptyContent", "name": "emptyContent",
@ -319,7 +320,7 @@
"exportName": "Table", "exportName": "Table",
"main": "src/index.js", "main": "src/index.js",
"destructuring": true, "destructuring": true,
"subName": "" "subName": "Column"
}, },
"props": [ "props": [
{ {
@ -387,7 +388,7 @@
"name": "showZero", "name": "showZero",
"propType": "bool", "propType": "bool",
"description": "当count为0时是否显示count", "description": "当count为0时是否显示count",
"defaultValue": false "defaultValue": true
}, },
{ {
"name": "content", "name": "content",
@ -1077,10 +1078,8 @@
}, },
{ {
"name": "children", "name": "children",
"propType": { "description": "内容",
"type": "instanceOf", "propType": "array"
"value": "node"
}
}, },
{ {
"name": "style", "name": "style",
@ -1239,17 +1238,19 @@
}, },
{ {
"name": "children", "name": "children",
"propType": { "propType": "array"
"type": "instanceOf",
"value": "node"
}
}, },
{ {
"name": "style", "name": "style",
"propType": "object", "propType": "object",
"description": "自定义内联样式" "description": "自定义内联样式"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "Button.Group", "componentName": "Button.Group",
@ -4120,8 +4121,14 @@
{ {
"name": "children", "name": "children",
"propType": { "propType": {
"type": "instanceOf", "type": "oneOfType",
"value": "node" "value": [
"bool",
{
"type": "instanceOf",
"value": "node"
}
]
}, },
"description": "内容" "description": "内容"
}, },
@ -4284,8 +4291,10 @@
} }
], ],
"configure": { "configure": {
"isContainer": true, "component": {
"isModel": true "isContainer": true,
"isModel": true
}
} }
}, },
{ {
@ -6112,7 +6121,12 @@
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "SubMenu", "componentName": "SubMenu",
@ -6236,7 +6250,7 @@
] ]
}, },
{ {
"componentName": "SelectableItem", "componentName": "Menu.Item",
"title": "SelectableItem", "title": "SelectableItem",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
@ -6534,8 +6548,8 @@
] ]
}, },
{ {
"componentName": "Group", "componentName": "Menu.Group",
"title": "Group", "title": "Menu.Group",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -7838,7 +7852,7 @@
}, },
{ {
"name": "backgroundColor", "name": "backgroundColor",
"propType": "string", "propType": "color",
"description": "背景色" "description": "背景色"
}, },
{ {
@ -8228,6 +8242,11 @@
"name": "renderPreview", "name": "renderPreview",
"propType": "func", "propType": "func",
"description": "预览态模式下渲染的内容\n@param {number} value 评分值" "description": "预览态模式下渲染的内容\n@param {number} value 评分值"
},
{
"name": "value",
"propType": "number",
"description": "分值"
} }
] ]
}, },
@ -9958,6 +9977,73 @@
} }
] ]
}, },
{
"componentName": "Tag",
"title": "Tag",
"docUrl": "",
"screenshot": "",
"npm": {
"package": "@alifd/next",
"version": "1.19.18",
"exportName": "Tag",
"main": "src/index.js",
"destructuring": true
},
"props": [
{
"name": "prefix",
"propType": "string",
"defaultValue": "next-"
},
{
"name": "type",
"propType": {
"type": "oneOf",
"value": [
"normal",
"primary"
]
},
"description": "标签的类型"
},
{
"name": "size",
"propType": {
"type": "oneOf",
"value": [
"small",
"medium",
"large"
]
},
"description": "标签的尺寸large 尺寸为兼容表单场景 large = medium"
},
{
"name": "closeArea",
"propType": {
"type": "oneOf",
"value": [
"tag",
"tail"
]
}
},
{
"name": "color",
"propType": "string",
"description": "标签颜色, 目前支持blue、 green、 orange、red、 turquoise、 yellow 和 hex 颜色值 `color keywords`作为 Tag 组件的保留字,请勿直接使用 , `1.19.0` 以上版本生效"
},
{
"name": "children",
"propType": "array"
}
],
"configure": {
"component": {
"isContainer": true
}
}
},
{ {
"componentName": "TimePicker", "componentName": "TimePicker",
"title": "TimePicker", "title": "TimePicker",
@ -10252,7 +10338,12 @@
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "TimelineItem", "componentName": "TimelineItem",
@ -10510,11 +10601,24 @@
"propType": "func", "propType": "func",
"description": "接收 children 自定义渲染列表" "description": "接收 children 自定义渲染列表"
}, },
{
"name": "dataSource",
"propType": "array"
},
{ {
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"props": {
"isExtends": true,
"override": [{
"name": "dataSource",
"setter": "JsonSetter"
}]
}
}
}, },
{ {
"componentName": "Tree", "componentName": "Tree",
@ -10762,7 +10866,12 @@
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "TreeNode", "componentName": "TreeNode",
@ -11936,11 +12045,16 @@
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "Cell", "componentName": "ResponsiveGrid.Cell",
"title": "Cell", "title": "ResponsiveGrid.Cell",
"docUrl": "", "docUrl": "",
"screenshot": "", "screenshot": "",
"npm": { "npm": {
@ -11993,7 +12107,12 @@
"name": "style", "name": "style",
"propType": "object" "propType": "object"
} }
] ],
"configure": {
"component": {
"isContainer": true
}
}
}, },
{ {
"componentName": "Box", "componentName": "Box",
@ -12149,7 +12268,7 @@
"componentName": "Badge", "componentName": "Badge",
"props": { "props": {
"prefix": "next-", "prefix": "next-",
"overflowCount": 99 "showZero": true
} }
} }
} }
@ -12398,6 +12517,30 @@
} }
] ]
}, },
{
"componentName": "Menu.Item",
"title": "菜单项",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "菜单项",
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_menu.png",
"schema": {
"componentName": "Menu.Item",
"props": {
"parentMode": "inline",
"type": "item",
"component": "",
"disabled": true,
"className": "",
"needIndent": ""
}
}
}
]
},
{ {
"componentName": "Progress", "componentName": "Progress",
"title": "进度指示器", "title": "进度指示器",
@ -12492,6 +12635,46 @@
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_timeline.png", "screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_timeline.png",
"schema": { "schema": {
"componentName": "Timeline", "componentName": "Timeline",
"props": {
"prefix": "next-",
"fold": [],
"animation": true
},"children": [
{
"componentName": "TimelineItem",
"props": {
"state": "process",
"title": "12344"
}
},
{
"componentName": "TimelineItem",
"props": {
"title": "Ship"
}
},
{
"componentName": "TimelineItem",
"props": {
"title": "Order"
}
}
]
}
}
]
},{
"componentName": "TimelineItem",
"title": "时间轴 Item",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "时间轴 Item",
"screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_timeline.png",
"schema": {
"componentName": "TimelineItem",
"props": { "props": {
"prefix": "next-", "prefix": "next-",
"fold": [], "fold": [],
@ -12634,23 +12817,6 @@
} }
} }
] ]
},
{
"componentName": "Notification",
"title": "通知",
"icon": "",
"package": "@alife/next",
"library": "Next",
"snippets": [
{
"title": "通知",
"screenshot": "",
"schema": {
"componentName": "Notification",
"props": {}
}
}
]
} }
], ],
"icon": "" "icon": ""
@ -12706,9 +12872,9 @@
"type": "primary", "type": "primary",
"size": "large", "size": "large",
"htmlType": "button", "htmlType": "button",
"component": "button" "component": "button",
}, "children": ["提交"]
"children": "提交" }
} }
} }
] ]
@ -12811,7 +12977,9 @@
"screenshot": "", "screenshot": "",
"schema": { "schema": {
"componentName": "Icon", "componentName": "Icon",
"props": {} "props": {
"type": "smile"
}
} }
} }
] ]
@ -12856,17 +13024,17 @@
] ]
}, },
{ {
"componentName": "Shell", "componentName": "ResponsiveGrid.Cell",
"title": "框架", "title": "栅格布局 Cell",
"icon": "", "icon": "",
"package": "@alife/next", "package": "@alife/next",
"library": "Next", "library": "Next",
"snippets": [ "snippets": [
{ {
"title": "框架", "title": "栅格布局 Cell",
"screenshot": "", "screenshot": "",
"schema": { "schema": {
"componentName": "Shell", "componentName": "ResponsiveGrid.Cell",
"props": {} "props": {}
} }
} }
@ -12952,12 +13120,12 @@
"schema": { "schema": {
"componentName": "Breadcrumb.Item", "componentName": "Breadcrumb.Item",
"props": { "props": {
"prefix": "next-" "prefix": "next-",
}, "children": [
"children": [ "222",
"222", "222111"
"222111" ]
] }
} }
} }
] ]

View File

@ -286,10 +286,10 @@
"onClick":{ "onClick":{
"type":"JSFunction", "type":"JSFunction",
"value":"function(){ this.onClick() }" "value":"function(){ this.onClick() }"
} },
}, "children":[
"children":[
"新建配置"] "新建配置"]
}
}] }]
}, },
{ {
@ -456,13 +456,9 @@
"type":"JSExpression", "type":"JSExpression",
"value":"this.state.isShowDialog" "value":"this.state.isShowDialog"
}, },
"children":{
"type":"JSSlot"
},
"title":"标题", "title":"标题",
"footer":{
"type":"JSSlot"
},
"events":[ "events":[
] ]
} }

View File

@ -211,6 +211,7 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
) { ) {
if (component.isContainer !== false) { if (component.isContainer !== false) {
component.isContainer = true; component.isContainer = true;
props.push(propConfigToFieldConfig(prop));
return; return;
} }
} }

View File

@ -108,9 +108,17 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
const leaf = host.document.getNode(__id); const leaf = host.document.getNode(__id);
viewProps._leaf = leaf; viewProps._leaf = leaf;
viewProps._componentName = leaf?.componentName; viewProps._componentName = leaf?.componentName;
let _children = leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children;
if (props.children && props.children.length) {
if (Array.isArray(props.children)) {
_children = Array.isArray(_children) ? _children.concat(props.children) : props.children.unshift(_children);
} else {
Array.isArray(_children) && _children.push(props.children) || (_children = [_children].push(props.children));
}
}
// 如果是容器 && 无children && 高宽为空 增加一个占位容器,方便拖动 // 如果是容器 && 无children && 高宽为空 增加一个占位容器,方便拖动
if (leaf?.isContainer() && children == null && (!viewProps.style || Object.keys(viewProps.style).length == 0)){ if (leaf?.isContainer() && (_children == null || !_children.length) && (!viewProps.style || Object.keys(viewProps.style).length == 0)){
children = <div style={{ _children = <div style={{
height:'66px', height:'66px',
backgroundColor:'#f0f0f0', backgroundColor:'#f0f0f0',
borderColor:'#a7b1bd', borderColor:'#a7b1bd',
@ -142,10 +150,11 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
}); });
console.info('menuprops', viewProps); console.info('menuprops', viewProps);
} }
return createElement( return createElement(
getDeviceView(Component, device, designMode), getDeviceView(Component, device, designMode),
viewProps, viewProps,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children, _children,
); );
}} }}
onCompGetRef={(schema: any, ref: ReactInstance | null) => { onCompGetRef={(schema: any, ref: ReactInstance | null) => {