Skip to content

Commit 7b8c3c0

Browse files
authored
Merge branch 'lljj-x:master' into master
2 parents 60ee613 + 8f1f762 commit 7b8c3c0

Some content is hidden

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

43 files changed

+371
-62
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [1.7.0](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.4...v1.7.0) (2021-08-29)
7+
8+
9+
### Bug Fixes
10+
11+
* **demo:** 修复element plus无法打开,锁定element plus cdn版本 ([a3c4312](https://github.com/lljj-x/vue-json-schema-form/commit/a3c43121cee3cdfc06844974028f8c78f5486e4f))
12+
* **schema-generator:** 修复array 下object排序问题 ([55dc50e](https://github.com/lljj-x/vue-json-schema-form/commit/55dc50e128417a67e9d186d3fcd6e2340d713144))
13+
14+
15+
### Features
16+
17+
* **lib:** 支持配置 slots ([27f1501](https://github.com/lljj-x/vue-json-schema-form/commit/27f1501eda01eabd4a723656be56904e9cb0f069)), closes [#45](https://github.com/lljj-x/vue-json-schema-form/issues/45)
18+
19+
20+
21+
22+
623
## [1.6.4](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.3...v1.6.4) (2021-07-18)
724

825

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"npmClient": "yarn",
33
"useWorkspaces": true,
4-
"version": "1.6.4",
4+
"version": "1.7.0",
55
"command": {
66
"version": {
77
"allowBranch": "master",

packages/demo/demo-v2/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [1.7.0](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.4...v1.7.0) (2021-08-29)
7+
8+
9+
### Bug Fixes
10+
11+
* **schema-generator:** 修复array 下object排序问题 ([55dc50e](https://github.com/lljj-x/vue-json-schema-form/commit/55dc50e128417a67e9d186d3fcd6e2340d713144))
12+
13+
14+
### Features
15+
16+
* **lib:** 支持配置 slots ([27f1501](https://github.com/lljj-x/vue-json-schema-form/commit/27f1501eda01eabd4a723656be56904e9cb0f069)), closes [#45](https://github.com/lljj-x/vue-json-schema-form/issues/45)
17+
18+
19+
20+
21+
622
## [1.6.3](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.2...v1.6.3) (2021-07-12)
723

824
**Note:** Version bump only for package demo

packages/demo/demo-v2/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "demo",
3-
"version": "1.6.3",
3+
"version": "1.7.0",
44
"private": true,
55
"license": "Apache-2.0",
66
"scripts": {
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"@lljj/polyfill": "^0.1.0",
13-
"@lljj/vue-json-schema-form": "1.6.3",
14-
"@lljj/vue2-form-iview3": "1.6.3",
13+
"@lljj/vue-json-schema-form": "1.7.0",
14+
"@lljj/vue2-form-iview3": "1.7.0",
1515
"ajv-i18n": "^3.5.0",
1616
"demo-common": "1.2.0",
1717
"iview": "^3.5.4",

packages/demo/demo-v2/src/pages/vue-editor/views/editor/viewComponents/Text/uiSchema.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
export default {
66
txt: {
77
'ui:options': {
8+
renderScopedSlots(h) {
9+
return {
10+
append: () => h('span', '.com')
11+
};
12+
},
13+
renderChildren(h) {
14+
return [
15+
h('span', {
16+
slot: 'suffix',
17+
}, '后缀')
18+
];
19+
},
820
getWidget(widgetVm) {
921
console.log(widgetVm);
1022
},

packages/demo/demo-v3/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [1.7.0](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.4...v1.7.0) (2021-08-29)
7+
8+
9+
### Bug Fixes
10+
11+
* **demo:** 修复element plus无法打开,锁定element plus cdn版本 ([a3c4312](https://github.com/lljj-x/vue-json-schema-form/commit/a3c43121cee3cdfc06844974028f8c78f5486e4f))
12+
13+
14+
15+
16+
617
## [1.6.4](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.3...v1.6.4) (2021-07-18)
718

819
**Note:** Version bump only for package demo-v3

packages/demo/demo-v3/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "demo-v3",
3-
"version": "1.6.4",
3+
"version": "1.7.0",
44
"private": true,
55
"license": "Apache-2.0",
66
"scripts": {
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"@lljj/polyfill": "^0.1.0",
13-
"@lljj/vue3-form-ant": "1.6.4",
14-
"@lljj/vue3-form-element": "1.6.3",
13+
"@lljj/vue3-form-ant": "1.7.0",
14+
"@lljj/vue3-form-element": "1.7.0",
1515
"ajv-i18n": "^3.5.0",
1616
"ant-design-vue": "^2.0.1",
1717
"demo-common": "1.2.0",

packages/docs/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [1.7.0](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.4...v1.7.0) (2021-08-29)
7+
8+
9+
### Features
10+
11+
* **lib:** 支持配置 slots ([27f1501](https://github.com/lljj-x/vue-json-schema-form/commit/27f1501eda01eabd4a723656be56904e9cb0f069)), closes [#45](https://github.com/lljj-x/vue-json-schema-form/issues/45)
12+
13+
14+
15+
16+
617
## [1.6.3](https://github.com/lljj-x/vue-json-schema-form/compare/v1.6.2...v1.6.3) (2021-07-12)
718

819
**Note:** Version bump only for package docs

packages/docs/docs/zh/guide/basic-config.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ uiSchema = {
162162
'ui:labelWidth': '50px',
163163

164164
'ui:options': {
165+
// scoped slots 使用render函数来实现
166+
// 配置 renderScopedSlots 返回对象key为slotName,函数体返回vnode
167+
// render 函数参考:https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
168+
renderScopedSlots(h) {
169+
return {
170+
append: (props) => h('span', '.com')
171+
};
172+
},
173+
174+
// slots,需要使用render函数来实现
175+
// 配置 renderChildren ,返回 Vnode[] 其中slot即为slotName
176+
// render 函数参考:https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
177+
renderChildren(h) {
178+
return [
179+
h('span', {
180+
slot: 'suffix',
181+
}, '后缀')
182+
];
183+
},
184+
165185
// 获取widget组件实例,非必要场景不建议使用
166186
// widget组件 mounted 组件后回调该方法传出vm实例
167187
// 支持版本: "0.4.1"
@@ -194,7 +214,9 @@ uiSchema = {
194214
attrs: {
195215
// 通过 vue render函数 attrs 传递给 Widget 组件,只能配置在叶子节点
196216
// 你也配置在外层,程序会合并 attrs 和 其它外层属性 通过 attrs 传递给子组件
197-
autofocus: true
217+
// 配置在这里的参数都会传给widget组件,当widget组件props和uiSchema通用参数冲突时可以使用attr配置
218+
autofocus: true,
219+
width: '99px', // 这里直接传给widget组件,而非外层的width配置
198220
},
199221
style: {
200222
// 通过 vue render函数 style 传递给 Widget 组件,只能配置在叶子节点
@@ -216,7 +238,7 @@ uiSchema = {
216238
fieldClass: true
217239
},
218240
fieldAttrs: {
219-
// 通过 vue render函数 attrs 传递给 Field 组件,支持所有field节点
241+
// 通过 vue render函数 attrs 传递给 Field 组件,支持所有节点
220242
'attr-x': 'xxx'
221243
},
222244

@@ -232,6 +254,65 @@ uiSchema = {
232254
>1. `ui:widget` 配置 `HiddenWidget` 或者 `hidden` 既可隐藏当前元素
233255
>1. `ui:hidden` 支持配置表达式,详细参见这里 [ui-schema ui:hidden配置表达式](/zh/guide/data-linkage.html#ui-schema配置表达式)
234256
257+
### ui-schema - slots
258+
可以通过uiSchema配置render函数传递slot到你的Widget组件,使用方式如下:
259+
260+
> 注意这里vue2版本需要区分slots,和scopeSlots的区别,配置如下
261+
>
262+
> [render函数参考官方文档](https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1)
263+
264+
* slots - `renderChildren` (仅vue2)
265+
266+
> 注意:vue3 版本所有slots 统一通过 `renderScopedSlots` 形式传递。
267+
268+
```js
269+
{
270+
'ui:options': {
271+
// slots,需要使用render函数来实现
272+
// 配置 renderChildren ,返回 Vnode[] 其中slot即为slotName
273+
// render 函数参考:https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
274+
renderChildren(h) {
275+
return [
276+
h('span', {
277+
slot: 'suffix',
278+
}, '后缀')
279+
];
280+
}
281+
}
282+
}
283+
```
284+
285+
* scopedSlots - `renderScopedSlots` (vue3、vue2)
286+
> vue3版本 h 为全局api,`import { h } from 'vue'`
287+
>
288+
> 同时,vue3 版本配置 `renderScopedSlots` 可以为纯对象、vue3不区分scoped slots
289+
290+
```js
291+
{
292+
'ui:options': {
293+
// vue2
294+
// scoped slots 使用render函数来实现
295+
// 配置 renderScopedSlots 返回对象key为slotName,函数体返回vnode
296+
// render 函数参考:https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
297+
renderScopedSlots(h){
298+
return {
299+
append: (props) => h('span', '.com')
300+
};
301+
}
302+
},
303+
304+
'ui:options': {
305+
// vue3
306+
// slots 使用render函数来实现
307+
// vue3 renderScopedSlots 可以为function、或者如下纯对象的形式
308+
// vue3 render 函数参考:https://v3.cn.vuejs.org/guide/render-function.html#%E6%8F%92%E6%A7%BD
309+
renderScopedSlots: {
310+
default: (props) =>h('span', props.text)
311+
}
312+
}
313+
}
314+
```
315+
235316
#### ui-schema配置在schema中
236317

237318
`0.0.16` 之后版本,`ui-schema` 所有配置都支持直接配置在 `schema` 参数中

packages/docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs",
3-
"version": "1.6.3",
3+
"version": "1.7.0",
44
"private": true,
55
"license": "Apache-2.0",
66
"scripts": {
@@ -9,7 +9,7 @@
99
"build": "vuepress build docs"
1010
},
1111
"dependencies": {
12-
"@lljj/vue-json-schema-form": "1.6.3",
12+
"@lljj/vue-json-schema-form": "1.7.0",
1313
"element-ui": "^2.13.2",
1414
"v-distpicker": "^1.2.7"
1515
},

0 commit comments

Comments
 (0)