@nutui/nutui 3.2.5-beta.1 → 3.2.6-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 (240) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/nutui.es.js +4214 -4444
  3. package/dist/nutui.umd.js +4213 -4543
  4. package/dist/packages/_es/ActionSheet.js +18 -19
  5. package/dist/packages/_es/Address.js +94 -85
  6. package/dist/packages/_es/AddressList.js +25 -12
  7. package/dist/packages/_es/Animate.js +3 -3
  8. package/dist/packages/_es/Audio.js +9 -2
  9. package/dist/packages/_es/AudioOperate.js +5 -1
  10. package/dist/packages/_es/Avatar.js +10 -10
  11. package/dist/packages/_es/AvatarGroup.js +5 -5
  12. package/dist/packages/_es/BackTop.js +55 -108
  13. package/dist/packages/_es/Badge.js +6 -4
  14. package/dist/packages/_es/Barrage.js +79 -103
  15. package/dist/packages/_es/Button.js +5 -3
  16. package/dist/packages/_es/Calendar.js +36 -23
  17. package/dist/packages/_es/CalendarItem.js +4 -3
  18. package/dist/packages/_es/Card.js +15 -5
  19. package/dist/packages/_es/Cascader.js +12 -11
  20. package/dist/packages/_es/Category.js +13 -12
  21. package/dist/packages/_es/CategoryPane.js +17 -13
  22. package/dist/packages/_es/Cell.js +9 -12
  23. package/dist/packages/_es/CellGroup.js +4 -2
  24. package/dist/packages/_es/Checkbox.js +1 -1
  25. package/dist/packages/_es/CheckboxGroup.js +2 -2
  26. package/dist/packages/_es/CircleProgress.js +98 -82
  27. package/dist/packages/_es/Col.js +1 -1
  28. package/dist/packages/_es/Collapse.js +65 -34
  29. package/dist/packages/_es/CollapseItem.js +93 -60
  30. package/dist/packages/_es/Comment.js +43 -19
  31. package/dist/packages/_es/ConfigProvider.js +1 -1
  32. package/dist/packages/_es/CountDown.js +3 -3
  33. package/dist/packages/_es/CountUp.js +47 -52
  34. package/dist/packages/_es/DatePicker.js +37 -54
  35. package/dist/packages/_es/Dialog.js +9 -88
  36. package/dist/packages/_es/Divider.js +3 -3
  37. package/dist/packages/_es/Drag.js +75 -49
  38. package/dist/packages/_es/Ecard.js +20 -18
  39. package/dist/packages/_es/Elevator.js +101 -76
  40. package/dist/packages/_es/Ellipsis.js +140 -100
  41. package/dist/packages/_es/Empty.js +6 -4
  42. package/dist/packages/_es/FixedNav.js +11 -6
  43. package/dist/packages/_es/Form.js +4 -4
  44. package/dist/packages/_es/FormItem.js +3 -1
  45. package/dist/packages/_es/Grid.js +1 -1
  46. package/dist/packages/_es/GridItem.js +10 -27
  47. package/dist/packages/_es/Icon.js +1 -1
  48. package/dist/packages/_es/Image.js +13 -114
  49. package/dist/packages/_es/ImagePreview.js +154 -400
  50. package/dist/packages/_es/Indicator.js +3 -3
  51. package/dist/packages/_es/InfiniteLoading.js +103 -115
  52. package/dist/packages/_es/Input.js +54 -26
  53. package/dist/packages/_es/InputNumber.js +25 -16
  54. package/dist/packages/_es/Invoice.js +6 -5
  55. package/dist/packages/_es/Layout.js +1 -1
  56. package/dist/packages/_es/List.js +47 -34
  57. package/dist/packages/_es/Menu.js +35 -35
  58. package/dist/packages/_es/MenuItem.js +56 -29
  59. package/dist/packages/_es/Navbar.js +49 -39
  60. package/dist/packages/_es/NoticeBar.js +52 -41
  61. package/dist/packages/_es/Notify.js +37 -166
  62. package/dist/packages/_es/NumberKeyboard.js +15 -20
  63. package/dist/packages/_es/OldPicker.js +130 -116
  64. package/dist/packages/_es/OverLay.js +5 -28
  65. package/dist/packages/_es/Pagination.js +8 -5
  66. package/dist/packages/_es/Picker.js +196 -65
  67. package/dist/packages/_es/Popover.js +201 -881
  68. package/dist/packages/_es/Popup.js +28 -84
  69. package/dist/packages/_es/Price.js +22 -6
  70. package/dist/packages/_es/Progress.js +18 -11
  71. package/dist/packages/_es/PullRefresh.js +4 -2
  72. package/dist/packages/_es/Radio.js +3 -3
  73. package/dist/packages/_es/RadioGroup.js +1 -1
  74. package/dist/packages/_es/Range.js +48 -34
  75. package/dist/packages/_es/Rate.js +15 -14
  76. package/dist/packages/_es/Row.js +1 -1
  77. package/dist/packages/_es/SearchBar.js +39 -36
  78. package/dist/packages/_es/ShortPassword.js +97 -66
  79. package/dist/packages/_es/SideNavBar.js +7 -18
  80. package/dist/packages/_es/SideNavBarItem.js +1 -1
  81. package/dist/packages/_es/Signature.js +113 -80
  82. package/dist/packages/_es/Skeleton.js +12 -11
  83. package/dist/packages/_es/Sku.js +63 -38
  84. package/dist/packages/_es/Step.js +7 -2
  85. package/dist/packages/_es/Steps.js +1 -1
  86. package/dist/packages/_es/Sticky.js +33 -23
  87. package/dist/packages/_es/SubSideNavBar.js +4 -2
  88. package/dist/packages/_es/Swipe.js +41 -26
  89. package/dist/packages/_es/Swiper.js +38 -21
  90. package/dist/packages/_es/SwiperItem.js +2 -2
  91. package/dist/packages/_es/Switch.js +8 -8
  92. package/dist/packages/_es/TabPane.js +1 -1
  93. package/dist/packages/_es/Tabbar.js +40 -9
  94. package/dist/packages/_es/TabbarItem.js +24 -30
  95. package/dist/packages/_es/Table.js +22 -17
  96. package/dist/packages/_es/Tabs.js +49 -16
  97. package/dist/packages/_es/Tag.js +6 -5
  98. package/dist/packages/_es/TextArea.js +114 -49
  99. package/dist/packages/_es/TimeDetail.js +4 -3
  100. package/dist/packages/_es/TimePannel.js +3 -3
  101. package/dist/packages/_es/TimeSelect.js +12 -10
  102. package/dist/packages/_es/Toast.js +53 -164
  103. package/dist/packages/_es/TrendArrow.js +6 -4
  104. package/dist/packages/_es/Uploader.js +141 -140
  105. package/dist/packages/_es/Video.js +72 -5
  106. package/dist/packages/_es/WaterMark.js +22 -14
  107. package/dist/packages/_es/common.js +1 -1
  108. package/dist/packages/_es/component.js +1 -1
  109. package/dist/packages/_es/index.js +44 -6
  110. package/dist/packages/_es/{index5.js → index.taro.js} +167 -154
  111. package/dist/packages/_es/index2.js +8 -31
  112. package/dist/packages/_es/index3.js +64 -7
  113. package/dist/packages/_es/index4.js +424 -62
  114. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  115. package/dist/packages/_es/pxCheck.js +1 -1
  116. package/dist/packages/_es/raf.js +1 -1
  117. package/dist/packages/_es/style.css +21 -3
  118. package/dist/packages/_es/use-lock-scroll.js +23 -0
  119. package/dist/packages/locale/lang/baseLang.js +1 -1
  120. package/dist/packages/locale/lang/en-US.js +1 -1
  121. package/dist/packages/locale/lang/id-ID.js +1 -1
  122. package/dist/packages/locale/lang/index.js +1 -1
  123. package/dist/packages/locale/lang/zh-CN.js +1 -1
  124. package/dist/packages/locale/lang/zh-TW.js +1 -1
  125. package/dist/packages/signature/index.scss +4 -1
  126. package/dist/packages/swiperitem/index.scss +1 -1
  127. package/dist/smartips/attributes.json +4 -0
  128. package/dist/smartips/tags.json +2 -1
  129. package/dist/smartips/web-types.json +10 -1
  130. package/dist/style.css +1 -1
  131. package/dist/styles/themes/default.scss +44 -44
  132. package/dist/styles/themes/jdb.scss +44 -44
  133. package/dist/styles/themes/jddkh.scss +44 -44
  134. package/dist/styles/themes/jdt.scss +44 -44
  135. package/dist/types/__VUE/actionsheet/{index.vue.d.ts → index.taro.vue.d.ts} +9 -9
  136. package/dist/types/__VUE/address/{index.vue.d.ts → index.taro.vue.d.ts} +73 -33
  137. package/dist/types/__VUE/addresslist/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  138. package/dist/types/__VUE/animate/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  139. package/dist/types/__VUE/avatar/{index.vue.d.ts → index.taro.vue.d.ts} +6 -6
  140. package/dist/types/__VUE/avatargroup/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  141. package/dist/types/__VUE/backtop/{index.vue.d.ts → index.taro.vue.d.ts} +15 -37
  142. package/dist/types/__VUE/badge/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  143. package/dist/types/__VUE/barrage/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
  144. package/dist/types/__VUE/button/index.taro.vue.d.ts +116 -0
  145. package/dist/types/__VUE/button/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/calendar/{index.vue.d.ts → index.taro.vue.d.ts} +13 -1
  147. package/dist/types/__VUE/calendaritem/{index.vue.d.ts → index.taro.vue.d.ts} +17 -17
  148. package/dist/types/__VUE/card/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  149. package/dist/types/__VUE/cascader/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  150. package/dist/types/__VUE/category/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  151. package/dist/types/__VUE/categorypane/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  152. package/dist/types/__VUE/cell/{index.vue.d.ts → index.taro.vue.d.ts} +13 -6
  153. package/dist/types/__VUE/checkbox/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  154. package/dist/types/__VUE/circleprogress/{index.vue.d.ts → index.taro.vue.d.ts} +14 -15
  155. package/dist/types/__VUE/collapse/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  156. package/dist/types/__VUE/collapseitem/{index.vue.d.ts → index.taro.vue.d.ts} +2 -10
  157. package/dist/types/__VUE/comment/{index.vue.d.ts → index.taro.vue.d.ts} +1 -2
  158. package/dist/types/__VUE/configprovider/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  159. package/dist/types/__VUE/countdown/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  160. package/dist/types/__VUE/countup/{index.vue.d.ts → index.taro.vue.d.ts} +5 -7
  161. package/dist/types/__VUE/datepicker/{index.vue.d.ts → index.taro.vue.d.ts} +5 -5
  162. package/dist/types/__VUE/dialog/{index.vue.d.ts → index.taro.vue.d.ts} +9 -12
  163. package/dist/types/__VUE/divider/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  164. package/dist/types/__VUE/drag/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
  165. package/dist/types/__VUE/ecard/{index.vue.d.ts → index.taro.vue.d.ts} +3 -3
  166. package/dist/types/__VUE/elevator/{index.vue.d.ts → index.taro.vue.d.ts} +11 -2
  167. package/dist/types/__VUE/ellipsis/{index.vue.d.ts → index.taro.vue.d.ts} +4 -0
  168. package/dist/types/__VUE/empty/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  169. package/dist/types/__VUE/fixednav/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  170. package/dist/types/__VUE/form/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  171. package/dist/types/__VUE/grid/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  172. package/dist/types/__VUE/griditem/{index.vue.d.ts → index.taro.vue.d.ts} +2 -27
  173. package/dist/types/__VUE/icon/index.taro.vue.d.ts +74 -0
  174. package/dist/types/__VUE/image/index.taro.vue.d.ts +33 -0
  175. package/dist/types/__VUE/imagepreview/{index.vue.d.ts → index.taro.vue.d.ts} +40 -42
  176. package/dist/types/__VUE/indicator/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  177. package/dist/types/__VUE/infiniteloading/{index.vue.d.ts → index.taro.vue.d.ts} +15 -8
  178. package/dist/types/__VUE/input/{index.vue.d.ts → index.taro.vue.d.ts} +34 -16
  179. package/dist/types/__VUE/inputnumber/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
  180. package/dist/types/__VUE/invoice/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  181. package/dist/types/__VUE/layout/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  182. package/dist/types/__VUE/list/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
  183. package/dist/types/__VUE/menu/{index.vue.d.ts → index.taro.vue.d.ts} +1 -0
  184. package/dist/types/__VUE/menuitem/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  185. package/dist/types/__VUE/navbar/{index.vue.d.ts → index.taro.vue.d.ts} +1 -2
  186. package/dist/types/__VUE/noticebar/{index.vue.d.ts → index.taro.vue.d.ts} +4 -3
  187. package/dist/types/__VUE/notify/{index.vue.d.ts → index.taro.vue.d.ts} +10 -25
  188. package/dist/types/__VUE/numberkeyboard/{index.vue.d.ts → index.taro.vue.d.ts} +5 -29
  189. package/dist/types/__VUE/oldpicker/{Column.vue.d.ts → ColumnTaro.vue.d.ts} +28 -17
  190. package/dist/types/__VUE/oldpicker/{index.vue.d.ts → index.taro.vue.d.ts} +64 -44
  191. package/dist/types/__VUE/overlay/index.taro.vue.d.ts +85 -0
  192. package/dist/types/__VUE/pagination/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  193. package/dist/types/__VUE/picker/{Column.vue.d.ts → ColumnTaro.vue.d.ts} +16 -4
  194. package/dist/types/__VUE/picker/{index.vue.d.ts → index.taro.vue.d.ts} +53 -28
  195. package/dist/types/__VUE/popover/{index.vue.d.ts → index.taro.vue.d.ts} +15 -13
  196. package/dist/types/__VUE/popup/index.taro.vue.d.ts +1728 -0
  197. package/dist/types/__VUE/popup/index.vue.d.ts +1 -1
  198. package/dist/types/__VUE/price/{index.vue.d.ts → index.taro.vue.d.ts} +1 -0
  199. package/dist/types/__VUE/progress/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  200. package/dist/types/__VUE/radio/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  201. package/dist/types/__VUE/range/{index.vue.d.ts → index.taro.vue.d.ts} +8 -7
  202. package/dist/types/__VUE/rate/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  203. package/dist/types/__VUE/searchbar/{index.vue.d.ts → index.taro.vue.d.ts} +19 -19
  204. package/dist/types/__VUE/shortpassword/{index.vue.d.ts → index.taro.vue.d.ts} +6 -21
  205. package/dist/types/__VUE/sidenavbar/{index.vue.d.ts → index.taro.vue.d.ts} +0 -5
  206. package/dist/types/__VUE/signature/{index.vue.d.ts → index.taro.vue.d.ts} +8 -5
  207. package/dist/types/__VUE/skeleton/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  208. package/dist/types/__VUE/sku/{index.vue.d.ts → index.taro.vue.d.ts} +54 -182
  209. package/dist/types/__VUE/step/index.vue.d.ts +1 -1
  210. package/dist/types/__VUE/steps/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  211. package/dist/types/__VUE/sticky/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  212. package/dist/types/__VUE/swipe/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
  213. package/dist/types/__VUE/swiper/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
  214. package/dist/types/__VUE/swiperitem/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  215. package/dist/types/__VUE/switch/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  216. package/dist/types/__VUE/tabbar/{index.vue.d.ts → index.taro.vue.d.ts} +10 -0
  217. package/dist/types/__VUE/tabbaritem/{index.vue.d.ts → index.taro.vue.d.ts} +9 -9
  218. package/dist/types/__VUE/table/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  219. package/dist/types/__VUE/tabs/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  220. package/dist/types/__VUE/tag/{index.vue.d.ts → index.taro.vue.d.ts} +4 -4
  221. package/dist/types/__VUE/textarea/{index.vue.d.ts → index.taro.vue.d.ts} +5 -3
  222. package/dist/types/__VUE/timedetail/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  223. package/dist/types/__VUE/timepannel/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  224. package/dist/types/__VUE/timeselect/{index.vue.d.ts → index.taro.vue.d.ts} +7 -8
  225. package/dist/types/__VUE/toast/{index.vue.d.ts → index.taro.vue.d.ts} +44 -22
  226. package/dist/types/__VUE/trendarrow/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
  227. package/dist/types/__VUE/uploader/{index.vue.d.ts → index.taro.vue.d.ts} +22 -13
  228. package/dist/types/__VUE/video/index.vue.d.ts +3 -1
  229. package/dist/types/__VUE/watermark/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
  230. package/dist/types/index.d.ts +1 -1
  231. package/dist/types/nutui.d.ts +89 -89
  232. package/package.json +1 -1
  233. package/dist/types/__VUE/dialog/index.d.ts +0 -48
  234. package/dist/types/__VUE/image/index.vue.d.ts +0 -117
  235. package/dist/types/__VUE/image/type.d.ts +0 -6
  236. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +0 -108
  237. package/dist/types/__VUE/imagepreview/index.d.ts +0 -25
  238. package/dist/types/__VUE/notify/index.d.ts +0 -26
  239. package/dist/types/__VUE/tag/type.d.ts +0 -5
  240. package/dist/types/__VUE/toast/index.d.ts +0 -16
@@ -1,12 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.5-beta.1 Tue Oct 25 2022 11:38:42 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
6
+ import { ref, computed, reactive, onMounted, watch, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, createTextVNode, renderSlot, Fragment, renderList, createVNode, withCtx, normalizeStyle } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
+ import Taro from "@tarojs/taro";
9
+ import { u as useExpose } from "./index2.js";
8
10
  import { r as requestAniFrame } from "./raf.js";
9
- import { u as useExpose } from "./index3.js";
10
11
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
11
12
  const Utils = {
12
13
  isLeapYear: function(y) {
@@ -90,6 +91,7 @@ const Utils = {
90
91
  }
91
92
  };
92
93
  const { create, translate } = createComponent("calendar-item");
94
+ const TARO_ENV = Taro.getEnv();
93
95
  const _sfc_main = create({
94
96
  props: {
95
97
  type: {
@@ -138,7 +140,7 @@ const _sfc_main = create({
138
140
  },
139
141
  defaultValue: {
140
142
  type: [String, Array],
141
- default: ""
143
+ default: null
142
144
  },
143
145
  startDate: {
144
146
  type: String,
@@ -152,14 +154,10 @@ const _sfc_main = create({
152
154
  emits: ["choose", "update", "close", "select"],
153
155
  setup(props, { emit, slots }) {
154
156
  const weeks = ref(translate("weekdays"));
155
- const months = ref(null);
156
- const monthsPanel = ref(null);
157
- const weeksPanel = ref(null);
158
- const viewArea = ref(null);
157
+ const scalePx = ref(2);
159
158
  const viewHeight = ref(0);
160
- const compConthsData = computed(() => {
161
- return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
162
- });
159
+ const scrollWithAnimation = ref(false);
160
+ const months = ref(null);
163
161
  const showTopBtn = computed(() => {
164
162
  return slots.btn;
165
163
  });
@@ -171,7 +169,9 @@ const _sfc_main = create({
171
169
  });
172
170
  const state = reactive({
173
171
  yearMonthTitle: "",
174
- defaultRange: [],
172
+ defaultRange: [0, 1],
173
+ compConthsDatas: [],
174
+ containerHeight: "100%",
175
175
  currDate: "",
176
176
  propStartDate: "",
177
177
  propEndDate: "",
@@ -197,6 +197,7 @@ const _sfc_main = create({
197
197
  timer: 0,
198
198
  currentIndex: 0,
199
199
  avgHeight: 0,
200
+ scrollTop: 0,
200
201
  monthsNum: 0
201
202
  });
202
203
  const splitDate = (date) => {
@@ -256,7 +257,7 @@ const _sfc_main = create({
256
257
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
257
258
  if (type == "multiple") {
258
259
  if (state.currDate.length > 0) {
259
- let hasIndex = void 0;
260
+ let hasIndex = "";
260
261
  state.currDate.forEach((item, index) => {
261
262
  if (item == days[3]) {
262
263
  hasIndex = index;
@@ -265,7 +266,7 @@ const _sfc_main = create({
265
266
  if (isFirst) {
266
267
  state.chooseData.push([...days]);
267
268
  } else {
268
- if (hasIndex !== void 0) {
269
+ if (hasIndex !== "") {
269
270
  state.currDate.splice(hasIndex, 1);
270
271
  state.chooseData.splice(hasIndex, 1);
271
272
  } else {
@@ -323,7 +324,7 @@ const _sfc_main = create({
323
324
  month = month == 12 ? 1 : ++month;
324
325
  break;
325
326
  }
326
- return [year + "", Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month)) + ""];
327
+ return [year, Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month))];
327
328
  };
328
329
  const getDaysStatus = (days, type, dateInfo) => {
329
330
  let { year, month } = dateInfo;
@@ -356,13 +357,13 @@ const _sfc_main = create({
356
357
  };
357
358
  const getMonth = (curData, type) => {
358
359
  const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
359
- let preMonth = Number(curData[1]) - 1;
360
- let preYear = Number(curData[0]);
360
+ let preMonth = curData[1] - 1;
361
+ let preYear = curData[0];
361
362
  if (preMonth <= 0) {
362
363
  preMonth = 12;
363
364
  preYear += 1;
364
365
  }
365
- const currMonthDays = Utils.getMonthDays(String(curData[0]), String(curData[1]));
366
+ const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
366
367
  const preCurrMonthDays = Utils.getMonthDays(preYear + "", preMonth + "");
367
368
  const title = {
368
369
  year: curData[0],
@@ -372,18 +373,19 @@ const _sfc_main = create({
372
373
  curData,
373
374
  title: translate("monthTitle", title.year, title.month),
374
375
  monthData: [
375
- ...getPreDaysStatus(
376
- preMonthDays,
377
- "prev",
378
- { month: preMonth + "", year: preYear + "" },
379
- preCurrMonthDays
380
- ),
376
+ ...getPreDaysStatus(preMonthDays, "prev", { month: preMonth, year: preYear }, preCurrMonthDays),
381
377
  ...getDaysStatus(currMonthDays, "curr", title)
382
- ],
383
- cssHeight: 0,
384
- cssScrollHeight: 0
378
+ ]
385
379
  };
386
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
380
+ let titleHeight, itemHeight;
381
+ if (TARO_ENV === Taro.ENV_TYPE.WEB) {
382
+ titleHeight = 46 * scalePx.value + 16 * scalePx.value * 2;
383
+ itemHeight = 128 * scalePx.value;
384
+ } else {
385
+ titleHeight = Math.floor(46 * scalePx.value) + Math.floor(16 * scalePx.value) * 2;
386
+ itemHeight = Math.floor(128 * scalePx.value);
387
+ }
388
+ monthInfo.cssHeight = titleHeight + (monthInfo.monthData.length > 35 ? itemHeight * 6 : itemHeight * 5);
387
389
  let cssScrollHeight = 0;
388
390
  if (state.monthsData.length > 0) {
389
391
  cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
@@ -491,7 +493,7 @@ const _sfc_main = create({
491
493
  state.currentIndex = current;
492
494
  state.yearMonthTitle = state.monthsData[state.currentIndex].title;
493
495
  if (state.defaultData.length > 0) {
494
- if (props.type == "range") {
496
+ if (state.isRange) {
495
497
  chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
496
498
  chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[lastCurrent], true);
497
499
  } else if (props.type == "multiple") {
@@ -511,14 +513,12 @@ const _sfc_main = create({
511
513
  }
512
514
  let lastItem = state.monthsData[state.monthsData.length - 1];
513
515
  let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
514
- requestAniFrame(() => {
515
- if ((months == null ? void 0 : months.value) && (monthsPanel == null ? void 0 : monthsPanel.value) && (viewArea == null ? void 0 : viewArea.value)) {
516
- viewHeight.value = months.value.clientHeight;
517
- monthsPanel.value.style.height = `${containerHeight}px`;
518
- months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
519
- }
520
- });
516
+ state.containerHeight = `${containerHeight}px`;
517
+ state.scrollTop = Math.ceil(state.monthsData[state.currentIndex].cssScrollHeight);
521
518
  state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
519
+ if (months == null ? void 0 : months.value) {
520
+ viewHeight.value = months.value.clientHeight;
521
+ }
522
522
  };
523
523
  const scrollToDate = (date) => {
524
524
  if (Utils.compareDate(date, state.propStartDate)) {
@@ -529,27 +529,16 @@ const _sfc_main = create({
529
529
  let dateArr = splitDate(date);
530
530
  state.monthsData.forEach((item, index) => {
531
531
  if (item.title == translate("monthTitle", dateArr[0], dateArr[1])) {
532
- if (months.value) {
533
- let distance = state.monthsData[index].cssScrollHeight - months.value.scrollTop;
534
- if (props.toDateAnimation) {
535
- let flag = 0;
536
- let interval = setInterval(() => {
537
- flag++;
538
- if (months.value) {
539
- let offset = distance / 10;
540
- months.value.scrollTop = months.value.scrollTop + offset;
541
- }
542
- if (flag >= 10) {
543
- clearInterval(interval);
544
- if (months.value) {
545
- months.value.scrollTop = state.monthsData[index].cssScrollHeight;
546
- }
547
- }
548
- }, 40);
549
- } else {
550
- months.value.scrollTop = state.monthsData[index].cssScrollHeight;
551
- }
552
- }
532
+ state.scrollTop += 1;
533
+ scrollWithAnimation.value = props.toDateAnimation;
534
+ requestAniFrame(() => {
535
+ setTimeout(() => {
536
+ state.scrollTop = state.monthsData[index].cssScrollHeight;
537
+ setTimeout(() => {
538
+ scrollWithAnimation.value = false;
539
+ }, 200);
540
+ }, 10);
541
+ });
553
542
  }
554
543
  });
555
544
  };
@@ -557,16 +546,22 @@ const _sfc_main = create({
557
546
  scrollToDate
558
547
  });
559
548
  const setDefaultRange = (monthsNum, current) => {
549
+ let rangeArr = [];
560
550
  if (monthsNum >= 3) {
561
551
  if (current > 0 && current < monthsNum) {
562
- state.defaultRange = [current - 1, current + 3];
552
+ rangeArr = [current - 1, current + 3];
563
553
  } else if (current == 0) {
564
- state.defaultRange = [current, current + 4];
554
+ rangeArr = [current, current + 4];
565
555
  } else if (current == monthsNum) {
566
- state.defaultRange = [current - 2, current + 2];
556
+ rangeArr = [current - 2, current + 2];
567
557
  }
568
558
  } else {
569
- state.defaultRange = [0, monthsNum + 2];
559
+ rangeArr = [0, monthsNum + 2];
560
+ }
561
+ if (JSON.stringify(state.defaultRange) !== JSON.stringify(rangeArr)) {
562
+ state.defaultRange[0] = rangeArr[0];
563
+ state.defaultRange[1] = rangeArr[1];
564
+ state.compConthsDatas = state.monthsData.slice(rangeArr[0], rangeArr[1]);
570
565
  }
571
566
  let defaultScrollTop = state.monthsData[state.defaultRange[0]].cssScrollHeight;
572
567
  state.translateY = defaultScrollTop;
@@ -589,7 +584,7 @@ const _sfc_main = create({
589
584
  }
590
585
  };
591
586
  const isCurrDay = (dateInfo) => {
592
- const date = `${dateInfo.year}-${dateInfo.month}-${Number(dateInfo.day) < 10 ? "0" + dateInfo.day : dateInfo.day}`;
587
+ const date = `${dateInfo.year}-${dateInfo.month}-${dateInfo.day < 10 ? "0" + dateInfo.day : dateInfo.day}`;
593
588
  return Utils.isEqual(date, Utils.date2Str(new Date()));
594
589
  };
595
590
  const mothsViewScroll = (e) => {
@@ -609,17 +604,6 @@ const _sfc_main = create({
609
604
  if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
610
605
  current -= 1;
611
606
  }
612
- } else {
613
- const viewPosition = Math.round(currentScrollTop + viewHeight.value);
614
- if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
615
- current -= 1;
616
- }
617
- if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
618
- current += 1;
619
- }
620
- if (current >= 1 && currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
621
- current -= 1;
622
- }
623
607
  }
624
608
  if (state.currentIndex !== current) {
625
609
  state.currentIndex = current;
@@ -632,7 +616,21 @@ const _sfc_main = create({
632
616
  state.monthsData.splice(0);
633
617
  initData();
634
618
  };
635
- initData();
619
+ onMounted(() => {
620
+ Taro.getSystemInfo({
621
+ success(res) {
622
+ let scale = 2;
623
+ let screenWidth = res.screenWidth;
624
+ let toFixed = 3;
625
+ if (TARO_ENV === Taro.ENV_TYPE.WEB) {
626
+ toFixed = 5;
627
+ }
628
+ scale = Number((screenWidth / 750).toFixed(toFixed));
629
+ scalePx.value = scale;
630
+ initData();
631
+ }
632
+ });
633
+ });
636
634
  watch(
637
635
  () => props.defaultValue,
638
636
  (val) => {
@@ -645,7 +643,6 @@ const _sfc_main = create({
645
643
  );
646
644
  return {
647
645
  weeks,
648
- compConthsData,
649
646
  showTopBtn,
650
647
  topInfo,
651
648
  bottomInfo,
@@ -657,12 +654,10 @@ const _sfc_main = create({
657
654
  chooseDay,
658
655
  isCurrDay,
659
656
  confirm,
660
- monthsPanel,
661
657
  months,
662
- weeksPanel,
663
- viewArea,
664
658
  ...toRefs(state),
665
659
  ...toRefs(props),
660
+ scrollWithAnimation,
666
661
  translate
667
662
  };
668
663
  }
@@ -679,39 +674,39 @@ const _hoisted_3 = {
679
674
  key: 2,
680
675
  class: "calendar-curr-month"
681
676
  };
682
- const _hoisted_4 = {
683
- class: "calendar-weeks",
684
- ref: "weeksPanel"
685
- };
686
- const _hoisted_5 = {
687
- class: "calendar-months-panel",
688
- ref: "monthsPanel"
689
- };
690
- const _hoisted_6 = { class: "calendar-month-title" };
691
- const _hoisted_7 = { class: "calendar-month-con" };
692
- const _hoisted_8 = ["onClick"];
693
- const _hoisted_9 = { class: "calendar-day" };
694
- const _hoisted_10 = {
677
+ const _hoisted_4 = { class: "calendar-weeks" };
678
+ const _hoisted_5 = { class: "calendar-month-title" };
679
+ const _hoisted_6 = { class: "calendar-month-con" };
680
+ const _hoisted_7 = ["onClick"];
681
+ const _hoisted_8 = { class: "calendar-day" };
682
+ const _hoisted_9 = {
695
683
  key: 0,
696
684
  class: "calendar-curr-tips calendar-curr-tips-top"
697
685
  };
698
- const _hoisted_11 = {
686
+ const _hoisted_10 = {
699
687
  key: 1,
700
688
  class: "calendar-curr-tips calendar-curr-tips-bottom"
701
689
  };
702
- const _hoisted_12 = {
690
+ const _hoisted_11 = {
703
691
  key: 2,
704
692
  class: "calendar-curr-tip-curr"
705
693
  };
706
- const _hoisted_13 = {
707
- key: 4,
694
+ const _hoisted_12 = {
695
+ key: 3,
708
696
  class: "calendar-day-tip"
709
697
  };
710
- const _hoisted_14 = {
698
+ const _hoisted_13 = {
711
699
  key: 0,
712
700
  class: "nut-calendar-footer"
713
701
  };
714
702
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
703
+ const _component_scroll_view = resolveComponent(function() {
704
+ if (process.env.TARO_ENV === "h5") {
705
+ return "taro-scroll-view";
706
+ } else {
707
+ return "scroll-view";
708
+ }
709
+ }());
715
710
  return openBlock(), createElementBlock("view", {
716
711
  class: normalizeClass(["nut-calendar nut-calendar-taro", {
717
712
  "nut-calendar-tile": !_ctx.poppable,
@@ -722,10 +717,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
722
717
  class: normalizeClass(["nut-calendar-header", { "nut-calendar-header-tile": !_ctx.poppable }])
723
718
  }, [
724
719
  _ctx.showTitle ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title || _ctx.translate("title")), 1)) : createCommentVNode("", true),
720
+ createTextVNode(),
725
721
  _ctx.showTopBtn ? (openBlock(), createElementBlock("view", _hoisted_2, [
726
722
  renderSlot(_ctx.$slots, "btn")
727
723
  ])) : createCommentVNode("", true),
724
+ createTextVNode(),
728
725
  _ctx.showSubTitle ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.yearMonthTitle), 1)) : createCommentVNode("", true),
726
+ createTextVNode(),
729
727
  createElementVNode("view", _hoisted_4, [
730
728
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.weeks, (item, index) => {
731
729
  return openBlock(), createElementBlock("view", {
@@ -733,71 +731,86 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
733
731
  key: index
734
732
  }, toDisplayString(item), 1);
735
733
  }), 128))
736
- ], 512)
734
+ ])
737
735
  ], 2),
738
- createElementVNode("view", {
736
+ createTextVNode(),
737
+ createVNode(_component_scroll_view, {
738
+ "scroll-top": _ctx.scrollTop,
739
+ "scroll-y": true,
739
740
  class: "nut-calendar-content",
740
- ref: "months",
741
- onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.mothsViewScroll && _ctx.mothsViewScroll(...args))
742
- }, [
743
- createElementVNode("view", _hoisted_5, [
741
+ onScroll: _ctx.mothsViewScroll,
742
+ "scroll-with-animation": _ctx.scrollWithAnimation,
743
+ ref: "months"
744
+ }, {
745
+ default: withCtx(() => [
744
746
  createElementVNode("view", {
745
- class: "viewArea",
746
- ref: "viewArea",
747
- style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
747
+ class: "calendar-months-panel",
748
+ style: normalizeStyle({ height: _ctx.containerHeight })
748
749
  }, [
749
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsData, (month, index) => {
750
- return openBlock(), createElementBlock("view", {
751
- class: "calendar-month",
752
- key: index
753
- }, [
754
- createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
755
- createElementVNode("view", _hoisted_7, [
756
- createElementVNode("view", {
757
- class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
758
- }, [
759
- (openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
760
- return openBlock(), createElementBlock("view", {
761
- key: i,
762
- class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
763
- onClick: ($event) => _ctx.chooseDay(day, month)
764
- }, [
765
- createElementVNode("view", _hoisted_9, [
766
- renderSlot(_ctx.$slots, "day", {
767
- date: day.type == "curr" ? day : ""
768
- }, () => [
769
- createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
770
- ])
771
- ]),
772
- _ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
773
- renderSlot(_ctx.$slots, "topInfo", {
774
- date: day.type == "curr" ? day : ""
775
- })
776
- ])) : createCommentVNode("", true),
777
- _ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
778
- renderSlot(_ctx.$slots, "bottomInfo", {
779
- date: day.type == "curr" ? day : ""
780
- })
781
- ])) : createCommentVNode("", true),
782
- !_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_12, toDisplayString(_ctx.translate("today")), 1)) : createCommentVNode("", true),
783
- _ctx.isStartTip(day, month) ? (openBlock(), createElementBlock("view", {
784
- key: 3,
785
- class: normalizeClass(["calendar-day-tip", { "calendar-curr-tips-top": _ctx.rangeTip() }])
786
- }, toDisplayString(_ctx.startText || _ctx.translate("start")), 3)) : createCommentVNode("", true),
787
- _ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText || _ctx.translate("end")), 1)) : createCommentVNode("", true)
788
- ], 10, _hoisted_8);
789
- }), 128))
790
- ], 2)
791
- ])
792
- ]);
793
- }), 128))
750
+ createElementVNode("view", {
751
+ class: "viewArea",
752
+ style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
753
+ }, [
754
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsDatas, (month, index) => {
755
+ return openBlock(), createElementBlock("view", {
756
+ class: "calendar-month",
757
+ key: index
758
+ }, [
759
+ createElementVNode("view", _hoisted_5, toDisplayString(month.title), 1),
760
+ createTextVNode(),
761
+ createElementVNode("view", _hoisted_6, [
762
+ createElementVNode("view", {
763
+ class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
764
+ }, [
765
+ (openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
766
+ return openBlock(), createElementBlock("view", {
767
+ key: i,
768
+ class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
769
+ onClick: ($event) => _ctx.chooseDay(day, month)
770
+ }, [
771
+ createElementVNode("view", _hoisted_8, [
772
+ renderSlot(_ctx.$slots, "day", {
773
+ date: day.type == "curr" ? day : ""
774
+ }, () => [
775
+ createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
776
+ ])
777
+ ]),
778
+ createTextVNode(),
779
+ _ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_9, [
780
+ renderSlot(_ctx.$slots, "topInfo", {
781
+ date: day.type == "curr" ? day : ""
782
+ })
783
+ ])) : createCommentVNode("", true),
784
+ createTextVNode(),
785
+ _ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
786
+ renderSlot(_ctx.$slots, "bottomInfo", {
787
+ date: day.type == "curr" ? day : ""
788
+ })
789
+ ])) : createCommentVNode("", true),
790
+ createTextVNode(),
791
+ !_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_11, toDisplayString(_ctx.translate("today")), 1)) : createCommentVNode("", true),
792
+ createTextVNode(),
793
+ createElementVNode("view", {
794
+ class: normalizeClass({ "calendar-curr-tips-top": _ctx.rangeTip(), "calendar-day-tip": true })
795
+ }, toDisplayString(_ctx.isStartTip(day, month) ? _ctx.startText || _ctx.translate("start") : ""), 3),
796
+ createTextVNode(),
797
+ _ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_12, toDisplayString(_ctx.endText || _ctx.translate("end")), 1)) : createCommentVNode("", true)
798
+ ], 10, _hoisted_7);
799
+ }), 128))
800
+ ], 2)
801
+ ])
802
+ ]);
803
+ }), 128))
804
+ ], 4)
794
805
  ], 4)
795
- ], 512)
796
- ], 544),
797
- _ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_14, [
806
+ ]),
807
+ _: 3
808
+ }, 8, ["scroll-top", "onScroll", "scroll-with-animation"]),
809
+ createTextVNode(),
810
+ _ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_13, [
798
811
  createElementVNode("view", {
799
812
  class: "calendar-confirm-btn",
800
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirm && _ctx.confirm(...args))
813
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.confirm && _ctx.confirm(...args))
801
814
  }, toDisplayString(_ctx.confirmText || _ctx.translate("confirm")), 1)
802
815
  ])) : createCommentVNode("", true)
803
816
  ], 2);
@@ -1,36 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.5-beta.1 Tue Oct 25 2022 11:38:42 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { unref } from "vue";
7
- function isWindow(val) {
8
- return val === window;
9
- }
10
- const useRect = (elementRef) => {
11
- const element = unref(elementRef);
12
- if (isWindow(element)) {
13
- const width = element.innerWidth;
14
- const height = element.innerHeight;
15
- return {
16
- top: 0,
17
- left: 0,
18
- right: width,
19
- bottom: height,
20
- width,
21
- height
22
- };
23
- }
24
- if (element && element.getBoundingClientRect) {
25
- return element.getBoundingClientRect();
6
+ import { getCurrentInstance } from "vue";
7
+ function useExpose(apis) {
8
+ const instance = getCurrentInstance();
9
+ if (instance) {
10
+ Object.assign(instance.proxy, apis);
26
11
  }
27
- return {
28
- top: 0,
29
- left: 0,
30
- right: 0,
31
- bottom: 0,
32
- width: 0,
33
- height: 0
34
- };
35
- };
36
- export { useRect as u };
12
+ }
13
+ export { useExpose as u };
@@ -1,13 +1,70 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.5-beta.1 Tue Oct 25 2022 11:38:42 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { getCurrentInstance } from "vue";
7
- function useExpose(apis) {
8
- const instance = getCurrentInstance();
9
- if (instance) {
10
- Object.assign(instance.proxy, apis);
6
+ import { ref } from "vue";
7
+ const MIN_DISTANCE = 10;
8
+ function getDirection(x, y) {
9
+ if (x > y && x > MIN_DISTANCE) {
10
+ return "horizontal";
11
11
  }
12
+ if (y > x && y > MIN_DISTANCE) {
13
+ return "vertical";
14
+ }
15
+ return "";
16
+ }
17
+ function useTouch() {
18
+ const startX = ref(0);
19
+ const startY = ref(0);
20
+ const moveX = ref(0);
21
+ const moveY = ref(0);
22
+ const deltaX = ref(0);
23
+ const deltaY = ref(0);
24
+ const offsetX = ref(0);
25
+ const offsetY = ref(0);
26
+ const direction = ref("");
27
+ const isVertical = () => direction.value === "vertical";
28
+ const isHorizontal = () => direction.value === "horizontal";
29
+ const reset = () => {
30
+ deltaX.value = 0;
31
+ deltaY.value = 0;
32
+ offsetX.value = 0;
33
+ offsetY.value = 0;
34
+ direction.value = "";
35
+ };
36
+ const start = (event) => {
37
+ reset();
38
+ startX.value = event.touches[0].clientX;
39
+ startY.value = event.touches[0].clientY;
40
+ };
41
+ const move = (event) => {
42
+ const touch = event.touches[0];
43
+ deltaX.value = touch.clientX - startX.value;
44
+ deltaY.value = touch.clientY - startY.value;
45
+ moveX.value = touch.clientX;
46
+ moveY.value = touch.clientY;
47
+ offsetX.value = Math.abs(deltaX.value);
48
+ offsetY.value = Math.abs(deltaY.value);
49
+ if (!direction.value) {
50
+ direction.value = getDirection(offsetX.value, offsetY.value);
51
+ }
52
+ };
53
+ return {
54
+ move,
55
+ start,
56
+ reset,
57
+ startX,
58
+ startY,
59
+ moveX,
60
+ moveY,
61
+ deltaX,
62
+ deltaY,
63
+ offsetX,
64
+ offsetY,
65
+ direction,
66
+ isVertical,
67
+ isHorizontal
68
+ };
12
69
  }
13
- export { useExpose as u };
70
+ export { useTouch as u };