Skip to content

Commit 498f213

Browse files
Merge pull request #14 from vueblocks/develop
Develop
2 parents 0ccc0d5 + a0f216d commit 498f213

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+9982
-58491
lines changed

app/main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ import './theme/index.css'
1414
import 'codemirror/theme/cobalt.css'
1515
import 'codemirror/mode/javascript/javascript.js'
1616

17-
import SchemaForm, { SchemaFormItem, SchemaFormJsoneditor, SchemaFormQuill, SchemaFormCodemirror } from '../src/index'
17+
import SchemaForm, {
18+
SchemaFormItem,
19+
SchemaFormJsoneditor,
20+
SchemaFormQuill,
21+
SchemaFormCodemirror
22+
} from '../src/index'
23+
// } from '../lib/element-schema-form.common'
1824

1925
Vue.use(ElementUI, {
2026
size: 'small'

app/store/global-actions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import types from './mutation-types'
22
import Immutable from 'immutable'
33
import shortid from 'js-shortid'
44

5+
const makeAction = type => {
6+
return ({ commit }, ...args) => commit(type, ...args)
7+
}
8+
59
export default {
610
addRow ({ commit, state }, reload) {
711
let { layoutSections } = state
@@ -67,7 +71,7 @@ export default {
6771
let _list = Immutable.fromJS(layoutSections)
6872
commit(types.UPDATE_LAYOUT_SECTIONS, _list.set(activeSection, newVal).toJS())
6973
},
70-
async delteColComp ({ commit, state, dispatch }, { colIndex, newVal, prop }) {
74+
async deleteColComp ({ commit, state, dispatch }, { colIndex, newVal, prop }) {
7175
let { layoutSections, activeSection } = state
7276
let _list = Immutable.fromJS(layoutSections)
7377
console.log(1)
@@ -123,5 +127,6 @@ export default {
123127
] })
124128
}
125129
commit(types.UPDATE_ACTIVE_PROP, `default_${_propIdx}`)
126-
}
130+
},
131+
resetGlobalStore: makeAction('RESET_GLOBAL_STORE')
127132
}

app/store/global-mutations.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,29 @@ export default {
3030
},
3131
[types.UPDATE_FORM_CONTROL] (state, load) {
3232
state.formControl = Object.assign(state.formControl, load)
33+
},
34+
[types.RESET_GLOBAL_STORE](state, load) {
35+
const originState = {
36+
iterationIdx: 0, // 迭代指针
37+
layoutSections: [], // schema 信息
38+
formModel: {},
39+
formOptions: {},
40+
formLayout: { // 表单布局
41+
gutter: 16,
42+
justify: 'start'
43+
},
44+
formSettings: { // 表单属性
45+
labelPosition: 'left',
46+
size: 'small',
47+
labelWidth: '80px'
48+
},
49+
formControl: { // 布局控制
50+
showGrid: false,
51+
showLayout: false
52+
},
53+
activeSection: 0, // 激活的行数
54+
activeProp: '' // 激活的组件prop
55+
}
56+
state = Object.assign(state, originState)
3357
}
3458
}

app/store/mutation-types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export default {
77
UPDATE_ITERATION_IDX: 'UPDATE_ITERATION_IDX',
88
UPDATE_FORM_SETTING: 'UPDATE_FORM_SETTING',
99
UPDATE_FORM_LAYOUT: 'UPDATE_FORM_LAYOUT',
10-
UPDATE_FORM_CONTROL: 'UPDATE_FORM_CONTROL'
10+
UPDATE_FORM_CONTROL: 'UPDATE_FORM_CONTROL',
11+
RESET_GLOBAL_STORE: 'RESET_GLOBAL_STORE'
1112
}

app/views/form-generator/aside-panel/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default {
9999
'editRow',
100100
'deleteRow',
101101
'changeRow',
102-
'delteColComp'
102+
'deleteColComp'
103103
]),
104104
checkMove (e) {
105105
console.log('Future index: ' + e.draggedContext.futureIndex)
@@ -109,7 +109,7 @@ export default {
109109
isCustom: 'btn-addCol',
110110
colGrid: element.colGrid
111111
}
112-
this.delteColComp({ colIndex, newVal: oldSection, prop: element.prop })
112+
this.deleteColComp({ colIndex, newVal: oldSection, prop: element.prop })
113113
},
114114
onAddRow (data) {
115115
const initVal = data.map((val, idx) => {

app/views/form-generator/config-panel/module/component-panel.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<figcaption class="component-panel__figcaption">
66
<span>通用属性</span>
77
</figcaption>
8-
<label-layout title="标签名称:">
9-
<el-input v-model="editInfo.formItem.label"></el-input>
10-
</label-layout>
11-
<label-layout title="数据字段:">
12-
<el-input v-model="editInfo.prop"></el-input>
13-
</label-layout>
14-
<label-layout title="栅格数:">
15-
<el-input v-model.number="editInfo.colGrid.span"></el-input>
16-
</label-layout>
8+
<label-layout title="标签名称:">
9+
<el-input v-model="editInfo.formItem.label"></el-input>
10+
</label-layout>
11+
<label-layout title="数据字段:">
12+
<el-input v-model="editInfo.prop"></el-input>
13+
</label-layout>
14+
<label-layout title="栅格数:">
15+
<el-input v-model.number="editInfo.colGrid.span"></el-input>
16+
</label-layout>
1717
</fieldset>
1818
<!-- 定制属性 -->
1919
<fieldset class="component-panel__fieldset">

app/views/form-generator/dialog/PreviewForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:options="options"
2020
>
2121
</schema-form>
22-
</el-form>
22+
</el-form>
2323
</el-dialog>
2424
</div>
2525
</template>

app/views/form-generator/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<el-button type="warning" size="mini" @click="showSchemaCode = true">生成 Schema</el-button>
1212
<el-button type="danger" size="mini" @click="showVueCode = true">生成 Vue 代码</el-button>
1313
<el-button type="success" size="mini" @click="showResult = true">预览表单</el-button>
14+
<el-button size="mini" @click="resetGlobalStore">重置表单</el-button>
1415
</div>
1516
</div>
1617
<el-form
@@ -132,7 +133,8 @@ export default {
132133
},
133134
methods: {
134135
...mapActions([
135-
'addComponent'
136+
'addComponent',
137+
'resetGlobalStore'
136138
]),
137139
handleAddComponent (comp, scope) {
138140
const { rowIndex, colIndex } = scope

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (process.env.NODE_ENV === 'production') {
1616

1717
module.exports = {
1818
presets: [
19-
'@vue/app'
19+
'@vue/cli-plugin-babel/preset'
2020
],
2121
plugins
2222
}

deploy.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
3+
# 确保脚本抛出遇到的错误
4+
set -e
5+
6+
# 生成静态文件
7+
npm run docs:build
8+
9+
# 进入生成的文件夹
10+
cd docs/.vuepress/dist
11+
12+
# 如果是发布到自定义域名
13+
# echo 'www.example.com' > CNAME
14+
15+
# git init
16+
git add -A
17+
git commit -m 'chore: deploy docs'
18+
19+
# 如果发布到 https://<USERNAME>.github.io
20+
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
21+
22+
# 如果发布到 https://<USERNAME>.github.io/<REPO>
23+
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
24+
25+
cd -

0 commit comments

Comments
 (0)