Skip to content

Commit dee479c

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 715f37e + 95a51ce commit dee479c

File tree

14 files changed

+186
-228
lines changed

14 files changed

+186
-228
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
"url": "https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues"
138138
},
139139
"homepage": "https://gitee.com/yudaocode/yudao-ui-admin-vue3",
140-
"packageManager": "[email protected]",
141140
"engines": {
142141
"node": ">= 16.0.0",
143142
"pnpm": ">=8.6.0"

src/components/FormCreate/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import MyFormCreateDesigner from './src/MyFormCreateDesigner.vue'
21
import { useFormCreateDesigner } from './src/useFormCreateDesigner'
32

4-
export { MyFormCreateDesigner, useFormCreateDesigner }
3+
export { useFormCreateDesigner }

src/components/FormCreate/src/MyFormCreateDesigner.vue

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/components/FormCreate/src/config/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { useUploadImgRule } from './useUploadImgRule'
33
import { useUploadImgsRule } from './useUploadImgsRule'
44
import { useDictSelectRule } from './useDictSelectRule'
55
import { useUserSelectRule } from './useUserSelectRule'
6+
import { useEditorRule } from './useEditorRule'
67

78
export {
89
useUploadFileRule,
910
useUploadImgRule,
1011
useUploadImgsRule,
1112
useDictSelectRule,
12-
useUserSelectRule
13+
useUserSelectRule,
14+
useEditorRule
1315
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const selectRule = [
2+
{ type: 'switch', field: 'multiple', title: '是否多选' },
3+
{
4+
type: 'switch',
5+
field: 'disabled',
6+
title: '是否禁用'
7+
},
8+
{ type: 'switch', field: 'clearable', title: '是否可以清空选项' },
9+
{
10+
type: 'switch',
11+
field: 'collapseTags',
12+
title: '多选时是否将选中值按文字的形式展示'
13+
},
14+
{
15+
type: 'inputNumber',
16+
field: 'multipleLimit',
17+
title: '多选时用户最多可以选择的项目数,为 0 则不限制',
18+
props: { min: 0 }
19+
},
20+
{
21+
type: 'input',
22+
field: 'autocomplete',
23+
title: 'autocomplete 属性'
24+
},
25+
{ type: 'input', field: 'placeholder', title: '占位符' },
26+
{
27+
type: 'switch',
28+
field: 'filterable',
29+
title: '是否可搜索'
30+
},
31+
{ type: 'switch', field: 'allowCreate', title: '是否允许用户创建新条目' },
32+
{
33+
type: 'input',
34+
field: 'noMatchText',
35+
title: '搜索条件无匹配时显示的文字'
36+
},
37+
{
38+
type: 'switch',
39+
field: 'remote',
40+
title: '其中的选项是否从服务器远程加载'
41+
},
42+
{
43+
type: 'Struct',
44+
field: 'remoteMethod',
45+
title: '自定义远程搜索方法'
46+
},
47+
{ type: 'input', field: 'noDataText', title: '选项为空时显示的文字' },
48+
{
49+
type: 'switch',
50+
field: 'reserveKeyword',
51+
title: '多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词'
52+
},
53+
{
54+
type: 'switch',
55+
field: 'defaultFirstOption',
56+
title: '在输入框按下回车,选择第一个匹配项'
57+
},
58+
{
59+
type: 'switch',
60+
field: 'popperAppendToBody',
61+
title: '是否将弹出框插入至 body 元素',
62+
value: true
63+
},
64+
{
65+
type: 'switch',
66+
field: 'automaticDropdown',
67+
title: '对于不可搜索的 Select,是否在输入框获得焦点后自动弹出选项菜单'
68+
}
69+
]
70+
71+
export default selectRule

src/components/FormCreate/src/config/useDictSelectRule.ts

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { generateUUID } from '@/utils'
22
import * as DictDataApi from '@/api/system/dict/dict.type'
33
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
4+
import selectRule from '@/components/FormCreate/src/config/selectRule'
45

56
export const useDictSelectRule = () => {
67
const label = '字典选择器'
@@ -51,73 +52,7 @@ export const useDictSelectRule = () => {
5152
{ label: '布尔值', value: 'bool' }
5253
]
5354
},
54-
{ type: 'switch', field: 'multiple', title: '是否多选' },
55-
{
56-
type: 'switch',
57-
field: 'disabled',
58-
title: '是否禁用'
59-
},
60-
{ type: 'switch', field: 'clearable', title: '是否可以清空选项' },
61-
{
62-
type: 'switch',
63-
field: 'collapseTags',
64-
title: '多选时是否将选中值按文字的形式展示'
65-
},
66-
{
67-
type: 'inputNumber',
68-
field: 'multipleLimit',
69-
title: '多选时用户最多可以选择的项目数,为 0 则不限制',
70-
props: { min: 0 }
71-
},
72-
{
73-
type: 'input',
74-
field: 'autocomplete',
75-
title: 'autocomplete 属性'
76-
},
77-
{ type: 'input', field: 'placeholder', title: '占位符' },
78-
{
79-
type: 'switch',
80-
field: 'filterable',
81-
title: '是否可搜索'
82-
},
83-
{ type: 'switch', field: 'allowCreate', title: '是否允许用户创建新条目' },
84-
{
85-
type: 'input',
86-
field: 'noMatchText',
87-
title: '搜索条件无匹配时显示的文字'
88-
},
89-
{
90-
type: 'switch',
91-
field: 'remote',
92-
title: '其中的选项是否从服务器远程加载'
93-
},
94-
{
95-
type: 'Struct',
96-
field: 'remoteMethod',
97-
title: '自定义远程搜索方法'
98-
},
99-
{ type: 'input', field: 'noDataText', title: '选项为空时显示的文字' },
100-
{
101-
type: 'switch',
102-
field: 'reserveKeyword',
103-
title: '多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词'
104-
},
105-
{
106-
type: 'switch',
107-
field: 'defaultFirstOption',
108-
title: '在输入框按下回车,选择第一个匹配项'
109-
},
110-
{
111-
type: 'switch',
112-
field: 'popperAppendToBody',
113-
title: '是否将弹出框插入至 body 元素',
114-
value: true
115-
},
116-
{
117-
type: 'switch',
118-
field: 'automaticDropdown',
119-
title: '对于不可搜索的 Select,是否在输入框获得焦点后自动弹出选项菜单'
120-
}
55+
...selectRule
12156
])
12257
}
12358
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { generateUUID } from '@/utils'
2+
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
3+
4+
export const useEditorRule = () => {
5+
const label = '富文本'
6+
const name = 'Editor'
7+
return {
8+
icon: 'icon-editor',
9+
label,
10+
name,
11+
rule() {
12+
return {
13+
type: name,
14+
field: generateUUID(),
15+
title: label,
16+
info: '',
17+
$required: false
18+
}
19+
},
20+
props(_, { t }) {
21+
return localeProps(t, name + '.props', [
22+
makeRequiredRule(),
23+
{
24+
type: 'input',
25+
field: 'height',
26+
title: '高度'
27+
},
28+
{ type: 'switch', field: 'readonly', title: '是否只读' }
29+
])
30+
}
31+
}
32+
}
Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { generateUUID } from '@/utils'
22
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
3+
import selectRule from '@/components/FormCreate/src/config/selectRule'
34

45
export const useUserSelectRule = () => {
56
const label = '用户选择器'
@@ -18,76 +19,7 @@ export const useUserSelectRule = () => {
1819
}
1920
},
2021
props(_, { t }) {
21-
return localeProps(t, name + '.props', [
22-
makeRequiredRule(),
23-
{ type: 'switch', field: 'multiple', title: '是否多选' },
24-
{
25-
type: 'switch',
26-
field: 'disabled',
27-
title: '是否禁用'
28-
},
29-
{ type: 'switch', field: 'clearable', title: '是否可以清空选项' },
30-
{
31-
type: 'switch',
32-
field: 'collapseTags',
33-
title: '多选时是否将选中值按文字的形式展示'
34-
},
35-
{
36-
type: 'inputNumber',
37-
field: 'multipleLimit',
38-
title: '多选时用户最多可以选择的项目数,为 0 则不限制',
39-
props: { min: 0 }
40-
},
41-
{
42-
type: 'input',
43-
field: 'autocomplete',
44-
title: 'autocomplete 属性'
45-
},
46-
{ type: 'input', field: 'placeholder', title: '占位符' },
47-
{
48-
type: 'switch',
49-
field: 'filterable',
50-
title: '是否可搜索'
51-
},
52-
{ type: 'switch', field: 'allowCreate', title: '是否允许用户创建新条目' },
53-
{
54-
type: 'input',
55-
field: 'noMatchText',
56-
title: '搜索条件无匹配时显示的文字'
57-
},
58-
{
59-
type: 'switch',
60-
field: 'remote',
61-
title: '其中的选项是否从服务器远程加载'
62-
},
63-
{
64-
type: 'Struct',
65-
field: 'remoteMethod',
66-
title: '自定义远程搜索方法'
67-
},
68-
{ type: 'input', field: 'noDataText', title: '选项为空时显示的文字' },
69-
{
70-
type: 'switch',
71-
field: 'reserveKeyword',
72-
title: '多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词'
73-
},
74-
{
75-
type: 'switch',
76-
field: 'defaultFirstOption',
77-
title: '在输入框按下回车,选择第一个匹配项'
78-
},
79-
{
80-
type: 'switch',
81-
field: 'popperAppendToBody',
82-
title: '是否将弹出框插入至 body 元素',
83-
value: true
84-
},
85-
{
86-
type: 'switch',
87-
field: 'automaticDropdown',
88-
title: '对于不可搜索的 Select,是否在输入框获得焦点后自动弹出选项菜单'
89-
}
90-
])
22+
return localeProps(t, name + '.props', [makeRequiredRule(), ...selectRule])
9123
}
9224
}
9325
}

src/components/FormCreate/src/useFormCreateDesigner.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
useDictSelectRule,
3+
useEditorRule,
34
useUploadFileRule,
45
useUploadImgRule,
56
useUploadImgsRule,
@@ -13,8 +14,12 @@ import { Ref } from 'vue'
1314
* - 文件上传
1415
* - 单图上传
1516
* - 多图上传
17+
* - 字典选择器
18+
* - 系统用户选择器
19+
* - 富文本
1620
*/
1721
export const useFormCreateDesigner = (designer: Ref) => {
22+
const editorRule = useEditorRule()
1823
const uploadFileRule = useUploadFileRule()
1924
const uploadImgRule = useUploadImgRule()
2025
const uploadImgsRule = useUploadImgsRule()
@@ -24,7 +29,10 @@ export const useFormCreateDesigner = (designer: Ref) => {
2429
onMounted(() => {
2530
// 移除自带的上传组件规则,使用 uploadFileRule、uploadImgRule、uploadImgsRule 替代
2631
designer.value?.removeMenuItem('upload')
32+
// 移除自带的富文本组件规则,使用 editorRule 替代
33+
designer.value?.removeMenuItem('fc-editor')
2734
const components = [
35+
editorRule,
2836
uploadFileRule,
2937
uploadImgRule,
3038
uploadImgsRule,

src/plugins/formCreate/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import install from '@form-create/element-ui/auto-import'
2121
import { UploadFile, UploadImg, UploadImgs } from '@/components/UploadFile'
2222
import { DictSelect } from '@/components/DictSelect'
2323
import UserSelect from '@/views/system/user/components/UserSelect.vue'
24+
import { Editor } from '@/components/Editor'
2425

2526
const components = [
2627
ElAside,
@@ -39,7 +40,8 @@ const components = [
3940
UploadImgs,
4041
UploadFile,
4142
DictSelect,
42-
UserSelect
43+
UserSelect,
44+
Editor
4345
]
4446

4547
// 参考 http://www.form-create.com/v3/element-ui/auto-import.html 文档

0 commit comments

Comments
 (0)