@nutui/nutui 4.0.12-beta.1 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +1 -1
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +50 -50
- package/dist/styles/themes/jdb.scss +50 -50
- package/dist/styles/themes/jddkh.scss +50 -50
- package/dist/styles/themes/jdt.scss +50 -50
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,169 +1,272 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
import { i as
|
|
3
|
-
import { r as
|
|
4
|
-
import { u as
|
|
5
|
-
import { P as
|
|
6
|
-
import { _ as
|
|
1
|
+
import { ref, computed, onMounted, watch, resolveComponent, openBlock, createElementBlock, Fragment, renderSlot, createCommentVNode, createElementVNode, normalizeClass, normalizeStyle, createVNode, withCtx, renderList, withModifiers, createBlock, resolveDynamicComponent, toDisplayString } from "vue";
|
|
2
|
+
import { i as isArray, c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
|
|
4
|
+
import { u as useRect } from "./index-29892cda.js";
|
|
5
|
+
import { P as Popup } from "./index-da0a7662.js";
|
|
6
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
7
7
|
import "../locale/lang";
|
|
8
8
|
import "./Overlay.js";
|
|
9
9
|
import "@nutui/icons-vue";
|
|
10
|
-
const { create
|
|
10
|
+
const { create } = createComponent("popover");
|
|
11
|
+
const _sfc_main = create({
|
|
11
12
|
components: {
|
|
12
|
-
[
|
|
13
|
+
[Popup.name]: Popup
|
|
13
14
|
},
|
|
14
15
|
props: {
|
|
15
|
-
visible: { type: Boolean, default:
|
|
16
|
+
visible: { type: Boolean, default: false },
|
|
16
17
|
list: { type: Array, default: [] },
|
|
17
18
|
theme: { type: String, default: "light" },
|
|
18
19
|
location: { type: String, default: "bottom" },
|
|
19
20
|
offset: { type: Array, default: [0, 12] },
|
|
20
21
|
arrowOffset: { type: Number, default: 0 },
|
|
21
22
|
customClass: { type: String, default: "" },
|
|
22
|
-
showArrow: { type: Boolean, default:
|
|
23
|
+
showArrow: { type: Boolean, default: true },
|
|
23
24
|
duration: { type: [Number, String], default: 0.3 },
|
|
24
|
-
overlay: { type: Boolean, default:
|
|
25
|
+
overlay: { type: Boolean, default: false },
|
|
25
26
|
overlayClass: { type: String, default: "" },
|
|
26
27
|
overlayStyle: { type: Object },
|
|
27
|
-
closeOnClickOverlay: { type: Boolean, default:
|
|
28
|
-
closeOnClickAction: { type: Boolean, default:
|
|
29
|
-
closeOnClickOutside: { type: Boolean, default:
|
|
28
|
+
closeOnClickOverlay: { type: Boolean, default: true },
|
|
29
|
+
closeOnClickAction: { type: Boolean, default: true },
|
|
30
|
+
closeOnClickOutside: { type: Boolean, default: true },
|
|
30
31
|
targetId: { type: String, default: "" },
|
|
31
32
|
bgColor: { type: String, default: "" }
|
|
32
33
|
},
|
|
33
34
|
emits: ["update", "update:visible", "close", "choose", "open"],
|
|
34
|
-
setup(
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
setup(props, { emit }) {
|
|
36
|
+
const popoverRef = ref();
|
|
37
|
+
const popoverContentRef = ref();
|
|
38
|
+
const showPopup = ref(props.visible);
|
|
39
|
+
let rootRect = ref();
|
|
40
|
+
let conentRootRect = ref();
|
|
41
|
+
const popoverArrow = computed(() => {
|
|
42
|
+
const prefixCls = "nut-popover-arrow";
|
|
43
|
+
const loca = props.location;
|
|
44
|
+
const direction = loca.split("-")[0];
|
|
45
|
+
return `${prefixCls} ${prefixCls}-${direction} ${prefixCls}--${loca}`;
|
|
46
|
+
});
|
|
47
|
+
const popoverArrowStyle = computed(() => {
|
|
48
|
+
const styles = {};
|
|
49
|
+
const { bgColor, arrowOffset, location } = props;
|
|
50
|
+
const direction = location.split("-")[0];
|
|
51
|
+
const skew = location.split("-")[1];
|
|
52
|
+
const base = 16;
|
|
53
|
+
if (bgColor) {
|
|
54
|
+
styles[`border${upperCaseFirst(direction)}Color`] = bgColor;
|
|
55
|
+
}
|
|
56
|
+
if (props.arrowOffset != 0) {
|
|
57
|
+
if (["bottom", "top"].includes(direction)) {
|
|
58
|
+
if (!skew) {
|
|
59
|
+
styles.left = `calc(50% + ${arrowOffset}px)`;
|
|
60
|
+
}
|
|
61
|
+
if (skew == "start") {
|
|
62
|
+
styles.left = `${base + arrowOffset}px`;
|
|
63
|
+
}
|
|
64
|
+
if (skew == "end") {
|
|
65
|
+
styles.right = `${base - arrowOffset}px`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (["left", "right"].includes(direction)) {
|
|
69
|
+
if (!skew) {
|
|
70
|
+
styles.top = `calc(50% - ${arrowOffset}px)`;
|
|
71
|
+
}
|
|
72
|
+
if (skew == "start") {
|
|
73
|
+
styles.top = `${base - arrowOffset}px`;
|
|
74
|
+
}
|
|
75
|
+
if (skew == "end") {
|
|
76
|
+
styles.bottom = `${base + arrowOffset}px`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return styles;
|
|
81
|
+
});
|
|
82
|
+
const upperCaseFirst = (str) => {
|
|
83
|
+
var str = str.toLowerCase();
|
|
84
|
+
str = str.replace(/\b\w+\b/g, (word) => word.substring(0, 1).toUpperCase() + word.substring(1));
|
|
85
|
+
return str;
|
|
86
|
+
};
|
|
87
|
+
const getRootPosition = computed(() => {
|
|
88
|
+
let styles = {};
|
|
89
|
+
if (!rootRect.value || !conentRootRect.value)
|
|
49
90
|
return {};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
91
|
+
const conentWidth = conentRootRect.value.width;
|
|
92
|
+
const conentHeight = conentRootRect.value.height;
|
|
93
|
+
const { width, height, left, top } = rootRect.value;
|
|
94
|
+
const { location, offset } = props;
|
|
95
|
+
const direction = location.split("-")[0];
|
|
96
|
+
const skew = location.split("-")[1];
|
|
97
|
+
let cross = 0;
|
|
98
|
+
let parallel = 0;
|
|
99
|
+
if (isArray(offset) && offset.length == 2) {
|
|
100
|
+
cross += +offset[1];
|
|
101
|
+
parallel += +offset[0];
|
|
102
|
+
}
|
|
103
|
+
if (width) {
|
|
104
|
+
if (["bottom", "top"].includes(direction)) {
|
|
105
|
+
const h2 = direction == "bottom" ? height + cross : -(conentHeight + cross);
|
|
106
|
+
styles.top = `${top + h2}px`;
|
|
107
|
+
if (!skew) {
|
|
108
|
+
styles.left = `${-(conentWidth - width) / 2 + left + parallel}px`;
|
|
109
|
+
}
|
|
110
|
+
if (skew == "start") {
|
|
111
|
+
styles.left = `${left + parallel}px`;
|
|
112
|
+
}
|
|
113
|
+
if (skew == "end") {
|
|
114
|
+
styles.left = `${rootRect.value.right + parallel}px`;
|
|
115
|
+
}
|
|
56
116
|
}
|
|
57
|
-
if (["left", "right"].includes(
|
|
58
|
-
const
|
|
59
|
-
|
|
117
|
+
if (["left", "right"].includes(direction)) {
|
|
118
|
+
const contentW = direction == "left" ? -(conentWidth + cross) : width + cross;
|
|
119
|
+
styles.left = `${left + contentW}px`;
|
|
120
|
+
if (!skew) {
|
|
121
|
+
styles.top = `${top - conentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
122
|
+
}
|
|
123
|
+
if (skew == "start") {
|
|
124
|
+
styles.top = `${top + parallel}px`;
|
|
125
|
+
}
|
|
126
|
+
if (skew == "end") {
|
|
127
|
+
styles.top = `${top + height + parallel}px`;
|
|
128
|
+
}
|
|
60
129
|
}
|
|
61
130
|
}
|
|
62
|
-
return
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
131
|
+
return styles;
|
|
132
|
+
});
|
|
133
|
+
const customStyle = computed(() => {
|
|
134
|
+
const styles = {};
|
|
135
|
+
if (props.bgColor) {
|
|
136
|
+
styles.background = props.bgColor;
|
|
137
|
+
}
|
|
138
|
+
return styles;
|
|
139
|
+
});
|
|
140
|
+
const getContentWidth = () => {
|
|
141
|
+
let rect2 = useRect(popoverRef.value);
|
|
142
|
+
if (props.targetId) {
|
|
143
|
+
rect2 = useRect(document.querySelector(`#${props.targetId}`));
|
|
144
|
+
}
|
|
145
|
+
rootRect.value = rect2;
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
conentRootRect.value = {
|
|
148
|
+
height: popoverContentRef.value.clientHeight,
|
|
149
|
+
width: popoverContentRef.value.clientWidth
|
|
72
150
|
};
|
|
73
151
|
}, 0);
|
|
74
152
|
};
|
|
75
|
-
|
|
153
|
+
onMounted(() => {
|
|
76
154
|
setTimeout(() => {
|
|
77
|
-
|
|
155
|
+
getContentWidth();
|
|
78
156
|
}, 200);
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
(
|
|
82
|
-
|
|
157
|
+
});
|
|
158
|
+
watch(
|
|
159
|
+
() => props.visible,
|
|
160
|
+
(value) => {
|
|
161
|
+
showPopup.value = value;
|
|
162
|
+
if (value) {
|
|
163
|
+
window.addEventListener("touchstart", clickAway, true);
|
|
164
|
+
getContentWidth();
|
|
165
|
+
} else {
|
|
166
|
+
window.removeEventListener("touchstart", clickAway, true);
|
|
167
|
+
}
|
|
83
168
|
}
|
|
84
169
|
);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
170
|
+
const update = (val) => {
|
|
171
|
+
emit("update", val);
|
|
172
|
+
emit("update:visible", val);
|
|
173
|
+
};
|
|
174
|
+
const openPopover = () => {
|
|
175
|
+
update(!props.visible);
|
|
176
|
+
emit("open");
|
|
177
|
+
};
|
|
178
|
+
const closePopover = () => {
|
|
179
|
+
emit("update:visible", false);
|
|
180
|
+
emit("close");
|
|
181
|
+
};
|
|
182
|
+
const chooseItem = (item, index) => {
|
|
183
|
+
!item.disabled && emit("choose", item, index);
|
|
184
|
+
if (props.closeOnClickAction) {
|
|
185
|
+
closePopover();
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const clickAway = (event) => {
|
|
189
|
+
const element = popoverRef.value;
|
|
190
|
+
const elContent = popoverContentRef.value;
|
|
191
|
+
let el = element && !element.contains(event.target);
|
|
192
|
+
if (props.targetId) {
|
|
193
|
+
const dom = document.querySelector(`#${props.targetId}`);
|
|
194
|
+
el = dom && !dom.contains(event.target);
|
|
195
|
+
}
|
|
196
|
+
if (el && elContent && !elContent.contains(event.target) && props.closeOnClickOutside) {
|
|
197
|
+
closePopover();
|
|
99
198
|
}
|
|
100
|
-
a && n && !n.contains(e.target) && t.closeOnClickOutside && O();
|
|
101
199
|
};
|
|
102
200
|
return {
|
|
103
|
-
showPopup
|
|
104
|
-
openPopover
|
|
105
|
-
popoverArrow
|
|
106
|
-
closePopover
|
|
107
|
-
chooseItem
|
|
108
|
-
popoverRef
|
|
109
|
-
popoverContentRef
|
|
110
|
-
getRootPosition
|
|
111
|
-
customStyle
|
|
112
|
-
popoverArrowStyle
|
|
113
|
-
renderIcon
|
|
201
|
+
showPopup,
|
|
202
|
+
openPopover,
|
|
203
|
+
popoverArrow,
|
|
204
|
+
closePopover,
|
|
205
|
+
chooseItem,
|
|
206
|
+
popoverRef,
|
|
207
|
+
popoverContentRef,
|
|
208
|
+
getRootPosition,
|
|
209
|
+
customStyle,
|
|
210
|
+
popoverArrowStyle,
|
|
211
|
+
renderIcon
|
|
114
212
|
};
|
|
115
213
|
}
|
|
116
|
-
})
|
|
214
|
+
});
|
|
215
|
+
const _hoisted_1 = {
|
|
117
216
|
ref: "popoverContentRef",
|
|
118
217
|
class: "nut-popover-content-group"
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
218
|
+
};
|
|
219
|
+
const _hoisted_2 = ["onClick"];
|
|
220
|
+
const _hoisted_3 = { class: "nut-popover-menu-item-name" };
|
|
221
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
222
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
223
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
224
|
+
!_ctx.targetId ? (openBlock(), createElementBlock("div", {
|
|
124
225
|
key: 0,
|
|
125
226
|
class: "nut-popover-wrapper",
|
|
126
|
-
onClick:
|
|
227
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openPopover && _ctx.openPopover(...args)),
|
|
127
228
|
ref: "popoverRef"
|
|
128
229
|
}, [
|
|
129
|
-
|
|
130
|
-
], 512)),
|
|
131
|
-
|
|
132
|
-
class:
|
|
133
|
-
style:
|
|
230
|
+
renderSlot(_ctx.$slots, "reference")
|
|
231
|
+
], 512)) : createCommentVNode("", true),
|
|
232
|
+
createElementVNode("view", {
|
|
233
|
+
class: normalizeClass(["nut-popover", `nut-popover--${_ctx.theme}`, `${_ctx.customClass}`]),
|
|
234
|
+
style: normalizeStyle(_ctx.getRootPosition)
|
|
134
235
|
}, [
|
|
135
|
-
|
|
136
|
-
popClass: `nut-popover-content nut-popover-content--${
|
|
137
|
-
style:
|
|
138
|
-
visible:
|
|
139
|
-
"onUpdate:visible":
|
|
236
|
+
createVNode(_component_nut_popup, {
|
|
237
|
+
popClass: `nut-popover-content nut-popover-content--${_ctx.location}`,
|
|
238
|
+
style: normalizeStyle(_ctx.customStyle),
|
|
239
|
+
visible: _ctx.showPopup,
|
|
240
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPopup = $event),
|
|
140
241
|
position: "",
|
|
141
242
|
transition: "nut-popover",
|
|
142
|
-
overlay:
|
|
143
|
-
duration:
|
|
144
|
-
overlayStyle:
|
|
145
|
-
overlayClass:
|
|
146
|
-
closeOnClickOverlay:
|
|
243
|
+
overlay: _ctx.overlay,
|
|
244
|
+
duration: _ctx.duration,
|
|
245
|
+
overlayStyle: _ctx.overlayStyle,
|
|
246
|
+
overlayClass: _ctx.overlayClass,
|
|
247
|
+
closeOnClickOverlay: _ctx.closeOnClickOverlay
|
|
147
248
|
}, {
|
|
148
|
-
default:
|
|
149
|
-
|
|
150
|
-
|
|
249
|
+
default: withCtx(() => [
|
|
250
|
+
createElementVNode("view", _hoisted_1, [
|
|
251
|
+
_ctx.showArrow ? (openBlock(), createElementBlock("view", {
|
|
151
252
|
key: 0,
|
|
152
|
-
class:
|
|
153
|
-
style:
|
|
154
|
-
}, null, 6)) :
|
|
155
|
-
|
|
156
|
-
(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
253
|
+
class: normalizeClass(_ctx.popoverArrow),
|
|
254
|
+
style: normalizeStyle(_ctx.popoverArrowStyle)
|
|
255
|
+
}, null, 6)) : createCommentVNode("", true),
|
|
256
|
+
renderSlot(_ctx.$slots, "content"),
|
|
257
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
|
|
258
|
+
return openBlock(), createElementBlock("view", {
|
|
259
|
+
key: index,
|
|
260
|
+
class: normalizeClass([item.className, item.disabled && "nut-popover-menu-disabled", "nut-popover-menu-item"]),
|
|
261
|
+
onClick: withModifiers(($event) => _ctx.chooseItem(item, index), ["stop"])
|
|
262
|
+
}, [
|
|
263
|
+
item.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(item.icon)), {
|
|
264
|
+
key: 0,
|
|
265
|
+
class: "nut-popover-item-img"
|
|
266
|
+
})) : createCommentVNode("", true),
|
|
267
|
+
createElementVNode("view", _hoisted_3, toDisplayString(item.name), 1)
|
|
268
|
+
], 10, _hoisted_2);
|
|
269
|
+
}), 128))
|
|
167
270
|
], 512)
|
|
168
271
|
]),
|
|
169
272
|
_: 3
|
|
@@ -171,7 +274,7 @@ function pe(t, l, h, v, S, y) {
|
|
|
171
274
|
], 6)
|
|
172
275
|
], 64);
|
|
173
276
|
}
|
|
174
|
-
const
|
|
277
|
+
const Popover = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
175
278
|
export {
|
|
176
|
-
|
|
279
|
+
Popover as default
|
|
177
280
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P
|
|
1
|
+
import { P } from "./index-da0a7662.js";
|
|
2
2
|
import "vue";
|
|
3
|
-
import "./_plugin-vue_export-helper-
|
|
4
|
-
import "./component-
|
|
3
|
+
import "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
4
|
+
import "./component-81a4c1d0.js";
|
|
5
5
|
import "../locale/lang";
|
|
6
6
|
import "./Overlay.js";
|
|
7
7
|
import "@nutui/icons-vue";
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
P as default
|
|
10
10
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
import { c as
|
|
3
|
-
import { _ as
|
|
1
|
+
import { computed, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
4
4
|
import "../locale/lang";
|
|
5
|
-
const { componentName
|
|
5
|
+
const { componentName, create } = createComponent("price");
|
|
6
|
+
const _sfc_main = create({
|
|
6
7
|
props: {
|
|
7
8
|
price: {
|
|
8
9
|
type: [Number, String],
|
|
@@ -10,7 +11,7 @@ const { componentName: u, create: S } = g("price"), $ = S({
|
|
|
10
11
|
},
|
|
11
12
|
needSymbol: {
|
|
12
13
|
type: Boolean,
|
|
13
|
-
default:
|
|
14
|
+
default: true
|
|
14
15
|
},
|
|
15
16
|
symbol: {
|
|
16
17
|
type: String,
|
|
@@ -22,7 +23,7 @@ const { componentName: u, create: S } = g("price"), $ = S({
|
|
|
22
23
|
},
|
|
23
24
|
thousands: {
|
|
24
25
|
type: Boolean,
|
|
25
|
-
default:
|
|
26
|
+
default: false
|
|
26
27
|
},
|
|
27
28
|
position: {
|
|
28
29
|
type: String,
|
|
@@ -34,54 +35,91 @@ const { componentName: u, create: S } = g("price"), $ = S({
|
|
|
34
35
|
},
|
|
35
36
|
strikeThrough: {
|
|
36
37
|
type: Boolean,
|
|
37
|
-
default:
|
|
38
|
+
default: false
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
|
-
setup(
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
setup(props) {
|
|
42
|
+
const classes = computed(() => {
|
|
43
|
+
return {
|
|
44
|
+
[componentName]: true,
|
|
45
|
+
[`${componentName}--strike`]: props.strikeThrough
|
|
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();
|
|
54
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
|
|
55
91
|
};
|
|
56
92
|
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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)
|
|
61
99
|
}, [
|
|
62
|
-
|
|
100
|
+
_ctx.needSymbol && _ctx.position == "before" ? (openBlock(), createElementBlock("view", {
|
|
63
101
|
key: 0,
|
|
64
|
-
class:
|
|
65
|
-
innerHTML:
|
|
66
|
-
}, null, 10,
|
|
67
|
-
|
|
68
|
-
class:
|
|
69
|
-
},
|
|
70
|
-
|
|
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", {
|
|
71
109
|
key: 1,
|
|
72
|
-
class:
|
|
73
|
-
}, ".", 2)) :
|
|
74
|
-
|
|
75
|
-
class:
|
|
76
|
-
},
|
|
77
|
-
|
|
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", {
|
|
78
116
|
key: 2,
|
|
79
|
-
class:
|
|
80
|
-
innerHTML:
|
|
81
|
-
}, null, 10,
|
|
117
|
+
class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
|
|
118
|
+
innerHTML: _ctx.showSymbol
|
|
119
|
+
}, null, 10, _hoisted_2)) : createCommentVNode("", true)
|
|
82
120
|
], 2);
|
|
83
121
|
}
|
|
84
|
-
const
|
|
122
|
+
const Price = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
85
123
|
export {
|
|
86
|
-
|
|
124
|
+
Price as default
|
|
87
125
|
};
|