y-design-ssr 0.2.3 → 0.2.5
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/README.md +21 -16
- package/libs/button/index.css +1 -579
- package/libs/button/index.mjs +66 -111
- package/libs/button/index.umd.js +2 -203
- package/libs/button/package.json +1 -7
- package/libs/cell/index.css +1 -1077
- package/libs/cell/index.mjs +104 -167
- package/libs/cell/index.umd.js +2 -300
- package/libs/cell/package.json +1 -7
- package/libs/checkbox/index.css +1 -1053
- package/libs/checkbox/index.mjs +127 -242
- package/libs/checkbox/index.umd.js +2 -369
- package/libs/checkbox/package.json +1 -7
- package/libs/checkboxGroup/index.css +1 -422
- package/libs/checkboxGroup/index.mjs +87 -173
- package/libs/checkboxGroup/index.umd.js +2 -265
- package/libs/checkboxGroup/package.json +1 -7
- package/libs/col/index.css +1 -615
- package/libs/col/index.mjs +81 -246
- package/libs/col/index.umd.js +2 -305
- package/libs/col/package.json +1 -7
- package/libs/countdown/index.css +1 -417
- package/libs/countdown/index.mjs +71 -179
- package/libs/countdown/index.umd.js +2 -231
- package/libs/countdown/package.json +1 -7
- package/libs/dialog/index.css +1 -1405
- package/libs/dialog/index.mjs +476 -646
- package/libs/dialog/index.umd.js +2 -1128
- package/libs/dialog/package.json +1 -7
- package/libs/empty/index.css +1 -457
- package/libs/empty/index.mjs +44 -91
- package/libs/empty/index.umd.js +2 -139
- package/libs/empty/package.json +1 -7
- package/libs/form/index.css +1 -477
- package/libs/form/index.mjs +126 -226
- package/libs/form/index.umd.js +2 -319
- package/libs/form/package.json +1 -7
- package/libs/formItem/index.css +1 -477
- package/libs/formItem/index.mjs +126 -276
- package/libs/formItem/index.umd.js +2 -372
- package/libs/formItem/package.json +1 -7
- package/libs/icon/index.css +1 -982
- package/libs/icon/index.mjs +58 -107
- package/libs/icon/index.umd.js +2 -186
- package/libs/icon/package.json +1 -7
- package/libs/index.css +1 -2902
- package/libs/index.mjs +2348 -3789
- package/libs/index.umd.js +2 -5509
- package/libs/input/index.css +1 -483
- package/libs/input/index.mjs +92 -183
- package/libs/input/index.umd.js +2 -274
- package/libs/input/package.json +1 -7
- package/libs/layout/index.css +1 -684
- package/libs/layout/index.mjs +130 -230
- package/libs/layout/index.umd.js +2 -318
- package/libs/layout/package.json +1 -7
- package/libs/list/index.css +1 -440
- package/libs/list/index.mjs +207 -388
- package/libs/list/index.umd.js +2 -571
- package/libs/list/package.json +1 -7
- package/libs/loading/index.css +1 -548
- package/libs/loading/index.mjs +118 -196
- package/libs/loading/index.umd.js +2 -321
- package/libs/loading/package.json +1 -7
- package/libs/mask/index.css +1 -426
- package/libs/mask/index.mjs +70 -131
- package/libs/mask/index.umd.js +2 -201
- package/libs/mask/package.json +1 -7
- package/libs/popup/index.css +1 -465
- package/libs/popup/index.mjs +134 -210
- package/libs/popup/index.umd.js +2 -358
- package/libs/popup/package.json +1 -7
- package/libs/progress/index.css +1 -488
- package/libs/progress/index.mjs +128 -200
- package/libs/progress/index.umd.js +2 -322
- package/libs/progress/package.json +1 -7
- package/libs/pullrefresh/index.css +1 -441
- package/libs/pullrefresh/index.mjs +111 -241
- package/libs/pullrefresh/index.umd.js +2 -302
- package/libs/pullrefresh/package.json +1 -7
- package/libs/row/index.css +1 -485
- package/libs/row/index.mjs +89 -181
- package/libs/row/index.umd.js +2 -237
- package/libs/row/package.json +1 -7
- package/libs/slider/index.css +1 -558
- package/libs/slider/index.mjs +160 -356
- package/libs/slider/index.umd.js +2 -453
- package/libs/slider/package.json +1 -7
- package/libs/stepper/index.css +1 -489
- package/libs/stepper/index.mjs +101 -181
- package/libs/stepper/index.umd.js +2 -269
- package/libs/stepper/package.json +1 -7
- package/libs/swipe/index.css +1 -506
- package/libs/swipe/index.mjs +259 -542
- package/libs/swipe/index.umd.js +2 -703
- package/libs/swipe/package.json +1 -7
- package/libs/swipeItem/index.css +1 -424
- package/libs/swipeItem/index.mjs +52 -111
- package/libs/swipeItem/index.umd.js +2 -154
- package/libs/swipeItem/package.json +1 -7
- package/libs/switch/index.css +1 -472
- package/libs/switch/index.mjs +62 -121
- package/libs/switch/index.umd.js +2 -200
- package/libs/switch/package.json +1 -7
- package/libs/tab/index.mjs +68 -131
- package/libs/tab/index.umd.js +1 -190
- package/libs/tab/package.json +1 -7
- package/libs/tabs/index.css +1 -514
- package/libs/tabs/index.mjs +410 -751
- package/libs/tabs/index.umd.js +2 -1020
- package/libs/tabs/package.json +1 -7
- package/libs/toast/index.css +1 -1050
- package/libs/toast/index.mjs +114 -183
- package/libs/toast/index.umd.js +2 -306
- package/libs/toast/package.json +1 -7
- package/libs/tooltip/index.css +1 -514
- package/libs/tooltip/index.mjs +155 -293
- package/libs/tooltip/index.umd.js +2 -416
- package/libs/tooltip/package.json +1 -7
- package/package.json +7 -11
package/libs/tabs/index.mjs
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
import { ref, reactive, getCurrentInstance, provide, isVNode, inject, onUnmounted, computed, defineComponent, createVNode, watch, onMounted, nextTick, onBeforeUnmount, onBeforeUpdate } from "vue";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 = {
|
|
1
|
+
import { ref as z, reactive as N, getCurrentInstance as ie, provide as Se, isVNode as re, inject as Ne, onUnmounted as Ce, computed as C, defineComponent as H, createVNode as b, watch as ee, onMounted as ce, nextTick as te, onBeforeUnmount as Te, onBeforeUpdate as ze } from "vue";
|
|
2
|
+
const V = (e, n) => n ? typeof n == "string" ? ` ${e}--${n}` : Array.isArray(n) ? n.reduce((o, l) => o + V(e, l), "") : Object.keys(n).reduce(
|
|
3
|
+
(o, l) => o + (n[l] ? V(e, l) : ""),
|
|
4
|
+
""
|
|
5
|
+
) : "", Ee = (e) => (n, o) => {
|
|
6
|
+
let l = n, v = o;
|
|
7
|
+
return l && typeof l != "string" && (v = l, l = ""), l = l ? `${e}__${l}` : e, `${l}${V(l, v)}`;
|
|
8
|
+
}, Le = () => (e, n) => n ? `${V(`y-${e}`, n)}` : `y-${e}`, $e = {
|
|
38
9
|
"pull-refresh": {
|
|
39
10
|
pulling: "下拉刷新...",
|
|
40
11
|
loosing: "释放刷新...",
|
|
@@ -46,94 +17,57 @@ const defaultLang = {
|
|
|
46
17
|
validateMessage: "请输入正确内容"
|
|
47
18
|
}
|
|
48
19
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"zh-CN":
|
|
20
|
+
z("zh-CN");
|
|
21
|
+
N({
|
|
22
|
+
"zh-CN": $e
|
|
52
23
|
});
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
return [
|
|
56
|
-
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return baseNumber * Number(val.replace(/%/g, "")) / 100;
|
|
62
|
-
}
|
|
63
|
-
return Number(val);
|
|
64
|
-
};
|
|
65
|
-
const filterChildren = (children) => {
|
|
66
|
-
const vnodes = [];
|
|
67
|
-
const _filterChildren = (childrens) => {
|
|
68
|
-
if (Array.isArray(childrens)) {
|
|
69
|
-
childrens.forEach((child) => {
|
|
70
|
-
var _a;
|
|
71
|
-
if (isVNode(child)) {
|
|
72
|
-
vnodes.push(child);
|
|
73
|
-
if ((_a = child.component) == null ? void 0 : _a.subTree) {
|
|
74
|
-
_filterChildren(child.component.subTree.children);
|
|
75
|
-
}
|
|
76
|
-
if (child.children) {
|
|
77
|
-
_filterChildren(child.children);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
_filterChildren(children);
|
|
84
|
-
return vnodes;
|
|
85
|
-
};
|
|
86
|
-
const sortChildren = (childrens, instance) => {
|
|
87
|
-
const vnodes = filterChildren(instance.subTree.children);
|
|
88
|
-
childrens.sort((a, b) => vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode));
|
|
89
|
-
};
|
|
90
|
-
const setRelation = (key) => {
|
|
91
|
-
const instance = getCurrentInstance();
|
|
92
|
-
const childrens = reactive([]);
|
|
93
|
-
const initProvide = (value) => {
|
|
94
|
-
const addChild = (child) => {
|
|
95
|
-
if (child.proxy) {
|
|
96
|
-
childrens.push(child);
|
|
97
|
-
instance && sortChildren(childrens, instance);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const removeChild = (child) => {
|
|
101
|
-
const index = childrens.indexOf(child);
|
|
102
|
-
childrens.splice(index, 1);
|
|
103
|
-
};
|
|
104
|
-
provide(key, {
|
|
105
|
-
addChild,
|
|
106
|
-
removeChild,
|
|
107
|
-
childrens,
|
|
108
|
-
...value
|
|
24
|
+
const U = (e) => {
|
|
25
|
+
const n = `y-${e}`;
|
|
26
|
+
return [n, Ee(n), Le()];
|
|
27
|
+
}, ae = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%") ? n * Number(e.replace(/%/g, "")) / 100 : Number(e), xe = (e) => {
|
|
28
|
+
const n = [], o = (l) => {
|
|
29
|
+
Array.isArray(l) && l.forEach((v) => {
|
|
30
|
+
var u;
|
|
31
|
+
re(v) && (n.push(v), (u = v.component) != null && u.subTree && o(v.component.subTree.children), v.children && o(v.children));
|
|
109
32
|
});
|
|
110
33
|
};
|
|
34
|
+
return o(e), n;
|
|
35
|
+
}, Ie = (e, n) => {
|
|
36
|
+
const o = xe(n.subTree.children);
|
|
37
|
+
e.sort((l, v) => o.indexOf(l.vnode) - o.indexOf(v.vnode));
|
|
38
|
+
}, ue = (e) => {
|
|
39
|
+
const n = ie(), o = N([]);
|
|
111
40
|
return {
|
|
112
|
-
childrens,
|
|
113
|
-
initProvide
|
|
41
|
+
childrens: o,
|
|
42
|
+
initProvide: (v) => {
|
|
43
|
+
Se(e, {
|
|
44
|
+
addChild: (s) => {
|
|
45
|
+
s.proxy && (o.push(s), n && Ie(o, n));
|
|
46
|
+
},
|
|
47
|
+
removeChild: (s) => {
|
|
48
|
+
const f = o.indexOf(s);
|
|
49
|
+
o.splice(f, 1);
|
|
50
|
+
},
|
|
51
|
+
childrens: o,
|
|
52
|
+
...v
|
|
53
|
+
});
|
|
54
|
+
}
|
|
114
55
|
};
|
|
115
|
-
}
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onUnmounted(() => removeChild(currentInstance));
|
|
123
|
-
const index = computed(() => childrens.indexOf(currentInstance));
|
|
124
|
-
return {
|
|
125
|
-
index,
|
|
126
|
-
parent
|
|
56
|
+
}, fe = (e) => {
|
|
57
|
+
const n = Ne(e, null), o = ie();
|
|
58
|
+
if (n && o) {
|
|
59
|
+
const { childrens: l, addChild: v, removeChild: u } = n;
|
|
60
|
+
return v(o), Ce(() => u(o)), {
|
|
61
|
+
index: C(() => l.indexOf(o)),
|
|
62
|
+
parent: n
|
|
127
63
|
};
|
|
128
64
|
}
|
|
129
65
|
return {
|
|
130
66
|
parent: null,
|
|
131
|
-
index:
|
|
67
|
+
index: z(-1)
|
|
132
68
|
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const YSwipeItem = /* @__PURE__ */ defineComponent({
|
|
136
|
-
name: name$3,
|
|
69
|
+
}, [Be, De] = U("swipe-item"), K = /* @__PURE__ */ H({
|
|
70
|
+
name: Be,
|
|
137
71
|
props: {
|
|
138
72
|
clonenNode: {
|
|
139
73
|
type: Object,
|
|
@@ -144,66 +78,39 @@ const YSwipeItem = /* @__PURE__ */ defineComponent({
|
|
|
144
78
|
default: -1
|
|
145
79
|
}
|
|
146
80
|
},
|
|
147
|
-
setup(
|
|
148
|
-
slots
|
|
81
|
+
setup(e, {
|
|
82
|
+
slots: n
|
|
149
83
|
}) {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const spacing = `${(parent == null ? void 0 : parent.itemDetail.space) || 0}px`;
|
|
167
|
-
if ((parent == null ? void 0 : parent.props.autoHeight) && (parent == null ? void 0 : parent.activeIndex) !== index.value) {
|
|
168
|
-
height = "0";
|
|
169
|
-
}
|
|
170
|
-
if (parent == null ? void 0 : parent.props.vertical) {
|
|
171
|
-
return {
|
|
172
|
-
height: width,
|
|
173
|
-
width: height,
|
|
174
|
-
marginBottom: spacing
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
width,
|
|
179
|
-
height,
|
|
180
|
-
marginRight: spacing
|
|
84
|
+
const o = ie(), {
|
|
85
|
+
parent: l
|
|
86
|
+
} = fe(ve);
|
|
87
|
+
!e.clonenNode && o && (l == null || l.children.push(o));
|
|
88
|
+
const v = C(() => e.clonenNode ? e.index : l == null ? void 0 : l.children.findIndex((c) => c.proxy === (o == null ? void 0 : o.proxy))), u = C(() => {
|
|
89
|
+
const c = `${(l == null ? void 0 : l.itemDetail.size) || 0}px`;
|
|
90
|
+
let s = "auto";
|
|
91
|
+
const f = `${(l == null ? void 0 : l.itemDetail.space) || 0}px`;
|
|
92
|
+
return l != null && l.props.autoHeight && (l == null ? void 0 : l.activeIndex) !== v.value && (s = "0"), l != null && l.props.vertical ? {
|
|
93
|
+
height: c,
|
|
94
|
+
width: s,
|
|
95
|
+
marginBottom: f
|
|
96
|
+
} : {
|
|
97
|
+
width: c,
|
|
98
|
+
height: s,
|
|
99
|
+
marginRight: f
|
|
181
100
|
};
|
|
182
101
|
});
|
|
183
102
|
return () => {
|
|
184
|
-
var
|
|
185
|
-
const
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}, [
|
|
103
|
+
var s, f;
|
|
104
|
+
const c = ((s = l == null ? void 0 : l.itemShowedList) == null ? void 0 : s.list[v.value || 0]) || !1;
|
|
105
|
+
return b("div", {
|
|
106
|
+
class: De(),
|
|
107
|
+
style: u.value
|
|
108
|
+
}, [c ? e.clonenNode || ((f = n.default) == null ? void 0 : f.call(n)) : null]);
|
|
190
109
|
};
|
|
191
110
|
}
|
|
192
111
|
});
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
Position2["top"] = "top";
|
|
196
|
-
Position2["bottom"] = "bottom";
|
|
197
|
-
Position2["right"] = "right";
|
|
198
|
-
return Position2;
|
|
199
|
-
})(Position || {});
|
|
200
|
-
var Align = /* @__PURE__ */ ((Align2) => {
|
|
201
|
-
Align2["start"] = "start";
|
|
202
|
-
Align2["center"] = "center";
|
|
203
|
-
Align2["end"] = "end";
|
|
204
|
-
return Align2;
|
|
205
|
-
})(Align || {});
|
|
206
|
-
const swipeProps = {
|
|
112
|
+
var ne = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(ne || {}), W = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(W || {});
|
|
113
|
+
const ke = {
|
|
207
114
|
autoplayTime: {
|
|
208
115
|
type: Number,
|
|
209
116
|
default: 0
|
|
@@ -218,11 +125,11 @@ const swipeProps = {
|
|
|
218
125
|
},
|
|
219
126
|
loop: {
|
|
220
127
|
type: Boolean,
|
|
221
|
-
default:
|
|
128
|
+
default: !0
|
|
222
129
|
},
|
|
223
130
|
dots: {
|
|
224
131
|
type: Boolean,
|
|
225
|
-
default:
|
|
132
|
+
default: !0
|
|
226
133
|
},
|
|
227
134
|
dotsPosition: {
|
|
228
135
|
type: String,
|
|
@@ -234,15 +141,15 @@ const swipeProps = {
|
|
|
234
141
|
},
|
|
235
142
|
lazy: {
|
|
236
143
|
type: Boolean,
|
|
237
|
-
default:
|
|
144
|
+
default: !1
|
|
238
145
|
},
|
|
239
146
|
vertical: {
|
|
240
147
|
type: Boolean,
|
|
241
|
-
default:
|
|
148
|
+
default: !1
|
|
242
149
|
},
|
|
243
150
|
autoHeight: {
|
|
244
151
|
type: Boolean,
|
|
245
|
-
default:
|
|
152
|
+
default: !1
|
|
246
153
|
},
|
|
247
154
|
itemSize: {
|
|
248
155
|
type: [Number, String],
|
|
@@ -258,253 +165,144 @@ const swipeProps = {
|
|
|
258
165
|
},
|
|
259
166
|
touchable: {
|
|
260
167
|
type: Boolean,
|
|
261
|
-
default:
|
|
168
|
+
default: !0
|
|
262
169
|
},
|
|
263
170
|
isFollowHand: {
|
|
264
171
|
type: Boolean,
|
|
265
|
-
default:
|
|
172
|
+
default: !0
|
|
266
173
|
},
|
|
267
174
|
align: {
|
|
268
175
|
type: String,
|
|
269
176
|
default: "center"
|
|
270
177
|
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const SWIPE_PROVIDE_KEY = name$2;
|
|
274
|
-
const Swipe = /* @__PURE__ */ defineComponent({
|
|
275
|
-
name: name$2,
|
|
178
|
+
}, [de, q] = U("swipe"), ve = de, _e = /* @__PURE__ */ H({
|
|
179
|
+
name: de,
|
|
276
180
|
components: {
|
|
277
|
-
YSwipeItem
|
|
181
|
+
YSwipeItem: K
|
|
278
182
|
},
|
|
279
|
-
props:
|
|
280
|
-
setup(
|
|
281
|
-
slots,
|
|
282
|
-
emit,
|
|
283
|
-
expose
|
|
183
|
+
props: ke,
|
|
184
|
+
setup(e, {
|
|
185
|
+
slots: n,
|
|
186
|
+
emit: o,
|
|
187
|
+
expose: l
|
|
284
188
|
}) {
|
|
285
189
|
const {
|
|
286
|
-
initProvide
|
|
287
|
-
} =
|
|
288
|
-
const itemList = reactive([]);
|
|
289
|
-
const activeIndex = ref(Number(props.initIndex));
|
|
290
|
-
const itemDetail = reactive({
|
|
190
|
+
initProvide: v
|
|
191
|
+
} = ue(ve), u = N([]), c = z(Number(e.initIndex)), s = N({
|
|
291
192
|
// 元素尺寸
|
|
292
193
|
size: 0,
|
|
293
194
|
// 间距
|
|
294
195
|
space: 0,
|
|
295
196
|
// 元素宽度比swipe小,占满整个视窗
|
|
296
|
-
isFillViewport:
|
|
297
|
-
})
|
|
298
|
-
const trackDetail = reactive({
|
|
197
|
+
isFillViewport: !1
|
|
198
|
+
}), f = N({
|
|
299
199
|
// 偏移量
|
|
300
200
|
offset: 0,
|
|
301
201
|
// 视窗大小
|
|
302
202
|
viewportSize: 0,
|
|
303
203
|
// 重复节点个数
|
|
304
204
|
cloneNodeCount: 0
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
result.push(!props.lazy);
|
|
313
|
-
}
|
|
314
|
-
return result;
|
|
315
|
-
};
|
|
316
|
-
const checkItemShowed = () => {
|
|
317
|
-
if (!props.lazy)
|
|
205
|
+
}), T = z(), g = z(), B = () => {
|
|
206
|
+
const t = u.length, a = [];
|
|
207
|
+
for (let m = 0; m < t; m++)
|
|
208
|
+
a.push(!e.lazy);
|
|
209
|
+
return a;
|
|
210
|
+
}, R = () => {
|
|
211
|
+
if (!e.lazy)
|
|
318
212
|
return;
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (!itemShowedList.list[i]) {
|
|
328
|
-
const left = itemSizeSpace * i;
|
|
329
|
-
const right = left + itemDetail.size;
|
|
330
|
-
if (left >= viewportLeft && left < viewportRight || right > viewportLeft && right < viewportRight || left < viewportLeft && right > viewportRight) {
|
|
331
|
-
itemShowedList.list[i] = true;
|
|
332
|
-
}
|
|
213
|
+
const t = s.size + s.space, a = u.length * t;
|
|
214
|
+
let m = -(f.offset + r.offset) - f.cloneNodeCount * t;
|
|
215
|
+
m < 0 && (m += a);
|
|
216
|
+
const w = m + f.viewportSize;
|
|
217
|
+
for (let y = 0; y < u.length; y++)
|
|
218
|
+
if (!k.list[y]) {
|
|
219
|
+
const S = t * y, E = S + s.size;
|
|
220
|
+
(S >= m && S < w || E > m && E < w || S < m && E > w) && (k.list[y] = !0);
|
|
333
221
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
list
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
itemDetail.size = parsePercent(itemSize, viewportSize);
|
|
347
|
-
} else {
|
|
348
|
-
itemDetail.size = viewportSize;
|
|
349
|
-
}
|
|
350
|
-
itemDetail.space = Number(props.itemSpace) || 0;
|
|
351
|
-
itemDetail.isFillViewport = itemDetail.size >= viewportSize;
|
|
352
|
-
trackDetail.viewportSize = viewportSize;
|
|
353
|
-
trackDetail.cloneNodeCount = getCloneNodeCount();
|
|
354
|
-
};
|
|
355
|
-
const getCloneNodeCount = () => {
|
|
356
|
-
if (needLoop.value) {
|
|
357
|
-
const sizeSpace = itemDetail.size + itemDetail.space;
|
|
358
|
-
if (sizeSpace === 0)
|
|
222
|
+
}, k = N({
|
|
223
|
+
list: B()
|
|
224
|
+
}), p = () => {
|
|
225
|
+
k.list = B(), R();
|
|
226
|
+
};
|
|
227
|
+
ee(() => [...u], p);
|
|
228
|
+
const D = (t, a) => {
|
|
229
|
+
t ? s.size = ae(t, a) : s.size = a, s.space = Number(e.itemSpace) || 0, s.isFillViewport = s.size >= a, f.viewportSize = a, f.cloneNodeCount = G();
|
|
230
|
+
}, G = () => {
|
|
231
|
+
if (x.value) {
|
|
232
|
+
const t = s.size + s.space;
|
|
233
|
+
if (t === 0)
|
|
359
234
|
return 0;
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
return Math.min(count, itemList.length - 1);
|
|
235
|
+
const a = f.viewportSize * 2 - t, m = Math.ceil(a / t);
|
|
236
|
+
return Math.min(m, u.length - 1);
|
|
363
237
|
}
|
|
364
238
|
return 0;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
if (!swipeRef.value)
|
|
239
|
+
}, L = () => {
|
|
240
|
+
if (!T.value)
|
|
368
241
|
return;
|
|
369
242
|
const {
|
|
370
|
-
width,
|
|
371
|
-
height
|
|
372
|
-
} =
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
243
|
+
width: t,
|
|
244
|
+
height: a
|
|
245
|
+
} = T.value.getBoundingClientRect();
|
|
246
|
+
e.vertical ? D(e.itemSize, a) : D(e.itemSize, t), c.value = c.value >= u.length ? u.length - 1 : c.value, c.value < 0 && (c.value = 0), I(c.value), p(), h();
|
|
247
|
+
};
|
|
248
|
+
ce(() => {
|
|
249
|
+
if (te(L).catch(() => {
|
|
250
|
+
}), e.touchable && T.value) {
|
|
251
|
+
const t = T.value;
|
|
252
|
+
t.addEventListener("touchstart", M, !1), t.addEventListener("mousedown", M, !1), t.addEventListener("touchmove", P, !1), t.addEventListener("mousemove", P, !1), t.addEventListener("touchend", $, !1), t.addEventListener("mouseup", $, !1), t.addEventListener("mouseleave", $, !1), t.addEventListener("touchcancel", $, !1);
|
|
377
253
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
254
|
+
window.addEventListener("resize", L, !1), window.addEventListener("orientationchange", L, !1);
|
|
255
|
+
}), Te(() => {
|
|
256
|
+
if (d(), e.touchable && T.value) {
|
|
257
|
+
const t = T.value;
|
|
258
|
+
t.removeEventListener("touchstart", M, !1), t.removeEventListener("mousedown", M, !1), t.removeEventListener("mousemove", P, !1), t.removeEventListener("touchmove", P, !1), t.removeEventListener("mouseup", $, !1), t.removeEventListener("touchend", $, !1), t.removeEventListener("mouseleave", $, !1), t.removeEventListener("touchcancel", $, !1);
|
|
381
259
|
}
|
|
382
|
-
|
|
383
|
-
initItemShowList();
|
|
384
|
-
startAutoplay();
|
|
385
|
-
};
|
|
386
|
-
onMounted(() => {
|
|
387
|
-
nextTick(resize).catch(() => {
|
|
388
|
-
});
|
|
389
|
-
if (props.touchable && swipeRef.value) {
|
|
390
|
-
const swipeEl = swipeRef.value;
|
|
391
|
-
swipeEl.addEventListener("touchstart", onTouchStart, false);
|
|
392
|
-
swipeEl.addEventListener("mousedown", onTouchStart, false);
|
|
393
|
-
swipeEl.addEventListener("touchmove", onTouch, false);
|
|
394
|
-
swipeEl.addEventListener("mousemove", onTouch, false);
|
|
395
|
-
swipeEl.addEventListener("touchend", onTouchEnd, false);
|
|
396
|
-
swipeEl.addEventListener("mouseup", onTouchEnd, false);
|
|
397
|
-
swipeEl.addEventListener("mouseleave", onTouchEnd, false);
|
|
398
|
-
swipeEl.addEventListener("touchcancel", onTouchEnd, false);
|
|
399
|
-
}
|
|
400
|
-
window.addEventListener("resize", resize, false);
|
|
401
|
-
window.addEventListener("orientationchange", resize, false);
|
|
260
|
+
window.removeEventListener("resize", L, !1), window.removeEventListener("orientationchange", L, !1);
|
|
402
261
|
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
swipeEl.removeEventListener("mousedown", onTouchStart, false);
|
|
409
|
-
swipeEl.removeEventListener("mousemove", onTouch, false);
|
|
410
|
-
swipeEl.removeEventListener("touchmove", onTouch, false);
|
|
411
|
-
swipeEl.removeEventListener("mouseup", onTouchEnd, false);
|
|
412
|
-
swipeEl.removeEventListener("touchend", onTouchEnd, false);
|
|
413
|
-
swipeEl.removeEventListener("mouseleave", onTouchEnd, false);
|
|
414
|
-
swipeEl.removeEventListener("touchcancel", onTouchEnd, false);
|
|
415
|
-
}
|
|
416
|
-
window.removeEventListener("resize", resize, false);
|
|
417
|
-
window.removeEventListener("orientationchange", resize, false);
|
|
418
|
-
});
|
|
419
|
-
const positionOffset = computed(() => {
|
|
420
|
-
let offset = 0;
|
|
421
|
-
switch (props.align) {
|
|
422
|
-
case Align.start:
|
|
423
|
-
offset = 0;
|
|
262
|
+
const j = C(() => {
|
|
263
|
+
let t = 0;
|
|
264
|
+
switch (e.align) {
|
|
265
|
+
case W.start:
|
|
266
|
+
t = 0;
|
|
424
267
|
break;
|
|
425
|
-
case
|
|
426
|
-
|
|
268
|
+
case W.center:
|
|
269
|
+
t = (f.viewportSize - s.size) / 2;
|
|
427
270
|
break;
|
|
428
|
-
case
|
|
429
|
-
|
|
271
|
+
case W.end:
|
|
272
|
+
t = f.viewportSize - s.size;
|
|
430
273
|
break;
|
|
431
274
|
default:
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
return offset;
|
|
435
|
-
});
|
|
436
|
-
const needLoop = computed(() => {
|
|
437
|
-
return props.loop && itemList.length > 1;
|
|
438
|
-
});
|
|
439
|
-
const updateTransform = (index) => {
|
|
440
|
-
const itemSizeSpace = itemDetail.size + itemDetail.space;
|
|
441
|
-
if (needLoop.value) {
|
|
442
|
-
trackDetail.offset = -itemSizeSpace * (index + trackDetail.cloneNodeCount) + positionOffset.value;
|
|
443
|
-
} else {
|
|
444
|
-
trackDetail.offset = -itemSizeSpace * index + positionOffset.value;
|
|
445
|
-
if (props.align !== "center") {
|
|
446
|
-
if (index === 0) {
|
|
447
|
-
trackDetail.offset = 0;
|
|
448
|
-
}
|
|
449
|
-
if (index === itemList.length - 1) {
|
|
450
|
-
trackDetail.offset = -itemSizeSpace * index + trackDetail.viewportSize - itemDetail.size;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
const afterChange = () => {
|
|
456
|
-
updateTransform(activeIndex.value);
|
|
457
|
-
emit("afterChange", activeIndex.value);
|
|
458
|
-
};
|
|
459
|
-
const getIndex = (index) => {
|
|
460
|
-
return (itemList.length + index) % itemList.length;
|
|
461
|
-
};
|
|
462
|
-
const moveTo = (index, withAnimation = true) => {
|
|
463
|
-
activeIndex.value = getIndex(index);
|
|
464
|
-
updateTransform(index);
|
|
465
|
-
checkItemShowed();
|
|
466
|
-
emit("change", activeIndex.value);
|
|
467
|
-
if (withAnimation) {
|
|
468
|
-
dragDetail.transitionEnabled = true;
|
|
469
|
-
if (swipeTrackRef.value) {
|
|
470
|
-
swipeTrackRef.value.addEventListener("transitionend", () => {
|
|
471
|
-
dragDetail.transitionEnabled = false;
|
|
472
|
-
afterChange();
|
|
473
|
-
}, {
|
|
474
|
-
once: true
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
} else {
|
|
478
|
-
afterChange();
|
|
275
|
+
t = 0;
|
|
479
276
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
277
|
+
return t;
|
|
278
|
+
}), x = C(() => e.loop && u.length > 1), I = (t) => {
|
|
279
|
+
const a = s.size + s.space;
|
|
280
|
+
x.value ? f.offset = -a * (t + f.cloneNodeCount) + j.value : (f.offset = -a * t + j.value, e.align !== "center" && (t === 0 && (f.offset = 0), t === u.length - 1 && (f.offset = -a * t + f.viewportSize - s.size)));
|
|
281
|
+
}, F = () => {
|
|
282
|
+
I(c.value), o("afterChange", c.value);
|
|
283
|
+
}, _ = (t) => (u.length + t) % u.length, A = (t, a = !0) => {
|
|
284
|
+
c.value = _(t), I(t), R(), o("change", c.value), a ? (r.transitionEnabled = !0, g.value && g.value.addEventListener("transitionend", () => {
|
|
285
|
+
r.transitionEnabled = !1, F();
|
|
286
|
+
}, {
|
|
287
|
+
once: !0
|
|
288
|
+
})) : F();
|
|
289
|
+
}, Y = (t = !0) => {
|
|
290
|
+
A(c.value - 1, t);
|
|
291
|
+
}, O = (t = !0) => {
|
|
292
|
+
A(c.value + 1, t);
|
|
293
|
+
};
|
|
294
|
+
let i = null;
|
|
295
|
+
const d = () => {
|
|
296
|
+
e.autoplayTime && i && clearInterval(i);
|
|
297
|
+
}, h = () => {
|
|
298
|
+
e.autoplayTime && u.length > 1 && (i && clearInterval(i), i = setInterval(() => {
|
|
299
|
+
O();
|
|
300
|
+
}, Number(e.autoplayTime)));
|
|
301
|
+
}, r = N({
|
|
504
302
|
// 拖拽中
|
|
505
|
-
isDragging:
|
|
303
|
+
isDragging: !1,
|
|
506
304
|
// 是否首次拖动
|
|
507
|
-
isFirstTouch:
|
|
305
|
+
isFirstTouch: !0,
|
|
508
306
|
// 拖拽起始位置X
|
|
509
307
|
startX: 0,
|
|
510
308
|
// 拖拽起始位置Y
|
|
@@ -514,182 +312,105 @@ const Swipe = /* @__PURE__ */ defineComponent({
|
|
|
514
312
|
// 开始拖动时间
|
|
515
313
|
startTime: /* @__PURE__ */ new Date(),
|
|
516
314
|
// 是否在执行动画
|
|
517
|
-
transitionEnabled:
|
|
518
|
-
})
|
|
519
|
-
|
|
520
|
-
if (dragDetail.transitionEnabled) {
|
|
315
|
+
transitionEnabled: !1
|
|
316
|
+
}), M = (t) => {
|
|
317
|
+
if (r.transitionEnabled)
|
|
521
318
|
return;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
dragDetail.startX = clientX;
|
|
533
|
-
dragDetail.startY = clientY;
|
|
534
|
-
dragDetail.isDragging = true;
|
|
535
|
-
dragDetail.isFirstTouch = true;
|
|
536
|
-
dragDetail.startTime = /* @__PURE__ */ new Date();
|
|
537
|
-
};
|
|
538
|
-
const onTouch = (e) => {
|
|
539
|
-
if (!dragDetail.isDragging) {
|
|
319
|
+
let a = 0, m = 0;
|
|
320
|
+
"touches" in t ? (a = t.touches[0].clientX, m = t.touches[0].clientY) : (a = t.clientX, m = t.clientY), r.startX = a, r.startY = m, r.isDragging = !0, r.isFirstTouch = !0, r.startTime = /* @__PURE__ */ new Date();
|
|
321
|
+
}, P = (t) => {
|
|
322
|
+
if (!r.isDragging)
|
|
323
|
+
return;
|
|
324
|
+
let a = 0, m = 0;
|
|
325
|
+
"touches" in t ? (a = t.touches[0].clientX, m = t.touches[0].clientY) : (a = t.clientX, m = t.clientY);
|
|
326
|
+
const w = a - r.startX, y = m - r.startY;
|
|
327
|
+
if (r.isFirstTouch && (r.isFirstTouch = !1, Math.abs(w) < Math.abs(y) !== e.vertical)) {
|
|
328
|
+
r.isDragging = !1;
|
|
540
329
|
return;
|
|
541
330
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
clientX = e.touches[0].clientX;
|
|
546
|
-
clientY = e.touches[0].clientY;
|
|
547
|
-
} else {
|
|
548
|
-
clientX = e.clientX;
|
|
549
|
-
clientY = e.clientY;
|
|
550
|
-
}
|
|
551
|
-
const offsetX = clientX - dragDetail.startX;
|
|
552
|
-
const offsetY = clientY - dragDetail.startY;
|
|
553
|
-
if (dragDetail.isFirstTouch) {
|
|
554
|
-
dragDetail.isFirstTouch = false;
|
|
555
|
-
const isVerticalTouch = Math.abs(offsetX) < Math.abs(offsetY);
|
|
556
|
-
if (isVerticalTouch !== props.vertical) {
|
|
557
|
-
dragDetail.isDragging = false;
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
e.preventDefault();
|
|
562
|
-
dragDetail.offset = props.vertical ? offsetY : offsetX;
|
|
563
|
-
checkItemShowed();
|
|
564
|
-
emit("dragging", {
|
|
565
|
-
percent: dragDetail.offset / (itemDetail.size + itemDetail.space),
|
|
566
|
-
offset: dragDetail.offset
|
|
331
|
+
t.preventDefault(), r.offset = e.vertical ? y : w, R(), o("dragging", {
|
|
332
|
+
percent: r.offset / (s.size + s.space),
|
|
333
|
+
offset: r.offset
|
|
567
334
|
});
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (!dragDetail.isDragging) {
|
|
335
|
+
}, $ = () => {
|
|
336
|
+
if (!r.isDragging)
|
|
571
337
|
return;
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
return true;
|
|
590
|
-
}
|
|
591
|
-
const nextIndex = dragDetail.offset > 0 ? activeIndex.value - 1 : activeIndex.value + 1;
|
|
592
|
-
return nextIndex >= 0 && nextIndex < itemList.length;
|
|
593
|
-
};
|
|
594
|
-
const trackStyle = computed(() => {
|
|
595
|
-
const offset = dragDetail.isDragging && !props.isFollowHand ? trackDetail.offset : trackDetail.offset + dragDetail.offset;
|
|
596
|
-
const style2 = {};
|
|
597
|
-
if (props.vertical) {
|
|
598
|
-
style2.transform = `translate3d(0, ${offset}px, 0)`;
|
|
599
|
-
style2.transitionDuration = dragDetail.transitionEnabled ? `${props.duration}ms` : "0ms";
|
|
600
|
-
} else {
|
|
601
|
-
style2.transform = `translate3d(${offset}px, 0, 0)`;
|
|
602
|
-
style2.transitionDuration = dragDetail.transitionEnabled ? `${props.duration}ms` : "0ms";
|
|
603
|
-
}
|
|
604
|
-
if (dragDetail.isDragging) {
|
|
605
|
-
style2.transition = "none";
|
|
606
|
-
}
|
|
607
|
-
if (props.vertical) {
|
|
608
|
-
style2.flexDirection = "column";
|
|
609
|
-
}
|
|
610
|
-
if (props.autoHeight) {
|
|
611
|
-
style2.display = "block";
|
|
612
|
-
style2.whiteSpace = "nowrap";
|
|
613
|
-
}
|
|
614
|
-
return style2;
|
|
615
|
-
});
|
|
616
|
-
const dotsClass = computed(() => {
|
|
617
|
-
const position = props.dotsPosition || (props.vertical ? Position.left : Position.bottom);
|
|
618
|
-
return ["y-swipe__dots", `y-swipe__dots--${position}`];
|
|
338
|
+
r.isDragging = !1;
|
|
339
|
+
const a = (/* @__PURE__ */ new Date()).getTime() - r.startTime.getTime();
|
|
340
|
+
ge() && (Math.abs(r.offset) > he.value || Math.abs(r.offset) / a > 0.5) && (r.offset > 0 ? Y() : O()), r.offset = 0, h();
|
|
341
|
+
}, he = C(() => ae(e.minSwipeDistance, s.size + s.space)), ge = () => {
|
|
342
|
+
if (x.value)
|
|
343
|
+
return !0;
|
|
344
|
+
const t = r.offset > 0 ? c.value - 1 : c.value + 1;
|
|
345
|
+
return t >= 0 && t < u.length;
|
|
346
|
+
}, ye = C(() => {
|
|
347
|
+
const t = r.isDragging && !e.isFollowHand ? f.offset : f.offset + r.offset, a = {};
|
|
348
|
+
return e.vertical ? (a.transform = `translate3d(0, ${t}px, 0)`, a.transitionDuration = r.transitionEnabled ? `${e.duration}ms` : "0ms") : (a.transform = `translate3d(${t}px, 0, 0)`, a.transitionDuration = r.transitionEnabled ? `${e.duration}ms` : "0ms"), r.isDragging && (a.transition = "none"), e.vertical && (a.flexDirection = "column"), e.autoHeight && (a.display = "block", a.whiteSpace = "nowrap"), a;
|
|
349
|
+
}), be = C(() => ["y-swipe__dots", `y-swipe__dots--${e.dotsPosition || (e.vertical ? ne.left : ne.bottom)}`]);
|
|
350
|
+
l({
|
|
351
|
+
moveTo: A,
|
|
352
|
+
next: O,
|
|
353
|
+
prev: Y,
|
|
354
|
+
resize: L
|
|
619
355
|
});
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
356
|
+
const we = N({
|
|
357
|
+
children: u,
|
|
358
|
+
activeIndex: c,
|
|
359
|
+
props: e,
|
|
360
|
+
itemDetail: s,
|
|
361
|
+
itemShowedList: k
|
|
625
362
|
});
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
});
|
|
642
|
-
return createVNode("div", {
|
|
643
|
-
"class": className,
|
|
644
|
-
"style": {
|
|
645
|
-
backgroundColor: props.dotsColor
|
|
646
|
-
},
|
|
647
|
-
"key": index
|
|
648
|
-
}, null);
|
|
649
|
-
})]);
|
|
650
|
-
}
|
|
651
|
-
return null;
|
|
652
|
-
};
|
|
363
|
+
v(we);
|
|
364
|
+
const pe = () => e.dots ? b("div", {
|
|
365
|
+
class: be.value
|
|
366
|
+
}, [u.map((t, a) => {
|
|
367
|
+
const m = q("dot", {
|
|
368
|
+
active: a === c.value
|
|
369
|
+
});
|
|
370
|
+
return b("div", {
|
|
371
|
+
class: m,
|
|
372
|
+
style: {
|
|
373
|
+
backgroundColor: e.dotsColor
|
|
374
|
+
},
|
|
375
|
+
key: a
|
|
376
|
+
}, null);
|
|
377
|
+
})]) : null;
|
|
653
378
|
return () => {
|
|
654
|
-
var
|
|
655
|
-
return
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}, [
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}, [Array(
|
|
663
|
-
var
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
"index": nodeIndex
|
|
379
|
+
var t;
|
|
380
|
+
return b("div", {
|
|
381
|
+
class: q(),
|
|
382
|
+
ref: T
|
|
383
|
+
}, [b("div", {
|
|
384
|
+
class: q("track"),
|
|
385
|
+
style: ye.value,
|
|
386
|
+
ref: g
|
|
387
|
+
}, [Array(f.cloneNodeCount).fill("").map((a, m) => {
|
|
388
|
+
var S, E, X;
|
|
389
|
+
const w = _(m - f.cloneNodeCount), y = (X = (S = u[w]) == null ? void 0 : (E = S.slots).default) == null ? void 0 : X.call(E);
|
|
390
|
+
return y ? b(K, {
|
|
391
|
+
clonenNode: y,
|
|
392
|
+
index: w
|
|
669
393
|
}, null) : null;
|
|
670
|
-
}), (
|
|
671
|
-
var
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
"index": nodeIndex
|
|
394
|
+
}), (t = n.default) == null ? void 0 : t.call(n), Array(f.cloneNodeCount).fill("").map((a, m) => {
|
|
395
|
+
var S, E, X;
|
|
396
|
+
const w = _(m), y = (X = (S = u[w]) == null ? void 0 : (E = S.slots).default) == null ? void 0 : X.call(E);
|
|
397
|
+
return y ? b(K, {
|
|
398
|
+
clonenNode: y,
|
|
399
|
+
index: w
|
|
677
400
|
}, null) : null;
|
|
678
|
-
})]),
|
|
401
|
+
})]), n.dots ? n.dots() : pe()]);
|
|
679
402
|
};
|
|
680
403
|
}
|
|
681
|
-
})
|
|
682
|
-
|
|
683
|
-
const YTabTitle = /* @__PURE__ */ defineComponent({
|
|
684
|
-
name: name$1,
|
|
404
|
+
}), [Ae, oe] = U("tabs-title"), se = /* @__PURE__ */ H({
|
|
405
|
+
name: Ae,
|
|
685
406
|
props: {
|
|
686
407
|
active: {
|
|
687
408
|
type: Boolean,
|
|
688
|
-
default:
|
|
409
|
+
default: !1
|
|
689
410
|
},
|
|
690
411
|
scrollable: {
|
|
691
412
|
type: Boolean,
|
|
692
|
-
default:
|
|
413
|
+
default: !1
|
|
693
414
|
},
|
|
694
415
|
title: {
|
|
695
416
|
type: String,
|
|
@@ -701,47 +422,39 @@ const YTabTitle = /* @__PURE__ */ defineComponent({
|
|
|
701
422
|
},
|
|
702
423
|
disabled: {
|
|
703
424
|
type: Boolean,
|
|
704
|
-
default:
|
|
425
|
+
default: !1
|
|
705
426
|
}
|
|
706
427
|
},
|
|
707
|
-
setup(
|
|
428
|
+
setup(e) {
|
|
708
429
|
const {
|
|
709
|
-
parent
|
|
710
|
-
} =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
...parent == null ? void 0 : parent.props.titleStyle,
|
|
724
|
-
...props.active ? {
|
|
725
|
-
...parent == null ? void 0 : parent.props.titleActiveStyle
|
|
726
|
-
} : {}
|
|
727
|
-
};
|
|
728
|
-
});
|
|
430
|
+
parent: n
|
|
431
|
+
} = fe(me), o = C(() => [{
|
|
432
|
+
"y-el--clickable": !e.disabled
|
|
433
|
+
}, oe({
|
|
434
|
+
scrollable: e.scrollable,
|
|
435
|
+
disabled: e.disabled
|
|
436
|
+
}), oe(`${(n == null ? void 0 : n.props.size) || "middle"}`, {
|
|
437
|
+
active: e.active
|
|
438
|
+
}), n == null ? void 0 : n.props.titleClass, e.active ? n == null ? void 0 : n.props.titleActiveClass : ""]), l = C(() => ({
|
|
439
|
+
...n == null ? void 0 : n.props.titleStyle,
|
|
440
|
+
...e.active ? {
|
|
441
|
+
...n == null ? void 0 : n.props.titleActiveStyle
|
|
442
|
+
} : {}
|
|
443
|
+
}));
|
|
729
444
|
return () => {
|
|
730
445
|
const {
|
|
731
|
-
title,
|
|
732
|
-
titleSlot
|
|
733
|
-
} =
|
|
734
|
-
return
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
}, [
|
|
446
|
+
title: v,
|
|
447
|
+
titleSlot: u
|
|
448
|
+
} = e;
|
|
449
|
+
return b("div", {
|
|
450
|
+
class: o.value,
|
|
451
|
+
title: v,
|
|
452
|
+
style: l.value,
|
|
453
|
+
role: "presentation"
|
|
454
|
+
}, [u ? u() : v]);
|
|
740
455
|
};
|
|
741
456
|
}
|
|
742
|
-
})
|
|
743
|
-
const unknownProp = null;
|
|
744
|
-
const acceptProps = {
|
|
457
|
+
}), J = null, Ye = {
|
|
745
458
|
initIndex: {
|
|
746
459
|
type: Number,
|
|
747
460
|
default: 0
|
|
@@ -756,7 +469,7 @@ const acceptProps = {
|
|
|
756
469
|
},
|
|
757
470
|
lazy: {
|
|
758
471
|
type: Boolean,
|
|
759
|
-
default:
|
|
472
|
+
default: !1
|
|
760
473
|
},
|
|
761
474
|
lineColor: {
|
|
762
475
|
type: String,
|
|
@@ -770,7 +483,7 @@ const acceptProps = {
|
|
|
770
483
|
type: [Number, String],
|
|
771
484
|
default: "3px"
|
|
772
485
|
},
|
|
773
|
-
titleWrapperClass:
|
|
486
|
+
titleWrapperClass: J,
|
|
774
487
|
titleScrollThreshold: {
|
|
775
488
|
type: Number,
|
|
776
489
|
default: 5
|
|
@@ -780,7 +493,7 @@ const acceptProps = {
|
|
|
780
493
|
default: null
|
|
781
494
|
},
|
|
782
495
|
titleClass: {
|
|
783
|
-
type:
|
|
496
|
+
type: J,
|
|
784
497
|
default: null
|
|
785
498
|
},
|
|
786
499
|
titleActiveStyle: {
|
|
@@ -788,16 +501,16 @@ const acceptProps = {
|
|
|
788
501
|
default: null
|
|
789
502
|
},
|
|
790
503
|
titleActiveClass: {
|
|
791
|
-
type:
|
|
504
|
+
type: J,
|
|
792
505
|
default: null
|
|
793
506
|
},
|
|
794
507
|
touchable: {
|
|
795
508
|
type: Boolean,
|
|
796
|
-
default:
|
|
509
|
+
default: !0
|
|
797
510
|
},
|
|
798
511
|
changeWithAnimation: {
|
|
799
512
|
type: Boolean,
|
|
800
|
-
default:
|
|
513
|
+
default: !1
|
|
801
514
|
},
|
|
802
515
|
size: {
|
|
803
516
|
type: String,
|
|
@@ -808,207 +521,153 @@ const acceptProps = {
|
|
|
808
521
|
default: "center"
|
|
809
522
|
}
|
|
810
523
|
};
|
|
811
|
-
function
|
|
812
|
-
return typeof
|
|
524
|
+
function Oe(e) {
|
|
525
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !re(e);
|
|
813
526
|
}
|
|
814
|
-
const [
|
|
815
|
-
|
|
816
|
-
const Tabs = /* @__PURE__ */ defineComponent({
|
|
817
|
-
name,
|
|
527
|
+
const [le, Q] = U("tabs"), me = le, Z = /* @__PURE__ */ H({
|
|
528
|
+
name: le,
|
|
818
529
|
components: {
|
|
819
|
-
YTabTitle
|
|
530
|
+
YTabTitle: se
|
|
820
531
|
},
|
|
821
|
-
props:
|
|
822
|
-
setup(
|
|
823
|
-
slots,
|
|
824
|
-
emit,
|
|
825
|
-
expose
|
|
532
|
+
props: Ye,
|
|
533
|
+
setup(e, {
|
|
534
|
+
slots: n,
|
|
535
|
+
emit: o,
|
|
536
|
+
expose: l
|
|
826
537
|
}) {
|
|
827
538
|
const {
|
|
828
|
-
initProvide
|
|
829
|
-
} =
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
};
|
|
843
|
-
const scrollToByIndex = (index) => {
|
|
844
|
-
scrollTo(index);
|
|
845
|
-
};
|
|
846
|
-
const scrollToByName = (tabName) => {
|
|
847
|
-
const curIndex = getCurIndexByName(tabName);
|
|
848
|
-
scrollTo(curIndex);
|
|
849
|
-
};
|
|
850
|
-
expose({
|
|
851
|
-
scrollToByIndex,
|
|
852
|
-
scrollToByName
|
|
539
|
+
initProvide: v
|
|
540
|
+
} = ue(me), u = z(!1), c = N([]), s = z(), f = C(() => c.length > e.titleScrollThreshold), T = (i) => c.findIndex((d) => (d.$props ? d.$props.name : "") === i), g = z(e.initName ? T(e.initName) : e.initIndex), B = (i) => {
|
|
541
|
+
g.value = i;
|
|
542
|
+
const d = s.value;
|
|
543
|
+
d && (d == null || d.moveTo(i, e.changeWithAnimation));
|
|
544
|
+
};
|
|
545
|
+
l({
|
|
546
|
+
scrollToByIndex: (i) => {
|
|
547
|
+
B(i);
|
|
548
|
+
},
|
|
549
|
+
scrollToByName: (i) => {
|
|
550
|
+
const d = T(i);
|
|
551
|
+
B(d);
|
|
552
|
+
}
|
|
853
553
|
});
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
titlesRef.value[index] = titleRef;
|
|
858
|
-
};
|
|
859
|
-
const clickTitle = (index) => {
|
|
554
|
+
const p = z([]), D = z(), G = (i) => (d) => {
|
|
555
|
+
p.value[i] = d;
|
|
556
|
+
}, L = (i) => {
|
|
860
557
|
const {
|
|
861
|
-
title,
|
|
862
|
-
name:
|
|
863
|
-
disabled
|
|
864
|
-
} =
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
return;
|
|
870
|
-
scrollTo(index);
|
|
871
|
-
};
|
|
872
|
-
const titleScrollToView = async () => {
|
|
873
|
-
await nextTick(() => {
|
|
874
|
-
if (!isTabScrollable.value || !tabListRef.value)
|
|
558
|
+
title: d,
|
|
559
|
+
name: h,
|
|
560
|
+
disabled: r
|
|
561
|
+
} = c[i].$props || {};
|
|
562
|
+
g.value !== i && (o(r ? "disabledClick" : "click", i, d, h), !r && B(i));
|
|
563
|
+
}, j = async () => {
|
|
564
|
+
await te(() => {
|
|
565
|
+
if (!f.value || !D.value)
|
|
875
566
|
return;
|
|
876
|
-
const
|
|
877
|
-
if (!
|
|
567
|
+
const i = D.value;
|
|
568
|
+
if (!i || !p.value[g.value])
|
|
878
569
|
return;
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
left: scrollDistance,
|
|
570
|
+
const d = p.value[g.value].$el, h = d.offsetLeft - (i.offsetWidth - d.offsetWidth) / 2 - i.scrollLeft;
|
|
571
|
+
i.scrollBy({
|
|
572
|
+
left: h,
|
|
883
573
|
behavior: "smooth"
|
|
884
574
|
});
|
|
885
575
|
});
|
|
886
576
|
};
|
|
887
|
-
|
|
888
|
-
|
|
577
|
+
ze(() => {
|
|
578
|
+
p.value = [];
|
|
889
579
|
});
|
|
890
|
-
const
|
|
580
|
+
const x = N({
|
|
891
581
|
transform: "translateX(50%)",
|
|
892
582
|
transition: "all 0ms ease-out"
|
|
893
|
-
})
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
if (!titlesRef.value || titlesRef.value.length === 0)
|
|
583
|
+
}), I = async () => {
|
|
584
|
+
await te(() => {
|
|
585
|
+
if (!p.value || p.value.length === 0)
|
|
897
586
|
return;
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
const left = curTitle.offsetLeft + curTitle.offsetWidth / 2;
|
|
901
|
-
lintState.transform = `translateX(${left}px) translateX(-50%)`;
|
|
902
|
-
if (inited.value) {
|
|
903
|
-
lintState.transition = `all ${props.duration}ms ease-out`;
|
|
904
|
-
}
|
|
905
|
-
inited.value = true;
|
|
587
|
+
const i = g.value >= p.value.length ? 0 : g.value, d = p.value[i].$el, h = d.offsetLeft + d.offsetWidth / 2;
|
|
588
|
+
x.transform = `translateX(${h}px) translateX(-50%)`, u.value && (x.transition = `all ${e.duration}ms ease-out`), u.value = !0;
|
|
906
589
|
});
|
|
907
|
-
}
|
|
908
|
-
const swipeChange = (index) => {
|
|
590
|
+
}, F = (i) => {
|
|
909
591
|
const {
|
|
910
|
-
title,
|
|
911
|
-
name:
|
|
912
|
-
} =
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
};
|
|
916
|
-
const swipeAfterChange = (index) => {
|
|
592
|
+
title: d,
|
|
593
|
+
name: h
|
|
594
|
+
} = c[i].$props || {};
|
|
595
|
+
o("change", i, d, h), g.value = i;
|
|
596
|
+
}, _ = (i) => {
|
|
917
597
|
const {
|
|
918
|
-
title,
|
|
919
|
-
name:
|
|
920
|
-
} =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
activeIndex,
|
|
927
|
-
props
|
|
928
|
-
});
|
|
929
|
-
initProvide(tabs);
|
|
930
|
-
const getSize = (value) => {
|
|
931
|
-
if (isString(value))
|
|
932
|
-
return /^\d+(\.\d+)?$/.test(value) ? `${value}px` : value;
|
|
933
|
-
return value;
|
|
934
|
-
};
|
|
935
|
-
const isString = (value) => {
|
|
936
|
-
return Object.prototype.toString.call(value) === `[object String]`;
|
|
937
|
-
};
|
|
938
|
-
onMounted(async () => {
|
|
939
|
-
await updateLineStyle();
|
|
598
|
+
title: d,
|
|
599
|
+
name: h
|
|
600
|
+
} = c[i].$props || {};
|
|
601
|
+
o("afterChange", i, d, h), g.value = i;
|
|
602
|
+
}, A = N({
|
|
603
|
+
children: c,
|
|
604
|
+
activeIndex: g,
|
|
605
|
+
props: e
|
|
940
606
|
});
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
607
|
+
v(A);
|
|
608
|
+
const Y = (i) => O(i) && /^\d+(\.\d+)?$/.test(i) ? `${i}px` : i, O = (i) => Object.prototype.toString.call(i) === "[object String]";
|
|
609
|
+
return ce(async () => {
|
|
610
|
+
await I();
|
|
611
|
+
}), ee(() => g.value, async () => {
|
|
612
|
+
await I(), await j();
|
|
613
|
+
}), ee(() => {
|
|
614
|
+
var i;
|
|
615
|
+
return (i = n.default) == null ? void 0 : i.length;
|
|
948
616
|
}, async () => {
|
|
949
|
-
await
|
|
950
|
-
})
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
"
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
[
|
|
962
|
-
[props.align]: props.align
|
|
617
|
+
await I();
|
|
618
|
+
}), () => {
|
|
619
|
+
let i;
|
|
620
|
+
return b("div", {
|
|
621
|
+
class: le
|
|
622
|
+
}, [b("div", {
|
|
623
|
+
class: Q("list")
|
|
624
|
+
}, [b("div", {
|
|
625
|
+
ref: D,
|
|
626
|
+
class: Q("list-child-wrapper", {
|
|
627
|
+
scrollable: f.value,
|
|
628
|
+
[e.size]: e.size,
|
|
629
|
+
[e.align]: e.align
|
|
963
630
|
})
|
|
964
|
-
}, [
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
height: getSize(props.lineHeight),
|
|
981
|
-
backgroundColor: props.lineColor
|
|
631
|
+
}, [c.length > 0 && c.map((d, h) => b(se, {
|
|
632
|
+
title: d.title,
|
|
633
|
+
disabled: d.disabled,
|
|
634
|
+
"title-slot": d.$slots.title,
|
|
635
|
+
key: h,
|
|
636
|
+
ref: G(h),
|
|
637
|
+
active: g.value === h,
|
|
638
|
+
scrollable: f.value,
|
|
639
|
+
onClick: () => L(h)
|
|
640
|
+
}, null)), b("div", {
|
|
641
|
+
class: Q("line"),
|
|
642
|
+
style: {
|
|
643
|
+
...x,
|
|
644
|
+
width: Y(e.lineWidth),
|
|
645
|
+
height: Y(e.lineHeight),
|
|
646
|
+
backgroundColor: e.lineColor
|
|
982
647
|
}
|
|
983
|
-
}, null)])]),
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
"is-follow-hand":
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
},
|
|
995
|
-
default: () => [
|
|
648
|
+
}, null)])]), n.default ? b(_e, {
|
|
649
|
+
ref: s,
|
|
650
|
+
dots: !1,
|
|
651
|
+
loop: !1,
|
|
652
|
+
initIndex: g.value,
|
|
653
|
+
lazy: e.lazy,
|
|
654
|
+
touchable: e.touchable,
|
|
655
|
+
duration: e.duration,
|
|
656
|
+
"is-follow-hand": e.changeWithAnimation,
|
|
657
|
+
onChange: F,
|
|
658
|
+
onAfterChange: _
|
|
659
|
+
}, Oe(i = n.default()) ? i : {
|
|
660
|
+
default: () => [i]
|
|
996
661
|
}) : null]);
|
|
997
662
|
};
|
|
998
663
|
}
|
|
999
664
|
});
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1003
|
-
const animation = "";
|
|
1004
|
-
const theme = "";
|
|
1005
|
-
const style = "";
|
|
1006
|
-
Tabs.install = (Vue) => {
|
|
1007
|
-
const { name: name2 } = Tabs;
|
|
1008
|
-
Vue.component(name2, Tabs);
|
|
665
|
+
Z.install = (e) => {
|
|
666
|
+
const { name: n } = Z;
|
|
667
|
+
e.component(n, Z);
|
|
1009
668
|
};
|
|
1010
669
|
export {
|
|
1011
|
-
acceptProps,
|
|
1012
|
-
|
|
1013
|
-
unknownProp
|
|
670
|
+
Ye as acceptProps,
|
|
671
|
+
Z as default,
|
|
672
|
+
J as unknownProp
|
|
1014
673
|
};
|