y-design-ssr 0.2.5 → 0.2.6
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/libs/button/index.css +579 -1
- package/libs/button/index.mjs +111 -66
- package/libs/button/index.umd.js +203 -2
- package/libs/button/package.json +1 -1
- package/libs/{types/components/button → button}/src/button.d.ts +1 -1
- package/libs/cell/index.css +1077 -1
- package/libs/{types/components/cell → cell}/index.d.ts +1 -0
- package/libs/cell/index.mjs +168 -104
- package/libs/cell/index.umd.js +301 -2
- package/libs/cell/package.json +1 -1
- package/libs/{types/components/cell → cell}/src/cell.d.ts +1 -1
- package/libs/checkbox/index.css +1053 -1
- package/libs/{types/components/checkbox → checkbox}/index.d.ts +1 -0
- package/libs/checkbox/index.mjs +243 -127
- package/libs/checkbox/index.umd.js +370 -2
- package/libs/checkbox/package.json +1 -1
- package/libs/checkboxGroup/index.css +422 -1
- package/libs/{types/components/checkboxGroup → checkboxGroup}/index.d.ts +1 -0
- package/libs/checkboxGroup/index.mjs +174 -87
- package/libs/checkboxGroup/index.umd.js +266 -2
- package/libs/checkboxGroup/package.json +1 -1
- package/libs/col/index.css +615 -1
- package/libs/{types/components/col → col}/index.d.ts +1 -0
- package/libs/col/index.mjs +247 -81
- package/libs/col/index.umd.js +306 -2
- package/libs/col/package.json +1 -1
- package/libs/countdown/index.css +417 -1
- package/libs/{types/components/countdown → countdown}/index.d.ts +1 -0
- package/libs/countdown/index.mjs +180 -71
- package/libs/countdown/index.umd.js +232 -2
- package/libs/countdown/package.json +1 -1
- package/libs/dialog/index.css +1405 -1
- package/libs/{types/components/dialog → dialog}/index.d.ts +1 -0
- package/libs/dialog/index.mjs +647 -476
- package/libs/dialog/index.umd.js +1129 -2
- package/libs/dialog/package.json +1 -1
- package/libs/{types/components/dialog → dialog}/src/dialog.d.ts +1 -1
- package/libs/empty/index.css +457 -1
- package/libs/{types/components/empty → empty}/index.d.ts +1 -0
- package/libs/empty/index.mjs +92 -44
- package/libs/empty/index.umd.js +140 -2
- package/libs/empty/package.json +1 -1
- package/libs/form/index.css +477 -1
- package/libs/{types/components/form → form}/index.d.ts +1 -0
- package/libs/form/index.mjs +227 -126
- package/libs/form/index.umd.js +320 -2
- package/libs/form/package.json +1 -1
- package/libs/formItem/index.css +477 -1
- package/libs/{types/components/formItem → formItem}/index.d.ts +1 -0
- package/libs/formItem/index.mjs +277 -126
- package/libs/formItem/index.umd.js +373 -2
- package/libs/formItem/package.json +1 -1
- package/libs/icon/index.css +982 -1
- package/libs/{types/components/icon → icon}/index.d.ts +1 -0
- package/libs/icon/index.mjs +108 -58
- package/libs/icon/index.umd.js +187 -2
- package/libs/icon/package.json +1 -1
- package/libs/index.css +2902 -1
- package/libs/index.d.ts +86 -3
- package/libs/index.mjs +3785 -2344
- package/libs/index.umd.js +5509 -2
- package/libs/input/index.css +483 -1
- package/libs/{types/components/input → input}/index.d.ts +1 -0
- package/libs/input/index.mjs +184 -92
- package/libs/input/index.umd.js +275 -2
- package/libs/input/package.json +1 -1
- package/libs/layout/index.css +684 -1
- package/libs/layout/index.mjs +230 -130
- package/libs/layout/index.umd.js +318 -2
- package/libs/layout/package.json +1 -1
- package/libs/list/index.css +440 -1
- package/libs/{types/components/list → list}/index.d.ts +1 -0
- package/libs/list/index.mjs +389 -207
- package/libs/list/index.umd.js +572 -2
- package/libs/list/package.json +1 -1
- package/libs/loading/index.css +548 -1
- package/libs/{types/components/loading → loading}/index.d.ts +1 -0
- package/libs/loading/index.mjs +197 -118
- package/libs/loading/index.umd.js +322 -2
- package/libs/loading/package.json +1 -1
- package/libs/{types/components/loading → loading}/src/loading.d.ts +1 -1
- package/libs/mask/index.css +426 -1
- package/libs/{types/components/mask → mask}/index.d.ts +1 -0
- package/libs/mask/index.mjs +132 -70
- package/libs/mask/index.umd.js +202 -2
- package/libs/mask/package.json +1 -1
- package/libs/popup/index.css +465 -1
- package/libs/{types/components/popup → popup}/index.d.ts +1 -0
- package/libs/popup/index.mjs +211 -134
- package/libs/popup/index.umd.js +359 -2
- package/libs/popup/package.json +1 -1
- package/libs/{types/components/popup → popup}/src/popup.d.ts +1 -1
- package/libs/progress/index.css +488 -1
- package/libs/{types/components/progress → progress}/index.d.ts +1 -0
- package/libs/progress/index.mjs +201 -128
- package/libs/progress/index.umd.js +323 -2
- package/libs/progress/package.json +1 -1
- package/libs/pullrefresh/index.css +441 -1
- package/libs/{types/components/pullrefresh → pullrefresh}/index.d.ts +1 -0
- package/libs/pullrefresh/index.mjs +242 -111
- package/libs/pullrefresh/index.umd.js +303 -2
- package/libs/pullrefresh/package.json +1 -1
- package/libs/row/index.css +485 -1
- package/libs/{types/components/row → row}/index.d.ts +1 -0
- package/libs/row/index.mjs +182 -89
- package/libs/row/index.umd.js +238 -2
- package/libs/row/package.json +1 -1
- package/libs/{types/components/row → row}/src/row.d.ts +1 -1
- package/libs/slider/index.css +558 -1
- package/libs/{types/components/slider → slider}/index.d.ts +1 -0
- package/libs/slider/index.mjs +357 -160
- package/libs/slider/index.umd.js +454 -2
- package/libs/slider/package.json +1 -1
- package/libs/stepper/index.css +489 -1
- package/libs/{types/components/stepper → stepper}/index.d.ts +1 -0
- package/libs/stepper/index.mjs +182 -101
- package/libs/stepper/index.umd.js +270 -2
- package/libs/stepper/package.json +1 -1
- package/libs/swipe/index.css +506 -1
- package/libs/{types/components/swipe → swipe}/index.d.ts +1 -0
- package/libs/swipe/index.mjs +543 -259
- package/libs/swipe/index.umd.js +704 -2
- package/libs/swipe/package.json +1 -1
- package/libs/swipeItem/index.css +424 -1
- package/libs/{types/components/swipeItem → swipeItem}/index.d.ts +1 -0
- package/libs/swipeItem/index.mjs +112 -52
- package/libs/swipeItem/index.umd.js +155 -2
- package/libs/swipeItem/package.json +1 -1
- package/libs/switch/index.css +472 -1
- package/libs/{types/components/switch → switch}/index.d.ts +1 -0
- package/libs/switch/index.mjs +122 -62
- package/libs/switch/index.umd.js +201 -2
- package/libs/switch/package.json +1 -1
- package/libs/{types/components/switch → switch}/src/switch.d.ts +1 -1
- package/libs/{types/components/tab → tab}/index.d.ts +1 -0
- package/libs/tab/index.mjs +132 -68
- package/libs/tab/index.umd.js +191 -1
- package/libs/tab/package.json +1 -1
- package/libs/tabs/index.css +514 -1
- package/libs/{types/components/tabs → tabs}/index.d.ts +1 -0
- package/libs/tabs/index.mjs +752 -410
- package/libs/tabs/index.umd.js +1021 -2
- package/libs/tabs/package.json +1 -1
- package/libs/toast/index.css +1050 -1
- package/libs/{types/components/toast → toast}/index.d.ts +1 -0
- package/libs/toast/index.mjs +184 -114
- package/libs/toast/index.umd.js +307 -2
- package/libs/toast/package.json +1 -1
- package/libs/{types/components/toast → toast}/src/toast.d.ts +1 -1
- package/libs/tooltip/index.css +514 -1
- package/libs/{types/components/tooltip → tooltip}/index.d.ts +1 -0
- package/libs/tooltip/index.mjs +294 -155
- package/libs/tooltip/index.umd.js +417 -2
- package/libs/tooltip/package.json +1 -1
- package/libs/vue-sfc.d.ts +12 -0
- package/libs/vue-tsx.d.ts +42 -0
- package/package.json +2 -2
- package/libs/types/index.d.ts +0 -86
- /package/libs/{types/components/button → button}/index.d.ts +0 -0
- /package/libs/{types/components/checkbox → checkbox}/src/checkbox.d.ts +0 -0
- /package/libs/{types/components/checkboxGroup → checkboxGroup}/src/checkboxGroup.d.ts +0 -0
- /package/libs/{types/components/checkboxGroup → checkboxGroup}/src/constants.d.ts +0 -0
- /package/libs/{types/components/col → col}/src/col.d.ts +0 -0
- /package/libs/{types/context → context}/filed/constants.d.ts +0 -0
- /package/libs/{types/context → context}/filed/index.d.ts +0 -0
- /package/libs/{types/context → context}/filed/inject.d.ts +0 -0
- /package/libs/{types/context → context}/filed/provide.d.ts +0 -0
- /package/libs/{types/context → context}/relation/index.d.ts +0 -0
- /package/libs/{types/context → context}/relation/inject.d.ts +0 -0
- /package/libs/{types/context → context}/relation/provide.d.ts +0 -0
- /package/libs/{types/components/countdown → countdown}/src/count-down.d.ts +0 -0
- /package/libs/{types/components/dialog → dialog}/src/create.d.ts +0 -0
- /package/libs/{types/components/empty → empty}/src/empty.d.ts +0 -0
- /package/libs/{types/components/empty → empty}/src/utils.d.ts +0 -0
- /package/libs/{types/components/form → form}/src/constants.d.ts +0 -0
- /package/libs/{types/components/form → form}/src/form.d.ts +0 -0
- /package/libs/{types/components/formItem → formItem}/src/formItem.d.ts +0 -0
- /package/libs/{types/hooks → hooks}/touch/index.d.ts +0 -0
- /package/libs/{types/components/icon → icon}/src/icon.d.ts +0 -0
- /package/libs/{types/components/input → input}/src/input.d.ts +0 -0
- /package/libs/{types/components/list → list}/src/list.d.ts +0 -0
- /package/libs/{types/components/loading → loading}/src/create.d.ts +0 -0
- /package/libs/{types/components/loading → loading}/src/directive.d.ts +0 -0
- /package/libs/{types/locale → locale}/index.d.ts +0 -0
- /package/libs/{types/locale → locale}/lang/zh-CN.d.ts +0 -0
- /package/libs/{types/components/mask → mask}/src/mask.d.ts +0 -0
- /package/libs/{types/components/progress → progress}/src/progress.d.ts +0 -0
- /package/libs/{types/components/pullrefresh → pullrefresh}/src/pullrefresh.d.ts +0 -0
- /package/libs/{types/components/pullrefresh → pullrefresh}/src/utils.d.ts +0 -0
- /package/libs/{types/components/row → row}/src/constants.d.ts +0 -0
- /package/libs/{types/components/slider → slider}/src/slider.d.ts +0 -0
- /package/libs/{types/components/stepper → stepper}/src/stepper.d.ts +0 -0
- /package/libs/{types/style → style}/index.d.ts +0 -0
- /package/libs/{types/components/swipe → swipe}/src/constants.d.ts +0 -0
- /package/libs/{types/components/swipe → swipe}/src/swipe.d.ts +0 -0
- /package/libs/{types/components/swipeItem → swipeItem}/src/swipeItem.d.ts +0 -0
- /package/libs/{types/components/tab → tab}/src/tab.d.ts +0 -0
- /package/libs/{types/components/tabs → tabs}/src/constants.d.ts +0 -0
- /package/libs/{types/components/tabs → tabs}/src/tabs.d.ts +0 -0
- /package/libs/{types/components/tabs → tabs}/src/title.d.ts +0 -0
- /package/libs/{types/components/toast → toast}/src/create.d.ts +0 -0
- /package/libs/{types/components/tooltip → tooltip}/src/constants.d.ts +0 -0
- /package/libs/{types/components/tooltip → tooltip}/src/direactive.d.ts +0 -0
- /package/libs/{types/components/tooltip → tooltip}/src/popper.d.ts +0 -0
- /package/libs/{types/components/tooltip → tooltip}/src/tooltip.d.ts +0 -0
- /package/libs/{types/utils → utils}/create/bem.d.ts +0 -0
- /package/libs/{types/utils → utils}/create/index.d.ts +0 -0
- /package/libs/{types/utils → utils}/index.d.ts +0 -0
- /package/libs/{types/utils → utils}/is.d.ts +0 -0
- /package/libs/{types/utils → utils}/parseFlexDirection.d.ts +0 -0
- /package/libs/{types/utils → utils}/parseUnit.d.ts +0 -0
- /package/libs/{types/utils → utils}/types.d.ts +0 -0
package/libs/dialog/index.mjs
CHANGED
|
@@ -1,11 +1,47 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
const
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ref, reactive, defineComponent, onMounted, onUnmounted, watch, createVNode, Transition, withDirectives, vShow, computed, Teleport, Fragment, createApp, h, mergeProps, resolveDirective, isVNode } from "vue";
|
|
2
|
+
const tagTester = (name2) => {
|
|
3
|
+
return (obj) => {
|
|
4
|
+
return Object.prototype.toString.call(obj) === `[object ${name2}]`;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
const isFunction = tagTester("Function");
|
|
8
|
+
const isPromise = tagTester("Promise");
|
|
9
|
+
const getMods = (el, mods) => {
|
|
10
|
+
if (!mods) {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
if (typeof mods === "string") {
|
|
14
|
+
return ` ${el}--${mods}`;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(mods)) {
|
|
17
|
+
return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
|
|
18
|
+
}
|
|
19
|
+
return Object.keys(mods).reduce(
|
|
20
|
+
(acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
|
|
21
|
+
""
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
const createBEM = (block) => {
|
|
25
|
+
return (el, mods) => {
|
|
26
|
+
let _el = el;
|
|
27
|
+
let _mods = mods;
|
|
28
|
+
if (_el && typeof _el !== "string") {
|
|
29
|
+
_mods = _el;
|
|
30
|
+
_el = "";
|
|
31
|
+
}
|
|
32
|
+
_el = _el ? `${block}__${_el}` : block;
|
|
33
|
+
return `${_el}${getMods(_el, _mods)}`;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const createGlobalBem = () => {
|
|
37
|
+
return (el, mods) => {
|
|
38
|
+
if (!mods) {
|
|
39
|
+
return `y-${el}`;
|
|
40
|
+
}
|
|
41
|
+
return `${getMods(`y-${el}`, mods)}`;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const defaultLang = {
|
|
9
45
|
"pull-refresh": {
|
|
10
46
|
pulling: "下拉刷新...",
|
|
11
47
|
loosing: "释放刷新...",
|
|
@@ -17,15 +53,22 @@ const oe = (e) => (t) => Object.prototype.toString.call(t) === `[object ${e}]`,
|
|
|
17
53
|
validateMessage: "请输入正确内容"
|
|
18
54
|
}
|
|
19
55
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"zh-CN":
|
|
56
|
+
ref("zh-CN");
|
|
57
|
+
reactive({
|
|
58
|
+
"zh-CN": defaultLang
|
|
23
59
|
});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
return [
|
|
27
|
-
}
|
|
28
|
-
|
|
60
|
+
const createNamespace = (name2) => {
|
|
61
|
+
const prefixedName = `y-${name2}`;
|
|
62
|
+
return [prefixedName, createBEM(prefixedName), createGlobalBem()];
|
|
63
|
+
};
|
|
64
|
+
const parseUnit = (val) => {
|
|
65
|
+
if (isNaN(Number(val)) && typeof val === "string") {
|
|
66
|
+
return val;
|
|
67
|
+
}
|
|
68
|
+
return `${val}px`;
|
|
69
|
+
};
|
|
70
|
+
const parseFlexDirection = (location) => {
|
|
71
|
+
switch (location) {
|
|
29
72
|
case "top":
|
|
30
73
|
return "column-reverse";
|
|
31
74
|
case "bottom":
|
|
@@ -37,11 +80,13 @@ const w = (e) => {
|
|
|
37
80
|
default:
|
|
38
81
|
return "column";
|
|
39
82
|
}
|
|
40
|
-
}
|
|
83
|
+
};
|
|
84
|
+
const [name$4, bem$5, gBem$2] = createNamespace("mask");
|
|
85
|
+
const _props$3 = {
|
|
41
86
|
// 控制显示
|
|
42
87
|
modelValue: {
|
|
43
88
|
type: Boolean,
|
|
44
|
-
default:
|
|
89
|
+
default: false
|
|
45
90
|
},
|
|
46
91
|
// 层级
|
|
47
92
|
zIndex: {
|
|
@@ -66,87 +111,118 @@ const w = (e) => {
|
|
|
66
111
|
// 触摸滚动开关
|
|
67
112
|
lockScroll: {
|
|
68
113
|
type: Boolean,
|
|
69
|
-
default:
|
|
114
|
+
default: true
|
|
70
115
|
},
|
|
71
116
|
onAfterLeave: {
|
|
72
117
|
type: Function,
|
|
73
118
|
default: null
|
|
74
119
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
120
|
+
};
|
|
121
|
+
const stack = reactive([]);
|
|
122
|
+
let num$1 = 0;
|
|
123
|
+
const Mask = /* @__PURE__ */ defineComponent({
|
|
124
|
+
name: name$4,
|
|
125
|
+
props: _props$3,
|
|
80
126
|
emits: ["update:modelValue"],
|
|
81
|
-
setup(
|
|
82
|
-
slots
|
|
127
|
+
setup(props, {
|
|
128
|
+
slots
|
|
83
129
|
}) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
n >= 0 && S.splice(n, 1);
|
|
90
|
-
}), pe(() => e.modelValue, (n) => {
|
|
91
|
-
a(n);
|
|
130
|
+
const id = ref("");
|
|
131
|
+
onMounted(() => {
|
|
132
|
+
id.value = `mask${num$1}`;
|
|
133
|
+
num$1 += 1;
|
|
134
|
+
stackIntercept(props.modelValue, true);
|
|
92
135
|
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
136
|
+
onUnmounted(() => {
|
|
137
|
+
const index = stack.findIndex((v) => v._id === id.value);
|
|
138
|
+
index >= 0 && stack.splice(index, 1);
|
|
139
|
+
});
|
|
140
|
+
watch(() => props.modelValue, (val) => {
|
|
141
|
+
stackIntercept(val);
|
|
142
|
+
});
|
|
143
|
+
const stackIntercept = (val, isMounted) => {
|
|
144
|
+
if (val) {
|
|
145
|
+
stack.unshift({
|
|
146
|
+
_id: id.value,
|
|
147
|
+
_state: val
|
|
148
|
+
});
|
|
149
|
+
if (stack.length > 1) {
|
|
150
|
+
stack[1]._state = false;
|
|
151
|
+
}
|
|
152
|
+
} else if (!isMounted) {
|
|
153
|
+
stack.splice(0, 1);
|
|
154
|
+
if (stack.length > 0) {
|
|
155
|
+
stack[0]._state = true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const find = () => {
|
|
160
|
+
let _state = false;
|
|
161
|
+
for (let i = 0; i < stack.length; i++) {
|
|
162
|
+
if (stack[i]._id === id.value) {
|
|
163
|
+
_state = stack[i]._state;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
102
166
|
return {
|
|
103
|
-
_state
|
|
167
|
+
_state
|
|
104
168
|
};
|
|
105
|
-
}
|
|
169
|
+
};
|
|
170
|
+
const onTouchMove = (payload) => {
|
|
106
171
|
const {
|
|
107
|
-
lockScroll
|
|
108
|
-
} =
|
|
109
|
-
|
|
172
|
+
lockScroll
|
|
173
|
+
} = props;
|
|
174
|
+
if (lockScroll) {
|
|
175
|
+
payload.preventDefault();
|
|
176
|
+
payload.stopPropagation();
|
|
177
|
+
}
|
|
110
178
|
};
|
|
111
179
|
return () => {
|
|
112
180
|
const {
|
|
113
|
-
customClass
|
|
114
|
-
duration
|
|
115
|
-
zIndex
|
|
116
|
-
customStyle
|
|
117
|
-
onAfterLeave
|
|
118
|
-
} =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
181
|
+
customClass,
|
|
182
|
+
duration,
|
|
183
|
+
zIndex,
|
|
184
|
+
customStyle,
|
|
185
|
+
onAfterLeave
|
|
186
|
+
} = props;
|
|
187
|
+
const {
|
|
188
|
+
_state
|
|
189
|
+
} = find();
|
|
190
|
+
return createVNode(Transition, {
|
|
191
|
+
"name": gBem$2("animation", "fade"),
|
|
192
|
+
"onAfterLeave": onAfterLeave
|
|
124
193
|
}, {
|
|
125
194
|
default: () => {
|
|
126
|
-
var
|
|
127
|
-
return [
|
|
128
|
-
style: {
|
|
129
|
-
animationDuration: `${
|
|
130
|
-
zIndex
|
|
131
|
-
...
|
|
195
|
+
var _a;
|
|
196
|
+
return [withDirectives(createVNode("div", {
|
|
197
|
+
"style": {
|
|
198
|
+
animationDuration: `${duration}ms`,
|
|
199
|
+
zIndex,
|
|
200
|
+
...customStyle
|
|
132
201
|
},
|
|
133
|
-
class: [
|
|
134
|
-
onTouchmove:
|
|
135
|
-
}, [(
|
|
202
|
+
"class": [bem$5(), customClass],
|
|
203
|
+
"onTouchmove": onTouchMove
|
|
204
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, _state]])];
|
|
136
205
|
}
|
|
137
206
|
});
|
|
138
207
|
};
|
|
139
208
|
}
|
|
140
209
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
210
|
+
const reset = "";
|
|
211
|
+
const libs = "";
|
|
212
|
+
const font = "";
|
|
213
|
+
const animation = "";
|
|
214
|
+
const theme = "";
|
|
215
|
+
const style$5 = "";
|
|
216
|
+
Mask.install = (app) => {
|
|
217
|
+
const { name: name2 } = Mask;
|
|
218
|
+
app.component(name2, Mask);
|
|
144
219
|
};
|
|
145
|
-
const [
|
|
220
|
+
const [name$3, bem$4, gBem$1] = createNamespace("popup");
|
|
221
|
+
const _props$2 = {
|
|
146
222
|
// 控制显示
|
|
147
223
|
modelValue: {
|
|
148
224
|
type: Boolean,
|
|
149
|
-
default:
|
|
225
|
+
default: false
|
|
150
226
|
},
|
|
151
227
|
// 位置
|
|
152
228
|
position: {
|
|
@@ -181,7 +257,7 @@ const [_e, Z, Ve] = w("popup"), Ae = {
|
|
|
181
257
|
// 点击遮罩是否关闭
|
|
182
258
|
isCloseOnClickMask: {
|
|
183
259
|
type: Boolean,
|
|
184
|
-
default:
|
|
260
|
+
default: true
|
|
185
261
|
},
|
|
186
262
|
onAfterLeave: {
|
|
187
263
|
type: Function,
|
|
@@ -189,107 +265,120 @@ const [_e, Z, Ve] = w("popup"), Ae = {
|
|
|
189
265
|
},
|
|
190
266
|
lockScroll: {
|
|
191
267
|
type: Boolean,
|
|
192
|
-
default:
|
|
268
|
+
default: true
|
|
193
269
|
},
|
|
194
270
|
zIndex: {
|
|
195
271
|
type: Number,
|
|
196
272
|
default: 101
|
|
197
273
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
274
|
+
};
|
|
275
|
+
const Popup = /* @__PURE__ */ defineComponent({
|
|
276
|
+
name: name$3,
|
|
277
|
+
props: _props$2,
|
|
201
278
|
emits: ["clickMask", "update:modelValue"],
|
|
202
|
-
setup(
|
|
203
|
-
slots
|
|
204
|
-
emit
|
|
279
|
+
setup(props, {
|
|
280
|
+
slots,
|
|
281
|
+
emit
|
|
205
282
|
}) {
|
|
206
|
-
const
|
|
283
|
+
const style2 = computed(() => {
|
|
207
284
|
const {
|
|
208
|
-
position
|
|
209
|
-
borderRadius
|
|
210
|
-
customStyle
|
|
211
|
-
duration
|
|
212
|
-
} =
|
|
213
|
-
|
|
214
|
-
|
|
285
|
+
position,
|
|
286
|
+
borderRadius,
|
|
287
|
+
customStyle,
|
|
288
|
+
duration
|
|
289
|
+
} = props;
|
|
290
|
+
const tbR = parseUnit(borderRadius);
|
|
291
|
+
let br = `0`;
|
|
292
|
+
switch (position) {
|
|
215
293
|
case "top":
|
|
216
|
-
|
|
294
|
+
br = ` 0 0 ${tbR} ${tbR}`;
|
|
217
295
|
break;
|
|
218
296
|
case "bottom":
|
|
219
|
-
|
|
297
|
+
br = `${tbR} ${tbR} 0 0`;
|
|
220
298
|
break;
|
|
221
299
|
case "left":
|
|
222
|
-
|
|
300
|
+
br = `0 ${tbR} ${tbR} 0`;
|
|
223
301
|
break;
|
|
224
302
|
case "right":
|
|
225
|
-
|
|
303
|
+
br = `${tbR} 0 0 ${tbR}`;
|
|
226
304
|
break;
|
|
227
305
|
default:
|
|
228
|
-
|
|
306
|
+
br = `${tbR}`;
|
|
229
307
|
}
|
|
230
308
|
return {
|
|
231
|
-
borderRadius:
|
|
232
|
-
animationDuration: `${
|
|
233
|
-
...
|
|
309
|
+
borderRadius: br,
|
|
310
|
+
animationDuration: `${duration}ms`,
|
|
311
|
+
...customStyle
|
|
234
312
|
};
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
313
|
+
});
|
|
314
|
+
const onClickMask = (event) => {
|
|
315
|
+
emit("clickMask", event);
|
|
316
|
+
if (props.isCloseOnClickMask) {
|
|
317
|
+
visible.value = false;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
const visible = computed({
|
|
321
|
+
get: () => props.modelValue,
|
|
322
|
+
set: (value) => emit("update:modelValue", value)
|
|
240
323
|
});
|
|
241
324
|
return () => {
|
|
242
325
|
const {
|
|
243
|
-
teleport
|
|
244
|
-
position
|
|
245
|
-
customClass
|
|
246
|
-
duration
|
|
247
|
-
onAfterLeave
|
|
248
|
-
lockScroll
|
|
249
|
-
zIndex
|
|
250
|
-
} =
|
|
251
|
-
return
|
|
252
|
-
to:
|
|
326
|
+
teleport,
|
|
327
|
+
position,
|
|
328
|
+
customClass,
|
|
329
|
+
duration,
|
|
330
|
+
onAfterLeave,
|
|
331
|
+
lockScroll,
|
|
332
|
+
zIndex
|
|
333
|
+
} = props;
|
|
334
|
+
return createVNode(Teleport, {
|
|
335
|
+
"to": teleport
|
|
253
336
|
}, {
|
|
254
|
-
default: () => [
|
|
255
|
-
class:
|
|
256
|
-
style: {
|
|
257
|
-
zIndex
|
|
337
|
+
default: () => [createVNode("div", {
|
|
338
|
+
"class": bem$4(),
|
|
339
|
+
"style": {
|
|
340
|
+
zIndex
|
|
258
341
|
}
|
|
259
|
-
}, [
|
|
260
|
-
modelValue:
|
|
261
|
-
"onUpdate:modelValue": (
|
|
262
|
-
duration:
|
|
263
|
-
lockScroll:
|
|
264
|
-
onClick:
|
|
265
|
-
onAfterLeave:
|
|
266
|
-
}, null),
|
|
267
|
-
name:
|
|
342
|
+
}, [createVNode(Mask, {
|
|
343
|
+
"modelValue": visible.value,
|
|
344
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
345
|
+
"duration": duration,
|
|
346
|
+
"lockScroll": lockScroll,
|
|
347
|
+
"onClick": onClickMask,
|
|
348
|
+
"onAfterLeave": onAfterLeave
|
|
349
|
+
}, null), createVNode(Transition, {
|
|
350
|
+
"name": gBem$1("animation", `slide-${position}`)
|
|
268
351
|
}, {
|
|
269
352
|
default: () => {
|
|
270
|
-
var
|
|
271
|
-
return [
|
|
272
|
-
style:
|
|
273
|
-
class: [
|
|
274
|
-
[
|
|
275
|
-
}),
|
|
276
|
-
}, [((
|
|
353
|
+
var _a;
|
|
354
|
+
return [withDirectives(createVNode("div", {
|
|
355
|
+
"style": style2.value,
|
|
356
|
+
"class": [bem$4("content", {
|
|
357
|
+
[position]: position
|
|
358
|
+
}), customClass]
|
|
359
|
+
}, [((_a = slots.default) == null ? void 0 : _a.call(slots)) || null]), [[vShow, visible.value]])];
|
|
277
360
|
}
|
|
278
361
|
})])]
|
|
279
362
|
});
|
|
280
363
|
};
|
|
281
364
|
}
|
|
282
365
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
366
|
+
const style$4 = "";
|
|
367
|
+
Popup.install = (app) => {
|
|
368
|
+
const { name: name2 } = Popup;
|
|
369
|
+
app.component(name2, Popup);
|
|
286
370
|
};
|
|
287
|
-
const [
|
|
288
|
-
|
|
371
|
+
const [cname, bem$3] = createNamespace("icon");
|
|
372
|
+
const isImage = (name2) => {
|
|
373
|
+
const re = new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/);
|
|
374
|
+
return re.test(name2.toLowerCase());
|
|
375
|
+
};
|
|
376
|
+
const Icon = /* @__PURE__ */ defineComponent({
|
|
377
|
+
name: cname,
|
|
289
378
|
props: {
|
|
290
379
|
dot: {
|
|
291
380
|
type: Boolean,
|
|
292
|
-
default:
|
|
381
|
+
default: false
|
|
293
382
|
},
|
|
294
383
|
name: {
|
|
295
384
|
type: String,
|
|
@@ -332,62 +421,66 @@ const [ze, z] = w("icon"), Ie = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|web
|
|
|
332
421
|
}
|
|
333
422
|
},
|
|
334
423
|
emits: ["click"],
|
|
335
|
-
setup(
|
|
336
|
-
slots
|
|
337
|
-
emit
|
|
424
|
+
setup(props, {
|
|
425
|
+
slots,
|
|
426
|
+
emit
|
|
338
427
|
}) {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
428
|
+
const isImg = isImage(props.name);
|
|
429
|
+
const getStyle = () => ({
|
|
430
|
+
fontSize: parseUnit(props.size),
|
|
431
|
+
color: props.color
|
|
432
|
+
});
|
|
433
|
+
const onClick = (event) => {
|
|
434
|
+
emit("click", event);
|
|
344
435
|
};
|
|
345
436
|
return () => {
|
|
346
437
|
const {
|
|
347
|
-
name:
|
|
348
|
-
classPrefix
|
|
349
|
-
badge
|
|
350
|
-
dot
|
|
351
|
-
subColor
|
|
352
|
-
subBg
|
|
353
|
-
tag:
|
|
354
|
-
} =
|
|
355
|
-
return
|
|
356
|
-
class: `${
|
|
357
|
-
style:
|
|
358
|
-
onClick:
|
|
438
|
+
name: name2,
|
|
439
|
+
classPrefix,
|
|
440
|
+
badge,
|
|
441
|
+
dot,
|
|
442
|
+
subColor,
|
|
443
|
+
subBg,
|
|
444
|
+
tag: Tag
|
|
445
|
+
} = props;
|
|
446
|
+
return createVNode(Tag, {
|
|
447
|
+
"class": `${classPrefix}${isImg ? "" : ` y-icon--${name2}`}`,
|
|
448
|
+
"style": getStyle(),
|
|
449
|
+
"onClick": onClick
|
|
359
450
|
}, {
|
|
360
451
|
default: () => {
|
|
361
|
-
var
|
|
362
|
-
return [
|
|
363
|
-
class:
|
|
364
|
-
}, [
|
|
365
|
-
class:
|
|
366
|
-
src:
|
|
367
|
-
alt: "icon"
|
|
368
|
-
}, null)]) : null,
|
|
369
|
-
class:
|
|
370
|
-
style: {
|
|
371
|
-
backgroundColor:
|
|
452
|
+
var _a;
|
|
453
|
+
return [isImg ? createVNode("em", {
|
|
454
|
+
"class": bem$3("node")
|
|
455
|
+
}, [createVNode("img", {
|
|
456
|
+
"class": bem$3("image"),
|
|
457
|
+
"src": name2,
|
|
458
|
+
"alt": "icon"
|
|
459
|
+
}, null)]) : null, dot ? createVNode("em", {
|
|
460
|
+
"class": bem$3("dot"),
|
|
461
|
+
"style": {
|
|
462
|
+
backgroundColor: subBg
|
|
372
463
|
}
|
|
373
|
-
}, null) : null,
|
|
374
|
-
class:
|
|
375
|
-
style: {
|
|
376
|
-
color:
|
|
377
|
-
backgroundColor:
|
|
464
|
+
}, null) : null, badge ? createVNode("em", {
|
|
465
|
+
"class": bem$3("badge"),
|
|
466
|
+
"style": {
|
|
467
|
+
color: subColor,
|
|
468
|
+
backgroundColor: subBg
|
|
378
469
|
}
|
|
379
|
-
}, [
|
|
470
|
+
}, [badge]) : null, ((_a = slots.default) == null ? void 0 : _a.call(slots)) || null];
|
|
380
471
|
}
|
|
381
472
|
});
|
|
382
473
|
};
|
|
383
474
|
}
|
|
384
475
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
476
|
+
const style$3 = "";
|
|
477
|
+
Icon.install = (app) => {
|
|
478
|
+
const { name: name2 } = Icon;
|
|
479
|
+
app.component(name2, Icon);
|
|
388
480
|
};
|
|
389
|
-
const [
|
|
390
|
-
|
|
481
|
+
const [name$2, bem$2, gBem] = createNamespace("button");
|
|
482
|
+
const Button = /* @__PURE__ */ defineComponent({
|
|
483
|
+
name: name$2,
|
|
391
484
|
props: {
|
|
392
485
|
// 标签
|
|
393
486
|
tag: {
|
|
@@ -412,7 +505,7 @@ const [Le, B, Me] = w("button"), _ = /* @__PURE__ */ x({
|
|
|
412
505
|
// 不可以状态
|
|
413
506
|
disabled: {
|
|
414
507
|
type: Boolean,
|
|
415
|
-
default:
|
|
508
|
+
default: false
|
|
416
509
|
},
|
|
417
510
|
// 阴影
|
|
418
511
|
shadow: {
|
|
@@ -422,12 +515,12 @@ const [Le, B, Me] = w("button"), _ = /* @__PURE__ */ x({
|
|
|
422
515
|
// 方形
|
|
423
516
|
square: {
|
|
424
517
|
type: Boolean,
|
|
425
|
-
default:
|
|
518
|
+
default: false
|
|
426
519
|
},
|
|
427
520
|
// 半圆弧
|
|
428
521
|
semicircle: {
|
|
429
522
|
type: Boolean,
|
|
430
|
-
default:
|
|
523
|
+
default: false
|
|
431
524
|
},
|
|
432
525
|
// 自定义圆角
|
|
433
526
|
radius: {
|
|
@@ -442,73 +535,77 @@ const [Le, B, Me] = w("button"), _ = /* @__PURE__ */ x({
|
|
|
442
535
|
// block 自动填满父布局
|
|
443
536
|
block: {
|
|
444
537
|
type: Boolean,
|
|
445
|
-
default:
|
|
538
|
+
default: false
|
|
446
539
|
},
|
|
447
540
|
// 危险按钮状态
|
|
448
541
|
danger: {
|
|
449
542
|
type: Boolean,
|
|
450
|
-
default:
|
|
543
|
+
default: false
|
|
451
544
|
}
|
|
452
545
|
},
|
|
453
546
|
emits: ["click"],
|
|
454
|
-
setup(
|
|
455
|
-
slots
|
|
456
|
-
emit
|
|
547
|
+
setup(props, {
|
|
548
|
+
slots,
|
|
549
|
+
emit
|
|
457
550
|
}) {
|
|
458
|
-
const
|
|
459
|
-
|
|
551
|
+
const onClick = (event) => {
|
|
552
|
+
emit("click", event);
|
|
460
553
|
};
|
|
461
554
|
return () => {
|
|
462
555
|
let {
|
|
463
|
-
tag:
|
|
464
|
-
} =
|
|
556
|
+
tag: Tag
|
|
557
|
+
} = props;
|
|
465
558
|
const {
|
|
466
|
-
radius
|
|
467
|
-
type
|
|
468
|
-
size
|
|
469
|
-
disabled
|
|
470
|
-
shadow
|
|
471
|
-
block
|
|
472
|
-
square
|
|
473
|
-
semicircle
|
|
474
|
-
danger
|
|
475
|
-
text
|
|
476
|
-
supplementText
|
|
477
|
-
} =
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
559
|
+
radius,
|
|
560
|
+
type,
|
|
561
|
+
size,
|
|
562
|
+
disabled,
|
|
563
|
+
shadow,
|
|
564
|
+
block,
|
|
565
|
+
square,
|
|
566
|
+
semicircle,
|
|
567
|
+
danger,
|
|
568
|
+
text,
|
|
569
|
+
supplementText
|
|
570
|
+
} = props;
|
|
571
|
+
const showText = slots.default ? slots.default() : text;
|
|
572
|
+
Tag = type === "link" ? "a" : Tag;
|
|
573
|
+
return createVNode(Tag, {
|
|
574
|
+
"class": [bem$2([type, size, {
|
|
575
|
+
block,
|
|
576
|
+
square,
|
|
577
|
+
semicircle,
|
|
578
|
+
disabled: disabled && Tag === "a"
|
|
579
|
+
}, (type === "primary" || type === "secondary") && shadow ? `shadow_${shadow}` : "", danger ? `${type}_danger` : "", disabled ? `${type}_disabled` : ""]), gBem("el", "clickable")],
|
|
580
|
+
"style": {
|
|
581
|
+
borderRadius: parseUnit(radius)
|
|
487
582
|
},
|
|
488
|
-
disabled:
|
|
489
|
-
onClick:
|
|
583
|
+
"disabled": disabled,
|
|
584
|
+
"onClick": onClick
|
|
490
585
|
}, {
|
|
491
586
|
default: () => {
|
|
492
|
-
var
|
|
493
|
-
return [
|
|
494
|
-
class:
|
|
495
|
-
}, [((
|
|
496
|
-
class:
|
|
497
|
-
}, [
|
|
498
|
-
class:
|
|
499
|
-
}, [
|
|
500
|
-
class:
|
|
501
|
-
}, [
|
|
587
|
+
var _a, _b;
|
|
588
|
+
return [createVNode("div", {
|
|
589
|
+
"class": bem$2("content")
|
|
590
|
+
}, [((_a = slots.leftIcon) == null ? void 0 : _a.call(slots)) || null, showText && createVNode(Fragment, null, [supplementText ? createVNode("div", {
|
|
591
|
+
"class": bem$2("text")
|
|
592
|
+
}, [createVNode("p", null, [showText]), createVNode("p", {
|
|
593
|
+
"class": bem$2("subtext")
|
|
594
|
+
}, [supplementText])]) : createVNode("span", {
|
|
595
|
+
"class": bem$2("text")
|
|
596
|
+
}, [showText])]), ((_b = slots.rightIcon) == null ? void 0 : _b.call(slots)) || null])];
|
|
502
597
|
}
|
|
503
598
|
});
|
|
504
599
|
};
|
|
505
600
|
}
|
|
506
601
|
});
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
602
|
+
const style$2 = "";
|
|
603
|
+
Button.install = (app) => {
|
|
604
|
+
const { name: name2 } = Button;
|
|
605
|
+
app.component(name2, Button);
|
|
510
606
|
};
|
|
511
|
-
const [
|
|
607
|
+
const [name$1, bem$1] = createNamespace("loading");
|
|
608
|
+
const _props$1 = {
|
|
512
609
|
// Loading icon 的颜色
|
|
513
610
|
color: {
|
|
514
611
|
type: String,
|
|
@@ -567,97 +664,107 @@ const [Re, C] = w("loading"), Oe = {
|
|
|
567
664
|
type: String,
|
|
568
665
|
default: "relative"
|
|
569
666
|
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
667
|
+
};
|
|
668
|
+
const Loading = /* @__PURE__ */ defineComponent({
|
|
669
|
+
name: name$1,
|
|
670
|
+
props: _props$1,
|
|
671
|
+
setup(props, {
|
|
672
|
+
slots
|
|
575
673
|
}) {
|
|
576
674
|
return () => {
|
|
577
|
-
var
|
|
675
|
+
var _a, _b;
|
|
578
676
|
const {
|
|
579
|
-
position
|
|
580
|
-
textLocation
|
|
581
|
-
bgColor
|
|
582
|
-
bgBorderRadius
|
|
583
|
-
size
|
|
584
|
-
padding
|
|
585
|
-
color
|
|
586
|
-
thick
|
|
587
|
-
direction
|
|
588
|
-
text
|
|
589
|
-
textColor
|
|
590
|
-
textSize
|
|
591
|
-
} =
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
677
|
+
position,
|
|
678
|
+
textLocation,
|
|
679
|
+
bgColor,
|
|
680
|
+
bgBorderRadius,
|
|
681
|
+
size,
|
|
682
|
+
padding,
|
|
683
|
+
color,
|
|
684
|
+
thick,
|
|
685
|
+
direction,
|
|
686
|
+
text,
|
|
687
|
+
textColor,
|
|
688
|
+
textSize
|
|
689
|
+
} = props;
|
|
690
|
+
const showText = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || text;
|
|
691
|
+
return createVNode("div", {
|
|
692
|
+
"class": bem$1({
|
|
693
|
+
[position]: position !== "relative"
|
|
595
694
|
})
|
|
596
|
-
}, [
|
|
597
|
-
class:
|
|
598
|
-
[
|
|
695
|
+
}, [createVNode("div", {
|
|
696
|
+
"class": bem$1("bg", {
|
|
697
|
+
[position]: position !== "relative"
|
|
599
698
|
}),
|
|
600
|
-
style: {
|
|
601
|
-
flexDirection:
|
|
602
|
-
backgroundColor:
|
|
603
|
-
borderRadius:
|
|
604
|
-
padding:
|
|
699
|
+
"style": {
|
|
700
|
+
flexDirection: parseFlexDirection(textLocation),
|
|
701
|
+
backgroundColor: bgColor,
|
|
702
|
+
borderRadius: parseUnit(bgBorderRadius),
|
|
703
|
+
padding: parseUnit(padding)
|
|
605
704
|
}
|
|
606
|
-
}, [
|
|
607
|
-
class:
|
|
608
|
-
style: {
|
|
609
|
-
width:
|
|
610
|
-
height:
|
|
705
|
+
}, [createVNode("span", {
|
|
706
|
+
"class": bem$1("icon-wrapper"),
|
|
707
|
+
"style": {
|
|
708
|
+
width: parseUnit(size),
|
|
709
|
+
height: parseUnit(size)
|
|
611
710
|
}
|
|
612
|
-
}, [((
|
|
613
|
-
class:
|
|
614
|
-
[
|
|
711
|
+
}, [((_b = slots.icon) == null ? void 0 : _b.call(slots)) || createVNode("svg", {
|
|
712
|
+
"class": bem$1("icon", {
|
|
713
|
+
[direction]: direction
|
|
615
714
|
}),
|
|
616
|
-
viewBox: "25 25 50 50"
|
|
617
|
-
}, [
|
|
618
|
-
class:
|
|
619
|
-
style: {
|
|
620
|
-
stroke:
|
|
621
|
-
strokeWidth:
|
|
715
|
+
"viewBox": "25 25 50 50"
|
|
716
|
+
}, [createVNode("circle", {
|
|
717
|
+
"class": bem$1("icon-circle"),
|
|
718
|
+
"style": {
|
|
719
|
+
stroke: color,
|
|
720
|
+
strokeWidth: parseUnit(thick)
|
|
622
721
|
},
|
|
623
|
-
cx: "50",
|
|
624
|
-
cy: "50",
|
|
625
|
-
r: "20",
|
|
626
|
-
fill: "none"
|
|
627
|
-
}, null)])]),
|
|
628
|
-
class:
|
|
629
|
-
[
|
|
722
|
+
"cx": "50",
|
|
723
|
+
"cy": "50",
|
|
724
|
+
"r": "20",
|
|
725
|
+
"fill": "none"
|
|
726
|
+
}, null)])]), showText && createVNode("span", {
|
|
727
|
+
"class": bem$1("text", {
|
|
728
|
+
[textLocation]: textLocation
|
|
630
729
|
}),
|
|
631
|
-
style: {
|
|
632
|
-
color:
|
|
633
|
-
fontSize:
|
|
730
|
+
"style": {
|
|
731
|
+
color: textColor,
|
|
732
|
+
fontSize: parseUnit(textSize)
|
|
634
733
|
}
|
|
635
|
-
}, [
|
|
734
|
+
}, [showText])])]);
|
|
636
735
|
};
|
|
637
736
|
}
|
|
638
|
-
})
|
|
737
|
+
});
|
|
738
|
+
const globalOptions = {
|
|
639
739
|
position: "fixed"
|
|
640
740
|
};
|
|
641
|
-
let
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
render: () =>
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
741
|
+
let instance = null;
|
|
742
|
+
const initInstance = (customProps, customSlots) => {
|
|
743
|
+
const wrapper = {
|
|
744
|
+
render: () => {
|
|
745
|
+
return h(Loading, { ...customProps }, { ...customSlots });
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
const customApp = createApp(wrapper);
|
|
749
|
+
const element = document.createElement("div");
|
|
750
|
+
return customApp.mount(element);
|
|
751
|
+
};
|
|
752
|
+
const createLoading = {
|
|
648
753
|
/**
|
|
649
754
|
* @description: show
|
|
650
755
|
* @param {LoadingPropsType} options
|
|
651
756
|
* @return {*}
|
|
652
757
|
*/
|
|
653
|
-
show: (
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
758
|
+
show: (customProps, customSlots) => {
|
|
759
|
+
if (!instance)
|
|
760
|
+
instance = initInstance(
|
|
761
|
+
{
|
|
762
|
+
...globalOptions,
|
|
763
|
+
...customProps
|
|
764
|
+
},
|
|
765
|
+
customSlots
|
|
766
|
+
);
|
|
767
|
+
document.body.appendChild(instance.$el);
|
|
661
768
|
},
|
|
662
769
|
/**
|
|
663
770
|
* @description: hide
|
|
@@ -665,47 +772,73 @@ const ae = (e, t) => {
|
|
|
665
772
|
* @return {*}
|
|
666
773
|
*/
|
|
667
774
|
hide: () => {
|
|
668
|
-
|
|
775
|
+
instance && instance.$el.remove();
|
|
669
776
|
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
777
|
+
};
|
|
778
|
+
const toggleLoading = (el, binding) => {
|
|
779
|
+
if (binding.value) {
|
|
780
|
+
el.classList.add("y-loading__wrap");
|
|
781
|
+
el.appendChild(el.instance.$el);
|
|
782
|
+
} else {
|
|
783
|
+
el.classList.remove("y-loading__wrap");
|
|
784
|
+
el.removeChild(el.instance.$el);
|
|
675
785
|
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
786
|
+
};
|
|
787
|
+
const loadingDirective = {
|
|
788
|
+
install: (app) => {
|
|
789
|
+
app.directive("loading", directive);
|
|
790
|
+
app.directive("loading-props", directiveProps);
|
|
791
|
+
app.directive("loading-slots", directiveSlots);
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
const directive = {
|
|
795
|
+
getSSRProps: (binding) => {
|
|
796
|
+
return { ...binding };
|
|
680
797
|
},
|
|
681
|
-
|
|
682
|
-
|
|
798
|
+
mounted: (el, binding) => {
|
|
799
|
+
el.instance = initInstance({ ...el.customProps }, { ...el.customSlots });
|
|
800
|
+
binding.value && toggleLoading(el, binding);
|
|
801
|
+
},
|
|
802
|
+
updated: (el, binding) => {
|
|
803
|
+
if (binding.oldValue !== binding.value) {
|
|
804
|
+
toggleLoading(el, binding);
|
|
805
|
+
}
|
|
683
806
|
},
|
|
684
|
-
unmounted: (
|
|
685
|
-
|
|
807
|
+
unmounted: (el) => {
|
|
808
|
+
el.instance && el.instance.$el.remove();
|
|
686
809
|
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
810
|
+
};
|
|
811
|
+
const directiveProps = {
|
|
812
|
+
getSSRProps: (binding) => {
|
|
813
|
+
return { ...binding };
|
|
814
|
+
},
|
|
815
|
+
beforeMount: (el, binding) => {
|
|
816
|
+
el.customProps = { ...binding.value };
|
|
691
817
|
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
818
|
+
};
|
|
819
|
+
const directiveSlots = {
|
|
820
|
+
getSSRProps: (binding) => {
|
|
821
|
+
return { ...binding };
|
|
822
|
+
},
|
|
823
|
+
beforeMount: (el, binding) => {
|
|
824
|
+
el.customSlots = { ...binding.value };
|
|
696
825
|
}
|
|
697
826
|
};
|
|
698
|
-
|
|
699
|
-
|
|
827
|
+
const style$1 = "";
|
|
828
|
+
Loading.install = (app) => {
|
|
829
|
+
app.component(Loading.name, Loading);
|
|
830
|
+
app.provide("loading", createLoading);
|
|
831
|
+
app.use(loadingDirective);
|
|
700
832
|
};
|
|
701
|
-
function
|
|
702
|
-
return typeof
|
|
833
|
+
function _isSlot(s) {
|
|
834
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
703
835
|
}
|
|
704
|
-
const [
|
|
836
|
+
const [name, bem] = createNamespace("dialog");
|
|
837
|
+
const _props = {
|
|
705
838
|
// 控制显示
|
|
706
839
|
modelValue: {
|
|
707
840
|
type: Boolean,
|
|
708
|
-
default:
|
|
841
|
+
default: false
|
|
709
842
|
},
|
|
710
843
|
width: {
|
|
711
844
|
type: [Number, String],
|
|
@@ -729,15 +862,15 @@ const [Ue, v] = w("dialog"), qe = {
|
|
|
729
862
|
},
|
|
730
863
|
isCloseOnClickMask: {
|
|
731
864
|
type: Boolean,
|
|
732
|
-
default:
|
|
865
|
+
default: true
|
|
733
866
|
},
|
|
734
867
|
showCloseIcon: {
|
|
735
868
|
type: Boolean,
|
|
736
|
-
default:
|
|
869
|
+
default: false
|
|
737
870
|
},
|
|
738
871
|
showCancelBtn: {
|
|
739
872
|
type: Boolean,
|
|
740
|
-
default:
|
|
873
|
+
default: false
|
|
741
874
|
},
|
|
742
875
|
cancelButtonText: {
|
|
743
876
|
type: String,
|
|
@@ -745,7 +878,7 @@ const [Ue, v] = w("dialog"), qe = {
|
|
|
745
878
|
},
|
|
746
879
|
showConfirmBtn: {
|
|
747
880
|
type: Boolean,
|
|
748
|
-
default:
|
|
881
|
+
default: false
|
|
749
882
|
},
|
|
750
883
|
confirmButtonText: {
|
|
751
884
|
type: String,
|
|
@@ -765,188 +898,226 @@ const [Ue, v] = w("dialog"), qe = {
|
|
|
765
898
|
},
|
|
766
899
|
circleImg: {
|
|
767
900
|
type: Boolean,
|
|
768
|
-
default:
|
|
901
|
+
default: false
|
|
769
902
|
},
|
|
770
903
|
// 插入对象
|
|
771
904
|
teleport: {
|
|
772
905
|
type: String,
|
|
773
906
|
default: "body"
|
|
774
907
|
}
|
|
775
|
-
}
|
|
776
|
-
|
|
908
|
+
};
|
|
909
|
+
const Dialog = /* @__PURE__ */ defineComponent({
|
|
910
|
+
name,
|
|
777
911
|
directives: {
|
|
778
|
-
loading:
|
|
912
|
+
loading: directive
|
|
779
913
|
},
|
|
780
|
-
props:
|
|
914
|
+
props: _props,
|
|
781
915
|
emits: ["update:modelValue", "cancel", "confirm"],
|
|
782
|
-
setup(
|
|
783
|
-
emit
|
|
784
|
-
slots
|
|
916
|
+
setup(props, {
|
|
917
|
+
emit,
|
|
918
|
+
slots
|
|
785
919
|
}) {
|
|
786
|
-
const
|
|
787
|
-
cancel:
|
|
788
|
-
confirm:
|
|
789
|
-
})
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
920
|
+
const loading = reactive({
|
|
921
|
+
cancel: false,
|
|
922
|
+
confirm: false
|
|
923
|
+
});
|
|
924
|
+
const update = (value) => {
|
|
925
|
+
visible.value = value;
|
|
926
|
+
};
|
|
927
|
+
const onClose = (actionType) => {
|
|
928
|
+
var _a;
|
|
929
|
+
update(false);
|
|
930
|
+
(_a = props.callback) == null ? void 0 : _a.call(props, actionType);
|
|
931
|
+
};
|
|
932
|
+
const onCancel = (event) => {
|
|
933
|
+
emit("cancel", event, onHandler("cancel"));
|
|
934
|
+
};
|
|
935
|
+
const onConfirm = (event) => {
|
|
936
|
+
emit("confirm", event, onHandler("confirm"));
|
|
937
|
+
};
|
|
938
|
+
const onHandler = (actionType) => {
|
|
799
939
|
const {
|
|
800
|
-
modelValue
|
|
801
|
-
beforeClose
|
|
802
|
-
} =
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
940
|
+
modelValue,
|
|
941
|
+
beforeClose
|
|
942
|
+
} = props;
|
|
943
|
+
if (!modelValue)
|
|
944
|
+
return;
|
|
945
|
+
if (isFunction(beforeClose)) {
|
|
946
|
+
loading[actionType] = true;
|
|
947
|
+
const fnReturn = beforeClose(actionType);
|
|
948
|
+
if (isPromise(fnReturn)) {
|
|
949
|
+
const promise = fnReturn;
|
|
950
|
+
promise.then((value) => {
|
|
951
|
+
done(value, actionType);
|
|
952
|
+
}).catch((e) => {
|
|
953
|
+
throw new Error(e);
|
|
954
|
+
});
|
|
955
|
+
} else {
|
|
956
|
+
done(fnReturn, actionType);
|
|
957
|
+
}
|
|
958
|
+
} else {
|
|
959
|
+
onClose(actionType);
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
const done = (value, actionType) => {
|
|
963
|
+
if (value) {
|
|
964
|
+
onClose(actionType);
|
|
965
|
+
loading[actionType] = false;
|
|
966
|
+
} else {
|
|
967
|
+
loading[actionType] = false;
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
const halfOfWidth = (val, multiple, processing) => {
|
|
971
|
+
let num2 = Number(val.substring(0, val.length - 2));
|
|
972
|
+
num2 /= multiple || 2;
|
|
973
|
+
return processing ? `${processing(num2)}px` : `${num2}px`;
|
|
974
|
+
};
|
|
975
|
+
const visible = computed({
|
|
976
|
+
get: () => props.modelValue,
|
|
977
|
+
set: (value) => emit("update:modelValue", value)
|
|
822
978
|
});
|
|
823
979
|
return () => {
|
|
824
980
|
const {
|
|
825
|
-
width
|
|
826
|
-
title
|
|
827
|
-
titleAlign
|
|
828
|
-
message
|
|
829
|
-
messageAlign
|
|
830
|
-
isCloseOnClickMask
|
|
831
|
-
showCloseIcon
|
|
832
|
-
showCancelBtn
|
|
833
|
-
cancelButtonText
|
|
834
|
-
showConfirmBtn
|
|
835
|
-
confirmButtonText
|
|
836
|
-
imgSrc
|
|
837
|
-
circleImg
|
|
838
|
-
teleport
|
|
839
|
-
} =
|
|
840
|
-
return
|
|
841
|
-
modelValue:
|
|
842
|
-
"onUpdate:modelValue": (
|
|
843
|
-
customClass:
|
|
844
|
-
customStyle: {
|
|
845
|
-
width:
|
|
981
|
+
width,
|
|
982
|
+
title,
|
|
983
|
+
titleAlign,
|
|
984
|
+
message,
|
|
985
|
+
messageAlign,
|
|
986
|
+
isCloseOnClickMask,
|
|
987
|
+
showCloseIcon,
|
|
988
|
+
showCancelBtn,
|
|
989
|
+
cancelButtonText,
|
|
990
|
+
showConfirmBtn,
|
|
991
|
+
confirmButtonText,
|
|
992
|
+
imgSrc,
|
|
993
|
+
circleImg,
|
|
994
|
+
teleport
|
|
995
|
+
} = props;
|
|
996
|
+
return createVNode(Popup, mergeProps({
|
|
997
|
+
"modelValue": visible.value,
|
|
998
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
999
|
+
"customClass": bem(),
|
|
1000
|
+
"customStyle": {
|
|
1001
|
+
width: parseUnit(width)
|
|
846
1002
|
}
|
|
847
1003
|
}, {
|
|
848
|
-
"onUpdate:modelValue":
|
|
1004
|
+
"onUpdate:modelValue": update
|
|
849
1005
|
}, {
|
|
850
|
-
isCloseOnClickMask:
|
|
851
|
-
teleport:
|
|
1006
|
+
"isCloseOnClickMask": isCloseOnClickMask,
|
|
1007
|
+
"teleport": teleport
|
|
852
1008
|
}), {
|
|
853
1009
|
default: () => {
|
|
854
|
-
var
|
|
855
|
-
return [((
|
|
856
|
-
class:
|
|
857
|
-
circle:
|
|
1010
|
+
var _a, _b, _c, _d;
|
|
1011
|
+
return [((_a = slots.img) == null ? void 0 : _a.call(slots)) || imgSrc && createVNode("div", {
|
|
1012
|
+
"class": bem("img", {
|
|
1013
|
+
circle: circleImg
|
|
858
1014
|
}),
|
|
859
|
-
style: {
|
|
860
|
-
top:
|
|
861
|
-
left:
|
|
1015
|
+
"style": {
|
|
1016
|
+
top: circleImg ? `-${halfOfWidth(parseUnit(width), 4)}` : "auto",
|
|
1017
|
+
left: circleImg ? `calc(50% - ${halfOfWidth(parseUnit(width), 4)})` : "auto"
|
|
862
1018
|
}
|
|
863
|
-
}, [
|
|
864
|
-
style: {
|
|
865
|
-
width:
|
|
866
|
-
height:
|
|
867
|
-
background: `url(${
|
|
868
|
-
borderRadius:
|
|
1019
|
+
}, [createVNode("div", {
|
|
1020
|
+
"style": {
|
|
1021
|
+
width: circleImg ? halfOfWidth(parseUnit(width)) : parseUnit(width),
|
|
1022
|
+
height: halfOfWidth(parseUnit(width)),
|
|
1023
|
+
background: `url(${imgSrc}) center`,
|
|
1024
|
+
borderRadius: circleImg ? "50%" : "20px 20px 0 0"
|
|
869
1025
|
}
|
|
870
|
-
}, null)]),
|
|
871
|
-
class:
|
|
872
|
-
}, [
|
|
873
|
-
style: {
|
|
874
|
-
height:
|
|
1026
|
+
}, null)]), createVNode("div", {
|
|
1027
|
+
"class": bem("container")
|
|
1028
|
+
}, [createVNode("div", {
|
|
1029
|
+
"style": {
|
|
1030
|
+
height: circleImg ? halfOfWidth(parseUnit(width), 4, (num2) => {
|
|
1031
|
+
return num2 + 20;
|
|
1032
|
+
}) : "24px"
|
|
875
1033
|
}
|
|
876
|
-
}, null), ((
|
|
877
|
-
class:
|
|
878
|
-
style: {
|
|
879
|
-
textAlign:
|
|
1034
|
+
}, null), ((_b = slots.title) == null ? void 0 : _b.call(slots)) || createVNode("div", {
|
|
1035
|
+
"class": bem("title"),
|
|
1036
|
+
"style": {
|
|
1037
|
+
textAlign: titleAlign
|
|
880
1038
|
}
|
|
881
|
-
}, [
|
|
882
|
-
class:
|
|
883
|
-
}, [
|
|
884
|
-
class:
|
|
885
|
-
style: {
|
|
886
|
-
textAlign:
|
|
1039
|
+
}, [title]), createVNode("div", {
|
|
1040
|
+
"class": bem("content")
|
|
1041
|
+
}, [createVNode("div", {
|
|
1042
|
+
"class": bem("message"),
|
|
1043
|
+
"style": {
|
|
1044
|
+
textAlign: messageAlign
|
|
887
1045
|
}
|
|
888
|
-
}, [((
|
|
889
|
-
class:
|
|
890
|
-
style: {
|
|
891
|
-
paddingTop:
|
|
1046
|
+
}, [((_c = slots.default) == null ? void 0 : _c.call(slots)) || message]), ((_d = slots.footer) == null ? void 0 : _d.call(slots)) || createVNode("div", {
|
|
1047
|
+
"class": bem("footer"),
|
|
1048
|
+
"style": {
|
|
1049
|
+
paddingTop: showCancelBtn || showConfirmBtn ? "20px" : "0px"
|
|
892
1050
|
}
|
|
893
|
-
}, [
|
|
894
|
-
type: "secondary",
|
|
895
|
-
class:
|
|
896
|
-
onClick:
|
|
897
|
-
},
|
|
898
|
-
default: () => [
|
|
899
|
-
}), [[
|
|
900
|
-
type: "primary",
|
|
901
|
-
class:
|
|
902
|
-
onClick:
|
|
1051
|
+
}, [showCancelBtn && withDirectives(createVNode(Button, {
|
|
1052
|
+
"type": "secondary",
|
|
1053
|
+
"class": bem("footer-btn"),
|
|
1054
|
+
"onClick": onCancel
|
|
1055
|
+
}, _isSlot(cancelButtonText) ? cancelButtonText : {
|
|
1056
|
+
default: () => [cancelButtonText]
|
|
1057
|
+
}), [[resolveDirective("loading"), loading.cancel]]), showConfirmBtn && withDirectives(createVNode(Button, {
|
|
1058
|
+
"type": "primary",
|
|
1059
|
+
"class": bem("footer-btn"),
|
|
1060
|
+
"onClick": onConfirm
|
|
903
1061
|
}, {
|
|
904
|
-
default: () => [
|
|
905
|
-
}), [[
|
|
906
|
-
class:
|
|
907
|
-
onClick: () =>
|
|
908
|
-
}, [
|
|
909
|
-
name: "cross"
|
|
1062
|
+
default: () => [loading.confirm ? "" : confirmButtonText]
|
|
1063
|
+
}), [[resolveDirective("loading"), loading.confirm]])])]), showCloseIcon && createVNode("div", {
|
|
1064
|
+
"class": bem("close"),
|
|
1065
|
+
"onClick": () => onClose("close")
|
|
1066
|
+
}, [createVNode(Icon, {
|
|
1067
|
+
"name": "cross"
|
|
910
1068
|
}, null)])])];
|
|
911
1069
|
}
|
|
912
1070
|
});
|
|
913
1071
|
};
|
|
914
1072
|
}
|
|
915
1073
|
});
|
|
916
|
-
let
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1074
|
+
let dialogApp = createApp({});
|
|
1075
|
+
let num = 0;
|
|
1076
|
+
const treasures = [];
|
|
1077
|
+
const createDialog = (customProps, customSlots) => {
|
|
1078
|
+
const id = `dialog${num += 1}`;
|
|
1079
|
+
const wrapper = {
|
|
920
1080
|
setup() {
|
|
921
|
-
const
|
|
922
|
-
|
|
1081
|
+
const show = ref(true);
|
|
1082
|
+
const toggle = (val) => {
|
|
1083
|
+
show.value = val;
|
|
1084
|
+
};
|
|
1085
|
+
return () => {
|
|
1086
|
+
return h(
|
|
1087
|
+
Dialog,
|
|
1088
|
+
{
|
|
1089
|
+
modelValue: show.value,
|
|
1090
|
+
"onUpdate:modelValue": toggle,
|
|
1091
|
+
...customProps,
|
|
1092
|
+
onAfterLeave: () => {
|
|
1093
|
+
close(id);
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
{ ...customSlots }
|
|
1097
|
+
);
|
|
923
1098
|
};
|
|
924
|
-
return () => le(
|
|
925
|
-
O,
|
|
926
|
-
{
|
|
927
|
-
modelValue: f.value,
|
|
928
|
-
"onUpdate:modelValue": n,
|
|
929
|
-
...e,
|
|
930
|
-
onAfterLeave: () => {
|
|
931
|
-
He(l);
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
{ ...t }
|
|
935
|
-
);
|
|
936
1099
|
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1100
|
+
};
|
|
1101
|
+
dialogApp = createApp(wrapper);
|
|
1102
|
+
const element = document.createElement("div");
|
|
1103
|
+
treasures.push({ id, app: dialogApp, el: element });
|
|
1104
|
+
dialogApp.mount(element);
|
|
1105
|
+
};
|
|
1106
|
+
const close = (id) => {
|
|
1107
|
+
treasures.forEach((obj) => {
|
|
1108
|
+
if (id === obj.id) {
|
|
1109
|
+
obj.app.unmount();
|
|
1110
|
+
}
|
|
943
1111
|
});
|
|
944
1112
|
};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1113
|
+
const style = "";
|
|
1114
|
+
Dialog.install = (app) => {
|
|
1115
|
+
const { name: name2 } = Dialog;
|
|
1116
|
+
app.component(name2, Dialog);
|
|
1117
|
+
app.provide("dialog", createDialog);
|
|
948
1118
|
};
|
|
949
1119
|
export {
|
|
950
|
-
|
|
951
|
-
|
|
1120
|
+
Dialog,
|
|
1121
|
+
createDialog,
|
|
1122
|
+
Dialog as default
|
|
952
1123
|
};
|