@nutui/nutui 4.0.10-beta.1 → 4.0.10

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6550 -8291
  4. package/dist/nutui.umd.js +1 -1
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -437
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +123 -174
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +154 -51
  128. package/dist/styles/themes/jdb.scss +154 -51
  129. package/dist/styles/themes/jddkh.scss +154 -51
  130. package/dist/styles/themes/jdt.scss +154 -51
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,12 +1,11 @@
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";
1
+ import { ref as Q, reactive as Z, computed as s, provide as _, onDeactivated as ee, onBeforeUnmount as te, watch as E, nextTick as Y, openBlock as P, createElementBlock as b, normalizeClass as S, createElementVNode as ne, normalizeStyle as L, renderSlot as j, Fragment as oe, renderList as ae, createCommentVNode as ie } from "vue";
2
+ import { c as le, e as B } from "./component-234624bc.js";
3
+ import { u as re } from "./index-53ec2d4d.js";
4
+ import { u as ue } from "./index-fadb0974.js";
5
+ import { r as k } from "./raf-a74f1a06.js";
6
+ import { _ as se } from "./_plugin-vue_export-helper-dad06003.js";
7
7
  import "../locale/lang";
8
- const { create, componentName } = createComponent("swiper");
9
- const _sfc_main = create({
8
+ const { create: ce, componentName: M } = le("swiper"), fe = ce({
10
9
  props: {
11
10
  width: {
12
11
  type: [Number, String],
@@ -23,7 +22,7 @@ const _sfc_main = create({
23
22
  },
24
23
  paginationVisible: {
25
24
  type: Boolean,
26
- default: false
25
+ default: !1
27
26
  },
28
27
  paginationColor: {
29
28
  type: String,
@@ -31,7 +30,7 @@ const _sfc_main = create({
31
30
  },
32
31
  loop: {
33
32
  type: Boolean,
34
- default: true
33
+ default: !0
35
34
  },
36
35
  duration: {
37
36
  type: [Number, String],
@@ -47,361 +46,225 @@ const _sfc_main = create({
47
46
  },
48
47
  touchable: {
49
48
  type: Boolean,
50
- default: true
49
+ default: !0
51
50
  },
52
51
  isPreventDefault: {
53
52
  type: Boolean,
54
- default: true
53
+ default: !0
55
54
  },
56
55
  isStopPropagation: {
57
56
  type: Boolean,
58
- default: true
57
+ default: !0
59
58
  }
60
59
  },
61
60
  emits: ["change"],
62
- setup(props, { emit, slots }) {
63
- const container = ref();
64
- const state = reactive({
61
+ setup(n, { emit: c, slots: p }) {
62
+ const N = Q(), e = Z({
65
63
  active: 0,
66
64
  num: 0,
67
65
  rect: null,
68
66
  width: 0,
69
67
  height: 0,
70
- moving: false,
68
+ moving: !1,
71
69
  offset: 0,
72
70
  touchTime: 0,
73
71
  autoplayTimer: null,
74
72
  children: [],
75
73
  childrenVNode: [],
76
74
  style: {}
77
- });
78
- const touch = useTouch();
79
- const classes = computed(() => {
80
- const prefixCls = componentName;
75
+ }), f = re(), v = s(() => ({
76
+ [M]: !0
77
+ })), l = s(() => n.direction === "vertical"), q = s(() => {
78
+ const t = M;
81
79
  return {
82
- [prefixCls]: true
80
+ [`${t}-inner`]: !0,
81
+ [`${t}-vertical`]: l.value
83
82
  };
84
- });
85
- const isVertical = computed(() => props.direction === "vertical");
86
- const classesInner = computed(() => {
87
- const prefixCls = componentName;
83
+ }), R = s(() => {
84
+ const t = M;
88
85
  return {
89
- [`${prefixCls}-inner`]: true,
90
- [`${prefixCls}-vertical`]: isVertical.value
86
+ [`${t}-pagination`]: !0,
87
+ [`${t}-pagination-vertical`]: l.value
91
88
  };
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`
89
+ }), h = s(() => l.value ? f.deltaY.value : f.deltaX.value), D = s(() => f.direction.value === n.direction), i = s(() => e.children.length), d = s(() => e[l.value ? "height" : "width"]), A = s(() => i.value * d.value), T = s(() => e.rect ? (l.value ? e.rect.height : e.rect.width) - d.value * i.value : 0), O = s(() => (e.active + i.value) % i.value), $ = () => {
90
+ let t = 0;
91
+ t = e.offset, e.style = {
92
+ transitionDuration: `${e.moving ? 0 : n.duration}ms`,
93
+ transform: `translate${l.value ? "Y" : "X"}(${t}px)`,
94
+ [l.value ? "height" : "width"]: `${d.value * i.value}px`,
95
+ [l.value ? "width" : "height"]: `${l.value ? e.width : e.height}px`
125
96
  };
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
- }
97
+ }, U = (t) => {
98
+ var m;
99
+ let o = [];
100
+ const u = e.childrenVNode.length;
101
+ let r = (m = p == null ? void 0 : p.default) == null ? void 0 : m.call(p);
102
+ if (r = r.filter((a) => a.children && Array.isArray(a.children)), r.forEach((a) => {
103
+ o = o.concat(a.children);
104
+ }), !u)
105
+ e.childrenVNode = o.slice(), t.proxy && e.children.push(t.proxy);
106
+ else if (u > o.length)
107
+ e.children = e.children.filter((a) => t.proxy !== a);
108
+ else if (u < o.length) {
109
+ for (let a = 0; a < u; a++)
110
+ if (o[a].key !== e.childrenVNode[a].key) {
111
+ t.proxy && e.children.splice(a, 0, t.proxy), t.vnode && e.childrenVNode.splice(a, 0, t.vnode);
112
+ break;
149
113
  }
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)
114
+ u !== o.length && (t.proxy && e.children.push(t.proxy), t.vnode && e.childrenVNode.push(t.vnode));
115
+ } else
116
+ e.childrenVNode = o.slice(), t.proxy && e.children.push(t.proxy);
117
+ }, z = (t, o = 0) => {
118
+ let u = t * d.value;
119
+ n.loop || (u = Math.min(u, -T.value));
120
+ let r = o - u;
121
+ return n.loop || (r = B(r, T.value, 0)), r;
122
+ }, W = (t) => {
123
+ const { active: o } = e;
124
+ return t ? n.loop ? B(o + t, -1, i.value) : B(o + t, 0, i.value - 1) : o;
125
+ }, g = ({ pace: t = 0, offset: o = 0, isEmit: u = !1 }) => {
126
+ if (i.value <= 1)
183
127
  return;
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);
128
+ const { active: r } = e, m = W(t), a = z(m, o);
129
+ if (n.loop) {
130
+ if (e.children[0] && a !== T.value) {
131
+ const V = a < T.value;
132
+ e.children[0].setOffset(V ? A.value : 0);
191
133
  }
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);
134
+ if (e.children[i.value - 1] && a !== 0) {
135
+ const V = a > 0;
136
+ e.children[i.value - 1].setOffset(V ? -A.value : 0);
195
137
  }
196
138
  }
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
139
+ e.active = m, e.offset = a, u && r !== e.active && c("change", O.value), $();
140
+ }, C = () => {
141
+ e.moving = !0, e.active <= -1 && g({ pace: i.value }), e.active >= i.value && g({ pace: -i.value });
142
+ }, y = () => {
143
+ e.autoplayTimer && clearTimeout(e.autoplayTimer);
144
+ }, F = (t) => {
145
+ C(), f.reset(), k(() => {
146
+ k(() => {
147
+ e.moving = !1, g({
148
+ pace: t,
149
+ isEmit: !0
227
150
  });
228
151
  });
229
152
  });
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
153
+ }, x = () => {
154
+ F(-1);
155
+ }, I = () => {
156
+ F(1);
157
+ }, G = (t) => {
158
+ C(), f.reset(), k(() => {
159
+ e.moving = !1;
160
+ let o;
161
+ n.loop && i.value === t ? o = e.active === 0 ? 0 : t : o = t % i.value, g({
162
+ pace: o - e.active,
163
+ isEmit: !0
251
164
  });
252
165
  });
253
- };
254
- const autoplay = () => {
255
- if (props.autoPlay <= 0 || childCount.value <= 1)
166
+ }, w = () => {
167
+ n.autoPlay <= 0 || i.value <= 1 || (y(), e.autoplayTimer = setTimeout(() => {
168
+ I(), w();
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)
256
180
  return;
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
181
+ const o = h.value / (Date.now() - e.touchTime);
182
+ if ((Math.abs(o) > 0.3 || Math.abs(h.value) > +(d.value / 2).toFixed(2)) && D.value) {
183
+ let r = 0;
184
+ const m = l.value ? f.offsetY.value : f.offsetX.value;
185
+ n.loop ? r = m > 0 ? h.value > 0 ? -1 : 1 : 0 : r = -Math[h.value > 0 ? "ceil" : "floor"](h.value / d.value), g({
186
+ pace: r,
187
+ isEmit: !0
313
188
  });
314
- } else if (delTa.value) {
315
- move({ pace: 0 });
316
- }
317
- state.moving = false;
318
- getStyle();
319
- autoplay();
189
+ } else
190
+ h.value && g({ pace: 0 });
191
+ e.moving = !1, $(), w();
320
192
  };
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));
193
+ return _("parent", {
194
+ props: n,
195
+ size: d,
196
+ relation: U
197
+ }), ue({
198
+ prev: x,
199
+ next: I,
200
+ to: G
201
+ }), ee(() => {
202
+ y();
203
+ }), te(() => {
204
+ y();
205
+ }), E(
206
+ () => n.initPage,
207
+ (t) => {
208
+ Y(() => {
209
+ X(Number(t));
342
210
  });
343
211
  }
344
- );
345
- watch(
346
- () => state.children.length,
212
+ ), E(
213
+ () => e.children.length,
347
214
  () => {
348
- nextTick(() => {
349
- init();
215
+ Y(() => {
216
+ X();
350
217
  });
351
218
  }
352
- );
353
- watch(
354
- () => props.autoPlay,
355
- (val) => {
356
- val > 0 ? autoplay() : stopAutoPlay();
219
+ ), E(
220
+ () => n.autoPlay,
221
+ (t) => {
222
+ t > 0 ? w() : y();
357
223
  }
358
- );
359
- return {
360
- state,
361
- classes,
362
- classesInner,
363
- classesPagination,
364
- container,
365
- activePagination,
366
- onTouchStart,
367
- onTouchMove,
368
- onTouchEnd
224
+ ), {
225
+ state: e,
226
+ classes: v,
227
+ classesInner: q,
228
+ classesPagination: R,
229
+ container: N,
230
+ activePagination: O,
231
+ onTouchStart: H,
232
+ onTouchMove: J,
233
+ onTouchEnd: K
369
234
  };
370
235
  }
371
236
  });
372
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
373
- return openBlock(), createElementBlock("view", {
237
+ function ve(n, c, p, N, e, f) {
238
+ return P(), b("view", {
374
239
  ref: "container",
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))
240
+ class: S(n.classes),
241
+ onTouchstart: c[0] || (c[0] = (...v) => n.onTouchStart && n.onTouchStart(...v)),
242
+ onTouchmove: c[1] || (c[1] = (...v) => n.onTouchMove && n.onTouchMove(...v)),
243
+ onTouchend: c[2] || (c[2] = (...v) => n.onTouchEnd && n.onTouchEnd(...v)),
244
+ onTouchcancel: c[3] || (c[3] = (...v) => n.onTouchEnd && n.onTouchEnd(...v))
380
245
  }, [
381
- createElementVNode("view", {
382
- class: normalizeClass(_ctx.classesInner),
383
- style: normalizeStyle(_ctx.state.style)
246
+ ne("view", {
247
+ class: S(n.classesInner),
248
+ style: L(n.state.style)
384
249
  }, [
385
- renderSlot(_ctx.$slots, "default")
250
+ j(n.$slots, "default")
386
251
  ], 6),
387
- renderSlot(_ctx.$slots, "page"),
388
- _ctx.paginationVisible && !_ctx.$slots.page ? (openBlock(), createElementBlock("view", {
252
+ j(n.$slots, "page"),
253
+ n.paginationVisible && !n.$slots.page ? (P(), b("view", {
389
254
  key: 0,
390
- class: normalizeClass(_ctx.classesPagination)
255
+ class: S(n.classesPagination)
391
256
  }, [
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)
257
+ (P(!0), b(oe, null, ae(n.state.children.length, (v, l) => (P(), b("i", {
258
+ style: L({
259
+ backgroundColor: n.activePagination === l ? n.paginationColor : "#ddd"
260
+ }),
261
+ class: S({ active: n.activePagination === l }),
262
+ key: l
263
+ }, null, 6))), 128))
264
+ ], 2)) : ie("", !0)
402
265
  ], 34);
403
266
  }
404
- const Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
267
+ const we = /* @__PURE__ */ se(fe, [["render", ve]]);
405
268
  export {
406
- Swiper as default
269
+ we as default
407
270
  };
@@ -1,55 +1,39 @@
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";
1
+ import { inject as p, getCurrentInstance as c, reactive as m, computed as a, onUnmounted as u, openBlock as d, createElementBlock as $, normalizeClass as h, normalizeStyle as z, renderSlot as _ } from "vue";
2
+ import { c as x } from "./component-234624bc.js";
3
+ import { u as y } from "./index-fadb0974.js";
4
+ import { _ as C } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  import "../locale/lang";
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({
6
+ const { create: v, componentName: w } = x("swiper-item"), S = v({
7
+ setup(s, { slots: l }) {
8
+ const e = p("parent");
9
+ e.relation(c());
10
+ const o = m({
12
11
  offset: 0
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;
12
+ }), r = a(() => ({
13
+ [w]: !0
14
+ })), n = a(() => {
15
+ const t = {}, i = e == null ? void 0 : e.props.direction;
16
+ return e != null && e.size.value && (t[i === "horizontal" ? "width" : "height"] = `${e == null ? void 0 : e.size.value}px`), o.offset && (t.transform = `translate${i === "horizontal" ? "X" : "Y"}(${o.offset}px)`), t;
17
+ }), f = (t) => {
18
+ o.offset = t;
33
19
  };
34
- onUnmounted(() => {
35
- parent["relation"](getCurrentInstance(), "unmount");
36
- });
37
- useExpose({ setOffset });
38
- return {
39
- style,
40
- classes
20
+ return u(() => {
21
+ e.relation(c(), "unmount");
22
+ }), y({ setOffset: f }), {
23
+ style: n,
24
+ classes: r
41
25
  };
42
26
  }
43
27
  });
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)
28
+ function g(s, l, e, o, r, n) {
29
+ return d(), $("view", {
30
+ class: h(s.classes),
31
+ style: z(s.style)
48
32
  }, [
49
- renderSlot(_ctx.$slots, "default")
33
+ _(s.$slots, "default")
50
34
  ], 6);
51
35
  }
52
- const SwiperItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
36
+ const N = /* @__PURE__ */ C(S, [["render", g]]);
53
37
  export {
54
- SwiperItem as default
38
+ N as default
55
39
  };