eoss 0.1.0-alpha.20 → 0.1.0-alpha.21
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/lib/account-login.js +1943 -1890
- package/lib/alert.js +4 -4
- package/lib/aside.js +4 -4
- package/lib/autocomplete.js +4936 -4834
- package/lib/avatar.js +4 -4
- package/lib/backtop.js +4 -4
- package/lib/badge.js +4 -4
- package/lib/breadcrumb-item.js +6 -6
- package/lib/breadcrumb.js +7 -7
- package/lib/button-group.js +11 -14
- package/lib/button.js +6 -6
- package/lib/ca-login.js +2480 -2382
- package/lib/calendar.js +798 -798
- package/lib/card.js +4 -4
- package/lib/carousel-item.js +911 -813
- package/lib/carousel.js +1646 -1548
- package/lib/cascader-panel.js +2556 -2458
- package/lib/cascader.js +4546 -4444
- package/lib/checkbox-button.js +4 -4
- package/lib/checkbox-group.js +2894 -2841
- package/lib/checkbox.js +4 -4
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +35159 -2572
- package/lib/collapse.js +35410 -2762
- package/lib/color-picker.js +494 -490
- package/lib/config/api.js +15 -1
- package/lib/container.js +4 -4
- package/lib/cron.js +4 -4
- package/lib/data-table.js +1895 -1842
- package/lib/date-picker.js +6422 -6320
- package/lib/dialog.js +2912 -2806
- package/lib/divider.js +4 -4
- package/lib/drawer.js +311 -299
- package/lib/dropdown-item.js +6 -6
- package/lib/dropdown-menu.js +539 -535
- package/lib/dropdown.js +2270 -2172
- package/lib/email-login.js +1783 -1730
- package/lib/empty.js +723 -0
- package/lib/eoss.common.js +63680 -56193
- package/lib/flip.js +4 -4
- package/lib/flow-group.js +2985 -2887
- package/lib/flow.js +28067 -28022
- package/lib/footer.js +4 -4
- package/lib/form-item.js +1935 -1837
- package/lib/form.js +9230 -9092
- package/lib/header.js +4 -4
- package/lib/icon.js +1708 -1590
- package/lib/icons.js +4 -4
- package/lib/image-viewer.js +1660 -1562
- package/lib/image.js +162 -162
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +76 -76
- package/lib/input-number.js +172 -172
- package/lib/input.js +1362 -1264
- package/lib/link.js +4 -4
- package/lib/loading.js +321 -317
- package/lib/login.js +3306 -3300
- package/lib/lowcode.js +13320 -0
- package/lib/main.js +14465 -14339
- package/lib/marquee.js +1237 -1139
- package/lib/menu-item-group.js +119 -119
- package/lib/menu-item.js +114 -114
- package/lib/menu.js +6193 -6091
- package/lib/message-box.js +3582 -3480
- package/lib/message.js +2265 -2163
- package/lib/notification.js +2430 -2328
- package/lib/option-group.js +4 -4
- package/lib/option.js +842 -744
- package/lib/page-header.js +4 -4
- package/lib/pagination.js +1916 -1815
- package/lib/phone-login.js +1788 -1735
- package/lib/popconfirm.js +8 -8
- package/lib/popover.js +4559 -4457
- package/lib/progress.js +4 -4
- package/lib/qr-code.js +9 -9
- package/lib/qrcode-login.js +1600 -1543
- package/lib/radio-button.js +6 -6
- package/lib/radio-group.js +2142 -2089
- package/lib/radio.js +6 -6
- package/lib/rate.js +1226 -1128
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +2695 -2597
- package/lib/select.js +5985 -5961
- package/lib/selector-panel.js +5239 -5186
- package/lib/selector.js +1712 -1659
- package/lib/slider.js +16 -16
- package/lib/step.js +35836 -2736
- package/lib/steps.js +1281 -1183
- package/lib/submenu.js +461 -457
- package/lib/switch.js +1010 -912
- package/lib/tab-pane.js +4 -4
- package/lib/table-column.js +2595 -2497
- package/lib/table.js +9225 -9239
- package/lib/tabs.js +2414 -2320
- package/lib/tag.js +4 -4
- package/lib/theme-chalk/account-login.css +1 -1
- package/lib/theme-chalk/autocomplete.css +1 -1
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/cascader.css +1 -1
- package/lib/theme-chalk/date-picker.css +1 -1
- package/lib/theme-chalk/empty.css +1 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/form.css +1 -1
- package/lib/theme-chalk/icon.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/input-number.css +1 -1
- package/lib/theme-chalk/input.css +1 -1
- package/lib/theme-chalk/login.css +1 -1
- package/lib/theme-chalk/lowcode.css +1 -0
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/message-box.css +1 -1
- package/lib/theme-chalk/pagination.css +1 -1
- package/lib/theme-chalk/qrcode-login.css +1 -1
- package/lib/theme-chalk/select.css +1 -1
- package/lib/theme-chalk/slider.css +1 -1
- package/lib/theme-chalk/tabs.css +1 -1
- package/lib/theme-chalk/time-picker.css +1 -1
- package/lib/theme-chalk/transfer.css +1 -1
- package/lib/time-picker.js +5823 -5819
- package/lib/time-select.js +3578 -3574
- package/lib/timeline-item.js +4 -4
- package/lib/timeline.js +4 -4
- package/lib/tips.js +1633 -1580
- package/lib/toolbar.js +213 -213
- package/lib/tooltip.js +4441 -4339
- package/lib/transfer.js +938 -840
- package/lib/tree-group.js +1875 -1757
- package/lib/tree.js +2626 -2573
- package/lib/upload.js +7209 -7156
- package/lib/utils/ajax.js +185 -243
- package/lib/utils/bus.js +2 -2
- package/lib/utils/popup/index.js +5 -1
- package/lib/utils/util.js +108 -11
- package/package.json +2 -2
- package/packages/button/src/button-group.vue +1 -4
- package/packages/collapse/src/collapse-item.vue +47 -33
- package/packages/dialog/src/dialog.vue +4 -1
- package/packages/drawer/src/drawer.vue +12 -4
- package/packages/empty/index.js +7 -0
- package/packages/empty/src/img-empty.vue +132 -0
- package/packages/empty/src/index.vue +49 -0
- package/packages/form/src/form-item-render.vue +16 -18
- package/packages/form/src/form.vue +27 -5
- package/packages/icons/src/icon.json +1 -1
- package/packages/login/src/login.vue +19 -21
- package/packages/login/src/mixins.js +2 -1
- package/packages/lowcode/index.js +5 -0
- package/packages/lowcode/src/aside.vue +331 -0
- package/packages/lowcode/src/attribute/bind.vue +441 -0
- package/packages/lowcode/src/attribute/dependency.vue +325 -0
- package/packages/lowcode/src/attribute/function.vue +112 -0
- package/packages/lowcode/src/attribute/property.vue +331 -0
- package/packages/lowcode/src/attribute/styles.vue +318 -0
- package/packages/lowcode/src/attribute.vue +135 -0
- package/packages/lowcode/src/canvas.vue +296 -0
- package/packages/lowcode/src/json.vue +32 -0
- package/packages/lowcode/src/lowcode.vue +539 -0
- package/packages/lowcode/src/modules.vue +93 -0
- package/packages/lowcode/src/pages.vue +91 -0
- package/packages/lowcode/src/render.vue +247 -0
- package/packages/lowcode/src/source.vue +32 -0
- package/packages/lowcode/src/toolbar.vue +162 -0
- package/packages/main/src/components/pages.vue +28 -2
- package/packages/main/src/components/set-menus.vue +3 -3
- package/packages/main/src/components/user.vue +6 -1
- package/packages/main/src/early.vue +2 -2
- package/packages/main/src/gzw.vue +55 -61
- package/packages/main/src/minxs.js +113 -36
- package/packages/pagination/src/pager.vue +2 -2
- package/packages/pagination/src/pagination.js +4 -1
- package/packages/qrcode-login/src/qrcode-login.vue +6 -2
- package/packages/select/src/select.vue +28 -6
- package/packages/steps/src/step.vue +7 -5
- package/packages/tabs/src/tab-nav.vue +1 -0
- package/packages/tabs/src/tabs.vue +0 -2
- package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/gulpfile.js +3 -0
- package/packages/theme-chalk/src/account-login.scss +1 -0
- package/packages/theme-chalk/src/base.scss +1 -1
- package/packages/theme-chalk/src/common/var.scss +16 -0
- package/packages/theme-chalk/src/empty.scss +45 -0
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/form.scss +1 -8
- package/packages/theme-chalk/src/icon.scss +30 -1
- package/packages/theme-chalk/src/index.scss +2 -0
- package/packages/theme-chalk/src/input-number.scss +0 -4
- package/packages/theme-chalk/src/input.scss +9 -0
- package/packages/theme-chalk/src/login.scss +32 -29
- package/packages/theme-chalk/src/lowcode.scss +461 -0
- package/packages/theme-chalk/src/main.scss +28 -65
- package/packages/theme-chalk/src/pagination.scss +4 -55
- package/packages/theme-chalk/src/qrcode-login.scss +3 -1
- package/packages/theme-chalk/src/tabs.scss +81 -50
- package/src/config/api.js +13 -0
- package/src/index.js +17 -4
- package/src/utils/ajax.js +61 -65
- package/src/utils/bus.js +2 -2
- package/src/utils/popup/index.js +5 -1
- package/src/utils/util.js +104 -7
- package/lib/index_/345/211/257/346/234/254.js +0 -583
- package/packages/dialog copy/index.js +0 -8
- package/packages/dialog copy/src/dialog.vue +0 -615
- package/src/index_/345/211/257/346/234/254.js +0 -359
- /package/{packages/form/src → src/components}/field-render.vue +0 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<es-scrollbar class="es-lowcode__bind">
|
|
3
|
+
<es-form label-width="auto" size="small" :model="models">
|
|
4
|
+
<es-collapse v-model="active">
|
|
5
|
+
<es-collapse-item name="attribute">
|
|
6
|
+
<template slot="title">
|
|
7
|
+
<span>属性</span>
|
|
8
|
+
<es-button
|
|
9
|
+
size="small"
|
|
10
|
+
type="text"
|
|
11
|
+
@click.stop="handleAdd('attributes')"
|
|
12
|
+
icon="es-icon-jia"
|
|
13
|
+
></es-button>
|
|
14
|
+
</template>
|
|
15
|
+
<div v-if="!isAttributesEmpty">
|
|
16
|
+
<es-form-item
|
|
17
|
+
v-for="item in attributes"
|
|
18
|
+
:label="item.label"
|
|
19
|
+
:key="item.name"
|
|
20
|
+
>
|
|
21
|
+
<es-input v-model="attributeValues[item.name]" clearable @change="handleChange('attrs')">
|
|
22
|
+
<i
|
|
23
|
+
v-if="item.custom"
|
|
24
|
+
slot="append"
|
|
25
|
+
class="es-icon-shanchu"
|
|
26
|
+
@click.stop="handleDelete('attributes', item.name)"
|
|
27
|
+
></i>
|
|
28
|
+
</es-input>
|
|
29
|
+
</es-form-item>
|
|
30
|
+
</div>
|
|
31
|
+
<es-empty v-else :image-size="60" description="暂无属性"></es-empty>
|
|
32
|
+
</es-collapse-item>
|
|
33
|
+
<es-collapse-item name="directive">
|
|
34
|
+
<template slot="title">
|
|
35
|
+
<span>指令</span>
|
|
36
|
+
<es-button
|
|
37
|
+
size="small"
|
|
38
|
+
type="text"
|
|
39
|
+
@click.stop="handleAdd('directives')"
|
|
40
|
+
icon="es-icon-jia"
|
|
41
|
+
></es-button>
|
|
42
|
+
</template>
|
|
43
|
+
<div v-if="!isDirectivesEmpty">
|
|
44
|
+
<es-form-item
|
|
45
|
+
v-for="item in directives"
|
|
46
|
+
:label="item.label"
|
|
47
|
+
:key="item.name"
|
|
48
|
+
>
|
|
49
|
+
<es-input v-model="directiveValues[item.name]" clearable @change="handleChange('directives')">
|
|
50
|
+
<i
|
|
51
|
+
v-if="item.custom"
|
|
52
|
+
slot="append"
|
|
53
|
+
class="es-icon-shanchu"
|
|
54
|
+
@click.stop="handleDelete('directives', item.name)"
|
|
55
|
+
></i>
|
|
56
|
+
</es-input>
|
|
57
|
+
</es-form-item>
|
|
58
|
+
</div>
|
|
59
|
+
<es-empty v-else :image-size="60" description="暂无指令"></es-empty>
|
|
60
|
+
</es-collapse-item>
|
|
61
|
+
<es-collapse-item name="event">
|
|
62
|
+
<template slot="title">
|
|
63
|
+
<span>事件</span>
|
|
64
|
+
<es-button
|
|
65
|
+
size="small"
|
|
66
|
+
type="text"
|
|
67
|
+
@click.stop="handleAdd('events')"
|
|
68
|
+
icon="es-icon-jia"
|
|
69
|
+
></es-button>
|
|
70
|
+
</template>
|
|
71
|
+
<div v-if="!isEventsEmpty">
|
|
72
|
+
<es-form-item
|
|
73
|
+
v-for="item in events"
|
|
74
|
+
:label="item.label"
|
|
75
|
+
:key="item.name"
|
|
76
|
+
>
|
|
77
|
+
<es-input v-model="eventValues[item.name]" clearable @change="handleChange('events')">
|
|
78
|
+
<i
|
|
79
|
+
v-if="item.custom"
|
|
80
|
+
slot="append"
|
|
81
|
+
class="es-icon-shanchu"
|
|
82
|
+
@click.stop="handleDelete('events', item.name)"
|
|
83
|
+
></i>
|
|
84
|
+
</es-input>
|
|
85
|
+
</es-form-item>
|
|
86
|
+
</div>
|
|
87
|
+
<es-empty v-else :image-size="60" description="暂无事件"></es-empty>
|
|
88
|
+
</es-collapse-item>
|
|
89
|
+
</es-collapse>
|
|
90
|
+
</es-form>
|
|
91
|
+
<es-dialog
|
|
92
|
+
:title="dialogTitle"
|
|
93
|
+
:visible.sync="visible"
|
|
94
|
+
:showScale="false"
|
|
95
|
+
width="400px"
|
|
96
|
+
height="200px"
|
|
97
|
+
@close="handleClose"
|
|
98
|
+
>
|
|
99
|
+
<es-form :model="value" label-width="80px" size="small" ref="keyRef">
|
|
100
|
+
<es-form-item label="属性名" :rules="rules" prop="key">
|
|
101
|
+
<es-input v-model="value.key"></es-input>
|
|
102
|
+
</es-form-item>
|
|
103
|
+
<es-form-item label="属性值" prop="value">
|
|
104
|
+
<es-input v-model="value.value"></es-input>
|
|
105
|
+
</es-form-item>
|
|
106
|
+
<div class="es-lowcode__property--dialog-footer">
|
|
107
|
+
<es-button size="small" @click="visible = false">取消</es-button>
|
|
108
|
+
<es-button size="small" @click="handleSubmit" type="primary"
|
|
109
|
+
>确定</es-button
|
|
110
|
+
>
|
|
111
|
+
</div>
|
|
112
|
+
</es-form>
|
|
113
|
+
</es-dialog>
|
|
114
|
+
</es-scrollbar>
|
|
115
|
+
</template>
|
|
116
|
+
<script>
|
|
117
|
+
export default {
|
|
118
|
+
name: 'Bind',
|
|
119
|
+
|
|
120
|
+
components: {},
|
|
121
|
+
|
|
122
|
+
props: {
|
|
123
|
+
model: {
|
|
124
|
+
type: Object,
|
|
125
|
+
default: () => ({})
|
|
126
|
+
},
|
|
127
|
+
attribute: {
|
|
128
|
+
type: Array,
|
|
129
|
+
default: () => [
|
|
130
|
+
{
|
|
131
|
+
name: 'id',
|
|
132
|
+
label: 'id',
|
|
133
|
+
type: 'text',
|
|
134
|
+
clearable: true
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'ref',
|
|
138
|
+
label: 'ref',
|
|
139
|
+
type: 'text',
|
|
140
|
+
clearable: true
|
|
141
|
+
},
|
|
142
|
+
// {
|
|
143
|
+
// name: 'key',
|
|
144
|
+
// label: 'key',
|
|
145
|
+
// type: 'text',
|
|
146
|
+
// clearable: true
|
|
147
|
+
// },
|
|
148
|
+
{
|
|
149
|
+
name: 'slot',
|
|
150
|
+
label: 'slot',
|
|
151
|
+
type: 'text',
|
|
152
|
+
clearable: true
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'class',
|
|
156
|
+
label: 'class',
|
|
157
|
+
type: 'text',
|
|
158
|
+
clearable: true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'style',
|
|
162
|
+
label: 'style',
|
|
163
|
+
type: 'text',
|
|
164
|
+
clearable: true
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
directive: {
|
|
169
|
+
type: Array,
|
|
170
|
+
default: () => [
|
|
171
|
+
{
|
|
172
|
+
name: 'v-model',
|
|
173
|
+
label: 'v-model',
|
|
174
|
+
type: 'text',
|
|
175
|
+
clearable: true
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'v-show',
|
|
179
|
+
label: 'v-show',
|
|
180
|
+
type: 'text',
|
|
181
|
+
clearable: true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'v-text',
|
|
185
|
+
label: 'v-text',
|
|
186
|
+
type: 'text',
|
|
187
|
+
clearable: true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'v-for',
|
|
191
|
+
label: 'v-for',
|
|
192
|
+
type: 'text',
|
|
193
|
+
clearable: true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'v-if',
|
|
197
|
+
label: 'v-if',
|
|
198
|
+
type: 'text',
|
|
199
|
+
clearable: true
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
event: {
|
|
204
|
+
type: Array,
|
|
205
|
+
default: () => [
|
|
206
|
+
{
|
|
207
|
+
name: 'change',
|
|
208
|
+
label: 'change',
|
|
209
|
+
type: 'text',
|
|
210
|
+
clearable: true
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'click',
|
|
214
|
+
label: 'click',
|
|
215
|
+
type: 'text',
|
|
216
|
+
clearable: true
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
data() {
|
|
223
|
+
return {
|
|
224
|
+
/**
|
|
225
|
+
* 属性
|
|
226
|
+
*/
|
|
227
|
+
attributes: this.attribute,
|
|
228
|
+
/**
|
|
229
|
+
* 指令
|
|
230
|
+
*/
|
|
231
|
+
directives: this.directive,
|
|
232
|
+
/**
|
|
233
|
+
* 事件
|
|
234
|
+
*/
|
|
235
|
+
events: this.event,
|
|
236
|
+
/**
|
|
237
|
+
* 属性值
|
|
238
|
+
*/
|
|
239
|
+
attributeValues: {},
|
|
240
|
+
/**
|
|
241
|
+
* 指令值
|
|
242
|
+
*/
|
|
243
|
+
directiveValues: {},
|
|
244
|
+
/**
|
|
245
|
+
* 事件值
|
|
246
|
+
*/
|
|
247
|
+
eventValues: {},
|
|
248
|
+
/**
|
|
249
|
+
* 活动项
|
|
250
|
+
*/
|
|
251
|
+
active: ['attribute', 'directive', 'event'],
|
|
252
|
+
visible: false,
|
|
253
|
+
/**
|
|
254
|
+
* 新增属性值
|
|
255
|
+
*/
|
|
256
|
+
value: {
|
|
257
|
+
key: '',
|
|
258
|
+
value: ''
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* 新增属性值规则
|
|
262
|
+
*/
|
|
263
|
+
rules: { required: true, message: '请输入属性名', trigger: 'blur' },
|
|
264
|
+
/**
|
|
265
|
+
* 新增属性值类型
|
|
266
|
+
*/
|
|
267
|
+
type: ''
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
computed: {
|
|
272
|
+
/**
|
|
273
|
+
* 模型数据
|
|
274
|
+
*/
|
|
275
|
+
models() {
|
|
276
|
+
return {
|
|
277
|
+
...this.attributeValues,
|
|
278
|
+
...this.directiveValues,
|
|
279
|
+
...this.eventValues
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* 对话框标题
|
|
284
|
+
*/
|
|
285
|
+
dialogTitle() {
|
|
286
|
+
const titleMap = {
|
|
287
|
+
attributes: '添加自定义属性',
|
|
288
|
+
directives: '添加自定义指令',
|
|
289
|
+
events: '添加自定义事件'
|
|
290
|
+
};
|
|
291
|
+
return titleMap[this.type] || '添加';
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* 属性是否为空
|
|
295
|
+
*/
|
|
296
|
+
isAttributesEmpty() {
|
|
297
|
+
return this.attributes.length === 0;
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* 指令是否为空
|
|
301
|
+
*/
|
|
302
|
+
isDirectivesEmpty() {
|
|
303
|
+
return this.directives.length === 0;
|
|
304
|
+
},
|
|
305
|
+
/**
|
|
306
|
+
* 事件是否为空
|
|
307
|
+
*/
|
|
308
|
+
isEventsEmpty() {
|
|
309
|
+
return this.events.length === 0;
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
watch: {
|
|
314
|
+
/**
|
|
315
|
+
* 监听 model prop 变化(仅用于切换组件时的初始化同步)
|
|
316
|
+
*/
|
|
317
|
+
model: {
|
|
318
|
+
handler(val) {
|
|
319
|
+
this.attributeValues = val.attrs || {};
|
|
320
|
+
this.directiveValues = val.directives || {};
|
|
321
|
+
this.eventValues = val.events || {};
|
|
322
|
+
},
|
|
323
|
+
immediate: true
|
|
324
|
+
},
|
|
325
|
+
attribute: {
|
|
326
|
+
handler(val) {
|
|
327
|
+
this.attributes = val;
|
|
328
|
+
},
|
|
329
|
+
deep: true
|
|
330
|
+
},
|
|
331
|
+
directive: {
|
|
332
|
+
handler(val) {
|
|
333
|
+
this.directives = val;
|
|
334
|
+
},
|
|
335
|
+
deep: true
|
|
336
|
+
},
|
|
337
|
+
event: {
|
|
338
|
+
handler(val) {
|
|
339
|
+
this.events = val;
|
|
340
|
+
},
|
|
341
|
+
deep: true
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
created() {},
|
|
346
|
+
|
|
347
|
+
mounted() {},
|
|
348
|
+
|
|
349
|
+
methods: {
|
|
350
|
+
/**
|
|
351
|
+
* 处理输入框内容变更,根据分类通过 change 事件通知父组件
|
|
352
|
+
* @param {String} category - 变更字段所属分类(attrs/directives/events)
|
|
353
|
+
*/
|
|
354
|
+
handleChange(category) {
|
|
355
|
+
const emitMap = {
|
|
356
|
+
attrs: 'attributeValues',
|
|
357
|
+
directives: 'directiveValues',
|
|
358
|
+
events: 'eventValues'
|
|
359
|
+
};
|
|
360
|
+
const dataKey = emitMap[category];
|
|
361
|
+
if (dataKey) {
|
|
362
|
+
this.$emit('change', { [category]: { ...this[dataKey] } });
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* 处理添加事件
|
|
367
|
+
*/
|
|
368
|
+
handleAdd(type) {
|
|
369
|
+
this.type = type;
|
|
370
|
+
this.value = { key: '', value: '' };
|
|
371
|
+
this.visible = true;
|
|
372
|
+
},
|
|
373
|
+
/**
|
|
374
|
+
* 处理关闭对话框
|
|
375
|
+
*/
|
|
376
|
+
handleClose() {
|
|
377
|
+
this.$refs.keyRef.resetFields();
|
|
378
|
+
this.value.key = '';
|
|
379
|
+
this.value.value = '';
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* 处理删除自定义字段
|
|
383
|
+
*/
|
|
384
|
+
handleDelete(type, name) {
|
|
385
|
+
this.$confirm('确认删除该字段?', '提示', {
|
|
386
|
+
confirmButtonText: '确定',
|
|
387
|
+
cancelButtonText: '取消',
|
|
388
|
+
type: 'warning'
|
|
389
|
+
})
|
|
390
|
+
.then(() => {
|
|
391
|
+
// 删除字段定义
|
|
392
|
+
const index = this[type].findIndex((item) => item.name === name);
|
|
393
|
+
if (index > -1) {
|
|
394
|
+
this[type].splice(index, 1);
|
|
395
|
+
}
|
|
396
|
+
// 删除对应的值
|
|
397
|
+
const targetKey =
|
|
398
|
+
type === 'attributes'
|
|
399
|
+
? 'attributeValues'
|
|
400
|
+
: type === 'directives'
|
|
401
|
+
? 'directiveValues'
|
|
402
|
+
: 'eventValues';
|
|
403
|
+
this.$delete(this[targetKey], name);
|
|
404
|
+
})
|
|
405
|
+
.catch(() => {});
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* 处理提交事件
|
|
409
|
+
*/
|
|
410
|
+
handleSubmit() {
|
|
411
|
+
this.$refs.keyRef.validate((valid) => {
|
|
412
|
+
if (valid) {
|
|
413
|
+
const { key, value } = this.value;
|
|
414
|
+
// 添加字段定义
|
|
415
|
+
this[this.type].push({
|
|
416
|
+
name: key,
|
|
417
|
+
label: key,
|
|
418
|
+
type: 'text',
|
|
419
|
+
custom: true
|
|
420
|
+
});
|
|
421
|
+
// 根据类型存储到对应的值对象
|
|
422
|
+
const targetKey =
|
|
423
|
+
this.type === 'attributes'
|
|
424
|
+
? 'attributeValues'
|
|
425
|
+
: this.type === 'directives'
|
|
426
|
+
? 'directiveValues'
|
|
427
|
+
: 'eventValues';
|
|
428
|
+
this.$set(this[targetKey], key, value);
|
|
429
|
+
// 触发值变化事件
|
|
430
|
+
this.$emit('change', {
|
|
431
|
+
type: this.type.replace('s', ''),
|
|
432
|
+
name: key,
|
|
433
|
+
value: value
|
|
434
|
+
});
|
|
435
|
+
this.visible = false;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
</script>
|