@nutui/nutui 4.0.11 → 4.0.12

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 (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +2 -2
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +48 -48
  135. package/dist/styles/themes/jdb.scss +48 -48
  136. package/dist/styles/themes/jddkh.scss +48 -48
  137. package/dist/styles/themes/jdt.scss +48 -48
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +3 -4
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,13 +1,14 @@
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";
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";
5
5
  import "../locale/lang";
6
- const { componentName: A, create: $ } = E("drag"), X = $({
6
+ const { componentName, create } = createComponent("drag");
7
+ const _sfc_main = create({
7
8
  props: {
8
9
  attract: {
9
10
  type: Boolean,
10
- default: !1
11
+ default: false
11
12
  },
12
13
  direction: {
13
14
  type: String,
@@ -15,17 +16,20 @@ const { componentName: A, create: $ } = E("drag"), X = $({
15
16
  },
16
17
  boundary: {
17
18
  type: Object,
18
- default: () => ({
19
- top: 0,
20
- left: 0,
21
- right: 0,
22
- bottom: 0
23
- })
19
+ default: () => {
20
+ return {
21
+ top: 0,
22
+ left: 0,
23
+ right: 0,
24
+ bottom: 0
25
+ };
26
+ }
24
27
  }
25
28
  },
26
- setup(i) {
27
- const o = h(), t = x({
28
- keepAlive: !1,
29
+ setup(props) {
30
+ const myDrag = ref();
31
+ const state = reactive({
32
+ keepAlive: false,
29
33
  elWidth: 0,
30
34
  elHeight: 0,
31
35
  screenWidth: 0,
@@ -43,76 +47,155 @@ const { componentName: A, create: $ } = E("drag"), X = $({
43
47
  right: 0,
44
48
  bottom: 0
45
49
  }
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;
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;
52
63
  }
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";
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
+ }
59
84
  }
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";
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
+ }
64
94
  }
65
- function d(e) {
95
+ function touchMove(e) {
66
96
  e.preventDefault();
67
- const n = e.currentTarget;
97
+ const target = e.currentTarget;
68
98
  if (e.targetTouches.length === 1) {
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");
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
+ }
73
121
  }
74
122
  }
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");
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
+ }
84
149
  }
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;
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;
88
162
  }
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
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
101
184
  };
102
185
  }
103
186
  });
104
- function C(i, o, t, a, p, c) {
105
- return T(), W("view", {
106
- class: H(i.classes),
187
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
188
+ return openBlock(), createElementBlock("view", {
189
+ class: normalizeClass(_ctx.classes),
107
190
  ref: "myDrag",
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))
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))
111
194
  }, [
112
- L(i.$slots, "default")
195
+ renderSlot(_ctx.$slots, "default")
113
196
  ], 34);
114
197
  }
115
- const Y = /* @__PURE__ */ k(X, [["render", C]]);
198
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
116
199
  export {
117
- Y as default
200
+ index as default
118
201
  };
@@ -1,13 +1,14 @@
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";
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";
5
5
  import "../locale/lang";
6
- import "./pxCheck-38173291.js";
6
+ import "./pxCheck-c6b9f6b7.js";
7
7
  import "@nutui/icons-vue";
8
- const { create: I, translate: $ } = T("ecard"), L = I({
8
+ const { create, translate } = createComponent("ecard");
9
+ const _sfc_main = create({
9
10
  components: {
10
- [y.name]: y
11
+ [InputNumber.name]: InputNumber
11
12
  },
12
13
  props: {
13
14
  chooseText: {
@@ -52,77 +53,116 @@ const { create: I, translate: $ } = T("ecard"), L = I({
52
53
  }
53
54
  },
54
55
  emits: ["inputChange", "changeStep", "inputClick", "change", "update:modelValue"],
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);
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);
65
68
  };
66
- return C(
67
- () => e.modelValue,
68
- (u) => {
69
- p.value = u;
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;
70
77
  }
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: $
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
81
112
  };
82
113
  }
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))
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))
97
137
  }, [
98
- l("view", null, i(e.otherValueText || e.translate("otherValueText")), 1),
99
- l("view", z, [
100
- b(l("input", {
138
+ createElementVNode("view", null, toDisplayString(_ctx.otherValueText || _ctx.translate("otherValueText")), 1),
139
+ createElementVNode("view", _hoisted_5, [
140
+ withDirectives(createElementVNode("input", {
101
141
  class: "nut-ecard__list__input--input",
102
142
  type: "text",
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]
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]
108
148
  ]),
109
- w(" " + i(e.suffix), 1)
149
+ createTextVNode(" " + toDisplayString(_ctx.suffix), 1)
110
150
  ])
111
151
  ], 2),
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
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
120
160
  }, null, 8, ["modelValue", "min", "max", "onChange"])
121
161
  ])
122
162
  ])
123
163
  ]);
124
164
  }
125
- const R = /* @__PURE__ */ B(L, [["render", q]]);
165
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
126
166
  export {
127
- R as default
167
+ index as default
128
168
  };