@houaoran/designer 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.es.js +3915 -3688
- package/dist/components.umd.js +95 -90
- package/dist/index.es.js +5078 -4797
- package/dist/index.umd.js +156 -151
- package/package.json +3 -2
- package/src/components/CurrentUser.vue +40 -0
- package/src/config/index.js +3 -1
- package/src/config/rule/currentUser.js +37 -0
- package/src/config/rule/divider.js +1 -0
- package/src/config/rule/input.js +67 -58
- package/src/config/rule/textarea.js +3 -1
- package/src/form/index.js +2 -0
- package/src/index.js +2 -0
- package/src/locale/en.js +7 -0
- package/src/locale/zh-cn.js +7 -0
- package/src/utils/wsCache.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@houaoran/designer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。",
|
|
5
5
|
"unpkg": "./dist/index.umd.js",
|
|
6
6
|
"jsdelivr": "./dist/index.umd.js",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"marked": "^17.0.0",
|
|
92
92
|
"signature_pad": "^5.0.10",
|
|
93
93
|
"sortablejs": "1.14.0",
|
|
94
|
-
"vuedraggable": "4.1.0"
|
|
94
|
+
"vuedraggable": "4.1.0",
|
|
95
|
+
"web-storage-cache": "^1.1.1"
|
|
95
96
|
}
|
|
96
97
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input v-model="value" disabled placeholder="请选择" />
|
|
3
|
+
|
|
4
|
+
</template>
|
|
5
|
+
<script>
|
|
6
|
+
import { defineComponent, ref } from 'vue';
|
|
7
|
+
import { getData } from '../utils/wsCache';
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'CurrentUser',
|
|
10
|
+
props: {
|
|
11
|
+
// 用户类型 username,deptName,postName
|
|
12
|
+
userType: {
|
|
13
|
+
'type': String,
|
|
14
|
+
default: 'username'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
mounted() {
|
|
18
|
+
if (!this.value) {
|
|
19
|
+
this.getCurrentUser()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
},
|
|
23
|
+
methods: {
|
|
24
|
+
getCurrentUser() {
|
|
25
|
+
const session = getData('user');
|
|
26
|
+
if (!session) {
|
|
27
|
+
this.value = '';
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (this.userType === 'username') {
|
|
31
|
+
this.value = session.user.nickname;
|
|
32
|
+
} else if (this.userType === 'deptName') {
|
|
33
|
+
this.value = session.user.deptName;
|
|
34
|
+
} else if (this.userType === 'postName') {
|
|
35
|
+
this.value = session.user.postList.map(item => item.postName).join('、');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
</script>
|
package/src/config/index.js
CHANGED
|
@@ -43,13 +43,15 @@ import signaturePad from './rule/signaturePad';
|
|
|
43
43
|
import inputRange from './rule/inputRange';
|
|
44
44
|
import title from './rule/title';
|
|
45
45
|
import dictSelect from './rule/dictSelect';
|
|
46
|
+
import currentUser from './rule/currentUser';
|
|
46
47
|
|
|
47
48
|
const ruleList = [
|
|
48
|
-
input, textarea, password, number, inputRange, dictSelect, radio, checkbox, select, _switch, rate, time, timeRange, slider, date, dateRange, color, cascader, upload, transfer, tree, treeSelect, editor, signaturePad,
|
|
49
|
+
input, textarea, password, number, inputRange, dictSelect, currentUser, radio, checkbox, select, _switch, rate, time, timeRange, slider, date, dateRange, color, cascader, upload, transfer, tree, treeSelect, editor, signaturePad,
|
|
49
50
|
group, subForm, tableForm, tableFormColumn,
|
|
50
51
|
alert, button, text, title, html, divider, tag, image,
|
|
51
52
|
row, table, tabs, space, card, collapse,
|
|
52
53
|
col, tabPane, collapseItem,
|
|
54
|
+
currentUser,
|
|
53
55
|
];
|
|
54
56
|
|
|
55
57
|
export default ruleList;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import uniqueId from '@form-create/utils/lib/unique';
|
|
2
|
+
import {localeProps} from '../../utils';
|
|
3
|
+
|
|
4
|
+
const label = '当前用户';
|
|
5
|
+
const name = 'currentUser';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
menu: 'main',
|
|
9
|
+
icon: 'icon-user',
|
|
10
|
+
label,
|
|
11
|
+
name,
|
|
12
|
+
input: true,
|
|
13
|
+
event: ['change'],
|
|
14
|
+
validate: ['array'],
|
|
15
|
+
rule({t}) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'CurrentUser',
|
|
18
|
+
field: uniqueId(),
|
|
19
|
+
title: t('com.currentUser.name'),
|
|
20
|
+
info: '',
|
|
21
|
+
$required: false,
|
|
22
|
+
value: null,
|
|
23
|
+
props: {
|
|
24
|
+
userType: 'username',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
props(_, {t}) {
|
|
29
|
+
return localeProps(t, name + '.props', [
|
|
30
|
+
{type: 'select', field: 'userType', value: 'username', options: [
|
|
31
|
+
{label: '用户名', value: 'username'},
|
|
32
|
+
{label: '部门名称', value: 'deptName'},
|
|
33
|
+
{label: '岗位名称', value: 'postName'},
|
|
34
|
+
]},
|
|
35
|
+
]);
|
|
36
|
+
},
|
|
37
|
+
};
|
package/src/config/rule/input.js
CHANGED
|
@@ -1,62 +1,71 @@
|
|
|
1
|
-
import uniqueId from
|
|
2
|
-
import {localeOptions, localeProps} from
|
|
1
|
+
import uniqueId from "@form-create/utils/lib/unique";
|
|
2
|
+
import { localeOptions, localeProps } from "../../utils";
|
|
3
3
|
|
|
4
|
-
const label =
|
|
5
|
-
const name =
|
|
4
|
+
const label = "输入框";
|
|
5
|
+
const name = "input";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
8
|
+
menu: "main",
|
|
9
|
+
icon: "icon-input",
|
|
10
|
+
label,
|
|
11
|
+
name,
|
|
12
|
+
input: true,
|
|
13
|
+
event: ["blur", "focus", "change", "input", "clear"],
|
|
14
|
+
validate: ["string", "url", "email"],
|
|
15
|
+
rule({ t }) {
|
|
16
|
+
return {
|
|
17
|
+
type: name,
|
|
18
|
+
field: uniqueId(),
|
|
19
|
+
title: t("com.input.name"),
|
|
20
|
+
info: "",
|
|
21
|
+
$required: false,
|
|
22
|
+
props: {
|
|
23
|
+
showWordLimit: true,
|
|
24
|
+
maxlength: 100,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
props(_, { t }) {
|
|
29
|
+
return localeProps(t, name + ".props", [
|
|
30
|
+
{
|
|
31
|
+
type: "switch",
|
|
32
|
+
field: "disabled",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "switch",
|
|
36
|
+
field: "readonly",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "select",
|
|
40
|
+
field: "type",
|
|
41
|
+
options: localeOptions(t, [
|
|
42
|
+
{ label: "text", value: "text" },
|
|
43
|
+
{ label: "number", value: "number" },
|
|
44
|
+
{ label: "time", value: "time" },
|
|
45
|
+
{ label: "date", value: "date" },
|
|
46
|
+
{ label: "month", value: "month" },
|
|
47
|
+
{ label: "datetime-local", value: "datetime-local" },
|
|
48
|
+
]),
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
{
|
|
52
|
+
type: "inputNumber",
|
|
53
|
+
field: "maxlength",
|
|
54
|
+
props: { min: 0 },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "switch",
|
|
58
|
+
field: "showWordLimit",
|
|
59
|
+
value:true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "input",
|
|
63
|
+
field: "placeholder",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "switch",
|
|
67
|
+
field: "clearable",
|
|
68
|
+
},
|
|
69
|
+
]);
|
|
70
|
+
},
|
|
62
71
|
};
|
package/src/form/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import TableForm from '../components/tableForm/TableForm.vue';
|
|
|
6
6
|
import Table from '../components/table/Table.vue';
|
|
7
7
|
import InputRange from '../components/InputRange.vue';
|
|
8
8
|
import DictSelect from '../components/DictSelect.vue';
|
|
9
|
+
import CurrentUser from '../components/CurrentUser.vue';
|
|
9
10
|
import '../style/icon.css';
|
|
10
11
|
|
|
11
12
|
const install = (formCreate) => {
|
|
@@ -16,6 +17,7 @@ const install = (formCreate) => {
|
|
|
16
17
|
formCreate.component('FcTable', Table);
|
|
17
18
|
formCreate.component('InputRange', InputRange);
|
|
18
19
|
formCreate.component('DictSelect', DictSelect);
|
|
20
|
+
formCreate.component('CurrentUser', CurrentUser);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
install(formCreate);
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import FcEditor from '@form-create/component-wangeditor';
|
|
|
33
33
|
import draggable from 'vuedraggable/src/vuedraggable';
|
|
34
34
|
import InputRange from './components/InputRange.vue';
|
|
35
35
|
import DictSelect from './components/DictSelect.vue';
|
|
36
|
+
import CurrentUser from './components/CurrentUser.vue';
|
|
36
37
|
import {
|
|
37
38
|
compareVersion,
|
|
38
39
|
copyTextToClipboard,
|
|
@@ -88,6 +89,7 @@ addComponent('TableForm', TableForm, TableFormView);
|
|
|
88
89
|
addComponent('FcTable', Table, TableView);
|
|
89
90
|
addComponent('InputRange', InputRange);
|
|
90
91
|
addComponent('DictSelect', DictSelect);
|
|
92
|
+
addComponent('CurrentUser', CurrentUser);
|
|
91
93
|
const install = function (Vue) {
|
|
92
94
|
Vue.component('FcDesigner', FcDesigner);
|
|
93
95
|
};
|
package/src/locale/en.js
CHANGED
|
@@ -422,6 +422,12 @@ const En = {
|
|
|
422
422
|
_top: 'Top Window',
|
|
423
423
|
},
|
|
424
424
|
com: {
|
|
425
|
+
currentUser: {
|
|
426
|
+
name: 'Current User',
|
|
427
|
+
props: {
|
|
428
|
+
userType: 'User Type',
|
|
429
|
+
}
|
|
430
|
+
},
|
|
425
431
|
cascader: {
|
|
426
432
|
name: 'Cascader',
|
|
427
433
|
event: {
|
|
@@ -733,6 +739,7 @@ const En = {
|
|
|
733
739
|
clearable: 'Whether to display the clear button',
|
|
734
740
|
disabled: 'Disabled',
|
|
735
741
|
readonly: 'Readonly',
|
|
742
|
+
showWordLimit: 'Whether to display the word count',
|
|
736
743
|
}
|
|
737
744
|
},
|
|
738
745
|
inputNumber: {
|
package/src/locale/zh-cn.js
CHANGED
|
@@ -734,6 +734,7 @@ const ZhCn = {
|
|
|
734
734
|
clearable: '是否显示清除按钮',
|
|
735
735
|
disabled: '是否禁用',
|
|
736
736
|
readonly: '是否只读',
|
|
737
|
+
showWordLimit: '是否显示统计字数',
|
|
737
738
|
}
|
|
738
739
|
},
|
|
739
740
|
inputNumber: {
|
|
@@ -772,6 +773,12 @@ const ZhCn = {
|
|
|
772
773
|
multiple: '是否多选(多选时,类型为选择器)',
|
|
773
774
|
}
|
|
774
775
|
},
|
|
776
|
+
currentUser: {
|
|
777
|
+
name: '当前用户',
|
|
778
|
+
props: {
|
|
779
|
+
userType: '用户类型',
|
|
780
|
+
}
|
|
781
|
+
},
|
|
775
782
|
password: {
|
|
776
783
|
name: '密码输入框',
|
|
777
784
|
event: {
|