@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,62 +1,306 @@
|
|
|
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
|
|
8
|
-
import
|
|
9
|
-
import { c as
|
|
10
|
-
import { _ as
|
|
6
|
+
import { ref, reactive, computed, onMounted, onBeforeUnmount, onBeforeMount, onActivated, onDeactivated, watch, toRefs, resolveComponent, openBlock, createBlock, Teleport, normalizeClass, normalizeStyle, createCommentVNode, createVNode, Transition, withCtx, withDirectives, createElementVNode, renderSlot, createElementBlock, vShow } from "vue";
|
|
7
|
+
import overlay, { overlayProps } from "./OverLay.js";
|
|
8
|
+
import _sfc_main$1 from "./Icon.js";
|
|
9
|
+
import { c as createComponent } from "./component.js";
|
|
10
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
11
11
|
import "../locale/lang";
|
|
12
12
|
import "./pxCheck.js";
|
|
13
|
-
let
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}]);
|
|
22
|
-
var m2;
|
|
23
|
-
const C2 = l(() => ({ [L]: true, round: p2.round, [`popup-${p2.position}`]: true, [`popup-${p2.position}--safebottom`]: p2.position === "bottom" && p2.safeAreaInsetBottom, [p2.popClass]: true })), f2 = l(() => ({ zIndex: v2.zIndex, animationDuration: p2.duration ? `${p2.duration}s` : "initial", ...p2.style })), b2 = () => {
|
|
24
|
-
p2.visible || (p2.zIndex !== void 0 && ($ = Number(p2.zIndex)), d2("update:visible", true), y2(), v2.zIndex = ++$), p2.destroyOnClose && (v2.showSlot = true), d2("open");
|
|
25
|
-
}, I2 = () => {
|
|
26
|
-
p2.visible && (k2(), d2("update:visible", false), p2.destroyOnClose && setTimeout(() => {
|
|
27
|
-
v2.showSlot = false, d2("close");
|
|
28
|
-
}, 1e3 * +p2.duration));
|
|
13
|
+
let count = 0;
|
|
14
|
+
const CLSNAME = "nut-overflow-hidden";
|
|
15
|
+
const useLockScroll = (isLock) => {
|
|
16
|
+
const lock = () => {
|
|
17
|
+
if (isLock()) {
|
|
18
|
+
!count && document.body.classList.add(CLSNAME);
|
|
19
|
+
count++;
|
|
20
|
+
}
|
|
29
21
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
22
|
+
const unlock = () => {
|
|
23
|
+
if (isLock() && count) {
|
|
24
|
+
count--;
|
|
25
|
+
!count && document.body.classList.remove(CLSNAME);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return [lock, unlock];
|
|
29
|
+
};
|
|
30
|
+
const { componentName, create } = createComponent("popup");
|
|
31
|
+
let _zIndex = 2e3;
|
|
32
|
+
const popupProps = {
|
|
33
|
+
...overlayProps,
|
|
34
|
+
position: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "center"
|
|
37
|
+
},
|
|
38
|
+
transition: String,
|
|
39
|
+
style: {
|
|
40
|
+
type: Object
|
|
41
|
+
},
|
|
42
|
+
popClass: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
closeable: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
closeIconPosition: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "top-right"
|
|
53
|
+
},
|
|
54
|
+
closeIcon: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "close"
|
|
57
|
+
},
|
|
58
|
+
destroyOnClose: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
teleport: {
|
|
63
|
+
type: [String, Element],
|
|
64
|
+
default: "body"
|
|
65
|
+
},
|
|
66
|
+
overlay: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
round: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false
|
|
73
|
+
},
|
|
74
|
+
isWrapTeleport: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
safeAreaInsetBottom: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const _sfc_main = create({
|
|
84
|
+
components: {
|
|
85
|
+
[overlay.name]: overlay,
|
|
86
|
+
[_sfc_main$1.name]: _sfc_main$1
|
|
87
|
+
},
|
|
88
|
+
props: {
|
|
89
|
+
...popupProps
|
|
90
|
+
},
|
|
91
|
+
emits: ["click", "click-close-icon", "open", "close", "opend", "closed", "update:visible", "click-overlay"],
|
|
92
|
+
setup(props, { emit }) {
|
|
93
|
+
const popupRef = ref();
|
|
94
|
+
const state = reactive({
|
|
95
|
+
zIndex: props.zIndex ? props.zIndex : _zIndex,
|
|
96
|
+
showSlot: true,
|
|
97
|
+
transitionName: `popup-fade-${props.position}`,
|
|
98
|
+
overLayCount: 1,
|
|
99
|
+
keepAlive: false,
|
|
100
|
+
closed: props.closeable
|
|
101
|
+
});
|
|
102
|
+
const [lockScroll, unlockScroll] = useLockScroll(() => props.lockScroll);
|
|
103
|
+
const classes = computed(() => {
|
|
104
|
+
const prefixCls = componentName;
|
|
105
|
+
return {
|
|
106
|
+
[prefixCls]: true,
|
|
107
|
+
["round"]: props.round,
|
|
108
|
+
[`popup-${props.position}`]: true,
|
|
109
|
+
[`popup-${props.position}--safebottom`]: props.position === "bottom" && props.safeAreaInsetBottom,
|
|
110
|
+
[props.popClass]: true
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const popStyle = computed(() => {
|
|
114
|
+
return {
|
|
115
|
+
zIndex: state.zIndex,
|
|
116
|
+
animationDuration: props.duration ? `${props.duration}s` : "initial",
|
|
117
|
+
...props.style
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
const open = () => {
|
|
121
|
+
if (!props.visible) {
|
|
122
|
+
if (props.zIndex !== void 0) {
|
|
123
|
+
_zIndex = Number(props.zIndex);
|
|
124
|
+
}
|
|
125
|
+
emit("update:visible", true);
|
|
126
|
+
lockScroll();
|
|
127
|
+
state.zIndex = ++_zIndex;
|
|
128
|
+
}
|
|
129
|
+
if (props.destroyOnClose) {
|
|
130
|
+
state.showSlot = true;
|
|
131
|
+
}
|
|
132
|
+
emit("open");
|
|
133
|
+
};
|
|
134
|
+
const close = () => {
|
|
135
|
+
if (props.visible) {
|
|
136
|
+
unlockScroll();
|
|
137
|
+
emit("update:visible", false);
|
|
138
|
+
if (props.destroyOnClose) {
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
state.showSlot = false;
|
|
141
|
+
emit("close");
|
|
142
|
+
}, +props.duration * 1e3);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const onClick = (e) => {
|
|
147
|
+
emit("click", e);
|
|
148
|
+
};
|
|
149
|
+
const onClickCloseIcon = (e) => {
|
|
150
|
+
emit("click-close-icon", e);
|
|
151
|
+
close();
|
|
152
|
+
};
|
|
153
|
+
const onClickOverlay = (e) => {
|
|
154
|
+
if (props.closeOnClickOverlay) {
|
|
155
|
+
emit("click-overlay", e);
|
|
156
|
+
close();
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const onOpened = (e) => {
|
|
160
|
+
emit("opend", e);
|
|
161
|
+
};
|
|
162
|
+
const onClosed = (e) => {
|
|
163
|
+
emit("closed", e);
|
|
164
|
+
};
|
|
165
|
+
onMounted(() => {
|
|
166
|
+
props.transition ? state.transitionName = props.transition : state.transitionName = `popup-slide-${props.position}`;
|
|
167
|
+
props.visible && open();
|
|
168
|
+
});
|
|
169
|
+
onBeforeUnmount(() => {
|
|
170
|
+
props.visible && close();
|
|
171
|
+
});
|
|
172
|
+
onBeforeMount(() => {
|
|
173
|
+
if (props.visible) {
|
|
174
|
+
unlockScroll();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
onActivated(() => {
|
|
178
|
+
if (state.keepAlive) {
|
|
179
|
+
emit("update:visible", true);
|
|
180
|
+
state.keepAlive = false;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
onDeactivated(() => {
|
|
184
|
+
if (props.visible) {
|
|
185
|
+
close();
|
|
186
|
+
state.keepAlive = true;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
watch(() => props.visible, (value) => {
|
|
190
|
+
if (value) {
|
|
191
|
+
open();
|
|
192
|
+
} else {
|
|
193
|
+
close();
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
watch(() => props.position, (value) => {
|
|
197
|
+
value === "center" ? state.transitionName = "popup-fade" : state.transitionName = `popup-slide-${value}`;
|
|
198
|
+
});
|
|
199
|
+
watch(() => props.closeable, (value) => {
|
|
200
|
+
state.closed = value;
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
...toRefs(state),
|
|
204
|
+
popStyle,
|
|
205
|
+
classes,
|
|
206
|
+
onClick,
|
|
207
|
+
onClickCloseIcon,
|
|
208
|
+
onClickOverlay,
|
|
209
|
+
onOpened,
|
|
210
|
+
onClosed,
|
|
211
|
+
popupRef
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
const _hoisted_1 = { key: 1 };
|
|
216
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
217
|
+
const _component_nut_overlay = resolveComponent("nut-overlay");
|
|
218
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
219
|
+
return _ctx.isWrapTeleport ? (openBlock(), createBlock(Teleport, {
|
|
220
|
+
key: 0,
|
|
221
|
+
to: _ctx.teleport
|
|
222
|
+
}, [
|
|
223
|
+
_ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
|
|
224
|
+
key: 0,
|
|
225
|
+
visible: _ctx.visible,
|
|
226
|
+
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
227
|
+
class: normalizeClass(_ctx.overlayClass),
|
|
228
|
+
style: normalizeStyle(_ctx.overlayStyle),
|
|
229
|
+
"z-index": _ctx.zIndex,
|
|
230
|
+
"lock-scroll": _ctx.lockScroll,
|
|
231
|
+
duration: _ctx.duration,
|
|
232
|
+
onClick: _ctx.onClickOverlay
|
|
233
|
+
}, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
|
|
234
|
+
createVNode(Transition, {
|
|
235
|
+
name: _ctx.transitionName,
|
|
236
|
+
onAfterEnter: _ctx.onOpened,
|
|
237
|
+
onAfterLeave: _ctx.onClosed
|
|
238
|
+
}, {
|
|
239
|
+
default: withCtx(() => [
|
|
240
|
+
withDirectives(createElementVNode("view", {
|
|
241
|
+
class: normalizeClass(_ctx.classes),
|
|
242
|
+
style: normalizeStyle(_ctx.popStyle),
|
|
243
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
244
|
+
ref: "popupRef"
|
|
245
|
+
}, [
|
|
246
|
+
_ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
|
|
247
|
+
_ctx.closed ? (openBlock(), createElementBlock("view", {
|
|
248
|
+
key: 1,
|
|
249
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
|
|
250
|
+
class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
|
|
251
|
+
}, [
|
|
252
|
+
createVNode(_component_nut_icon, {
|
|
253
|
+
name: _ctx.closeIcon,
|
|
254
|
+
size: "12px"
|
|
255
|
+
}, null, 8, ["name"])
|
|
256
|
+
], 2)) : createCommentVNode("", true)
|
|
257
|
+
], 6), [
|
|
258
|
+
[vShow, _ctx.visible]
|
|
259
|
+
])
|
|
260
|
+
]),
|
|
261
|
+
_: 3
|
|
262
|
+
}, 8, ["name", "onAfterEnter", "onAfterLeave"])
|
|
263
|
+
], 8, ["to"])) : (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
264
|
+
_ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
|
|
265
|
+
key: 0,
|
|
266
|
+
visible: _ctx.visible,
|
|
267
|
+
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
268
|
+
class: normalizeClass(_ctx.overlayClass),
|
|
269
|
+
style: normalizeStyle(_ctx.overlayStyle),
|
|
270
|
+
"z-index": _ctx.zIndex,
|
|
271
|
+
"lock-scroll": _ctx.lockScroll,
|
|
272
|
+
duration: _ctx.duration,
|
|
273
|
+
onClick: _ctx.onClickOverlay
|
|
274
|
+
}, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
|
|
275
|
+
createVNode(Transition, {
|
|
276
|
+
name: _ctx.transitionName,
|
|
277
|
+
onAfterEnter: _ctx.onOpened,
|
|
278
|
+
onAfterLeave: _ctx.onClosed
|
|
279
|
+
}, {
|
|
280
|
+
default: withCtx(() => [
|
|
281
|
+
withDirectives(createElementVNode("view", {
|
|
282
|
+
class: normalizeClass(_ctx.classes),
|
|
283
|
+
style: normalizeStyle(_ctx.popStyle),
|
|
284
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
285
|
+
}, [
|
|
286
|
+
_ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
|
|
287
|
+
_ctx.closed ? (openBlock(), createElementBlock("view", {
|
|
288
|
+
key: 1,
|
|
289
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
|
|
290
|
+
class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
|
|
291
|
+
}, [
|
|
292
|
+
createVNode(_component_nut_icon, {
|
|
293
|
+
name: _ctx.closeIcon,
|
|
294
|
+
size: "12px"
|
|
295
|
+
}, null, 8, ["name"])
|
|
296
|
+
], 2)) : createCommentVNode("", true)
|
|
297
|
+
], 6), [
|
|
298
|
+
[vShow, _ctx.visible]
|
|
299
|
+
])
|
|
300
|
+
]),
|
|
301
|
+
_: 3
|
|
302
|
+
}, 8, ["name", "onAfterEnter", "onAfterLeave"])
|
|
303
|
+
]));
|
|
304
|
+
}
|
|
305
|
+
var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
306
|
+
export { Popup as default, popupProps };
|
|
@@ -1,21 +1,123 @@
|
|
|
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 { computed
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { computed, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString } 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
|
-
|
|
10
|
+
const { componentName, create } = createComponent("price");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
price: {
|
|
14
|
+
type: [Number, String],
|
|
15
|
+
default: 0
|
|
16
|
+
},
|
|
17
|
+
needSymbol: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
symbol: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "¥"
|
|
24
|
+
},
|
|
25
|
+
decimalDigits: {
|
|
26
|
+
type: [Number, String],
|
|
27
|
+
default: 2
|
|
28
|
+
},
|
|
29
|
+
thousands: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
position: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "before"
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "large"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
setup(props) {
|
|
43
|
+
const classes = computed(() => {
|
|
44
|
+
return {
|
|
45
|
+
[componentName]: true
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const showSymbol = computed(() => {
|
|
49
|
+
const symbol = props.needSymbol ? props.symbol : "";
|
|
50
|
+
return symbol;
|
|
51
|
+
});
|
|
52
|
+
const checkPoint = (price) => {
|
|
53
|
+
return String(price).indexOf(".") > 0;
|
|
54
|
+
};
|
|
55
|
+
const formatThousands = (num) => {
|
|
56
|
+
if (Number(num) == 0) {
|
|
57
|
+
num = 0;
|
|
58
|
+
}
|
|
59
|
+
if (checkPoint(num)) {
|
|
60
|
+
num = Number(num).toFixed(props.decimalDigits);
|
|
61
|
+
num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
|
|
62
|
+
} else {
|
|
63
|
+
num = num.toString();
|
|
64
|
+
}
|
|
65
|
+
if (props.thousands) {
|
|
66
|
+
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
|
|
67
|
+
} else {
|
|
68
|
+
return num;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const formatDecimal = (decimalNum) => {
|
|
72
|
+
if (Number(decimalNum) == 0) {
|
|
73
|
+
decimalNum = 0;
|
|
74
|
+
}
|
|
75
|
+
if (checkPoint(decimalNum)) {
|
|
76
|
+
decimalNum = Number(decimalNum).toFixed(props.decimalDigits);
|
|
77
|
+
decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] ? decimalNum.split(".")[1] : 0;
|
|
78
|
+
} else {
|
|
79
|
+
decimalNum = 0;
|
|
80
|
+
}
|
|
81
|
+
const result = "0." + decimalNum;
|
|
82
|
+
const resultFixed = Number(result).toFixed(props.decimalDigits);
|
|
83
|
+
return String(resultFixed).substring(2, resultFixed.length);
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
classes,
|
|
87
|
+
showSymbol,
|
|
88
|
+
checkPoint,
|
|
89
|
+
formatThousands,
|
|
90
|
+
formatDecimal
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
const _hoisted_1 = ["innerHTML"];
|
|
95
|
+
const _hoisted_2 = ["innerHTML"];
|
|
96
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
97
|
+
return openBlock(), createElementBlock("view", {
|
|
98
|
+
class: normalizeClass(_ctx.classes)
|
|
99
|
+
}, [
|
|
100
|
+
_ctx.needSymbol && _ctx.position == "before" ? (openBlock(), createElementBlock("view", {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
|
|
103
|
+
innerHTML: _ctx.showSymbol
|
|
104
|
+
}, null, 10, _hoisted_1)) : createCommentVNode("", true),
|
|
105
|
+
createElementVNode("view", {
|
|
106
|
+
class: normalizeClass(`nut-price--${_ctx.size}`)
|
|
107
|
+
}, toDisplayString(_ctx.formatThousands(_ctx.price)), 3),
|
|
108
|
+
_ctx.decimalDigits != 0 ? (openBlock(), createElementBlock("view", {
|
|
109
|
+
key: 1,
|
|
110
|
+
class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
|
|
111
|
+
}, ".", 2)) : createCommentVNode("", true),
|
|
112
|
+
createElementVNode("view", {
|
|
113
|
+
class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
|
|
114
|
+
}, toDisplayString(_ctx.formatDecimal(_ctx.price)), 3),
|
|
115
|
+
_ctx.needSymbol && _ctx.position == "after" ? (openBlock(), createElementBlock("view", {
|
|
116
|
+
key: 2,
|
|
117
|
+
class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
|
|
118
|
+
innerHTML: _ctx.showSymbol
|
|
119
|
+
}, null, 10, _hoisted_2)) : createCommentVNode("", true)
|
|
120
|
+
], 2);
|
|
121
|
+
}
|
|
122
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
123
|
+
export { index as default };
|