@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,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-radius-input">
|
|
3
|
+
<ConfigItem :label="t('style.borderRadius')">
|
|
4
|
+
<SizeInput :unit="unit" v-model="style.com" @change="batch"/>
|
|
5
|
+
<template #append>
|
|
6
|
+
<div class="_fd-radius-con">
|
|
7
|
+
<div class="_fd-radius-item">
|
|
8
|
+
<div class="_fd-radius-icon" style="transform: rotate(180deg);">
|
|
9
|
+
<i class="fc-icon icon-radius"></i>
|
|
10
|
+
</div>
|
|
11
|
+
<SizeInput :unit="unit" v-model="style.left" @change="onInput"/>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="_fd-radius-item">
|
|
14
|
+
<div class="_fd-radius-icon" style="transform: rotate(-90deg);">
|
|
15
|
+
<i class="fc-icon icon-radius"></i>
|
|
16
|
+
</div>
|
|
17
|
+
<SizeInput :unit="unit" v-model="style.top" @change="onInput"/>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="_fd-radius-item">
|
|
20
|
+
<div class="_fd-radius-icon" style="transform: rotate(90deg);">
|
|
21
|
+
<i class="fc-icon icon-radius"></i>
|
|
22
|
+
</div>
|
|
23
|
+
<SizeInput :unit="unit" v-model="style.bottom" @change="onInput"/>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="_fd-radius-item">
|
|
26
|
+
<div class="_fd-radius-icon">
|
|
27
|
+
<i class="fc-icon icon-radius"></i>
|
|
28
|
+
</div>
|
|
29
|
+
<SizeInput :unit="unit" v-model="style.right" @change="onInput"/>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
</ConfigItem>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import {defineComponent} from 'vue';
|
|
39
|
+
import SizeInput from './SizeInput.vue';
|
|
40
|
+
import ColorInput from './ColorInput.vue';
|
|
41
|
+
import ConfigItem from './ConfigItem.vue';
|
|
42
|
+
|
|
43
|
+
export default defineComponent({
|
|
44
|
+
name: 'RadiusInput',
|
|
45
|
+
components: {ConfigItem, ColorInput, SizeInput},
|
|
46
|
+
inject: ['designer'],
|
|
47
|
+
emits: ['update:modelValue', 'change'],
|
|
48
|
+
props: {
|
|
49
|
+
modelValue: String
|
|
50
|
+
},
|
|
51
|
+
watch: {
|
|
52
|
+
modelValue(n) {
|
|
53
|
+
n !== this.oldValue && this.tidyValue();
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
t() {
|
|
58
|
+
return this.designer.setupState.t;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
visit: false,
|
|
64
|
+
active: '',
|
|
65
|
+
style: {
|
|
66
|
+
com: '',
|
|
67
|
+
left: '',
|
|
68
|
+
right: '',
|
|
69
|
+
top: '',
|
|
70
|
+
bottom: '',
|
|
71
|
+
},
|
|
72
|
+
unit: ['px', '%'],
|
|
73
|
+
oldValue: '',
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
batch() {
|
|
78
|
+
this.style.left = this.style.com;
|
|
79
|
+
this.style.right = this.style.com;
|
|
80
|
+
this.style.top = this.style.com;
|
|
81
|
+
this.style.bottom = this.style.com;
|
|
82
|
+
this.onInput();
|
|
83
|
+
},
|
|
84
|
+
tidyValue() {
|
|
85
|
+
this.style = {
|
|
86
|
+
com: '',
|
|
87
|
+
left: '',
|
|
88
|
+
right: '',
|
|
89
|
+
top: '',
|
|
90
|
+
bottom: '',
|
|
91
|
+
};
|
|
92
|
+
if (!this.modelValue) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let split = (this.modelValue || '').split(' ').filter(v => v !== '');
|
|
96
|
+
if (split.length === 1) {
|
|
97
|
+
split = [split[0], split[0], split[0], split[0]];
|
|
98
|
+
} else if (split.length === 2) {
|
|
99
|
+
split = [split[0], split[1], split[0], split[1]];
|
|
100
|
+
} else if (split.length === 3) {
|
|
101
|
+
split = [split[0], split[1], split[2], split[1]];
|
|
102
|
+
}
|
|
103
|
+
this.style.left = split[0];
|
|
104
|
+
this.style.top = split[1];
|
|
105
|
+
this.style.right = split[2];
|
|
106
|
+
this.style.bottom = split[3];
|
|
107
|
+
this.updateCom();
|
|
108
|
+
},
|
|
109
|
+
updateCom() {
|
|
110
|
+
let value = `${this.style.left || '0px'} ${this.style.top || '0px'} ${this.style.right || '0px'} ${this.style.bottom || '0px'}`;
|
|
111
|
+
this.style.com = value.replaceAll(this.style.left, '').trim() === '' ? this.style.left : '';
|
|
112
|
+
},
|
|
113
|
+
onInput() {
|
|
114
|
+
let value = `${this.style.left || '0px'} ${this.style.top || '0px'} ${this.style.right || '0px'} ${this.style.bottom || '0px'}`;
|
|
115
|
+
if ('' === `${this.style.left}${this.style.top}${this.style.right}${this.style.bottom}`.trim()) {
|
|
116
|
+
value = '';
|
|
117
|
+
} else {
|
|
118
|
+
this.updateCom();
|
|
119
|
+
}
|
|
120
|
+
this.oldValue = value;
|
|
121
|
+
this.$emit('update:modelValue', value);
|
|
122
|
+
this.$emit('change', value);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
created() {
|
|
126
|
+
this.tidyValue();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
});
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<style>
|
|
133
|
+
._fd-radius-input {
|
|
134
|
+
width: 100%;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
._fd-radius-con {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
._fd-radius-item {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
width: 50%;
|
|
149
|
+
padding: 5px 0;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
._fd-radius-item ._fd-radius-icon {
|
|
154
|
+
width: 24px;
|
|
155
|
+
height: 24px;
|
|
156
|
+
display: flex;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
align-items: center;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
._fd-radius-item ._fd-size-input .el-input-number--small {
|
|
162
|
+
width: 70px;
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-shadow-content">
|
|
3
|
+
<el-form label-width="50px" label-position="top" inline class="_fd-sc-form" size="small">
|
|
4
|
+
<el-form-item :label="t('style.shadow.mode')">
|
|
5
|
+
<el-radio-group v-model="form.type" @change="onInput" size="small" class="_fd-sc-radio">
|
|
6
|
+
<template v-for="item in options" :key="item.key">
|
|
7
|
+
<el-tooltip
|
|
8
|
+
effect="dark"
|
|
9
|
+
:content="t('style.shadow.' + item.key)"
|
|
10
|
+
placement="top"
|
|
11
|
+
:hide-after="0"
|
|
12
|
+
persistent
|
|
13
|
+
>
|
|
14
|
+
<el-radio-button :label="item.key" :value="item.key">
|
|
15
|
+
<i class="fc-icon" :class="'icon-' + item.icon"></i>
|
|
16
|
+
</el-radio-button>
|
|
17
|
+
</el-tooltip>
|
|
18
|
+
</template>
|
|
19
|
+
</el-radio-group>
|
|
20
|
+
</el-form-item>
|
|
21
|
+
<el-form-item :label="t('style.color')">
|
|
22
|
+
<ColorInput v-model="form.color" @change="onInput"></ColorInput>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
<el-form-item :label="t('style.shadow.x')">
|
|
25
|
+
<el-input v-model="form.x" type="number" @change="onInput">
|
|
26
|
+
<template #append>
|
|
27
|
+
<el-select v-model="form.x_unit" @change="onInput">
|
|
28
|
+
<el-option v-for="item in units" :key="item" :label="item" :value="item"/>
|
|
29
|
+
</el-select>
|
|
30
|
+
</template>
|
|
31
|
+
</el-input>
|
|
32
|
+
</el-form-item>
|
|
33
|
+
<el-form-item :label="t('style.shadow.y')">
|
|
34
|
+
<el-input v-model="form.y" type="number" @change="onInput">
|
|
35
|
+
<template #append>
|
|
36
|
+
<el-select v-model="form.y_unit" @change="onInput">
|
|
37
|
+
<el-option v-for="item in units" :key="item" :label="item" :value="item"/>
|
|
38
|
+
</el-select>
|
|
39
|
+
</template>
|
|
40
|
+
</el-input>
|
|
41
|
+
</el-form-item>
|
|
42
|
+
<el-form-item :label="t('style.shadow.vague')">
|
|
43
|
+
<el-input v-model="form.vague" type="number" @change="onInput">
|
|
44
|
+
<template #append>
|
|
45
|
+
<el-select v-model="form.vague_unit" @change="onInput">
|
|
46
|
+
<el-option v-for="item in units" :key="item" :label="item" :value="item"/>
|
|
47
|
+
</el-select>
|
|
48
|
+
</template>
|
|
49
|
+
</el-input>
|
|
50
|
+
</el-form-item>
|
|
51
|
+
<el-form-item :label="t('style.shadow.extend')">
|
|
52
|
+
<el-input v-model="form.extend" type="number" @change="onInput">
|
|
53
|
+
<template #append>
|
|
54
|
+
<el-select v-model="form.extend_unit" @change="onInput">
|
|
55
|
+
<el-option v-for="item in units" :key="item" :label="item" :value="item"/>
|
|
56
|
+
</el-select>
|
|
57
|
+
</template>
|
|
58
|
+
</el-input>
|
|
59
|
+
</el-form-item>
|
|
60
|
+
</el-form>
|
|
61
|
+
<div class="_fd-sc-right">
|
|
62
|
+
<div
|
|
63
|
+
ref="box"
|
|
64
|
+
class="_fd-sc-box"
|
|
65
|
+
:class="down ? 'down' : ''"
|
|
66
|
+
@click="getMouseXY($event, 1)"
|
|
67
|
+
@mousedown="onMousedown"
|
|
68
|
+
@mouseup="onMouseup"
|
|
69
|
+
@mousemove="getMouseXY($event, 0)"
|
|
70
|
+
>
|
|
71
|
+
<span class="spot" :style="spotStyle">
|
|
72
|
+
<i class="spot-id"/>
|
|
73
|
+
</span>
|
|
74
|
+
<span class="center-spot"/>
|
|
75
|
+
<div class="x-hr"/>
|
|
76
|
+
<div class="y-hr"/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<script>
|
|
84
|
+
import {defineComponent} from 'vue';
|
|
85
|
+
import ColorInput from './ColorInput.vue';
|
|
86
|
+
|
|
87
|
+
export default defineComponent({
|
|
88
|
+
name: 'ShadowContent',
|
|
89
|
+
components: {ColorInput},
|
|
90
|
+
inject: ['designer'],
|
|
91
|
+
emits: ['update:modelValue', 'change'],
|
|
92
|
+
props: {
|
|
93
|
+
modelValue: {
|
|
94
|
+
default: '0px 0px 0px rgba(0, 0, 0, 0)',
|
|
95
|
+
type: String,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
data() {
|
|
99
|
+
return {
|
|
100
|
+
max: 24,
|
|
101
|
+
boxSize: 250,
|
|
102
|
+
options: [
|
|
103
|
+
{key: 'external', icon: 'shadow'},
|
|
104
|
+
{key: 'inset', icon: 'shadow-inset'},
|
|
105
|
+
],
|
|
106
|
+
form: {
|
|
107
|
+
color: '',
|
|
108
|
+
type: 'external',
|
|
109
|
+
x: 0,
|
|
110
|
+
y: 0,
|
|
111
|
+
vague: 0,
|
|
112
|
+
extend: 0,
|
|
113
|
+
x_unit: 'px',
|
|
114
|
+
y_unit: 'px',
|
|
115
|
+
vague_unit: 'px',
|
|
116
|
+
extend_unit: 'px',
|
|
117
|
+
},
|
|
118
|
+
units: ['px', '%', 'rem', 'em', 'vw', 'vh'],
|
|
119
|
+
down: false,
|
|
120
|
+
position: {
|
|
121
|
+
left: 0,
|
|
122
|
+
top: 0,
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
computed: {
|
|
127
|
+
spotStyle() {
|
|
128
|
+
return {
|
|
129
|
+
left: this.position.left + 'px',
|
|
130
|
+
top: this.position.top + 'px',
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
t() {
|
|
134
|
+
return this.designer.setupState.t;
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
watch: {
|
|
138
|
+
position(n) {
|
|
139
|
+
this.form.x = parseInt(String(((n.left - this.boxSize / 2) / this.boxSize) * this.max));
|
|
140
|
+
this.form.y = parseInt(String(((n.top - this.boxSize / 2) / this.boxSize) * this.max));
|
|
141
|
+
const i = this.max / 2;
|
|
142
|
+
this.form.x = this.form.x < 0 ? Math.max(this.form.x, i * -1) : Math.min(this.form.x, i);
|
|
143
|
+
this.form.y = this.form.y < 0 ? Math.max(this.form.y, i * -1) : Math.min(this.form.y, i);
|
|
144
|
+
},
|
|
145
|
+
modelValue(n) {
|
|
146
|
+
this.initStyle(n);
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
getMouseXY(e, force) {
|
|
151
|
+
if (this.down || force) {
|
|
152
|
+
const _box = this.$refs.box.getBoundingClientRect()
|
|
153
|
+
this.position = {
|
|
154
|
+
left: parseInt(String(e.clientX - _box.x)),
|
|
155
|
+
top: parseInt(String(e.clientY - _box.y)),
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
onMouseup() {
|
|
160
|
+
this.down = false;
|
|
161
|
+
this.onInput();
|
|
162
|
+
},
|
|
163
|
+
onMousedown(e) {
|
|
164
|
+
this.getMouseXY(e, true);
|
|
165
|
+
this.down = true;
|
|
166
|
+
},
|
|
167
|
+
onInput() {
|
|
168
|
+
const n = this.form;
|
|
169
|
+
let value = `${n.x}${n.x_unit} ${n.y}${n.y_unit} ${n.vague}${n.vague_unit} ${n.extend}${n.extend_unit} ${n.color}`
|
|
170
|
+
if (`${n.x}${n.y}${n.vague}${n.extend}`.replaceAll('0', '') === '') {
|
|
171
|
+
value = '';
|
|
172
|
+
} else if (n.type === 'inset') {
|
|
173
|
+
value += ' inset'
|
|
174
|
+
}
|
|
175
|
+
this.$emit('update:modelValue', value);
|
|
176
|
+
this.$emit('change', value);
|
|
177
|
+
},
|
|
178
|
+
initStyle(modelValue) {
|
|
179
|
+
if ((this.modelValue || '').indexOf(' inset') > -1) {
|
|
180
|
+
this.form.type = 'inset'
|
|
181
|
+
modelValue = modelValue.replace(' inset', '')
|
|
182
|
+
}
|
|
183
|
+
const shadowData = modelValue.split('rgba')
|
|
184
|
+
let color, shadowValues;
|
|
185
|
+
|
|
186
|
+
if (shadowData.length > 1) {
|
|
187
|
+
// 将颜色值和其他阴影值进行分离
|
|
188
|
+
color = 'rgba' + shadowData[1].trim()
|
|
189
|
+
shadowValues = shadowData[0].trim().split(' ')
|
|
190
|
+
} else {
|
|
191
|
+
shadowValues = shadowData[0].trim().split(' ')
|
|
192
|
+
color = shadowValues.pop()
|
|
193
|
+
}
|
|
194
|
+
this.form.color = color || '#000'
|
|
195
|
+
this.form.x = parseInt(shadowValues[0]) || 0
|
|
196
|
+
this.form.y = parseInt(shadowValues[1]) || 0
|
|
197
|
+
this.form.vague = parseInt(shadowValues[2]) || 0
|
|
198
|
+
this.form.extend = parseInt(shadowValues[3]) || 0
|
|
199
|
+
|
|
200
|
+
const getUnit = (value) => {
|
|
201
|
+
return value?.replace(/[-\d.]/g, '') || 'px'
|
|
202
|
+
}
|
|
203
|
+
this.form.x_unit = getUnit(shadowValues[0])
|
|
204
|
+
this.form.y_unit = getUnit(shadowValues[1])
|
|
205
|
+
this.form.vague_unit = getUnit(shadowValues[2])
|
|
206
|
+
this.form.extend_unit = getUnit(shadowValues[3])
|
|
207
|
+
this.position.left = this.boxSize / 2 + (this.form.x / this.max) * this.boxSize || 0
|
|
208
|
+
this.position.top = this.boxSize / 2 + (this.form.y / this.max) * this.boxSize || 0
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
mounted() {
|
|
212
|
+
this.initStyle(this.modelValue);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
});
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<style>
|
|
219
|
+
._fd-shadow-content {
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
justify-content: space-between;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
padding: 0 5px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
._fd-sc-form .fc-icon {
|
|
228
|
+
font-size: 12px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
._fd-shadow-content .el-form {
|
|
232
|
+
display: grid;
|
|
233
|
+
grid-template-columns: repeat(2, 1fr);
|
|
234
|
+
width: 100%;
|
|
235
|
+
grid-column-gap: 10px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
._fd-shadow-content .el-form-item {
|
|
239
|
+
display: grid !important;
|
|
240
|
+
margin: 0 !important;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
._fd-shadow-content .el-input__wrapper {
|
|
244
|
+
flex: 1;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
._fd-shadow-content ._fd-sc-box {
|
|
248
|
+
width: 250px;
|
|
249
|
+
height: 250px;
|
|
250
|
+
border: 1px solid #ccc;
|
|
251
|
+
border-radius: 5px;
|
|
252
|
+
position: relative;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
overflow: hidden
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
._fd-shadow-content ._fd-sc-box .spot {
|
|
258
|
+
position: absolute;
|
|
259
|
+
width: 0;
|
|
260
|
+
height: 0;
|
|
261
|
+
border-radius: 100%
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
._fd-shadow-content ._fd-sc-box .spot-id {
|
|
265
|
+
position: absolute;
|
|
266
|
+
top: -5px;
|
|
267
|
+
left: -5px;
|
|
268
|
+
width: 10px;
|
|
269
|
+
height: 10px;
|
|
270
|
+
background: #1989fa;
|
|
271
|
+
border-radius: 100%;
|
|
272
|
+
z-index: 9
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
._fd-shadow-content ._fd-sc-box.down .spot-id {
|
|
276
|
+
box-shadow: 1px 1px 10px 2px #1989fa
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
._fd-shadow-content ._fd-sc-box .center-spot {
|
|
280
|
+
position: absolute;
|
|
281
|
+
width: 0;
|
|
282
|
+
height: 0;
|
|
283
|
+
top: 125px;
|
|
284
|
+
left: 125px;
|
|
285
|
+
border-radius: 100%;
|
|
286
|
+
background: #1989fa
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
._fd-shadow-content ._fd-sc-box .x-hr {
|
|
290
|
+
width: 100%;
|
|
291
|
+
position: absolute;
|
|
292
|
+
height: 1px;
|
|
293
|
+
top: 125px;
|
|
294
|
+
background: #ccc
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
._fd-shadow-content ._fd-sc-box .y-hr {
|
|
298
|
+
height: 100%;
|
|
299
|
+
position: absolute;
|
|
300
|
+
width: 1px;
|
|
301
|
+
left: 125px;
|
|
302
|
+
background: #ccc
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
._fd-shadow-content .el-select__placeholder {
|
|
306
|
+
text-align: center;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
._fd-shadow-content .el-input-group__append {
|
|
310
|
+
width: 55px;
|
|
311
|
+
padding: 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
._fd-shadow-content .el-input, ._fd-shadow-content ._fd-color-input {
|
|
315
|
+
width: 100%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
._fd-shadow-content ._fd-sc-right {
|
|
319
|
+
margin-top: 10px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
._fd-shadow-content ._fd-sc-radio {
|
|
323
|
+
width: 100%;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
._fd-shadow-content ._fd-sc-radio .el-radio-button {
|
|
327
|
+
display: flex;
|
|
328
|
+
flex: 1;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
._fd-shadow-content ._fd-sc-radio .el-radio-button__inner {
|
|
332
|
+
width: 100%;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-shadow-input">
|
|
3
|
+
<ConfigItem :label="t('style.shadow.name')">
|
|
4
|
+
<el-input clearable v-model="value" @change="changeValue(value)" @keydown.enter="changeValue(value)" class="_fd-si-input">
|
|
5
|
+
<template #append>
|
|
6
|
+
<el-dropdown>
|
|
7
|
+
<i class="fc-icon icon-setting"></i>
|
|
8
|
+
<template #dropdown>
|
|
9
|
+
<el-dropdown-menu>
|
|
10
|
+
<el-dropdown-item v-for="item in options" @click="changeValue(item.value)">
|
|
11
|
+
{{ item.label }}
|
|
12
|
+
</el-dropdown-item>
|
|
13
|
+
</el-dropdown-menu>
|
|
14
|
+
</template>
|
|
15
|
+
</el-dropdown>
|
|
16
|
+
</template>
|
|
17
|
+
</el-input>
|
|
18
|
+
<template #append>
|
|
19
|
+
<ShadowContent v-model="value" @change="changeValue(value)"></ShadowContent>
|
|
20
|
+
</template>
|
|
21
|
+
</ConfigItem>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import {defineComponent} from 'vue';
|
|
27
|
+
import ShadowContent from './ShadowContent.vue';
|
|
28
|
+
import ConfigItem from './ConfigItem.vue';
|
|
29
|
+
|
|
30
|
+
export default defineComponent({
|
|
31
|
+
name: 'ShadowInput',
|
|
32
|
+
emits: ['update:modelValue', 'change'],
|
|
33
|
+
components: {ConfigItem, ShadowContent},
|
|
34
|
+
inject: ['designer'],
|
|
35
|
+
props: {
|
|
36
|
+
modelValue: String,
|
|
37
|
+
},
|
|
38
|
+
watch: {
|
|
39
|
+
modelValue() {
|
|
40
|
+
this.value = this.modelValue || '';
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
const t = this.designer.setupState.t;
|
|
45
|
+
return {
|
|
46
|
+
t,
|
|
47
|
+
options: [
|
|
48
|
+
{label: t('style.shadow.classic'), value: '3px 5px 7px 2px #CBCBCBFF'},
|
|
49
|
+
{label: t('style.shadow.flat'), value: '4px 4px 3px -2px #E7E5E5FF'},
|
|
50
|
+
{label: t('style.shadow.solid'), value: '1px 2px 4px 2px #979797FF'}
|
|
51
|
+
],
|
|
52
|
+
value: this.modelValue || ''
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
changeValue(val) {
|
|
57
|
+
this.value = val;
|
|
58
|
+
this.$emit('update:modelValue', val);
|
|
59
|
+
this.$emit('change', val);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
created() {
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
._fd-shadow-input ._fd-ci-con {
|
|
70
|
+
width: 150px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
._fd-shadow-input :focus-visible {
|
|
74
|
+
outline: 0 none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
._fd-si-input .el-input-group__append {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
width: 24px;
|
|
80
|
+
padding: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
._fd-si-input .el-input__wrapper {
|
|
84
|
+
flex: 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
._fd-shadow-input ._fd-ci-con .fc-icon {
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-size-input">
|
|
3
|
+
<template v-if="unit[idx] === 'auto'">
|
|
4
|
+
<el-button :size="size" style="width: 150px;" @click="changeType()">{{ unit[idx] }}</el-button>
|
|
5
|
+
</template>
|
|
6
|
+
<template v-else>
|
|
7
|
+
<el-inputNumber :size="size" v-model="num" @change="submit" @keydown.enter="submit" controls-position="right"/>
|
|
8
|
+
<el-dropdown trigger="click" size="small">
|
|
9
|
+
<el-button :size="size">{{ unit[idx] }}</el-button>
|
|
10
|
+
<template #dropdown>
|
|
11
|
+
<el-dropdown-menu>
|
|
12
|
+
<el-dropdown-item v-for="(name, idx) in unit" :key="name" @click="changeType(idx)">
|
|
13
|
+
<div>{{ name }}</div>
|
|
14
|
+
</el-dropdown-item>
|
|
15
|
+
</el-dropdown-menu>
|
|
16
|
+
</template>
|
|
17
|
+
</el-dropdown>
|
|
18
|
+
</template>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import {defineComponent} from 'vue';
|
|
24
|
+
import {isNull} from '../../utils/index';
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: 'SizeInput',
|
|
28
|
+
inject: ['designer'],
|
|
29
|
+
emits: ['update:modelValue', 'change'],
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: String,
|
|
32
|
+
size: String,
|
|
33
|
+
unit: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default: () => ['auto', 'px', '%', 'vh', 'vw', 'em', 'rem']
|
|
36
|
+
},
|
|
37
|
+
defaultUnit: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'px'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
modelValue() {
|
|
44
|
+
this.parseValue();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
idx: 1,
|
|
50
|
+
num: 0,
|
|
51
|
+
oldValue: this.modelValue || '',
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
methods: {
|
|
55
|
+
parseValue() {
|
|
56
|
+
if (this.modelValue !== 'auto') {
|
|
57
|
+
this.idx = Math.max(this.unit.indexOf(this.defaultUnit), 0);
|
|
58
|
+
this.unit.forEach((v, i) => {
|
|
59
|
+
if ((this.modelValue || '').indexOf(v) > -1) {
|
|
60
|
+
this.idx = i;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
this.num = isNull(this.modelValue) ? null : parseFloat(this.modelValue || 0);
|
|
64
|
+
} else {
|
|
65
|
+
this.idx = 0;
|
|
66
|
+
this.num = 0;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
submit() {
|
|
70
|
+
this.oldValue = !isNull(this.num) ? '' + this.num + this.unit[this.idx] : '';
|
|
71
|
+
this.$emit('update:modelValue', this.oldValue);
|
|
72
|
+
this.$emit('change', this.oldValue);
|
|
73
|
+
},
|
|
74
|
+
changeType(idx) {
|
|
75
|
+
if (idx !== undefined) {
|
|
76
|
+
if (this.idx === idx) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.idx = idx;
|
|
80
|
+
} else {
|
|
81
|
+
this.idx++;
|
|
82
|
+
if (this.idx > 4) {
|
|
83
|
+
this.idx = 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (this.unit[this.idx] === 'auto') {
|
|
87
|
+
this.oldValue = 'auto';
|
|
88
|
+
this.$emit('update:modelValue', 'auto');
|
|
89
|
+
this.$emit('change', 'auto');
|
|
90
|
+
} else {
|
|
91
|
+
this.submit();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
created() {
|
|
96
|
+
this.parseValue();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style>
|
|
103
|
+
._fd-size-input {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
._fd-size-input .el-input-number--small {
|
|
109
|
+
width: 122px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
._fd-size-input .el-button {
|
|
113
|
+
font-size: 12px;
|
|
114
|
+
padding: 5px;
|
|
115
|
+
margin-left: 3px;
|
|
116
|
+
width: 25px;
|
|
117
|
+
}
|
|
118
|
+
</style>
|