haiwei-ui 1.0.3 → 1.0.4
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/README.md +10 -0
- package/package.json +1 -1
- package/packages/components/box/index.vue +116 -125
- package/packages/components/box-col/index.vue +30 -33
- package/packages/components/box-row/index.vue +17 -17
- package/packages/components/box-small/index.vue +38 -38
- package/packages/components/button/index.vue +29 -42
- package/packages/components/button-copy/index.vue +46 -62
- package/packages/components/button-delete/index.vue +64 -77
- package/packages/components/button-delete-batch/index.vue +82 -95
- package/packages/components/button-has/index.vue +29 -42
- package/packages/components/checkbox-group/index.vue +85 -85
- package/packages/components/color-picker/index.vue +41 -50
- package/packages/components/container/index.vue +8 -8
- package/packages/components/date-range-picker/index.vue +92 -103
- package/packages/components/details/index.vue +72 -79
- package/packages/components/dialog/index.vue +281 -294
- package/packages/components/drag-sort/index.vue +36 -36
- package/packages/components/drag-sort-dialog/index.vue +58 -58
- package/packages/components/drawer/index.vue +157 -166
- package/packages/components/enums/sex/index.vue +1 -1
- package/packages/components/flex/index.vue +33 -33
- package/packages/components/form/index.vue +123 -138
- package/packages/components/form-dialog/index.vue +184 -217
- package/packages/components/form-page/index.vue +134 -151
- package/packages/components/icon/index.vue +6 -6
- package/packages/components/icon-picker/index.vue +30 -30
- package/packages/components/icon-picker/panel.vue +58 -58
- package/packages/components/label/index.vue +22 -30
- package/packages/components/list/components/export/index.vue +101 -99
- package/packages/components/list/components/footer/index.vue +42 -51
- package/packages/components/list/components/header/index.vue +34 -34
- package/packages/components/list/components/querybar/index.vue +144 -144
- package/packages/components/list/components/select-column/index.vue +30 -30
- package/packages/components/list/components/table/index.vue +169 -188
- package/packages/components/list/index.vue +337 -391
- package/packages/components/list-agile/index.vue +145 -145
- package/packages/components/list-dialog/index.vue +70 -84
- package/packages/components/listbox/index.vue +48 -48
- package/packages/components/login-default/index.vue +107 -107
- package/packages/components/login-neon/index.vue +104 -104
- package/packages/components/map/index.vue +229 -229
- package/packages/components/map-coord-picking/index.vue +220 -219
- package/packages/components/map-search/index.vue +75 -72
- package/packages/components/scrollbar/index.vue +11 -11
- package/packages/components/select-whether/index.vue +30 -30
- package/packages/components/split/index.vue +141 -141
- package/packages/components/split/trigger.vue +15 -15
- package/packages/components/tabnav/index.vue +125 -89
- package/packages/components/tabs/index.vue +31 -31
- package/packages/components/toolbar/components/fullscreen/index.vue +10 -10
- package/packages/components/toolbar/components/logout/index.vue +13 -13
- package/packages/components/toolbar/components/skin-toggle/form.vue +59 -59
- package/packages/components/toolbar/components/skin-toggle/index.vue +12 -12
- package/packages/components/toolbar/components/userInfo/index.vue +18 -18
- package/packages/components/toolbar/index.vue +12 -12
- package/packages/components/tree-select/mixins.vue +261 -270
- package/packages/components/txt/index.vue +17 -17
- package/packages/components/update-password/index.vue +45 -57
- package/packages/layout.vue +18 -18
- package/packages/mixins/components/checkbox.vue +71 -82
- package/packages/mixins/components/radio.vue +69 -69
- package/packages/page/403/index.vue +32 -28
- package/packages/page/404/index.vue +32 -28
- package/packages/page/default/index.vue +17 -13
- package/packages/page/iframe/index.vue +6 -6
- package/packages/page/login/index.vue +9 -9
- package/packages/page/userInfo/index.vue +5 -5
- package/packages/router/index.js +1 -9
- package/packages/skins/pretty/components/header/components/breadcrumb/index.vue +29 -29
- package/packages/skins/pretty/components/header/components/theme/index.vue +22 -21
- package/packages/skins/pretty/components/header/index.vue +12 -12
- package/packages/skins/pretty/components/main/index.vue +27 -27
- package/packages/skins/pretty/components/menus/index.vue +28 -28
- package/packages/skins/pretty/components/menus/item.vue +23 -23
- package/packages/skins/pretty/components/sidebar/index.vue +7 -7
- package/packages/skins/pretty/index.vue +6 -6
- package/packages/skins/pretty/styles/themes/blue-light/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/default/_index.scss +1 -1
- package/packages/skins/pretty/styles/themes/green/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/green-light/_index.scss +2 -2
- package/packages/styles/_mixins.scss +24 -25
- package/packages/styles/animation/_index.scss +22 -23
- package/packages/styles/animation/breadcrumb.scss +6 -6
- package/packages/styles/animation/fade.scss +11 -11
- package/packages/styles/animation/move.scss +98 -98
- package/packages/styles/components/box-small/_index.scss +58 -58
- package/packages/styles/components/button/_index.scss +7 -7
- package/packages/styles/components/container/_index.scss +26 -26
- package/packages/styles/components/date-range-picker/_index.scss +4 -4
- package/packages/styles/components/details/_index.scss +66 -67
- package/packages/styles/components/details-dialog/_index.scss +13 -13
- package/packages/styles/components/drag-sort/_index.scss +20 -20
- package/packages/styles/components/drag-sort-dialog/_index.scss +7 -7
- package/packages/styles/components/flex/_index.scss +56 -56
- package/packages/styles/components/form-dialog/_index.scss +11 -11
- package/packages/styles/components/icon/_index.scss +6 -6
- package/packages/styles/components/label/_index.scss +245 -245
- package/packages/styles/components/listbox/_index.scss +47 -47
- package/packages/styles/components/split/_index.scss +102 -102
- package/packages/styles/components/toolbar/_index.scss +98 -98
- package/packages/styles/components/txt/_index.scss +13 -13
- package/packages/styles/components/upload-dialog/_index.scss +44 -44
- package/packages/styles/components/upload-multiple/_index.scss +19 -19
- package/packages/styles/components/upload-single/_index.scss +16 -16
- package/packages/utils/resize-event.js +3 -3
- package/packages/vuter/attributes.json +30 -40
- package/packages/vuter/tags.json +11 -27
- package/public/lib/font/iconfont.js +47 -1
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-dialog
|
|
3
|
-
ref="dialog"
|
|
4
|
-
:id="id"
|
|
5
|
-
:class="class_"
|
|
6
|
-
:top="draggable_ ? '' : top"
|
|
7
|
-
:modal="modal"
|
|
8
|
-
:close-on-click-modal="closeOnClickModal_"
|
|
9
|
-
:fullscreen="hasFullscreen"
|
|
10
|
-
:visible.sync="visible_"
|
|
11
|
-
:show-close="false"
|
|
12
|
-
:append-to-body="true"
|
|
13
|
-
:destroy-on-close="destroyOnClose"
|
|
14
|
-
v-on="on"
|
|
15
|
-
>
|
|
2
|
+
<el-dialog ref="dialog" :id="id" :class="class_" :top="draggable_ ? '' : top" :modal="modal" :close-on-click-modal="closeOnClickModal_" :fullscreen="hasFullscreen" :visible.sync="visible_" :show-close="false" :append-to-body="true" :destroy-on-close="destroyOnClose" v-on="on">
|
|
16
3
|
<!--头部-->
|
|
17
4
|
<template v-slot:title>
|
|
18
5
|
<section v-if="icon" class="nm-dialog-icon">
|
|
@@ -55,310 +42,310 @@
|
|
|
55
42
|
</el-dialog>
|
|
56
43
|
</template>
|
|
57
44
|
<script>
|
|
58
|
-
import { mapState, mapActions } from 'vuex'
|
|
59
|
-
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event'
|
|
60
|
-
import { on, off } from '../../utils/dom'
|
|
61
|
-
import visible from '../../mixins/components/visible.js'
|
|
62
|
-
export default {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
props: {
|
|
87
|
-
/**
|
|
88
|
-
* @description 显示头部
|
|
89
|
-
*/
|
|
90
|
-
header: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: true
|
|
93
|
-
},
|
|
94
|
-
/** Dialog 的标题,也可通过具名 title传入 */
|
|
95
|
-
title: String,
|
|
96
|
-
/** 图标 */
|
|
97
|
-
icon: String,
|
|
98
|
-
/**图标颜色 */
|
|
99
|
-
iconColor: String,
|
|
100
|
-
/** Dialog 的宽度 */
|
|
101
|
-
width: {
|
|
102
|
-
type: [Number, String],
|
|
103
|
-
default: '50%'
|
|
104
|
-
},
|
|
105
|
-
/** Dialog 的高度 */
|
|
106
|
-
height: [Number, String],
|
|
107
|
-
/** 内边距 */
|
|
108
|
-
padding: Number,
|
|
109
|
-
/** 显示尾部 */
|
|
110
|
-
footer: Boolean,
|
|
111
|
-
/** 是否需要遮罩层 */
|
|
112
|
-
modal: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: true
|
|
115
|
-
},
|
|
116
|
-
/** 是否可以通过点击 modal 关闭 Dialog */
|
|
117
|
-
closeOnClickModal: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: null
|
|
120
|
-
},
|
|
121
|
-
/** 是否显示关闭按钮 */
|
|
122
|
-
showClose: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
default: true
|
|
125
|
-
},
|
|
126
|
-
/** 关闭前的回调,会暂停 Dialog 的关闭 */
|
|
127
|
-
beforeClose: Function,
|
|
128
|
-
/** 是否显示全屏按钮 */
|
|
129
|
-
fullscreen: Boolean,
|
|
130
|
-
/** 不包含滚动条 */
|
|
131
|
-
noScrollbar: Boolean,
|
|
132
|
-
/** 显示加载动画 */
|
|
133
|
-
loading: Boolean,
|
|
134
|
-
/** 可拖拽的 */
|
|
135
|
-
draggable: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
default: null
|
|
138
|
-
},
|
|
139
|
-
/** 是否可拖出页面 */
|
|
140
|
-
dragOutPage: Boolean,
|
|
141
|
-
/** 拖拽出页面后保留的最小宽度 */
|
|
142
|
-
dragMinWidth: {
|
|
143
|
-
type: Number,
|
|
144
|
-
default: 100
|
|
145
|
-
},
|
|
146
|
-
/** 是否显示底部关闭按钮 */
|
|
147
|
-
footerCloseButton: Boolean,
|
|
148
|
-
/**关闭时销毁 Dialog 中的元素 */
|
|
149
|
-
destroyOnClose: Boolean
|
|
150
|
-
},
|
|
151
|
-
computed: {
|
|
152
|
-
...mapState('app/config', { config: s => s.component.dialog }),
|
|
153
|
-
...mapState('app/loading', { loadingText: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
|
|
154
|
-
elScrollbarViewEl() {
|
|
155
|
-
return this.$refs.dialog.$el.querySelector('.el-scrollbar__view')
|
|
156
|
-
},
|
|
157
|
-
class_() {
|
|
158
|
-
return ['nm-dialog', this.draggable_ ? 'draggable' : '', this.header ? '' : 'no-header']
|
|
159
|
-
},
|
|
160
|
-
width_() {
|
|
161
|
-
return typeof this.width === 'number' ? (this.width > 0 ? this.width + 'px' : '50%') : this.width
|
|
162
|
-
},
|
|
163
|
-
closeOnClickModal_() {
|
|
164
|
-
if (this.closeOnClickModal === null) {
|
|
165
|
-
return this.config.closeOnClickModal
|
|
166
|
-
}
|
|
167
|
-
return this.closeOnClickModal
|
|
168
|
-
},
|
|
169
|
-
draggable_() {
|
|
170
|
-
if (this.draggable === null) {
|
|
171
|
-
return this.config.draggable
|
|
45
|
+
import { mapState, mapActions } from 'vuex'
|
|
46
|
+
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event'
|
|
47
|
+
import { on, off } from '../../utils/dom'
|
|
48
|
+
import visible from '../../mixins/components/visible.js'
|
|
49
|
+
export default {
|
|
50
|
+
name: 'Dialog',
|
|
51
|
+
mixins: [visible],
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
id: '',
|
|
55
|
+
// 是否已全屏
|
|
56
|
+
hasFullscreen: false,
|
|
57
|
+
// 距顶部高度
|
|
58
|
+
top: '',
|
|
59
|
+
// 是否点击拖拽
|
|
60
|
+
isDragDown: false,
|
|
61
|
+
on: {
|
|
62
|
+
open: this.onOpen,
|
|
63
|
+
opened: this.onOpened,
|
|
64
|
+
close: this.onClose,
|
|
65
|
+
closed: this.onClosed
|
|
66
|
+
},
|
|
67
|
+
// 拖拽点击时的状态
|
|
68
|
+
dragDownState: {},
|
|
69
|
+
// 已初始化
|
|
70
|
+
hasInit: false
|
|
172
71
|
}
|
|
173
|
-
return this.draggable
|
|
174
72
|
},
|
|
175
|
-
|
|
176
|
-
|
|
73
|
+
props: {
|
|
74
|
+
/**
|
|
75
|
+
* @description 显示头部
|
|
76
|
+
*/
|
|
77
|
+
header: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
/** Dialog 的标题,也可通过具名 title传入 */
|
|
82
|
+
title: String,
|
|
83
|
+
/** 图标 */
|
|
84
|
+
icon: String,
|
|
85
|
+
/**图标颜色 */
|
|
86
|
+
iconColor: String,
|
|
87
|
+
/** Dialog 的宽度 */
|
|
88
|
+
width: {
|
|
89
|
+
type: [Number, String],
|
|
90
|
+
default: '50%'
|
|
91
|
+
},
|
|
92
|
+
/** Dialog 的高度 */
|
|
93
|
+
height: [Number, String],
|
|
94
|
+
/** 内边距 */
|
|
95
|
+
padding: Number,
|
|
96
|
+
/** 显示尾部 */
|
|
97
|
+
footer: Boolean,
|
|
98
|
+
/** 是否需要遮罩层 */
|
|
99
|
+
modal: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
/** 是否可以通过点击 modal 关闭 Dialog */
|
|
104
|
+
closeOnClickModal: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: null
|
|
107
|
+
},
|
|
108
|
+
/** 是否显示关闭按钮 */
|
|
109
|
+
showClose: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: true
|
|
112
|
+
},
|
|
113
|
+
/** 关闭前的回调,会暂停 Dialog 的关闭 */
|
|
114
|
+
beforeClose: Function,
|
|
115
|
+
/** 是否显示全屏按钮 */
|
|
116
|
+
fullscreen: Boolean,
|
|
117
|
+
/** 不包含滚动条 */
|
|
118
|
+
noScrollbar: Boolean,
|
|
119
|
+
/** 显示加载动画 */
|
|
120
|
+
loading: Boolean,
|
|
121
|
+
/** 可拖拽的 */
|
|
122
|
+
draggable: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
/** 是否可拖出页面 */
|
|
127
|
+
dragOutPage: Boolean,
|
|
128
|
+
/** 拖拽出页面后保留的最小宽度 */
|
|
129
|
+
dragMinWidth: {
|
|
130
|
+
type: Number,
|
|
131
|
+
default: 100
|
|
132
|
+
},
|
|
133
|
+
/** 是否显示底部关闭按钮 */
|
|
134
|
+
footerCloseButton: Boolean,
|
|
135
|
+
/**关闭时销毁 Dialog 中的元素 */
|
|
136
|
+
destroyOnClose: Boolean
|
|
177
137
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
138
|
+
computed: {
|
|
139
|
+
...mapState('app/config', { config: s => s.component.dialog }),
|
|
140
|
+
...mapState('app/loading', { loadingText: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
|
|
141
|
+
elScrollbarViewEl() {
|
|
142
|
+
return this.$refs.dialog.$el.querySelector('.el-scrollbar__view')
|
|
143
|
+
},
|
|
144
|
+
class_() {
|
|
145
|
+
return ['nm-dialog', this.draggable_ ? 'draggable' : '', this.header ? '' : 'no-header']
|
|
146
|
+
},
|
|
147
|
+
width_() {
|
|
148
|
+
return typeof this.width === 'number' ? (this.width > 0 ? this.width + 'px' : '50%') : this.width
|
|
149
|
+
},
|
|
150
|
+
closeOnClickModal_() {
|
|
151
|
+
if (this.closeOnClickModal === null) {
|
|
152
|
+
return this.config.closeOnClickModal
|
|
153
|
+
}
|
|
154
|
+
return this.closeOnClickModal
|
|
155
|
+
},
|
|
156
|
+
draggable_() {
|
|
157
|
+
if (this.draggable === null) {
|
|
158
|
+
return this.config.draggable
|
|
159
|
+
}
|
|
160
|
+
return this.draggable
|
|
161
|
+
},
|
|
162
|
+
dialogEl() {
|
|
163
|
+
return this.$refs.dialog.$el.querySelector('.el-dialog')
|
|
164
|
+
},
|
|
165
|
+
titleEl() {
|
|
166
|
+
return this.$refs.title
|
|
190
167
|
}
|
|
191
168
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
169
|
+
methods: {
|
|
170
|
+
...mapActions('app/dialog', ['open']),
|
|
171
|
+
/** 全屏切换 */
|
|
172
|
+
triggerFullscreen() {
|
|
173
|
+
if (this.hasFullscreen) {
|
|
174
|
+
this.closeFullscreen()
|
|
175
|
+
} else {
|
|
176
|
+
this.openFullscreen()
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
/** 开启全屏 */
|
|
180
|
+
openFullscreen() {
|
|
181
|
+
this.hasFullscreen = true
|
|
182
|
+
this.$emit('fullscreen-change', this.hasFullscreen)
|
|
183
|
+
},
|
|
184
|
+
/** 关闭全屏 */
|
|
185
|
+
closeFullscreen() {
|
|
186
|
+
this.hasFullscreen = false
|
|
187
|
+
this.$emit('fullscreen-change', this.hasFullscreen)
|
|
188
|
+
},
|
|
189
|
+
/** 关闭对话框 */
|
|
190
|
+
close() {
|
|
191
|
+
this.hide()
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* 调整高度
|
|
195
|
+
*/
|
|
196
|
+
resize() {
|
|
197
|
+
// 对话框高度
|
|
198
|
+
const dialogHeight = this.getDialogHeight()
|
|
199
|
+
// 页面高度
|
|
200
|
+
const bodyHeight = document.body.clientHeight
|
|
214
201
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
202
|
+
let height
|
|
203
|
+
if (dialogHeight.full + 20 > bodyHeight) {
|
|
204
|
+
this.top = '10px'
|
|
205
|
+
height = bodyHeight - dialogHeight.h - dialogHeight.f - 20 + 'px'
|
|
206
|
+
} else {
|
|
207
|
+
this.top = ((bodyHeight - dialogHeight.full) / 7) * 2.5 + 'px'
|
|
208
|
+
height = dialogHeight.full + 'px'
|
|
209
|
+
}
|
|
223
210
|
|
|
224
|
-
|
|
225
|
-
|
|
211
|
+
this.dialogEl.style.height = height
|
|
212
|
+
this.dialogEl.style.width = this.width_
|
|
226
213
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
214
|
+
if (!this.hasInit) {
|
|
215
|
+
// 如果是可拖拽的,需要计算绝对定位
|
|
216
|
+
if (this.draggable_) {
|
|
217
|
+
this.dialogEl.style.left = (document.body.offsetWidth - this.dialogEl.offsetWidth) / 2 + 'px'
|
|
218
|
+
this.dialogEl.style.top = this.top
|
|
219
|
+
}
|
|
220
|
+
// 设置内边距
|
|
221
|
+
if (this.padding) {
|
|
222
|
+
this.dialogEl.querySelector(this.noScrollbar ? '.nm-dialog-main' : '.el-scrollbar__view').style.padding = this.padding + 'px'
|
|
223
|
+
}
|
|
224
|
+
this.hasInit = true
|
|
236
225
|
}
|
|
237
|
-
this.hasInit = true
|
|
238
|
-
}
|
|
239
226
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
227
|
+
this.updateScrollbar()
|
|
228
|
+
},
|
|
229
|
+
// 获取对话框的高度信息
|
|
230
|
+
getDialogHeight() {
|
|
231
|
+
const headerEl = this.dialogEl.querySelector('.el-dialog__header')
|
|
232
|
+
const h = headerEl ? headerEl.offsetHeight : 0
|
|
233
|
+
let b = this.elScrollbarViewEl ? this.elScrollbarViewEl.offsetHeight : 0
|
|
234
|
+
const footerEl = this.dialogEl.querySelector('.nm-dialog-footer')
|
|
235
|
+
const f = footerEl ? footerEl.offsetHeight : 0
|
|
249
236
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
} else {
|
|
256
|
-
if (this.height.endsWith('px')) {
|
|
257
|
-
full = parseFloat(this.height.replace('px', ''))
|
|
237
|
+
let full = h + b + f
|
|
238
|
+
// 如果主动设置了高度
|
|
239
|
+
if (this.height) {
|
|
240
|
+
if (typeof this.height === 'number' && this.height > 0) {
|
|
241
|
+
full = this.height
|
|
258
242
|
} else {
|
|
259
|
-
|
|
243
|
+
if (this.height.endsWith('px')) {
|
|
244
|
+
full = parseFloat(this.height.replace('px', ''))
|
|
245
|
+
} else {
|
|
246
|
+
full = (document.body.clientHeight * parseFloat(this.height.replace('%', ''))) / 100 - h - f
|
|
247
|
+
}
|
|
260
248
|
}
|
|
249
|
+
b = parseFloat(full - h - f)
|
|
261
250
|
}
|
|
262
|
-
b = parseFloat(full - h - f)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return { h, b, f, full: full }
|
|
266
|
-
},
|
|
267
|
-
/**
|
|
268
|
-
* @description 更新滚动条
|
|
269
|
-
*/
|
|
270
|
-
updateScrollbar() {
|
|
271
|
-
// 如果有滚动条,需要更新下滚动条
|
|
272
|
-
if (!this.noScrollbar) {
|
|
273
|
-
this.$nextTick(() => {
|
|
274
|
-
this.$refs.scrollbar.update()
|
|
275
|
-
})
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
/**
|
|
279
|
-
* @description 处理拖拽点击
|
|
280
|
-
*/
|
|
281
|
-
handleDragDown(e) {
|
|
282
|
-
if (this.draggable_ && !this.hasFullscreen) {
|
|
283
|
-
this.isDragDown = true
|
|
284
|
-
this.dragDownState = e
|
|
285
251
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
252
|
+
return { h, b, f, full: full }
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* @description 更新滚动条
|
|
256
|
+
*/
|
|
257
|
+
updateScrollbar() {
|
|
258
|
+
// 如果有滚动条,需要更新下滚动条
|
|
259
|
+
if (!this.noScrollbar) {
|
|
260
|
+
this.$nextTick(() => {
|
|
261
|
+
this.$refs.scrollbar.update()
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
/**
|
|
266
|
+
* @description 处理拖拽点击
|
|
267
|
+
*/
|
|
268
|
+
handleDragDown(e) {
|
|
269
|
+
if (this.draggable_ && !this.hasFullscreen) {
|
|
270
|
+
this.isDragDown = true
|
|
271
|
+
this.dragDownState = e
|
|
303
272
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
273
|
+
// 防止鼠标选中抽屉中文字,造成拖动trigger触发浏览器原生拖动行为
|
|
274
|
+
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty()
|
|
275
|
+
on(document, 'mousemove', this.handleDragMove)
|
|
276
|
+
on(document, 'mouseup', this.handleDragUp)
|
|
308
277
|
}
|
|
278
|
+
},
|
|
279
|
+
/**
|
|
280
|
+
* @description 处理拖拽移动
|
|
281
|
+
*/
|
|
282
|
+
handleDragMove(e) {
|
|
283
|
+
if (this.isDragDown) {
|
|
284
|
+
let left = this.dialogEl.offsetLeft + (e.clientX - this.dragDownState.clientX)
|
|
285
|
+
let top = this.dialogEl.offsetTop + (e.clientY - this.dragDownState.clientY)
|
|
286
|
+
let leftMax = document.body.offsetWidth - this.dialogEl.offsetWidth
|
|
287
|
+
let leftMin = 0
|
|
288
|
+
let topMax = document.body.offsetHeight - this.dialogEl.offsetHeight
|
|
289
|
+
let topMin = 0
|
|
309
290
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* @description 处理拖拽结束
|
|
317
|
-
*/
|
|
318
|
-
handleDragUp() {
|
|
319
|
-
this.isDragDown = false
|
|
320
|
-
off(document, 'mousemove', this.handleDragMove)
|
|
321
|
-
off(document, 'mouseup', this.handleDragUp)
|
|
322
|
-
},
|
|
323
|
-
onOpen() {
|
|
324
|
-
this.$nextTick(() => {
|
|
325
|
-
this.resize()
|
|
291
|
+
if (this.dragOutPage) {
|
|
292
|
+
leftMax = document.body.offsetWidth - this.dragMinWidth
|
|
293
|
+
leftMin = -this.dialogEl.offsetWidth + this.dragMinWidth
|
|
294
|
+
topMax = document.body.offsetHeight - this.titleEl.offsetHeight
|
|
295
|
+
}
|
|
326
296
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
297
|
+
this.dialogEl.style.left = Math.max(leftMin, Math.min(left, leftMax)) + 'px'
|
|
298
|
+
this.dialogEl.style.top = Math.max(topMin, Math.min(top, topMax)) + 'px'
|
|
299
|
+
this.dragDownState = e
|
|
330
300
|
}
|
|
301
|
+
},
|
|
302
|
+
/**
|
|
303
|
+
* @description 处理拖拽结束
|
|
304
|
+
*/
|
|
305
|
+
handleDragUp() {
|
|
306
|
+
this.isDragDown = false
|
|
307
|
+
off(document, 'mousemove', this.handleDragMove)
|
|
308
|
+
off(document, 'mouseup', this.handleDragUp)
|
|
309
|
+
},
|
|
310
|
+
onOpen() {
|
|
311
|
+
this.$nextTick(() => {
|
|
312
|
+
this.resize()
|
|
331
313
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
314
|
+
on(window, 'resize', this.resize)
|
|
315
|
+
if (!this.noScrollbar) {
|
|
316
|
+
addResizeListener(this.elScrollbarViewEl, this.resize)
|
|
317
|
+
}
|
|
335
318
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
319
|
+
if (!this.draggable_) return
|
|
320
|
+
on(this.titleEl, 'mousedown', this.handleDragDown)
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
this.$emit('open')
|
|
324
|
+
},
|
|
325
|
+
onOpened() {
|
|
326
|
+
this.$emit('opened')
|
|
327
|
+
},
|
|
328
|
+
onClose() {
|
|
329
|
+
off(window, 'resize', this.resize)
|
|
330
|
+
if (!this.noScrollbar) {
|
|
331
|
+
removeResizeListener(this.elScrollbarViewEl, this.resize)
|
|
332
|
+
}
|
|
333
|
+
off(this.titleEl, 'mousedown', this.handleDragDown)
|
|
334
|
+
this.$emit('close')
|
|
335
|
+
},
|
|
336
|
+
onClosed() {
|
|
337
|
+
this.$emit('closed')
|
|
345
338
|
}
|
|
346
|
-
off(this.titleEl, 'mousedown', this.handleDragDown)
|
|
347
|
-
this.$emit('close')
|
|
348
339
|
},
|
|
349
|
-
|
|
350
|
-
|
|
340
|
+
mounted() {
|
|
341
|
+
// 打开对话框
|
|
342
|
+
this.open().then(id => {
|
|
343
|
+
this.id = 'nm-dialog-' + id
|
|
344
|
+
})
|
|
345
|
+
},
|
|
346
|
+
destroyed() {
|
|
347
|
+
off(document, 'mousemove', this.handleDragMove)
|
|
348
|
+
off(document, 'mouseup', this.handleDragUp)
|
|
351
349
|
}
|
|
352
|
-
},
|
|
353
|
-
mounted() {
|
|
354
|
-
// 打开对话框
|
|
355
|
-
this.open().then(id => {
|
|
356
|
-
this.id = 'nm-dialog-' + id
|
|
357
|
-
})
|
|
358
|
-
},
|
|
359
|
-
destroyed() {
|
|
360
|
-
off(document, 'mousemove', this.handleDragMove)
|
|
361
|
-
off(document, 'mouseup', this.handleDragUp)
|
|
362
350
|
}
|
|
363
|
-
}
|
|
364
351
|
</script>
|