y-design-ssr 0.2.1 → 0.2.3
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 +12 -0
- package/libs/cell/index.css +1077 -1
- package/libs/cell/index.mjs +167 -104
- package/libs/cell/index.umd.js +300 -2
- package/libs/cell/package.json +12 -0
- package/libs/checkbox/index.css +1053 -1
- package/libs/checkbox/index.mjs +242 -127
- package/libs/checkbox/index.umd.js +369 -2
- package/libs/checkbox/package.json +12 -0
- package/libs/checkboxGroup/index.css +422 -1
- package/libs/checkboxGroup/index.mjs +173 -87
- package/libs/checkboxGroup/index.umd.js +265 -2
- package/libs/checkboxGroup/package.json +12 -0
- package/libs/col/index.css +615 -1
- package/libs/col/index.mjs +246 -81
- package/libs/col/index.umd.js +305 -2
- package/libs/col/package.json +12 -0
- package/libs/countdown/index.css +417 -1
- package/libs/countdown/index.mjs +179 -71
- package/libs/countdown/index.umd.js +231 -2
- package/libs/countdown/package.json +12 -0
- package/libs/dialog/index.css +1405 -1
- package/libs/dialog/index.mjs +646 -476
- package/libs/dialog/index.umd.js +1128 -2
- package/libs/dialog/package.json +12 -0
- package/libs/empty/index.css +457 -1
- package/libs/empty/index.mjs +91 -44
- package/libs/empty/index.umd.js +139 -2
- package/libs/empty/package.json +12 -0
- package/libs/form/index.css +477 -1
- package/libs/form/index.mjs +226 -126
- package/libs/form/index.umd.js +319 -2
- package/libs/form/package.json +12 -0
- package/libs/formItem/index.css +477 -1
- package/libs/formItem/index.mjs +276 -126
- package/libs/formItem/index.umd.js +372 -2
- package/libs/formItem/package.json +12 -0
- package/libs/icon/index.css +982 -1
- package/libs/icon/index.mjs +107 -58
- package/libs/icon/index.umd.js +186 -2
- package/libs/icon/package.json +12 -0
- package/libs/index.css +2902 -1
- package/libs/index.mjs +3785 -2344
- package/libs/index.umd.js +5509 -2
- package/libs/input/index.css +483 -1
- package/libs/input/index.mjs +183 -92
- package/libs/input/index.umd.js +274 -2
- package/libs/input/package.json +12 -0
- 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 +12 -0
- package/libs/list/index.css +440 -1
- package/libs/list/index.mjs +388 -207
- package/libs/list/index.umd.js +571 -2
- package/libs/list/package.json +12 -0
- package/libs/loading/index.css +548 -1
- package/libs/loading/index.mjs +196 -118
- package/libs/loading/index.umd.js +321 -2
- package/libs/loading/package.json +12 -0
- package/libs/mask/index.css +426 -1
- package/libs/mask/index.mjs +131 -70
- package/libs/mask/index.umd.js +201 -2
- package/libs/mask/package.json +12 -0
- package/libs/popup/index.css +465 -1
- package/libs/popup/index.mjs +210 -134
- package/libs/popup/index.umd.js +358 -2
- package/libs/popup/package.json +12 -0
- package/libs/progress/index.css +488 -1
- package/libs/progress/index.mjs +200 -128
- package/libs/progress/index.umd.js +322 -2
- package/libs/progress/package.json +12 -0
- package/libs/pullrefresh/index.css +441 -1
- package/libs/pullrefresh/index.mjs +241 -111
- package/libs/pullrefresh/index.umd.js +302 -2
- package/libs/pullrefresh/package.json +12 -0
- package/libs/row/index.css +485 -1
- package/libs/row/index.mjs +181 -89
- package/libs/row/index.umd.js +237 -2
- package/libs/row/package.json +12 -0
- package/libs/slider/index.css +558 -1
- package/libs/slider/index.mjs +356 -160
- package/libs/slider/index.umd.js +453 -2
- package/libs/slider/package.json +12 -0
- package/libs/stepper/index.css +489 -1
- package/libs/stepper/index.mjs +181 -101
- package/libs/stepper/index.umd.js +269 -2
- package/libs/stepper/package.json +12 -0
- package/libs/swipe/index.css +506 -1
- package/libs/swipe/index.mjs +542 -259
- package/libs/swipe/index.umd.js +703 -2
- package/libs/swipe/package.json +12 -0
- package/libs/swipeItem/index.css +424 -1
- package/libs/swipeItem/index.mjs +111 -52
- package/libs/swipeItem/index.umd.js +154 -2
- package/libs/swipeItem/package.json +12 -0
- package/libs/switch/index.css +472 -1
- package/libs/switch/index.mjs +121 -62
- package/libs/switch/index.umd.js +200 -2
- package/libs/switch/package.json +12 -0
- package/libs/tab/index.mjs +131 -68
- package/libs/tab/index.umd.js +190 -1
- package/libs/tab/package.json +12 -0
- package/libs/tabs/index.css +514 -1
- package/libs/tabs/index.mjs +751 -410
- package/libs/tabs/index.umd.js +1020 -2
- package/libs/tabs/package.json +12 -0
- package/libs/toast/index.css +1050 -1
- package/libs/toast/index.mjs +183 -114
- package/libs/toast/index.umd.js +306 -2
- package/libs/toast/package.json +12 -0
- package/libs/tooltip/index.css +514 -1
- package/libs/tooltip/index.mjs +293 -155
- package/libs/tooltip/index.umd.js +416 -2
- package/libs/tooltip/package.json +12 -0
- package/package.json +3 -3
package/libs/popup/index.mjs
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
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 } from "vue";
|
|
2
|
+
const getMods = (el, mods) => {
|
|
3
|
+
if (!mods) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
if (typeof mods === "string") {
|
|
7
|
+
return ` ${el}--${mods}`;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(mods)) {
|
|
10
|
+
return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
|
|
11
|
+
}
|
|
12
|
+
return Object.keys(mods).reduce(
|
|
13
|
+
(acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
|
|
14
|
+
""
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
const createBEM = (block) => {
|
|
18
|
+
return (el, mods) => {
|
|
19
|
+
let _el = el;
|
|
20
|
+
let _mods = mods;
|
|
21
|
+
if (_el && typeof _el !== "string") {
|
|
22
|
+
_mods = _el;
|
|
23
|
+
_el = "";
|
|
24
|
+
}
|
|
25
|
+
_el = _el ? `${block}__${_el}` : block;
|
|
26
|
+
return `${_el}${getMods(_el, _mods)}`;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const createGlobalBem = () => {
|
|
30
|
+
return (el, mods) => {
|
|
31
|
+
if (!mods) {
|
|
32
|
+
return `y-${el}`;
|
|
33
|
+
}
|
|
34
|
+
return `${getMods(`y-${el}`, mods)}`;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const defaultLang = {
|
|
9
38
|
"pull-refresh": {
|
|
10
39
|
pulling: "下拉刷新...",
|
|
11
40
|
loosing: "释放刷新...",
|
|
@@ -17,18 +46,26 @@ const k = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t)
|
|
|
17
46
|
validateMessage: "请输入正确内容"
|
|
18
47
|
}
|
|
19
48
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"zh-CN":
|
|
49
|
+
ref("zh-CN");
|
|
50
|
+
reactive({
|
|
51
|
+
"zh-CN": defaultLang
|
|
23
52
|
});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
return [
|
|
27
|
-
}
|
|
53
|
+
const createNamespace = (name2) => {
|
|
54
|
+
const prefixedName = `y-${name2}`;
|
|
55
|
+
return [prefixedName, createBEM(prefixedName), createGlobalBem()];
|
|
56
|
+
};
|
|
57
|
+
const parseUnit = (val) => {
|
|
58
|
+
if (isNaN(Number(val)) && typeof val === "string") {
|
|
59
|
+
return val;
|
|
60
|
+
}
|
|
61
|
+
return `${val}px`;
|
|
62
|
+
};
|
|
63
|
+
const [name$1, bem$1, gBem$1] = createNamespace("mask");
|
|
64
|
+
const _props$1 = {
|
|
28
65
|
// 控制显示
|
|
29
66
|
modelValue: {
|
|
30
67
|
type: Boolean,
|
|
31
|
-
default:
|
|
68
|
+
default: false
|
|
32
69
|
},
|
|
33
70
|
// 层级
|
|
34
71
|
zIndex: {
|
|
@@ -53,87 +90,118 @@ const x = (e) => {
|
|
|
53
90
|
// 触摸滚动开关
|
|
54
91
|
lockScroll: {
|
|
55
92
|
type: Boolean,
|
|
56
|
-
default:
|
|
93
|
+
default: true
|
|
57
94
|
},
|
|
58
95
|
onAfterLeave: {
|
|
59
96
|
type: Function,
|
|
60
97
|
default: null
|
|
61
98
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
99
|
+
};
|
|
100
|
+
const stack = reactive([]);
|
|
101
|
+
let num = 0;
|
|
102
|
+
const Mask = /* @__PURE__ */ defineComponent({
|
|
103
|
+
name: name$1,
|
|
104
|
+
props: _props$1,
|
|
67
105
|
emits: ["update:modelValue"],
|
|
68
|
-
setup(
|
|
69
|
-
slots
|
|
106
|
+
setup(props, {
|
|
107
|
+
slots
|
|
70
108
|
}) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
n >= 0 && r.splice(n, 1);
|
|
77
|
-
}), L(() => e.modelValue, (n) => {
|
|
78
|
-
a(n);
|
|
109
|
+
const id = ref("");
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
id.value = `mask${num}`;
|
|
112
|
+
num += 1;
|
|
113
|
+
stackIntercept(props.modelValue, true);
|
|
79
114
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
onUnmounted(() => {
|
|
116
|
+
const index = stack.findIndex((v) => v._id === id.value);
|
|
117
|
+
index >= 0 && stack.splice(index, 1);
|
|
118
|
+
});
|
|
119
|
+
watch(() => props.modelValue, (val) => {
|
|
120
|
+
stackIntercept(val);
|
|
121
|
+
});
|
|
122
|
+
const stackIntercept = (val, isMounted) => {
|
|
123
|
+
if (val) {
|
|
124
|
+
stack.unshift({
|
|
125
|
+
_id: id.value,
|
|
126
|
+
_state: val
|
|
127
|
+
});
|
|
128
|
+
if (stack.length > 1) {
|
|
129
|
+
stack[1]._state = false;
|
|
130
|
+
}
|
|
131
|
+
} else if (!isMounted) {
|
|
132
|
+
stack.splice(0, 1);
|
|
133
|
+
if (stack.length > 0) {
|
|
134
|
+
stack[0]._state = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const find = () => {
|
|
139
|
+
let _state = false;
|
|
140
|
+
for (let i = 0; i < stack.length; i++) {
|
|
141
|
+
if (stack[i]._id === id.value) {
|
|
142
|
+
_state = stack[i]._state;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
89
145
|
return {
|
|
90
|
-
_state
|
|
146
|
+
_state
|
|
91
147
|
};
|
|
92
|
-
}
|
|
148
|
+
};
|
|
149
|
+
const onTouchMove = (payload) => {
|
|
93
150
|
const {
|
|
94
|
-
lockScroll
|
|
95
|
-
} =
|
|
96
|
-
|
|
151
|
+
lockScroll
|
|
152
|
+
} = props;
|
|
153
|
+
if (lockScroll) {
|
|
154
|
+
payload.preventDefault();
|
|
155
|
+
payload.stopPropagation();
|
|
156
|
+
}
|
|
97
157
|
};
|
|
98
158
|
return () => {
|
|
99
159
|
const {
|
|
100
|
-
customClass
|
|
101
|
-
duration
|
|
102
|
-
zIndex
|
|
103
|
-
customStyle
|
|
104
|
-
onAfterLeave
|
|
105
|
-
} =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
160
|
+
customClass,
|
|
161
|
+
duration,
|
|
162
|
+
zIndex,
|
|
163
|
+
customStyle,
|
|
164
|
+
onAfterLeave
|
|
165
|
+
} = props;
|
|
166
|
+
const {
|
|
167
|
+
_state
|
|
168
|
+
} = find();
|
|
169
|
+
return createVNode(Transition, {
|
|
170
|
+
"name": gBem$1("animation", "fade"),
|
|
171
|
+
"onAfterLeave": onAfterLeave
|
|
111
172
|
}, {
|
|
112
173
|
default: () => {
|
|
113
|
-
var
|
|
114
|
-
return [
|
|
115
|
-
style: {
|
|
116
|
-
animationDuration: `${
|
|
117
|
-
zIndex
|
|
118
|
-
...
|
|
174
|
+
var _a;
|
|
175
|
+
return [withDirectives(createVNode("div", {
|
|
176
|
+
"style": {
|
|
177
|
+
animationDuration: `${duration}ms`,
|
|
178
|
+
zIndex,
|
|
179
|
+
...customStyle
|
|
119
180
|
},
|
|
120
|
-
class: [
|
|
121
|
-
onTouchmove:
|
|
122
|
-
}, [(
|
|
181
|
+
"class": [bem$1(), customClass],
|
|
182
|
+
"onTouchmove": onTouchMove
|
|
183
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, _state]])];
|
|
123
184
|
}
|
|
124
185
|
});
|
|
125
186
|
};
|
|
126
187
|
}
|
|
127
188
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
189
|
+
const reset = "";
|
|
190
|
+
const libs = "";
|
|
191
|
+
const font = "";
|
|
192
|
+
const animation = "";
|
|
193
|
+
const theme = "";
|
|
194
|
+
const style$1 = "";
|
|
195
|
+
Mask.install = (app) => {
|
|
196
|
+
const { name: name2 } = Mask;
|
|
197
|
+
app.component(name2, Mask);
|
|
131
198
|
};
|
|
132
|
-
const [
|
|
199
|
+
const [name, bem, gBem] = createNamespace("popup");
|
|
200
|
+
const _props = {
|
|
133
201
|
// 控制显示
|
|
134
202
|
modelValue: {
|
|
135
203
|
type: Boolean,
|
|
136
|
-
default:
|
|
204
|
+
default: false
|
|
137
205
|
},
|
|
138
206
|
// 位置
|
|
139
207
|
position: {
|
|
@@ -168,7 +236,7 @@ const [F, S, P] = x("popup"), E = {
|
|
|
168
236
|
// 点击遮罩是否关闭
|
|
169
237
|
isCloseOnClickMask: {
|
|
170
238
|
type: Boolean,
|
|
171
|
-
default:
|
|
239
|
+
default: true
|
|
172
240
|
},
|
|
173
241
|
onAfterLeave: {
|
|
174
242
|
type: Function,
|
|
@@ -176,101 +244,109 @@ const [F, S, P] = x("popup"), E = {
|
|
|
176
244
|
},
|
|
177
245
|
lockScroll: {
|
|
178
246
|
type: Boolean,
|
|
179
|
-
default:
|
|
247
|
+
default: true
|
|
180
248
|
},
|
|
181
249
|
zIndex: {
|
|
182
250
|
type: Number,
|
|
183
251
|
default: 101
|
|
184
252
|
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
253
|
+
};
|
|
254
|
+
const Popup = /* @__PURE__ */ defineComponent({
|
|
255
|
+
name,
|
|
256
|
+
props: _props,
|
|
188
257
|
emits: ["clickMask", "update:modelValue"],
|
|
189
|
-
setup(
|
|
190
|
-
slots
|
|
191
|
-
emit
|
|
258
|
+
setup(props, {
|
|
259
|
+
slots,
|
|
260
|
+
emit
|
|
192
261
|
}) {
|
|
193
|
-
const
|
|
262
|
+
const style2 = computed(() => {
|
|
194
263
|
const {
|
|
195
|
-
position
|
|
196
|
-
borderRadius
|
|
197
|
-
customStyle
|
|
198
|
-
duration
|
|
199
|
-
} =
|
|
200
|
-
|
|
201
|
-
|
|
264
|
+
position,
|
|
265
|
+
borderRadius,
|
|
266
|
+
customStyle,
|
|
267
|
+
duration
|
|
268
|
+
} = props;
|
|
269
|
+
const tbR = parseUnit(borderRadius);
|
|
270
|
+
let br = `0`;
|
|
271
|
+
switch (position) {
|
|
202
272
|
case "top":
|
|
203
|
-
|
|
273
|
+
br = ` 0 0 ${tbR} ${tbR}`;
|
|
204
274
|
break;
|
|
205
275
|
case "bottom":
|
|
206
|
-
|
|
276
|
+
br = `${tbR} ${tbR} 0 0`;
|
|
207
277
|
break;
|
|
208
278
|
case "left":
|
|
209
|
-
|
|
279
|
+
br = `0 ${tbR} ${tbR} 0`;
|
|
210
280
|
break;
|
|
211
281
|
case "right":
|
|
212
|
-
|
|
282
|
+
br = `${tbR} 0 0 ${tbR}`;
|
|
213
283
|
break;
|
|
214
284
|
default:
|
|
215
|
-
|
|
285
|
+
br = `${tbR}`;
|
|
216
286
|
}
|
|
217
287
|
return {
|
|
218
|
-
borderRadius:
|
|
219
|
-
animationDuration: `${
|
|
220
|
-
...
|
|
288
|
+
borderRadius: br,
|
|
289
|
+
animationDuration: `${duration}ms`,
|
|
290
|
+
...customStyle
|
|
221
291
|
};
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
292
|
+
});
|
|
293
|
+
const onClickMask = (event) => {
|
|
294
|
+
emit("clickMask", event);
|
|
295
|
+
if (props.isCloseOnClickMask) {
|
|
296
|
+
visible.value = false;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const visible = computed({
|
|
300
|
+
get: () => props.modelValue,
|
|
301
|
+
set: (value) => emit("update:modelValue", value)
|
|
227
302
|
});
|
|
228
303
|
return () => {
|
|
229
304
|
const {
|
|
230
|
-
teleport
|
|
231
|
-
position
|
|
232
|
-
customClass
|
|
233
|
-
duration
|
|
234
|
-
onAfterLeave
|
|
235
|
-
lockScroll
|
|
236
|
-
zIndex
|
|
237
|
-
} =
|
|
238
|
-
return
|
|
239
|
-
to:
|
|
305
|
+
teleport,
|
|
306
|
+
position,
|
|
307
|
+
customClass,
|
|
308
|
+
duration,
|
|
309
|
+
onAfterLeave,
|
|
310
|
+
lockScroll,
|
|
311
|
+
zIndex
|
|
312
|
+
} = props;
|
|
313
|
+
return createVNode(Teleport, {
|
|
314
|
+
"to": teleport
|
|
240
315
|
}, {
|
|
241
|
-
default: () => [
|
|
242
|
-
class:
|
|
243
|
-
style: {
|
|
244
|
-
zIndex
|
|
316
|
+
default: () => [createVNode("div", {
|
|
317
|
+
"class": bem(),
|
|
318
|
+
"style": {
|
|
319
|
+
zIndex
|
|
245
320
|
}
|
|
246
|
-
}, [
|
|
247
|
-
modelValue:
|
|
248
|
-
"onUpdate:modelValue": (
|
|
249
|
-
duration:
|
|
250
|
-
lockScroll:
|
|
251
|
-
onClick:
|
|
252
|
-
onAfterLeave:
|
|
253
|
-
}, null),
|
|
254
|
-
name:
|
|
321
|
+
}, [createVNode(Mask, {
|
|
322
|
+
"modelValue": visible.value,
|
|
323
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
324
|
+
"duration": duration,
|
|
325
|
+
"lockScroll": lockScroll,
|
|
326
|
+
"onClick": onClickMask,
|
|
327
|
+
"onAfterLeave": onAfterLeave
|
|
328
|
+
}, null), createVNode(Transition, {
|
|
329
|
+
"name": gBem("animation", `slide-${position}`)
|
|
255
330
|
}, {
|
|
256
331
|
default: () => {
|
|
257
|
-
var
|
|
258
|
-
return [
|
|
259
|
-
style:
|
|
260
|
-
class: [
|
|
261
|
-
[
|
|
262
|
-
}),
|
|
263
|
-
}, [((
|
|
332
|
+
var _a;
|
|
333
|
+
return [withDirectives(createVNode("div", {
|
|
334
|
+
"style": style2.value,
|
|
335
|
+
"class": [bem("content", {
|
|
336
|
+
[position]: position
|
|
337
|
+
}), customClass]
|
|
338
|
+
}, [((_a = slots.default) == null ? void 0 : _a.call(slots)) || null]), [[vShow, visible.value]])];
|
|
264
339
|
}
|
|
265
340
|
})])]
|
|
266
341
|
});
|
|
267
342
|
};
|
|
268
343
|
}
|
|
269
344
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
345
|
+
const style = "";
|
|
346
|
+
Popup.install = (app) => {
|
|
347
|
+
const { name: name2 } = Popup;
|
|
348
|
+
app.component(name2, Popup);
|
|
273
349
|
};
|
|
274
350
|
export {
|
|
275
|
-
|
|
351
|
+
Popup as default
|
|
276
352
|
};
|