@nutui/nutui 3.2.6-beta.1 → 3.2.6
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 +31 -0
- package/README.md +18 -4
- package/dist/nutui.es.js +4461 -4135
- package/dist/nutui.umd.js +4559 -4133
- package/dist/packages/_es/ActionSheet.js +19 -18
- package/dist/packages/_es/Address.js +85 -94
- package/dist/packages/_es/AddressList.js +12 -25
- package/dist/packages/_es/Animate.js +3 -3
- package/dist/packages/_es/Audio.js +2 -9
- package/dist/packages/_es/AudioOperate.js +1 -5
- package/dist/packages/_es/Avatar.js +10 -10
- package/dist/packages/_es/AvatarGroup.js +5 -5
- package/dist/packages/_es/BackTop.js +108 -55
- package/dist/packages/_es/Badge.js +12 -10
- package/dist/packages/_es/Barrage.js +103 -79
- package/dist/packages/_es/Button.js +3 -5
- package/dist/packages/_es/Calendar.js +23 -36
- package/dist/packages/_es/CalendarItem.js +3 -4
- package/dist/packages/_es/Card.js +5 -15
- package/dist/packages/_es/Cascader.js +11 -12
- package/dist/packages/_es/Category.js +12 -13
- package/dist/packages/_es/CategoryPane.js +13 -17
- package/dist/packages/_es/Cell.js +12 -9
- package/dist/packages/_es/CellGroup.js +2 -4
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +2 -2
- package/dist/packages/_es/CircleProgress.js +82 -98
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +34 -65
- package/dist/packages/_es/CollapseItem.js +60 -93
- package/dist/packages/_es/Comment.js +19 -43
- package/dist/packages/_es/ConfigProvider.js +1 -1
- package/dist/packages/_es/CountDown.js +3 -3
- package/dist/packages/_es/CountUp.js +52 -47
- package/dist/packages/_es/DatePicker.js +54 -37
- package/dist/packages/_es/Dialog.js +88 -9
- package/dist/packages/_es/Divider.js +3 -3
- package/dist/packages/_es/Drag.js +49 -75
- package/dist/packages/_es/Ecard.js +18 -20
- package/dist/packages/_es/Elevator.js +76 -101
- package/dist/packages/_es/Ellipsis.js +100 -140
- package/dist/packages/_es/Empty.js +4 -6
- package/dist/packages/_es/FixedNav.js +6 -11
- package/dist/packages/_es/Form.js +4 -4
- package/dist/packages/_es/FormItem.js +1 -3
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +27 -10
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/Image.js +114 -13
- package/dist/packages/_es/ImagePreview.js +411 -149
- package/dist/packages/_es/Indicator.js +3 -3
- package/dist/packages/_es/InfiniteLoading.js +115 -103
- package/dist/packages/_es/Input.js +32 -56
- package/dist/packages/_es/InputNumber.js +16 -25
- package/dist/packages/_es/Invoice.js +5 -6
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/List.js +34 -47
- package/dist/packages/_es/Menu.js +35 -35
- package/dist/packages/_es/MenuItem.js +29 -56
- package/dist/packages/_es/Navbar.js +39 -49
- package/dist/packages/_es/NoticeBar.js +45 -54
- package/dist/packages/_es/Notify.js +162 -44
- package/dist/packages/_es/NumberKeyboard.js +20 -15
- package/dist/packages/_es/OldPicker.js +116 -130
- package/dist/packages/_es/OverLay.js +28 -5
- package/dist/packages/_es/Pagination.js +5 -8
- package/dist/packages/_es/Picker.js +74 -198
- package/dist/packages/_es/Popover.js +881 -201
- package/dist/packages/_es/Popup.js +84 -28
- package/dist/packages/_es/Price.js +6 -22
- package/dist/packages/_es/Progress.js +11 -18
- package/dist/packages/_es/PullRefresh.js +2 -4
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +34 -48
- package/dist/packages/_es/Rate.js +14 -15
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +36 -39
- package/dist/packages/_es/ShortPassword.js +66 -97
- package/dist/packages/_es/SideNavBar.js +18 -7
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +80 -113
- package/dist/packages/_es/Skeleton.js +11 -12
- package/dist/packages/_es/Sku.js +38 -63
- package/dist/packages/_es/Step.js +2 -7
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +23 -33
- package/dist/packages/_es/SubSideNavBar.js +2 -4
- package/dist/packages/_es/Swipe.js +26 -41
- package/dist/packages/_es/Swiper.js +21 -38
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +8 -8
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +13 -15
- package/dist/packages/_es/TabbarItem.js +30 -24
- package/dist/packages/_es/Table.js +17 -22
- package/dist/packages/_es/Tabs.js +16 -49
- package/dist/packages/_es/Tag.js +5 -6
- package/dist/packages/_es/TextArea.js +49 -114
- package/dist/packages/_es/TimeDetail.js +3 -4
- package/dist/packages/_es/TimePannel.js +3 -3
- package/dist/packages/_es/TimeSelect.js +10 -12
- package/dist/packages/_es/Toast.js +164 -53
- package/dist/packages/_es/TrendArrow.js +4 -6
- package/dist/packages/_es/Uploader.js +140 -141
- package/dist/packages/_es/Video.js +18 -39
- package/dist/packages/_es/WaterMark.js +14 -22
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +6 -44
- package/dist/packages/_es/index2.js +31 -8
- package/dist/packages/_es/index3.js +7 -64
- package/dist/packages/_es/index4.js +62 -424
- package/dist/packages/_es/{index.taro.js → index5.js} +154 -167
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/style.css +3 -21
- package/dist/packages/checkbox/index.scss +1 -0
- package/dist/packages/locale/lang/baseLang.js +1 -1
- package/dist/packages/locale/lang/en-US.js +1 -1
- package/dist/packages/locale/lang/id-ID.js +1 -1
- package/dist/packages/locale/lang/index.js +1 -1
- package/dist/packages/locale/lang/zh-CN.js +1 -1
- package/dist/packages/locale/lang/zh-TW.js +1 -1
- package/dist/packages/menuitem/index.scss +12 -3
- package/dist/smartips/attributes.json +5 -1
- package/dist/smartips/tags.json +1 -0
- package/dist/smartips/web-types.json +11 -2
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jddkh.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/types/__VUE/actionsheet/{index.taro.vue.d.ts → index.vue.d.ts} +9 -9
- package/dist/types/__VUE/address/{index.taro.vue.d.ts → index.vue.d.ts} +32 -72
- package/dist/types/__VUE/addresslist/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/animate/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/avatar/{index.taro.vue.d.ts → index.vue.d.ts} +6 -6
- package/dist/types/__VUE/avatargroup/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/backtop/{index.taro.vue.d.ts → index.vue.d.ts} +37 -15
- package/dist/types/__VUE/badge/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/barrage/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +1 -1
- package/dist/types/__VUE/calendar/{index.taro.vue.d.ts → index.vue.d.ts} +1 -13
- package/dist/types/__VUE/calendaritem/{index.taro.vue.d.ts → index.vue.d.ts} +17 -17
- package/dist/types/__VUE/card/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/cascader/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
- package/dist/types/__VUE/category/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/categorypane/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/cell/{index.taro.vue.d.ts → index.vue.d.ts} +6 -13
- package/dist/types/__VUE/checkbox/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/circleprogress/{index.taro.vue.d.ts → index.vue.d.ts} +15 -14
- package/dist/types/__VUE/collapse/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
- package/dist/types/__VUE/collapseitem/{index.taro.vue.d.ts → index.vue.d.ts} +10 -2
- package/dist/types/__VUE/comment/{index.taro.vue.d.ts → index.vue.d.ts} +2 -1
- package/dist/types/__VUE/configprovider/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/countdown/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/countup/{index.taro.vue.d.ts → index.vue.d.ts} +7 -5
- package/dist/types/__VUE/datepicker/{index.taro.vue.d.ts → index.vue.d.ts} +5 -5
- package/dist/types/__VUE/dialog/index.d.ts +48 -0
- package/dist/types/__VUE/dialog/{index.taro.vue.d.ts → index.vue.d.ts} +12 -9
- package/dist/types/__VUE/divider/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/drag/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
- package/dist/types/__VUE/ecard/{index.taro.vue.d.ts → index.vue.d.ts} +3 -3
- package/dist/types/__VUE/elevator/{index.taro.vue.d.ts → index.vue.d.ts} +2 -11
- package/dist/types/__VUE/ellipsis/{index.taro.vue.d.ts → index.vue.d.ts} +0 -4
- package/dist/types/__VUE/empty/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/fixednav/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/form/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/grid/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
- package/dist/types/__VUE/griditem/{index.taro.vue.d.ts → index.vue.d.ts} +27 -2
- package/dist/types/__VUE/image/index.vue.d.ts +117 -0
- package/dist/types/__VUE/image/type.d.ts +6 -0
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +109 -0
- package/dist/types/__VUE/imagepreview/index.d.ts +25 -0
- package/dist/types/__VUE/imagepreview/{index.taro.vue.d.ts → index.vue.d.ts} +44 -33
- package/dist/types/__VUE/indicator/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/infiniteloading/{index.taro.vue.d.ts → index.vue.d.ts} +8 -15
- package/dist/types/__VUE/input/{index.taro.vue.d.ts → index.vue.d.ts} +16 -34
- package/dist/types/__VUE/inputnumber/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
- package/dist/types/__VUE/invoice/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/layout/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/list/{index.taro.vue.d.ts → index.vue.d.ts} +2 -2
- package/dist/types/__VUE/menu/{index.taro.vue.d.ts → index.vue.d.ts} +0 -1
- package/dist/types/__VUE/menuitem/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/navbar/{index.taro.vue.d.ts → index.vue.d.ts} +2 -1
- package/dist/types/__VUE/noticebar/{index.taro.vue.d.ts → index.vue.d.ts} +4 -4
- package/dist/types/__VUE/notify/index.d.ts +26 -0
- package/dist/types/__VUE/notify/{index.taro.vue.d.ts → index.vue.d.ts} +18 -5
- package/dist/types/__VUE/numberkeyboard/{index.taro.vue.d.ts → index.vue.d.ts} +29 -5
- package/dist/types/__VUE/oldpicker/{ColumnTaro.vue.d.ts → Column.vue.d.ts} +17 -28
- package/dist/types/__VUE/oldpicker/{index.taro.vue.d.ts → index.vue.d.ts} +44 -64
- package/dist/types/__VUE/pagination/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/picker/{ColumnTaro.vue.d.ts → Column.vue.d.ts} +4 -16
- package/dist/types/__VUE/picker/{index.taro.vue.d.ts → index.vue.d.ts} +28 -53
- package/dist/types/__VUE/popover/{index.taro.vue.d.ts → index.vue.d.ts} +12 -14
- package/dist/types/__VUE/popup/index.vue.d.ts +1 -1
- package/dist/types/__VUE/price/{index.taro.vue.d.ts → index.vue.d.ts} +0 -1
- package/dist/types/__VUE/progress/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
- package/dist/types/__VUE/radio/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/range/{index.taro.vue.d.ts → index.vue.d.ts} +6 -7
- package/dist/types/__VUE/rate/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/searchbar/{index.taro.vue.d.ts → index.vue.d.ts} +19 -19
- package/dist/types/__VUE/shortpassword/{index.taro.vue.d.ts → index.vue.d.ts} +21 -6
- package/dist/types/__VUE/sidenavbar/{index.taro.vue.d.ts → index.vue.d.ts} +5 -0
- package/dist/types/__VUE/signature/{index.taro.vue.d.ts → index.vue.d.ts} +5 -8
- package/dist/types/__VUE/skeleton/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/sku/index.vue.d.ts +310 -0
- package/dist/types/__VUE/step/index.vue.d.ts +1 -1
- package/dist/types/__VUE/steps/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/sticky/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/swipe/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
- package/dist/types/__VUE/swiper/{index.taro.vue.d.ts → index.vue.d.ts} +1 -2
- package/dist/types/__VUE/swiperitem/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/switch/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/tabbar/{index.taro.vue.d.ts → index.vue.d.ts} +2 -1
- package/dist/types/__VUE/tabbaritem/{index.taro.vue.d.ts → index.vue.d.ts} +9 -9
- package/dist/types/__VUE/table/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/tabs/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/tag/{index.taro.vue.d.ts → index.vue.d.ts} +4 -4
- package/dist/types/__VUE/tag/type.d.ts +5 -0
- package/dist/types/__VUE/textarea/{index.taro.vue.d.ts → index.vue.d.ts} +3 -5
- package/dist/types/__VUE/timedetail/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/timepannel/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/timeselect/{index.taro.vue.d.ts → index.vue.d.ts} +8 -7
- package/dist/types/__VUE/toast/index.d.ts +16 -0
- package/dist/types/__VUE/toast/{index.taro.vue.d.ts → index.vue.d.ts} +22 -44
- package/dist/types/__VUE/trendarrow/{index.taro.vue.d.ts → index.vue.d.ts} +0 -0
- package/dist/types/__VUE/uploader/{index.taro.vue.d.ts → index.vue.d.ts} +11 -20
- package/dist/types/__VUE/watermark/{index.taro.vue.d.ts → index.vue.d.ts} +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +89 -89
- package/package.json +3 -2
- package/dist/packages/_es/use-lock-scroll.js +0 -23
- package/dist/types/__VUE/button/index.taro.vue.d.ts +0 -116
- package/dist/types/__VUE/icon/index.taro.vue.d.ts +0 -74
- package/dist/types/__VUE/image/index.taro.vue.d.ts +0 -33
- package/dist/types/__VUE/overlay/index.taro.vue.d.ts +0 -85
- package/dist/types/__VUE/popup/index.taro.vue.d.ts +0 -1728
- package/dist/types/__VUE/sku/index.taro.vue.d.ts +0 -182
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.2.6
|
|
2
|
+
* @nutui/nutui v3.2.6 Fri Nov 04 2022 18:06:53 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive, computed, onMounted, toRefs, resolveComponent, openBlock,
|
|
6
|
+
import { reactive, computed, onMounted, onUnmounted, ref, onActivated, onDeactivated, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createVNode, mergeProps, toDisplayString, renderSlot, Fragment, createCommentVNode } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
-
import _sfc_main$1 from "./Icon.js";
|
|
9
|
-
import Taro from "@tarojs/taro";
|
|
10
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
11
9
|
import "../locale/lang";
|
|
12
|
-
import "./pxCheck.js";
|
|
13
10
|
const { componentName, create, translate } = createComponent("infiniteloading");
|
|
14
11
|
const _sfc_main = create({
|
|
15
12
|
props: {
|
|
@@ -21,10 +18,6 @@ const _sfc_main = create({
|
|
|
21
18
|
type: Number,
|
|
22
19
|
default: 200
|
|
23
20
|
},
|
|
24
|
-
upperThreshold: {
|
|
25
|
-
type: Number,
|
|
26
|
-
default: 40
|
|
27
|
-
},
|
|
28
21
|
pullIcon: {
|
|
29
22
|
type: String,
|
|
30
23
|
default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png"
|
|
@@ -63,16 +56,14 @@ const _sfc_main = create({
|
|
|
63
56
|
}
|
|
64
57
|
},
|
|
65
58
|
emits: ["scroll-change", "load-more", "refresh"],
|
|
66
|
-
components: {
|
|
67
|
-
"nut-icon": _sfc_main$1
|
|
68
|
-
},
|
|
69
59
|
setup(props, { emit, slots }) {
|
|
70
60
|
const state = reactive({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
scrollEl: window,
|
|
62
|
+
scroller: null,
|
|
63
|
+
refreshTop: null,
|
|
64
|
+
beforeScrollTop: 0,
|
|
75
65
|
isTouching: false,
|
|
66
|
+
isInfiniting: false,
|
|
76
67
|
refreshMaxH: 0,
|
|
77
68
|
y: 0,
|
|
78
69
|
x: 0,
|
|
@@ -90,44 +81,67 @@ const _sfc_main = create({
|
|
|
90
81
|
transition: state.isTouching ? `height 0s cubic-bezier(0.25,0.1,0.25,1)` : `height 0.2s cubic-bezier(0.25,0.1,0.25,1)`
|
|
91
82
|
};
|
|
92
83
|
});
|
|
93
|
-
const
|
|
94
|
-
return
|
|
84
|
+
const requestAniFrame = () => {
|
|
85
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
|
|
86
|
+
window.setTimeout(callback, 1e3 / 60);
|
|
87
|
+
};
|
|
95
88
|
};
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
parentElement.boundingClientRect((rect) => {
|
|
99
|
-
state.scrollHeight = rect.height;
|
|
100
|
-
}).exec();
|
|
89
|
+
const getWindowScrollTop = () => {
|
|
90
|
+
return window.pageYOffset !== void 0 ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
|
|
101
91
|
};
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
return false;
|
|
105
|
-
} else {
|
|
106
|
-
state.isInfiniting = true;
|
|
107
|
-
emit("load-more", infiniteDone);
|
|
108
|
-
}
|
|
92
|
+
const calculateTopPosition = (el) => {
|
|
93
|
+
return !el ? 0 : el.offsetTop + calculateTopPosition(el.offsetParent);
|
|
109
94
|
};
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
const isScrollAtBottom = () => {
|
|
96
|
+
let offsetDistance = 0;
|
|
97
|
+
let resScrollTop = 0;
|
|
98
|
+
let direction = "down";
|
|
99
|
+
const windowScrollTop = getWindowScrollTop();
|
|
100
|
+
if (props.useWindow) {
|
|
101
|
+
if (state.scroller) {
|
|
102
|
+
offsetDistance = calculateTopPosition(state.scroller) + state.scroller.offsetHeight - windowScrollTop - window.innerHeight;
|
|
103
|
+
}
|
|
104
|
+
resScrollTop = windowScrollTop;
|
|
105
|
+
} else {
|
|
106
|
+
const { scrollHeight, clientHeight, scrollTop } = state.scrollEl;
|
|
107
|
+
offsetDistance = scrollHeight - clientHeight - scrollTop;
|
|
108
|
+
resScrollTop = scrollTop;
|
|
115
109
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
110
|
+
if (state.beforeScrollTop > resScrollTop) {
|
|
111
|
+
direction = "up";
|
|
118
112
|
} else {
|
|
119
|
-
|
|
113
|
+
direction = "down";
|
|
120
114
|
}
|
|
121
|
-
state.
|
|
122
|
-
emit("scroll-change",
|
|
115
|
+
state.beforeScrollTop = resScrollTop;
|
|
116
|
+
emit("scroll-change", resScrollTop);
|
|
117
|
+
return offsetDistance <= props.threshold && direction == "down";
|
|
123
118
|
};
|
|
124
119
|
const infiniteDone = () => {
|
|
125
120
|
state.isInfiniting = false;
|
|
126
121
|
};
|
|
122
|
+
const handleScroll = () => {
|
|
123
|
+
requestAniFrame()(() => {
|
|
124
|
+
if (!isScrollAtBottom() || !props.hasMore || state.isInfiniting) {
|
|
125
|
+
return false;
|
|
126
|
+
} else {
|
|
127
|
+
state.isInfiniting = true;
|
|
128
|
+
emit("load-more", infiniteDone);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
const scrollListener = () => {
|
|
133
|
+
state.scrollEl.addEventListener("scroll", handleScroll, props.useCapture);
|
|
134
|
+
};
|
|
135
|
+
const refreshDone = () => {
|
|
136
|
+
state.distance = 0;
|
|
137
|
+
state.isTouching = false;
|
|
138
|
+
};
|
|
127
139
|
const touchStart = (event) => {
|
|
128
|
-
if (state.
|
|
140
|
+
if (state.beforeScrollTop == 0 && !state.isTouching && props.isOpenRefresh) {
|
|
129
141
|
state.y = event.touches[0].pageY;
|
|
130
142
|
state.isTouching = true;
|
|
143
|
+
const childHeight = state.refreshTop.firstElementChild.offsetHeight;
|
|
144
|
+
state.refreshMaxH = Math.floor(childHeight * 1 + 10);
|
|
131
145
|
}
|
|
132
146
|
};
|
|
133
147
|
const touchMove = (event) => {
|
|
@@ -142,39 +156,50 @@ const _sfc_main = create({
|
|
|
142
156
|
}
|
|
143
157
|
};
|
|
144
158
|
const touchEnd = () => {
|
|
145
|
-
if (state.distance
|
|
146
|
-
state.distance
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
if (state.distance) {
|
|
160
|
+
if (state.distance < state.refreshMaxH) {
|
|
161
|
+
state.distance = 0;
|
|
162
|
+
} else {
|
|
163
|
+
emit("refresh", refreshDone);
|
|
164
|
+
}
|
|
149
165
|
}
|
|
150
166
|
};
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
state.isTouching = false;
|
|
167
|
+
const getParentElement = (el) => {
|
|
168
|
+
return !!props.containerId ? document.querySelector(`#${props.containerId}`) : el && el.parentNode;
|
|
154
169
|
};
|
|
155
170
|
onMounted(() => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
const parentElement = getParentElement(state.scroller);
|
|
172
|
+
state.scrollEl = props.useWindow ? window : parentElement;
|
|
173
|
+
scrollListener();
|
|
174
|
+
console.log(slots);
|
|
175
|
+
});
|
|
176
|
+
onUnmounted(() => {
|
|
177
|
+
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
178
|
+
});
|
|
179
|
+
const isKeepAlive = ref(false);
|
|
180
|
+
onActivated(() => {
|
|
181
|
+
if (isKeepAlive.value) {
|
|
182
|
+
isKeepAlive.value = false;
|
|
183
|
+
scrollListener();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
onDeactivated(() => {
|
|
187
|
+
isKeepAlive.value = true;
|
|
188
|
+
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
160
189
|
});
|
|
161
190
|
return {
|
|
162
191
|
classes,
|
|
163
192
|
...toRefs(state),
|
|
164
|
-
lower,
|
|
165
|
-
scroll,
|
|
166
193
|
touchStart,
|
|
167
194
|
touchMove,
|
|
168
195
|
touchEnd,
|
|
169
196
|
getStyle,
|
|
170
|
-
translate
|
|
197
|
+
translate,
|
|
198
|
+
slots
|
|
171
199
|
};
|
|
172
200
|
}
|
|
173
201
|
});
|
|
174
|
-
const _hoisted_1 = {
|
|
175
|
-
class: "top-box",
|
|
176
|
-
id: "refreshTop"
|
|
177
|
-
};
|
|
202
|
+
const _hoisted_1 = { class: "top-box" };
|
|
178
203
|
const _hoisted_2 = { class: "top-text" };
|
|
179
204
|
const _hoisted_3 = { class: "nut-infinite-container" };
|
|
180
205
|
const _hoisted_4 = { class: "nut-infinite-bottom" };
|
|
@@ -184,55 +209,42 @@ const _hoisted_5 = {
|
|
|
184
209
|
};
|
|
185
210
|
const _hoisted_6 = { class: "bottom-text" };
|
|
186
211
|
const _hoisted_7 = {
|
|
187
|
-
key:
|
|
212
|
+
key: 0,
|
|
188
213
|
class: "tips"
|
|
189
214
|
};
|
|
190
215
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
191
216
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
192
|
-
|
|
193
|
-
if (process.env.TARO_ENV === "h5") {
|
|
194
|
-
return "taro-scroll-view";
|
|
195
|
-
} else {
|
|
196
|
-
return "scroll-view";
|
|
197
|
-
}
|
|
198
|
-
}());
|
|
199
|
-
return openBlock(), createBlock(_component_scroll_view, {
|
|
217
|
+
return openBlock(), createElementBlock("view", {
|
|
200
218
|
class: normalizeClass(_ctx.classes),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
createElementVNode("view",
|
|
212
|
-
class: "
|
|
213
|
-
|
|
214
|
-
}, [
|
|
215
|
-
createElementVNode("view", _hoisted_1, [
|
|
216
|
-
createVNode(_component_nut_icon, mergeProps({ class: "top-img" }, _ctx.$attrs, { name: _ctx.pullIcon }), null, 16, ["name"]),
|
|
217
|
-
createTextVNode(),
|
|
218
|
-
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.pullTxt || _ctx.translate("pullTxt")), 1)
|
|
219
|
-
])
|
|
220
|
-
], 4),
|
|
221
|
-
createTextVNode(),
|
|
222
|
-
createElementVNode("view", _hoisted_3, [
|
|
223
|
-
renderSlot(_ctx.$slots, "default")
|
|
224
|
-
]),
|
|
225
|
-
createTextVNode(),
|
|
226
|
-
createElementVNode("view", _hoisted_4, [
|
|
227
|
-
_ctx.isInfiniting ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
228
|
-
createVNode(_component_nut_icon, mergeProps({ class: "bottom-img" }, _ctx.$attrs, { name: _ctx.loadIcon }), null, 16, ["name"]),
|
|
229
|
-
createTextVNode(),
|
|
230
|
-
createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt || _ctx.translate("loading")), 1)
|
|
231
|
-
])) : !_ctx.hasMore ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt || _ctx.translate("loadMoreTxt")), 1)) : createCommentVNode("", true)
|
|
219
|
+
ref: "scroller",
|
|
220
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
|
|
221
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.touchMove && _ctx.touchMove(...args)),
|
|
222
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
|
|
223
|
+
}, [
|
|
224
|
+
createElementVNode("view", {
|
|
225
|
+
class: "nut-infinite-top",
|
|
226
|
+
ref: "refreshTop",
|
|
227
|
+
style: normalizeStyle(_ctx.getStyle)
|
|
228
|
+
}, [
|
|
229
|
+
createElementVNode("view", _hoisted_1, [
|
|
230
|
+
createVNode(_component_nut_icon, mergeProps({ class: "top-img" }, _ctx.$attrs, { name: _ctx.pullIcon }), null, 16, ["name"]),
|
|
231
|
+
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.pullTxt || _ctx.translate("pullTxt")), 1)
|
|
232
232
|
])
|
|
233
|
+
], 4),
|
|
234
|
+
createElementVNode("view", _hoisted_3, [
|
|
235
|
+
renderSlot(_ctx.$slots, "default")
|
|
233
236
|
]),
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
createElementVNode("view", _hoisted_4, [
|
|
238
|
+
_ctx.isInfiniting ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
239
|
+
!_ctx.slots.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
240
|
+
createVNode(_component_nut_icon, mergeProps({ class: "bottom-img" }, _ctx.$attrs, { name: _ctx.loadIcon }), null, 16, ["name"]),
|
|
241
|
+
createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt || _ctx.translate("loading")), 1)
|
|
242
|
+
], 64)) : renderSlot(_ctx.$slots, "loading", { key: 1 })
|
|
243
|
+
])) : !_ctx.hasMore ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
244
|
+
!_ctx.slots.finished ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt || _ctx.translate("loadMoreTxt")), 1)) : renderSlot(_ctx.$slots, "finished", { key: 1 })
|
|
245
|
+
], 64)) : createCommentVNode("", true)
|
|
246
|
+
])
|
|
247
|
+
], 34);
|
|
236
248
|
}
|
|
237
|
-
var
|
|
238
|
-
export {
|
|
249
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
250
|
+
export { index as default };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.2.6
|
|
2
|
+
* @nutui/nutui v3.2.6 Fri Nov 04 2022 18:06:53 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref, reactive, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, normalizeStyle, createElementVNode, toDisplayString, createCommentVNode,
|
|
6
|
+
import { ref, reactive, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, normalizeStyle, createElementVNode, toDisplayString, createCommentVNode, renderSlot, createVNode, mergeProps, withDirectives, createBlock, vShow, createTextVNode } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
10
|
function trimExtraChar(value, char, regExp) {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
11
|
+
const index2 = value.indexOf(char);
|
|
12
|
+
if (index2 === -1) {
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
-
if (char === "-" &&
|
|
16
|
-
return value.slice(0,
|
|
15
|
+
if (char === "-" && index2 !== 0) {
|
|
16
|
+
return value.slice(0, index2);
|
|
17
17
|
}
|
|
18
|
-
return value.slice(0,
|
|
18
|
+
return value.slice(0, index2 + 1) + value.slice(index2).replace(regExp, "");
|
|
19
19
|
}
|
|
20
20
|
function formatNumber(value, allowDot = true, allowMinus = true) {
|
|
21
21
|
if (allowDot) {
|
|
@@ -98,14 +98,14 @@ const _sfc_main = create({
|
|
|
98
98
|
type: [String, Number],
|
|
99
99
|
default: "9999"
|
|
100
100
|
},
|
|
101
|
-
leftIconSize: {
|
|
102
|
-
type: [String, Number],
|
|
103
|
-
default: ""
|
|
104
|
-
},
|
|
105
101
|
leftIcon: {
|
|
106
102
|
type: String,
|
|
107
103
|
default: ""
|
|
108
104
|
},
|
|
105
|
+
leftIconSize: {
|
|
106
|
+
type: [String, Number],
|
|
107
|
+
default: ""
|
|
108
|
+
},
|
|
109
109
|
rightIcon: {
|
|
110
110
|
type: String,
|
|
111
111
|
default: ""
|
|
@@ -161,14 +161,6 @@ const _sfc_main = create({
|
|
|
161
161
|
autofocus: {
|
|
162
162
|
type: Boolean,
|
|
163
163
|
default: false
|
|
164
|
-
},
|
|
165
|
-
confirmType: {
|
|
166
|
-
type: String,
|
|
167
|
-
default: "done"
|
|
168
|
-
},
|
|
169
|
-
adjustPosition: {
|
|
170
|
-
type: Boolean,
|
|
171
|
-
default: true
|
|
172
164
|
}
|
|
173
165
|
},
|
|
174
166
|
emits: [
|
|
@@ -184,7 +176,8 @@ const _sfc_main = create({
|
|
|
184
176
|
],
|
|
185
177
|
setup(props, { emit, slots }) {
|
|
186
178
|
const active = ref(false);
|
|
187
|
-
const inputRef = ref(
|
|
179
|
+
const inputRef = ref();
|
|
180
|
+
ref();
|
|
188
181
|
const getModelValue = () => {
|
|
189
182
|
var _a;
|
|
190
183
|
return String((_a = props.modelValue) != null ? _a : "");
|
|
@@ -232,10 +225,9 @@ const _sfc_main = create({
|
|
|
232
225
|
value = value.slice(0, Number(props.maxLength));
|
|
233
226
|
}
|
|
234
227
|
updateValue(value);
|
|
235
|
-
emit("update:modelValue", value, event);
|
|
236
|
-
emit("change", value, event);
|
|
237
228
|
};
|
|
238
229
|
const updateValue = (value, trigger = "onChange") => {
|
|
230
|
+
var _a;
|
|
239
231
|
if (props.type === "digit") {
|
|
240
232
|
value = formatNumber(value, false, false);
|
|
241
233
|
}
|
|
@@ -245,8 +237,8 @@ const _sfc_main = create({
|
|
|
245
237
|
if (props.formatter && trigger === props.formatTrigger) {
|
|
246
238
|
value = props.formatter(value);
|
|
247
239
|
}
|
|
248
|
-
if (inputRef
|
|
249
|
-
inputRef.value = value;
|
|
240
|
+
if (((_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.value) !== value) {
|
|
241
|
+
inputRef.value.value = value;
|
|
250
242
|
}
|
|
251
243
|
if (value !== props.modelValue) {
|
|
252
244
|
emit("update:modelValue", value);
|
|
@@ -310,22 +302,23 @@ const _sfc_main = create({
|
|
|
310
302
|
};
|
|
311
303
|
const onClick = (e) => {
|
|
312
304
|
if (props.disabled) {
|
|
313
|
-
e.
|
|
305
|
+
e.stopImmediatePropagation();
|
|
314
306
|
return;
|
|
315
307
|
}
|
|
316
308
|
};
|
|
317
309
|
watch(
|
|
318
310
|
() => props.modelValue,
|
|
319
311
|
() => {
|
|
320
|
-
|
|
321
|
-
|
|
312
|
+
if (!slots.input) {
|
|
313
|
+
updateValue(getModelValue());
|
|
314
|
+
resetValidation();
|
|
315
|
+
}
|
|
322
316
|
}
|
|
323
317
|
);
|
|
324
318
|
onMounted(() => {
|
|
325
|
-
if (
|
|
326
|
-
|
|
319
|
+
if (!slots.input) {
|
|
320
|
+
updateValue(getModelValue(), props.formatTrigger);
|
|
327
321
|
}
|
|
328
|
-
updateValue(getModelValue(), props.formatTrigger);
|
|
329
322
|
});
|
|
330
323
|
return {
|
|
331
324
|
inputRef,
|
|
@@ -351,8 +344,8 @@ const _hoisted_3 = { class: "label-string" };
|
|
|
351
344
|
const _hoisted_4 = { class: "nut-input-value" };
|
|
352
345
|
const _hoisted_5 = { class: "nut-input-inner" };
|
|
353
346
|
const _hoisted_6 = { class: "nut-input-box" };
|
|
354
|
-
const _hoisted_7 = ["maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "
|
|
355
|
-
const _hoisted_8 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "
|
|
347
|
+
const _hoisted_7 = ["maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
|
|
348
|
+
const _hoisted_8 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
|
|
356
349
|
const _hoisted_9 = { class: "nut-input-clear-box" };
|
|
357
350
|
const _hoisted_10 = {
|
|
358
351
|
key: 0,
|
|
@@ -363,7 +356,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
363
356
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
364
357
|
return openBlock(), createElementBlock("view", {
|
|
365
358
|
class: normalizeClass(_ctx.classes),
|
|
366
|
-
onClick: _cache[
|
|
359
|
+
onClick: _cache[11] || (_cache[11] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
367
360
|
}, [
|
|
368
361
|
_ctx.$slots.input ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
369
362
|
_ctx.label ? (openBlock(), createElementBlock("view", {
|
|
@@ -376,7 +369,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
376
369
|
}, [
|
|
377
370
|
createElementVNode("view", _hoisted_1, toDisplayString(_ctx.label) + " " + toDisplayString(_ctx.colon ? ":" : ""), 1)
|
|
378
371
|
], 6)) : createCommentVNode("", true),
|
|
379
|
-
createTextVNode(),
|
|
380
372
|
createElementVNode("view", _hoisted_2, [
|
|
381
373
|
createElementVNode("view", {
|
|
382
374
|
class: "nut-input-inner",
|
|
@@ -393,7 +385,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
393
385
|
}, [
|
|
394
386
|
createVNode(_component_nut_icon, mergeProps({ name: _ctx.leftIcon }, _ctx.$attrs, { size: _ctx.leftIconSize }), null, 16, ["name", "size"])
|
|
395
387
|
])) : createCommentVNode("", true),
|
|
396
|
-
createTextVNode(),
|
|
397
388
|
_ctx.label ? (openBlock(), createElementBlock("view", {
|
|
398
389
|
key: 1,
|
|
399
390
|
class: normalizeClass(["nut-input-label", _ctx.labelClass]),
|
|
@@ -404,7 +395,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
404
395
|
}, [
|
|
405
396
|
createElementVNode("view", _hoisted_3, toDisplayString(_ctx.label) + " " + toDisplayString(_ctx.colon ? ":" : ""), 1)
|
|
406
397
|
], 6)) : createCommentVNode("", true),
|
|
407
|
-
createTextVNode(),
|
|
408
398
|
createElementVNode("view", _hoisted_4, [
|
|
409
399
|
createElementVNode("view", _hoisted_5, [
|
|
410
400
|
createElementVNode("view", _hoisted_6, [
|
|
@@ -415,12 +405,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
415
405
|
style: normalizeStyle(_ctx.stylesTextarea),
|
|
416
406
|
maxlength: _ctx.maxLength,
|
|
417
407
|
placeholder: _ctx.placeholder,
|
|
418
|
-
"placeholder-class": "nut-placeholder",
|
|
419
408
|
disabled: _ctx.disabled,
|
|
420
409
|
readonly: _ctx.readonly,
|
|
421
410
|
value: _ctx.modelValue,
|
|
422
411
|
formatTrigger: _ctx.formatTrigger,
|
|
423
|
-
|
|
412
|
+
autofocus: _ctx.autofocus,
|
|
424
413
|
onInput: _cache[2] || (_cache[2] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
425
414
|
onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
426
415
|
onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
@@ -433,26 +422,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
433
422
|
type: _ctx.inputType(_ctx.type),
|
|
434
423
|
maxlength: _ctx.maxLength,
|
|
435
424
|
placeholder: _ctx.placeholder,
|
|
436
|
-
"placeholder-class": "nut-placeholder",
|
|
437
425
|
disabled: _ctx.disabled,
|
|
438
426
|
readonly: _ctx.readonly,
|
|
439
427
|
value: _ctx.modelValue,
|
|
440
428
|
formatTrigger: _ctx.formatTrigger,
|
|
441
|
-
|
|
442
|
-
"adjust-position": _ctx.adjustPosition,
|
|
429
|
+
autofocus: _ctx.autofocus,
|
|
443
430
|
onInput: _cache[6] || (_cache[6] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
444
431
|
onFocus: _cache[7] || (_cache[7] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
445
432
|
onBlur: _cache[8] || (_cache[8] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
446
433
|
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.onClickInput && _ctx.onClickInput(...args))
|
|
447
|
-
}, null, 44, _hoisted_8))
|
|
448
|
-
createTextVNode(),
|
|
449
|
-
_ctx.readonly ? (openBlock(), createElementBlock("view", {
|
|
450
|
-
key: 2,
|
|
451
|
-
class: "nut-input-disabled-mask",
|
|
452
|
-
onClick: _cache[10] || (_cache[10] = (...args) => _ctx.onClickInput && _ctx.onClickInput(...args))
|
|
453
|
-
})) : createCommentVNode("", true)
|
|
434
|
+
}, null, 44, _hoisted_8))
|
|
454
435
|
]),
|
|
455
|
-
createTextVNode(),
|
|
456
436
|
createElementVNode("view", _hoisted_9, [
|
|
457
437
|
_ctx.clearable && !_ctx.readonly ? withDirectives((openBlock(), createBlock(_component_nut_icon, mergeProps({
|
|
458
438
|
key: 0,
|
|
@@ -465,26 +445,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
465
445
|
[vShow, _ctx.active && _ctx.modelValue.length > 0]
|
|
466
446
|
]) : createCommentVNode("", true)
|
|
467
447
|
]),
|
|
468
|
-
createTextVNode(),
|
|
469
448
|
_ctx.rightIcon && _ctx.rightIcon.length > 0 ? (openBlock(), createElementBlock("view", {
|
|
470
449
|
key: 0,
|
|
471
450
|
class: "nut-input-right-icon",
|
|
472
|
-
onClick: _cache[
|
|
451
|
+
onClick: _cache[10] || (_cache[10] = (...args) => _ctx.onClickRightIcon && _ctx.onClickRightIcon(...args))
|
|
473
452
|
}, [
|
|
474
453
|
createVNode(_component_nut_icon, mergeProps({ name: _ctx.rightIcon }, _ctx.$attrs, { size: _ctx.rightIconSize }), null, 16, ["name", "size"])
|
|
475
454
|
])) : createCommentVNode("", true),
|
|
476
|
-
createTextVNode(),
|
|
477
455
|
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {
|
|
478
456
|
key: 1,
|
|
479
457
|
class: "nut-input-button"
|
|
480
458
|
}) : createCommentVNode("", true)
|
|
481
459
|
]),
|
|
482
|
-
createTextVNode(),
|
|
483
460
|
_ctx.showWordLimit && _ctx.maxLength ? (openBlock(), createElementBlock("view", _hoisted_10, [
|
|
484
461
|
createElementVNode("span", _hoisted_11, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0), 1),
|
|
485
462
|
createTextVNode("/" + toDisplayString(_ctx.maxLength), 1)
|
|
486
463
|
])) : createCommentVNode("", true),
|
|
487
|
-
createTextVNode(),
|
|
488
464
|
_ctx.errorMessage ? (openBlock(), createElementBlock("view", {
|
|
489
465
|
key: 1,
|
|
490
466
|
class: "nut-input-error-message",
|
|
@@ -496,5 +472,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
496
472
|
], 64))
|
|
497
473
|
], 2);
|
|
498
474
|
}
|
|
499
|
-
var
|
|
500
|
-
export {
|
|
475
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
476
|
+
export { index as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.2.6
|
|
2
|
+
* @nutui/nutui v3.2.6 Fri Nov 04 2022 18:06:53 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, mergeProps,
|
|
6
|
+
import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, mergeProps, createElementVNode } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { p as pxCheck } from "./pxCheck.js";
|
|
9
9
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
@@ -70,7 +70,7 @@ const _sfc_main = create({
|
|
|
70
70
|
};
|
|
71
71
|
const change = (event) => {
|
|
72
72
|
const input = event.target;
|
|
73
|
-
emit("update:modelValue", input.
|
|
73
|
+
emit("update:modelValue", input.valueAsNumber, event);
|
|
74
74
|
};
|
|
75
75
|
const emitChange = (value, event) => {
|
|
76
76
|
let output_value = fixedDecimalPlaces(value);
|
|
@@ -101,13 +101,20 @@ const _sfc_main = create({
|
|
|
101
101
|
emit("overlimit", event, "add");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
+
const focus = (event) => {
|
|
105
|
+
if (props.disabled)
|
|
106
|
+
return;
|
|
107
|
+
if (props.readonly)
|
|
108
|
+
return;
|
|
109
|
+
emit("focus", event);
|
|
110
|
+
};
|
|
104
111
|
const blur = (event) => {
|
|
105
112
|
if (props.disabled)
|
|
106
113
|
return;
|
|
107
114
|
if (props.readonly)
|
|
108
115
|
return;
|
|
109
116
|
const input = event.target;
|
|
110
|
-
let value =
|
|
117
|
+
let value = input.valueAsNumber;
|
|
111
118
|
if (value < Number(props.min)) {
|
|
112
119
|
value = Number(props.min);
|
|
113
120
|
} else if (value > Number(props.max)) {
|
|
@@ -116,15 +123,6 @@ const _sfc_main = create({
|
|
|
116
123
|
emitChange(value, event);
|
|
117
124
|
emit("blur", event);
|
|
118
125
|
};
|
|
119
|
-
const focus = (event) => {
|
|
120
|
-
if (props.disabled)
|
|
121
|
-
return;
|
|
122
|
-
if (props.readonly) {
|
|
123
|
-
blur(event);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
emit("focus", event);
|
|
127
|
-
};
|
|
128
126
|
return {
|
|
129
127
|
classes,
|
|
130
128
|
change,
|
|
@@ -138,11 +136,7 @@ const _sfc_main = create({
|
|
|
138
136
|
};
|
|
139
137
|
}
|
|
140
138
|
});
|
|
141
|
-
const _hoisted_1 =
|
|
142
|
-
key: 0,
|
|
143
|
-
class: "nut-inputnumber__text--readonly"
|
|
144
|
-
};
|
|
145
|
-
const _hoisted_2 = ["min", "max", "disabled", "readonly", "value"];
|
|
139
|
+
const _hoisted_1 = ["min", "max", "disabled", "readonly", "value"];
|
|
146
140
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
147
141
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
148
142
|
return openBlock(), createElementBlock("view", {
|
|
@@ -154,9 +148,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
154
148
|
class: ["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.reduceAllow() }],
|
|
155
149
|
size: _ctx.buttonSize
|
|
156
150
|
}, _ctx.$attrs, { onClick: _ctx.reduce }), null, 16, ["name", "class", "size", "onClick"]),
|
|
157
|
-
|
|
158
|
-
_ctx.readonly ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.modelValue), 1)) : (openBlock(), createElementBlock("input", {
|
|
159
|
-
key: 1,
|
|
151
|
+
createElementVNode("input", {
|
|
160
152
|
type: "number",
|
|
161
153
|
min: _ctx.min,
|
|
162
154
|
max: _ctx.max,
|
|
@@ -167,8 +159,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
167
159
|
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
|
|
168
160
|
onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
|
|
169
161
|
onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
|
|
170
|
-
}, null, 44,
|
|
171
|
-
createTextVNode(),
|
|
162
|
+
}, null, 44, _hoisted_1),
|
|
172
163
|
createVNode(_component_nut_icon, mergeProps({
|
|
173
164
|
name: _ctx.iconRight,
|
|
174
165
|
class: ["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.addAllow() }],
|
|
@@ -176,5 +167,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
176
167
|
}, _ctx.$attrs, { onClick: _ctx.add }), null, 16, ["name", "class", "size", "onClick"])
|
|
177
168
|
], 6);
|
|
178
169
|
}
|
|
179
|
-
var
|
|
180
|
-
export {
|
|
170
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
171
|
+
export { index as default };
|