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
|
@@ -1,615 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition
|
|
3
|
-
name="dialog-fade"
|
|
4
|
-
@after-enter="afterEnter"
|
|
5
|
-
@after-leave="afterLeave"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
v-show="visible"
|
|
9
|
-
class="es-dialog__wrapper"
|
|
10
|
-
@click.self="handleWrapperClick"
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
role="dialog"
|
|
14
|
-
:key="key"
|
|
15
|
-
:id="id"
|
|
16
|
-
aria-modal="true"
|
|
17
|
-
:aria-label="title || 'dialog'"
|
|
18
|
-
:class="[
|
|
19
|
-
'es-dialog',
|
|
20
|
-
{ 'is-fullscreen': isFull, 'es-dialog--center': center },
|
|
21
|
-
customClass
|
|
22
|
-
]"
|
|
23
|
-
ref="dialog"
|
|
24
|
-
:style="styles"
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
class="es-dialog__header"
|
|
28
|
-
:class="{ 'es-dialog__drag': drag }"
|
|
29
|
-
ref="header"
|
|
30
|
-
>
|
|
31
|
-
<slot name="title">
|
|
32
|
-
<div class="es-dialog__title">{{ title }}</div>
|
|
33
|
-
</slot>
|
|
34
|
-
<div class="es-dialog__headerbtn">
|
|
35
|
-
<button
|
|
36
|
-
class="es-dialog__header-btn"
|
|
37
|
-
type="button"
|
|
38
|
-
aria-label="Scale"
|
|
39
|
-
v-if="
|
|
40
|
-
showScale && this.width !== '100%' && this.height !== '100%'
|
|
41
|
-
"
|
|
42
|
-
@click.stop="handleScale"
|
|
43
|
-
>
|
|
44
|
-
<i
|
|
45
|
-
class="es-dialog__icon es-icon"
|
|
46
|
-
:class="{
|
|
47
|
-
'es-icon-quanping': !isFull,
|
|
48
|
-
'es-icon-suofang': isFull
|
|
49
|
-
}"
|
|
50
|
-
></i>
|
|
51
|
-
</button>
|
|
52
|
-
<button
|
|
53
|
-
class="es-dialog__header-btn"
|
|
54
|
-
type="button"
|
|
55
|
-
aria-label="Close"
|
|
56
|
-
v-if="showClose"
|
|
57
|
-
@click.stop="handleClose"
|
|
58
|
-
>
|
|
59
|
-
<i class="es-dialog__icon es-icon es-icon-guanbi"></i>
|
|
60
|
-
</button>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
<div
|
|
64
|
-
class="es-dialog__body"
|
|
65
|
-
v-if="rendered"
|
|
66
|
-
ref="body"
|
|
67
|
-
:style="bodyStyle"
|
|
68
|
-
>
|
|
69
|
-
<slot></slot>
|
|
70
|
-
</div>
|
|
71
|
-
<div class="es-dialog__footer" v-if="$slots.footer">
|
|
72
|
-
<slot name="footer"></slot>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</transition>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script>
|
|
80
|
-
/**
|
|
81
|
-
* Dialog 对话框组件
|
|
82
|
-
* 功能说明:在保留当前页面状态的情况下,告知用户并承载相关操作
|
|
83
|
-
* 适用场景:需要用户确认、输入信息或展示详细内容的场景
|
|
84
|
-
*/
|
|
85
|
-
import Popup from 'eoss/src/utils/popup';
|
|
86
|
-
import { getWinTop } from 'eoss/src/utils/util';
|
|
87
|
-
import Migrating from 'eoss/src/mixins/migrating';
|
|
88
|
-
import emitter from 'eoss/src/mixins/emitter';
|
|
89
|
-
import { debounce } from 'throttle-debounce';
|
|
90
|
-
// 初始化为默认值,将在组件挂载时动态计算
|
|
91
|
-
let availWidth = 900;
|
|
92
|
-
let availHeight = 600;
|
|
93
|
-
export default {
|
|
94
|
-
name: 'EsDialog',
|
|
95
|
-
|
|
96
|
-
mixins: [Popup, emitter, Migrating],
|
|
97
|
-
|
|
98
|
-
props: {
|
|
99
|
-
/**
|
|
100
|
-
* 对话框的唯一标识
|
|
101
|
-
*/
|
|
102
|
-
id: String,
|
|
103
|
-
/**
|
|
104
|
-
* 对话框的标题
|
|
105
|
-
*/
|
|
106
|
-
title: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: ''
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* 是否需要遮罩层
|
|
113
|
-
*/
|
|
114
|
-
modal: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: true
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* 遮罩层是否插入至 body 元素上
|
|
121
|
-
*/
|
|
122
|
-
modalAppendToBody: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
default() {
|
|
125
|
-
return this.appendToBody;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 对话框自身是否插入至 body 元素上
|
|
131
|
-
*/
|
|
132
|
-
appendToBody: {
|
|
133
|
-
type: Boolean,
|
|
134
|
-
default: false
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 是否在对话框出现时将 body 滚动锁定
|
|
139
|
-
*/
|
|
140
|
-
lockScroll: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
default: true
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 是否可以通过点击遮罩层关闭对话框
|
|
147
|
-
*/
|
|
148
|
-
closeOnClickModal: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
default: true
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* 是否可以通过按下 ESC 关闭对话框
|
|
155
|
-
*/
|
|
156
|
-
closeOnPressEscape: {
|
|
157
|
-
type: Boolean,
|
|
158
|
-
default: true
|
|
159
|
-
},
|
|
160
|
-
/**
|
|
161
|
-
* 是否显示全屏切换按钮
|
|
162
|
-
*/
|
|
163
|
-
showScale: {
|
|
164
|
-
type: Boolean,
|
|
165
|
-
default: true
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* 是否显示关闭按钮
|
|
169
|
-
*/
|
|
170
|
-
showClose: {
|
|
171
|
-
type: Boolean,
|
|
172
|
-
default: true
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* 对话框的宽度
|
|
177
|
-
*/
|
|
178
|
-
width: [String, Number],
|
|
179
|
-
/**
|
|
180
|
-
* 对话框的高度
|
|
181
|
-
*/
|
|
182
|
-
height: [String, Number],
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* 对话框的自定义类名
|
|
186
|
-
*/
|
|
187
|
-
customClass: {
|
|
188
|
-
type: String,
|
|
189
|
-
default: ''
|
|
190
|
-
},
|
|
191
|
-
/**
|
|
192
|
-
* 关闭前的回调函数
|
|
193
|
-
*/
|
|
194
|
-
beforeClose: Function,
|
|
195
|
-
/**
|
|
196
|
-
* 是否对头部和底部采用居中布局
|
|
197
|
-
*/
|
|
198
|
-
center: {
|
|
199
|
-
type: Boolean,
|
|
200
|
-
default: false
|
|
201
|
-
},
|
|
202
|
-
/**
|
|
203
|
-
* 对话框的尺寸
|
|
204
|
-
*/
|
|
205
|
-
size: {
|
|
206
|
-
type: String,
|
|
207
|
-
default: 'sm'
|
|
208
|
-
},
|
|
209
|
-
/**
|
|
210
|
-
* 关闭时是否销毁对话框中的元素
|
|
211
|
-
*/
|
|
212
|
-
destroyOnClose: Boolean,
|
|
213
|
-
/**
|
|
214
|
-
* 是否可拖动
|
|
215
|
-
*/
|
|
216
|
-
drag: Boolean,
|
|
217
|
-
/**
|
|
218
|
-
* 对话框的变换样式
|
|
219
|
-
*/
|
|
220
|
-
transform: String
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
data() {
|
|
224
|
-
return {
|
|
225
|
-
original: {},
|
|
226
|
-
initial: {},
|
|
227
|
-
styles: {},
|
|
228
|
-
closed: false,
|
|
229
|
-
key: 0,
|
|
230
|
-
full: false,
|
|
231
|
-
isMove: false,
|
|
232
|
-
isFull: false,
|
|
233
|
-
resizeObserver: null,
|
|
234
|
-
sizes: {
|
|
235
|
-
mini: { width: '720px', height: '400px' },
|
|
236
|
-
sm: { width: '960px', height: '500px' },
|
|
237
|
-
md: { width: '1060px', height: '600px' },
|
|
238
|
-
lg: { width: '1200px', height: availHeight < 800 ? '560px' : '800px' },
|
|
239
|
-
max: { width: `${availWidth}px`, height: `${availHeight}px` },
|
|
240
|
-
full: { width: '100%', height: '100%' }
|
|
241
|
-
},
|
|
242
|
-
defaultProps: {},
|
|
243
|
-
zoom: 1,
|
|
244
|
-
scales: { zoom: 1 }
|
|
245
|
-
};
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
watch: {
|
|
249
|
-
_width: {
|
|
250
|
-
immediate: true,
|
|
251
|
-
handler(val) {
|
|
252
|
-
this.initStyle({ width: val });
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
_height: {
|
|
256
|
-
immediate: true,
|
|
257
|
-
handler(val) {
|
|
258
|
-
if (val) {
|
|
259
|
-
this.initStyle({ height: val });
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
visible: {
|
|
264
|
-
immediate: true,
|
|
265
|
-
handler(val, old) {
|
|
266
|
-
if (val) {
|
|
267
|
-
if (
|
|
268
|
-
!this.height ||
|
|
269
|
-
this.height === 'auto' ||
|
|
270
|
-
!this.width ||
|
|
271
|
-
this.width === 'auto'
|
|
272
|
-
) {
|
|
273
|
-
this.$nextTick(() => {
|
|
274
|
-
const { height, width } =
|
|
275
|
-
this.$refs.dialog.getBoundingClientRect();
|
|
276
|
-
let style = {};
|
|
277
|
-
if (!this.height || this.height === 'auto') {
|
|
278
|
-
style.height = height + 'px';
|
|
279
|
-
}
|
|
280
|
-
if (!this.width || this.width === 'auto') {
|
|
281
|
-
style.width = width + 'px';
|
|
282
|
-
}
|
|
283
|
-
this.initStyle(style);
|
|
284
|
-
(!this.height || this.height === 'auto') &&
|
|
285
|
-
this.initResizeObserver();
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
this.closed = false;
|
|
289
|
-
this.$emit('open');
|
|
290
|
-
this.$el && this.$el.addEventListener('scroll', this.updatePopper);
|
|
291
|
-
this.$nextTick(() => {
|
|
292
|
-
this.$refs.dialog.scrollTop = 0;
|
|
293
|
-
});
|
|
294
|
-
if (this.appendToBody && this.$el) {
|
|
295
|
-
// 使用 getWinTop() 获取顶层窗口的 document
|
|
296
|
-
const topWindow = getWinTop();
|
|
297
|
-
topWindow.document.body.appendChild(this.$el);
|
|
298
|
-
}
|
|
299
|
-
} else if (old !== undefined) {
|
|
300
|
-
if (this.resizeObserver) {
|
|
301
|
-
this.resizeObserver.disconnect();
|
|
302
|
-
this.resizeObserver = null;
|
|
303
|
-
}
|
|
304
|
-
this.$el && this.$el.removeEventListener('scroll', this.updatePopper);
|
|
305
|
-
if (!this.closed) this.$emit('close');
|
|
306
|
-
if (this.destroyOnClose) {
|
|
307
|
-
this.$nextTick(() => {
|
|
308
|
-
this.key++;
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
computed: {
|
|
317
|
-
bodyStyle() {
|
|
318
|
-
return this.styles.height && this.styles.height !== 'auto'
|
|
319
|
-
? { height: 'calc(100% - 48px)' }
|
|
320
|
-
: {};
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
_width() {
|
|
324
|
-
return this.width ? this.width : this.sizes[this.size]['width'];
|
|
325
|
-
},
|
|
326
|
-
_height() {
|
|
327
|
-
return this.height ? this.height : this.sizes[this.size]['height'];
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
created() {},
|
|
331
|
-
|
|
332
|
-
mounted() {
|
|
333
|
-
// 动态计算窗口可用尺寸
|
|
334
|
-
this.calculateAvailSize();
|
|
335
|
-
// 监听窗口大小变化,重新计算尺寸
|
|
336
|
-
window.addEventListener('resize', this.calculateAvailSize);
|
|
337
|
-
|
|
338
|
-
if (this.visible) {
|
|
339
|
-
this.open();
|
|
340
|
-
if (this.appendToBody) {
|
|
341
|
-
// 使用 getWinTop() 获取顶层窗口的 document
|
|
342
|
-
const topWindow = getWinTop();
|
|
343
|
-
topWindow.document.body.appendChild(this.$el);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (this.drag) {
|
|
347
|
-
this.move();
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
methods: {
|
|
352
|
-
/**
|
|
353
|
-
* 初始化对话框样式
|
|
354
|
-
* @param {Object} values - 样式值对象
|
|
355
|
-
*/
|
|
356
|
-
initStyle(values) {
|
|
357
|
-
// 使用getWinTop获取顶层document
|
|
358
|
-
const topWindow = getWinTop();
|
|
359
|
-
const rect = topWindow.document.body.getBoundingClientRect();
|
|
360
|
-
const position = { height: 'top', width: 'left' };
|
|
361
|
-
let style = JSON.parse(JSON.stringify(this.styles));
|
|
362
|
-
for (let i in values) {
|
|
363
|
-
if (values[i]) {
|
|
364
|
-
let val = values[i];
|
|
365
|
-
style[i] =
|
|
366
|
-
this[i] === 'auto'
|
|
367
|
-
? this[i]
|
|
368
|
-
: typeof val === 'number'
|
|
369
|
-
? val + 'px'
|
|
370
|
-
: val === 'auto' ||
|
|
371
|
-
val.indexOf('%') > -1 ||
|
|
372
|
-
val.indexOf('px') > -1
|
|
373
|
-
? val
|
|
374
|
-
: val + 'px';
|
|
375
|
-
if (val !== 'auto') {
|
|
376
|
-
let n = parseInt(val, 10);
|
|
377
|
-
if (typeof val === 'string' && val.indexOf('%') > -1) {
|
|
378
|
-
style[position[i]] = (rect[i] - (rect[i] * n) / 100) / 2 + 'px';
|
|
379
|
-
} else {
|
|
380
|
-
style[position[i]] = (rect[i] - n) / 2 + 'px';
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
this.styles = style;
|
|
386
|
-
this.original = JSON.parse(JSON.stringify(this.styles));
|
|
387
|
-
this.initial = JSON.parse(JSON.stringify(this.styles));
|
|
388
|
-
if (this.width === '100%' && this.height === '100%') {
|
|
389
|
-
this.isFull = true;
|
|
390
|
-
} else {
|
|
391
|
-
this.isFull = false;
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
/**
|
|
395
|
-
* 初始化 resize 观察器
|
|
396
|
-
*/
|
|
397
|
-
initResizeObserver: debounce(300, function () {
|
|
398
|
-
// 断开之前的观察器
|
|
399
|
-
if (this.resizeObserver) {
|
|
400
|
-
this.resizeObserver.disconnect();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
404
|
-
requestAnimationFrame(() => {
|
|
405
|
-
let { height, width } = this.$refs.dialog.getBoundingClientRect();
|
|
406
|
-
this.initStyle({
|
|
407
|
-
height,
|
|
408
|
-
width
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
// 确保 body 元素存在时才调用 observe 方法
|
|
413
|
-
if (this.$refs.body) {
|
|
414
|
-
this.resizeObserver.observe(this.$refs.body);
|
|
415
|
-
}
|
|
416
|
-
}),
|
|
417
|
-
/**
|
|
418
|
-
* 初始化对话框拖动功能
|
|
419
|
-
*/
|
|
420
|
-
move() {
|
|
421
|
-
let area = this.$refs.header;
|
|
422
|
-
let box = this.$refs.dialog;
|
|
423
|
-
let [sTime, eTime] = [0, 0];
|
|
424
|
-
area.addEventListener('mousedown', (e) => {
|
|
425
|
-
e.stopPropagation();
|
|
426
|
-
e.preventDefault();
|
|
427
|
-
sTime = new Date().getTime();
|
|
428
|
-
let { x: downX, y: downY } = e;
|
|
429
|
-
let { width: winW, height: winH } =
|
|
430
|
-
document.body.getBoundingClientRect();
|
|
431
|
-
// 防止拖动期间选中和复制网页文本
|
|
432
|
-
document.body.onselectstart = document.body.oncontextmenu = () => {
|
|
433
|
-
return false;
|
|
434
|
-
};
|
|
435
|
-
document.onmousemove = (eve) => {
|
|
436
|
-
this.isMove = true;
|
|
437
|
-
let { x: moveX, y: moveY } = eve;
|
|
438
|
-
let {
|
|
439
|
-
left: boxLeft,
|
|
440
|
-
top: boxTop,
|
|
441
|
-
width: boxW
|
|
442
|
-
} = box.getBoundingClientRect();
|
|
443
|
-
boxLeft = boxLeft + (moveX - downX);
|
|
444
|
-
boxLeft >= winW - 60 && (boxLeft = winW - 60);
|
|
445
|
-
boxLeft <= 60 - boxW && (boxLeft = 60 - boxW);
|
|
446
|
-
box.style.left = boxLeft + 'px';
|
|
447
|
-
downX = moveX;
|
|
448
|
-
boxTop = boxTop + (moveY - downY);
|
|
449
|
-
boxTop >= winH - 40 && (boxTop = winH - 40);
|
|
450
|
-
boxTop <= 0 && (boxTop = 0);
|
|
451
|
-
box.style.top = boxTop + 'px';
|
|
452
|
-
downY = moveY;
|
|
453
|
-
};
|
|
454
|
-
document.onmouseup = () => {
|
|
455
|
-
eTime = new Date().getTime();
|
|
456
|
-
let isClick = eTime - sTime < 200;
|
|
457
|
-
if (isClick) {
|
|
458
|
-
this.isMove = false;
|
|
459
|
-
let onArea = () => {
|
|
460
|
-
area.removeEventListener('click', onArea);
|
|
461
|
-
};
|
|
462
|
-
area.addEventListener('click', onArea);
|
|
463
|
-
}
|
|
464
|
-
this.$emit('move');
|
|
465
|
-
document.onmousemove = null;
|
|
466
|
-
document.body.onselectstart = document.body.oncontextmenu = () => {
|
|
467
|
-
return true;
|
|
468
|
-
};
|
|
469
|
-
};
|
|
470
|
-
});
|
|
471
|
-
},
|
|
472
|
-
/**
|
|
473
|
-
* 获取迁移配置
|
|
474
|
-
* @returns {Object} 迁移配置对象
|
|
475
|
-
*/
|
|
476
|
-
getMigratingConfig() {
|
|
477
|
-
return {
|
|
478
|
-
props: {
|
|
479
|
-
size: 'size is removed.'
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
},
|
|
483
|
-
/**
|
|
484
|
-
* 处理遮罩层点击事件
|
|
485
|
-
*/
|
|
486
|
-
handleWrapperClick() {
|
|
487
|
-
if (!this.closeOnClickModal) return;
|
|
488
|
-
this.handleClose();
|
|
489
|
-
},
|
|
490
|
-
/**
|
|
491
|
-
* 处理关闭按钮点击事件
|
|
492
|
-
*/
|
|
493
|
-
handleClose() {
|
|
494
|
-
if (typeof this.beforeClose === 'function') {
|
|
495
|
-
this.beforeClose(this.hide);
|
|
496
|
-
} else {
|
|
497
|
-
this.hide(0);
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
/**
|
|
501
|
-
* 处理全屏切换事件
|
|
502
|
-
*/
|
|
503
|
-
handleScale() {
|
|
504
|
-
this.isFull = !this.isFull;
|
|
505
|
-
if (this.isFull) {
|
|
506
|
-
const { width, height, left, top } = this.$refs.dialog.style;
|
|
507
|
-
this.initial = { width, height, left, top };
|
|
508
|
-
this.styles = { width: '100%', height: '100%' };
|
|
509
|
-
this.isMove = false;
|
|
510
|
-
} else {
|
|
511
|
-
this.styles = this.initial;
|
|
512
|
-
this.isMove = this.drag;
|
|
513
|
-
}
|
|
514
|
-
if (this.resizeObserver) {
|
|
515
|
-
this.resizeObserver.disconnect();
|
|
516
|
-
}
|
|
517
|
-
this.$emit('scale', this.isFull);
|
|
518
|
-
},
|
|
519
|
-
/**
|
|
520
|
-
* 隐藏对话框
|
|
521
|
-
* @param {*} cancel - 是否取消
|
|
522
|
-
*/
|
|
523
|
-
hide(cancel) {
|
|
524
|
-
if (cancel !== false) {
|
|
525
|
-
this.$emit('update:visible', false);
|
|
526
|
-
this.$emit('close', cancel);
|
|
527
|
-
this.closed = true;
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
/**
|
|
531
|
-
* 更新 popper 位置
|
|
532
|
-
*/
|
|
533
|
-
updatePopper() {
|
|
534
|
-
this.broadcast('EsSelectDropdown', 'updatePopper');
|
|
535
|
-
this.broadcast('EsDropdownMenu', 'updatePopper');
|
|
536
|
-
},
|
|
537
|
-
/**
|
|
538
|
-
* 对话框进入动画结束后执行
|
|
539
|
-
*/
|
|
540
|
-
afterEnter() {
|
|
541
|
-
this.$emit('opened');
|
|
542
|
-
},
|
|
543
|
-
/**
|
|
544
|
-
* 对话框离开动画结束后执行
|
|
545
|
-
*/
|
|
546
|
-
afterLeave() {
|
|
547
|
-
this.$emit('closed');
|
|
548
|
-
this.styles = {};
|
|
549
|
-
this.$nextTick(() => {
|
|
550
|
-
this.styles = JSON.parse(JSON.stringify(this.original));
|
|
551
|
-
if (this.width === '100%' && this.height === '100%') {
|
|
552
|
-
this.isFull = true;
|
|
553
|
-
} else {
|
|
554
|
-
this.isFull = false;
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
},
|
|
558
|
-
/**
|
|
559
|
-
* 计算窗口可用尺寸
|
|
560
|
-
*/
|
|
561
|
-
calculateAvailSize() {
|
|
562
|
-
try {
|
|
563
|
-
// 使用getWinTop获取顶层document
|
|
564
|
-
const topWindow = getWinTop();
|
|
565
|
-
const topDocument = topWindow.document;
|
|
566
|
-
if (topDocument && topDocument.body) {
|
|
567
|
-
// 使用getBoundingClientRect获取准确的尺寸
|
|
568
|
-
const bodyRect = topDocument.body.getBoundingClientRect();
|
|
569
|
-
availWidth = bodyRect.width - 96;
|
|
570
|
-
availHeight = bodyRect.height - 96;
|
|
571
|
-
|
|
572
|
-
// 确保尺寸至少为默认值
|
|
573
|
-
availWidth = Math.max(availWidth, 900);
|
|
574
|
-
availHeight = Math.max(availHeight, 600);
|
|
575
|
-
|
|
576
|
-
// 更新sizes中的尺寸
|
|
577
|
-
this.$set(this.sizes.max, 'width', `${availWidth}px`);
|
|
578
|
-
this.$set(this.sizes.max, 'height', `${availHeight}px`);
|
|
579
|
-
this.$set(
|
|
580
|
-
this.sizes.lg,
|
|
581
|
-
'height',
|
|
582
|
-
`${availHeight < 800 ? '560px' : '800px'}`
|
|
583
|
-
);
|
|
584
|
-
|
|
585
|
-
// 如果当前使用的是这些尺寸,重新应用样式
|
|
586
|
-
if (this.size === 'max' || this.size === 'lg') {
|
|
587
|
-
this.initStyle({ width: this._width, height: this._height });
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
} catch (error) {
|
|
591
|
-
// 处理跨域或其他错误
|
|
592
|
-
console.warn('获取窗口尺寸失败,使用默认值', error);
|
|
593
|
-
// 确保使用安全的默认值
|
|
594
|
-
availWidth = 900;
|
|
595
|
-
availHeight = 600;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
beforeDestroy() {
|
|
601
|
-
// 移除窗口大小变化监听
|
|
602
|
-
window.removeEventListener('resize', this.calculateAvailSize);
|
|
603
|
-
},
|
|
604
|
-
|
|
605
|
-
destroyed() {
|
|
606
|
-
// if appendToBody is true, remove DOM node after destroy
|
|
607
|
-
if (this.appendToBody && this.$el && this.$el.parentNode) {
|
|
608
|
-
this.$el.parentNode.removeChild(this.$el);
|
|
609
|
-
}
|
|
610
|
-
if (this.resizeObserver) {
|
|
611
|
-
this.resizeObserver.disconnect();
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
</script>
|