-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fix): add builder-next package and fix builder bugs.
fix(docs): update playground link and fix some bugs feat(fix): add builder-next package and fix builder bugs docs: update playground link
- Loading branch information
Showing
30 changed files
with
544 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# @uform/builder-next | ||
> UForm 可视化配置 next实现 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@uform/builder-next", | ||
"version": "0.1.0-beta.15", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/alibaba/uform.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/alibaba/uform/issues" | ||
}, | ||
"homepage": "https://github.com/alibaba/uform#readme", | ||
"engines": { | ||
"npm": ">=3.0.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0" | ||
}, | ||
"dependencies": { | ||
"@alifd/next": "^1.13.1", | ||
"@uform/builder": "^0.1.0-beta.14" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "f513fc2dcca781b3f7aa588c4419bce20cba2d8b" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import React from 'react' | ||
import SchemaForm, { FormButtonGroup, Submit, Reset } from '@uform/next' | ||
import Builder from '@uform/builder' | ||
|
||
import { | ||
Button, | ||
Collapse, | ||
Message, | ||
Upload, | ||
Input, | ||
Select, | ||
DatePicker, | ||
Icon, | ||
Checkbox, | ||
NumberPicker, | ||
TimePicker, | ||
Radio, | ||
Form, | ||
Tab | ||
} from '@alifd/next' | ||
|
||
// style | ||
import '@alifd/next/dist/next.css' | ||
|
||
SchemaForm.FormButtonGroup = FormButtonGroup | ||
SchemaForm.Submit = Submit | ||
SchemaForm.Reset = Reset | ||
|
||
const renderSchema = {} | ||
|
||
const props = { | ||
UI: { | ||
version: '1.x', | ||
Button, | ||
Accordion: Collapse, | ||
Toast: Message, | ||
Upload, | ||
Input, | ||
Select, | ||
Icon, | ||
DatePicker, | ||
TimePicker, | ||
Checkbox, | ||
NumberPicker, | ||
Radio, | ||
RadioGroup: Radio.Group, | ||
TabPane: Tab.Item, | ||
Form, | ||
Tab | ||
}, | ||
// 主题: dark/light,默认dark | ||
themeStyle: 'dark', | ||
// 是否展示布局组件,默认为false | ||
showLayoutField: true, | ||
// 是否展示预览按钮,默认为true | ||
showPreviewBtn: true, | ||
// 是否展示源码按钮 | ||
showSourceCodeBtn: true, | ||
// 控制返回按钮点击事件 | ||
onBackBtnClick: () => { | ||
alert('点击了返回') | ||
}, | ||
// 额外全局按钮 | ||
globalButtonList: [ | ||
// { | ||
// key: 'submit', | ||
// title: '自定义保存', | ||
// render: (props) => { | ||
// return <Badge dot>{props.children}</Badge> | ||
// }, | ||
// props: { | ||
// // loading: true, | ||
// }, | ||
// }, { | ||
// key: 'cancel', | ||
// title: '取消', | ||
// props: { | ||
// onClick: () => { | ||
// alert('点击取消'); | ||
// } | ||
// }, | ||
// } | ||
], | ||
// 是否展示全局配置 | ||
showGlobalCfg: true, | ||
// 全局配置额外项 | ||
extraGlobalCfgList: [ | ||
{ | ||
name: 'labelCol', | ||
title: 'label宽度占比', | ||
type: 'string' | ||
}, | ||
{ | ||
name: 'wrapperCol', | ||
title: 'wrapper宽度占比', | ||
type: 'string' | ||
} | ||
], | ||
globalCfg: {}, | ||
supportFieldList: [], | ||
includeFieldListKeyList: [ | ||
'input', | ||
'multipleInput', | ||
'number', | ||
'radio', | ||
'checkbox', | ||
'date', | ||
'month', | ||
'daterange', | ||
'time' | ||
], | ||
|
||
// 渲染引擎 | ||
renderEngine: SchemaForm, | ||
|
||
schema: renderSchema, | ||
// onChange: (data) => { | ||
// console.info('index onChange data', data); | ||
// }, | ||
onSubmit: data => { | ||
console.info('index onSubmit data', data) | ||
} | ||
} | ||
|
||
class Component extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
schema: renderSchema | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div style={{ marginTop: -20 }}> | ||
<Builder {...props} schema={this.state.schema} /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.