md-editor-v3 4.12.0 → 4.12.2
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/cjs/DropdownToolbar.cjs +3 -1
- package/lib/cjs/MdCatalog.cjs +270 -1
- package/lib/cjs/MdEditor.cjs +3101 -58
- package/lib/cjs/MdModal.cjs +3 -1
- package/lib/cjs/MdPreview.cjs +3 -1
- package/lib/cjs/ModalToolbar.cjs +124 -1
- package/lib/cjs/NormalToolbar.cjs +61 -1
- package/lib/cjs/chunks/config.cjs +290 -1
- package/lib/cjs/chunks/dom.cjs +64 -1
- package/lib/cjs/chunks/index.cjs +1863 -8
- package/lib/cjs/chunks/index2.cjs +198 -1
- package/lib/cjs/chunks/index3.cjs +270 -1
- package/lib/cjs/chunks/index4.cjs +141 -2
- package/lib/cjs/chunks/vue-tsx.cjs +10 -1
- package/lib/cjs/config.cjs +12 -1
- package/lib/cjs/index.cjs +25 -1
- package/lib/es/DropdownToolbar.mjs +2 -2
- package/lib/es/MdCatalog.mjs +164 -114
- package/lib/es/MdEditor.mjs +2292 -1677
- package/lib/es/MdModal.mjs +2 -2
- package/lib/es/MdPreview.mjs +2 -2
- package/lib/es/ModalToolbar.mjs +55 -38
- package/lib/es/NormalToolbar.mjs +26 -18
- package/lib/es/chunks/config.mjs +73 -54
- package/lib/es/chunks/dom.mjs +57 -24
- package/lib/es/chunks/index.mjs +1093 -611
- package/lib/es/chunks/index2.mjs +126 -78
- package/lib/es/chunks/index3.mjs +185 -111
- package/lib/es/chunks/index4.mjs +124 -73
- package/lib/es/chunks/vue-tsx.mjs +8 -8
- package/lib/es/config.mjs +11 -10
- package/lib/es/index.mjs +23 -23
- package/lib/preview.css +200 -1
- package/lib/style.css +592 -1
- package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +1 -1
- package/lib/types/DropdownToolbar/index.d.ts +39 -61
- package/lib/types/MdCatalog/CatalogLink.d.ts +1 -1
- package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
- package/lib/types/MdCatalog/index.d.ts +47 -60
- package/lib/types/MdEditor/Editor.d.ts +1 -1
- package/lib/types/MdEditor/components/Checkbox/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Divider/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Dropdown/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/Icon.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +2 -2
- package/lib/types/MdEditor/components/Modal/index.d.ts +59 -63
- package/lib/types/MdEditor/components/Popper/index.d.ts +1 -1
- package/lib/types/MdEditor/index.d.ts +238 -104
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Content/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Link.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +1 -1
- package/lib/types/MdEditor/utils/vue-tsx.d.ts +1 -1
- package/lib/types/MdPreview/MdPreview.d.ts +1 -1
- package/lib/types/MdPreview/index.d.ts +119 -73
- package/lib/types/ModalToolbar/ModalToolbar.d.ts +1 -1
- package/lib/types/ModalToolbar/index.d.ts +64 -66
- package/lib/types/NormalToolbar/NormalToolbar.d.ts +1 -1
- package/lib/types/NormalToolbar/index.d.ts +30 -58
- package/lib/umd/index.js +42 -42
- package/package.json +4 -4
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { p as
|
|
3
|
-
import { g as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent, reactive, ref, watch, onMounted, onBeforeUnmount, cloneVNode, createVNode, inject } from "vue";
|
|
2
|
+
import { p as prefix } from "./config.mjs";
|
|
3
|
+
import { g as getSlot } from "./vue-tsx.mjs";
|
|
4
|
+
const props$1 = {
|
|
5
5
|
overlay: {
|
|
6
6
|
type: [String, Object],
|
|
7
7
|
default: ""
|
|
8
8
|
},
|
|
9
9
|
visible: {
|
|
10
10
|
type: Boolean,
|
|
11
|
-
default:
|
|
11
|
+
default: false
|
|
12
12
|
},
|
|
13
13
|
onChange: {
|
|
14
14
|
type: Function,
|
|
@@ -20,61 +20,99 @@ const B = {
|
|
|
20
20
|
type: String,
|
|
21
21
|
default: "html"
|
|
22
22
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
};
|
|
24
|
+
const Dropdown = /* @__PURE__ */ defineComponent({
|
|
25
|
+
props: props$1,
|
|
26
|
+
setup(props2, ctx) {
|
|
27
|
+
const HIDDEN_CLASS = `${prefix}-dropdown-hidden`;
|
|
28
|
+
const ctl = reactive({
|
|
29
|
+
overlayClass: [HIDDEN_CLASS],
|
|
28
30
|
overlayStyle: {},
|
|
29
|
-
triggerHover:
|
|
30
|
-
overlayHover:
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
triggerHover: false,
|
|
32
|
+
overlayHover: false
|
|
33
|
+
});
|
|
34
|
+
const triggerRef = ref();
|
|
35
|
+
const overlayRef = ref();
|
|
36
|
+
const triggerHandler = () => {
|
|
37
|
+
var _a;
|
|
38
|
+
ctl.triggerHover = true;
|
|
39
|
+
const triggerEle = triggerRef.value;
|
|
40
|
+
const overlayEle = overlayRef.value;
|
|
41
|
+
if (!triggerEle || !overlayEle) {
|
|
36
42
|
return;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
}
|
|
44
|
+
const triggerInfo = triggerEle.getBoundingClientRect();
|
|
45
|
+
const triggerTop = triggerEle.offsetTop;
|
|
46
|
+
const triggerLeft = triggerEle.offsetLeft;
|
|
47
|
+
const triggerHeight = triggerInfo.height;
|
|
48
|
+
const triggerWidth = triggerInfo.width;
|
|
49
|
+
const relativecrollLeft = ((_a = document.querySelector(props2.relative)) == null ? void 0 : _a.scrollLeft) || 0;
|
|
50
|
+
ctl.overlayStyle = {
|
|
51
|
+
...ctl.overlayStyle,
|
|
52
|
+
top: triggerTop + triggerHeight + "px",
|
|
53
|
+
left: triggerLeft - overlayEle.offsetWidth / 2 + triggerWidth / 2 - relativecrollLeft + "px"
|
|
54
|
+
};
|
|
55
|
+
props2.onChange(true);
|
|
56
|
+
};
|
|
57
|
+
const overlayHandler = () => {
|
|
58
|
+
ctl.overlayHover = true;
|
|
45
59
|
};
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
watch(() => props2.visible, (newV) => {
|
|
61
|
+
if (newV) {
|
|
62
|
+
ctl.overlayClass = ctl.overlayClass.filter((classItem) => classItem !== HIDDEN_CLASS);
|
|
63
|
+
} else {
|
|
64
|
+
ctl.overlayClass.push(HIDDEN_CLASS);
|
|
65
|
+
}
|
|
48
66
|
});
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
let hiddenTimer = -1;
|
|
68
|
+
const leaveHidden = (e) => {
|
|
69
|
+
if (triggerRef.value === e.target) {
|
|
70
|
+
ctl.triggerHover = false;
|
|
71
|
+
} else {
|
|
72
|
+
ctl.overlayHover = false;
|
|
73
|
+
}
|
|
74
|
+
clearTimeout(hiddenTimer);
|
|
75
|
+
hiddenTimer = window.setTimeout(() => {
|
|
76
|
+
if (!ctl.overlayHover && !ctl.triggerHover) {
|
|
77
|
+
props2.onChange(false);
|
|
78
|
+
}
|
|
53
79
|
}, 10);
|
|
54
80
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
triggerRef.value.addEventListener("mouseenter", triggerHandler);
|
|
83
|
+
triggerRef.value.addEventListener("mouseleave", leaveHidden);
|
|
84
|
+
overlayRef.value.addEventListener("mouseenter", overlayHandler);
|
|
85
|
+
overlayRef.value.addEventListener("mouseleave", leaveHidden);
|
|
86
|
+
});
|
|
87
|
+
onBeforeUnmount(() => {
|
|
88
|
+
triggerRef.value.removeEventListener("mouseenter", triggerHandler);
|
|
89
|
+
triggerRef.value.removeEventListener("mouseleave", leaveHidden);
|
|
90
|
+
overlayRef.value.removeEventListener("mouseenter", overlayHandler);
|
|
91
|
+
overlayRef.value.removeEventListener("mouseleave", leaveHidden);
|
|
92
|
+
});
|
|
93
|
+
return () => {
|
|
94
|
+
const slotDefault = getSlot({
|
|
95
|
+
ctx
|
|
96
|
+
});
|
|
97
|
+
const slotOverlay = getSlot({
|
|
98
|
+
props: props2,
|
|
99
|
+
ctx
|
|
100
|
+
}, "overlay");
|
|
101
|
+
const trigger = cloneVNode(slotDefault instanceof Array ? slotDefault[0] : slotDefault, {
|
|
102
|
+
ref: triggerRef
|
|
103
|
+
});
|
|
104
|
+
const overlay = createVNode("div", {
|
|
105
|
+
"class": [`${prefix}-dropdown`, ctl.overlayClass],
|
|
106
|
+
"style": ctl.overlayStyle,
|
|
107
|
+
"ref": overlayRef
|
|
108
|
+
}, [createVNode("div", {
|
|
109
|
+
"class": `${prefix}-dropdown-overlay`
|
|
110
|
+
}, [slotOverlay instanceof Array ? slotOverlay[0] : slotOverlay])]);
|
|
111
|
+
return [trigger, overlay];
|
|
75
112
|
};
|
|
76
113
|
}
|
|
77
|
-
})
|
|
114
|
+
});
|
|
115
|
+
const props = {
|
|
78
116
|
title: {
|
|
79
117
|
type: String,
|
|
80
118
|
default: ""
|
|
@@ -111,41 +149,51 @@ const B = {
|
|
|
111
149
|
default: {
|
|
112
150
|
type: [String, Object]
|
|
113
151
|
}
|
|
114
|
-
}
|
|
152
|
+
};
|
|
153
|
+
const DropdownToolbar = /* @__PURE__ */ defineComponent({
|
|
115
154
|
name: "DropdownToolbar",
|
|
116
|
-
props
|
|
155
|
+
props,
|
|
117
156
|
emits: ["onChange"],
|
|
118
|
-
setup(
|
|
119
|
-
const
|
|
157
|
+
setup(props2, ctx) {
|
|
158
|
+
const editorId = inject("editorId");
|
|
120
159
|
return () => {
|
|
121
|
-
const
|
|
122
|
-
props:
|
|
123
|
-
ctx
|
|
124
|
-
}, "trigger")
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
160
|
+
const Trigger = getSlot({
|
|
161
|
+
props: props2,
|
|
162
|
+
ctx
|
|
163
|
+
}, "trigger");
|
|
164
|
+
const Overlay = getSlot({
|
|
165
|
+
props: props2,
|
|
166
|
+
ctx
|
|
167
|
+
}, "overlay");
|
|
168
|
+
const Default = getSlot({
|
|
169
|
+
props: props2,
|
|
170
|
+
ctx
|
|
130
171
|
});
|
|
131
|
-
return
|
|
132
|
-
relative: `#${
|
|
133
|
-
visible:
|
|
134
|
-
onChange: (
|
|
135
|
-
|
|
172
|
+
return createVNode(Dropdown, {
|
|
173
|
+
"relative": `#${editorId}-toolbar-wrapper`,
|
|
174
|
+
"visible": props2.visible,
|
|
175
|
+
"onChange": (v) => {
|
|
176
|
+
if (props2.onChange instanceof Function) {
|
|
177
|
+
props2.onChange(v);
|
|
178
|
+
} else {
|
|
179
|
+
ctx.emit("onChange", v);
|
|
180
|
+
}
|
|
136
181
|
},
|
|
137
|
-
overlay:
|
|
182
|
+
"overlay": Overlay
|
|
138
183
|
}, {
|
|
139
|
-
default: () => [
|
|
140
|
-
class: `${
|
|
141
|
-
title:
|
|
142
|
-
}, [
|
|
184
|
+
default: () => [createVNode("div", {
|
|
185
|
+
"class": `${prefix}-toolbar-item`,
|
|
186
|
+
"title": props2.title || ""
|
|
187
|
+
}, [Trigger, Default])]
|
|
143
188
|
});
|
|
144
189
|
};
|
|
145
190
|
}
|
|
146
191
|
});
|
|
147
|
-
|
|
192
|
+
DropdownToolbar.install = (app) => {
|
|
193
|
+
app.component(DropdownToolbar.name, DropdownToolbar);
|
|
194
|
+
return app;
|
|
195
|
+
};
|
|
148
196
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
197
|
+
DropdownToolbar as D,
|
|
198
|
+
Dropdown as a
|
|
151
199
|
};
|
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,50 +1,57 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { p as
|
|
3
|
-
import { g as
|
|
4
|
-
import { k as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent, createVNode, inject, h, ref, shallowRef, reactive, computed, watch, nextTick, onMounted, Teleport } from "vue";
|
|
2
|
+
import { p as prefix, e as configOption } from "./config.mjs";
|
|
3
|
+
import { g as getSlot } from "./vue-tsx.mjs";
|
|
4
|
+
import { k as keyMove } from "./dom.mjs";
|
|
5
|
+
const Icon$1 = /* @__PURE__ */ defineComponent({
|
|
6
6
|
props: {
|
|
7
7
|
name: {
|
|
8
8
|
type: String,
|
|
9
9
|
default: ""
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
setup(
|
|
13
|
-
return () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
setup(props2) {
|
|
13
|
+
return () => {
|
|
14
|
+
return configOption.iconfontType === "svg" ? createVNode("svg", {
|
|
15
|
+
"class": `${prefix}-icon`,
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}, [createVNode("use", {
|
|
18
|
+
"xlink:href": `#${prefix}-icon-${props2.name}`
|
|
19
|
+
}, null)]) : createVNode("i", {
|
|
20
|
+
"class": `${prefix}-iconfont ${prefix}-icon-${props2.name}`
|
|
21
|
+
}, null);
|
|
22
|
+
};
|
|
21
23
|
}
|
|
22
|
-
})
|
|
24
|
+
});
|
|
25
|
+
const Icon = /* @__PURE__ */ defineComponent({
|
|
23
26
|
props: {
|
|
24
27
|
name: {
|
|
25
28
|
type: String,
|
|
26
29
|
default: ""
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
32
|
+
setup(props2) {
|
|
33
|
+
const customIcon = inject("customIcon");
|
|
31
34
|
return () => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const item = customIcon.value[props2.name];
|
|
36
|
+
if (typeof item === "object") {
|
|
37
|
+
return typeof item.component === "object" ? h(item.component, item.props) : createVNode("span", {
|
|
38
|
+
"innerHTML": item.component
|
|
39
|
+
}, null);
|
|
40
|
+
}
|
|
41
|
+
return createVNode(Icon$1, {
|
|
42
|
+
"name": props2.name
|
|
37
43
|
}, null);
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
|
-
})
|
|
46
|
+
});
|
|
47
|
+
const props = {
|
|
41
48
|
title: {
|
|
42
49
|
type: String,
|
|
43
50
|
default: ""
|
|
44
51
|
},
|
|
45
52
|
visible: {
|
|
46
53
|
type: Boolean,
|
|
47
|
-
default:
|
|
54
|
+
default: false
|
|
48
55
|
},
|
|
49
56
|
width: {
|
|
50
57
|
type: String,
|
|
@@ -59,11 +66,11 @@ const W = /* @__PURE__ */ y({
|
|
|
59
66
|
},
|
|
60
67
|
showAdjust: {
|
|
61
68
|
type: Boolean,
|
|
62
|
-
default:
|
|
69
|
+
default: false
|
|
63
70
|
},
|
|
64
71
|
isFullscreen: {
|
|
65
72
|
type: Boolean,
|
|
66
|
-
default:
|
|
73
|
+
default: false
|
|
67
74
|
},
|
|
68
75
|
onAdjust: {
|
|
69
76
|
type: Function,
|
|
@@ -77,18 +84,28 @@ const W = /* @__PURE__ */ y({
|
|
|
77
84
|
type: Object,
|
|
78
85
|
default: () => ({})
|
|
79
86
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
};
|
|
88
|
+
const getNextIndex = /* @__PURE__ */ (() => {
|
|
89
|
+
let startIndex = 2e4;
|
|
90
|
+
return () => {
|
|
91
|
+
return ++startIndex;
|
|
92
|
+
};
|
|
93
|
+
})();
|
|
94
|
+
const MdModal = /* @__PURE__ */ defineComponent({
|
|
84
95
|
name: "MdModal",
|
|
85
|
-
props
|
|
96
|
+
props,
|
|
86
97
|
emits: ["onClose"],
|
|
87
|
-
setup(
|
|
88
|
-
const
|
|
89
|
-
|
|
98
|
+
setup(props2, ctx) {
|
|
99
|
+
const themeRef = inject("theme");
|
|
100
|
+
const modalVisible = ref(props2.visible);
|
|
101
|
+
const modalClass = ref([`${prefix}-modal`]);
|
|
102
|
+
const modalRef = ref();
|
|
103
|
+
const modalHeaderRef = ref();
|
|
104
|
+
const bodyRef = ref();
|
|
105
|
+
const containerRef = shallowRef();
|
|
106
|
+
let keyMoveClear = () => {
|
|
90
107
|
};
|
|
91
|
-
const
|
|
108
|
+
const state = reactive({
|
|
92
109
|
maskStyle: {
|
|
93
110
|
zIndex: -1
|
|
94
111
|
},
|
|
@@ -103,95 +120,152 @@ const W = /* @__PURE__ */ y({
|
|
|
103
120
|
left: "0px",
|
|
104
121
|
top: "0px"
|
|
105
122
|
}
|
|
106
|
-
}), I = H(() => e.isFullscreen ? {
|
|
107
|
-
width: "100%",
|
|
108
|
-
height: "100%"
|
|
109
|
-
} : {
|
|
110
|
-
width: e.width,
|
|
111
|
-
height: e.height
|
|
112
123
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
const innerSize = computed(() => {
|
|
125
|
+
if (props2.isFullscreen) {
|
|
126
|
+
return {
|
|
127
|
+
width: "100%",
|
|
128
|
+
height: "100%"
|
|
129
|
+
};
|
|
130
|
+
} else {
|
|
131
|
+
return {
|
|
132
|
+
width: props2.width,
|
|
133
|
+
height: props2.height
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
watch(() => props2.isFullscreen, (nVal) => {
|
|
138
|
+
if (nVal) {
|
|
139
|
+
keyMoveClear();
|
|
140
|
+
} else {
|
|
141
|
+
nextTick(() => {
|
|
142
|
+
keyMoveClear = keyMove(modalHeaderRef.value, (left, top) => {
|
|
143
|
+
state.initPos.left = left + "px";
|
|
144
|
+
state.initPos.top = top + "px";
|
|
145
|
+
});
|
|
117
146
|
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
watch(() => props2.visible, (nVal) => {
|
|
150
|
+
if (nVal) {
|
|
151
|
+
state.maskStyle.zIndex = getNextIndex();
|
|
152
|
+
state.modalStyle.zIndex = getNextIndex();
|
|
153
|
+
modalClass.value.push("zoom-in");
|
|
154
|
+
modalVisible.value = nVal;
|
|
155
|
+
nextTick(() => {
|
|
156
|
+
const halfWidth = modalRef.value.offsetWidth / 2;
|
|
157
|
+
const halfHeight = modalRef.value.offsetHeight / 2;
|
|
158
|
+
const halfClientWidth = document.documentElement.clientWidth / 2;
|
|
159
|
+
const halfClientHeight = document.documentElement.clientHeight / 2;
|
|
160
|
+
state.initPos.left = halfClientWidth - halfWidth + "px";
|
|
161
|
+
state.initPos.top = halfClientHeight - halfHeight + "px";
|
|
162
|
+
if (!props2.isFullscreen) {
|
|
163
|
+
keyMoveClear = keyMove(modalHeaderRef.value, (left, top) => {
|
|
164
|
+
state.initPos.left = left + "px";
|
|
165
|
+
state.initPos.top = top + "px";
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
modalClass.value = modalClass.value.filter((item) => item !== "zoom-in");
|
|
171
|
+
}, 140);
|
|
172
|
+
} else {
|
|
173
|
+
modalClass.value.push("zoom-out");
|
|
174
|
+
keyMoveClear();
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
modalClass.value = modalClass.value.filter((item) => item !== "zoom-out");
|
|
177
|
+
modalVisible.value = nVal;
|
|
178
|
+
}, 130);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
onMounted(() => {
|
|
182
|
+
bodyRef.value = document.body;
|
|
183
|
+
});
|
|
184
|
+
return () => {
|
|
185
|
+
const slotDefault = getSlot({
|
|
186
|
+
ctx
|
|
118
187
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
o.initPos.left = b - n + "px", o.initPos.top = j - u + "px", e.isFullscreen || (d = C(h.value, (z, F) => {
|
|
123
|
-
o.initPos.left = z + "px", o.initPos.top = F + "px";
|
|
124
|
-
}));
|
|
125
|
-
}), setTimeout(() => {
|
|
126
|
-
i.value = i.value.filter((n) => n !== "zoom-in");
|
|
127
|
-
}, 140)) : (i.value.push("zoom-out"), d(), setTimeout(() => {
|
|
128
|
-
i.value = i.value.filter((n) => n !== "zoom-out"), f.value = a;
|
|
129
|
-
}, 130));
|
|
130
|
-
}), () => {
|
|
131
|
-
const a = x({
|
|
132
|
-
ctx: c
|
|
133
|
-
}), n = x({
|
|
134
|
-
props: e,
|
|
135
|
-
ctx: c
|
|
188
|
+
const slotTitle = getSlot({
|
|
189
|
+
props: props2,
|
|
190
|
+
ctx
|
|
136
191
|
}, "title");
|
|
137
|
-
return
|
|
138
|
-
to:
|
|
192
|
+
return bodyRef.value ? createVNode(Teleport, {
|
|
193
|
+
"to": bodyRef.value
|
|
139
194
|
}, {
|
|
140
|
-
default: () => [
|
|
141
|
-
ref:
|
|
142
|
-
class:
|
|
143
|
-
"data-theme":
|
|
144
|
-
}, [
|
|
145
|
-
class:
|
|
146
|
-
style: {
|
|
147
|
-
...
|
|
148
|
-
display:
|
|
195
|
+
default: () => [createVNode("div", {
|
|
196
|
+
"ref": containerRef,
|
|
197
|
+
"class": `${prefix}-modal-container`,
|
|
198
|
+
"data-theme": themeRef.value
|
|
199
|
+
}, [createVNode("div", {
|
|
200
|
+
"class": props2.class,
|
|
201
|
+
"style": {
|
|
202
|
+
...props2.style,
|
|
203
|
+
display: modalVisible.value ? "block" : "none"
|
|
149
204
|
}
|
|
150
|
-
}, [
|
|
151
|
-
class: `${
|
|
152
|
-
style:
|
|
153
|
-
onClick: () => {
|
|
154
|
-
|
|
205
|
+
}, [createVNode("div", {
|
|
206
|
+
"class": `${prefix}-modal-mask`,
|
|
207
|
+
"style": state.maskStyle,
|
|
208
|
+
"onClick": () => {
|
|
209
|
+
if (props2.onClose) {
|
|
210
|
+
props2.onClose();
|
|
211
|
+
} else {
|
|
212
|
+
ctx.emit("onClose");
|
|
213
|
+
}
|
|
155
214
|
}
|
|
156
|
-
}, null),
|
|
157
|
-
class:
|
|
158
|
-
style: {
|
|
159
|
-
...
|
|
160
|
-
...
|
|
161
|
-
...
|
|
215
|
+
}, null), createVNode("div", {
|
|
216
|
+
"class": modalClass.value,
|
|
217
|
+
"style": {
|
|
218
|
+
...state.modalStyle,
|
|
219
|
+
...state.initPos,
|
|
220
|
+
...innerSize.value
|
|
162
221
|
},
|
|
163
|
-
ref:
|
|
164
|
-
}, [
|
|
165
|
-
class: `${
|
|
166
|
-
ref:
|
|
167
|
-
}, [
|
|
168
|
-
class: `${
|
|
169
|
-
}, [
|
|
170
|
-
class: `${
|
|
171
|
-
}, [
|
|
172
|
-
class: `${
|
|
173
|
-
onClick: (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
222
|
+
"ref": modalRef
|
|
223
|
+
}, [createVNode("div", {
|
|
224
|
+
"class": `${prefix}-modal-header`,
|
|
225
|
+
"ref": modalHeaderRef
|
|
226
|
+
}, [slotTitle || ""]), createVNode("div", {
|
|
227
|
+
"class": `${prefix}-modal-body`
|
|
228
|
+
}, [slotDefault]), createVNode("div", {
|
|
229
|
+
"class": `${prefix}-modal-func`
|
|
230
|
+
}, [props2.showAdjust && createVNode("div", {
|
|
231
|
+
"class": `${prefix}-modal-adjust`,
|
|
232
|
+
"onClick": (e) => {
|
|
233
|
+
e.stopPropagation();
|
|
234
|
+
if (!props2.isFullscreen) {
|
|
235
|
+
state.historyPos = state.initPos;
|
|
236
|
+
state.initPos = {
|
|
237
|
+
left: "0",
|
|
238
|
+
top: "0"
|
|
239
|
+
};
|
|
240
|
+
} else {
|
|
241
|
+
state.initPos = state.historyPos;
|
|
242
|
+
}
|
|
243
|
+
props2.onAdjust(!props2.isFullscreen);
|
|
178
244
|
}
|
|
179
|
-
}, [
|
|
180
|
-
name:
|
|
181
|
-
}, null)]),
|
|
182
|
-
class: `${
|
|
183
|
-
onClick: (
|
|
184
|
-
|
|
245
|
+
}, [createVNode(Icon, {
|
|
246
|
+
"name": props2.isFullscreen ? "suoxiao" : "fangda"
|
|
247
|
+
}, null)]), createVNode("div", {
|
|
248
|
+
"class": `${prefix}-modal-close`,
|
|
249
|
+
"onClick": (e) => {
|
|
250
|
+
e.stopPropagation();
|
|
251
|
+
if (props2.onClose) {
|
|
252
|
+
props2.onClose();
|
|
253
|
+
} else {
|
|
254
|
+
ctx.emit("onClose");
|
|
255
|
+
}
|
|
185
256
|
}
|
|
186
|
-
}, [
|
|
187
|
-
name: "close"
|
|
257
|
+
}, [createVNode(Icon, {
|
|
258
|
+
"name": "close"
|
|
188
259
|
}, null)])])])])])]
|
|
189
|
-
});
|
|
260
|
+
}) : "";
|
|
190
261
|
};
|
|
191
262
|
}
|
|
192
263
|
});
|
|
193
|
-
|
|
264
|
+
MdModal.install = (app) => {
|
|
265
|
+
app.component(MdModal.name, MdModal);
|
|
266
|
+
return app;
|
|
267
|
+
};
|
|
194
268
|
export {
|
|
195
|
-
|
|
196
|
-
|
|
269
|
+
Icon as I,
|
|
270
|
+
MdModal as M
|
|
197
271
|
};
|