Skip to content

Commit 2ac6ac3

Browse files
author
lkccy
committed
Merge branch 'develop'
2 parents 4b72b93 + e4aac2a commit 2ac6ac3

24 files changed

+313
-98
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# element-schema-form
22

33
<p align="left">
4-
<a href="https://travis-ci.org/vueblocks/element-schema-form"><img src="https://travis-ci.org/vueblocks/element-schema-form.svg?branch=dev"></a>
4+
<!-- <a href="https://travis-ci.org/vueblocks/element-schema-form"><img src="https://travis-ci.org/vueblocks/element-schema-form.svg?branch=dev"></a> -->
55
<a href="https://www.npmjs.com/package/@vueblocks/element-schema-form" target="_blank"><img src="https://img.shields.io/npm/v/@vueblocks/element-schema-form.svg"></a>
66
<a href="https://github.com/vueblocks/element-schema-form"><img src="https://img.shields.io/github/stars/vueblocks/element-schema-form.svg"></a>
77
<a href="https://github.com/vueblocks/element-schema-form"><img src="https://img.shields.io/github/license/vueblocks/element-schema-form.svg"></a>
@@ -21,7 +21,17 @@ npm i @vueblocks/element-schema-form -S
2121

2222
## Online Demo
2323

24-
> [WIP]
24+
### 表单验证
25+
26+
[![Edit 表单验证](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/biaodanyanzheng-er1t1?fontsize=14&hidenavigation=1&theme=dark)
27+
28+
### 数字类型验证
29+
30+
[![Edit 数字类型验证](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/shuzileixingyanzheng-eezhn?fontsize=14&hidenavigation=1&theme=dark)
31+
32+
### 动态增减表单项
33+
34+
[![Edit 动态增减表单项](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/dongtaizengjianbiaodanxiang-h0ogx?fontsize=14&hidenavigation=1&theme=dark)
2535

2636
## License
2737

app/views/test-common/const.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@ export const schema = [
7373
formItem: { label: '成绩' },
7474
attrs: { 'show-stops': true, step: 10 }
7575
}, {
76-
type: 'timeselect',
76+
type: 'timepicker',
7777
prop: 'sleepTime',
78-
formItem: { label: '晚睡时间' }
78+
formItem: { label: '晚睡时间' },
79+
attrs: {
80+
'picker-options': {
81+
selectableRange: '18:30:00 - 20:30:00'
82+
},
83+
'arrow-control': true
84+
}
7985
}, {
8086
type: 'rate',
8187
prop: 'star',

docs/.vuepress/components/code-contain.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</template>
1515

1616
<script>
17+
1718
// 在线示例
1819
import BasicValidate from './basic-validate'
1920
import ValidateNumber from './validate-number'
@@ -30,6 +31,8 @@ import SlotSlot from './slot-slot'
3031
import CustomInput from './custom-input'
3132
// 动态属性
3233
import DynamicInput from './dynamic-input'
34+
// 拓展组件
35+
import ExpandCodeMirror from './expand-code-mirror'
3336
3437
export default {
3538
props: {
@@ -50,7 +53,8 @@ export default {
5053
SlotRear,
5154
SlotSlot,
5255
CustomInput,
53-
DynamicInput
56+
DynamicInput,
57+
ExpandCodeMirror
5458
},
5559
data () {
5660
return {

docs/.vuepress/components/dynamic-input.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
computed: {
2222
schema () {
2323
return [
24-
[
24+
[
2525
{
2626
type: 'switch',
2727
prop: 'editable',
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<el-form label-position="top">
3+
<schema-form
4+
:model="model"
5+
:schema="schema"
6+
>
7+
</schema-form>
8+
</el-form>
9+
</template>
10+
11+
<script>
12+
export default {
13+
data () {
14+
return {
15+
model: { code: 'let a = 100' },
16+
schema: [
17+
[
18+
{
19+
type: 'codemirror',
20+
prop: 'code',
21+
formItem: { label: '代码镜像' },
22+
attrs: {
23+
cmOptions: {
24+
tabSize: 2,
25+
mode: 'text/javascript',
26+
theme: 'night',
27+
lineNumbers: true,
28+
line: true
29+
}
30+
},
31+
on: {
32+
change: this.codeChange
33+
}
34+
}
35+
]
36+
]
37+
}
38+
},
39+
methods: {
40+
codeChange (code) {
41+
console.log(code)
42+
}
43+
}
44+
}
45+
</script>
46+
47+
<style scoped>
48+
49+
</style>

docs/.vuepress/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
title: 'Element Schema Form',
3-
description: '基于 JSON Schema 构建 Element 表单',
3+
description: '基于 JSON Schema 构建 Element 表单,表单页面开发从未如此高效',
44
base: '/element-schema-form/',
55
port: 5454,
66
themeConfig: {
@@ -31,7 +31,6 @@ module.exports = {
3131
'快速开始',
3232
'更新日志',
3333
'在线示例',
34-
'设计导图',
3534
]
3635
},
3736
{
@@ -44,7 +43,8 @@ module.exports = {
4443
['/guide/component/layout', 'layout 布局'],
4544
['/guide/component/slot', 'slot 插槽'],
4645
['/guide/component/dynamic', 'dynamicAttrs 动态属性'],
47-
['/guide/component/custom', '自定义组件']
46+
['/guide/component/custom', '自定义组件'],
47+
['/guide/component/expand', '第三方拓展']
4848
]
4949
}
5050
]

docs/.vuepress/enhanceApp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import CustomNumber from './components/custom/custom-number.vue'
55
import "element-ui/lib/theme-chalk/index.css"
66
import '@vuepress/theme-default'
77

8+
89
export default ({ Vue }) => {
910
Vue.use(SchemaForm)
1011
Vue.use(ElementUI)
12+
// Vue.use(SchemaFormQuill)
1113
Vue.component('CustomNumber', CustomNumber)
1214
}

docs/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ heroImage: /element-schema-form__logo.jpg
44
actionText: 快速开始 →
55
actionLink: /guide/
66
features:
7-
- title: Schema Form Based
8-
details: 基于 JSON 数据结构的 Schema
9-
- title: Element Based
10-
details: 基于 Element UI组件库的 Form 表单
11-
- title: Responsable Form
12-
details: 响应式的栅格表单布局。
7+
- title: JSON Schema Based
8+
details: 基于 JSON Schema 规范的数据驱动
9+
- title: Element UI Based
10+
details: 基于 Element UI 组件库的 Form 表单
11+
- title: Responsive Form
12+
details: 灵活的响应式的栅格表单布局
1313
footer: MIT Licensed | Copyright © 2019-present VueBlocks
1414
---

docs/guide/README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,43 @@
44
}
55
---
66

7-
## Element Schema Form
7+
## 背景
88

9-
**Element Schema Form** 是一个基于 `Vue``element-ui` 技术栈封装的表单组件库
9+
前端领域里,在中后台实际业务场景中,基本上逃不过表单页面的开发,表单页面承担着数据输入的角色,是数据收集的重要来源
1010

11-
用于解决大型、复杂表单页面开发过程中所做的大量重复性工作。
11+
而对于工程中使用 **Element** 作为UI组件库的项目而言,前端开发者在使用 `el-form` 的时候可能更多的都在关注:
1212

13-
Element Schema Form 使用一份 JSON Schema 即可生成一个成型的 form 表单。
13+
* 如何布局表单
14+
* 表单控件类型
15+
* 表单控件配置项
16+
* 表单的状态管理
17+
* 表单校验
18+
19+
从而为了实现一个业务场景复杂的表单,往往要编写大量重复的代码,以及产生篇幅巨大的单页面组件,而这样的开发方式是不必要的。
20+
21+
## 方案
22+
23+
经过我们在表单领域的不断探索与尝试,总结出了一套基于 **JSON Schema** 规范的数据动态生成表单的解决方案 **Element Schema Form**
24+
25+
**Element Schema Form** 是一个基于 `Vue``element-ui` 技术栈封装的表单组件,用于解决大型、复杂表单页面开发过程中所做的大量重复性工作。使用一份 JSON Schema 即可生成一个成型的 form 表单,使表单组件代码变得简洁并便于维护。开发表单更高效。
1426

1527
## 核心功能
1628

1729
* 基于 JSON Schema 的数据结构生成表单
1830
* 基于 `el-row`/`el-col` 的灵活表单布局
1931
* 支持所有 `element-ui` 基础表单组件
20-
* 支持常用第三方扩展组件,如 `codemirror``quill-editor``jsoneditor`
32+
* 支持常用第三方扩展组件,如 `codemirror``quill editor``markdown editor`
2133
* 支持个性化的自定义插槽组件
34+
* 支持可视化构建表单
35+
36+
## JSON Schema 规范
37+
38+
如果你还不了解什么是 JSON Schema,请移步这里 [JSON Schema](https://json-schema.org/)
2239

2340
## 可视化探索
2441

25-
我们提供了基于 `@vueblocks/element-schema-form` 开发的表单设计器 [element-form-generator](https://github.com/vueblocks/element-form-generator)
42+
为了开发更高效,我们提供了基于 **Element Schema Form** 开发的可视化配置工具
43+
44+
表单设计器 [element-form-generator](https://github.com/vueblocks/element-form-generator)
2645

27-
只需简单操作几步即可配置好一个 form 表单
46+
只需简单操作几步即可配置好一个 form 表单

docs/guide/component/SchemaForm.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
---
66

77

8-
### 组件使用
8+
## 组件使用
99

1010
```vue
1111
<template>
@@ -38,16 +38,16 @@ export default {
3838
</script>
3939
```
4040

41-
### Props
41+
## Props
4242

43-
#### layout
43+
### layout
4444

45-
##### 表单布局信息,详见 [layout布局](layout.html)
45+
#### 表单布局信息,详见 [layout布局](layout.html)
4646

4747

48-
#### model
48+
### model
4949

50-
##### 表单数据对象,表单绑定值的集合,例如
50+
#### 表单数据对象,表单绑定值的集合,例如
5151
``` js
5252
{
5353
model: {
@@ -57,8 +57,8 @@ export default {
5757
}
5858
```
5959

60-
#### schema
61-
##### 表单模板,用于表单的构建。详情见 [schema 详解](schema.html)
60+
### schema
61+
#### 表单模板,用于表单的构建。详情见 [schema 详解](schema.html)
6262

6363
参数|说明|类型|可选值|默认值
6464
:--|:--|:--|:--|:--
@@ -72,9 +72,9 @@ on|组件事件|object|-|-
7272
hide|是否隐藏|boolean|-|false
7373
colGrid|栅格布局,与el-col属性相同|object|-|-
7474

75-
#### options
75+
### options
7676

77-
##### 表单可选数据源,如我们常用的 el-select 的数据源
77+
#### 表单可选数据源,如我们常用的 el-select 的数据源
7878
``` js
7979
{
8080
options: {

0 commit comments

Comments
 (0)