@nutui/nutui 4.0.12-beta.1 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +1 -1
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +50 -50
- package/dist/styles/themes/jdb.scss +50 -50
- package/dist/styles/themes/jddkh.scss +50 -50
- package/dist/styles/themes/jdt.scss +50 -50
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
5
|
-
import { r as
|
|
6
|
-
import { _ as
|
|
1
|
+
import { ref, reactive, computed, provide, onDeactivated, onBeforeUnmount, watch, nextTick, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
|
|
2
|
+
import { c as createComponent, e as clamp } from "./component-81a4c1d0.js";
|
|
3
|
+
import { u as useTouch } from "./index-7a7385e4.js";
|
|
4
|
+
import { u as useExpose } from "./index-79c5dc33.js";
|
|
5
|
+
import { r as requestAniFrame } from "./raf-729dad54.js";
|
|
6
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
7
7
|
import "../locale/lang";
|
|
8
|
-
const { create
|
|
8
|
+
const { create, componentName } = createComponent("swiper");
|
|
9
|
+
const _sfc_main = create({
|
|
9
10
|
props: {
|
|
10
11
|
width: {
|
|
11
12
|
type: [Number, String],
|
|
@@ -22,7 +23,7 @@ const { create: ce, componentName: M } = le("swiper"), fe = ce({
|
|
|
22
23
|
},
|
|
23
24
|
paginationVisible: {
|
|
24
25
|
type: Boolean,
|
|
25
|
-
default:
|
|
26
|
+
default: false
|
|
26
27
|
},
|
|
27
28
|
paginationColor: {
|
|
28
29
|
type: String,
|
|
@@ -30,7 +31,7 @@ const { create: ce, componentName: M } = le("swiper"), fe = ce({
|
|
|
30
31
|
},
|
|
31
32
|
loop: {
|
|
32
33
|
type: Boolean,
|
|
33
|
-
default:
|
|
34
|
+
default: true
|
|
34
35
|
},
|
|
35
36
|
duration: {
|
|
36
37
|
type: [Number, String],
|
|
@@ -46,225 +47,361 @@ const { create: ce, componentName: M } = le("swiper"), fe = ce({
|
|
|
46
47
|
},
|
|
47
48
|
touchable: {
|
|
48
49
|
type: Boolean,
|
|
49
|
-
default:
|
|
50
|
+
default: true
|
|
50
51
|
},
|
|
51
52
|
isPreventDefault: {
|
|
52
53
|
type: Boolean,
|
|
53
|
-
default:
|
|
54
|
+
default: true
|
|
54
55
|
},
|
|
55
56
|
isStopPropagation: {
|
|
56
57
|
type: Boolean,
|
|
57
|
-
default:
|
|
58
|
+
default: true
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
emits: ["change"],
|
|
61
|
-
setup(
|
|
62
|
-
const
|
|
62
|
+
setup(props, { emit, slots }) {
|
|
63
|
+
const container = ref();
|
|
64
|
+
const state = reactive({
|
|
63
65
|
active: 0,
|
|
64
66
|
num: 0,
|
|
65
67
|
rect: null,
|
|
66
68
|
width: 0,
|
|
67
69
|
height: 0,
|
|
68
|
-
moving:
|
|
70
|
+
moving: false,
|
|
69
71
|
offset: 0,
|
|
70
72
|
touchTime: 0,
|
|
71
73
|
autoplayTimer: null,
|
|
72
74
|
children: [],
|
|
73
75
|
childrenVNode: [],
|
|
74
76
|
style: {}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
77
|
+
});
|
|
78
|
+
const touch = useTouch();
|
|
79
|
+
const classes = computed(() => {
|
|
80
|
+
const prefixCls = componentName;
|
|
79
81
|
return {
|
|
80
|
-
[
|
|
81
|
-
[`${t}-vertical`]: l.value
|
|
82
|
+
[prefixCls]: true
|
|
82
83
|
};
|
|
83
|
-
})
|
|
84
|
-
|
|
84
|
+
});
|
|
85
|
+
const isVertical = computed(() => props.direction === "vertical");
|
|
86
|
+
const classesInner = computed(() => {
|
|
87
|
+
const prefixCls = componentName;
|
|
85
88
|
return {
|
|
86
|
-
[`${
|
|
87
|
-
[`${
|
|
89
|
+
[`${prefixCls}-inner`]: true,
|
|
90
|
+
[`${prefixCls}-vertical`]: isVertical.value
|
|
88
91
|
};
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
[
|
|
95
|
-
|
|
92
|
+
});
|
|
93
|
+
const classesPagination = computed(() => {
|
|
94
|
+
const prefixCls = componentName;
|
|
95
|
+
return {
|
|
96
|
+
[`${prefixCls}-pagination`]: true,
|
|
97
|
+
[`${prefixCls}-pagination-vertical`]: isVertical.value
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
const delTa = computed(() => {
|
|
101
|
+
return isVertical.value ? touch.deltaY.value : touch.deltaX.value;
|
|
102
|
+
});
|
|
103
|
+
const isCorrectDirection = computed(() => {
|
|
104
|
+
return touch.direction.value === props.direction;
|
|
105
|
+
});
|
|
106
|
+
const childCount = computed(() => state.children.length);
|
|
107
|
+
const size = computed(() => state[isVertical.value ? "height" : "width"]);
|
|
108
|
+
const trackSize = computed(() => childCount.value * size.value);
|
|
109
|
+
const minOffset = computed(() => {
|
|
110
|
+
if (state.rect) {
|
|
111
|
+
const base = isVertical.value ? state.rect.height : state.rect.width;
|
|
112
|
+
return base - size.value * childCount.value;
|
|
113
|
+
}
|
|
114
|
+
return 0;
|
|
115
|
+
});
|
|
116
|
+
const activePagination = computed(() => (state.active + childCount.value) % childCount.value);
|
|
117
|
+
const getStyle = () => {
|
|
118
|
+
let offset = 0;
|
|
119
|
+
offset = state.offset;
|
|
120
|
+
state.style = {
|
|
121
|
+
transitionDuration: `${state.moving ? 0 : props.duration}ms`,
|
|
122
|
+
transform: `translate${isVertical.value ? "Y" : "X"}(${offset}px)`,
|
|
123
|
+
[isVertical.value ? "height" : "width"]: `${size.value * childCount.value}px`,
|
|
124
|
+
[isVertical.value ? "width" : "height"]: `${isVertical.value ? state.width : state.height}px`
|
|
96
125
|
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
};
|
|
127
|
+
const relation = (child) => {
|
|
128
|
+
var _a;
|
|
129
|
+
let children = [];
|
|
130
|
+
const childrenVNodeLen = state.childrenVNode.length;
|
|
131
|
+
let slot = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots);
|
|
132
|
+
slot = slot.filter((item) => item.children && Array.isArray(item.children));
|
|
133
|
+
slot.forEach((item) => {
|
|
134
|
+
children = children.concat(item.children);
|
|
135
|
+
});
|
|
136
|
+
if (!childrenVNodeLen) {
|
|
137
|
+
state.childrenVNode = children.slice();
|
|
138
|
+
child.proxy && state.children.push(child.proxy);
|
|
139
|
+
} else {
|
|
140
|
+
if (childrenVNodeLen > children.length) {
|
|
141
|
+
state.children = state.children.filter((item) => child.proxy !== item);
|
|
142
|
+
} else if (childrenVNodeLen < children.length) {
|
|
143
|
+
for (let i = 0; i < childrenVNodeLen; i++) {
|
|
144
|
+
if (children[i].key !== state.childrenVNode[i].key) {
|
|
145
|
+
child.proxy && state.children.splice(i, 0, child.proxy);
|
|
146
|
+
child.vnode && state.childrenVNode.splice(i, 0, child.vnode);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
113
149
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (
|
|
150
|
+
if (childrenVNodeLen !== children.length) {
|
|
151
|
+
child.proxy && state.children.push(child.proxy);
|
|
152
|
+
child.vnode && state.childrenVNode.push(child.vnode);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
state.childrenVNode = children.slice();
|
|
156
|
+
child.proxy && state.children.push(child.proxy);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const getOffset = (active, offset = 0) => {
|
|
161
|
+
let currentPosition = active * size.value;
|
|
162
|
+
if (!props.loop) {
|
|
163
|
+
currentPosition = Math.min(currentPosition, -minOffset.value);
|
|
164
|
+
}
|
|
165
|
+
let targetOffset = offset - currentPosition;
|
|
166
|
+
if (!props.loop) {
|
|
167
|
+
targetOffset = clamp(targetOffset, minOffset.value, 0);
|
|
168
|
+
}
|
|
169
|
+
return targetOffset;
|
|
170
|
+
};
|
|
171
|
+
const getActive = (pace) => {
|
|
172
|
+
const { active } = state;
|
|
173
|
+
if (pace) {
|
|
174
|
+
if (props.loop) {
|
|
175
|
+
return clamp(active + pace, -1, childCount.value);
|
|
176
|
+
}
|
|
177
|
+
return clamp(active + pace, 0, childCount.value - 1);
|
|
178
|
+
}
|
|
179
|
+
return active;
|
|
180
|
+
};
|
|
181
|
+
const move = ({ pace = 0, offset = 0, isEmit = false }) => {
|
|
182
|
+
if (childCount.value <= 1)
|
|
127
183
|
return;
|
|
128
|
-
const { active
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
184
|
+
const { active } = state;
|
|
185
|
+
const targetActive = getActive(pace);
|
|
186
|
+
const targetOffset = getOffset(targetActive, offset);
|
|
187
|
+
if (props.loop) {
|
|
188
|
+
if (state.children[0] && targetOffset !== minOffset.value) {
|
|
189
|
+
const rightBound = targetOffset < minOffset.value;
|
|
190
|
+
state.children[0].setOffset(rightBound ? trackSize.value : 0);
|
|
133
191
|
}
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
|
|
192
|
+
if (state.children[childCount.value - 1] && targetOffset !== 0) {
|
|
193
|
+
const leftBound = targetOffset > 0;
|
|
194
|
+
state.children[childCount.value - 1].setOffset(leftBound ? -trackSize.value : 0);
|
|
137
195
|
}
|
|
138
196
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
197
|
+
state.active = targetActive;
|
|
198
|
+
state.offset = targetOffset;
|
|
199
|
+
if (isEmit && active !== state.active) {
|
|
200
|
+
emit("change", activePagination.value);
|
|
201
|
+
}
|
|
202
|
+
getStyle();
|
|
203
|
+
};
|
|
204
|
+
const resettPosition = () => {
|
|
205
|
+
state.moving = true;
|
|
206
|
+
if (state.active <= -1) {
|
|
207
|
+
move({ pace: childCount.value });
|
|
208
|
+
}
|
|
209
|
+
if (state.active >= childCount.value) {
|
|
210
|
+
move({ pace: -childCount.value });
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const stopAutoPlay = () => {
|
|
214
|
+
if (state.autoplayTimer) {
|
|
215
|
+
clearTimeout(state.autoplayTimer);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const jump = (pace) => {
|
|
219
|
+
resettPosition();
|
|
220
|
+
touch.reset();
|
|
221
|
+
requestAniFrame(() => {
|
|
222
|
+
requestAniFrame(() => {
|
|
223
|
+
state.moving = false;
|
|
224
|
+
move({
|
|
225
|
+
pace,
|
|
226
|
+
isEmit: true
|
|
150
227
|
});
|
|
151
228
|
});
|
|
152
229
|
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
230
|
+
};
|
|
231
|
+
const prev = () => {
|
|
232
|
+
jump(-1);
|
|
233
|
+
};
|
|
234
|
+
const next = () => {
|
|
235
|
+
jump(1);
|
|
236
|
+
};
|
|
237
|
+
const to = (index) => {
|
|
238
|
+
resettPosition();
|
|
239
|
+
touch.reset();
|
|
240
|
+
requestAniFrame(() => {
|
|
241
|
+
state.moving = false;
|
|
242
|
+
let targetIndex;
|
|
243
|
+
if (props.loop && childCount.value === index) {
|
|
244
|
+
targetIndex = state.active === 0 ? 0 : index;
|
|
245
|
+
} else {
|
|
246
|
+
targetIndex = index % childCount.value;
|
|
247
|
+
}
|
|
248
|
+
move({
|
|
249
|
+
pace: targetIndex - state.active,
|
|
250
|
+
isEmit: true
|
|
164
251
|
});
|
|
165
252
|
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}, Number(n.autoPlay)));
|
|
170
|
-
}, X = (t = +n.initPage) => {
|
|
171
|
-
y(), e.rect = N.value.getBoundingClientRect(), t = Math.min(i.value - 1, t), e.width = n.width ? +n.width : e.rect.width, e.height = n.height ? +n.height : e.rect.height, e.active = t, e.offset = z(e.active), e.moving = !0, $(), w();
|
|
172
|
-
}, H = (t) => {
|
|
173
|
-
n.isPreventDefault && t.preventDefault(), n.isStopPropagation && t.stopPropagation(), n.touchable && (f.start(t), e.touchTime = Date.now(), y(), C());
|
|
174
|
-
}, J = (t) => {
|
|
175
|
-
n.touchable && e.moving && (f.move(t), D.value && g({
|
|
176
|
-
offset: h.value
|
|
177
|
-
}));
|
|
178
|
-
}, K = (t) => {
|
|
179
|
-
if (!n.touchable || !e.moving)
|
|
253
|
+
};
|
|
254
|
+
const autoplay = () => {
|
|
255
|
+
if (props.autoPlay <= 0 || childCount.value <= 1)
|
|
180
256
|
return;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
257
|
+
stopAutoPlay();
|
|
258
|
+
state.autoplayTimer = setTimeout(() => {
|
|
259
|
+
next();
|
|
260
|
+
autoplay();
|
|
261
|
+
}, Number(props.autoPlay));
|
|
262
|
+
};
|
|
263
|
+
const init = (active = +props.initPage) => {
|
|
264
|
+
stopAutoPlay();
|
|
265
|
+
state.rect = container.value.getBoundingClientRect();
|
|
266
|
+
active = Math.min(childCount.value - 1, active);
|
|
267
|
+
state.width = props.width ? +props.width : state.rect.width;
|
|
268
|
+
state.height = props.height ? +props.height : state.rect.height;
|
|
269
|
+
state.active = active;
|
|
270
|
+
state.offset = getOffset(state.active);
|
|
271
|
+
state.moving = true;
|
|
272
|
+
getStyle();
|
|
273
|
+
autoplay();
|
|
274
|
+
};
|
|
275
|
+
const onTouchStart = (e) => {
|
|
276
|
+
if (props.isPreventDefault)
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
if (props.isStopPropagation)
|
|
279
|
+
e.stopPropagation();
|
|
280
|
+
if (!props.touchable)
|
|
281
|
+
return;
|
|
282
|
+
touch.start(e);
|
|
283
|
+
state.touchTime = Date.now();
|
|
284
|
+
stopAutoPlay();
|
|
285
|
+
resettPosition();
|
|
286
|
+
};
|
|
287
|
+
const onTouchMove = (e) => {
|
|
288
|
+
if (props.touchable && state.moving) {
|
|
289
|
+
touch.move(e);
|
|
290
|
+
if (isCorrectDirection.value) {
|
|
291
|
+
move({
|
|
292
|
+
offset: delTa.value
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
const onTouchEnd = (e) => {
|
|
298
|
+
if (!props.touchable || !state.moving)
|
|
299
|
+
return;
|
|
300
|
+
const speed = delTa.value / (Date.now() - state.touchTime);
|
|
301
|
+
const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(delTa.value) > +(size.value / 2).toFixed(2);
|
|
302
|
+
if (isShouldMove && isCorrectDirection.value) {
|
|
303
|
+
let pace = 0;
|
|
304
|
+
const offset = isVertical.value ? touch.offsetY.value : touch.offsetX.value;
|
|
305
|
+
if (props.loop) {
|
|
306
|
+
pace = offset > 0 ? delTa.value > 0 ? -1 : 1 : 0;
|
|
307
|
+
} else {
|
|
308
|
+
pace = -Math[delTa.value > 0 ? "ceil" : "floor"](delTa.value / size.value);
|
|
309
|
+
}
|
|
310
|
+
move({
|
|
311
|
+
pace,
|
|
312
|
+
isEmit: true
|
|
188
313
|
});
|
|
189
|
-
} else
|
|
190
|
-
|
|
191
|
-
|
|
314
|
+
} else if (delTa.value) {
|
|
315
|
+
move({ pace: 0 });
|
|
316
|
+
}
|
|
317
|
+
state.moving = false;
|
|
318
|
+
getStyle();
|
|
319
|
+
autoplay();
|
|
192
320
|
};
|
|
193
|
-
|
|
194
|
-
props
|
|
195
|
-
size
|
|
196
|
-
relation
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
(
|
|
208
|
-
|
|
209
|
-
|
|
321
|
+
provide("parent", {
|
|
322
|
+
props,
|
|
323
|
+
size,
|
|
324
|
+
relation
|
|
325
|
+
});
|
|
326
|
+
useExpose({
|
|
327
|
+
prev,
|
|
328
|
+
next,
|
|
329
|
+
to
|
|
330
|
+
});
|
|
331
|
+
onDeactivated(() => {
|
|
332
|
+
stopAutoPlay();
|
|
333
|
+
});
|
|
334
|
+
onBeforeUnmount(() => {
|
|
335
|
+
stopAutoPlay();
|
|
336
|
+
});
|
|
337
|
+
watch(
|
|
338
|
+
() => props.initPage,
|
|
339
|
+
(val) => {
|
|
340
|
+
nextTick(() => {
|
|
341
|
+
init(Number(val));
|
|
210
342
|
});
|
|
211
343
|
}
|
|
212
|
-
)
|
|
213
|
-
|
|
344
|
+
);
|
|
345
|
+
watch(
|
|
346
|
+
() => state.children.length,
|
|
214
347
|
() => {
|
|
215
|
-
|
|
216
|
-
|
|
348
|
+
nextTick(() => {
|
|
349
|
+
init();
|
|
217
350
|
});
|
|
218
351
|
}
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
(
|
|
222
|
-
|
|
352
|
+
);
|
|
353
|
+
watch(
|
|
354
|
+
() => props.autoPlay,
|
|
355
|
+
(val) => {
|
|
356
|
+
val > 0 ? autoplay() : stopAutoPlay();
|
|
223
357
|
}
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
358
|
+
);
|
|
359
|
+
return {
|
|
360
|
+
state,
|
|
361
|
+
classes,
|
|
362
|
+
classesInner,
|
|
363
|
+
classesPagination,
|
|
364
|
+
container,
|
|
365
|
+
activePagination,
|
|
366
|
+
onTouchStart,
|
|
367
|
+
onTouchMove,
|
|
368
|
+
onTouchEnd
|
|
234
369
|
};
|
|
235
370
|
}
|
|
236
371
|
});
|
|
237
|
-
function
|
|
238
|
-
return
|
|
372
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
373
|
+
return openBlock(), createElementBlock("view", {
|
|
239
374
|
ref: "container",
|
|
240
|
-
class:
|
|
241
|
-
onTouchstart:
|
|
242
|
-
onTouchmove:
|
|
243
|
-
onTouchend:
|
|
244
|
-
onTouchcancel:
|
|
375
|
+
class: normalizeClass(_ctx.classes),
|
|
376
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
377
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
378
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
379
|
+
onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
245
380
|
}, [
|
|
246
|
-
|
|
247
|
-
class:
|
|
248
|
-
style:
|
|
381
|
+
createElementVNode("view", {
|
|
382
|
+
class: normalizeClass(_ctx.classesInner),
|
|
383
|
+
style: normalizeStyle(_ctx.state.style)
|
|
249
384
|
}, [
|
|
250
|
-
|
|
385
|
+
renderSlot(_ctx.$slots, "default")
|
|
251
386
|
], 6),
|
|
252
|
-
|
|
253
|
-
|
|
387
|
+
renderSlot(_ctx.$slots, "page"),
|
|
388
|
+
_ctx.paginationVisible && !_ctx.$slots.page ? (openBlock(), createElementBlock("view", {
|
|
254
389
|
key: 0,
|
|
255
|
-
class:
|
|
390
|
+
class: normalizeClass(_ctx.classesPagination)
|
|
256
391
|
}, [
|
|
257
|
-
(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
392
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.state.children.length, (item, index) => {
|
|
393
|
+
return openBlock(), createElementBlock("i", {
|
|
394
|
+
style: normalizeStyle({
|
|
395
|
+
backgroundColor: _ctx.activePagination === index ? _ctx.paginationColor : "#ddd"
|
|
396
|
+
}),
|
|
397
|
+
class: normalizeClass({ active: _ctx.activePagination === index }),
|
|
398
|
+
key: index
|
|
399
|
+
}, null, 6);
|
|
400
|
+
}), 128))
|
|
401
|
+
], 2)) : createCommentVNode("", true)
|
|
265
402
|
], 34);
|
|
266
403
|
}
|
|
267
|
-
const
|
|
404
|
+
const Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
268
405
|
export {
|
|
269
|
-
|
|
406
|
+
Swiper as default
|
|
270
407
|
};
|
|
@@ -1,39 +1,55 @@
|
|
|
1
|
-
import { inject
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { _ as
|
|
1
|
+
import { inject, getCurrentInstance, reactive, computed, onUnmounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { u as useExpose } from "./index-79c5dc33.js";
|
|
4
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
5
5
|
import "../locale/lang";
|
|
6
|
-
const { create
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const { create, componentName } = createComponent("swiper-item");
|
|
7
|
+
const _sfc_main = create({
|
|
8
|
+
setup(props, { slots }) {
|
|
9
|
+
const parent = inject("parent");
|
|
10
|
+
parent["relation"](getCurrentInstance());
|
|
11
|
+
const state = reactive({
|
|
11
12
|
offset: 0
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
});
|
|
14
|
+
const classes = computed(() => {
|
|
15
|
+
const prefixCls = componentName;
|
|
16
|
+
return {
|
|
17
|
+
[prefixCls]: true
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const style = computed(() => {
|
|
21
|
+
const style2 = {};
|
|
22
|
+
const direction = parent == null ? void 0 : parent.props.direction;
|
|
23
|
+
if (parent == null ? void 0 : parent.size.value) {
|
|
24
|
+
style2[direction === "horizontal" ? "width" : "height"] = `${parent == null ? void 0 : parent.size.value}px`;
|
|
25
|
+
}
|
|
26
|
+
if (state.offset) {
|
|
27
|
+
style2["transform"] = `translate${direction === "horizontal" ? "X" : "Y"}(${state.offset}px)`;
|
|
28
|
+
}
|
|
29
|
+
return style2;
|
|
30
|
+
});
|
|
31
|
+
const setOffset = (offset) => {
|
|
32
|
+
state.offset = offset;
|
|
19
33
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
onUnmounted(() => {
|
|
35
|
+
parent["relation"](getCurrentInstance(), "unmount");
|
|
36
|
+
});
|
|
37
|
+
useExpose({ setOffset });
|
|
38
|
+
return {
|
|
39
|
+
style,
|
|
40
|
+
classes
|
|
25
41
|
};
|
|
26
42
|
}
|
|
27
43
|
});
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
class:
|
|
31
|
-
style:
|
|
44
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
45
|
+
return openBlock(), createElementBlock("view", {
|
|
46
|
+
class: normalizeClass(_ctx.classes),
|
|
47
|
+
style: normalizeStyle(_ctx.style)
|
|
32
48
|
}, [
|
|
33
|
-
|
|
49
|
+
renderSlot(_ctx.$slots, "default")
|
|
34
50
|
], 6);
|
|
35
51
|
}
|
|
36
|
-
const
|
|
52
|
+
const SwiperItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
37
53
|
export {
|
|
38
|
-
|
|
54
|
+
SwiperItem as default
|
|
39
55
|
};
|