@nutui/nutui 3.1.19-beta.1 → 3.1.19-beta.4

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