yuang-framework-ui-pc 1.1.15 → 1.1.16
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/es/core-components.js +3 -4
- package/es/ele-dialog/index.d.ts +2 -2
- package/es/ele-dialog/index.js +15 -15
- package/es/ele-dialog/props.d.ts +3 -3
- package/es/ele-dialog/props.js +4 -4
- package/es/ele-dialog/util.d.ts +8 -8
- package/es/ele-dialog/util.js +93 -101
- package/es/style/plus.scss +2 -0
- package/es/style/themes/default.scss +26 -0
- package/lib/core-components.cjs +53 -54
- package/lib/ele-dialog/index.cjs +13 -13
- package/lib/ele-dialog/index.d.ts +2 -2
- package/lib/ele-dialog/props.cjs +4 -4
- package/lib/ele-dialog/props.d.ts +3 -3
- package/lib/ele-dialog/util.cjs +93 -101
- package/lib/ele-dialog/util.d.ts +8 -8
- package/lib/style/plus.scss +2 -0
- package/lib/style/themes/default.scss +26 -0
- package/package.json +1 -1
- package/typings/global.d.ts +0 -1
- package/es/ele-modal/index.d.ts +0 -245
- package/es/ele-modal/index.js +0 -342
- package/es/ele-modal/props.d.ts +0 -135
- package/es/ele-modal/props.js +0 -71
- package/es/ele-modal/style/css-var.scss +0 -8
- package/es/ele-modal/style/index.d.ts +0 -1
- package/es/ele-modal/style/index.js +0 -3
- package/es/ele-modal/style/index.scss +0 -259
- package/es/ele-modal/types.d.ts +0 -43
- package/es/ele-modal/util.d.ts +0 -52
- package/es/ele-modal/util.js +0 -301
- package/lib/ele-modal/index.cjs +0 -341
- package/lib/ele-modal/index.d.ts +0 -245
- package/lib/ele-modal/props.cjs +0 -71
- package/lib/ele-modal/props.d.ts +0 -135
- package/lib/ele-modal/style/css-var.scss +0 -8
- package/lib/ele-modal/style/index.cjs +0 -4
- package/lib/ele-modal/style/index.d.ts +0 -1
- package/lib/ele-modal/style/index.scss +0 -259
- package/lib/ele-modal/types.d.ts +0 -43
- package/lib/ele-modal/util.cjs +0 -301
- package/lib/ele-modal/util.d.ts +0 -52
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
@use '../../style/themes/default.scss' as *;
|
|
2
|
-
@use '../../style/util.scss' as *;
|
|
3
|
-
@use './css-var.scss' as *;
|
|
4
|
-
|
|
5
|
-
@include set-dialog-var($ele);
|
|
6
|
-
|
|
7
|
-
.ele-dialog {
|
|
8
|
-
&.el-overlay {
|
|
9
|
-
height: auto;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
& > .el-overlay-dialog {
|
|
13
|
-
position: absolute;
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
justify-content: flex-start;
|
|
17
|
-
align-items: center;
|
|
18
|
-
|
|
19
|
-
& > .el-dialog {
|
|
20
|
-
padding: 0;
|
|
21
|
-
flex-shrink: 0;
|
|
22
|
-
position: relative;
|
|
23
|
-
background: eleVar('modal', 'bg');
|
|
24
|
-
border-radius: eleVar('modal', 'radius');
|
|
25
|
-
margin-bottom: eleVar('modal', 'mobile-space');
|
|
26
|
-
|
|
27
|
-
// 让 model 外层不出现滚动条
|
|
28
|
-
position: absolute!important;
|
|
29
|
-
left: 50%;
|
|
30
|
-
top: 50%;
|
|
31
|
-
margin-top: 0!important;
|
|
32
|
-
transform: translate(-50%,-50%);
|
|
33
|
-
max-height: calc(100% - 30px);
|
|
34
|
-
max-width: calc(100% - 30px);
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
|
|
38
|
-
& > .el-dialog__header,
|
|
39
|
-
& > .el-dialog__footer {
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
border: none;
|
|
42
|
-
padding: 0;
|
|
43
|
-
margin: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
& > .el-dialog__body {
|
|
47
|
-
padding: 0;
|
|
48
|
-
color: inherit;
|
|
49
|
-
font-size: inherit;
|
|
50
|
-
|
|
51
|
-
overflow: scroll;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* header */
|
|
58
|
-
.ele-dialog-header {
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
box-sizing: border-box;
|
|
62
|
-
padding: eleVar('modal', 'header-padding');
|
|
63
|
-
border-bottom: eleVar('modal', 'header-border');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.ele-dialog-title {
|
|
67
|
-
flex: 1;
|
|
68
|
-
color: eleVar('modal', 'header-color');
|
|
69
|
-
font-size: eleVar('modal', 'header-font-size');
|
|
70
|
-
line-height: eleVar('modal', 'header-line-height');
|
|
71
|
-
font-weight: eleVar('modal', 'header-font-weight');
|
|
72
|
-
box-sizing: border-box;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* 图标按钮 */
|
|
76
|
-
.ele-dialog-tool {
|
|
77
|
-
flex-shrink: 0;
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
width: eleVar('modal', 'icon-size');
|
|
82
|
-
height: eleVar('modal', 'icon-size');
|
|
83
|
-
line-height: eleVar('modal', 'icon-size');
|
|
84
|
-
color: eleVar('modal', 'icon-color');
|
|
85
|
-
font-size: eleVar('modal', 'icon-font-size');
|
|
86
|
-
border-radius: eleVar('modal', 'icon-radius');
|
|
87
|
-
transition: (color $transition-base, background-color $transition-base);
|
|
88
|
-
box-sizing: border-box;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
|
|
91
|
-
&:hover {
|
|
92
|
-
color: eleVar('modal', 'icon-hover-color');
|
|
93
|
-
background: eleVar('modal', 'icon-hover-bg');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
& + .ele-dialog-tool {
|
|
97
|
-
margin-left: eleVar('modal', 'icon-space');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* body */
|
|
102
|
-
.ele-dialog-body {
|
|
103
|
-
padding: eleVar('modal', 'body-padding');
|
|
104
|
-
box-sizing: border-box;
|
|
105
|
-
|
|
106
|
-
&.is-form {
|
|
107
|
-
padding: eleVar('modal', 'form-body-padding');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/* footer */
|
|
112
|
-
.ele-dialog-footer {
|
|
113
|
-
padding: eleVar('modal', 'footer-padding');
|
|
114
|
-
border-top: eleVar('modal', 'footer-border');
|
|
115
|
-
box-sizing: border-box;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* 默认位置 */
|
|
119
|
-
.ele-dialog-top > .el-overlay-dialog > .el-dialog {
|
|
120
|
-
margin: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.ele-dialog-center > .el-overlay-dialog > .el-dialog {
|
|
124
|
-
margin: auto;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.ele-dialog-bottom > .el-overlay-dialog > .el-dialog {
|
|
128
|
-
margin: auto auto 0 auto;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.ele-dialog-left > .el-overlay-dialog > .el-dialog {
|
|
132
|
-
margin: auto auto auto 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.ele-dialog-right > .el-overlay-dialog > .el-dialog {
|
|
136
|
-
margin: auto 0 auto auto;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.ele-dialog-left-top > .el-overlay-dialog > .el-dialog {
|
|
140
|
-
margin: 0 auto 0 0;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.ele-dialog-left-bottom > .el-overlay-dialog > .el-dialog {
|
|
144
|
-
margin: auto auto 0 0;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.ele-dialog-right-top > .el-overlay-dialog > .el-dialog {
|
|
148
|
-
margin: 0 0 0 auto;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.ele-dialog-right-bottom > .el-overlay-dialog > .el-dialog {
|
|
152
|
-
margin: auto 0 0 auto;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/* 支持拖拽 */
|
|
156
|
-
.ele-dialog-movable > .el-overlay-dialog > .el-dialog > .el-dialog__header {
|
|
157
|
-
cursor: move;
|
|
158
|
-
user-select: none;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/* 支持拉伸 */
|
|
162
|
-
.ele-dialog-resize-icon {
|
|
163
|
-
position: absolute;
|
|
164
|
-
right: 2px;
|
|
165
|
-
bottom: 2px;
|
|
166
|
-
display: flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
justify-content: center;
|
|
169
|
-
color: eleVar('modal', 'icon-color');
|
|
170
|
-
font-size: 12px;
|
|
171
|
-
cursor: se-resize;
|
|
172
|
-
|
|
173
|
-
&.is-horizontal {
|
|
174
|
-
cursor: e-resize;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&.is-vertical {
|
|
178
|
-
cursor: s-resize;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.ele-dialog-resizable > .el-overlay-dialog > .el-dialog,
|
|
183
|
-
.ele-dialog-fullscreen > .el-overlay-dialog > .el-dialog {
|
|
184
|
-
display: flex;
|
|
185
|
-
flex-direction: column;
|
|
186
|
-
|
|
187
|
-
& > .el-dialog__body {
|
|
188
|
-
flex: auto;
|
|
189
|
-
overflow: auto;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* 全屏 */
|
|
194
|
-
.ele-dialog-fullscreen > .el-overlay-dialog > .el-dialog {
|
|
195
|
-
top: 0 !important;
|
|
196
|
-
left: 0 !important;
|
|
197
|
-
margin: 0 !important;
|
|
198
|
-
width: 100% !important;
|
|
199
|
-
height: 100% !important;
|
|
200
|
-
display: flex !important;
|
|
201
|
-
max-width: none !important;
|
|
202
|
-
min-width: auto !important;
|
|
203
|
-
max-height: none !important;
|
|
204
|
-
min-height: auto !important;
|
|
205
|
-
border-radius: 0 !important;
|
|
206
|
-
|
|
207
|
-
& > .el-dialog__header {
|
|
208
|
-
cursor: default;
|
|
209
|
-
|
|
210
|
-
& > .ele-dialog-resize-icon {
|
|
211
|
-
display: none;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/* 同时打开多个 */
|
|
217
|
-
.ele-dialog-container {
|
|
218
|
-
position: absolute;
|
|
219
|
-
top: 0;
|
|
220
|
-
left: 0;
|
|
221
|
-
right: 0;
|
|
222
|
-
bottom: 0;
|
|
223
|
-
width: 100%;
|
|
224
|
-
height: 100%;
|
|
225
|
-
pointer-events: none;
|
|
226
|
-
box-sizing: border-box;
|
|
227
|
-
z-index: elVar('index', 'popper');
|
|
228
|
-
overflow: hidden;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.ele-dialog-multiple {
|
|
232
|
-
pointer-events: none !important;
|
|
233
|
-
position: absolute !important;
|
|
234
|
-
|
|
235
|
-
& > .el-overlay-dialog {
|
|
236
|
-
pointer-events: none;
|
|
237
|
-
overflow: hidden;
|
|
238
|
-
|
|
239
|
-
& > .el-dialog {
|
|
240
|
-
pointer-events: auto;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* 失活状态 */
|
|
246
|
-
.ele-dialog-hide {
|
|
247
|
-
display: none !important;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/* 最大宽度适应屏幕 */
|
|
251
|
-
.ele-dialog-responsive > .el-overlay-dialog > .el-dialog {
|
|
252
|
-
max-width: calc(100% - #{eleVar('modal', 'mobile-space')} * 2);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/* 限制在主体区域 */
|
|
256
|
-
.ele-admin-modals > .ele-dialog {
|
|
257
|
-
pointer-events: auto;
|
|
258
|
-
position: absolute !important;
|
|
259
|
-
}
|
package/lib/ele-modal/types.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 拉伸类型
|
|
3
|
-
*/
|
|
4
|
-
export type Resizable = boolean | 'horizontal' | 'vertical';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 拖出边界字符类型
|
|
8
|
-
*/
|
|
9
|
-
export type MoveOutValue = 'top' | 'left' | 'right' | 'bottom';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 拖出边界类型
|
|
13
|
-
*/
|
|
14
|
-
export type MoveOut = boolean | MoveOutValue[];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 初始位置对象类型
|
|
18
|
-
*/
|
|
19
|
-
export interface PositionObject {
|
|
20
|
-
top?: string | number;
|
|
21
|
-
left?: string | number;
|
|
22
|
-
bottom?: string | number;
|
|
23
|
-
right?: string | number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 初始位置字符类型
|
|
28
|
-
*/
|
|
29
|
-
export type PositionValue =
|
|
30
|
-
| 'top'
|
|
31
|
-
| 'bottom'
|
|
32
|
-
| 'left'
|
|
33
|
-
| 'right'
|
|
34
|
-
| 'leftTop'
|
|
35
|
-
| 'leftBottom'
|
|
36
|
-
| 'rightTop'
|
|
37
|
-
| 'rightBottom'
|
|
38
|
-
| 'center';
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 初始位置类型
|
|
42
|
-
*/
|
|
43
|
-
export type Position = PositionValue | PositionObject;
|
package/lib/ele-modal/util.cjs
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const core = require("../utils/core");
|
|
5
|
-
const hook = require("../utils/hook");
|
|
6
|
-
const containerClass = "ele-dialog-container";
|
|
7
|
-
const wrapperClass = "ele-dialog";
|
|
8
|
-
const closedClass = "ele-dialog-closed";
|
|
9
|
-
const fixTop = 0.65;
|
|
10
|
-
const fixLeft = 0.65;
|
|
11
|
-
function getModalEl(dialogRef) {
|
|
12
|
-
var _a, _b;
|
|
13
|
-
const el = (_b = vue.unref((_a = vue.unref(dialogRef)) == null ? void 0 : _a.dialogContentRef)) == null ? void 0 : _b.$el;
|
|
14
|
-
return el;
|
|
15
|
-
}
|
|
16
|
-
function initModalStyle(modalEl) {
|
|
17
|
-
modalEl.style.top = modalEl.offsetTop + "px";
|
|
18
|
-
modalEl.style.left = modalEl.offsetLeft + "px";
|
|
19
|
-
modalEl.style.right = "auto";
|
|
20
|
-
modalEl.style.bottom = "auto";
|
|
21
|
-
modalEl.style.position = "absolute";
|
|
22
|
-
modalEl.style.margin = "0";
|
|
23
|
-
}
|
|
24
|
-
function canMoveOut(moveOut, direction) {
|
|
25
|
-
if (direction && moveOut != null && Array.isArray(moveOut)) {
|
|
26
|
-
return moveOut.includes(direction);
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
function getDialogContainer(inner, multiple, appendTo, modalsEl) {
|
|
31
|
-
if (multiple) {
|
|
32
|
-
const parent = (inner ? modalsEl : void 0) || document.body;
|
|
33
|
-
const wrapper = core.queryChild(parent, containerClass);
|
|
34
|
-
if (wrapper) {
|
|
35
|
-
return wrapper;
|
|
36
|
-
}
|
|
37
|
-
const elem = document.createElement("div");
|
|
38
|
-
elem.classList.add(containerClass);
|
|
39
|
-
parent.appendChild(elem);
|
|
40
|
-
return elem;
|
|
41
|
-
}
|
|
42
|
-
if (inner && modalsEl) {
|
|
43
|
-
return modalsEl;
|
|
44
|
-
}
|
|
45
|
-
return appendTo || "body";
|
|
46
|
-
}
|
|
47
|
-
function useModalMove(dialogRef, props, isFullscreen) {
|
|
48
|
-
let modalEl = null;
|
|
49
|
-
let wrapEl = null;
|
|
50
|
-
let downOL = null;
|
|
51
|
-
let downOT = null;
|
|
52
|
-
const { handleMousedown, handleTouchstart } = hook.useMoveEvent({
|
|
53
|
-
start: () => {
|
|
54
|
-
modalEl = getModalEl(dialogRef);
|
|
55
|
-
wrapEl = modalEl == null ? void 0 : modalEl.parentElement;
|
|
56
|
-
if (!modalEl || !wrapEl || !props.draggable || isFullscreen.value) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
modalEl.style.userSelect = "none";
|
|
60
|
-
initModalStyle(modalEl);
|
|
61
|
-
downOL = modalEl.offsetLeft;
|
|
62
|
-
downOT = modalEl.offsetTop;
|
|
63
|
-
},
|
|
64
|
-
move: ({ distanceX, distanceY, e }) => {
|
|
65
|
-
if (!modalEl || !wrapEl || downOL == null || downOT == null || distanceX == null || distanceY == null) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
let positionLeft = distanceX + downOL;
|
|
70
|
-
let positionTop = distanceY + downOT;
|
|
71
|
-
const limitL = wrapEl.clientWidth - modalEl.clientWidth - fixLeft;
|
|
72
|
-
const limitT = wrapEl.clientHeight - modalEl.clientHeight - fixTop;
|
|
73
|
-
if (!props.moveOut) {
|
|
74
|
-
if (positionLeft < 0) {
|
|
75
|
-
positionLeft = 0;
|
|
76
|
-
} else if (positionLeft > limitL) {
|
|
77
|
-
positionLeft = limitL;
|
|
78
|
-
}
|
|
79
|
-
if (positionTop > limitT) {
|
|
80
|
-
positionTop = limitT;
|
|
81
|
-
}
|
|
82
|
-
if (positionTop < 0) {
|
|
83
|
-
positionTop = 0;
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
if (!canMoveOut(props.moveOut, "left") && positionLeft < 0) {
|
|
87
|
-
positionLeft = 0;
|
|
88
|
-
}
|
|
89
|
-
if (!canMoveOut(props.moveOut, "right") && positionLeft > limitL) {
|
|
90
|
-
positionLeft = limitL;
|
|
91
|
-
}
|
|
92
|
-
if (!canMoveOut(props.moveOut, "bottom") && positionTop > limitT) {
|
|
93
|
-
positionTop = limitT;
|
|
94
|
-
}
|
|
95
|
-
if (!canMoveOut(props.moveOut, "top") && positionTop < 0) {
|
|
96
|
-
positionTop = 0;
|
|
97
|
-
}
|
|
98
|
-
const minLimitL = wrapEl.clientWidth - 48;
|
|
99
|
-
if (positionLeft > minLimitL) {
|
|
100
|
-
positionLeft = minLimitL;
|
|
101
|
-
}
|
|
102
|
-
const minLimitT = wrapEl.clientHeight - 48;
|
|
103
|
-
if (props.multiple && positionTop > minLimitT) {
|
|
104
|
-
positionTop = minLimitT;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
modalEl.style.left = `${Math.floor(positionLeft)}px`;
|
|
108
|
-
modalEl.style.top = `${Math.floor(positionTop)}px`;
|
|
109
|
-
},
|
|
110
|
-
end: () => {
|
|
111
|
-
if (modalEl) {
|
|
112
|
-
modalEl.style.userSelect = "";
|
|
113
|
-
}
|
|
114
|
-
downOL = null;
|
|
115
|
-
downOT = null;
|
|
116
|
-
modalEl = null;
|
|
117
|
-
wrapEl = null;
|
|
118
|
-
},
|
|
119
|
-
touchmoveOptions: { passive: false }
|
|
120
|
-
});
|
|
121
|
-
return {
|
|
122
|
-
handleHeaderMousedown: handleMousedown,
|
|
123
|
-
handleHeaderTouchstart: handleTouchstart
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function useModalResize(dialogRef, props, isFullscreen) {
|
|
127
|
-
let modalEl = null;
|
|
128
|
-
let wrapEl = null;
|
|
129
|
-
let downW = null;
|
|
130
|
-
let downH = null;
|
|
131
|
-
const { handleMousedown, handleTouchstart } = hook.useMoveEvent({
|
|
132
|
-
start: () => {
|
|
133
|
-
modalEl = getModalEl(dialogRef);
|
|
134
|
-
wrapEl = modalEl == null ? void 0 : modalEl.parentElement;
|
|
135
|
-
if (!modalEl || !wrapEl || !props.resizable || isFullscreen.value) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
modalEl.style.userSelect = "none";
|
|
139
|
-
initModalStyle(modalEl);
|
|
140
|
-
downW = modalEl.clientWidth;
|
|
141
|
-
downH = modalEl.clientHeight;
|
|
142
|
-
},
|
|
143
|
-
move: ({ distanceX, distanceY, e }) => {
|
|
144
|
-
if (!modalEl || !wrapEl || downW == null || downH == null || distanceX == null || distanceY == null) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
e.preventDefault();
|
|
148
|
-
if (props.resizable !== "vertical") {
|
|
149
|
-
const w = distanceX + downW;
|
|
150
|
-
const maxW = wrapEl.clientWidth - modalEl.offsetLeft - fixLeft;
|
|
151
|
-
const nw = (w < props.minWidth ? props.minWidth : !canMoveOut(props.moveOut, "right") && w > maxW ? maxW : w) + "px";
|
|
152
|
-
modalEl.style.width = nw;
|
|
153
|
-
modalEl.style.maxWidth = nw;
|
|
154
|
-
modalEl.style.minWidth = nw;
|
|
155
|
-
}
|
|
156
|
-
if (props.resizable !== "horizontal") {
|
|
157
|
-
const h = distanceY + downH;
|
|
158
|
-
const maxH = wrapEl.clientHeight - modalEl.offsetTop - fixTop;
|
|
159
|
-
const nh = (h < props.minHeight ? props.minHeight : !canMoveOut(props.moveOut, "bottom") && h > maxH ? maxH : h) + "px";
|
|
160
|
-
modalEl.style.height = nh;
|
|
161
|
-
modalEl.style.maxHeight = nh;
|
|
162
|
-
modalEl.style.minHeight = nh;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
end: () => {
|
|
166
|
-
if (modalEl) {
|
|
167
|
-
modalEl.style.userSelect = "";
|
|
168
|
-
}
|
|
169
|
-
downW = null;
|
|
170
|
-
downH = null;
|
|
171
|
-
modalEl = null;
|
|
172
|
-
wrapEl = null;
|
|
173
|
-
},
|
|
174
|
-
touchmoveOptions: { passive: false }
|
|
175
|
-
});
|
|
176
|
-
return {
|
|
177
|
-
handleResizeMousedown: handleMousedown,
|
|
178
|
-
handleResizeTouchstart: handleTouchstart
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function useModalEvent(dialogRef, props, isFullscreen) {
|
|
182
|
-
const { handleHeaderMousedown, handleHeaderTouchstart } = useModalMove(
|
|
183
|
-
dialogRef,
|
|
184
|
-
props,
|
|
185
|
-
isFullscreen
|
|
186
|
-
);
|
|
187
|
-
const { handleResizeMousedown, handleResizeTouchstart } = useModalResize(
|
|
188
|
-
dialogRef,
|
|
189
|
-
props,
|
|
190
|
-
isFullscreen
|
|
191
|
-
);
|
|
192
|
-
let isInitPosition = true;
|
|
193
|
-
const getZIndex = () => {
|
|
194
|
-
return props.zIndex ?? 2e3;
|
|
195
|
-
};
|
|
196
|
-
const topModal = (el) => {
|
|
197
|
-
var _a;
|
|
198
|
-
const modalEl = el ?? getModalEl(dialogRef);
|
|
199
|
-
const overlayEl = (_a = modalEl == null ? void 0 : modalEl.parentElement) == null ? void 0 : _a.parentElement;
|
|
200
|
-
if (!overlayEl) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const currentIndex = core.getCurrentStyle(overlayEl).zIndex;
|
|
204
|
-
const containerEl = overlayEl.parentElement;
|
|
205
|
-
const cls = `.${wrapperClass}:not(.${closedClass})`;
|
|
206
|
-
const modals = containerEl ? containerEl.querySelectorAll(cls) : void 0;
|
|
207
|
-
let maxIndex = 0;
|
|
208
|
-
(modals ? Array.from(modals) : []).forEach((modalEl2) => {
|
|
209
|
-
const zIndex = core.getCurrentStyle(modalEl2).zIndex;
|
|
210
|
-
if (zIndex != null) {
|
|
211
|
-
const index = Number(zIndex);
|
|
212
|
-
if (index >= maxIndex && (!overlayEl || modalEl2 !== overlayEl)) {
|
|
213
|
-
maxIndex = index + 1;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
if (maxIndex > Number(currentIndex || getZIndex() || 0)) {
|
|
218
|
-
overlayEl.style.zIndex = String(maxIndex);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
const mousedownListener = (event) => {
|
|
222
|
-
if (props.multiple) {
|
|
223
|
-
topModal(event.currentTarget);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
const bindAutoTopEvent = () => {
|
|
227
|
-
const modalEl = getModalEl(dialogRef);
|
|
228
|
-
if (modalEl) {
|
|
229
|
-
modalEl.addEventListener("mousedown", mousedownListener);
|
|
230
|
-
modalEl.addEventListener("touchstart", mousedownListener);
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
const unbindAutoTopEvent = () => {
|
|
234
|
-
const modalEl = getModalEl(dialogRef);
|
|
235
|
-
if (modalEl) {
|
|
236
|
-
modalEl.removeEventListener("mousedown", mousedownListener);
|
|
237
|
-
modalEl.removeEventListener("touchstart", mousedownListener);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
const getPositionMargin = (position) => {
|
|
241
|
-
if (position == null || typeof position !== "object" || position.top == null && position.right == null && position.bottom == null && position.left == null) {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
return [position.top, position.right, position.bottom, position.left].map((p) => typeof p === "number" ? `${p}px` : p || "auto").join(" ");
|
|
245
|
-
};
|
|
246
|
-
const getPosition = () => {
|
|
247
|
-
if (props.alignCenter) {
|
|
248
|
-
return "center";
|
|
249
|
-
}
|
|
250
|
-
if (props.top != null && props.top !== "") {
|
|
251
|
-
return { top: props.top };
|
|
252
|
-
}
|
|
253
|
-
return props.position;
|
|
254
|
-
};
|
|
255
|
-
const setInitPosition = () => {
|
|
256
|
-
if (isInitPosition) {
|
|
257
|
-
isInitPosition = false;
|
|
258
|
-
const modalEl = getModalEl(dialogRef);
|
|
259
|
-
const margin = getPositionMargin(getPosition());
|
|
260
|
-
if (modalEl && margin != null) {
|
|
261
|
-
modalEl.style.margin = margin;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
const resetModalStyle = () => {
|
|
266
|
-
const modalEl = getModalEl(dialogRef);
|
|
267
|
-
if (modalEl) {
|
|
268
|
-
const w = props.width;
|
|
269
|
-
modalEl.style.margin = getPositionMargin(getPosition()) || "";
|
|
270
|
-
modalEl.style.position = "";
|
|
271
|
-
modalEl.style.top = "";
|
|
272
|
-
modalEl.style.left = "";
|
|
273
|
-
modalEl.style.right = "";
|
|
274
|
-
modalEl.style.bottom = "";
|
|
275
|
-
modalEl.style.height = "";
|
|
276
|
-
modalEl.style.maxHeight = "";
|
|
277
|
-
modalEl.style.minHeight = "";
|
|
278
|
-
modalEl.style.width = typeof w === "number" ? `${w}px` : w ?? "";
|
|
279
|
-
modalEl.style.maxWidth = "";
|
|
280
|
-
modalEl.style.minWidth = "";
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
return {
|
|
284
|
-
handleHeaderMousedown,
|
|
285
|
-
handleHeaderTouchstart,
|
|
286
|
-
handleResizeMousedown,
|
|
287
|
-
handleResizeTouchstart,
|
|
288
|
-
bindAutoTopEvent,
|
|
289
|
-
unbindAutoTopEvent,
|
|
290
|
-
topModal,
|
|
291
|
-
setInitPosition,
|
|
292
|
-
resetModalStyle
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
exports.closedClass = closedClass;
|
|
296
|
-
exports.containerClass = containerClass;
|
|
297
|
-
exports.getDialogContainer = getDialogContainer;
|
|
298
|
-
exports.useModalEvent = useModalEvent;
|
|
299
|
-
exports.useModalMove = useModalMove;
|
|
300
|
-
exports.useModalResize = useModalResize;
|
|
301
|
-
exports.wrapperClass = wrapperClass;
|
package/lib/ele-modal/util.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { ElDialogInstance } from '../ele-app/el';
|
|
3
|
-
import { ModalProps } from './props';
|
|
4
|
-
|
|
5
|
-
export declare const containerClass = "ele-dialog-container";
|
|
6
|
-
export declare const wrapperClass = "ele-dialog";
|
|
7
|
-
export declare const closedClass = "ele-dialog-closed";
|
|
8
|
-
/**
|
|
9
|
-
* 获取弹窗容器
|
|
10
|
-
* @param inner 是否限制在主体内部
|
|
11
|
-
* @param multiple 是否支持同时打开多个
|
|
12
|
-
* @param appendTo 自定义插入的容器
|
|
13
|
-
* @param modalsEl 限制在主体内部时的容器
|
|
14
|
-
*/
|
|
15
|
-
export declare function getDialogContainer(inner?: boolean, multiple?: boolean, appendTo?: string | HTMLElement, modalsEl?: HTMLElement | null): HTMLElement | string;
|
|
16
|
-
/**
|
|
17
|
-
* 弹窗支持移动
|
|
18
|
-
* @param dialogRef 弹窗实例
|
|
19
|
-
* @param props 属性
|
|
20
|
-
* @param isFullscreen 全屏状态
|
|
21
|
-
*/
|
|
22
|
-
export declare function useModalMove(dialogRef: Ref<ElDialogInstance>, props: ModalProps, isFullscreen: Ref<boolean>): {
|
|
23
|
-
handleHeaderMousedown: (e: MouseEvent) => void;
|
|
24
|
-
handleHeaderTouchstart: (e: TouchEvent) => void;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* 弹窗支持拉伸
|
|
28
|
-
* @param dialogRef 弹窗实例
|
|
29
|
-
* @param props 属性
|
|
30
|
-
* @param isFullscreen 全屏状态
|
|
31
|
-
*/
|
|
32
|
-
export declare function useModalResize(dialogRef: Ref<ElDialogInstance>, props: ModalProps, isFullscreen: Ref<boolean>): {
|
|
33
|
-
handleResizeMousedown: (e: MouseEvent) => void;
|
|
34
|
-
handleResizeTouchstart: (e: TouchEvent) => void;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* 弹窗事件处理
|
|
38
|
-
* @param dialogRef 弹窗实例
|
|
39
|
-
* @param props 属性
|
|
40
|
-
* @param isFullscreen 全屏状态
|
|
41
|
-
*/
|
|
42
|
-
export declare function useModalEvent(dialogRef: Ref<ElDialogInstance>, props: ModalProps, isFullscreen: Ref<boolean>): {
|
|
43
|
-
handleHeaderMousedown: (e: MouseEvent) => void;
|
|
44
|
-
handleHeaderTouchstart: (e: TouchEvent) => void;
|
|
45
|
-
handleResizeMousedown: (e: MouseEvent) => void;
|
|
46
|
-
handleResizeTouchstart: (e: TouchEvent) => void;
|
|
47
|
-
bindAutoTopEvent: () => void;
|
|
48
|
-
unbindAutoTopEvent: () => void;
|
|
49
|
-
topModal: (el?: HTMLElement) => void;
|
|
50
|
-
setInitPosition: () => void;
|
|
51
|
-
resetModalStyle: () => void;
|
|
52
|
-
};
|