yuang-framework-ui-pc 1.1.11 → 1.1.12
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/ele-dialog/index.d.ts +245 -0
- package/es/ele-dialog/index.js +342 -0
- package/es/ele-dialog/props.d.ts +135 -0
- package/es/ele-dialog/props.js +71 -0
- package/es/ele-dialog/style/css-var.scss +8 -0
- package/es/ele-dialog/style/index.d.ts +1 -0
- package/es/ele-dialog/style/index.js +3 -0
- package/es/ele-dialog/style/index.scss +259 -0
- package/es/ele-dialog/types.d.ts +43 -0
- package/es/ele-dialog/util.d.ts +52 -0
- package/es/ele-dialog/util.js +301 -0
- package/lib/ele-dialog/index.cjs +341 -0
- package/lib/ele-dialog/index.d.ts +245 -0
- package/lib/ele-dialog/props.cjs +71 -0
- package/lib/ele-dialog/props.d.ts +135 -0
- package/lib/ele-dialog/style/css-var.scss +8 -0
- package/lib/ele-dialog/style/index.cjs +4 -0
- package/lib/ele-dialog/style/index.d.ts +1 -0
- package/lib/ele-dialog/style/index.scss +259 -0
- package/lib/ele-dialog/types.d.ts +43 -0
- package/lib/ele-dialog/util.cjs +301 -0
- package/lib/ele-dialog/util.d.ts +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { unref } from "vue";
|
|
2
|
+
import { queryChild, getCurrentStyle } from "../utils/core";
|
|
3
|
+
import { useMoveEvent } from "../utils/hook";
|
|
4
|
+
const containerClass = "ele-modal-container";
|
|
5
|
+
const wrapperClass = "ele-modal";
|
|
6
|
+
const closedClass = "ele-modal-closed";
|
|
7
|
+
const fixTop = 0.65;
|
|
8
|
+
const fixLeft = 0.65;
|
|
9
|
+
function getModalEl(dialogRef) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const el = (_b = unref((_a = unref(dialogRef)) == null ? void 0 : _a.dialogContentRef)) == null ? void 0 : _b.$el;
|
|
12
|
+
return el;
|
|
13
|
+
}
|
|
14
|
+
function initModalStyle(modalEl) {
|
|
15
|
+
modalEl.style.top = modalEl.offsetTop + "px";
|
|
16
|
+
modalEl.style.left = modalEl.offsetLeft + "px";
|
|
17
|
+
modalEl.style.right = "auto";
|
|
18
|
+
modalEl.style.bottom = "auto";
|
|
19
|
+
modalEl.style.position = "absolute";
|
|
20
|
+
modalEl.style.margin = "0";
|
|
21
|
+
}
|
|
22
|
+
function canMoveOut(moveOut, direction) {
|
|
23
|
+
if (direction && moveOut != null && Array.isArray(moveOut)) {
|
|
24
|
+
return moveOut.includes(direction);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
function getModalContainer(inner, multiple, appendTo, modalsEl) {
|
|
29
|
+
if (multiple) {
|
|
30
|
+
const parent = (inner ? modalsEl : void 0) || document.body;
|
|
31
|
+
const wrapper = queryChild(parent, containerClass);
|
|
32
|
+
if (wrapper) {
|
|
33
|
+
return wrapper;
|
|
34
|
+
}
|
|
35
|
+
const elem = document.createElement("div");
|
|
36
|
+
elem.classList.add(containerClass);
|
|
37
|
+
parent.appendChild(elem);
|
|
38
|
+
return elem;
|
|
39
|
+
}
|
|
40
|
+
if (inner && modalsEl) {
|
|
41
|
+
return modalsEl;
|
|
42
|
+
}
|
|
43
|
+
return appendTo || "body";
|
|
44
|
+
}
|
|
45
|
+
function useModalMove(dialogRef, props, isFullscreen) {
|
|
46
|
+
let modalEl = null;
|
|
47
|
+
let wrapEl = null;
|
|
48
|
+
let downOL = null;
|
|
49
|
+
let downOT = null;
|
|
50
|
+
const { handleMousedown, handleTouchstart } = useMoveEvent({
|
|
51
|
+
start: () => {
|
|
52
|
+
modalEl = getModalEl(dialogRef);
|
|
53
|
+
wrapEl = modalEl == null ? void 0 : modalEl.parentElement;
|
|
54
|
+
if (!modalEl || !wrapEl || !props.draggable || isFullscreen.value) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
modalEl.style.userSelect = "none";
|
|
58
|
+
initModalStyle(modalEl);
|
|
59
|
+
downOL = modalEl.offsetLeft;
|
|
60
|
+
downOT = modalEl.offsetTop;
|
|
61
|
+
},
|
|
62
|
+
move: ({ distanceX, distanceY, e }) => {
|
|
63
|
+
if (!modalEl || !wrapEl || downOL == null || downOT == null || distanceX == null || distanceY == null) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
let positionLeft = distanceX + downOL;
|
|
68
|
+
let positionTop = distanceY + downOT;
|
|
69
|
+
const limitL = wrapEl.clientWidth - modalEl.clientWidth - fixLeft;
|
|
70
|
+
const limitT = wrapEl.clientHeight - modalEl.clientHeight - fixTop;
|
|
71
|
+
if (!props.moveOut) {
|
|
72
|
+
if (positionLeft < 0) {
|
|
73
|
+
positionLeft = 0;
|
|
74
|
+
} else if (positionLeft > limitL) {
|
|
75
|
+
positionLeft = limitL;
|
|
76
|
+
}
|
|
77
|
+
if (positionTop > limitT) {
|
|
78
|
+
positionTop = limitT;
|
|
79
|
+
}
|
|
80
|
+
if (positionTop < 0) {
|
|
81
|
+
positionTop = 0;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
if (!canMoveOut(props.moveOut, "left") && positionLeft < 0) {
|
|
85
|
+
positionLeft = 0;
|
|
86
|
+
}
|
|
87
|
+
if (!canMoveOut(props.moveOut, "right") && positionLeft > limitL) {
|
|
88
|
+
positionLeft = limitL;
|
|
89
|
+
}
|
|
90
|
+
if (!canMoveOut(props.moveOut, "bottom") && positionTop > limitT) {
|
|
91
|
+
positionTop = limitT;
|
|
92
|
+
}
|
|
93
|
+
if (!canMoveOut(props.moveOut, "top") && positionTop < 0) {
|
|
94
|
+
positionTop = 0;
|
|
95
|
+
}
|
|
96
|
+
const minLimitL = wrapEl.clientWidth - 48;
|
|
97
|
+
if (positionLeft > minLimitL) {
|
|
98
|
+
positionLeft = minLimitL;
|
|
99
|
+
}
|
|
100
|
+
const minLimitT = wrapEl.clientHeight - 48;
|
|
101
|
+
if (props.multiple && positionTop > minLimitT) {
|
|
102
|
+
positionTop = minLimitT;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
modalEl.style.left = `${Math.floor(positionLeft)}px`;
|
|
106
|
+
modalEl.style.top = `${Math.floor(positionTop)}px`;
|
|
107
|
+
},
|
|
108
|
+
end: () => {
|
|
109
|
+
if (modalEl) {
|
|
110
|
+
modalEl.style.userSelect = "";
|
|
111
|
+
}
|
|
112
|
+
downOL = null;
|
|
113
|
+
downOT = null;
|
|
114
|
+
modalEl = null;
|
|
115
|
+
wrapEl = null;
|
|
116
|
+
},
|
|
117
|
+
touchmoveOptions: { passive: false }
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
handleHeaderMousedown: handleMousedown,
|
|
121
|
+
handleHeaderTouchstart: handleTouchstart
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function useModalResize(dialogRef, props, isFullscreen) {
|
|
125
|
+
let modalEl = null;
|
|
126
|
+
let wrapEl = null;
|
|
127
|
+
let downW = null;
|
|
128
|
+
let downH = null;
|
|
129
|
+
const { handleMousedown, handleTouchstart } = useMoveEvent({
|
|
130
|
+
start: () => {
|
|
131
|
+
modalEl = getModalEl(dialogRef);
|
|
132
|
+
wrapEl = modalEl == null ? void 0 : modalEl.parentElement;
|
|
133
|
+
if (!modalEl || !wrapEl || !props.resizable || isFullscreen.value) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
modalEl.style.userSelect = "none";
|
|
137
|
+
initModalStyle(modalEl);
|
|
138
|
+
downW = modalEl.clientWidth;
|
|
139
|
+
downH = modalEl.clientHeight;
|
|
140
|
+
},
|
|
141
|
+
move: ({ distanceX, distanceY, e }) => {
|
|
142
|
+
if (!modalEl || !wrapEl || downW == null || downH == null || distanceX == null || distanceY == null) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
if (props.resizable !== "vertical") {
|
|
147
|
+
const w = distanceX + downW;
|
|
148
|
+
const maxW = wrapEl.clientWidth - modalEl.offsetLeft - fixLeft;
|
|
149
|
+
const nw = (w < props.minWidth ? props.minWidth : !canMoveOut(props.moveOut, "right") && w > maxW ? maxW : w) + "px";
|
|
150
|
+
modalEl.style.width = nw;
|
|
151
|
+
modalEl.style.maxWidth = nw;
|
|
152
|
+
modalEl.style.minWidth = nw;
|
|
153
|
+
}
|
|
154
|
+
if (props.resizable !== "horizontal") {
|
|
155
|
+
const h = distanceY + downH;
|
|
156
|
+
const maxH = wrapEl.clientHeight - modalEl.offsetTop - fixTop;
|
|
157
|
+
const nh = (h < props.minHeight ? props.minHeight : !canMoveOut(props.moveOut, "bottom") && h > maxH ? maxH : h) + "px";
|
|
158
|
+
modalEl.style.height = nh;
|
|
159
|
+
modalEl.style.maxHeight = nh;
|
|
160
|
+
modalEl.style.minHeight = nh;
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
end: () => {
|
|
164
|
+
if (modalEl) {
|
|
165
|
+
modalEl.style.userSelect = "";
|
|
166
|
+
}
|
|
167
|
+
downW = null;
|
|
168
|
+
downH = null;
|
|
169
|
+
modalEl = null;
|
|
170
|
+
wrapEl = null;
|
|
171
|
+
},
|
|
172
|
+
touchmoveOptions: { passive: false }
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
handleResizeMousedown: handleMousedown,
|
|
176
|
+
handleResizeTouchstart: handleTouchstart
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function useModalEvent(dialogRef, props, isFullscreen) {
|
|
180
|
+
const { handleHeaderMousedown, handleHeaderTouchstart } = useModalMove(
|
|
181
|
+
dialogRef,
|
|
182
|
+
props,
|
|
183
|
+
isFullscreen
|
|
184
|
+
);
|
|
185
|
+
const { handleResizeMousedown, handleResizeTouchstart } = useModalResize(
|
|
186
|
+
dialogRef,
|
|
187
|
+
props,
|
|
188
|
+
isFullscreen
|
|
189
|
+
);
|
|
190
|
+
let isInitPosition = true;
|
|
191
|
+
const getZIndex = () => {
|
|
192
|
+
return props.zIndex ?? 2e3;
|
|
193
|
+
};
|
|
194
|
+
const topModal = (el) => {
|
|
195
|
+
var _a;
|
|
196
|
+
const modalEl = el ?? getModalEl(dialogRef);
|
|
197
|
+
const overlayEl = (_a = modalEl == null ? void 0 : modalEl.parentElement) == null ? void 0 : _a.parentElement;
|
|
198
|
+
if (!overlayEl) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const currentIndex = getCurrentStyle(overlayEl).zIndex;
|
|
202
|
+
const containerEl = overlayEl.parentElement;
|
|
203
|
+
const cls = `.${wrapperClass}:not(.${closedClass})`;
|
|
204
|
+
const modals = containerEl ? containerEl.querySelectorAll(cls) : void 0;
|
|
205
|
+
let maxIndex = 0;
|
|
206
|
+
(modals ? Array.from(modals) : []).forEach((modalEl2) => {
|
|
207
|
+
const zIndex = getCurrentStyle(modalEl2).zIndex;
|
|
208
|
+
if (zIndex != null) {
|
|
209
|
+
const index = Number(zIndex);
|
|
210
|
+
if (index >= maxIndex && (!overlayEl || modalEl2 !== overlayEl)) {
|
|
211
|
+
maxIndex = index + 1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
if (maxIndex > Number(currentIndex || getZIndex() || 0)) {
|
|
216
|
+
overlayEl.style.zIndex = String(maxIndex);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const mousedownListener = (event) => {
|
|
220
|
+
if (props.multiple) {
|
|
221
|
+
topModal(event.currentTarget);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const bindAutoTopEvent = () => {
|
|
225
|
+
const modalEl = getModalEl(dialogRef);
|
|
226
|
+
if (modalEl) {
|
|
227
|
+
modalEl.addEventListener("mousedown", mousedownListener);
|
|
228
|
+
modalEl.addEventListener("touchstart", mousedownListener);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const unbindAutoTopEvent = () => {
|
|
232
|
+
const modalEl = getModalEl(dialogRef);
|
|
233
|
+
if (modalEl) {
|
|
234
|
+
modalEl.removeEventListener("mousedown", mousedownListener);
|
|
235
|
+
modalEl.removeEventListener("touchstart", mousedownListener);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const getPositionMargin = (position) => {
|
|
239
|
+
if (position == null || typeof position !== "object" || position.top == null && position.right == null && position.bottom == null && position.left == null) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
return [position.top, position.right, position.bottom, position.left].map((p) => typeof p === "number" ? `${p}px` : p || "auto").join(" ");
|
|
243
|
+
};
|
|
244
|
+
const getPosition = () => {
|
|
245
|
+
if (props.alignCenter) {
|
|
246
|
+
return "center";
|
|
247
|
+
}
|
|
248
|
+
if (props.top != null && props.top !== "") {
|
|
249
|
+
return { top: props.top };
|
|
250
|
+
}
|
|
251
|
+
return props.position;
|
|
252
|
+
};
|
|
253
|
+
const setInitPosition = () => {
|
|
254
|
+
if (isInitPosition) {
|
|
255
|
+
isInitPosition = false;
|
|
256
|
+
const modalEl = getModalEl(dialogRef);
|
|
257
|
+
const margin = getPositionMargin(getPosition());
|
|
258
|
+
if (modalEl && margin != null) {
|
|
259
|
+
modalEl.style.margin = margin;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const resetModalStyle = () => {
|
|
264
|
+
const modalEl = getModalEl(dialogRef);
|
|
265
|
+
if (modalEl) {
|
|
266
|
+
const w = props.width;
|
|
267
|
+
modalEl.style.margin = getPositionMargin(getPosition()) || "";
|
|
268
|
+
modalEl.style.position = "";
|
|
269
|
+
modalEl.style.top = "";
|
|
270
|
+
modalEl.style.left = "";
|
|
271
|
+
modalEl.style.right = "";
|
|
272
|
+
modalEl.style.bottom = "";
|
|
273
|
+
modalEl.style.height = "";
|
|
274
|
+
modalEl.style.maxHeight = "";
|
|
275
|
+
modalEl.style.minHeight = "";
|
|
276
|
+
modalEl.style.width = typeof w === "number" ? `${w}px` : w ?? "";
|
|
277
|
+
modalEl.style.maxWidth = "";
|
|
278
|
+
modalEl.style.minWidth = "";
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
return {
|
|
282
|
+
handleHeaderMousedown,
|
|
283
|
+
handleHeaderTouchstart,
|
|
284
|
+
handleResizeMousedown,
|
|
285
|
+
handleResizeTouchstart,
|
|
286
|
+
bindAutoTopEvent,
|
|
287
|
+
unbindAutoTopEvent,
|
|
288
|
+
topModal,
|
|
289
|
+
setInitPosition,
|
|
290
|
+
resetModalStyle
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
export {
|
|
294
|
+
closedClass,
|
|
295
|
+
containerClass,
|
|
296
|
+
getModalContainer,
|
|
297
|
+
useModalEvent,
|
|
298
|
+
useModalMove,
|
|
299
|
+
useModalResize,
|
|
300
|
+
wrapperClass
|
|
301
|
+
};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
3
|
+
const elementPlus = require("element-plus");
|
|
4
|
+
const icons = require("../icons");
|
|
5
|
+
const ReceiverView = require("../ele-config-provider/components/receiver-view");
|
|
6
|
+
const util = require("../ele-pro-layout/util");
|
|
7
|
+
const util$1 = require("./util");
|
|
8
|
+
const props = require("./props");
|
|
9
|
+
const _sfc_main = vue.defineComponent({
|
|
10
|
+
name: "EleModal",
|
|
11
|
+
components: {
|
|
12
|
+
ElDialog: elementPlus.ElDialog,
|
|
13
|
+
ElIcon: elementPlus.ElIcon,
|
|
14
|
+
CloseOutlined: icons.CloseOutlined,
|
|
15
|
+
CompressOutlined: icons.CompressOutlined,
|
|
16
|
+
ExpandOutlined: icons.ExpandOutlined,
|
|
17
|
+
ResizeOutlined: icons.ResizeOutlined,
|
|
18
|
+
ReceiverView
|
|
19
|
+
},
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
props: props.modalProps,
|
|
22
|
+
emits: props.modalEmits,
|
|
23
|
+
setup(props2, { emit }) {
|
|
24
|
+
const layoutState = util.useLayoutState();
|
|
25
|
+
const isResponsive = util.useResponsive(props2);
|
|
26
|
+
const dialogRef = vue.ref(null);
|
|
27
|
+
const isFullscreen = vue.ref(props2.fullscreen ?? false);
|
|
28
|
+
const isActivated = vue.ref(true);
|
|
29
|
+
const dialogClass = vue.computed(() => {
|
|
30
|
+
const classes = [util$1.wrapperClass];
|
|
31
|
+
if (props2.responsive ?? isResponsive.value ?? true) {
|
|
32
|
+
classes.push("ele-modal-responsive");
|
|
33
|
+
}
|
|
34
|
+
if (props2.alignCenter || props2.position === "center") {
|
|
35
|
+
classes.push("ele-modal-center");
|
|
36
|
+
} else if (props2.position === "top") {
|
|
37
|
+
classes.push("ele-modal-top");
|
|
38
|
+
} else if (props2.position === "bottom") {
|
|
39
|
+
classes.push("ele-modal-bottom");
|
|
40
|
+
} else if (props2.position === "left") {
|
|
41
|
+
classes.push("ele-modal-left");
|
|
42
|
+
} else if (props2.position === "right") {
|
|
43
|
+
classes.push("ele-modal-right");
|
|
44
|
+
} else if (props2.position === "leftTop") {
|
|
45
|
+
classes.push("ele-modal-left-top");
|
|
46
|
+
} else if (props2.position === "leftBottom") {
|
|
47
|
+
classes.push("ele-modal-left-bottom");
|
|
48
|
+
} else if (props2.position === "rightTop") {
|
|
49
|
+
classes.push("ele-modal-right-top");
|
|
50
|
+
} else if (props2.position === "rightBottom") {
|
|
51
|
+
classes.push("ele-modal-right-bottom");
|
|
52
|
+
}
|
|
53
|
+
if (props2.draggable) {
|
|
54
|
+
classes.push("ele-modal-movable");
|
|
55
|
+
}
|
|
56
|
+
if (props2.resizable) {
|
|
57
|
+
classes.push("ele-modal-resizable");
|
|
58
|
+
}
|
|
59
|
+
if (props2.multiple) {
|
|
60
|
+
classes.push("ele-modal-multiple");
|
|
61
|
+
}
|
|
62
|
+
if (isFullscreen.value) {
|
|
63
|
+
classes.push("ele-modal-fullscreen");
|
|
64
|
+
}
|
|
65
|
+
if (!props2.modelValue) {
|
|
66
|
+
classes.push(util$1.closedClass);
|
|
67
|
+
}
|
|
68
|
+
if (!isActivated.value && props2.modelValue) {
|
|
69
|
+
classes.push("ele-modal-hide");
|
|
70
|
+
}
|
|
71
|
+
if (props2.inner) {
|
|
72
|
+
classes.push("ele-modal-inner");
|
|
73
|
+
}
|
|
74
|
+
if (props2.modalClass) {
|
|
75
|
+
classes.push(props2.modalClass);
|
|
76
|
+
}
|
|
77
|
+
return classes.join(" ");
|
|
78
|
+
});
|
|
79
|
+
const teleportTo = vue.computed(() => {
|
|
80
|
+
return util$1.getModalContainer(
|
|
81
|
+
props2.inner,
|
|
82
|
+
props2.multiple,
|
|
83
|
+
props2.appendTo,
|
|
84
|
+
layoutState.modalsEl
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
const teleportDisabled = vue.computed(() => {
|
|
88
|
+
const appendTo = props2.appendTo || "body";
|
|
89
|
+
const disabled = appendTo === "body" ? !props2.appendToBody : false;
|
|
90
|
+
return props2.multiple || props2.inner ? false : disabled;
|
|
91
|
+
});
|
|
92
|
+
const {
|
|
93
|
+
handleHeaderMousedown,
|
|
94
|
+
handleHeaderTouchstart,
|
|
95
|
+
handleResizeMousedown,
|
|
96
|
+
handleResizeTouchstart,
|
|
97
|
+
bindAutoTopEvent,
|
|
98
|
+
unbindAutoTopEvent,
|
|
99
|
+
topModal,
|
|
100
|
+
setInitPosition,
|
|
101
|
+
resetModalStyle
|
|
102
|
+
} = util$1.useModalEvent(dialogRef, props2, isFullscreen);
|
|
103
|
+
const updateModelValue = (modelValue) => {
|
|
104
|
+
emit("update:modelValue", modelValue);
|
|
105
|
+
};
|
|
106
|
+
const toggleFullscreen = (fullscreen) => {
|
|
107
|
+
isFullscreen.value = fullscreen ?? !isFullscreen.value;
|
|
108
|
+
vue.nextTick(() => {
|
|
109
|
+
topModal();
|
|
110
|
+
});
|
|
111
|
+
emit("update:fullscreen", isFullscreen.value);
|
|
112
|
+
};
|
|
113
|
+
const handleOpen = () => {
|
|
114
|
+
if (props2.resetOnClose || props2.destroyOnClose) {
|
|
115
|
+
isFullscreen.value = props2.fullscreen ?? false;
|
|
116
|
+
}
|
|
117
|
+
vue.nextTick(() => {
|
|
118
|
+
if (props2.resetOnClose) {
|
|
119
|
+
resetModalStyle();
|
|
120
|
+
} else {
|
|
121
|
+
setInitPosition();
|
|
122
|
+
}
|
|
123
|
+
topModal();
|
|
124
|
+
});
|
|
125
|
+
emit("open");
|
|
126
|
+
};
|
|
127
|
+
const handleOpened = () => {
|
|
128
|
+
bindAutoTopEvent();
|
|
129
|
+
emit("opened");
|
|
130
|
+
};
|
|
131
|
+
const handleClose = () => {
|
|
132
|
+
unbindAutoTopEvent();
|
|
133
|
+
emit("close");
|
|
134
|
+
};
|
|
135
|
+
const handleClosed = () => {
|
|
136
|
+
emit("closed");
|
|
137
|
+
};
|
|
138
|
+
const handleOpenAutoFocus = () => {
|
|
139
|
+
emit("openAutoFocus");
|
|
140
|
+
};
|
|
141
|
+
const handleCloseAutoFocus = () => {
|
|
142
|
+
emit("closeAutoFocus");
|
|
143
|
+
};
|
|
144
|
+
vue.watch(
|
|
145
|
+
() => props2.fullscreen,
|
|
146
|
+
(fullscreen) => {
|
|
147
|
+
isFullscreen.value = fullscreen ?? false;
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
vue.onMounted(() => {
|
|
151
|
+
if (props2.modelValue) {
|
|
152
|
+
setInitPosition();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
vue.onActivated(() => {
|
|
156
|
+
isActivated.value = true;
|
|
157
|
+
});
|
|
158
|
+
vue.onDeactivated(() => {
|
|
159
|
+
isActivated.value = false;
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
dialogRef,
|
|
163
|
+
isFullscreen,
|
|
164
|
+
dialogClass,
|
|
165
|
+
teleportTo,
|
|
166
|
+
teleportDisabled,
|
|
167
|
+
handleHeaderMousedown,
|
|
168
|
+
handleHeaderTouchstart,
|
|
169
|
+
handleResizeMousedown,
|
|
170
|
+
handleResizeTouchstart,
|
|
171
|
+
updateModelValue,
|
|
172
|
+
toggleFullscreen,
|
|
173
|
+
handleOpen,
|
|
174
|
+
handleOpened,
|
|
175
|
+
handleClose,
|
|
176
|
+
handleClosed,
|
|
177
|
+
handleOpenAutoFocus,
|
|
178
|
+
handleCloseAutoFocus
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const _export_sfc = (sfc, props2) => {
|
|
183
|
+
const target = sfc.__vccOpts || sfc;
|
|
184
|
+
for (const [key, val] of props2) {
|
|
185
|
+
target[key] = val;
|
|
186
|
+
}
|
|
187
|
+
return target;
|
|
188
|
+
};
|
|
189
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
190
|
+
const _component_CompressOutlined = vue.resolveComponent("CompressOutlined");
|
|
191
|
+
const _component_ExpandOutlined = vue.resolveComponent("ExpandOutlined");
|
|
192
|
+
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
193
|
+
const _component_CloseOutlined = vue.resolveComponent("CloseOutlined");
|
|
194
|
+
const _component_ResizeOutlined = vue.resolveComponent("ResizeOutlined");
|
|
195
|
+
const _component_ReceiverView = vue.resolveComponent("ReceiverView");
|
|
196
|
+
const _component_ElDialog = vue.resolveComponent("ElDialog");
|
|
197
|
+
return vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
198
|
+
to: _ctx.teleportTo,
|
|
199
|
+
disabled: _ctx.teleportDisabled
|
|
200
|
+
}, [
|
|
201
|
+
vue.createVNode(_component_ElDialog, vue.mergeProps(_ctx.$attrs, {
|
|
202
|
+
ref: "dialogRef",
|
|
203
|
+
modelValue: _ctx.modelValue,
|
|
204
|
+
title: _ctx.title,
|
|
205
|
+
width: _ctx.width,
|
|
206
|
+
fullscreen: false,
|
|
207
|
+
modal: _ctx.multiple ? false : _ctx.modal,
|
|
208
|
+
modalClass: _ctx.dialogClass,
|
|
209
|
+
appendToBody: false,
|
|
210
|
+
lockScroll: _ctx.inner || _ctx.multiple ? false : _ctx.lockScroll,
|
|
211
|
+
openDelay: _ctx.openDelay,
|
|
212
|
+
closeDelay: _ctx.closeDelay,
|
|
213
|
+
closeOnClickModal: _ctx.closeOnClickModal,
|
|
214
|
+
closeOnPressEscape: _ctx.closeOnPressEscape,
|
|
215
|
+
showClose: false,
|
|
216
|
+
beforeClose: _ctx.beforeClose,
|
|
217
|
+
draggable: false,
|
|
218
|
+
overflow: false,
|
|
219
|
+
center: _ctx.center,
|
|
220
|
+
alignCenter: false,
|
|
221
|
+
destroyOnClose: _ctx.destroyOnClose,
|
|
222
|
+
zIndex: _ctx.zIndex,
|
|
223
|
+
headerAriaLevel: _ctx.headerAriaLevel,
|
|
224
|
+
"onUpdate:modelValue": _ctx.updateModelValue,
|
|
225
|
+
onOpen: _ctx.handleOpen,
|
|
226
|
+
onOpened: _ctx.handleOpened,
|
|
227
|
+
onClose: _ctx.handleClose,
|
|
228
|
+
onClosed: _ctx.handleClosed,
|
|
229
|
+
onOpenAutoFocus: _ctx.handleOpenAutoFocus,
|
|
230
|
+
onCloseAutoFocus: _ctx.handleCloseAutoFocus
|
|
231
|
+
}), vue.createSlots({
|
|
232
|
+
header: vue.withCtx(({ close, titleId, titleClass }) => [
|
|
233
|
+
vue.createElementVNode("div", {
|
|
234
|
+
style: vue.normalizeStyle(_ctx.headerStyle),
|
|
235
|
+
class: "ele-modal-header",
|
|
236
|
+
onMousedown: _cache[6] || (_cache[6] = (...args) => _ctx.handleHeaderMousedown && _ctx.handleHeaderMousedown(...args)),
|
|
237
|
+
onTouchstart: _cache[7] || (_cache[7] = (...args) => _ctx.handleHeaderTouchstart && _ctx.handleHeaderTouchstart(...args))
|
|
238
|
+
}, [
|
|
239
|
+
vue.createElementVNode("div", {
|
|
240
|
+
class: "ele-modal-title",
|
|
241
|
+
style: vue.normalizeStyle(_ctx.titleStyle)
|
|
242
|
+
}, [
|
|
243
|
+
vue.renderSlot(_ctx.$slots, "header", {
|
|
244
|
+
close,
|
|
245
|
+
titleId,
|
|
246
|
+
titleClass
|
|
247
|
+
}, () => [
|
|
248
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
|
|
249
|
+
])
|
|
250
|
+
], 4),
|
|
251
|
+
_ctx.maxable ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: "ele-modal-tool ele-modal-tool-max",
|
|
254
|
+
style: vue.normalizeStyle(_ctx.fullscreenBtnStyle),
|
|
255
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.toggleFullscreen()),
|
|
256
|
+
onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
257
|
+
}, ["stop"])),
|
|
258
|
+
onTouchstart: _cache[2] || (_cache[2] = vue.withModifiers(() => {
|
|
259
|
+
}, ["stop"]))
|
|
260
|
+
}, [
|
|
261
|
+
vue.renderSlot(_ctx.$slots, "maxIcon", { fullscreen: _ctx.isFullscreen }, () => [
|
|
262
|
+
vue.createVNode(_component_ElIcon, null, {
|
|
263
|
+
default: vue.withCtx(() => [
|
|
264
|
+
_ctx.isFullscreen ? (vue.openBlock(), vue.createBlock(_component_CompressOutlined, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_ExpandOutlined, { key: 1 }))
|
|
265
|
+
]),
|
|
266
|
+
_: 1
|
|
267
|
+
})
|
|
268
|
+
])
|
|
269
|
+
], 36)) : vue.createCommentVNode("", true),
|
|
270
|
+
_ctx.showClose ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
271
|
+
key: 1,
|
|
272
|
+
class: "ele-modal-tool",
|
|
273
|
+
style: vue.normalizeStyle(_ctx.closeBtnStyle),
|
|
274
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.updateModelValue(false)),
|
|
275
|
+
onMousedown: _cache[4] || (_cache[4] = vue.withModifiers(() => {
|
|
276
|
+
}, ["stop"])),
|
|
277
|
+
onTouchstart: _cache[5] || (_cache[5] = vue.withModifiers(() => {
|
|
278
|
+
}, ["stop"]))
|
|
279
|
+
}, [
|
|
280
|
+
vue.renderSlot(_ctx.$slots, "closeIcon", {}, () => [
|
|
281
|
+
vue.createVNode(_component_ElIcon, null, {
|
|
282
|
+
default: vue.withCtx(() => [
|
|
283
|
+
_ctx.closeIcon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon), { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_CloseOutlined, { key: 1 }))
|
|
284
|
+
]),
|
|
285
|
+
_: 1
|
|
286
|
+
})
|
|
287
|
+
])
|
|
288
|
+
], 36)) : vue.createCommentVNode("", true)
|
|
289
|
+
], 36),
|
|
290
|
+
_ctx.resizable ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
291
|
+
key: 0,
|
|
292
|
+
class: vue.normalizeClass([
|
|
293
|
+
"ele-modal-resize-icon",
|
|
294
|
+
{ "is-horizontal": _ctx.resizable === "horizontal" },
|
|
295
|
+
{ "is-vertical": _ctx.resizable === "vertical" }
|
|
296
|
+
]),
|
|
297
|
+
style: vue.normalizeStyle(_ctx.resizeIconStyle),
|
|
298
|
+
onMousedown: _cache[8] || (_cache[8] = (...args) => _ctx.handleResizeMousedown && _ctx.handleResizeMousedown(...args)),
|
|
299
|
+
onTouchstart: _cache[9] || (_cache[9] = (...args) => _ctx.handleResizeTouchstart && _ctx.handleResizeTouchstart(...args))
|
|
300
|
+
}, [
|
|
301
|
+
vue.renderSlot(_ctx.$slots, "resizeIcon", {}, () => [
|
|
302
|
+
vue.createVNode(_component_ElIcon, null, {
|
|
303
|
+
default: vue.withCtx(() => [
|
|
304
|
+
vue.createVNode(_component_ResizeOutlined)
|
|
305
|
+
]),
|
|
306
|
+
_: 1
|
|
307
|
+
})
|
|
308
|
+
])
|
|
309
|
+
], 38)) : vue.createCommentVNode("", true)
|
|
310
|
+
]),
|
|
311
|
+
default: vue.withCtx(() => [
|
|
312
|
+
vue.createVNode(_component_ReceiverView, {
|
|
313
|
+
wrapPosition: false,
|
|
314
|
+
class: vue.normalizeClass(["ele-modal-body", { "is-form": _ctx.form }]),
|
|
315
|
+
style: vue.normalizeStyle(_ctx.bodyStyle)
|
|
316
|
+
}, {
|
|
317
|
+
default: vue.withCtx(() => [
|
|
318
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
319
|
+
]),
|
|
320
|
+
_: 3
|
|
321
|
+
}, 8, ["class", "style"])
|
|
322
|
+
]),
|
|
323
|
+
_: 2
|
|
324
|
+
}, [
|
|
325
|
+
_ctx.$slots.footer ? {
|
|
326
|
+
name: "footer",
|
|
327
|
+
fn: vue.withCtx(() => [
|
|
328
|
+
vue.createElementVNode("div", {
|
|
329
|
+
class: "ele-modal-footer",
|
|
330
|
+
style: vue.normalizeStyle(_ctx.footerStyle)
|
|
331
|
+
}, [
|
|
332
|
+
vue.renderSlot(_ctx.$slots, "footer")
|
|
333
|
+
], 4)
|
|
334
|
+
]),
|
|
335
|
+
key: "0"
|
|
336
|
+
} : void 0
|
|
337
|
+
]), 1040, ["modelValue", "title", "width", "modal", "modalClass", "lockScroll", "openDelay", "closeDelay", "closeOnClickModal", "closeOnPressEscape", "beforeClose", "center", "destroyOnClose", "zIndex", "headerAriaLevel", "onUpdate:modelValue", "onOpen", "onOpened", "onClose", "onClosed", "onOpenAutoFocus", "onCloseAutoFocus"])
|
|
338
|
+
], 8, ["to", "disabled"]);
|
|
339
|
+
}
|
|
340
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
341
|
+
module.exports = index;
|