@houaoran/designer 1.0.0 → 1.0.2
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 +2681 -2606
- package/dist/components.umd.js +57 -57
- package/dist/index.es.js +2010 -1889
- package/dist/index.umd.js +54 -54
- package/package.json +1 -1
- package/src/components/InputRange.vue +78 -0
- package/src/config/index.js +2 -1
- package/src/config/rule/inputRange.js +39 -0
- package/src/form/index.js +2 -0
- package/src/index.js +2 -1
- package/src/locale/en.js +12 -0
- package/src/locale/zh-cn.js +12 -0
package/package.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fc-input-range">
|
|
3
|
+
<el-input-number
|
|
4
|
+
v-model="start"
|
|
5
|
+
:min="min"
|
|
6
|
+
:max="end ?? max"
|
|
7
|
+
:step="step"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:placeholder="startPlaceholder"
|
|
10
|
+
controls-position="right"
|
|
11
|
+
@change="emitChange"
|
|
12
|
+
/>
|
|
13
|
+
<span class="_fc-input-range-sep">{{ separator }}</span>
|
|
14
|
+
<el-input-number
|
|
15
|
+
v-model="end"
|
|
16
|
+
:min="start ?? min"
|
|
17
|
+
:max="max"
|
|
18
|
+
:step="step"
|
|
19
|
+
:disabled="disabled"
|
|
20
|
+
:placeholder="endPlaceholder"
|
|
21
|
+
controls-position="right"
|
|
22
|
+
@change="emitChange"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { defineComponent } from 'vue';
|
|
29
|
+
|
|
30
|
+
export default defineComponent({
|
|
31
|
+
name: 'InputRange',
|
|
32
|
+
emits: ['update:modelValue', 'change'],
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => [null, null],
|
|
37
|
+
},
|
|
38
|
+
min: Number,
|
|
39
|
+
max: Number,
|
|
40
|
+
step: { type: Number, default: 1 },
|
|
41
|
+
disabled: Boolean,
|
|
42
|
+
separator: { type: String, default: '~' },
|
|
43
|
+
startPlaceholder: String,
|
|
44
|
+
endPlaceholder: String,
|
|
45
|
+
},
|
|
46
|
+
computed: {
|
|
47
|
+
start: {
|
|
48
|
+
get() { return this.modelValue?.[0] ?? null; },
|
|
49
|
+
set(val) { this.update([val, this.end]); },
|
|
50
|
+
},
|
|
51
|
+
end: {
|
|
52
|
+
get() { return this.modelValue?.[1] ?? null; },
|
|
53
|
+
set(val) { this.update([this.start, val]); },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
update(val) {
|
|
58
|
+
this.$emit('update:modelValue', val);
|
|
59
|
+
this.$emit('change', val);
|
|
60
|
+
},
|
|
61
|
+
emitChange() {
|
|
62
|
+
this.$emit('change', [this.start, this.end]);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
._fc-input-range {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
._fc-input-range-sep {
|
|
76
|
+
color: #909399;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
package/src/config/index.js
CHANGED
|
@@ -40,11 +40,12 @@ import tableForm from './rule/tableForm';
|
|
|
40
40
|
import tableFormColumn from './rule/tableFormColumn';
|
|
41
41
|
import image from './rule/image';
|
|
42
42
|
import signaturePad from './rule/signaturePad';
|
|
43
|
+
import inputRange from './rule/inputRange';
|
|
43
44
|
import title from './rule/title';
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
const ruleList = [
|
|
47
|
-
input, textarea, password, number, radio, checkbox, select, _switch, rate, time, timeRange, slider, date, dateRange, color, cascader, upload, transfer, tree, treeSelect, editor, signaturePad,
|
|
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
49
|
group, subForm, tableForm, tableFormColumn,
|
|
49
50
|
alert, button, text, title, html, divider, tag, image,
|
|
50
51
|
row, table, tabs, space, card, collapse,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import uniqueId from '@form-create/utils/lib/unique';
|
|
2
|
+
import {localeProps} from '../../utils';
|
|
3
|
+
|
|
4
|
+
const label = '数值范围';
|
|
5
|
+
const name = 'inputRange';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
menu: 'main',
|
|
9
|
+
icon: 'icon-number',
|
|
10
|
+
label,
|
|
11
|
+
name,
|
|
12
|
+
input: true,
|
|
13
|
+
event: ['change'],
|
|
14
|
+
validate: ['array'],
|
|
15
|
+
rule({t}) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'InputRange',
|
|
18
|
+
field: uniqueId(),
|
|
19
|
+
title: t('com.inputRange.name'),
|
|
20
|
+
info: '',
|
|
21
|
+
$required: false,
|
|
22
|
+
value: [null, null],
|
|
23
|
+
props: {
|
|
24
|
+
separator: '~',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
props(_, {t}) {
|
|
29
|
+
return localeProps(t, name + '.props', [
|
|
30
|
+
{type: 'switch', field: 'disabled'},
|
|
31
|
+
{type: 'inputNumber', field: 'min'},
|
|
32
|
+
{type: 'inputNumber', field: 'max'},
|
|
33
|
+
{type: 'inputNumber', field: 'step', props: {min: 0}, value: 1},
|
|
34
|
+
{type: 'input', field: 'separator', value: '~'},
|
|
35
|
+
{type: 'input', field: 'startPlaceholder'},
|
|
36
|
+
{type: 'input', field: 'endPlaceholder'},
|
|
37
|
+
]);
|
|
38
|
+
},
|
|
39
|
+
};
|
package/src/form/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import FcTitle from '../components/FcTitle.vue';
|
|
|
4
4
|
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
|
+
import InputRange from '../components/InputRange.vue';
|
|
7
8
|
import '../style/icon.css';
|
|
8
9
|
|
|
9
10
|
const install = (formCreate) => {
|
|
@@ -12,6 +13,7 @@ const install = (formCreate) => {
|
|
|
12
13
|
formCreate.component('SignaturePad', SignaturePad);
|
|
13
14
|
formCreate.component('TableForm', TableForm);
|
|
14
15
|
formCreate.component('FcTable', Table);
|
|
16
|
+
formCreate.component('InputRange', InputRange);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
install(formCreate);
|
package/src/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import ValueInput from './components/ValueInput.vue';
|
|
|
31
31
|
import formCreate, {designerForm} from './utils/form';
|
|
32
32
|
import FcEditor from '@form-create/component-wangeditor';
|
|
33
33
|
import draggable from 'vuedraggable/src/vuedraggable';
|
|
34
|
+
import InputRange from './components/InputRange.vue';
|
|
34
35
|
import {
|
|
35
36
|
compareVersion,
|
|
36
37
|
copyTextToClipboard,
|
|
@@ -84,7 +85,7 @@ addComponent('FcTitle', FcTitle);
|
|
|
84
85
|
addComponent('SignaturePad', SignaturePad);
|
|
85
86
|
addComponent('TableForm', TableForm, TableFormView);
|
|
86
87
|
addComponent('FcTable', Table, TableView);
|
|
87
|
-
|
|
88
|
+
addComponent('InputRange', InputRange);
|
|
88
89
|
const install = function (Vue) {
|
|
89
90
|
Vue.component('FcDesigner', FcDesigner);
|
|
90
91
|
};
|
package/src/locale/en.js
CHANGED
|
@@ -749,6 +749,18 @@ const En = {
|
|
|
749
749
|
placeholder: 'Placeholder'
|
|
750
750
|
}
|
|
751
751
|
},
|
|
752
|
+
inputRange: {
|
|
753
|
+
name: 'Input Range',
|
|
754
|
+
props: {
|
|
755
|
+
disabled: 'Disabled',
|
|
756
|
+
min: 'Minimum value',
|
|
757
|
+
max: 'Maximum value',
|
|
758
|
+
step: 'Step',
|
|
759
|
+
separator: 'Separator',
|
|
760
|
+
startPlaceholder: 'Start placeholder',
|
|
761
|
+
endPlaceholder: 'End placeholder',
|
|
762
|
+
}
|
|
763
|
+
},
|
|
752
764
|
password: {
|
|
753
765
|
name: 'Password',
|
|
754
766
|
event: {
|
package/src/locale/zh-cn.js
CHANGED
|
@@ -750,6 +750,18 @@ const ZhCn = {
|
|
|
750
750
|
placeholder: '输入框占位文本'
|
|
751
751
|
}
|
|
752
752
|
},
|
|
753
|
+
inputRange: {
|
|
754
|
+
name: '数值范围',
|
|
755
|
+
props: {
|
|
756
|
+
disabled: '是否禁用',
|
|
757
|
+
min: '最小值',
|
|
758
|
+
max: '最大值',
|
|
759
|
+
step: '步长',
|
|
760
|
+
separator: '分隔符',
|
|
761
|
+
startPlaceholder: '起始占位符',
|
|
762
|
+
endPlaceholder: '结束占位符',
|
|
763
|
+
}
|
|
764
|
+
},
|
|
753
765
|
password: {
|
|
754
766
|
name: '密码输入框',
|
|
755
767
|
event: {
|