@houaoran/designer 1.0.0
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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/components.es.js +11424 -0
- package/dist/components.umd.js +878 -0
- package/dist/index.es.js +39113 -0
- package/dist/index.umd.js +1187 -0
- package/package.json +96 -0
- package/src/components/DragBox.vue +49 -0
- package/src/components/DragTool.vue +235 -0
- package/src/components/EventConfig.vue +557 -0
- package/src/components/FcDesigner.vue +2569 -0
- package/src/components/FcTitle.vue +69 -0
- package/src/components/FetchConfig.vue +415 -0
- package/src/components/FieldInput.vue +371 -0
- package/src/components/FnConfig.vue +315 -0
- package/src/components/FnEditor.vue +327 -0
- package/src/components/FnInput.vue +103 -0
- package/src/components/FormLabel.vue +47 -0
- package/src/components/HtmlEditor.vue +125 -0
- package/src/components/JsonPreview.vue +146 -0
- package/src/components/OptionsTextInput.vue +151 -0
- package/src/components/PropsInput.vue +72 -0
- package/src/components/Required.vue +75 -0
- package/src/components/Row.vue +26 -0
- package/src/components/SignaturePad.vue +176 -0
- package/src/components/Struct.vue +153 -0
- package/src/components/StructEditor.vue +121 -0
- package/src/components/StructTree.vue +209 -0
- package/src/components/TableOptions.vue +164 -0
- package/src/components/TreeOptions.vue +167 -0
- package/src/components/TypeSelect.vue +144 -0
- package/src/components/Validate.vue +302 -0
- package/src/components/ValueInput.vue +89 -0
- package/src/components/Warning.vue +46 -0
- package/src/components/ai/AiPanel.vue +1122 -0
- package/src/components/ai/MarkdownRenderer.vue +548 -0
- package/src/components/language/LanguageConfig.vue +174 -0
- package/src/components/language/LanguageInput.vue +191 -0
- package/src/components/style/BackgroundInput.vue +315 -0
- package/src/components/style/BorderInput.vue +242 -0
- package/src/components/style/BoxSizeInput.vue +166 -0
- package/src/components/style/BoxSpaceInput.vue +269 -0
- package/src/components/style/ColorInput.vue +90 -0
- package/src/components/style/ConfigItem.vue +118 -0
- package/src/components/style/FontInput.vue +197 -0
- package/src/components/style/PositionInput.vue +146 -0
- package/src/components/style/RadiusInput.vue +164 -0
- package/src/components/style/ShadowContent.vue +335 -0
- package/src/components/style/ShadowInput.vue +91 -0
- package/src/components/style/SizeInput.vue +118 -0
- package/src/components/style/StyleConfig.vue +307 -0
- package/src/components/table/Table.vue +252 -0
- package/src/components/table/TableView.vue +1058 -0
- package/src/components/tableForm/TableForm.vue +471 -0
- package/src/components/tableForm/TableFormColumnView.vue +103 -0
- package/src/components/tableForm/TableFormView.vue +46 -0
- package/src/components/tree/FcTree.vue +713 -0
- package/src/components/tree/FcTreeNode.vue +216 -0
- package/src/config/base/field.js +43 -0
- package/src/config/base/form.js +132 -0
- package/src/config/base/style.js +26 -0
- package/src/config/base/validate.js +15 -0
- package/src/config/index.js +70 -0
- package/src/config/menu.js +24 -0
- package/src/config/rule/alert.js +45 -0
- package/src/config/rule/button.js +49 -0
- package/src/config/rule/card.js +40 -0
- package/src/config/rule/cascader.js +121 -0
- package/src/config/rule/checkbox.js +68 -0
- package/src/config/rule/col.js +86 -0
- package/src/config/rule/collapse.js +30 -0
- package/src/config/rule/collapseItem.js +36 -0
- package/src/config/rule/color.js +53 -0
- package/src/config/rule/date.js +66 -0
- package/src/config/rule/dateRange.js +60 -0
- package/src/config/rule/divider.js +31 -0
- package/src/config/rule/editor.js +31 -0
- package/src/config/rule/group.js +86 -0
- package/src/config/rule/html.js +43 -0
- package/src/config/rule/image.js +32 -0
- package/src/config/rule/input.js +62 -0
- package/src/config/rule/number.js +49 -0
- package/src/config/rule/password.js +52 -0
- package/src/config/rule/radio.js +43 -0
- package/src/config/rule/rate.js +44 -0
- package/src/config/rule/row.js +46 -0
- package/src/config/rule/select.js +70 -0
- package/src/config/rule/signaturePad.js +59 -0
- package/src/config/rule/slider.js +53 -0
- package/src/config/rule/space.js +44 -0
- package/src/config/rule/subForm.js +47 -0
- package/src/config/rule/switch.js +46 -0
- package/src/config/rule/tabPane.js +29 -0
- package/src/config/rule/table.js +37 -0
- package/src/config/rule/tableForm.js +115 -0
- package/src/config/rule/tableFormColumn.js +55 -0
- package/src/config/rule/tabs.js +38 -0
- package/src/config/rule/tag.js +69 -0
- package/src/config/rule/text.js +41 -0
- package/src/config/rule/textarea.js +63 -0
- package/src/config/rule/time.js +58 -0
- package/src/config/rule/timeRange.js +49 -0
- package/src/config/rule/title.js +37 -0
- package/src/config/rule/transfer.js +59 -0
- package/src/config/rule/tree.js +70 -0
- package/src/config/rule/treeSelect.js +77 -0
- package/src/config/rule/upload.js +107 -0
- package/src/form/index.js +19 -0
- package/src/index.js +173 -0
- package/src/locale/en.js +981 -0
- package/src/locale/zh-cn.js +983 -0
- package/src/style/fonts/fc-icons.woff +0 -0
- package/src/style/icon.css +1052 -0
- package/src/style/index.css +836 -0
- package/src/utils/form.js +9 -0
- package/src/utils/highlight/highlight.min.js +307 -0
- package/src/utils/highlight/javascript.min.js +80 -0
- package/src/utils/highlight/style.css +1 -0
- package/src/utils/highlight/xml.min.js +29 -0
- package/src/utils/hintStubs.js +120 -0
- package/src/utils/index.js +544 -0
- package/src/utils/jsonDiff.js +173 -0
- package/src/utils/locale.js +23 -0
- package/src/utils/message.js +19 -0
- package/src/utils/template.js +105 -0
- package/types/index.d.ts +575 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-color-input">
|
|
3
|
+
<el-input clearable v-model="value">
|
|
4
|
+
<template #append>
|
|
5
|
+
<el-color-picker show-alpha color-format="hex" :predefine="predefine" v-model="value"/>
|
|
6
|
+
</template>
|
|
7
|
+
</el-input>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import {defineComponent} from 'vue';
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: 'ColorInput',
|
|
16
|
+
inject: ['designer'],
|
|
17
|
+
emits: ['update:modelValue', 'change'],
|
|
18
|
+
props: {
|
|
19
|
+
modelValue: String,
|
|
20
|
+
},
|
|
21
|
+
watch: {
|
|
22
|
+
modelValue() {
|
|
23
|
+
this.value = this.modelValue || '';
|
|
24
|
+
},
|
|
25
|
+
value(n) {
|
|
26
|
+
this.$emit('update:modelValue', n);
|
|
27
|
+
this.$emit('change', n);
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
value: this.modelValue || '',
|
|
33
|
+
predefine: [
|
|
34
|
+
'#c9e6fc',
|
|
35
|
+
'#c3f2f2',
|
|
36
|
+
'#c2f1d2',
|
|
37
|
+
'#fef6c6',
|
|
38
|
+
'#ffe5c2',
|
|
39
|
+
'#fdcac2',
|
|
40
|
+
'#fadcce',
|
|
41
|
+
'#dec2fa',
|
|
42
|
+
'#ccd2f1',
|
|
43
|
+
'#2196f3',
|
|
44
|
+
'#08c9c9',
|
|
45
|
+
'#00c344',
|
|
46
|
+
'#fad714',
|
|
47
|
+
'#ff9300',
|
|
48
|
+
'#f52222',
|
|
49
|
+
'#eb2f96',
|
|
50
|
+
'#800080',
|
|
51
|
+
'#7500ea',
|
|
52
|
+
'#2d46c4',
|
|
53
|
+
'#000000',
|
|
54
|
+
'#333333',
|
|
55
|
+
'#5a5a5a',
|
|
56
|
+
'#757575',
|
|
57
|
+
'#9e9e9e',
|
|
58
|
+
'#bdbdbd',
|
|
59
|
+
'#dddddd',
|
|
60
|
+
'#f5f5f5',
|
|
61
|
+
'#ffffff',
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {},
|
|
66
|
+
created() {
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
._fd-color-input {
|
|
74
|
+
width: 150px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
._fd-color-input .el-input .el-color-picker {
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
._fd-color-input .el-input .el-input-group__append {
|
|
82
|
+
padding: 0;
|
|
83
|
+
width: 24px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
._fd-color-input .el-input .el-color-picker__trigger {
|
|
87
|
+
border-left: 0 none;
|
|
88
|
+
border-radius: 0px 3px 3px 0px;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-config-item">
|
|
3
|
+
<div class="_fd-ci-head">
|
|
4
|
+
<div class="_fd-ci-label" :class="$slots.append && arrow !== false ? 'is-arrow' : ''"
|
|
5
|
+
@click="visit = $slots.append && arrow !== false && !visit">
|
|
6
|
+
<template v-if="warning">
|
|
7
|
+
<Warning :tooltip="warning">
|
|
8
|
+
<slot name="label">
|
|
9
|
+
<span>{{ label }}</span>
|
|
10
|
+
</slot>
|
|
11
|
+
</Warning>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<slot name="label">
|
|
15
|
+
<span>{{ label }}</span>
|
|
16
|
+
</slot>
|
|
17
|
+
</template>
|
|
18
|
+
<i class="fc-icon icon-down" v-if="$slots.append && arrow !== false"
|
|
19
|
+
:class="(showAppend || visit) ? 'down' : ''"></i>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="_fd-ci-con" v-if="$slots.default || info">
|
|
22
|
+
<template v-if="$slots.default">
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</template>
|
|
25
|
+
<span class="_fd-ci-info" v-else>{{ info }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="_fd-ci-append" v-if="showAppend || visit" :style="'background:' + appendBackground">
|
|
29
|
+
<slot name="append"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import {defineComponent} from 'vue';
|
|
36
|
+
import Warning from '../Warning.vue';
|
|
37
|
+
|
|
38
|
+
export default defineComponent({
|
|
39
|
+
name: 'ConfigItem',
|
|
40
|
+
components: {Warning},
|
|
41
|
+
props: {
|
|
42
|
+
label: String,
|
|
43
|
+
info: String,
|
|
44
|
+
warning: String,
|
|
45
|
+
appendBackground: String,
|
|
46
|
+
arrow: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
showAppend: Boolean,
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
visit: false,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
._fd-config-item {
|
|
64
|
+
display: flex;
|
|
65
|
+
width: 100%;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
color: #666666;
|
|
69
|
+
margin-bottom: 10px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
._fd-ci-head {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
align-items: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
._fd-ci-label {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
color: #262626;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
._fd-ci-con {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
min-width: 150px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
._fd-ci-label.is-arrow {
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
._fd-ci-append {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
background: #F5F5F5;
|
|
100
|
+
margin: 5px 3px 3px;
|
|
101
|
+
padding: 4px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
._fd-ci-label i {
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
._fd-ci-label i.down {
|
|
111
|
+
transform: rotate(-180deg);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
._fd-ci-info {
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
padding-right: 5px;
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ConfigItem :label="t('style.font.name')">
|
|
3
|
+
<div class="_fd-fi-box" :style="fontStyle">
|
|
4
|
+
{{ t('style.font.preview') }}
|
|
5
|
+
</div>
|
|
6
|
+
<template #append>
|
|
7
|
+
<div class="_fd-font-input">
|
|
8
|
+
<el-form label-width="50px" label-position="top" inline size="small">
|
|
9
|
+
<el-form-item :label="t('style.font.family')">
|
|
10
|
+
<el-select v-model="fontStyle.fontFamily" clearable @change="onInput">
|
|
11
|
+
<el-option
|
|
12
|
+
v-for="item in familyType"
|
|
13
|
+
:key="item.value"
|
|
14
|
+
:label="item.label"
|
|
15
|
+
:value="item.value"
|
|
16
|
+
>
|
|
17
|
+
<span :style="{fontFamily: item.value}">{{ item.label }}</span>
|
|
18
|
+
</el-option>
|
|
19
|
+
</el-select>
|
|
20
|
+
</el-form-item>
|
|
21
|
+
<el-form-item :label="t('style.font.size')">
|
|
22
|
+
<SizeInput v-model="fontStyle.fontSize" @change="onInput"/>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
<el-form-item :label="t('style.weight.name')">
|
|
25
|
+
<el-select v-model="fontStyle.fontWeight" clearable @change="onInput">
|
|
26
|
+
<el-option
|
|
27
|
+
v-for="item in weightType"
|
|
28
|
+
:key="item.value"
|
|
29
|
+
:label="item.label"
|
|
30
|
+
:value="item.value"
|
|
31
|
+
>
|
|
32
|
+
<span :style="{fontWeight: item.value}">{{ item.label }}</span>
|
|
33
|
+
</el-option>
|
|
34
|
+
</el-select>
|
|
35
|
+
</el-form-item>
|
|
36
|
+
<el-form-item :label="t('style.decoration.name')">
|
|
37
|
+
<el-select v-model="fontStyle.textDecoration" clearable @change="onInput">
|
|
38
|
+
<el-option
|
|
39
|
+
v-for="item in decorationType"
|
|
40
|
+
:key="item.value"
|
|
41
|
+
:label="item.label"
|
|
42
|
+
:value="item.value"
|
|
43
|
+
>
|
|
44
|
+
<span :style="{textDecoration: item.value}">{{ item.label }}</span>
|
|
45
|
+
</el-option>
|
|
46
|
+
</el-select>
|
|
47
|
+
</el-form-item>
|
|
48
|
+
<el-form-item :label="t('style.font.align')">
|
|
49
|
+
<el-select v-model="fontStyle.textAlign" clearable @change="onInput">
|
|
50
|
+
<el-option
|
|
51
|
+
v-for="item in alignType"
|
|
52
|
+
:key="item.value"
|
|
53
|
+
:label="item.label"
|
|
54
|
+
:value="item.value"
|
|
55
|
+
/>
|
|
56
|
+
</el-select>
|
|
57
|
+
</el-form-item>
|
|
58
|
+
<el-form-item :label="t('style.font.height')">
|
|
59
|
+
<SizeInput v-model="fontStyle.lineHeight" @change="onInput"/>
|
|
60
|
+
</el-form-item>
|
|
61
|
+
<el-form-item :label="t('style.font.spacing')">
|
|
62
|
+
<SizeInput v-model="fontStyle.letterSpacing" @change="onInput"/>
|
|
63
|
+
</el-form-item>
|
|
64
|
+
</el-form>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
</ConfigItem>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import {defineComponent} from 'vue';
|
|
72
|
+
import SizeInput from './SizeInput.vue';
|
|
73
|
+
import ColorInput from './ColorInput.vue';
|
|
74
|
+
import ConfigItem from './ConfigItem.vue';
|
|
75
|
+
import {toLine} from '@form-create/utils';
|
|
76
|
+
|
|
77
|
+
export default defineComponent({
|
|
78
|
+
name: 'BorderInput',
|
|
79
|
+
components: {ColorInput, SizeInput, ConfigItem},
|
|
80
|
+
inject: ['designer'],
|
|
81
|
+
emits: ['update:modelValue', 'change'],
|
|
82
|
+
props: {
|
|
83
|
+
modelValue: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => ({}),
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
watch: {
|
|
89
|
+
modelValue() {
|
|
90
|
+
this.tidyValue();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
borderStyleStr() {
|
|
95
|
+
let str = '';
|
|
96
|
+
Object.keys(this.borderStyle).forEach((key) => {
|
|
97
|
+
if (this.borderStyle[key] !== '') {
|
|
98
|
+
str += toLine(key) + ': ' + this.borderStyle[key] + ';';
|
|
99
|
+
}
|
|
100
|
+
}, {})
|
|
101
|
+
return str;
|
|
102
|
+
},
|
|
103
|
+
alignType() {
|
|
104
|
+
return ['left', 'center', 'right'].map(v => {
|
|
105
|
+
return {label: this.t('props.' + v), value: v};
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
decorationType() {
|
|
109
|
+
return ['underline', 'line-through', 'overline'].map(v => {
|
|
110
|
+
return {label: this.t('style.decoration.' + v), value: v};
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
weightType() {
|
|
114
|
+
return [300, 400, 500, 700].map(v => {
|
|
115
|
+
return {label: this.t('style.weight.' + v), value: v};
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
familyType() {
|
|
119
|
+
const fontFamily = this.designer.setupState.getConfig('fontFamily') || ['Microsoft YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong', 'Arial', 'sans-serif', 'monospace'];
|
|
120
|
+
return fontFamily.map(v => {
|
|
121
|
+
if (typeof v === 'string') {
|
|
122
|
+
return {label: this.t('style.family.' + v) || v, value: v};
|
|
123
|
+
} else {
|
|
124
|
+
return v;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
data() {
|
|
130
|
+
const t = this.designer.setupState.t;
|
|
131
|
+
return {
|
|
132
|
+
t,
|
|
133
|
+
fontStyle: {
|
|
134
|
+
fontSize: '',
|
|
135
|
+
fontFamily: '',
|
|
136
|
+
fontWeight: '',
|
|
137
|
+
fontStyle: '',
|
|
138
|
+
textDecoration: '',
|
|
139
|
+
textAlign: '',
|
|
140
|
+
lineHeight: '',
|
|
141
|
+
letterSpacing: '',
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
methods: {
|
|
146
|
+
tidyValue() {
|
|
147
|
+
Object.keys(this.fontStyle).forEach(k => {
|
|
148
|
+
this.fontStyle[k] = this.modelValue[k] || '';
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
onInput() {
|
|
152
|
+
const style = Object.keys(this.fontStyle).reduce((acc, key) => {
|
|
153
|
+
if (this.fontStyle[key] !== '') {
|
|
154
|
+
acc[key] = this.fontStyle[key]
|
|
155
|
+
}
|
|
156
|
+
return acc
|
|
157
|
+
}, {})
|
|
158
|
+
this.$emit('update:modelValue', style)
|
|
159
|
+
this.$emit('change', style)
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
created() {
|
|
163
|
+
this.tidyValue();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
});
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<style>
|
|
170
|
+
._fd-font-input {
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
padding: 0 5px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
._fd-fi-box {
|
|
177
|
+
width: 150px;
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
._fd-font-input .el-form {
|
|
182
|
+
display: grid;
|
|
183
|
+
grid-template-columns: repeat(2, 1fr);
|
|
184
|
+
width: 100%;
|
|
185
|
+
grid-column-gap: 10px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
._fd-font-input .el-form--inline .el-form-item {
|
|
189
|
+
margin: 0;
|
|
190
|
+
padding: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
._fd-font-input ._fd-size-input .el-input-number--small {
|
|
194
|
+
width: 100%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
</style>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-pos-input">
|
|
3
|
+
<ConfigItem :label="t('style.position.name')">
|
|
4
|
+
<el-select v-model="style.position" clearable @change="onInput">
|
|
5
|
+
<el-option
|
|
6
|
+
v-for="item in positionType"
|
|
7
|
+
:key="item.value"
|
|
8
|
+
:label="item.label"
|
|
9
|
+
:value="item.value"
|
|
10
|
+
>
|
|
11
|
+
{{ item.label }}
|
|
12
|
+
</el-option>
|
|
13
|
+
</el-select>
|
|
14
|
+
<template #append>
|
|
15
|
+
<div class="_fd-pos-con">
|
|
16
|
+
<div class="_fd-pos-item">
|
|
17
|
+
<div class="_fd-pos-icon">
|
|
18
|
+
<i class="fc-icon icon-position-left"></i>
|
|
19
|
+
</div>
|
|
20
|
+
<SizeInput v-model="style.left" @change="onInput"/>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="_fd-pos-item">
|
|
23
|
+
<div class="_fd-pos-icon" style="transform: rotate(90deg);">
|
|
24
|
+
<i class="fc-icon icon-position-left"></i>
|
|
25
|
+
</div>
|
|
26
|
+
<SizeInput v-model="style.top" @change="onInput"/>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="_fd-pos-item">
|
|
29
|
+
<div class="_fd-pos-icon" style="transform: rotate(-90deg);">
|
|
30
|
+
<i class="fc-icon icon-position-left"></i>
|
|
31
|
+
</div>
|
|
32
|
+
<SizeInput v-model="style.bottom" @change="onInput"/>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="_fd-pos-item">
|
|
35
|
+
<div class="_fd-pos-icon" style="transform: rotate(180deg);">
|
|
36
|
+
<i class="fc-icon icon-position-left"></i>
|
|
37
|
+
</div>
|
|
38
|
+
<SizeInput v-model="style.right" @change="onInput"/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
</ConfigItem>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import {defineComponent} from 'vue';
|
|
48
|
+
import SizeInput from './SizeInput.vue';
|
|
49
|
+
import ConfigItem from './ConfigItem.vue';
|
|
50
|
+
|
|
51
|
+
export default defineComponent({
|
|
52
|
+
name: 'PositionInput',
|
|
53
|
+
components: {ConfigItem, SizeInput},
|
|
54
|
+
inject: ['designer'],
|
|
55
|
+
emits: ['update:modelValue', 'change'],
|
|
56
|
+
props: {
|
|
57
|
+
modelValue: Object,
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
modelValue() {
|
|
61
|
+
this.tidyValue();
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
t() {
|
|
66
|
+
return this.designer.setupState.t;
|
|
67
|
+
},
|
|
68
|
+
positionType() {
|
|
69
|
+
return ['static', 'relative', 'absolute', 'fixed', 'sticky'].map(v => {
|
|
70
|
+
return {label: this.t('style.position.' + v), value: v}
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
style: {
|
|
77
|
+
position: '',
|
|
78
|
+
left: '',
|
|
79
|
+
right: '',
|
|
80
|
+
top: '',
|
|
81
|
+
bottom: '',
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
methods: {
|
|
86
|
+
tidyValue() {
|
|
87
|
+
this.style = {
|
|
88
|
+
position: '',
|
|
89
|
+
left: '',
|
|
90
|
+
right: '',
|
|
91
|
+
top: '',
|
|
92
|
+
bottom: '',
|
|
93
|
+
...this.modelValue,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
onInput() {
|
|
97
|
+
const style = Object.keys(this.style).reduce((acc, key) => {
|
|
98
|
+
if (this.style[key] !== '') {
|
|
99
|
+
acc[key] = this.style[key]
|
|
100
|
+
}
|
|
101
|
+
return acc
|
|
102
|
+
}, {})
|
|
103
|
+
this.$emit('update:modelValue', style)
|
|
104
|
+
this.$emit('change', style)
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
created() {
|
|
108
|
+
this.tidyValue();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style>
|
|
115
|
+
._fd-pos-input {
|
|
116
|
+
width: 100%;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
._fd-pos-con {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-wrap: wrap;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
._fd-pos-item {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: 50%;
|
|
131
|
+
padding: 5px 0;
|
|
132
|
+
box-sizing: border-box;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
._fd-pos-item ._fd-pos-icon {
|
|
136
|
+
width: 24px;
|
|
137
|
+
height: 24px;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
align-items: center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
._fd-pos-item ._fd-size-input .el-input-number--small {
|
|
144
|
+
width: 70px;
|
|
145
|
+
}
|
|
146
|
+
</style>
|