From 87dfa5d3e98d5d031a836e69ce7c7b3d998593ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=A5=E5=B8=8C?= Date: Mon, 27 Jul 2020 11:10:24 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20demo=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/code-generator/demo/assets.json | 480 +++++++++++++++++++++-- packages/code-generator/demo/schema.json | 474 +++++++++++++++++----- 2 files changed, 822 insertions(+), 132 deletions(-) diff --git a/packages/code-generator/demo/assets.json b/packages/code-generator/demo/assets.json index 3a9ce284a..f46fd9f22 100644 --- a/packages/code-generator/demo/assets.json +++ b/packages/code-generator/demo/assets.json @@ -25,6 +25,12 @@ { "componentName": "Page", "title": "Page", + "props": [ + { + "name": "style", + "propType": "object" + } + ], "configure": { "events": { "supportedLifecycles": [ @@ -60,6 +66,272 @@ } } }, + { + "componentName": "Table", + "title": "Table", + "docUrl": "", + "screenshot": "", + "npm": { + "package": "@alifd/next", + "version": "1.19.18", + "exportName": "Table", + "main": "src/index.js", + "destructuring": true, + "subName": "" + }, + "props": [ + { + "name": "prefix", + "propType": "string" + }, + { + "name": "pure", + "propType": "bool" + }, + { + "name": "rtl", + "propType": "bool" + }, + { + "name": "tableLayout", + "propType": { + "type": "oneOf", + "value": [ + "fixed", + "auto" + ] + } + }, + { + "name": "tableWidth", + "propType": "number" + }, + { + "name": "className", + "propType": "string" + }, + { + "name": "style", + "propType": "object" + }, + { + "name": "size", + "propType": { + "type": "oneOf", + "value": [ + "small", + "medium" + ] + } + }, + { + "name": "dataSource", + "propType": { + "type": "arrayOf", + "value": "object" + } + }, + { + "name": "entireDataSource", + "propType": "array" + }, + { + "name": "onRowClick", + "propType": "func" + }, + { + "name": "onRowMouseEnter", + "propType": "func" + }, + { + "name": "rowProps", + "propType": "func" + }, + { + "name": "cellProps", + "propType": "func" + }, + { + "name": "hasBorder", + "propType": "bool" + }, + { + "name": "hasHeader", + "propType": "bool" + }, + { + "name": "isZebra", + "propType": "bool" + }, + { + "name": "loading", + "propType": "bool" + }, + { + "name": "filterParams", + "propType": "object" + }, + { + "name": "sort", + "propType": "object" + }, + { + "name": "sortIcons", + "propType": "object" + }, + { + "name": "locale", + "propType": "object" + }, + { + "name": "components", + "propType": "object" + }, + { + "name": "columns", + "propType": "array" + }, + { + "name": "emptyContent", + "propType": "node" + }, + { + "name": "primaryKey", + "propType": "string" + }, + { + "name": "lockType", + "propType": { + "type": "oneOf", + "value": [ + "left", + "right" + ] + } + },{ + "name": "style", + "propType": "object" + }, + { + "name": "wrapperContent", + "propType": "any" + }, + { + "name": "refs", + "propType": "object" + }, + { + "name": "expandedRowRender", + "propType": "func" + }, + { + "name": "expandedRowIndent", + "propType": "array" + }, + { + "name": "hasExpandedRowCtrl", + "propType": "bool" + }, + { + "name": "getExpandedColProps", + "propType": "func" + }, + { + "name": "openRowKeys", + "propType": "array" + }, + { + "name": "onRowOpen", + "propType": "func" + }, + { + "name": "onExpandedRowClick", + "propType": "func" + }, + { + "name": "fixedHeader", + "propType": "bool" + }, + { + "name": "rowSelection", + "propType": "object" + }, + { + "name": "stickyHeader", + "propType": "bool" + }, + { + "name": "offsetTop", + "propType": "number" + }, + { + "name": "affixProps", + "propType": "object" + }, + { + "name": "indent", + "propType": "number" + }, + { + "name": "isTree", + "propType": "bool" + }, + { + "name": "useVirtual", + "propType": "bool" + }, + { + "name": "onBodyScroll", + "propType": "func" + }, + { + "name": "expandedIndexSimulate", + "propType": "bool" + }, + { + "name": "crossline", + "propType": "bool" + }, + { + "name": "lengths", + "propType": "object" + } + ], + "configure": { + "component": { + "isContainer": true + }, + "props": { + "isExtends": true, + "override": [{ + "name": "dataSource", + "setter": "JsonSetter" + }] + } + } + }, + { + "componentName": "Table.Column", + "title": "Table.Column", + "npm": { + "package": "@alifd/next", + "version": "1.19.18", + "exportName": "Table", + "main": "src/index.js", + "destructuring": true, + "subName": "Column" + }, + "props": [ + { + "name": "title", + "propType": "string" + }, + { + "name": "dataIndex", + "propType": "string" + } + ] + }, { "componentName": "Badge", "title": "Badge", @@ -614,7 +886,7 @@ "name": "children", "propType": { "type": "instanceOf", - "value": "custom" + "value": "node" }, "description": "面包屑子节点,需传入 Breadcrumb.Item" }, @@ -663,7 +935,12 @@ "name": "style", "propType": "object" } - ] + ], + "configure": { + "component": { + "isContainer": true + } + } }, { "componentName": "MCBreadcrumb", @@ -699,7 +976,7 @@ "name": "children", "propType": { "type": "instanceOf", - "value": "custom" + "value": "node" }, "description": "面包屑子节点,需传入 Breadcrumb.Item" }, @@ -748,7 +1025,12 @@ "name": "style", "propType": "object" } - ] + ], + "configure": { + "component": { + "isContainer": true + } + } }, { "componentName": "Breadcrumb.Item", @@ -804,7 +1086,12 @@ "name": "style", "propType": "object" } - ] + ], + "configure": { + "component": { + "isContainer": true + } + } }, { "componentName": "Button", @@ -962,12 +1249,7 @@ "propType": "object", "description": "自定义内联样式" } - ], - "configure": { - "component": { - "isContainer": true - } - } + ] }, { "componentName": "Button.Group", @@ -3823,7 +4105,7 @@ }, { "name": "visible", - "propType": "bool", + "propType": "oneOfType", "description": "是否显示", "defaultValue": false }, @@ -4000,7 +4282,11 @@ "name": "style", "propType": "object" } - ] + ], + "configure": { + "isContainer": true, + "isModel": true + } }, { "componentName": "Inner", @@ -4266,26 +4552,6 @@ } ] }, - { - "componentName": "Table", - "title": "Table", - "docUrl": "", - "screenshot": "", - "npm": { - "package": "@alifd/next", - "version": "1.19.18", - "exportName": "Table", - "main": "src/index.js", - "destructuring": true, - "subName": "" - }, - "props": [ - { - "name": "style", - "propType": "object" - } - ] - }, { "componentName": "Form", "title": "Form", @@ -11888,6 +12154,72 @@ } } ] + },{ + "componentName": "Table", + "title": "表格", + "icon": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_table.png", + "package": "@alife/next", + "library": "Next", + "snippets": [ + { + "title": "表格", + "screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_table.png", + "schema": { + "componentName": "Table", + "props": { + "dataSource": [{ + "id": 1, "time": "2016" + },{ + "id": 2, "time": "2017" + }], + "size": "medium", + "prefix": "next-", + "hasBorder": true, + "hasHeader": true, + "isZebra": false, + "loading": false, + "expandedIndexSimulate": false, + "primaryKey": "id", + "locale": "zhCN.Table", + "crossline": false + }, + "children": [ + { + "componentName": "Table.Column", + "props": { + "title": "id", + "dataIndex": "id" + } + }, + { + "componentName": "Table.Column", + "props": { + "title": "time", + "dataIndex": "time" + } + } + ] + } + } + ] + },{ + "componentName": "Table.Column", + "title": "表格列", + "icon": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_table.png", + "package": "@alife/next", + "library": "Next", + "snippets": [ + { + "title": "表格列", + "screenshot": "https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_table.png", + "schema": { + "componentName": "Table.Column", + "props": { + "title": "name" + } + } + } + ] }, { "componentName": "Calendar", @@ -12381,6 +12713,54 @@ } ] }, + { + "componentName": "Button.Group", + "title": "按钮组", + "icon": "", + "package": "@alife/next", + "library": "Next", + "snippets": [ + { + "title": "按钮组", + "screenshot": "https://img.alicdn.com/tfs/TB1t6dhvV67gK0jSZPfXXahhFXa-310-122.png", + "schema": { + "componentName": "Button.Group", + "props": { + + }, + "children": [{ + "componentName": "Button", + "props": { + "type": "primary", + "style": { + "margin": "0 5px 0 5px" + }, + "htmlType": "submit" + }, + "children": [ + { + "componentName": "Icon", + "props": { + "type": "success" + } + }, + "提交" + ] + }, { + "componentName": "Button", + "props": { + "type": "normal", + "style": { + "margin": "0 5px 0 5px" + }, + "htmlType": "reset" + }, + "children": "重置" + }] + } + } + ] + }, { "componentName": "Divider", "title": "分隔符", @@ -12559,6 +12939,28 @@ } } ] + },{ + "componentName": "Breadcrumb.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_breadcrumb.png", + "schema": { + "componentName": "Breadcrumb.Item", + "props": { + "prefix": "next-" + }, + "children": [ + "222", + "222111" + ] + } + } + ] }, { "componentName": "MCBreadcrumb", @@ -12763,17 +13165,23 @@ }, { "componentName": "Form.Item", - "title": "表单辅助工具", + "title": "Form.Item", "icon": "", "package": "@alife/next", "library": "Next", "snippets": [ { - "title": "表单辅助工具", + "title": "Form.Item", "screenshot": "", "schema": { "componentName": "Form.Item", - "props": {} + "props": { + "style":{ + "margin-bottom": "0", + "min-width": "200px", + "min-height": "28px" + } + } } } ] diff --git a/packages/code-generator/demo/schema.json b/packages/code-generator/demo/schema.json index e5a3b43e7..0e60ac61c 100644 --- a/packages/code-generator/demo/schema.json +++ b/packages/code-generator/demo/schema.json @@ -1,138 +1,420 @@ { "componentName": "Page", + "id": "node_dockcviv8fo1", + "props": { + "ref": "outterView", + "autoLoading": true, + "style": { + "padding": "0 5px 0 5px" + } + }, "fileName": "test", "dataSource": { "list": [] }, "state": { - "text": "outter" + "text": "outter", + "isShowDialog": false }, - "css": "body {font-size: 12px;} .botton{width:100px;color:#ff00ff}", "lifeCycles": { "componentDidMount": { - "type": "JSExpression", - "value": "function() {\n \t\tconsole.log('did mount');\n\t}" + "type": "JSFunction", + "value": "function() {\n console.log('did mount');\n }" }, "componentWillUnmount": { - "type": "JSExpression", - "value": "function() {\n \t\tconsole.log('will umount');\n\t}" + "type": "JSFunction", + "value": "function() {\n console.log('will umount');\n }" } }, - "methods": { "testFunc": { "type": "JSFunction", - "value": "function() {console.log('test func');}" - } - }, - - "props": { - "ref": "outterView", - "autoLoading": true, - "style": { - "padding": 20 + "value": "function() {\n console.log('test func');\n }" + }, + "onClick": { + "type": "JSFunction", + "value": "function(){\n this.setState({\n isShowDialog:true\n })\n\t}" } }, "children": [{ - "componentName": "Form", + "componentName": "Box", + "id": "node_dockcy8n9xed", "props": { - "labelCol": 3, - "style": {}, - "ref": "testForm" + "style": { + "backgroundColor": "rgba(31,56,88,0.1)", + "padding": "12px 12px 12px 12px" + } }, "children": [{ - "componentName": "Form.Item", - "props": { - "label": "姓名:", - "name": "name", - "initValue": "李雷" - }, - "children": [{ - "componentName": "Input", - "props": { - "placeholder": "请输入", - "size": "medium", - "style": { - "width": 320 - } - } - }] - }, { - "componentName": "Form.Item", - "props": { - "label": "年龄:", - "name": "age", - "initValue": "22" - }, - "children": [{ - "componentName": "NumberPicker", - "props": { - "size": "medium", - "type": "normal" - } - }] - }, { - "componentName": "Form.Item", - "props": { - "label": "职业:", - "name": "profession" - }, - "children": [{ - "componentName": "Select", - "props": { - "dataSource": [{ - "label": "教师", - "value": "t" - }, { - "label": "医生", - "value": "d" - }, { - "label": "歌手", - "value": "s" - }] - } - }] - }, { - "componentName": "Form.Item", + "componentName": "Box", + "id": "node_dockcy8n9xee", "props": { "style": { - "textAlign": "center" + "padding": "12px 12px 12px 12px", + "backgroundColor": "#ffffff" } }, "children": [{ - "componentName": "Button.Group", - "props": {}, + "componentName": "Breadcrumb", + "id": "node_dockcy8n9xef", + "props": { + "prefix": "next-", + "maxNode": 100, + "component": "nav" + }, "children": [{ - "componentName": "Button", + "componentName": "Breadcrumb.Item", + "id": "node_dockcy8n9xeg", "props": { - "type": "primary", - "style": { - "margin": "0 5px 0 5px" - }, - "htmlType": "submit" + "prefix": "next-" }, - "children": [ - { + "children": ["首页"] + }, { + "componentName": "Breadcrumb.Item", + "id": "node_dockcy8n9xei", + "props": { + "prefix": "next-" + }, + "children": ["品质中台"] + }, { + "componentName": "Breadcrumb.Item", + "id": "node_dockcy8n9xek", + "props": { + "prefix": "next-" + }, + "children": ["商家品质页面管理"] + }, { + "componentName": "Breadcrumb.Item", + "id": "node_dockcy8n9xem", + "props": { + "prefix": "next-" + }, + "children": ["质检知识条配置"] + }] + }] + }, { + "componentName": "Box", + "id": "node_dockcy8n9xeo", + "props": { + "style": { + "marginTop": "12px", + "backgroundColor": "#ffffff" + } + }, + "children": [{ + "componentName": "Form", + "id": "node_dockcy8n9xep", + "props": { + "inline": true, + "style": { + "marginTop": "12px", + "marginRight": "12px", + "marginLeft": "12px" + }, + "__events": [] + }, + "children": [{ + "componentName": "Form.Item", + "id": "node_dockcy8n9xeq", + "props": { + "style": { + "marginBottom": "0" + }, + "label": "类目名:" + }, + "children": [{ + "componentName": "Select", + "id": "node_dockcy8n9xer", + "props": { + "mode": "single", + "hasArrow": true, + "cacheValue": true, + "style": { + "width": "150px" + } + } + }] + }, { + "componentName": "Form.Item", + "id": "node_dockcy8n9xes", + "props": { + "style": { + "marginBottom": "0" + }, + "label": "项目类型:" + }, + "children": [{ + "componentName": "Select", + "id": "node_dockcy8n9xet", + "props": { + "mode": "single", + "hasArrow": true, + "cacheValue": true, + "style": { + "width": "200px" + } + } + }] + }, { + "componentName": "Form.Item", + "id": "node_dockcy8n9xeu", + "props": { + "style": { + "marginBottom": "0" + }, + "label": "项目 ID:" + }, + "children": [{ + "componentName": "Input", + "id": "node_dockcy8n9xev", + "props": { + "hasBorder": true, + "size": "medium", + "autoComplete": "off", + "style": { + "width": "200px" + } + } + }] + }, { + "componentName": "Button.Group", + "id": "node_dockcy8n9xew", + "props": {}, + "children": [{ + "componentName": "Button", + "id": "node_dockcy8n9xex", + "props": { + "type": "primary", + "style": { + "margin": "0 5px 0 5px" + }, + "htmlType": "submit" + }, + "children": [{ "componentName": "Icon", + "id": "node_dockcy8n9xey", "props": { "type": "success" } + }, "搜索"] + }, { + "componentName": "Button", + "id": "node_dockcy8n9xe10", + "props": { + "type": "normal", + "style": { + "margin": "0 5px 0 5px" + }, + "htmlType": "reset" }, - "提交" - ] - }, { - "componentName": "Button", - "props": { - "type": "normal", - "style": { - "margin": "0 5px 0 5px" - }, - "htmlType": "reset" - }, - "children": "重置" + "children": ["清空"] + }] }] }] + }, { + "componentName": "Box", + "id": "node_dockcy8n9xe12", + "props": { + "style": { + "justifyContent": "flex-end", + "display": "flex", + "backgroundColor": "#ffffff", + "flexDirection": "row", + "paddingRight": "24px" + } + }, + "children": [{ + "componentName": "Button", + "id": "node_dockcy8n9xe13", + "props": { + "prefix": "next-", + "type": "primary", + "size": "medium", + "htmlType": "button", + "component": "button", + "style": { + "width": "100px" + }, + "events": { + "onClick": { + "type": "JSFunction", + "value": "function(){ this.onClick() }", + "__eventData": { + "type": "componentEvent", + "name": "onClick", + "relatedEventName": "onClick" + } + } + }, + "__events": [{ + "type": "componentEvent", + "name": "onClick", + "relatedEventName": "onClick" + }], + "onClick": { + "type": "JSFunction", + "value": "function(){ this.onClick() }" + } + }, + "children": ["新建配置"] + }] + }, { + "componentName": "Box", + "id": "node_dockcy8n9xe15", + "props": { + "style": { + "backgroundColor": "#ffffff" + } + }, + "children": [{ + "componentName": "Table", + "id": "node_dockcy8n9xe16", + "props": { + "dataSource": [{ + "firstCategory": "其他", + "secondCategory": "新品预览", + "leafCategory": "", + "projectType": "标识判断", + "projectId": "", + "title": "其他类目->新品预览类目类型知识库", + "url": "其他", + "operation": "编辑" + }, { + "firstCategory": "其他", + "secondCategory": "新品预览", + "leafCategory": "", + "projectType": "", + "projectId": "1", + "title": "其他类目->新品预览项目Id知识库", + "url": "其他", + "operation": "编辑" + }], + "size": "medium", + "prefix": "next-", + "hasBorder": true, + "hasHeader": true, + "isZebra": false, + "loading": false, + "expandedIndexSimulate": false, + "primaryKey": "id", + "locale": "zhCN.Table", + "crossline": false, + "style": { + "margin": "24px 12px 24px 12px" + } + }, + "children": [{ + "componentName": "Table.Column", + "id": "node_dockcy8n9xe17", + "props": { + "title": "一级类目", + "dataIndex": "firstCategory" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe18", + "props": { + "title": "二级类目", + "dataIndex": "secondCategory" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe19", + "props": { + "title": "叶子类目", + "dataIndex": "leafCategory" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe1a", + "props": { + "title": "项目类型", + "dataIndex": "projectType" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe1b", + "props": { + "title": "项目 ID", + "dataIndex": "projectId" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe1c", + "props": { + "title": "知识条标题", + "dataIndex": "title" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe1d", + "props": { + "title": "知识条链接", + "dataIndex": "url" + } + }, { + "componentName": "Table.Column", + "id": "node_dockcy8n9xe1e", + "props": { + "title": "操作", + "dataIndex": "operation" + } + }] + }] + }, { + "componentName": "Box", + "id": "node_dockcy8n9xe1f", + "props": { + "style": { + "backgroundColor": "#ffffff", + "paddingBottom": "24px" + } + }, + "children": [{ + "componentName": "Pagination", + "id": "node_dockcy8n9xe1g", + "props": { + "prefix": "next-", + "type": "normal", + "shape": "normal", + "size": "medium", + "defaultCurrent": 1, + "total": 100, + "pageShowCount": 5, + "pageSize": 10, + "pageSizePosition": "start", + "showJump": true, + "style": { + "display": "flex", + "justifyContent": "flex-end" + } + } + }] }] + }, { + "componentName": "Dialog", + "id": "node_dockcy8n9xe1h", + "props": { + "prefix": "next-", + "footerAlign": "right", + "footerActions": ["ok", "cancel"], + "closeable": "esc,close", + "hasMask": true, + "align": "cc cc", + "minMargin": 40, + "visible": { + "type": "JSExpression", + "value": "this.state.isShowDialog" + }, + "children": { + "type": "JSSlot" + }, + "title": "标题", + "footer": { + "type": "JSSlot" + }, + "events": [] + } }] }