@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,242 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ConfigItem :label="t('style.border')">
|
|
3
|
+
<div class="line-box" :style="borderStyleStr">
|
|
4
|
+
<div class="line-box-con"></div>
|
|
5
|
+
</div>
|
|
6
|
+
<template #append>
|
|
7
|
+
<div class="_fd-border-input">
|
|
8
|
+
<div class="_fd-bi-left">
|
|
9
|
+
<div class="_fd-bil-row">
|
|
10
|
+
<div class="_fd-bil-col" :class="active === 'Top' ? 'active' : ''" @click="active = 'Top'">┳
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="_fd-bil-row">
|
|
14
|
+
<div class="_fd-bil-col" :class="active === 'Left' ? 'active' : ''" @click="active = 'Left'">┣
|
|
15
|
+
</div>
|
|
16
|
+
<div class="_fd-bil-col" :class="active === '' ? 'active' : ''" @click="active = ''">╋</div>
|
|
17
|
+
<div class="_fd-bil-col" :class="active === 'Right' ? 'active' : ''" @click="active = 'Right'">
|
|
18
|
+
┫
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="_fd-bil-row">
|
|
22
|
+
<div class="_fd-bil-col" :class="active === 'Bottom' ? 'active' : ''"
|
|
23
|
+
@click="active = 'Bottom'">┻
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="_fd-bi-right">
|
|
28
|
+
<el-select v-model="curStyle" clearable>
|
|
29
|
+
<el-option
|
|
30
|
+
v-for="item in lineType"
|
|
31
|
+
:key="item.value"
|
|
32
|
+
:label="item.label"
|
|
33
|
+
:value="item.value"
|
|
34
|
+
>
|
|
35
|
+
<div class="_fd-bi-opt">
|
|
36
|
+
<div class="_line" :class="item.value"></div>
|
|
37
|
+
</div>
|
|
38
|
+
</el-option>
|
|
39
|
+
</el-select>
|
|
40
|
+
<SizeInput v-model="curWidth"/>
|
|
41
|
+
<ColorInput v-model="curColor"/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</ConfigItem>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import {defineComponent} from 'vue';
|
|
50
|
+
import SizeInput from './SizeInput.vue';
|
|
51
|
+
import ColorInput from './ColorInput.vue';
|
|
52
|
+
import ConfigItem from './ConfigItem.vue';
|
|
53
|
+
import {toLine} from '@form-create/utils';
|
|
54
|
+
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: 'BorderInput',
|
|
57
|
+
components: {ColorInput, SizeInput, ConfigItem},
|
|
58
|
+
inject: ['designer'],
|
|
59
|
+
emits: ['update:modelValue', 'change'],
|
|
60
|
+
props: {
|
|
61
|
+
modelValue: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: () => ({}),
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
modelValue() {
|
|
68
|
+
this.tidyValue();
|
|
69
|
+
this.initCur();
|
|
70
|
+
},
|
|
71
|
+
active() {
|
|
72
|
+
this.initCur();
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
borderStyleStr() {
|
|
77
|
+
let str = '';
|
|
78
|
+
Object.keys(this.borderStyle).forEach((key) => {
|
|
79
|
+
if (this.borderStyle[key] !== '') {
|
|
80
|
+
str += toLine(key) + ': ' + this.borderStyle[key] + ';';
|
|
81
|
+
}
|
|
82
|
+
}, {})
|
|
83
|
+
return str;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
data() {
|
|
87
|
+
const t = this.designer.setupState.t;
|
|
88
|
+
return {
|
|
89
|
+
t,
|
|
90
|
+
active: '',
|
|
91
|
+
borderStyle: {},
|
|
92
|
+
curStyle: '',
|
|
93
|
+
curColor: '',
|
|
94
|
+
curWidth: '',
|
|
95
|
+
lineType: ['solid', 'dashed', 'dotted', 'double'].map(k => {
|
|
96
|
+
return {value: k, label: t('style.' + k)}
|
|
97
|
+
}),
|
|
98
|
+
position: ['Top', 'Left', 'Bottom', 'Right'],
|
|
99
|
+
type: ['Style', 'Color', 'Width'],
|
|
100
|
+
unwatch: null,
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
methods: {
|
|
104
|
+
tidyValue() {
|
|
105
|
+
const key = [];
|
|
106
|
+
this.borderStyle = {};
|
|
107
|
+
['', ...this.position].forEach(k => {
|
|
108
|
+
this.type.forEach(t => {
|
|
109
|
+
key.push('border' + k + t);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
key.forEach(k => {
|
|
113
|
+
this.borderStyle[k] = this.modelValue[k] || '';
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
onInput() {
|
|
117
|
+
const style = Object.keys(this.borderStyle).reduce((acc, key) => {
|
|
118
|
+
if (this.borderStyle[key] !== '') {
|
|
119
|
+
acc[key] = this.borderStyle[key]
|
|
120
|
+
}
|
|
121
|
+
return acc
|
|
122
|
+
}, {})
|
|
123
|
+
this.$emit('update:modelValue', style)
|
|
124
|
+
this.$emit('change', style)
|
|
125
|
+
},
|
|
126
|
+
pushCur() {
|
|
127
|
+
this.borderStyle['border' + this.active + 'Style'] = this.curStyle || '';
|
|
128
|
+
this.borderStyle['border' + this.active + 'Color'] = this.curColor || '';
|
|
129
|
+
this.borderStyle['border' + this.active + 'Width'] = this.curWidth || '';
|
|
130
|
+
this.onInput();
|
|
131
|
+
},
|
|
132
|
+
initCur() {
|
|
133
|
+
this.unwatch && this.unwatch();
|
|
134
|
+
this.curStyle = this.borderStyle['border' + this.active + 'Style'] || '';
|
|
135
|
+
this.curColor = this.borderStyle['border' + this.active + 'Color'] || '';
|
|
136
|
+
this.curWidth = this.borderStyle['border' + this.active + 'Width'] || '';
|
|
137
|
+
this.unwatch = this.$watch(() => [this.curStyle, this.curColor, this.curWidth], () => {
|
|
138
|
+
this.pushCur();
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
created() {
|
|
143
|
+
this.tidyValue();
|
|
144
|
+
this.initCur();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
});
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style>
|
|
151
|
+
._fd-border-input {
|
|
152
|
+
width: 100%;
|
|
153
|
+
height: 110px;
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
._fd-border-input ._fd-bi-left {
|
|
159
|
+
width: 115px;
|
|
160
|
+
height: 115px;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
align-items: center;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
._fd-border-input ._fd-bi-right {
|
|
168
|
+
width: 140px;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
justify-content: space-around;
|
|
172
|
+
padding: 5px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
._fd-border-input ._fd-bi-right ._fd-color-input {
|
|
176
|
+
width: 140px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
._fd-bi-opt {
|
|
180
|
+
width: 100%;
|
|
181
|
+
display: flex;
|
|
182
|
+
height: 100%;
|
|
183
|
+
align-items: center;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
._fd-bi-opt ._line {
|
|
187
|
+
width: 100%;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
._fd-bi-opt .solid {
|
|
191
|
+
border: 1px solid #000;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
._fd-bi-opt .dashed {
|
|
195
|
+
border: 1px dashed #000;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
._fd-bi-opt .dotted {
|
|
199
|
+
border: 1px dotted #000;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
._fd-bi-opt .double {
|
|
203
|
+
border: 1px double #000;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
._fd-border-input ._fd-bil-row {
|
|
207
|
+
height: 38px;
|
|
208
|
+
display: flex;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
._fd-border-input ._fd-bil-col {
|
|
213
|
+
width: 22px;
|
|
214
|
+
height: 22px;
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
margin: 8px;
|
|
220
|
+
font-size: 16px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
._fd-border-input ._fd-bil-col.active {
|
|
224
|
+
outline: 1px dashed #2E73FF;
|
|
225
|
+
color: #2E73FF;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.line-box {
|
|
229
|
+
width: 150px;
|
|
230
|
+
height: 20px;
|
|
231
|
+
padding: 1px;
|
|
232
|
+
box-sizing: border-box;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.line-box-con {
|
|
236
|
+
width: 100%;
|
|
237
|
+
height: 100%;
|
|
238
|
+
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAD5JREFUOE9jZGBg+M+AChjR+HjlQYqHgQFoXibNS+gBBjKMpDAZHAaQ5GQGBgYUV4+mA7QAgaYokgJ14NMBAK1TIAlUJpxYAAAAAElFTkSuQmCC");
|
|
239
|
+
opacity: 0.3;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
</style>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-box-size-input">
|
|
3
|
+
<ConfigItem :label="t('props.size')" :info="Object.keys(modelValue).length > 0 ? t('struct.configured') : ''">
|
|
4
|
+
<template #append>
|
|
5
|
+
<el-form label-position="top" size="small">
|
|
6
|
+
<el-form-item :label="t('style.' + key)" v-for="key in keys" :key="key">
|
|
7
|
+
<SizeInput v-model="boxStyle[key]" @change="onInput"></SizeInput>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item :label="t('style.overflow.name')" style="grid-column: span 2;">
|
|
10
|
+
<el-radio-group :modelValue="boxStyle.overflow">
|
|
11
|
+
<el-tooltip
|
|
12
|
+
effect="dark"
|
|
13
|
+
:content="t('style.overflow.' + item.value)"
|
|
14
|
+
placement="top"
|
|
15
|
+
persistent
|
|
16
|
+
:hide-after="0"
|
|
17
|
+
v-for="item in overflow"
|
|
18
|
+
:key="item.value"
|
|
19
|
+
>
|
|
20
|
+
<el-radio-button :label="item.value" :value="item.value"
|
|
21
|
+
@click="changeOverflow(item.value)">
|
|
22
|
+
<template v-if="item.text">
|
|
23
|
+
<span style="font-size: 12px;line-height: 16px;">Auto
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else>
|
|
27
|
+
<i class="fc-icon" :class="item.icon"></i>
|
|
28
|
+
</template>
|
|
29
|
+
</el-radio-button>
|
|
30
|
+
</el-tooltip>
|
|
31
|
+
</el-radio-group>
|
|
32
|
+
</el-form-item>
|
|
33
|
+
</el-form>
|
|
34
|
+
</template>
|
|
35
|
+
</ConfigItem>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import {defineComponent} from 'vue';
|
|
41
|
+
import ConfigItem from './ConfigItem.vue';
|
|
42
|
+
import SizeInput from './SizeInput.vue';
|
|
43
|
+
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
name: 'BoxSizeInput',
|
|
46
|
+
components: {SizeInput, ConfigItem},
|
|
47
|
+
props: {
|
|
48
|
+
modelValue: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: () => ({}),
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
inject: ['designer'],
|
|
54
|
+
emits: ['update:modelValue', 'change'],
|
|
55
|
+
data() {
|
|
56
|
+
return {
|
|
57
|
+
overflow: [
|
|
58
|
+
{
|
|
59
|
+
value: 'visible',
|
|
60
|
+
icon: 'icon-eye',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: 'hidden',
|
|
64
|
+
icon: 'icon-eye-close',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: 'scroll',
|
|
68
|
+
icon: 'icon-scroll',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
value: 'auto',
|
|
72
|
+
text: 'Auto',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
keys: ['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],
|
|
76
|
+
boxStyle: {
|
|
77
|
+
width: '',
|
|
78
|
+
minWidth: '',
|
|
79
|
+
maxWidth: '',
|
|
80
|
+
height: '',
|
|
81
|
+
minHeight: '',
|
|
82
|
+
maxHeight: '',
|
|
83
|
+
overflow: '',
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
modelValue() {
|
|
89
|
+
this.tidyValue();
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
t() {
|
|
94
|
+
return this.designer.setupState.t;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
tidyValue() {
|
|
99
|
+
this.boxStyle = {
|
|
100
|
+
width: '',
|
|
101
|
+
minWidth: '',
|
|
102
|
+
maxWidth: '',
|
|
103
|
+
height: '',
|
|
104
|
+
minHeight: '',
|
|
105
|
+
maxHeight: '',
|
|
106
|
+
overflow: '',
|
|
107
|
+
};
|
|
108
|
+
if (!this.modelValue) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
Object.keys(this.boxStyle).forEach(k => {
|
|
112
|
+
if (this.modelValue[k]) {
|
|
113
|
+
this.boxStyle[k] = this.modelValue[k];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
onInput() {
|
|
118
|
+
const style = Object.keys(this.boxStyle).reduce((acc, key) => {
|
|
119
|
+
if (this.boxStyle[key] !== '') {
|
|
120
|
+
acc[key] = this.boxStyle[key]
|
|
121
|
+
}
|
|
122
|
+
return acc
|
|
123
|
+
}, {})
|
|
124
|
+
this.$emit('update:modelValue', style)
|
|
125
|
+
this.$emit('change', style)
|
|
126
|
+
},
|
|
127
|
+
changeOverflow(val) {
|
|
128
|
+
this.boxStyle.overflow = this.boxStyle.overflow === val ? '' : val;
|
|
129
|
+
this.onInput();
|
|
130
|
+
},
|
|
131
|
+
change(type, e) {
|
|
132
|
+
this.boxStyle[type] = e.target.value;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
created() {
|
|
136
|
+
this.tidyValue();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<style>
|
|
143
|
+
._fd-box-size-input .el-form {
|
|
144
|
+
display: grid;
|
|
145
|
+
grid-template-columns: repeat(2, 1fr);
|
|
146
|
+
width: 100%;
|
|
147
|
+
grid-column-gap: 10px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
._fd-box-size-input .el-radio-group {
|
|
151
|
+
width: 100%;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
._fd-box-size-input .el-radio-button__inner {
|
|
155
|
+
width: 100%;
|
|
156
|
+
padding: 4px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
._fd-box-size-input .el-radio-button {
|
|
160
|
+
flex: 1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
._fd-box-size-input ._fd-size-input .el-input-number--small {
|
|
164
|
+
width: 100%;
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-box-space-input">
|
|
3
|
+
<div class="_padding">
|
|
4
|
+
<span class="_padding-title">
|
|
5
|
+
{{ t('style.margin') }}
|
|
6
|
+
</span>
|
|
7
|
+
<input class="_fd-input _fd-top" placeholder=" " :value="boxStyle.marginTop" type="text"
|
|
8
|
+
@blur="(e)=>setValue('margin','Top', e)" @input="(e)=>change('marginTop', e)" @keydown.enter="(e)=>setValue('margin','Top', e)">
|
|
9
|
+
<input class="_fd-input _fd-right" placeholder=" " :value="boxStyle.marginRight" type="text"
|
|
10
|
+
@blur="(e)=>setValue('margin','Right', e)" @input="(e)=>change('marginRight', e)" @keydown.enter="(e)=>setValue('margin','Right', e)">
|
|
11
|
+
<input class="_fd-input _fd-bottom" placeholder=" " :value="boxStyle.marginBottom" type="text"
|
|
12
|
+
@blur="(e)=>setValue('margin','Bottom', e)" @input="(e)=>change('marginBottom', e)" @keydown.enter="(e)=>setValue('margin','Bottom', e)">
|
|
13
|
+
<input class="_fd-input _fd-left" placeholder=" " :value="boxStyle.marginLeft" type="text"
|
|
14
|
+
@blur="(e)=>setValue('margin','Left', e)" @input="(e)=>change('marginLeft', e)" @keydown.enter="(e)=>setValue('margin','Left', e)">
|
|
15
|
+
<div class="_fd-help">
|
|
16
|
+
<i class="fc-icon icon-link2" title="lock" :class="marginLock ? 'active' : ''"
|
|
17
|
+
@click="lock('margin')"></i>
|
|
18
|
+
<i class="fc-icon icon-delete-circle" title="clear" @click="clear('margin')"></i>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="_margin">
|
|
21
|
+
<span class="_margin-title">
|
|
22
|
+
{{ t('style.padding') }}
|
|
23
|
+
</span>
|
|
24
|
+
<div class="_fd-help">
|
|
25
|
+
<i class="fc-icon icon-link2" title="lock" :class="paddingLock ? 'active' : ''"
|
|
26
|
+
@click="lock('padding')"></i>
|
|
27
|
+
<i class="fc-icon icon-delete-circle" title="clear" @click="clear('padding')"></i>
|
|
28
|
+
</div>
|
|
29
|
+
<input class="_fd-input _fd-top" placeholder=" " :value="boxStyle.paddingTop" type="text"
|
|
30
|
+
@blur="(e)=>setValue('padding','Top', e)" @input="(e)=>change('paddingTop', e)" @keydown.enter="(e)=>setValue('padding','Top', e)">
|
|
31
|
+
<input class="_fd-input _fd-right" placeholder=" " :value="boxStyle.paddingRight" type="text"
|
|
32
|
+
@blur="(e)=>setValue('padding','Right', e)" @input="(e)=>change('paddingRight', e)" @keydown.enter="(e)=>setValue('padding','Right', e)">
|
|
33
|
+
<input class="_fd-input _fd-bottom" placeholder=" " :value="boxStyle.paddingBottom" type="text"
|
|
34
|
+
@blur="(e)=>setValue('padding','Bottom', e)" @input="(e)=>change('paddingBottom', e)" @keydown.enter="(e)=>setValue('padding','Bottom', e)">
|
|
35
|
+
<input class="_fd-input _fd-left" placeholder=" " :value="boxStyle.paddingLeft" type="text"
|
|
36
|
+
@blur="(e)=>setValue('padding','Left', e)" @input="(e)=>change('paddingLeft', e)" @keydown.enter="(e)=>setValue('padding','Left', e)">
|
|
37
|
+
<div class="_box">
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import {defineComponent} from 'vue';
|
|
46
|
+
import ConfigItem from './ConfigItem.vue';
|
|
47
|
+
|
|
48
|
+
export default defineComponent({
|
|
49
|
+
name: 'BoxSpaceInput',
|
|
50
|
+
components: {ConfigItem},
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: Object,
|
|
54
|
+
default: () => ({}),
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
inject: ['designer'],
|
|
58
|
+
emits: ['update:modelValue', 'change'],
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
position: ['Top', 'Right', 'Bottom', 'Left'],
|
|
62
|
+
boxStyle: {
|
|
63
|
+
margin: '',
|
|
64
|
+
padding: '',
|
|
65
|
+
marginLeft: '',
|
|
66
|
+
marginRight: '',
|
|
67
|
+
marginTop: '',
|
|
68
|
+
marginBottom: '',
|
|
69
|
+
paddingLeft: '',
|
|
70
|
+
paddingRight: '',
|
|
71
|
+
paddingTop: '',
|
|
72
|
+
paddingBottom: '',
|
|
73
|
+
},
|
|
74
|
+
marginLock: false,
|
|
75
|
+
paddingLock: false,
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
watch: {
|
|
79
|
+
modelValue() {
|
|
80
|
+
this.tidyValue();
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
t() {
|
|
85
|
+
return this.designer.setupState.t;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
tidyValue() {
|
|
90
|
+
this.boxStyle = {};
|
|
91
|
+
['margin', 'padding'].forEach(k => {
|
|
92
|
+
this.boxStyle[k] = this.modelValue[k] || '';
|
|
93
|
+
this.position.forEach(p => {
|
|
94
|
+
this.boxStyle[k + p] = this.tidySize(this.modelValue[k + p] || this.modelValue[k] || '');
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
},
|
|
98
|
+
onInput() {
|
|
99
|
+
const style = Object.keys(this.boxStyle).reduce((acc, key) => {
|
|
100
|
+
if (this.boxStyle[key] !== '') {
|
|
101
|
+
acc[key] = this.boxStyle[key]
|
|
102
|
+
}
|
|
103
|
+
return acc
|
|
104
|
+
}, {})
|
|
105
|
+
this.$emit('update:modelValue', style)
|
|
106
|
+
this.$emit('change', style)
|
|
107
|
+
},
|
|
108
|
+
tidySize(val) {
|
|
109
|
+
const regex = /^(\d*\.?\d+)(px|rem|%|vh|vw|em)$/
|
|
110
|
+
if (!regex.test(val)) {
|
|
111
|
+
if (val === 'auto') {
|
|
112
|
+
return val;
|
|
113
|
+
}
|
|
114
|
+
const number = parseInt(val);
|
|
115
|
+
if (isNaN(number)) {
|
|
116
|
+
return '';
|
|
117
|
+
} else {
|
|
118
|
+
return number + 'px';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return val;
|
|
122
|
+
},
|
|
123
|
+
setValue(type, key, e) {
|
|
124
|
+
const value = this.tidySize(e.target.value);
|
|
125
|
+
if (!type) {
|
|
126
|
+
this.boxStyle[key] = value;
|
|
127
|
+
} else if (this[type + 'Lock']) {
|
|
128
|
+
this.position.forEach(v => {
|
|
129
|
+
this.boxStyle[type + v] = value;
|
|
130
|
+
})
|
|
131
|
+
} else {
|
|
132
|
+
this.boxStyle[type + key] = value;
|
|
133
|
+
}
|
|
134
|
+
this.onInput();
|
|
135
|
+
},
|
|
136
|
+
change(type, e) {
|
|
137
|
+
this.boxStyle[type] = e.target.value;
|
|
138
|
+
},
|
|
139
|
+
clear(type) {
|
|
140
|
+
this.position.forEach(v => {
|
|
141
|
+
this.boxStyle[type + v] = '';
|
|
142
|
+
})
|
|
143
|
+
this.onInput();
|
|
144
|
+
},
|
|
145
|
+
lock(type) {
|
|
146
|
+
const key = type + 'Lock';
|
|
147
|
+
this[key] = !this[key];
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
},
|
|
151
|
+
created() {
|
|
152
|
+
this.tidyValue();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<style>
|
|
159
|
+
|
|
160
|
+
._fd-box-space-input {
|
|
161
|
+
color: #000000;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
._fd-box-space-input ._padding, ._fd-box-space-input ._margin {
|
|
165
|
+
width: 100%;
|
|
166
|
+
height: 180px;
|
|
167
|
+
background-color: #F2CEA5;
|
|
168
|
+
padding: 40px 55px;
|
|
169
|
+
box-sizing: border-box;
|
|
170
|
+
position: relative;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
html.dark ._fd-box-space-input ._padding, ._fd-box-space-input ._margin {
|
|
174
|
+
background-color: #A9855C;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
._fd-box-space-input ._margin {
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 100px;
|
|
180
|
+
background-color: #C6CF92;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
._fd-box-space-input ._fd-input {
|
|
184
|
+
display: inline-block;
|
|
185
|
+
width: 30%;
|
|
186
|
+
max-width: 40px;
|
|
187
|
+
height: 20px;
|
|
188
|
+
border: 0 none;
|
|
189
|
+
padding: 0;
|
|
190
|
+
margin: 0;
|
|
191
|
+
outline: 0 none;
|
|
192
|
+
text-align: center;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
background-color: unset;
|
|
195
|
+
text-decoration: underline;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
._fd-box-space-input ._fd-input:hover, ._fd-box-space-input ._fd-input:focus {
|
|
199
|
+
background-color: #ECECEC;
|
|
200
|
+
opacity: 0.9;
|
|
201
|
+
color: #262626;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
._fd-box-space-input ._fd-left, ._fd-box-space-input ._fd-right {
|
|
205
|
+
position: absolute;
|
|
206
|
+
left: 7px;
|
|
207
|
+
top: 50%;
|
|
208
|
+
margin-top: -10px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
._fd-box-space-input ._fd-top, ._fd-box-space-input ._fd-bottom {
|
|
212
|
+
position: absolute;
|
|
213
|
+
left: 50%;
|
|
214
|
+
top: 5px;
|
|
215
|
+
margin-left: -20px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
._fd-box-space-input ._fd-bottom {
|
|
219
|
+
top: unset;
|
|
220
|
+
bottom: 15px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
._fd-box-space-input ._fd-right {
|
|
224
|
+
left: unset;
|
|
225
|
+
right: 2px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
._fd-box-space-input ._box {
|
|
229
|
+
width: 100%;
|
|
230
|
+
height: 100%;
|
|
231
|
+
background-color: #94B5C0;
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
justify-content: center;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
._fd-box-space-input ._padding-title, ._fd-box-space-input ._margin-title {
|
|
238
|
+
position: absolute;
|
|
239
|
+
top: 2px;
|
|
240
|
+
left: 4px;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
._fd-box-space-input ._fd-help {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
position: absolute;
|
|
247
|
+
right: 5px;
|
|
248
|
+
top: 5px;
|
|
249
|
+
color: #AAAAAA;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
._fd-box-space-input ._padding .fc-icon {
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
color: #262626;
|
|
255
|
+
font-size: 12px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
._fd-box-space-input ._padding .fc-icon + .fc-icon {
|
|
259
|
+
margin-left: 2px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
._fd-box-space-input .fc-icon.active {
|
|
263
|
+
color: #2E73FF;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
._fd-box-space-input ._fd-x {
|
|
267
|
+
margin: 0 5px;
|
|
268
|
+
}
|
|
269
|
+
</style>
|