@nutui/nutui 3.1.22-beta.5 → 3.1.23-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 (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,63 +1,204 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as t, reactive as e, computed as o, onMounted as n, onActivated as r, onDeactivated as s, openBlock as i, createElementBlock as l, normalizeClass as u, renderSlot as c } from "vue";
7
- import { c as a } from "./component.js";
8
- import { r as p } from "./raf.js";
9
- import { _ as y } from "./plugin-vue_export-helper.js";
6
+ import { ref, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { r as requestAniFrame } from "./raf.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName: f, create: d } = a("drag");
12
- var h = y(d({ props: { attract: { type: Boolean, default: false }, direction: { type: String, default: "all" }, boundary: { type: Object, default: () => ({ top: 0, left: 0, right: 0, bottom: 0 }) } }, setup(i2, { emit: l2 }) {
13
- const u2 = t(), c2 = e({ keepAlive: false, elWidth: 0, elHeight: 0, screenWidth: 0, screenHeight: 0, startTop: 0, startLeft: 0, nx: 0, ny: 0, xPum: 0, yPum: 0, position: { x: 0, y: 0 }, boundary: { top: 0, left: 0, right: 0, bottom: 0 } }), a2 = o(() => ({ [f]: true }));
14
- function y2(t2) {
15
- c2.boundary.left ? +t2.style.left.split("px")[0] > c2.boundary.left ? (t2.style.left = +t2.style.left.split("px")[0] - 10 + "px", p(() => {
16
- y2(t2);
17
- })) : t2.style.left = `${c2.boundary.left}px` : +t2.style.left.split("px")[0] > 10 ? (t2.style.left = +t2.style.left.split("px")[0] - 10 + "px", p(() => {
18
- y2(t2);
19
- })) : t2.style.left = "0px";
20
- }
21
- function d2(t2, e2) {
22
- e2 - parseInt(t2.style.left.split("px")[0]) > 10 ? (t2.style.left = parseInt(t2.style.left.split("px")[0]) + 10 + "px", p(() => {
23
- d2(t2, e2);
24
- })) : t2.style.left = e2 + "px";
25
- }
26
- function h2(t2) {
27
- t2.preventDefault();
28
- const e2 = t2.currentTarget;
29
- if (t2.targetTouches.length === 1) {
30
- const o2 = t2.targetTouches[0];
31
- c2.nx = o2.clientX - c2.position.x, c2.ny = o2.clientY - c2.position.y, c2.xPum = c2.startLeft + c2.nx, c2.yPum = c2.startTop + c2.ny;
32
- const n2 = c2.screenWidth - c2.elWidth - c2.boundary.right;
33
- Math.abs(c2.xPum) > n2 ? c2.xPum = n2 : c2.xPum <= c2.boundary.left && (c2.xPum = c2.boundary.left), c2.yPum < c2.boundary.top ? c2.yPum = c2.boundary.top : c2.yPum > c2.screenHeight - c2.elHeight - c2.boundary.bottom && (c2.yPum = c2.screenHeight - c2.elHeight - c2.boundary.bottom), i2.direction != "y" && (e2.style.left = c2.xPum + "px"), i2.direction != "x" && (e2.style.top = c2.yPum + "px");
11
+ const { componentName, create } = createComponent("drag");
12
+ const _sfc_main = create({
13
+ props: {
14
+ attract: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ direction: {
19
+ type: String,
20
+ default: "all"
21
+ },
22
+ boundary: {
23
+ type: Object,
24
+ default: () => {
25
+ return {
26
+ top: 0,
27
+ left: 0,
28
+ right: 0,
29
+ bottom: 0
30
+ };
31
+ }
34
32
  }
33
+ },
34
+ setup(props, { emit }) {
35
+ const myDrag = ref();
36
+ const state = reactive({
37
+ keepAlive: false,
38
+ elWidth: 0,
39
+ elHeight: 0,
40
+ screenWidth: 0,
41
+ screenHeight: 0,
42
+ startTop: 0,
43
+ startLeft: 0,
44
+ nx: 0,
45
+ ny: 0,
46
+ xPum: 0,
47
+ yPum: 0,
48
+ position: { x: 0, y: 0 },
49
+ boundary: {
50
+ top: 0,
51
+ left: 0,
52
+ right: 0,
53
+ bottom: 0
54
+ }
55
+ });
56
+ const classes = computed(() => {
57
+ const prefixCls = componentName;
58
+ return {
59
+ [prefixCls]: true
60
+ };
61
+ });
62
+ function getInfo() {
63
+ const domElem = document.documentElement;
64
+ state.elWidth = myDrag.value.offsetWidth;
65
+ state.elHeight = myDrag.value.offsetHeight;
66
+ state.screenWidth = domElem.clientWidth || 375;
67
+ state.screenHeight = domElem.clientHeight || 667;
68
+ }
69
+ function goLeft(target) {
70
+ if (state.boundary.left) {
71
+ if (+target.style.left.split("px")[0] > state.boundary.left) {
72
+ target.style.left = +target.style.left.split("px")[0] - 10 + "px";
73
+ requestAniFrame(() => {
74
+ goLeft(target);
75
+ });
76
+ } else {
77
+ target.style.left = `${state.boundary.left}px`;
78
+ }
79
+ } else {
80
+ if (+target.style.left.split("px")[0] > 10) {
81
+ target.style.left = +target.style.left.split("px")[0] - 10 + "px";
82
+ requestAniFrame(() => {
83
+ goLeft(target);
84
+ });
85
+ } else {
86
+ target.style.left = "0px";
87
+ }
88
+ }
89
+ }
90
+ function goRight(target, rightLocation) {
91
+ if (rightLocation - parseInt(target.style.left.split("px")[0]) > 10) {
92
+ target.style.left = parseInt(target.style.left.split("px")[0]) + 10 + "px";
93
+ requestAniFrame(() => {
94
+ goRight(target, rightLocation);
95
+ });
96
+ } else {
97
+ target.style.left = rightLocation + "px";
98
+ }
99
+ }
100
+ function touchMove(e) {
101
+ e.preventDefault();
102
+ const target = e.currentTarget;
103
+ if (e.targetTouches.length === 1) {
104
+ const touch = e.targetTouches[0];
105
+ state.nx = touch.clientX - state.position.x;
106
+ state.ny = touch.clientY - state.position.y;
107
+ state.xPum = state.startLeft + state.nx;
108
+ state.yPum = state.startTop + state.ny;
109
+ const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
110
+ if (Math.abs(state.xPum) > rightLocation) {
111
+ state.xPum = rightLocation;
112
+ } else if (state.xPum <= state.boundary.left) {
113
+ state.xPum = state.boundary.left;
114
+ }
115
+ if (state.yPum < state.boundary.top) {
116
+ state.yPum = state.boundary.top;
117
+ } else if (state.yPum > state.screenHeight - state.elHeight - state.boundary.bottom) {
118
+ state.yPum = state.screenHeight - state.elHeight - state.boundary.bottom;
119
+ }
120
+ if (props.direction != "y") {
121
+ target.style.left = state.xPum + "px";
122
+ }
123
+ if (props.direction != "x") {
124
+ target.style.top = state.yPum + "px";
125
+ }
126
+ }
127
+ }
128
+ function touchEnd(e) {
129
+ const target = e.currentTarget;
130
+ const touch = e.changedTouches[0];
131
+ let currX = touch.clientX;
132
+ const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
133
+ if (currX > rightLocation) {
134
+ currX = rightLocation;
135
+ } else if (currX < state.boundary.left) {
136
+ currX = state.boundary.left;
137
+ } else {
138
+ currX = currX < state.screenWidth / 2 ? state.boundary.left : rightLocation;
139
+ }
140
+ if (props.direction != "y" && props.attract) {
141
+ if (currX < state.screenWidth / 2) {
142
+ requestAniFrame(() => {
143
+ goLeft(target);
144
+ });
145
+ } else {
146
+ requestAniFrame(() => {
147
+ goRight(target, rightLocation);
148
+ });
149
+ }
150
+ }
151
+ if (props.direction != "x") {
152
+ target.style.top = state.yPum + "px";
153
+ }
154
+ }
155
+ function touchStart(e) {
156
+ const target = e.currentTarget;
157
+ const touches = e.touches[0];
158
+ const touch = e.targetTouches[0];
159
+ state.startTop = target.offsetTop;
160
+ state.startLeft = target.offsetLeft;
161
+ state.position.x = touches.clientX;
162
+ state.position.y = touches.clientY;
163
+ state.nx = touch.clientX - state.position.x;
164
+ state.ny = touch.clientY - state.position.y;
165
+ state.xPum = state.startLeft + state.nx;
166
+ state.yPum = state.startTop + state.ny;
167
+ }
168
+ onMounted(() => {
169
+ getInfo();
170
+ state.boundary = props.boundary;
171
+ });
172
+ onActivated(() => {
173
+ if (state.keepAlive) {
174
+ state.keepAlive = false;
175
+ }
176
+ });
177
+ onDeactivated(() => {
178
+ state.keepAlive = true;
179
+ myDrag.removeEventListener("touchstart", touchStart);
180
+ myDrag.removeEventListener("touchmove", touchMove);
181
+ myDrag.removeEventListener("touchend", touchEnd);
182
+ });
183
+ return {
184
+ classes,
185
+ myDrag,
186
+ touchStart,
187
+ touchMove,
188
+ touchEnd
189
+ };
35
190
  }
36
- function m(t2) {
37
- const e2 = t2.currentTarget;
38
- let o2 = t2.changedTouches[0].clientX;
39
- const n2 = c2.screenWidth - c2.elWidth - c2.boundary.right;
40
- o2 = o2 > n2 ? n2 : o2 < c2.boundary.left || o2 < c2.screenWidth / 2 ? c2.boundary.left : n2, i2.direction != "y" && i2.attract && (o2 < c2.screenWidth / 2 ? p(() => {
41
- y2(e2);
42
- }) : p(() => {
43
- d2(e2, n2);
44
- })), i2.direction != "x" && (e2.style.top = c2.yPum + "px");
45
- }
46
- function x(t2) {
47
- const e2 = t2.currentTarget, o2 = t2.touches[0], n2 = t2.targetTouches[0];
48
- c2.startTop = e2.offsetTop, c2.startLeft = e2.offsetLeft, c2.position.x = o2.clientX, c2.position.y = o2.clientY, c2.nx = n2.clientX - c2.position.x, c2.ny = n2.clientY - c2.position.y, c2.xPum = c2.startLeft + c2.nx, c2.yPum = c2.startTop + c2.ny;
49
- }
50
- return n(() => {
51
- !function() {
52
- const t2 = document.documentElement;
53
- c2.elWidth = u2.value.offsetWidth, c2.elHeight = u2.value.offsetHeight, c2.screenWidth = t2.clientWidth || 375, c2.screenHeight = t2.clientHeight || 667;
54
- }(), c2.boundary = i2.boundary;
55
- }), r(() => {
56
- c2.keepAlive && (c2.keepAlive = false);
57
- }), s(() => {
58
- c2.keepAlive = true, u2.removeEventListener("touchstart", x), u2.removeEventListener("touchmove", h2), u2.removeEventListener("touchend", m);
59
- }), { classes: a2, myDrag: u2, touchStart: x, touchMove: h2, touchEnd: m };
60
- } }), [["render", function(t2, e2, o2, n2, r2, s2) {
61
- return i(), l("view", { class: u(t2.classes), ref: "myDrag", onTouchstart: e2[0] || (e2[0] = (e3) => t2.touchStart(e3)), onTouchmove: e2[1] || (e2[1] = (e3) => t2.touchMove(e3)), onTouchend: e2[2] || (e2[2] = (e3) => t2.touchEnd(e3)) }, [c(t2.$slots, "default")], 34);
62
- }]]);
63
- export { h as default };
191
+ });
192
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
193
+ return openBlock(), createElementBlock("view", {
194
+ class: normalizeClass(_ctx.classes),
195
+ ref: "myDrag",
196
+ onTouchstart: _cache[0] || (_cache[0] = ($event) => _ctx.touchStart($event)),
197
+ onTouchmove: _cache[1] || (_cache[1] = ($event) => _ctx.touchMove($event)),
198
+ onTouchend: _cache[2] || (_cache[2] = ($event) => _ctx.touchEnd($event))
199
+ }, [
200
+ renderSlot(_ctx.$slots, "default")
201
+ ], 34);
202
+ }
203
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
204
+ export { index as default };
@@ -1,29 +1,164 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e, watch as a, resolveComponent as t, openBlock as u, createElementBlock as l, createElementVNode as n, toDisplayString as r, Fragment as c, renderList as i, normalizeClass as d, withDirectives as o, vModelText as p, createTextVNode as m, createVNode as s } from "vue";
7
- import { c as v } from "./component.js";
8
- import { _ as h } from "./plugin-vue_export-helper.js";
6
+ import { ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, renderList, normalizeClass, withDirectives, vModelText, createTextVNode, createVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: _, create: x, translate: g } = v("ecard"), f = x({ props: { chooseText: { type: String, default: "" }, otherValueText: { type: String, default: "" }, dataList: { type: [Object, Array], default: () => [] }, cardAmountMin: { type: Number, default: 1 }, cardAmountMax: { type: Number, default: 9999 }, cardBuyMin: { type: Number, default: 1 }, cardBuyMax: { type: Number, default: 9999 }, modelValue: { type: [Number, String], default: 0 }, placeholder: { type: String, default: "" }, suffix: { type: String, default: "\xA5" } }, emits: ["inputChange", "changeStep", "inputClick", "change", "update:modelValue"], setup(t2, { emit: u2 }) {
11
- const l2 = e(null), n2 = e(null), r2 = e(""), c2 = e(t2.cardAmountMin), i2 = e(t2.modelValue);
12
- return a(() => t2.modelValue, (e2) => {
13
- i2.value = e2;
14
- }), { handleClick: (e2, a2) => {
15
- l2.value = a2, c2.value = t2.cardAmountMin, n2.value = e2.price, u2("change", e2), u2("update:modelValue", e2.price);
16
- }, changeStep: (e2) => {
17
- c2.value = e2, u2("changeStep", c2.value, n2.value);
18
- }, change: (e2) => {
19
- let a2 = e2.target.value.replace(/[^\d]/g, "");
20
- r2.value = a2, n2.value = a2, Number(a2) > t2.cardAmountMax && (r2.value = t2.cardAmountMax, n2.value = t2.cardAmountMax), Number(a2) < t2.cardAmountMin && (r2.value = t2.cardAmountMin, n2.value = t2.cardAmountMin), u2("inputChange", Number(r2.value)), u2("update:modelValue", Number(r2.value));
21
- }, inputClick: () => {
22
- l2.value = "input", c2.value = t2.cardAmountMin, n2.value = r2.value, u2("update:modelValue", r2.value), u2("inputClick");
23
- }, stepValue: c2, currentIndex: l2, inputValue: r2, money: i2, translate: g };
24
- } }), V = { class: "nut-ecard" }, y = { class: "nut-ecard__title" }, M = { class: "nut-ecard__list" }, C = ["onClick"], A = { class: "nut-ecard__list__input--con" }, b = ["placeholder"], k = { class: "nut-ecard__list__step" };
25
- var N = h(f, [["render", function(e2, a2, v2, h2, _2, x2) {
26
- const g2 = t("nut-inputnumber");
27
- return u(), l("view", V, [n("view", y, r(e2.chooseText || e2.translate("chooseText")), 1), n("view", M, [(u(true), l(c, null, i(e2.dataList, (a3, t2) => (u(), l("view", { key: t2, class: d(["nut-ecard__list__item", e2.currentIndex == t2 ? "active" : ""]), onClick: (u2) => e2.handleClick(a3, t2) }, r(a3.price), 11, C))), 128)), n("view", { class: d(["nut-ecard__list__input", e2.currentIndex == "input" ? "active" : ""]), onClick: a2[2] || (a2[2] = (...a3) => e2.inputClick && e2.inputClick(...a3)) }, [n("view", null, r(e2.otherValueText || e2.translate("otherValueText")), 1), n("view", A, [o(n("input", { class: "nut-ecard__list__input--input", type: "text", "onUpdate:modelValue": a2[0] || (a2[0] = (a3) => e2.inputValue = a3), onInput: a2[1] || (a2[1] = (...a3) => e2.change && e2.change(...a3)), placeholder: e2.placeholder || e2.translate("placeholder") }, null, 40, b), [[p, e2.inputValue]]), m(" " + r(e2.suffix), 1)])], 2), n("view", k, [n("view", null, r(e2.suffix) + r(e2.money), 1), s(g2, { modelValue: e2.stepValue, "onUpdate:modelValue": a2[3] || (a2[3] = (a3) => e2.stepValue = a3), min: e2.cardBuyMin, max: e2.cardBuyMax, onChange: e2.changeStep }, null, 8, ["modelValue", "min", "max", "onChange"])])])]);
28
- }]]);
29
- export { N as default };
10
+ const { componentName, create, translate } = createComponent("ecard");
11
+ const _sfc_main = create({
12
+ props: {
13
+ chooseText: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ otherValueText: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ dataList: {
22
+ type: [Object, Array],
23
+ default: () => {
24
+ return [];
25
+ }
26
+ },
27
+ cardAmountMin: {
28
+ type: Number,
29
+ default: 1
30
+ },
31
+ cardAmountMax: {
32
+ type: Number,
33
+ default: 9999
34
+ },
35
+ cardBuyMin: {
36
+ type: Number,
37
+ default: 1
38
+ },
39
+ cardBuyMax: {
40
+ type: Number,
41
+ default: 9999
42
+ },
43
+ modelValue: {
44
+ type: [Number, String],
45
+ default: 0
46
+ },
47
+ placeholder: {
48
+ type: String,
49
+ default: ""
50
+ },
51
+ suffix: {
52
+ type: String,
53
+ default: "\xA5"
54
+ }
55
+ },
56
+ emits: ["inputChange", "changeStep", "inputClick", "change", "update:modelValue"],
57
+ setup(props, { emit }) {
58
+ const currentIndex = ref(null);
59
+ const currentValue = ref(null);
60
+ const inputValue = ref("");
61
+ const stepValue = ref(props.cardAmountMin);
62
+ const money = ref(props.modelValue);
63
+ const handleClick = (item, index2) => {
64
+ currentIndex.value = index2;
65
+ stepValue.value = props.cardAmountMin;
66
+ currentValue.value = item.price;
67
+ emit("change", item);
68
+ emit("update:modelValue", item.price);
69
+ };
70
+ const change = (event) => {
71
+ let input = event.target;
72
+ let val = input.value.replace(/[^\d]/g, "");
73
+ inputValue.value = val;
74
+ currentValue.value = val;
75
+ if (Number(val) > props.cardAmountMax) {
76
+ inputValue.value = props.cardAmountMax;
77
+ currentValue.value = props.cardAmountMax;
78
+ }
79
+ if (Number(val) < props.cardAmountMin) {
80
+ inputValue.value = props.cardAmountMin;
81
+ currentValue.value = props.cardAmountMin;
82
+ }
83
+ emit("inputChange", Number(inputValue.value));
84
+ emit("update:modelValue", Number(inputValue.value));
85
+ };
86
+ const inputClick = () => {
87
+ currentIndex.value = "input";
88
+ stepValue.value = props.cardAmountMin;
89
+ currentValue.value = inputValue.value;
90
+ emit("update:modelValue", inputValue.value);
91
+ emit("inputClick");
92
+ };
93
+ const changeStep = (value) => {
94
+ stepValue.value = value;
95
+ emit("changeStep", stepValue.value, currentValue.value);
96
+ };
97
+ watch(() => props.modelValue, (value) => {
98
+ money.value = value;
99
+ });
100
+ return {
101
+ handleClick,
102
+ changeStep,
103
+ change,
104
+ inputClick,
105
+ stepValue,
106
+ currentIndex,
107
+ inputValue,
108
+ money,
109
+ translate
110
+ };
111
+ }
112
+ });
113
+ const _hoisted_1 = { class: "nut-ecard" };
114
+ const _hoisted_2 = { class: "nut-ecard__title" };
115
+ const _hoisted_3 = { class: "nut-ecard__list" };
116
+ const _hoisted_4 = ["onClick"];
117
+ const _hoisted_5 = { class: "nut-ecard__list__input--con" };
118
+ const _hoisted_6 = ["placeholder"];
119
+ const _hoisted_7 = { class: "nut-ecard__list__step" };
120
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
121
+ const _component_nut_inputnumber = resolveComponent("nut-inputnumber");
122
+ return openBlock(), createElementBlock("view", _hoisted_1, [
123
+ createElementVNode("view", _hoisted_2, toDisplayString(_ctx.chooseText || _ctx.translate("chooseText")), 1),
124
+ createElementVNode("view", _hoisted_3, [
125
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataList, (item, index2) => {
126
+ return openBlock(), createElementBlock("view", {
127
+ key: index2,
128
+ class: normalizeClass(["nut-ecard__list__item", _ctx.currentIndex == index2 ? "active" : ""]),
129
+ onClick: ($event) => _ctx.handleClick(item, index2)
130
+ }, toDisplayString(item.price), 11, _hoisted_4);
131
+ }), 128)),
132
+ createElementVNode("view", {
133
+ class: normalizeClass(["nut-ecard__list__input", _ctx.currentIndex == "input" ? "active" : ""]),
134
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.inputClick && _ctx.inputClick(...args))
135
+ }, [
136
+ createElementVNode("view", null, toDisplayString(_ctx.otherValueText || _ctx.translate("otherValueText")), 1),
137
+ createElementVNode("view", _hoisted_5, [
138
+ withDirectives(createElementVNode("input", {
139
+ class: "nut-ecard__list__input--input",
140
+ type: "text",
141
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.inputValue = $event),
142
+ onInput: _cache[1] || (_cache[1] = (...args) => _ctx.change && _ctx.change(...args)),
143
+ placeholder: _ctx.placeholder || _ctx.translate("placeholder")
144
+ }, null, 40, _hoisted_6), [
145
+ [vModelText, _ctx.inputValue]
146
+ ]),
147
+ createTextVNode(" " + toDisplayString(_ctx.suffix), 1)
148
+ ])
149
+ ], 2),
150
+ createElementVNode("view", _hoisted_7, [
151
+ createElementVNode("view", null, toDisplayString(_ctx.suffix) + toDisplayString(_ctx.money), 1),
152
+ createVNode(_component_nut_inputnumber, {
153
+ modelValue: _ctx.stepValue,
154
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.stepValue = $event),
155
+ min: _ctx.cardBuyMin,
156
+ max: _ctx.cardBuyMax,
157
+ onChange: _ctx.changeStep
158
+ }, null, 8, ["modelValue", "min", "max", "onChange"])
159
+ ])
160
+ ])
161
+ ]);
162
+ }
163
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
164
+ export { index as default };