@nutui/nutui 3.2.6-beta.1 → 3.2.6-beta.2

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/README.md +18 -4
  2. package/dist/nutui.es.js +4461 -4135
  3. package/dist/nutui.umd.js +4559 -4133
  4. package/dist/packages/_es/ActionSheet.js +19 -18
  5. package/dist/packages/_es/Address.js +85 -94
  6. package/dist/packages/_es/AddressList.js +12 -25
  7. package/dist/packages/_es/Animate.js +3 -3
  8. package/dist/packages/_es/Audio.js +2 -9
  9. package/dist/packages/_es/AudioOperate.js +1 -5
  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 +108 -55
  13. package/dist/packages/_es/Badge.js +12 -10
  14. package/dist/packages/_es/Barrage.js +103 -79
  15. package/dist/packages/_es/Button.js +3 -5
  16. package/dist/packages/_es/Calendar.js +23 -36
  17. package/dist/packages/_es/CalendarItem.js +3 -4
  18. package/dist/packages/_es/Card.js +5 -15
  19. package/dist/packages/_es/Cascader.js +11 -12
  20. package/dist/packages/_es/Category.js +12 -13
  21. package/dist/packages/_es/CategoryPane.js +13 -17
  22. package/dist/packages/_es/Cell.js +12 -9
  23. package/dist/packages/_es/CellGroup.js +2 -4
  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 +82 -98
  27. package/dist/packages/_es/Col.js +1 -1
  28. package/dist/packages/_es/Collapse.js +34 -65
  29. package/dist/packages/_es/CollapseItem.js +60 -93
  30. package/dist/packages/_es/Comment.js +19 -43
  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 +52 -47
  34. package/dist/packages/_es/DatePicker.js +54 -37
  35. package/dist/packages/_es/Dialog.js +88 -9
  36. package/dist/packages/_es/Divider.js +3 -3
  37. package/dist/packages/_es/Drag.js +49 -75
  38. package/dist/packages/_es/Ecard.js +18 -20
  39. package/dist/packages/_es/Elevator.js +76 -101
  40. package/dist/packages/_es/Ellipsis.js +100 -140
  41. package/dist/packages/_es/Empty.js +4 -6
  42. package/dist/packages/_es/FixedNav.js +6 -11
  43. package/dist/packages/_es/Form.js +4 -4
  44. package/dist/packages/_es/FormItem.js +1 -3
  45. package/dist/packages/_es/Grid.js +1 -1
  46. package/dist/packages/_es/GridItem.js +27 -10
  47. package/dist/packages/_es/Icon.js +1 -1
  48. package/dist/packages/_es/Image.js +114 -13
  49. package/dist/packages/_es/ImagePreview.js +411 -149
  50. package/dist/packages/_es/Indicator.js +3 -3
  51. package/dist/packages/_es/InfiniteLoading.js +115 -103
  52. package/dist/packages/_es/Input.js +32 -56
  53. package/dist/packages/_es/InputNumber.js +16 -25
  54. package/dist/packages/_es/Invoice.js +5 -6
  55. package/dist/packages/_es/Layout.js +1 -1
  56. package/dist/packages/_es/List.js +34 -47
  57. package/dist/packages/_es/Menu.js +35 -35
  58. package/dist/packages/_es/MenuItem.js +29 -56
  59. package/dist/packages/_es/Navbar.js +39 -49
  60. package/dist/packages/_es/NoticeBar.js +45 -54
  61. package/dist/packages/_es/Notify.js +162 -44
  62. package/dist/packages/_es/NumberKeyboard.js +20 -15
  63. package/dist/packages/_es/OldPicker.js +116 -130
  64. package/dist/packages/_es/OverLay.js +28 -5
  65. package/dist/packages/_es/Pagination.js +5 -8
  66. package/dist/packages/_es/Picker.js +74 -198
  67. package/dist/packages/_es/Popover.js +881 -201
  68. package/dist/packages/_es/Popup.js +84 -28
  69. package/dist/packages/_es/Price.js +6 -22
  70. package/dist/packages/_es/Progress.js +11 -18
  71. package/dist/packages/_es/PullRefresh.js +2 -4
  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 +34 -48
  75. package/dist/packages/_es/Rate.js +14 -15
  76. package/dist/packages/_es/Row.js +1 -1
  77. package/dist/packages/_es/SearchBar.js +36 -39
  78. package/dist/packages/_es/ShortPassword.js +66 -97
  79. package/dist/packages/_es/SideNavBar.js +18 -7
  80. package/dist/packages/_es/SideNavBarItem.js +1 -1
  81. package/dist/packages/_es/Signature.js +80 -113
  82. package/dist/packages/_es/Skeleton.js +11 -12
  83. package/dist/packages/_es/Sku.js +38 -63
  84. package/dist/packages/_es/Step.js +2 -7
  85. package/dist/packages/_es/Steps.js +1 -1
  86. package/dist/packages/_es/Sticky.js +23 -33
  87. package/dist/packages/_es/SubSideNavBar.js +2 -4
  88. package/dist/packages/_es/Swipe.js +26 -41
  89. package/dist/packages/_es/Swiper.js +21 -38
  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 +13 -15
  94. package/dist/packages/_es/TabbarItem.js +30 -24
  95. package/dist/packages/_es/Table.js +17 -22
  96. package/dist/packages/_es/Tabs.js +16 -49
  97. package/dist/packages/_es/Tag.js +5 -6
  98. package/dist/packages/_es/TextArea.js +49 -114
  99. package/dist/packages/_es/TimeDetail.js +3 -4
  100. package/dist/packages/_es/TimePannel.js +3 -3
  101. package/dist/packages/_es/TimeSelect.js +10 -12
  102. package/dist/packages/_es/Toast.js +164 -53
  103. package/dist/packages/_es/TrendArrow.js +4 -6
  104. package/dist/packages/_es/Uploader.js +140 -141
  105. package/dist/packages/_es/Video.js +18 -39
  106. package/dist/packages/_es/WaterMark.js +14 -22
  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 +6 -44
  110. package/dist/packages/_es/index2.js +31 -8
  111. package/dist/packages/_es/index3.js +7 -64
  112. package/dist/packages/_es/index4.js +62 -424
  113. package/dist/packages/_es/{index.taro.js → index5.js} +154 -167
  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 +3 -21
  118. package/dist/packages/checkbox/index.scss +1 -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/menuitem/index.scss +12 -3
  126. package/dist/smartips/attributes.json +5 -1
  127. package/dist/smartips/tags.json +1 -0
  128. package/dist/smartips/web-types.json +11 -2
  129. package/dist/style.css +1 -1
  130. package/dist/styles/themes/default.scss +48 -48
  131. package/dist/styles/themes/jdb.scss +48 -48
  132. package/dist/styles/themes/jddkh.scss +48 -48
  133. package/dist/styles/themes/jdt.scss +48 -48
  134. package/dist/types/__VUE/actionsheet/{index.taro.vue.d.ts → index.vue.d.ts} +9 -9
  135. package/dist/types/__VUE/address/{index.taro.vue.d.ts → index.vue.d.ts} +33 -73
  136. package/dist/types/__VUE/addresslist/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  137. package/dist/types/__VUE/animate/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  138. package/dist/types/__VUE/avatar/{index.taro.vue.d.ts → index.vue.d.ts} +6 -6
  139. package/dist/types/__VUE/avatargroup/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  140. package/dist/types/__VUE/backtop/{index.taro.vue.d.ts → index.vue.d.ts} +37 -15
  141. package/dist/types/__VUE/badge/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  142. package/dist/types/__VUE/barrage/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
  143. package/dist/types/__VUE/button/index.vue.d.ts +1 -1
  144. package/dist/types/__VUE/calendar/{index.taro.vue.d.ts → index.vue.d.ts} +1 -13
  145. package/dist/types/__VUE/calendaritem/{index.taro.vue.d.ts → index.vue.d.ts} +17 -17
  146. package/dist/types/__VUE/card/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  147. package/dist/types/__VUE/cascader/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  148. package/dist/types/__VUE/category/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  149. package/dist/types/__VUE/categorypane/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  150. package/dist/types/__VUE/cell/{index.taro.vue.d.ts → index.vue.d.ts} +5 -12
  151. package/dist/types/__VUE/checkbox/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  152. package/dist/types/__VUE/circleprogress/{index.taro.vue.d.ts → index.vue.d.ts} +15 -14
  153. package/dist/types/__VUE/collapse/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  154. package/dist/types/__VUE/collapseitem/{index.taro.vue.d.ts → index.vue.d.ts} +10 -2
  155. package/dist/types/__VUE/comment/{index.taro.vue.d.ts → index.vue.d.ts} +2 -1
  156. package/dist/types/__VUE/configprovider/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  157. package/dist/types/__VUE/countdown/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  158. package/dist/types/__VUE/countup/{index.taro.vue.d.ts → index.vue.d.ts} +7 -5
  159. package/dist/types/__VUE/datepicker/{index.taro.vue.d.ts → index.vue.d.ts} +5 -5
  160. package/dist/types/__VUE/dialog/index.d.ts +48 -0
  161. package/dist/types/__VUE/dialog/{index.taro.vue.d.ts → index.vue.d.ts} +12 -9
  162. package/dist/types/__VUE/divider/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  163. package/dist/types/__VUE/drag/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
  164. package/dist/types/__VUE/ecard/{index.taro.vue.d.ts → index.vue.d.ts} +3 -3
  165. package/dist/types/__VUE/elevator/{index.taro.vue.d.ts → index.vue.d.ts} +2 -11
  166. package/dist/types/__VUE/ellipsis/{index.taro.vue.d.ts → index.vue.d.ts} +0 -4
  167. package/dist/types/__VUE/empty/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  168. package/dist/types/__VUE/fixednav/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  169. package/dist/types/__VUE/form/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  170. package/dist/types/__VUE/grid/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
  171. package/dist/types/__VUE/griditem/{index.taro.vue.d.ts → index.vue.d.ts} +27 -2
  172. package/dist/types/__VUE/image/index.vue.d.ts +117 -0
  173. package/dist/types/__VUE/image/type.d.ts +6 -0
  174. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +109 -0
  175. package/dist/types/__VUE/imagepreview/index.d.ts +25 -0
  176. package/dist/types/__VUE/imagepreview/{index.taro.vue.d.ts → index.vue.d.ts} +44 -33
  177. package/dist/types/__VUE/indicator/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  178. package/dist/types/__VUE/infiniteloading/{index.taro.vue.d.ts → index.vue.d.ts} +12 -19
  179. package/dist/types/__VUE/input/{index.taro.vue.d.ts → index.vue.d.ts} +16 -34
  180. package/dist/types/__VUE/inputnumber/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
  181. package/dist/types/__VUE/invoice/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  182. package/dist/types/__VUE/layout/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  183. package/dist/types/__VUE/list/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
  184. package/dist/types/__VUE/menu/{index.taro.vue.d.ts → index.vue.d.ts} +0 -1
  185. package/dist/types/__VUE/menuitem/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  186. package/dist/types/__VUE/navbar/{index.taro.vue.d.ts → index.vue.d.ts} +3 -2
  187. package/dist/types/__VUE/noticebar/{index.taro.vue.d.ts → index.vue.d.ts} +4 -4
  188. package/dist/types/__VUE/notify/index.d.ts +26 -0
  189. package/dist/types/__VUE/notify/{index.taro.vue.d.ts → index.vue.d.ts} +18 -5
  190. package/dist/types/__VUE/numberkeyboard/{index.taro.vue.d.ts → index.vue.d.ts} +29 -5
  191. package/dist/types/__VUE/oldpicker/{ColumnTaro.vue.d.ts → Column.vue.d.ts} +17 -28
  192. package/dist/types/__VUE/oldpicker/{index.taro.vue.d.ts → index.vue.d.ts} +44 -64
  193. package/dist/types/__VUE/pagination/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  194. package/dist/types/__VUE/picker/{ColumnTaro.vue.d.ts → Column.vue.d.ts} +4 -16
  195. package/dist/types/__VUE/picker/{index.taro.vue.d.ts → index.vue.d.ts} +28 -53
  196. package/dist/types/__VUE/popover/{index.taro.vue.d.ts → index.vue.d.ts} +13 -15
  197. package/dist/types/__VUE/popup/index.vue.d.ts +1 -1
  198. package/dist/types/__VUE/price/{index.taro.vue.d.ts → index.vue.d.ts} +0 -1
  199. package/dist/types/__VUE/progress/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  200. package/dist/types/__VUE/radio/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  201. package/dist/types/__VUE/range/{index.taro.vue.d.ts → index.vue.d.ts} +7 -8
  202. package/dist/types/__VUE/rate/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  203. package/dist/types/__VUE/searchbar/{index.taro.vue.d.ts → index.vue.d.ts} +19 -19
  204. package/dist/types/__VUE/shortpassword/{index.taro.vue.d.ts → index.vue.d.ts} +21 -6
  205. package/dist/types/__VUE/sidenavbar/{index.taro.vue.d.ts → index.vue.d.ts} +5 -0
  206. package/dist/types/__VUE/signature/{index.taro.vue.d.ts → index.vue.d.ts} +5 -8
  207. package/dist/types/__VUE/skeleton/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  208. package/dist/types/__VUE/sku/index.vue.d.ts +310 -0
  209. package/dist/types/__VUE/step/index.vue.d.ts +1 -1
  210. package/dist/types/__VUE/steps/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  211. package/dist/types/__VUE/sticky/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  212. package/dist/types/__VUE/swipe/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
  213. package/dist/types/__VUE/swiper/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
  214. package/dist/types/__VUE/swiperitem/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  215. package/dist/types/__VUE/switch/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  216. package/dist/types/__VUE/tabbar/{index.taro.vue.d.ts → index.vue.d.ts} +2 -1
  217. package/dist/types/__VUE/tabbaritem/{index.taro.vue.d.ts → index.vue.d.ts} +9 -9
  218. package/dist/types/__VUE/table/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  219. package/dist/types/__VUE/tabs/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  220. package/dist/types/__VUE/tag/{index.taro.vue.d.ts → index.vue.d.ts} +4 -4
  221. package/dist/types/__VUE/tag/type.d.ts +5 -0
  222. package/dist/types/__VUE/textarea/{index.taro.vue.d.ts → index.vue.d.ts} +3 -5
  223. package/dist/types/__VUE/timedetail/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  224. package/dist/types/__VUE/timepannel/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  225. package/dist/types/__VUE/timeselect/{index.taro.vue.d.ts → index.vue.d.ts} +8 -7
  226. package/dist/types/__VUE/toast/index.d.ts +16 -0
  227. package/dist/types/__VUE/toast/{index.taro.vue.d.ts → index.vue.d.ts} +22 -44
  228. package/dist/types/__VUE/trendarrow/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
  229. package/dist/types/__VUE/uploader/{index.taro.vue.d.ts → index.vue.d.ts} +13 -22
  230. package/dist/types/__VUE/watermark/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
  231. package/dist/types/index.d.ts +1 -1
  232. package/dist/types/nutui.d.ts +89 -89
  233. package/package.json +3 -2
  234. package/dist/packages/_es/use-lock-scroll.js +0 -23
  235. package/dist/types/__VUE/button/index.taro.vue.d.ts +0 -116
  236. package/dist/types/__VUE/icon/index.taro.vue.d.ts +0 -74
  237. package/dist/types/__VUE/image/index.taro.vue.d.ts +0 -33
  238. package/dist/types/__VUE/overlay/index.taro.vue.d.ts +0 -85
  239. package/dist/types/__VUE/popup/index.taro.vue.d.ts +0 -1728
  240. package/dist/types/__VUE/sku/index.taro.vue.d.ts +0 -182
@@ -1,432 +1,70 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.6-beta.2 Fri Nov 04 2022 17:24:29 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed, watch, onDeactivated, onBeforeUnmount, onMounted, onActivated, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow, h, ref, reactive, onBeforeMount, toRefs, resolveComponent, Teleport, createCommentVNode, createTextVNode, createVNode, createElementBlock, mergeProps } from "vue";
7
- import { u as useLockScroll } from "./use-lock-scroll.js";
8
- import { c as createComponent } from "./component.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
- import { p as pxCheck } from "./pxCheck.js";
11
- const { componentName: componentName$2, create: create$2 } = createComponent("overlay");
12
- const overlayProps = {
13
- visible: {
14
- type: Boolean,
15
- default: false
16
- },
17
- zIndex: {
18
- type: [Number, String],
19
- default: 2e3
20
- },
21
- duration: {
22
- type: [Number, String],
23
- default: 0.3
24
- },
25
- overlayClass: {
26
- type: String,
27
- default: ""
28
- },
29
- lockScroll: {
30
- type: Boolean,
31
- default: false
32
- },
33
- overlayStyle: {
34
- type: Object
35
- },
36
- closeOnClickOverlay: {
37
- type: Boolean,
38
- default: true
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";
39
11
  }
40
- };
41
- const _sfc_main$2 = create$2({
42
- props: overlayProps,
43
- emits: ["click", "update:visible"],
44
- setup(props, { emit }) {
45
- const classes = computed(() => {
46
- const prefixCls = componentName$2;
47
- return {
48
- [prefixCls]: true,
49
- [props.overlayClass]: true
50
- };
51
- });
52
- watch(
53
- () => props.visible,
54
- (value) => {
55
- value ? lock() : unlock();
56
- }
57
- );
58
- const lock = () => {
59
- if (props.lockScroll && props.visible) {
60
- document.body.classList.add("nut-overflow-hidden");
61
- }
62
- };
63
- const unlock = () => {
64
- document.body.classList.remove("nut-overflow-hidden");
65
- };
66
- onDeactivated(unlock);
67
- onBeforeUnmount(unlock);
68
- onMounted(lock);
69
- onActivated(lock);
70
- const style = computed(() => {
71
- return {
72
- animationDuration: `${props.duration}s`,
73
- zIndex: props.zIndex,
74
- ...props.overlayStyle
75
- };
76
- });
77
- const touchmove = (e) => {
78
- if (props.lockScroll)
79
- e.preventDefault();
80
- };
81
- const onClick = (e) => {
82
- emit("click", e);
83
- if (props.closeOnClickOverlay) {
84
- emit("update:visible", false);
85
- }
86
- };
87
- return { classes, style, touchmove, onClick };
12
+ if (y > x && y > MIN_DISTANCE) {
13
+ return "vertical";
88
14
  }
89
- });
90
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
91
- return openBlock(), createBlock(Transition, { name: "overlay-fade" }, {
92
- default: withCtx(() => [
93
- withDirectives(createElementVNode("view", {
94
- class: normalizeClass(_ctx.classes),
95
- onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.touchmove && _ctx.touchmove(...args), ["stop"])),
96
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
97
- style: normalizeStyle(_ctx.style)
98
- }, [
99
- renderSlot(_ctx.$slots, "default")
100
- ], 38), [
101
- [vShow, _ctx.visible]
102
- ])
103
- ]),
104
- _: 3
105
- });
15
+ return "";
106
16
  }
107
- var overlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
108
- const { componentName: componentName$1, create: create$1 } = createComponent("icon");
109
- const _sfc_main$1 = create$1({
110
- props: {
111
- name: { type: String, default: "" },
112
- size: { type: [String, Number], default: "" },
113
- classPrefix: { type: String, default: "nut-icon" },
114
- fontClassName: { type: String, default: "nutui-iconfont" },
115
- color: { type: String, default: "" },
116
- tag: { type: String, default: "i" }
117
- },
118
- emits: ["click"],
119
- setup(props, { emit, slots }) {
120
- const handleClick = (event) => {
121
- emit("click", event);
122
- };
123
- const isImage = () => {
124
- return props.name ? props.name.indexOf("/") !== -1 : false;
125
- };
126
- return () => {
127
- var _a;
128
- const _isImage = isImage();
129
- return h(
130
- _isImage ? "img" : props.tag,
131
- {
132
- class: _isImage ? `${componentName$1}__img` : `${props.fontClassName} ${componentName$1} ${props.classPrefix}-${props.name}`,
133
- style: {
134
- color: props.color,
135
- fontSize: pxCheck(props.size),
136
- width: pxCheck(props.size),
137
- height: pxCheck(props.size)
138
- },
139
- onClick: handleClick,
140
- src: _isImage ? props.name : ""
141
- },
142
- (_a = slots.default) == null ? void 0 : _a.call(slots)
143
- );
144
- };
145
- }
146
- });
147
- const { componentName, create } = createComponent("popup");
148
- let _zIndex = 2e3;
149
- const popupProps = {
150
- ...overlayProps,
151
- position: {
152
- type: String,
153
- default: "center"
154
- },
155
- transition: String,
156
- style: {
157
- type: Object
158
- },
159
- popClass: {
160
- type: String,
161
- default: ""
162
- },
163
- closeable: {
164
- type: Boolean,
165
- default: false
166
- },
167
- closeIconPosition: {
168
- type: String,
169
- default: "top-right"
170
- },
171
- closeIcon: {
172
- type: String,
173
- default: "close"
174
- },
175
- destroyOnClose: {
176
- type: Boolean,
177
- default: true
178
- },
179
- teleport: {
180
- type: [String, Element],
181
- default: "body"
182
- },
183
- overlay: {
184
- type: Boolean,
185
- default: true
186
- },
187
- round: {
188
- type: Boolean,
189
- default: false
190
- },
191
- isWrapTeleport: {
192
- type: Boolean,
193
- default: true
194
- },
195
- safeAreaInsetBottom: {
196
- type: Boolean,
197
- default: false
198
- }
199
- };
200
- const _sfc_main = create({
201
- components: {
202
- [overlay.name]: overlay,
203
- [_sfc_main$1.name]: _sfc_main$1
204
- },
205
- props: {
206
- ...popupProps
207
- },
208
- emits: ["click", "click-close-icon", "open", "close", "opend", "closed", "update:visible", "click-overlay"],
209
- setup(props, { emit }) {
210
- const popupRef = ref();
211
- const state = reactive({
212
- zIndex: props.zIndex,
213
- showSlot: true,
214
- transitionName: `popup-fade-${props.position}`,
215
- overLayCount: 1,
216
- keepAlive: false,
217
- closed: props.closeable
218
- });
219
- const [lockScroll, unlockScroll] = useLockScroll(() => props.lockScroll);
220
- const classes = computed(() => {
221
- const prefixCls = componentName;
222
- return {
223
- [prefixCls]: true,
224
- ["round"]: props.round,
225
- [`popup-${props.position}`]: true,
226
- [`popup-${props.position}--safebottom`]: props.position === "bottom" && props.safeAreaInsetBottom,
227
- [props.popClass]: true
228
- };
229
- });
230
- const popStyle = computed(() => {
231
- return {
232
- zIndex: state.zIndex,
233
- animationDuration: props.duration ? `${props.duration}s` : "initial",
234
- ...props.style
235
- };
236
- });
237
- const open = () => {
238
- if (props.zIndex != 2e3) {
239
- _zIndex = Number(props.zIndex);
240
- }
241
- emit("update:visible", true);
242
- lockScroll();
243
- state.zIndex = ++_zIndex;
244
- if (props.destroyOnClose) {
245
- state.showSlot = true;
246
- }
247
- emit("open");
248
- };
249
- const close = () => {
250
- unlockScroll();
251
- emit("update:visible", false);
252
- emit("close");
253
- if (props.destroyOnClose) {
254
- setTimeout(() => {
255
- state.showSlot = false;
256
- }, +props.duration * 1e3);
257
- }
258
- };
259
- const onClick = (e) => {
260
- emit("click", e);
261
- };
262
- const onClickCloseIcon = (e) => {
263
- emit("click-close-icon", e);
264
- close();
265
- };
266
- const onClickOverlay = (e) => {
267
- if (props.closeOnClickOverlay) {
268
- emit("click-overlay", e);
269
- close();
270
- }
271
- };
272
- const onOpened = (e) => {
273
- emit("opend", e);
274
- };
275
- const onClosed = (e) => {
276
- emit("closed", e);
277
- };
278
- onMounted(() => {
279
- props.transition ? state.transitionName = props.transition : state.transitionName = `popup-slide-${props.position}`;
280
- props.visible && open();
281
- });
282
- onBeforeUnmount(() => {
283
- props.visible && close();
284
- });
285
- onBeforeMount(() => {
286
- if (props.visible) {
287
- unlockScroll();
288
- }
289
- });
290
- onActivated(() => {
291
- if (state.keepAlive) {
292
- emit("update:visible", true);
293
- state.keepAlive = false;
294
- }
295
- });
296
- onDeactivated(() => {
297
- if (props.visible) {
298
- close();
299
- state.keepAlive = true;
300
- }
301
- });
302
- watch(
303
- () => props.visible,
304
- (value) => {
305
- if (value) {
306
- open();
307
- } else {
308
- close();
309
- }
310
- }
311
- );
312
- watch(
313
- () => props.position,
314
- (value) => {
315
- value === "center" ? state.transitionName = "popup-fade" : state.transitionName = `popup-slide-${value}`;
316
- }
317
- );
318
- watch(
319
- () => props.closeable,
320
- (value) => {
321
- state.closed = value;
322
- }
323
- );
324
- return {
325
- ...toRefs(state),
326
- popStyle,
327
- classes,
328
- onClick,
329
- onClickCloseIcon,
330
- onClickOverlay,
331
- onOpened,
332
- onClosed,
333
- popupRef
334
- };
335
- }
336
- });
337
- const _hoisted_1 = { key: 1 };
338
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
339
- const _component_nut_overlay = resolveComponent("nut-overlay");
340
- const _component_nut_icon = resolveComponent("nut-icon");
341
- return _ctx.isWrapTeleport ? (openBlock(), createBlock(Teleport, {
342
- key: 0,
343
- to: _ctx.teleport
344
- }, [
345
- _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
346
- key: 0,
347
- visible: _ctx.visible,
348
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
349
- class: normalizeClass(_ctx.overlayClass),
350
- style: normalizeStyle(_ctx.overlayStyle),
351
- "z-index": _ctx.zIndex,
352
- "lock-scroll": _ctx.lockScroll,
353
- duration: _ctx.duration,
354
- onClick: _ctx.onClickOverlay
355
- }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
356
- createTextVNode(),
357
- createVNode(Transition, {
358
- name: _ctx.transitionName,
359
- onAfterEnter: _ctx.onOpened,
360
- onAfterLeave: _ctx.onClosed
361
- }, {
362
- default: withCtx(() => [
363
- withDirectives(createElementVNode("view", {
364
- class: normalizeClass(_ctx.classes),
365
- style: normalizeStyle(_ctx.popStyle),
366
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
367
- ref: "popupRef"
368
- }, [
369
- _ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
370
- createTextVNode(),
371
- _ctx.closed ? (openBlock(), createElementBlock("view", {
372
- key: 1,
373
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
374
- class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
375
- }, [
376
- createVNode(_component_nut_icon, mergeProps(_ctx.$attrs, {
377
- name: _ctx.closeIcon,
378
- size: "12px"
379
- }), null, 16, ["name"])
380
- ], 2)) : createCommentVNode("", true)
381
- ], 6), [
382
- [vShow, _ctx.visible]
383
- ])
384
- ]),
385
- _: 3
386
- }, 8, ["name", "onAfterEnter", "onAfterLeave"])
387
- ], 8, ["to"])) : (openBlock(), createElementBlock("view", _hoisted_1, [
388
- _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
389
- key: 0,
390
- visible: _ctx.visible,
391
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
392
- class: normalizeClass(_ctx.overlayClass),
393
- style: normalizeStyle(_ctx.overlayStyle),
394
- "z-index": _ctx.zIndex,
395
- "lock-scroll": _ctx.lockScroll,
396
- duration: _ctx.duration,
397
- onClick: _ctx.onClickOverlay
398
- }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
399
- createTextVNode(),
400
- createVNode(Transition, {
401
- name: _ctx.transitionName,
402
- onAfterEnter: _ctx.onOpened,
403
- onAfterLeave: _ctx.onClosed
404
- }, {
405
- default: withCtx(() => [
406
- withDirectives(createElementVNode("view", {
407
- class: normalizeClass(_ctx.classes),
408
- style: normalizeStyle(_ctx.popStyle),
409
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onClick && _ctx.onClick(...args))
410
- }, [
411
- _ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
412
- createTextVNode(),
413
- _ctx.closed ? (openBlock(), createElementBlock("view", {
414
- key: 1,
415
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
416
- class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
417
- }, [
418
- createVNode(_component_nut_icon, {
419
- name: _ctx.closeIcon,
420
- size: "12px"
421
- }, null, 8, ["name"])
422
- ], 2)) : createCommentVNode("", true)
423
- ], 6), [
424
- [vShow, _ctx.visible]
425
- ])
426
- ]),
427
- _: 3
428
- }, 8, ["name", "onAfterEnter", "onAfterLeave"])
429
- ]));
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
+ };
430
69
  }
431
- var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
432
- export { Popup as P, _sfc_main$1 as _, popupProps as p };
70
+ export { useTouch as u };