@nutui/nutui 4.0.0 → 4.0.1-2.beta-1

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 (285) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +34 -65
  3. package/dist/nutui.es.js +10 -17
  4. package/dist/nutui.js +16202 -0
  5. package/dist/nutui.umd.js +1 -7
  6. package/dist/packages/_es/ActionSheet.js +79 -94
  7. package/dist/packages/_es/Address.js +260 -345
  8. package/dist/packages/_es/AddressList.js +269 -354
  9. package/dist/packages/_es/Animate.js +46 -38
  10. package/dist/packages/_es/Audio.js +128 -180
  11. package/dist/packages/_es/AudioOperate.js +60 -52
  12. package/dist/packages/_es/Avatar.js +67 -75
  13. package/dist/packages/_es/AvatarGroup.js +23 -31
  14. package/dist/packages/_es/Backtop.js +59 -99
  15. package/dist/packages/_es/Badge.js +39 -46
  16. package/dist/packages/_es/Barrage.js +68 -145
  17. package/dist/packages/_es/Button.js +47 -66
  18. package/dist/packages/_es/Calendar.js +135 -152
  19. package/dist/packages/_es/CalendarItem.js +6 -6
  20. package/dist/packages/_es/Card.js +42 -56
  21. package/dist/packages/_es/Cascader.js +323 -433
  22. package/dist/packages/_es/Category.js +29 -39
  23. package/dist/packages/_es/CategoryPane.js +57 -83
  24. package/dist/packages/_es/Cell.js +56 -71
  25. package/dist/packages/_es/CellGroup.js +19 -27
  26. package/dist/packages/_es/Checkbox.js +109 -138
  27. package/dist/packages/_es/CheckboxGroup.js +38 -61
  28. package/dist/packages/_es/CircleProgress.js +67 -96
  29. package/dist/packages/_es/Col.js +23 -31
  30. package/dist/packages/_es/Collapse.js +37 -67
  31. package/dist/packages/_es/CollapseItem.js +91 -184
  32. package/dist/packages/_es/Comment.js +207 -279
  33. package/dist/packages/_es/ConfigProvider.js +38 -56
  34. package/dist/packages/_es/Countdown.js +100 -194
  35. package/dist/packages/_es/Countup.js +232 -428
  36. package/dist/packages/_es/DatePicker.js +169 -245
  37. package/dist/packages/_es/Dialog.js +163 -188
  38. package/dist/packages/_es/Divider.js +42 -40
  39. package/dist/packages/_es/Drag.js +70 -153
  40. package/dist/packages/_es/Ecard.js +64 -104
  41. package/dist/packages/_es/Elevator.js +144 -201
  42. package/dist/packages/_es/Ellipsis.js +95 -159
  43. package/dist/packages/_es/Empty.js +23 -39
  44. package/dist/packages/_es/FixedNav.js +93 -116
  45. package/dist/packages/_es/Form.js +108 -164
  46. package/dist/packages/_es/FormItem.js +48 -61
  47. package/dist/packages/_es/Grid.js +5 -6
  48. package/dist/packages/_es/GridItem.js +58 -84
  49. package/dist/packages/_es/Image.js +98 -88
  50. package/dist/packages/_es/ImagePreview.js +262 -392
  51. package/dist/packages/_es/Indicator.js +30 -34
  52. package/dist/packages/_es/InfiniteLoading.js +83 -117
  53. package/dist/packages/_es/Input.js +176 -223
  54. package/dist/packages/_es/InputNumber.js +81 -117
  55. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  56. package/dist/packages/_es/Invoice.js +105 -113
  57. package/dist/packages/_es/Layout.js +3 -4
  58. package/dist/packages/_es/List.js +147 -89
  59. package/dist/packages/_es/Menu.js +96 -152
  60. package/dist/packages/_es/MenuItem.js +117 -153
  61. package/dist/packages/_es/Navbar.js +103 -119
  62. package/dist/packages/_es/Noticebar.js +207 -273
  63. package/dist/packages/_es/Notify.js +110 -147
  64. package/dist/packages/_es/NumberKeyboard.js +127 -202
  65. package/dist/packages/_es/Overlay.js +53 -66
  66. package/dist/packages/_es/Pagination.js +70 -100
  67. package/dist/packages/_es/Picker.js +276 -425
  68. package/dist/packages/_es/Popover.js +122 -225
  69. package/dist/packages/_es/Popup.js +4 -4
  70. package/dist/packages/_es/Price.js +47 -80
  71. package/dist/packages/_es/Progress.js +63 -79
  72. package/dist/packages/_es/PullRefresh.js +96 -157
  73. package/dist/packages/_es/Radio.js +4 -4
  74. package/dist/packages/_es/RadioGroup.js +3 -3
  75. package/dist/packages/_es/Range.js +205 -329
  76. package/dist/packages/_es/Rate.js +93 -122
  77. package/dist/packages/_es/Row.js +21 -27
  78. package/dist/packages/_es/Searchbar.js +130 -160
  79. package/dist/packages/_es/ShortPassword.js +69 -93
  80. package/dist/packages/_es/SideNavbar.js +49 -59
  81. package/dist/packages/_es/SideNavbarItem.js +22 -32
  82. package/dist/packages/_es/Signature.js +83 -128
  83. package/dist/packages/_es/Skeleton.js +110 -130
  84. package/dist/packages/_es/Sku.js +251 -326
  85. package/dist/packages/_es/Step.js +60 -69
  86. package/dist/packages/_es/Steps.js +26 -31
  87. package/dist/packages/_es/Sticky.js +4 -4
  88. package/dist/packages/_es/SubSideNavbar.js +52 -56
  89. package/dist/packages/_es/Swipe.js +84 -137
  90. package/dist/packages/_es/Swiper.js +175 -310
  91. package/dist/packages/_es/SwiperItem.js +28 -44
  92. package/dist/packages/_es/Switch.js +55 -67
  93. package/dist/packages/_es/TabPane.js +32 -20
  94. package/dist/packages/_es/Tabbar.js +41 -52
  95. package/dist/packages/_es/TabbarItem.js +61 -81
  96. package/dist/packages/_es/Table.js +110 -148
  97. package/dist/packages/_es/Tabs.js +284 -205
  98. package/dist/packages/_es/Tag.js +44 -61
  99. package/dist/packages/_es/Textarea.js +80 -124
  100. package/dist/packages/_es/TimeDetail.js +49 -57
  101. package/dist/packages/_es/TimePannel.js +35 -31
  102. package/dist/packages/_es/TimeSelect.js +47 -68
  103. package/dist/packages/_es/Toast.js +150 -203
  104. package/dist/packages/_es/Tour.js +139 -175
  105. package/dist/packages/_es/TrendArrow.js +57 -58
  106. package/dist/packages/_es/Uploader.js +235 -359
  107. package/dist/packages/_es/Video.js +191 -298
  108. package/dist/packages/_es/Watermark.js +84 -98
  109. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  110. package/dist/packages/_es/common-d218746f.js +116 -0
  111. package/dist/packages/_es/component-234624bc.js +89 -0
  112. package/dist/packages/_es/index-14dfadc4.js +561 -0
  113. package/dist/packages/_es/index-192a3ef6.js +29 -0
  114. package/dist/packages/_es/index-360c5092.js +210 -0
  115. package/dist/packages/_es/index-496e6e05.js +24 -0
  116. package/dist/packages/_es/index-50eed3d9.js +7 -0
  117. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  118. package/dist/packages/_es/index-fadb0974.js +8 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  121. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  122. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  123. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  124. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  125. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  126. package/dist/packages/actionsheet/index.scss +2 -0
  127. package/dist/packages/actionsheet/style.mjs +0 -2
  128. package/dist/packages/address/index.scss +5 -2
  129. package/dist/packages/address/style.mjs +0 -3
  130. package/dist/packages/addresslist/index.scss +3 -0
  131. package/dist/packages/addresslist/style.mjs +0 -2
  132. package/dist/packages/audio/index.scss +2 -0
  133. package/dist/packages/audio/style.mjs +0 -1
  134. package/dist/packages/audiooperate/index.scss +2 -0
  135. package/dist/packages/audiooperate/style.mjs +0 -1
  136. package/dist/packages/badge/index.scss +3 -0
  137. package/dist/packages/button/index.scss +1 -1
  138. package/dist/packages/calendar/index.scss +3 -0
  139. package/dist/packages/calendar/style.mjs +0 -3
  140. package/dist/packages/card/index.scss +3 -0
  141. package/dist/packages/card/style.mjs +0 -2
  142. package/dist/packages/cascader/index.scss +4 -0
  143. package/dist/packages/cascader/style.mjs +0 -5
  144. package/dist/packages/cellgroup/index.scss +1 -1
  145. package/dist/packages/checkbox/index.scss +41 -0
  146. package/dist/packages/col/index.scss +2 -2
  147. package/dist/packages/comment/index.scss +2 -0
  148. package/dist/packages/comment/style.mjs +0 -1
  149. package/dist/packages/datepicker/index.scss +1 -2
  150. package/dist/packages/datepicker/style.mjs +0 -3
  151. package/dist/packages/dialog/index.scss +11 -0
  152. package/dist/packages/dialog/style.mjs +0 -3
  153. package/dist/packages/ecard/index.scss +2 -0
  154. package/dist/packages/ecard/style.mjs +0 -1
  155. package/dist/packages/fixednav/index.scss +2 -0
  156. package/dist/packages/fixednav/style.mjs +0 -1
  157. package/dist/packages/form/index.scss +1 -2
  158. package/dist/packages/form/style.mjs +0 -1
  159. package/dist/packages/formitem/index.scss +3 -0
  160. package/dist/packages/formitem/style.mjs +0 -1
  161. package/dist/packages/imagepreview/index.scss +5 -5
  162. package/dist/packages/imagepreview/style.mjs +0 -5
  163. package/dist/packages/input/index.scss +13 -13
  164. package/dist/packages/invoice/index.scss +6 -0
  165. package/dist/packages/invoice/style.mjs +0 -7
  166. package/dist/packages/list/index.scss +8 -8
  167. package/dist/packages/menuitem/index.scss +9 -10
  168. package/dist/packages/menuitem/style.mjs +0 -2
  169. package/dist/packages/navbar/index.scss +0 -1
  170. package/dist/packages/noticebar/index.scss +12 -2
  171. package/dist/packages/notify/index.scss +2 -0
  172. package/dist/packages/notify/style.mjs +0 -2
  173. package/dist/packages/numberkeyboard/index.scss +2 -0
  174. package/dist/packages/numberkeyboard/style.mjs +0 -2
  175. package/dist/packages/picker/index.scss +4 -9
  176. package/dist/packages/picker/style.mjs +0 -2
  177. package/dist/packages/popover/index.scss +2 -0
  178. package/dist/packages/popover/style.mjs +0 -2
  179. package/dist/packages/popup/index.scss +2 -0
  180. package/dist/packages/popup/style.mjs +0 -1
  181. package/dist/packages/price/index.scss +5 -10
  182. package/dist/packages/rate/index.scss +6 -9
  183. package/dist/packages/searchbar/index.scss +4 -0
  184. package/dist/packages/shortpassword/index.scss +18 -0
  185. package/dist/packages/shortpassword/style.mjs +0 -2
  186. package/dist/packages/signature/index.scss +2 -0
  187. package/dist/packages/signature/style.mjs +0 -1
  188. package/dist/packages/skeleton/index.scss +2 -0
  189. package/dist/packages/skeleton/style.mjs +0 -1
  190. package/dist/packages/sku/index.scss +4 -0
  191. package/dist/packages/sku/style.mjs +0 -4
  192. package/dist/packages/tabbaritem/index.scss +2 -0
  193. package/dist/packages/tabbaritem/style.mjs +0 -1
  194. package/dist/packages/tabs/index.scss +36 -2
  195. package/dist/packages/tabs/style.mjs +0 -1
  196. package/dist/packages/textarea/index.scss +2 -0
  197. package/dist/packages/timeselect/index.scss +2 -0
  198. package/dist/packages/timeselect/style.mjs +0 -2
  199. package/dist/packages/tour/index.scss +2 -0
  200. package/dist/packages/tour/style.mjs +0 -3
  201. package/dist/packages/uploader/index.scss +10 -2
  202. package/dist/packages/uploader/style.mjs +0 -2
  203. package/dist/resolver/index.d.ts +6 -0
  204. package/dist/resolver/index.js +1 -0
  205. package/dist/resolver/index.mjs +24 -0
  206. package/dist/resolver/package.json +20 -0
  207. package/dist/smartips/web-types.json +114 -15
  208. package/dist/style.css +1 -1
  209. package/dist/styles/themes/default.scss +155 -52
  210. package/dist/styles/themes/jdb.scss +155 -52
  211. package/dist/styles/themes/jddkh.scss +155 -52
  212. package/dist/styles/themes/jdt.scss +155 -52
  213. package/dist/styles/variables-jdb.scss +9 -1
  214. package/dist/styles/variables-jddkh.scss +9 -1
  215. package/dist/styles/variables-jdt.scss +9 -1
  216. package/dist/styles/variables.scss +8 -0
  217. package/dist/types/__VUE/address/index.vue.d.ts +2 -1
  218. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +1 -1
  219. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -1
  220. package/dist/types/__VUE/addresslist/index.vue.d.ts +1 -1
  221. package/dist/types/__VUE/animate/index.vue.d.ts +6 -0
  222. package/dist/types/__VUE/audiooperate/index.vue.d.ts +4 -4
  223. package/dist/types/__VUE/badge/index.vue.d.ts +9 -0
  224. package/dist/types/__VUE/button/type.d.ts +1 -0
  225. package/dist/types/__VUE/calendaritem/type.d.ts +1 -0
  226. package/dist/types/__VUE/collapse/index.vue.d.ts +31 -5
  227. package/dist/types/__VUE/collapseitem/index.vue.d.ts +117 -11
  228. package/dist/types/__VUE/configprovider/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/datepicker/index.vue.d.ts +1 -1
  230. package/dist/types/__VUE/dialog/index.d.ts +1 -0
  231. package/dist/types/__VUE/dialog/index.vue.d.ts +1 -0
  232. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  233. package/dist/types/__VUE/image/index.vue.d.ts +14 -3
  234. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +9 -0
  235. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  236. package/dist/types/__VUE/input/index.vue.d.ts +27 -2
  237. package/dist/types/__VUE/list/index.vue.d.ts +42 -13
  238. package/dist/types/__VUE/list/type.d.ts +13 -0
  239. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  240. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  241. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  242. package/dist/types/__VUE/noticebar/index.vue.d.ts +5 -2
  243. package/dist/types/__VUE/picker/common.d.ts +2 -0
  244. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  245. package/dist/types/__VUE/price/index.vue.d.ts +9 -0
  246. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  247. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  248. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  249. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  250. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  251. package/dist/types/__VUE/switch/index.vue.d.ts +1 -0
  252. package/dist/types/__VUE/table/common.d.ts +55 -2
  253. package/dist/types/__VUE/tabpane/index.vue.d.ts +1 -4
  254. package/dist/types/__VUE/tabs/hooks.d.ts +12 -0
  255. package/dist/types/__VUE/tabs/index.vue.d.ts +35 -5
  256. package/dist/types/__VUE/tabs/types.d.ts +12 -0
  257. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  258. package/dist/types/__VUE/toast/index.vue.d.ts +11 -4
  259. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  260. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  261. package/dist/types/index.d.ts +1 -2
  262. package/dist/types/resolver/index.d.ts +6 -0
  263. package/dist/types/utils/date.d.ts +4 -0
  264. package/dist/types/utils/useTaroRect/index.d.ts +1 -1
  265. package/dist/types/utils/util.d.ts +1 -1
  266. package/package.json +13 -6
  267. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  268. package/dist/packages/_es/common-b9a5e726.js +0 -145
  269. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  270. package/dist/packages/_es/index-29892cda.js +0 -33
  271. package/dist/packages/_es/index-2ae3ae87.js +0 -846
  272. package/dist/packages/_es/index-43c34ac6.js +0 -30
  273. package/dist/packages/_es/index-54d03fc1.js +0 -8
  274. package/dist/packages/_es/index-79c5dc33.js +0 -10
  275. package/dist/packages/_es/index-7a7385e4.js +0 -67
  276. package/dist/packages/_es/index-991c279f.js +0 -244
  277. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  278. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  279. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  280. package/dist/packages/_es/interceptor-956b24fc.js +0 -29
  281. package/dist/packages/_es/mountComponent-1ece4110.js +0 -39
  282. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  283. package/dist/packages/_es/raf-729dad54.js +0 -25
  284. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
  285. /package/dist/types/utils/{interceptor.d.ts → Interceptor.d.ts} +0 -0
@@ -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,359 +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
- autoplayTimer: 0,
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
- clearTimeout(state.autoplayTimer);
215
- };
216
- const jump = (pace) => {
217
- resettPosition();
218
- touch.reset();
219
- requestAniFrame(() => {
220
- requestAniFrame(() => {
221
- state.moving = false;
222
- move({
223
- pace,
224
- 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
225
150
  });
226
151
  });
227
152
  });
228
- };
229
- const prev = () => {
230
- jump(-1);
231
- };
232
- const next = () => {
233
- jump(1);
234
- };
235
- const to = (index) => {
236
- resettPosition();
237
- touch.reset();
238
- requestAniFrame(() => {
239
- state.moving = false;
240
- let targetIndex;
241
- if (props.loop && childCount.value === index) {
242
- targetIndex = state.active === 0 ? 0 : index;
243
- } else {
244
- targetIndex = index % childCount.value;
245
- }
246
- move({
247
- pace: targetIndex - state.active,
248
- 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
249
164
  });
250
165
  });
251
- };
252
- const autoplay = () => {
253
- if (props.autoPlay <= 0 || childCount.value <= 1)
254
- return;
255
- stopAutoPlay();
256
- state.autoplayTimer = setTimeout(() => {
257
- next();
258
- autoplay();
259
- }, Number(props.autoPlay));
260
- };
261
- const init = (active = +props.initPage) => {
262
- stopAutoPlay();
263
- state.rect = container.value.getBoundingClientRect();
264
- active = Math.min(childCount.value - 1, active);
265
- state.width = props.width ? +props.width : state.rect.width;
266
- state.height = props.height ? +props.height : state.rect.height;
267
- state.active = active;
268
- state.offset = getOffset(state.active);
269
- state.moving = true;
270
- getStyle();
271
- autoplay();
272
- };
273
- const onTouchStart = (e) => {
274
- if (props.isPreventDefault)
275
- e.preventDefault();
276
- if (props.isStopPropagation)
277
- e.stopPropagation();
278
- if (!props.touchable)
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)
279
180
  return;
280
- touch.start(e);
281
- state.touchTime = Date.now();
282
- stopAutoPlay();
283
- resettPosition();
284
- };
285
- const onTouchMove = (e) => {
286
- if (props.touchable && state.moving) {
287
- touch.move(e);
288
- if (isCorrectDirection.value) {
289
- move({
290
- offset: delTa.value
291
- });
292
- }
293
- }
294
- };
295
- const onTouchEnd = (e) => {
296
- if (!props.touchable || !state.moving)
297
- return;
298
- const speed = delTa.value / (Date.now() - state.touchTime);
299
- const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(delTa.value) > +(size.value / 2).toFixed(2);
300
- if (isShouldMove && isCorrectDirection.value) {
301
- let pace = 0;
302
- const offset = isVertical.value ? touch.offsetY.value : touch.offsetX.value;
303
- if (props.loop) {
304
- pace = offset > 0 ? delTa.value > 0 ? -1 : 1 : 0;
305
- } else {
306
- pace = -Math[delTa.value > 0 ? "ceil" : "floor"](delTa.value / size.value);
307
- }
308
- move({
309
- pace,
310
- 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
311
188
  });
312
- } else if (delTa.value) {
313
- move({ pace: 0 });
314
- }
315
- state.moving = false;
316
- getStyle();
317
- autoplay();
189
+ } else
190
+ h.value && g({ pace: 0 });
191
+ e.moving = !1, $(), w();
318
192
  };
319
- provide("parent", {
320
- props,
321
- size,
322
- relation
323
- });
324
- useExpose({
325
- prev,
326
- next,
327
- to
328
- });
329
- onDeactivated(() => {
330
- stopAutoPlay();
331
- });
332
- onBeforeUnmount(() => {
333
- stopAutoPlay();
334
- });
335
- watch(
336
- () => props.initPage,
337
- (val) => {
338
- nextTick(() => {
339
- 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));
340
210
  });
341
211
  }
342
- );
343
- watch(
344
- () => state.children.length,
212
+ ), E(
213
+ () => e.children.length,
345
214
  () => {
346
- nextTick(() => {
347
- init();
215
+ Y(() => {
216
+ X();
348
217
  });
349
218
  }
350
- );
351
- watch(
352
- () => props.autoPlay,
353
- (val) => {
354
- val > 0 ? autoplay() : stopAutoPlay();
219
+ ), E(
220
+ () => n.autoPlay,
221
+ (t) => {
222
+ t > 0 ? w() : y();
355
223
  }
356
- );
357
- return {
358
- state,
359
- classes,
360
- classesInner,
361
- classesPagination,
362
- container,
363
- activePagination,
364
- onTouchStart,
365
- onTouchMove,
366
- 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
367
234
  };
368
235
  }
369
236
  });
370
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
371
- return openBlock(), createElementBlock("view", {
237
+ function ve(n, c, p, N, e, f) {
238
+ return P(), b("view", {
372
239
  ref: "container",
373
- class: normalizeClass(_ctx.classes),
374
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
375
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
376
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
377
- 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))
378
245
  }, [
379
- createElementVNode("view", {
380
- class: normalizeClass(_ctx.classesInner),
381
- style: normalizeStyle(_ctx.state.style)
246
+ ne("view", {
247
+ class: S(n.classesInner),
248
+ style: L(n.state.style)
382
249
  }, [
383
- renderSlot(_ctx.$slots, "default")
250
+ j(n.$slots, "default")
384
251
  ], 6),
385
- renderSlot(_ctx.$slots, "page"),
386
- _ctx.paginationVisible && !_ctx.$slots.page ? (openBlock(), createElementBlock("view", {
252
+ j(n.$slots, "page"),
253
+ n.paginationVisible && !n.$slots.page ? (P(), b("view", {
387
254
  key: 0,
388
- class: normalizeClass(_ctx.classesPagination)
255
+ class: S(n.classesPagination)
389
256
  }, [
390
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.state.children.length, (item, index) => {
391
- return openBlock(), createElementBlock("i", {
392
- style: normalizeStyle({
393
- backgroundColor: _ctx.activePagination === index ? _ctx.paginationColor : "#ddd"
394
- }),
395
- class: normalizeClass({ active: _ctx.activePagination === index }),
396
- key: index
397
- }, null, 6);
398
- }), 128))
399
- ], 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)
400
265
  ], 34);
401
266
  }
402
- const Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
267
+ const we = /* @__PURE__ */ se(fe, [["render", ve]]);
403
268
  export {
404
- Swiper as default
269
+ we as default
405
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
  };