@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.
- package/CHANGELOG.md +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +20412 -4214
- package/dist/nutui.umd.js +20518 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +454 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/packages/picker/index.scss +13 -0
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +4 -1
- package/dist/styles/variables-jdt.scss +4 -1
- package/dist/styles/variables.scss +1 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
- package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,63 +1,204 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
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
|
|
7
|
-
import { c as
|
|
8
|
-
import { r as
|
|
9
|
-
import { _ as
|
|
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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.
|
|
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
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 };
|