@houaoran/designer 1.0.2 → 1.0.4
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 +2813 -2715
- package/dist/components.umd.js +63 -63
- package/dist/index.es.js +2816 -2673
- package/dist/index.umd.js +80 -80
- package/package.json +1 -1
- package/src/components/DictSelect.vue +61 -0
- package/src/config/index.js +2 -2
- package/src/config/rule/dictSelect.js +40 -0
- package/src/config/rule/inputRange.js +1 -0
- package/src/form/index.js +2 -0
- package/src/index.js +2 -0
- package/src/locale/en.js +9 -0
- package/src/locale/zh-cn.js +9 -0
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 100%;">
|
|
3
|
+
<el-select :disabled="disabled" v-model="value" placeholder="请选择" v-if="type === 'select'" @change="update">
|
|
4
|
+
<el-option v-for="item in dictOptions" :key="item.value" :label="item.label"
|
|
5
|
+
:value="item.value"></el-option>
|
|
6
|
+
</el-select>
|
|
7
|
+
<el-radio-group :disabled="disabled" v-model="value" v-if="type === 'radio'" @change="update">
|
|
8
|
+
<el-radio v-for="item in dictOptions" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
|
|
9
|
+
</el-radio-group>
|
|
10
|
+
<el-checkbox-group :disabled="disabled" v-model="value" v-if="type === 'checkbox'" @change="update">
|
|
11
|
+
<el-checkbox v-for="item in dictOptions" :key="item.value" :label="item.value">{{ item.label
|
|
12
|
+
}}</el-checkbox>
|
|
13
|
+
</el-checkbox-group>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script>
|
|
17
|
+
import { defineComponent } from 'vue';
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: 'DictSelect',
|
|
20
|
+
emits: ['update:modelValue', 'change'],
|
|
21
|
+
props: {
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: [Array, String, Number],
|
|
24
|
+
default: null,
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
dictCode: String,
|
|
31
|
+
type: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'select',
|
|
34
|
+
validator: (value) => {
|
|
35
|
+
return ['select', 'radio', 'checkbox'].includes(value);
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
computed: {
|
|
41
|
+
dictOptions() {
|
|
42
|
+
const { v } = JSON.parse(sessionStorage.getItem('dictCache') ?? '{}') ?? {} ?? {}
|
|
43
|
+
console.log(v, 'v');
|
|
44
|
+
const data = JSON.parse(v ?? '{}') ?? {}
|
|
45
|
+
console.log(data, 'data');
|
|
46
|
+
return data[this.dictCode]
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
|
|
51
|
+
update(val) {
|
|
52
|
+
this.$emit('update:modelValue', val);
|
|
53
|
+
this.$emit('change', val);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
mounted() {
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
</script>
|
package/src/config/index.js
CHANGED
|
@@ -42,10 +42,10 @@ import image from './rule/image';
|
|
|
42
42
|
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
46
|
|
|
47
47
|
const ruleList = [
|
|
48
|
-
input, textarea, password, number, inputRange, radio, checkbox, select, _switch, rate, time, timeRange, slider, date, dateRange, color, cascader, upload, transfer, tree, treeSelect, editor, signaturePad,
|
|
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
49
|
group, subForm, tableForm, tableFormColumn,
|
|
50
50
|
alert, button, text, title, html, divider, tag, image,
|
|
51
51
|
row, table, tabs, space, card, collapse,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import uniqueId from '@form-create/utils/lib/unique';
|
|
2
|
+
import {localeProps} from '../../utils';
|
|
3
|
+
|
|
4
|
+
const label = '字典选择';
|
|
5
|
+
const name = 'dictSelect';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
menu: 'main',
|
|
9
|
+
icon: 'icon-select',
|
|
10
|
+
label,
|
|
11
|
+
name,
|
|
12
|
+
input: true,
|
|
13
|
+
event: ['change'],
|
|
14
|
+
validate: ['array'],
|
|
15
|
+
rule({t}) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'DictSelect',
|
|
18
|
+
field: uniqueId(),
|
|
19
|
+
title: t('com.dictSelect.name'),
|
|
20
|
+
info: '',
|
|
21
|
+
$required: false,
|
|
22
|
+
value: null,
|
|
23
|
+
props: {
|
|
24
|
+
dictCode: '',
|
|
25
|
+
type: 'select',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
props(_, {t}) {
|
|
30
|
+
return localeProps(t, name + '.props', [
|
|
31
|
+
{type: 'switch', field: 'disabled'},
|
|
32
|
+
{type: 'input', field: 'dictCode', value: ''},
|
|
33
|
+
{type: 'select', field: 'type', value: 'select', options: [
|
|
34
|
+
{label: '选择器', value: 'select'},
|
|
35
|
+
{label: '复选框', value: 'checkbox'},
|
|
36
|
+
{label: '单选框', value: 'radio'},
|
|
37
|
+
]},
|
|
38
|
+
]);
|
|
39
|
+
},
|
|
40
|
+
};
|
package/src/form/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import SignaturePad from '../components/SignaturePad.vue';
|
|
|
5
5
|
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
|
+
import DictSelect from '../components/DictSelect.vue';
|
|
8
9
|
import '../style/icon.css';
|
|
9
10
|
|
|
10
11
|
const install = (formCreate) => {
|
|
@@ -14,6 +15,7 @@ const install = (formCreate) => {
|
|
|
14
15
|
formCreate.component('TableForm', TableForm);
|
|
15
16
|
formCreate.component('FcTable', Table);
|
|
16
17
|
formCreate.component('InputRange', InputRange);
|
|
18
|
+
formCreate.component('DictSelect', DictSelect);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
install(formCreate);
|
package/src/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import formCreate, {designerForm} from './utils/form';
|
|
|
32
32
|
import FcEditor from '@form-create/component-wangeditor';
|
|
33
33
|
import draggable from 'vuedraggable/src/vuedraggable';
|
|
34
34
|
import InputRange from './components/InputRange.vue';
|
|
35
|
+
import DictSelect from './components/DictSelect.vue';
|
|
35
36
|
import {
|
|
36
37
|
compareVersion,
|
|
37
38
|
copyTextToClipboard,
|
|
@@ -86,6 +87,7 @@ addComponent('SignaturePad', SignaturePad);
|
|
|
86
87
|
addComponent('TableForm', TableForm, TableFormView);
|
|
87
88
|
addComponent('FcTable', Table, TableView);
|
|
88
89
|
addComponent('InputRange', InputRange);
|
|
90
|
+
addComponent('DictSelect', DictSelect);
|
|
89
91
|
const install = function (Vue) {
|
|
90
92
|
Vue.component('FcDesigner', FcDesigner);
|
|
91
93
|
};
|
package/src/locale/en.js
CHANGED
|
@@ -759,6 +759,15 @@ const En = {
|
|
|
759
759
|
separator: 'Separator',
|
|
760
760
|
startPlaceholder: 'Start placeholder',
|
|
761
761
|
endPlaceholder: 'End placeholder',
|
|
762
|
+
showInput: 'Whether to display the input box, it is only valid during non-range selection',
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
dictSelect: {
|
|
766
|
+
name: 'DictSelect',
|
|
767
|
+
props: {
|
|
768
|
+
disabled: 'Disabled',
|
|
769
|
+
dictCode: 'Dict Code',
|
|
770
|
+
type: 'Type',
|
|
762
771
|
}
|
|
763
772
|
},
|
|
764
773
|
password: {
|
package/src/locale/zh-cn.js
CHANGED
|
@@ -760,6 +760,15 @@ const ZhCn = {
|
|
|
760
760
|
separator: '分隔符',
|
|
761
761
|
startPlaceholder: '起始占位符',
|
|
762
762
|
endPlaceholder: '结束占位符',
|
|
763
|
+
showInput: '是否显示输入框,仅在非范围选择时有效',
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
dictSelect: {
|
|
767
|
+
name: '字典选择',
|
|
768
|
+
props: {
|
|
769
|
+
disabled: '是否禁用',
|
|
770
|
+
dictCode: '字典代码',
|
|
771
|
+
type: '类型',
|
|
763
772
|
}
|
|
764
773
|
},
|
|
765
774
|
password: {
|