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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +34 -65
  3. package/dist/nutui.es.js +10 -17
  4. package/dist/nutui.js +16202 -0
  5. package/dist/nutui.umd.js +1 -7
  6. package/dist/packages/_es/ActionSheet.js +79 -94
  7. package/dist/packages/_es/Address.js +260 -345
  8. package/dist/packages/_es/AddressList.js +269 -354
  9. package/dist/packages/_es/Animate.js +46 -38
  10. package/dist/packages/_es/Audio.js +128 -180
  11. package/dist/packages/_es/AudioOperate.js +60 -52
  12. package/dist/packages/_es/Avatar.js +67 -75
  13. package/dist/packages/_es/AvatarGroup.js +23 -31
  14. package/dist/packages/_es/Backtop.js +59 -99
  15. package/dist/packages/_es/Badge.js +39 -46
  16. package/dist/packages/_es/Barrage.js +68 -145
  17. package/dist/packages/_es/Button.js +47 -66
  18. package/dist/packages/_es/Calendar.js +135 -152
  19. package/dist/packages/_es/CalendarItem.js +6 -6
  20. package/dist/packages/_es/Card.js +42 -56
  21. package/dist/packages/_es/Cascader.js +323 -433
  22. package/dist/packages/_es/Category.js +29 -39
  23. package/dist/packages/_es/CategoryPane.js +57 -83
  24. package/dist/packages/_es/Cell.js +56 -71
  25. package/dist/packages/_es/CellGroup.js +19 -27
  26. package/dist/packages/_es/Checkbox.js +109 -138
  27. package/dist/packages/_es/CheckboxGroup.js +38 -61
  28. package/dist/packages/_es/CircleProgress.js +67 -96
  29. package/dist/packages/_es/Col.js +23 -31
  30. package/dist/packages/_es/Collapse.js +37 -67
  31. package/dist/packages/_es/CollapseItem.js +91 -184
  32. package/dist/packages/_es/Comment.js +207 -279
  33. package/dist/packages/_es/ConfigProvider.js +38 -56
  34. package/dist/packages/_es/Countdown.js +100 -194
  35. package/dist/packages/_es/Countup.js +232 -428
  36. package/dist/packages/_es/DatePicker.js +169 -245
  37. package/dist/packages/_es/Dialog.js +163 -188
  38. package/dist/packages/_es/Divider.js +42 -40
  39. package/dist/packages/_es/Drag.js +70 -153
  40. package/dist/packages/_es/Ecard.js +64 -104
  41. package/dist/packages/_es/Elevator.js +144 -201
  42. package/dist/packages/_es/Ellipsis.js +95 -159
  43. package/dist/packages/_es/Empty.js +23 -39
  44. package/dist/packages/_es/FixedNav.js +93 -116
  45. package/dist/packages/_es/Form.js +108 -164
  46. package/dist/packages/_es/FormItem.js +48 -61
  47. package/dist/packages/_es/Grid.js +5 -6
  48. package/dist/packages/_es/GridItem.js +58 -84
  49. package/dist/packages/_es/Image.js +98 -88
  50. package/dist/packages/_es/ImagePreview.js +262 -392
  51. package/dist/packages/_es/Indicator.js +30 -34
  52. package/dist/packages/_es/InfiniteLoading.js +83 -117
  53. package/dist/packages/_es/Input.js +176 -223
  54. package/dist/packages/_es/InputNumber.js +81 -117
  55. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  56. package/dist/packages/_es/Invoice.js +105 -113
  57. package/dist/packages/_es/Layout.js +3 -4
  58. package/dist/packages/_es/List.js +147 -89
  59. package/dist/packages/_es/Menu.js +96 -152
  60. package/dist/packages/_es/MenuItem.js +117 -153
  61. package/dist/packages/_es/Navbar.js +103 -119
  62. package/dist/packages/_es/Noticebar.js +207 -273
  63. package/dist/packages/_es/Notify.js +110 -147
  64. package/dist/packages/_es/NumberKeyboard.js +127 -202
  65. package/dist/packages/_es/Overlay.js +53 -66
  66. package/dist/packages/_es/Pagination.js +70 -100
  67. package/dist/packages/_es/Picker.js +276 -425
  68. package/dist/packages/_es/Popover.js +122 -225
  69. package/dist/packages/_es/Popup.js +4 -4
  70. package/dist/packages/_es/Price.js +47 -80
  71. package/dist/packages/_es/Progress.js +63 -79
  72. package/dist/packages/_es/PullRefresh.js +96 -157
  73. package/dist/packages/_es/Radio.js +4 -4
  74. package/dist/packages/_es/RadioGroup.js +3 -3
  75. package/dist/packages/_es/Range.js +205 -329
  76. package/dist/packages/_es/Rate.js +93 -122
  77. package/dist/packages/_es/Row.js +21 -27
  78. package/dist/packages/_es/Searchbar.js +130 -160
  79. package/dist/packages/_es/ShortPassword.js +69 -93
  80. package/dist/packages/_es/SideNavbar.js +49 -59
  81. package/dist/packages/_es/SideNavbarItem.js +22 -32
  82. package/dist/packages/_es/Signature.js +83 -128
  83. package/dist/packages/_es/Skeleton.js +110 -130
  84. package/dist/packages/_es/Sku.js +251 -326
  85. package/dist/packages/_es/Step.js +60 -69
  86. package/dist/packages/_es/Steps.js +26 -31
  87. package/dist/packages/_es/Sticky.js +4 -4
  88. package/dist/packages/_es/SubSideNavbar.js +52 -56
  89. package/dist/packages/_es/Swipe.js +84 -137
  90. package/dist/packages/_es/Swiper.js +175 -310
  91. package/dist/packages/_es/SwiperItem.js +28 -44
  92. package/dist/packages/_es/Switch.js +55 -67
  93. package/dist/packages/_es/TabPane.js +32 -20
  94. package/dist/packages/_es/Tabbar.js +41 -52
  95. package/dist/packages/_es/TabbarItem.js +61 -81
  96. package/dist/packages/_es/Table.js +110 -148
  97. package/dist/packages/_es/Tabs.js +284 -205
  98. package/dist/packages/_es/Tag.js +44 -61
  99. package/dist/packages/_es/Textarea.js +80 -124
  100. package/dist/packages/_es/TimeDetail.js +49 -57
  101. package/dist/packages/_es/TimePannel.js +35 -31
  102. package/dist/packages/_es/TimeSelect.js +47 -68
  103. package/dist/packages/_es/Toast.js +150 -203
  104. package/dist/packages/_es/Tour.js +139 -175
  105. package/dist/packages/_es/TrendArrow.js +57 -58
  106. package/dist/packages/_es/Uploader.js +235 -359
  107. package/dist/packages/_es/Video.js +191 -298
  108. package/dist/packages/_es/Watermark.js +84 -98
  109. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  110. package/dist/packages/_es/common-d218746f.js +116 -0
  111. package/dist/packages/_es/component-234624bc.js +89 -0
  112. package/dist/packages/_es/index-14dfadc4.js +561 -0
  113. package/dist/packages/_es/index-192a3ef6.js +29 -0
  114. package/dist/packages/_es/index-360c5092.js +210 -0
  115. package/dist/packages/_es/index-496e6e05.js +24 -0
  116. package/dist/packages/_es/index-50eed3d9.js +7 -0
  117. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  118. package/dist/packages/_es/index-fadb0974.js +8 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  121. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  122. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  123. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  124. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  125. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  126. package/dist/packages/actionsheet/index.scss +2 -0
  127. package/dist/packages/actionsheet/style.mjs +0 -2
  128. package/dist/packages/address/index.scss +5 -2
  129. package/dist/packages/address/style.mjs +0 -3
  130. package/dist/packages/addresslist/index.scss +3 -0
  131. package/dist/packages/addresslist/style.mjs +0 -2
  132. package/dist/packages/audio/index.scss +2 -0
  133. package/dist/packages/audio/style.mjs +0 -1
  134. package/dist/packages/audiooperate/index.scss +2 -0
  135. package/dist/packages/audiooperate/style.mjs +0 -1
  136. package/dist/packages/badge/index.scss +3 -0
  137. package/dist/packages/button/index.scss +1 -1
  138. package/dist/packages/calendar/index.scss +3 -0
  139. package/dist/packages/calendar/style.mjs +0 -3
  140. package/dist/packages/card/index.scss +3 -0
  141. package/dist/packages/card/style.mjs +0 -2
  142. package/dist/packages/cascader/index.scss +4 -0
  143. package/dist/packages/cascader/style.mjs +0 -5
  144. package/dist/packages/cellgroup/index.scss +1 -1
  145. package/dist/packages/checkbox/index.scss +41 -0
  146. package/dist/packages/col/index.scss +2 -2
  147. package/dist/packages/comment/index.scss +2 -0
  148. package/dist/packages/comment/style.mjs +0 -1
  149. package/dist/packages/datepicker/index.scss +1 -2
  150. package/dist/packages/datepicker/style.mjs +0 -3
  151. package/dist/packages/dialog/index.scss +11 -0
  152. package/dist/packages/dialog/style.mjs +0 -3
  153. package/dist/packages/ecard/index.scss +2 -0
  154. package/dist/packages/ecard/style.mjs +0 -1
  155. package/dist/packages/fixednav/index.scss +2 -0
  156. package/dist/packages/fixednav/style.mjs +0 -1
  157. package/dist/packages/form/index.scss +1 -2
  158. package/dist/packages/form/style.mjs +0 -1
  159. package/dist/packages/formitem/index.scss +3 -0
  160. package/dist/packages/formitem/style.mjs +0 -1
  161. package/dist/packages/imagepreview/index.scss +5 -5
  162. package/dist/packages/imagepreview/style.mjs +0 -5
  163. package/dist/packages/input/index.scss +13 -13
  164. package/dist/packages/invoice/index.scss +6 -0
  165. package/dist/packages/invoice/style.mjs +0 -7
  166. package/dist/packages/list/index.scss +8 -8
  167. package/dist/packages/menuitem/index.scss +9 -10
  168. package/dist/packages/menuitem/style.mjs +0 -2
  169. package/dist/packages/navbar/index.scss +0 -1
  170. package/dist/packages/noticebar/index.scss +12 -2
  171. package/dist/packages/notify/index.scss +2 -0
  172. package/dist/packages/notify/style.mjs +0 -2
  173. package/dist/packages/numberkeyboard/index.scss +2 -0
  174. package/dist/packages/numberkeyboard/style.mjs +0 -2
  175. package/dist/packages/picker/index.scss +4 -9
  176. package/dist/packages/picker/style.mjs +0 -2
  177. package/dist/packages/popover/index.scss +2 -0
  178. package/dist/packages/popover/style.mjs +0 -2
  179. package/dist/packages/popup/index.scss +2 -0
  180. package/dist/packages/popup/style.mjs +0 -1
  181. package/dist/packages/price/index.scss +5 -10
  182. package/dist/packages/rate/index.scss +6 -9
  183. package/dist/packages/searchbar/index.scss +4 -0
  184. package/dist/packages/shortpassword/index.scss +18 -0
  185. package/dist/packages/shortpassword/style.mjs +0 -2
  186. package/dist/packages/signature/index.scss +2 -0
  187. package/dist/packages/signature/style.mjs +0 -1
  188. package/dist/packages/skeleton/index.scss +2 -0
  189. package/dist/packages/skeleton/style.mjs +0 -1
  190. package/dist/packages/sku/index.scss +4 -0
  191. package/dist/packages/sku/style.mjs +0 -4
  192. package/dist/packages/tabbaritem/index.scss +2 -0
  193. package/dist/packages/tabbaritem/style.mjs +0 -1
  194. package/dist/packages/tabs/index.scss +36 -2
  195. package/dist/packages/tabs/style.mjs +0 -1
  196. package/dist/packages/textarea/index.scss +2 -0
  197. package/dist/packages/timeselect/index.scss +2 -0
  198. package/dist/packages/timeselect/style.mjs +0 -2
  199. package/dist/packages/tour/index.scss +2 -0
  200. package/dist/packages/tour/style.mjs +0 -3
  201. package/dist/packages/uploader/index.scss +10 -2
  202. package/dist/packages/uploader/style.mjs +0 -2
  203. package/dist/resolver/index.d.ts +6 -0
  204. package/dist/resolver/index.js +1 -0
  205. package/dist/resolver/index.mjs +24 -0
  206. package/dist/resolver/package.json +20 -0
  207. package/dist/smartips/web-types.json +114 -15
  208. package/dist/style.css +1 -1
  209. package/dist/styles/themes/default.scss +155 -52
  210. package/dist/styles/themes/jdb.scss +155 -52
  211. package/dist/styles/themes/jddkh.scss +155 -52
  212. package/dist/styles/themes/jdt.scss +155 -52
  213. package/dist/styles/variables-jdb.scss +9 -1
  214. package/dist/styles/variables-jddkh.scss +9 -1
  215. package/dist/styles/variables-jdt.scss +9 -1
  216. package/dist/styles/variables.scss +8 -0
  217. package/dist/types/__VUE/address/index.vue.d.ts +2 -1
  218. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +1 -1
  219. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -1
  220. package/dist/types/__VUE/addresslist/index.vue.d.ts +1 -1
  221. package/dist/types/__VUE/animate/index.vue.d.ts +6 -0
  222. package/dist/types/__VUE/audiooperate/index.vue.d.ts +4 -4
  223. package/dist/types/__VUE/badge/index.vue.d.ts +9 -0
  224. package/dist/types/__VUE/button/type.d.ts +1 -0
  225. package/dist/types/__VUE/calendaritem/type.d.ts +1 -0
  226. package/dist/types/__VUE/collapse/index.vue.d.ts +31 -5
  227. package/dist/types/__VUE/collapseitem/index.vue.d.ts +117 -11
  228. package/dist/types/__VUE/configprovider/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/datepicker/index.vue.d.ts +1 -1
  230. package/dist/types/__VUE/dialog/index.d.ts +1 -0
  231. package/dist/types/__VUE/dialog/index.vue.d.ts +1 -0
  232. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  233. package/dist/types/__VUE/image/index.vue.d.ts +14 -3
  234. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +9 -0
  235. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  236. package/dist/types/__VUE/input/index.vue.d.ts +27 -2
  237. package/dist/types/__VUE/list/index.vue.d.ts +42 -13
  238. package/dist/types/__VUE/list/type.d.ts +13 -0
  239. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  240. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  241. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  242. package/dist/types/__VUE/noticebar/index.vue.d.ts +5 -2
  243. package/dist/types/__VUE/picker/common.d.ts +2 -0
  244. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  245. package/dist/types/__VUE/price/index.vue.d.ts +9 -0
  246. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  247. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  248. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  249. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  250. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  251. package/dist/types/__VUE/switch/index.vue.d.ts +1 -0
  252. package/dist/types/__VUE/table/common.d.ts +55 -2
  253. package/dist/types/__VUE/tabpane/index.vue.d.ts +1 -4
  254. package/dist/types/__VUE/tabs/hooks.d.ts +12 -0
  255. package/dist/types/__VUE/tabs/index.vue.d.ts +35 -5
  256. package/dist/types/__VUE/tabs/types.d.ts +12 -0
  257. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  258. package/dist/types/__VUE/toast/index.vue.d.ts +11 -4
  259. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  260. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  261. package/dist/types/index.d.ts +1 -2
  262. package/dist/types/resolver/index.d.ts +6 -0
  263. package/dist/types/utils/date.d.ts +4 -0
  264. package/dist/types/utils/useTaroRect/index.d.ts +1 -1
  265. package/dist/types/utils/util.d.ts +1 -1
  266. package/package.json +13 -6
  267. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  268. package/dist/packages/_es/common-b9a5e726.js +0 -145
  269. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  270. package/dist/packages/_es/index-29892cda.js +0 -33
  271. package/dist/packages/_es/index-2ae3ae87.js +0 -846
  272. package/dist/packages/_es/index-43c34ac6.js +0 -30
  273. package/dist/packages/_es/index-54d03fc1.js +0 -8
  274. package/dist/packages/_es/index-79c5dc33.js +0 -10
  275. package/dist/packages/_es/index-7a7385e4.js +0 -67
  276. package/dist/packages/_es/index-991c279f.js +0 -244
  277. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  278. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  279. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  280. package/dist/packages/_es/interceptor-956b24fc.js +0 -29
  281. package/dist/packages/_es/mountComponent-1ece4110.js +0 -39
  282. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  283. package/dist/packages/_es/raf-729dad54.js +0 -25
  284. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
  285. /package/dist/types/utils/{interceptor.d.ts → Interceptor.d.ts} +0 -0
@@ -1,14 +1,13 @@
1
- import { ref, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { r as requestAniFrame } from "./raf-729dad54.js";
4
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { ref as h, reactive as x, computed as b, onMounted as v, onActivated as g, onDeactivated as P, openBlock as T, createElementBlock as W, normalizeClass as H, renderSlot as L } from "vue";
2
+ import { c as E } from "./component-234624bc.js";
3
+ import { r as u } from "./raf-a74f1a06.js";
4
+ import { _ as k } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  import "../locale/lang";
6
- const { componentName, create } = createComponent("drag");
7
- const _sfc_main = create({
6
+ const { componentName: A, create: $ } = E("drag"), X = $({
8
7
  props: {
9
8
  attract: {
10
9
  type: Boolean,
11
- default: false
10
+ default: !1
12
11
  },
13
12
  direction: {
14
13
  type: String,
@@ -16,20 +15,17 @@ const _sfc_main = create({
16
15
  },
17
16
  boundary: {
18
17
  type: Object,
19
- default: () => {
20
- return {
21
- top: 0,
22
- left: 0,
23
- right: 0,
24
- bottom: 0
25
- };
26
- }
18
+ default: () => ({
19
+ top: 0,
20
+ left: 0,
21
+ right: 0,
22
+ bottom: 0
23
+ })
27
24
  }
28
25
  },
29
- setup(props) {
30
- const myDrag = ref();
31
- const state = reactive({
32
- keepAlive: false,
26
+ setup(i) {
27
+ const o = h(), t = x({
28
+ keepAlive: !1,
33
29
  elWidth: 0,
34
30
  elHeight: 0,
35
31
  screenWidth: 0,
@@ -47,155 +43,76 @@ const _sfc_main = create({
47
43
  right: 0,
48
44
  bottom: 0
49
45
  }
50
- });
51
- const classes = computed(() => {
52
- const prefixCls = componentName;
53
- return {
54
- [prefixCls]: true
55
- };
56
- });
57
- function getInfo() {
58
- const domElem = document.documentElement;
59
- state.elWidth = myDrag.value.offsetWidth;
60
- state.elHeight = myDrag.value.offsetHeight;
61
- state.screenWidth = domElem.clientWidth || 375;
62
- state.screenHeight = domElem.clientHeight || 667;
46
+ }), a = b(() => ({
47
+ [A]: !0
48
+ }));
49
+ function p() {
50
+ const e = document.documentElement;
51
+ t.elWidth = o.value.offsetWidth, t.elHeight = o.value.offsetHeight, t.screenWidth = e.clientWidth || 375, t.screenHeight = e.clientHeight || 667;
63
52
  }
64
- function goLeft(target) {
65
- if (state.boundary.left) {
66
- if (+target.style.left.split("px")[0] > state.boundary.left) {
67
- target.style.left = +target.style.left.split("px")[0] - 10 + "px";
68
- requestAniFrame(() => {
69
- goLeft(target);
70
- });
71
- } else {
72
- target.style.left = `${state.boundary.left}px`;
73
- }
74
- } else {
75
- if (+target.style.left.split("px")[0] > 10) {
76
- target.style.left = +target.style.left.split("px")[0] - 10 + "px";
77
- requestAniFrame(() => {
78
- goLeft(target);
79
- });
80
- } else {
81
- target.style.left = "0px";
82
- }
83
- }
53
+ function c(e) {
54
+ t.boundary.left ? +e.style.left.split("px")[0] > t.boundary.left ? (e.style.left = +e.style.left.split("px")[0] - 10 + "px", u(() => {
55
+ c(e);
56
+ })) : e.style.left = `${t.boundary.left}px` : +e.style.left.split("px")[0] > 10 ? (e.style.left = +e.style.left.split("px")[0] - 10 + "px", u(() => {
57
+ c(e);
58
+ })) : e.style.left = "0px";
84
59
  }
85
- function goRight(target, rightLocation) {
86
- if (rightLocation - parseInt(target.style.left.split("px")[0]) > 10) {
87
- target.style.left = parseInt(target.style.left.split("px")[0]) + 10 + "px";
88
- requestAniFrame(() => {
89
- goRight(target, rightLocation);
90
- });
91
- } else {
92
- target.style.left = rightLocation + "px";
93
- }
60
+ function l(e, n) {
61
+ n - parseInt(e.style.left.split("px")[0]) > 10 ? (e.style.left = parseInt(e.style.left.split("px")[0]) + 10 + "px", u(() => {
62
+ l(e, n);
63
+ })) : e.style.left = n + "px";
94
64
  }
95
- function touchMove(e) {
65
+ function d(e) {
96
66
  e.preventDefault();
97
- const target = e.currentTarget;
67
+ const n = e.currentTarget;
98
68
  if (e.targetTouches.length === 1) {
99
- const touch = e.targetTouches[0];
100
- state.nx = touch.clientX - state.position.x;
101
- state.ny = touch.clientY - state.position.y;
102
- state.xPum = state.startLeft + state.nx;
103
- state.yPum = state.startTop + state.ny;
104
- const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
105
- if (Math.abs(state.xPum) > rightLocation) {
106
- state.xPum = rightLocation;
107
- } else if (state.xPum <= state.boundary.left) {
108
- state.xPum = state.boundary.left;
109
- }
110
- if (state.yPum < state.boundary.top) {
111
- state.yPum = state.boundary.top;
112
- } else if (state.yPum > state.screenHeight - state.elHeight - state.boundary.bottom) {
113
- state.yPum = state.screenHeight - state.elHeight - state.boundary.bottom;
114
- }
115
- if (props.direction != "y") {
116
- target.style.left = state.xPum + "px";
117
- }
118
- if (props.direction != "x") {
119
- target.style.top = state.yPum + "px";
120
- }
69
+ const r = e.targetTouches[0];
70
+ t.nx = r.clientX - t.position.x, t.ny = r.clientY - t.position.y, t.xPum = t.startLeft + t.nx, t.yPum = t.startTop + t.ny;
71
+ const s = t.screenWidth - t.elWidth - t.boundary.right;
72
+ Math.abs(t.xPum) > s ? t.xPum = s : t.xPum <= t.boundary.left && (t.xPum = t.boundary.left), t.yPum < t.boundary.top ? t.yPum = t.boundary.top : t.yPum > t.screenHeight - t.elHeight - t.boundary.bottom && (t.yPum = t.screenHeight - t.elHeight - t.boundary.bottom), i.direction != "y" && (n.style.left = t.xPum + "px"), i.direction != "x" && (n.style.top = t.yPum + "px");
121
73
  }
122
74
  }
123
- function touchEnd(e) {
124
- const target = e.currentTarget;
125
- const touch = e.changedTouches[0];
126
- let currX = touch.clientX;
127
- const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
128
- if (currX > rightLocation) {
129
- currX = rightLocation;
130
- } else if (currX < state.boundary.left) {
131
- currX = state.boundary.left;
132
- } else {
133
- currX = currX < state.screenWidth / 2 ? state.boundary.left : rightLocation;
134
- }
135
- if (props.direction != "y" && props.attract) {
136
- if (currX < state.screenWidth / 2) {
137
- requestAniFrame(() => {
138
- goLeft(target);
139
- });
140
- } else {
141
- requestAniFrame(() => {
142
- goRight(target, rightLocation);
143
- });
144
- }
145
- }
146
- if (props.direction != "x") {
147
- target.style.top = state.yPum + "px";
148
- }
75
+ function y(e) {
76
+ const n = e.currentTarget;
77
+ let s = e.changedTouches[0].clientX;
78
+ const f = t.screenWidth - t.elWidth - t.boundary.right;
79
+ s > f ? s = f : s < t.boundary.left ? s = t.boundary.left : s = s < t.screenWidth / 2 ? t.boundary.left : f, i.direction != "y" && i.attract && (s < t.screenWidth / 2 ? u(() => {
80
+ c(n);
81
+ }) : u(() => {
82
+ l(n, f);
83
+ })), i.direction != "x" && (n.style.top = t.yPum + "px");
149
84
  }
150
- function touchStart(e) {
151
- const target = e.currentTarget;
152
- const touches = e.touches[0];
153
- const touch = e.targetTouches[0];
154
- state.startTop = target.offsetTop;
155
- state.startLeft = target.offsetLeft;
156
- state.position.x = touches.clientX;
157
- state.position.y = touches.clientY;
158
- state.nx = touch.clientX - state.position.x;
159
- state.ny = touch.clientY - state.position.y;
160
- state.xPum = state.startLeft + state.nx;
161
- state.yPum = state.startTop + state.ny;
85
+ function m(e) {
86
+ const n = e.currentTarget, r = e.touches[0], s = e.targetTouches[0];
87
+ t.startTop = n.offsetTop, t.startLeft = n.offsetLeft, t.position.x = r.clientX, t.position.y = r.clientY, t.nx = s.clientX - t.position.x, t.ny = s.clientY - t.position.y, t.xPum = t.startLeft + t.nx, t.yPum = t.startTop + t.ny;
162
88
  }
163
- onMounted(() => {
164
- getInfo();
165
- state.boundary = props.boundary;
166
- });
167
- onActivated(() => {
168
- if (state.keepAlive) {
169
- state.keepAlive = false;
170
- }
171
- });
172
- onDeactivated(() => {
173
- state.keepAlive = true;
174
- myDrag.value.removeEventListener("touchstart", touchStart);
175
- myDrag.value.removeEventListener("touchmove", touchMove);
176
- myDrag.value.removeEventListener("touchend", touchEnd);
177
- });
178
- return {
179
- classes,
180
- myDrag,
181
- touchStart,
182
- touchMove,
183
- touchEnd
89
+ return v(() => {
90
+ p(), t.boundary = i.boundary;
91
+ }), g(() => {
92
+ t.keepAlive && (t.keepAlive = !1);
93
+ }), P(() => {
94
+ t.keepAlive = !0, o.value.removeEventListener("touchstart", m), o.value.removeEventListener("touchmove", d), o.value.removeEventListener("touchend", y);
95
+ }), {
96
+ classes: a,
97
+ myDrag: o,
98
+ touchStart: m,
99
+ touchMove: d,
100
+ touchEnd: y
184
101
  };
185
102
  }
186
103
  });
187
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
188
- return openBlock(), createElementBlock("view", {
189
- class: normalizeClass(_ctx.classes),
104
+ function C(i, o, t, a, p, c) {
105
+ return T(), W("view", {
106
+ class: H(i.classes),
190
107
  ref: "myDrag",
191
- onTouchstart: _cache[0] || (_cache[0] = ($event) => _ctx.touchStart($event)),
192
- onTouchmove: _cache[1] || (_cache[1] = ($event) => _ctx.touchMove($event)),
193
- onTouchend: _cache[2] || (_cache[2] = ($event) => _ctx.touchEnd($event))
108
+ onTouchstart: o[0] || (o[0] = (l) => i.touchStart(l)),
109
+ onTouchmove: o[1] || (o[1] = (l) => i.touchMove(l)),
110
+ onTouchend: o[2] || (o[2] = (l) => i.touchEnd(l))
194
111
  }, [
195
- renderSlot(_ctx.$slots, "default")
112
+ L(i.$slots, "default")
196
113
  ], 34);
197
114
  }
198
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
115
+ const Y = /* @__PURE__ */ k(X, [["render", C]]);
199
116
  export {
200
- index as default
117
+ Y as default
201
118
  };
@@ -1,14 +1,13 @@
1
- import { ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, renderList, normalizeClass, withDirectives, vModelText, createTextVNode, createVNode } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import InputNumber from "./InputNumber.js";
4
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { ref as s, watch as C, resolveComponent as M, openBlock as v, createElementBlock as f, createElementVNode as l, toDisplayString as i, Fragment as k, renderList as N, normalizeClass as g, withDirectives as b, vModelText as A, createTextVNode as w, createVNode as S } from "vue";
2
+ import { c as T } from "./component-234624bc.js";
3
+ import y from "./InputNumber.js";
4
+ import { _ as B } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  import "../locale/lang";
6
- import "./pxCheck-c6b9f6b7.js";
6
+ import "./pxCheck-38173291.js";
7
7
  import "@nutui/icons-vue";
8
- const { create, translate } = createComponent("ecard");
9
- const _sfc_main = create({
8
+ const { create: I, translate: $ } = T("ecard"), L = I({
10
9
  components: {
11
- [InputNumber.name]: InputNumber
10
+ [y.name]: y
12
11
  },
13
12
  props: {
14
13
  chooseText: {
@@ -53,116 +52,77 @@ const _sfc_main = create({
53
52
  }
54
53
  },
55
54
  emits: ["inputChange", "changeStep", "inputClick", "change", "update:modelValue"],
56
- setup(props, { emit }) {
57
- const currentIndex = ref(null);
58
- const currentValue = ref(null);
59
- const inputValue = ref("");
60
- const stepValue = ref(props.cardAmountMin);
61
- const money = ref(props.modelValue);
62
- const handleClick = (item, index2) => {
63
- currentIndex.value = index2;
64
- stepValue.value = props.cardAmountMin;
65
- currentValue.value = item.price;
66
- emit("change", item);
67
- emit("update:modelValue", item.price);
55
+ setup(e, { emit: t }) {
56
+ const c = s(null), o = s(null), a = s(""), r = s(e.cardAmountMin), p = s(e.modelValue), n = (u, V) => {
57
+ c.value = V, r.value = e.cardAmountMin, o.value = u.price, t("change", u), t("update:modelValue", u.price);
58
+ }, d = (u) => {
59
+ let m = u.target.value.replace(/[^\d]/g, "");
60
+ a.value = m, o.value = m, Number(m) > e.cardAmountMax && (a.value = e.cardAmountMax, o.value = e.cardAmountMax), Number(m) < e.cardAmountMin && (a.value = e.cardAmountMin, o.value = e.cardAmountMin), t("inputChange", Number(a.value)), t("update:modelValue", Number(a.value));
61
+ }, h = () => {
62
+ c.value = "input", r.value = e.cardAmountMin, o.value = a.value, t("update:modelValue", a.value), t("inputClick");
63
+ }, _ = (u) => {
64
+ r.value = u, t("changeStep", r.value, o.value);
68
65
  };
69
- const change = (event) => {
70
- let input = event.target;
71
- let val = input.value.replace(/[^\d]/g, "");
72
- inputValue.value = val;
73
- currentValue.value = val;
74
- if (Number(val) > props.cardAmountMax) {
75
- inputValue.value = props.cardAmountMax;
76
- currentValue.value = props.cardAmountMax;
66
+ return C(
67
+ () => e.modelValue,
68
+ (u) => {
69
+ p.value = u;
77
70
  }
78
- if (Number(val) < props.cardAmountMin) {
79
- inputValue.value = props.cardAmountMin;
80
- currentValue.value = props.cardAmountMin;
81
- }
82
- emit("inputChange", Number(inputValue.value));
83
- emit("update:modelValue", Number(inputValue.value));
84
- };
85
- const inputClick = () => {
86
- currentIndex.value = "input";
87
- stepValue.value = props.cardAmountMin;
88
- currentValue.value = inputValue.value;
89
- emit("update:modelValue", inputValue.value);
90
- emit("inputClick");
91
- };
92
- const changeStep = (value) => {
93
- stepValue.value = value;
94
- emit("changeStep", stepValue.value, currentValue.value);
95
- };
96
- watch(
97
- () => props.modelValue,
98
- (value) => {
99
- money.value = value;
100
- }
101
- );
102
- return {
103
- handleClick,
104
- changeStep,
105
- change,
106
- inputClick,
107
- stepValue,
108
- currentIndex,
109
- inputValue,
110
- money,
111
- translate
71
+ ), {
72
+ handleClick: n,
73
+ changeStep: _,
74
+ change: d,
75
+ inputClick: h,
76
+ stepValue: r,
77
+ currentIndex: c,
78
+ inputValue: a,
79
+ money: p,
80
+ translate: $
112
81
  };
113
82
  }
114
- });
115
- const _hoisted_1 = { class: "nut-ecard" };
116
- const _hoisted_2 = { class: "nut-ecard__title" };
117
- const _hoisted_3 = { class: "nut-ecard__list" };
118
- const _hoisted_4 = ["onClick"];
119
- const _hoisted_5 = { class: "nut-ecard__list__input--con" };
120
- const _hoisted_6 = ["placeholder"];
121
- const _hoisted_7 = { class: "nut-ecard__list__step" };
122
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
123
- const _component_nut_input_number = resolveComponent("nut-input-number");
124
- return openBlock(), createElementBlock("view", _hoisted_1, [
125
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.chooseText || _ctx.translate("chooseText")), 1),
126
- createElementVNode("view", _hoisted_3, [
127
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataList, (item, index2) => {
128
- return openBlock(), createElementBlock("view", {
129
- key: index2,
130
- class: normalizeClass(["nut-ecard__list__item", _ctx.currentIndex == index2 ? "active" : ""]),
131
- onClick: ($event) => _ctx.handleClick(item, index2)
132
- }, toDisplayString(item.price), 11, _hoisted_4);
133
- }), 128)),
134
- createElementVNode("view", {
135
- class: normalizeClass(["nut-ecard__list__input", _ctx.currentIndex == "input" ? "active" : ""]),
136
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.inputClick && _ctx.inputClick(...args))
83
+ }), D = { class: "nut-ecard" }, E = { class: "nut-ecard__title" }, U = { class: "nut-ecard__list" }, x = ["onClick"], z = { class: "nut-ecard__list__input--con" }, F = ["placeholder"], j = { class: "nut-ecard__list__step" };
84
+ function q(e, t, c, o, a, r) {
85
+ const p = M("nut-input-number");
86
+ return v(), f("view", D, [
87
+ l("view", E, i(e.chooseText || e.translate("chooseText")), 1),
88
+ l("view", U, [
89
+ (v(!0), f(k, null, N(e.dataList, (n, d) => (v(), f("view", {
90
+ key: d,
91
+ class: g(["nut-ecard__list__item", e.currentIndex == d ? "active" : ""]),
92
+ onClick: (h) => e.handleClick(n, d)
93
+ }, i(n.price), 11, x))), 128)),
94
+ l("view", {
95
+ class: g(["nut-ecard__list__input", e.currentIndex == "input" ? "active" : ""]),
96
+ onClick: t[2] || (t[2] = (...n) => e.inputClick && e.inputClick(...n))
137
97
  }, [
138
- createElementVNode("view", null, toDisplayString(_ctx.otherValueText || _ctx.translate("otherValueText")), 1),
139
- createElementVNode("view", _hoisted_5, [
140
- withDirectives(createElementVNode("input", {
98
+ l("view", null, i(e.otherValueText || e.translate("otherValueText")), 1),
99
+ l("view", z, [
100
+ b(l("input", {
141
101
  class: "nut-ecard__list__input--input",
142
102
  type: "text",
143
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.inputValue = $event),
144
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.change && _ctx.change(...args)),
145
- placeholder: _ctx.placeholder || _ctx.translate("placeholder")
146
- }, null, 40, _hoisted_6), [
147
- [vModelText, _ctx.inputValue]
103
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.inputValue = n),
104
+ onInput: t[1] || (t[1] = (...n) => e.change && e.change(...n)),
105
+ placeholder: e.placeholder || e.translate("placeholder")
106
+ }, null, 40, F), [
107
+ [A, e.inputValue]
148
108
  ]),
149
- createTextVNode(" " + toDisplayString(_ctx.suffix), 1)
109
+ w(" " + i(e.suffix), 1)
150
110
  ])
151
111
  ], 2),
152
- createElementVNode("view", _hoisted_7, [
153
- createElementVNode("view", null, toDisplayString(_ctx.suffix) + toDisplayString(_ctx.money), 1),
154
- createVNode(_component_nut_input_number, {
155
- modelValue: _ctx.stepValue,
156
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.stepValue = $event),
157
- min: _ctx.cardBuyMin,
158
- max: _ctx.cardBuyMax,
159
- onChange: _ctx.changeStep
112
+ l("view", j, [
113
+ l("view", null, i(e.suffix) + i(e.money), 1),
114
+ S(p, {
115
+ modelValue: e.stepValue,
116
+ "onUpdate:modelValue": t[3] || (t[3] = (n) => e.stepValue = n),
117
+ min: e.cardBuyMin,
118
+ max: e.cardBuyMax,
119
+ onChange: e.changeStep
160
120
  }, null, 8, ["modelValue", "min", "max", "onChange"])
161
121
  ])
162
122
  ])
163
123
  ]);
164
124
  }
165
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
125
+ const R = /* @__PURE__ */ B(L, [["render", q]]);
166
126
  export {
167
- index as default
127
+ R as default
168
128
  };