@nutui/nutui 3.1.18-beta.0 → 3.1.19-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 +41 -0
- package/LICENSE +1 -1
- package/README.md +6 -0
- package/dist/nutui.d.ts +39 -36
- package/dist/nutui.es.js +13149 -11288
- package/dist/nutui.umd.js +13156 -11381
- package/dist/packages/_es/ActionSheet.js +13 -19
- package/dist/packages/_es/Address.js +70 -55
- package/dist/packages/_es/Audio.js +13 -13
- package/dist/packages/_es/AudioOperate.js +125 -0
- package/dist/packages/_es/Avatar.js +4 -4
- package/dist/packages/_es/BackTop.js +69 -108
- package/dist/packages/_es/Badge.js +4 -4
- package/dist/packages/_es/Barrage.js +63 -56
- package/dist/packages/_es/Button.js +3 -3
- package/dist/packages/_es/Calendar.js +30 -702
- package/dist/packages/_es/CalendarItem.js +10 -0
- package/dist/packages/_es/Card.js +7 -6
- package/dist/packages/_es/Cascader.js +8 -8
- package/dist/packages/_es/Cell.js +27 -27
- package/dist/packages/_es/CellGroup.js +2 -2
- package/dist/packages/_es/Checkbox.js +4 -4
- package/dist/packages/_es/CheckboxGroup.js +3 -3
- package/dist/packages/_es/CircleProgress.js +150 -41
- package/dist/packages/_es/Col.js +2 -2
- package/dist/packages/_es/Collapse.js +35 -9
- package/dist/packages/_es/CollapseItem.js +79 -38
- package/dist/packages/_es/CountDown.js +8 -6
- package/dist/packages/_es/CountUp.js +31 -30
- package/dist/packages/_es/DatePicker.js +81 -44
- package/dist/packages/_es/Dialog.js +7 -83
- package/dist/packages/_es/Divider.js +5 -5
- package/dist/packages/_es/Drag.js +93 -55
- package/dist/packages/_es/Elevator.js +75 -50
- package/dist/packages/_es/Empty.js +4 -4
- package/dist/packages/_es/FixedNav.js +6 -6
- package/dist/packages/_es/Form.js +11 -9
- package/dist/packages/_es/FormItem.js +9 -6
- package/dist/packages/_es/Grid.js +2 -2
- package/dist/packages/_es/GridItem.js +9 -27
- package/dist/packages/_es/Icon.js +2 -2
- package/dist/packages/_es/ImagePreview.js +14 -83
- package/dist/packages/_es/Indicator.js +4 -4
- package/dist/packages/_es/InfiniteLoading.js +94 -108
- package/dist/packages/_es/Input.js +297 -73
- package/dist/packages/_es/InputNumber.js +24 -17
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/List.js +131 -0
- package/dist/packages/_es/Menu.js +16 -13
- package/dist/packages/_es/MenuItem.js +8 -8
- package/dist/packages/_es/Navbar.js +17 -12
- package/dist/packages/_es/NoticeBar.js +47 -39
- package/dist/packages/_es/Notify.js +28 -163
- package/dist/packages/_es/NumberKeyboard.js +4 -4
- package/dist/packages/_es/OldPicker.js +486 -0
- package/dist/packages/_es/OverLay.js +6 -26
- package/dist/packages/_es/Pagination.js +8 -8
- package/dist/packages/_es/Picker.js +192 -163
- package/dist/packages/_es/Popover.js +155 -30
- package/dist/packages/_es/Popup.js +7 -70
- package/dist/packages/_es/Price.js +18 -6
- package/dist/packages/_es/Progress.js +29 -27
- package/dist/packages/_es/PullRefresh.js +363 -0
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +169 -46
- package/dist/packages/_es/Rate.js +17 -20
- package/dist/packages/_es/Row.js +2 -2
- package/dist/packages/_es/SearchBar.js +9 -7
- package/dist/packages/_es/ShortPassword.js +90 -68
- package/dist/packages/_es/SideNavBar.js +6 -17
- package/dist/packages/_es/SideNavBarItem.js +2 -2
- package/dist/packages/_es/Signature.js +70 -70
- package/dist/packages/_es/Skeleton.js +9 -12
- package/dist/packages/_es/Sku.js +40 -31
- package/dist/packages/_es/Step.js +28 -12
- package/dist/packages/_es/Steps.js +8 -3
- package/dist/packages/_es/Sticky.js +29 -24
- package/dist/packages/_es/SubSideNavBar.js +2 -2
- package/dist/packages/_es/Swipe.js +40 -27
- package/dist/packages/_es/Swiper.js +32 -14
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +4 -4
- package/dist/packages/_es/TabPane.js +2 -2
- package/dist/packages/_es/Tabbar.js +4 -4
- package/dist/packages/_es/TabbarItem.js +28 -23
- package/dist/packages/_es/Table.js +14 -14
- package/dist/packages/_es/Tabs.js +19 -15
- package/dist/packages/_es/Tag.js +14 -8
- package/dist/packages/_es/TextArea.js +49 -15
- package/dist/packages/_es/TimeDetail.js +5 -4
- package/dist/packages/_es/TimePannel.js +4 -4
- package/dist/packages/_es/TimeSelect.js +9 -8
- package/dist/packages/_es/Toast.js +42 -171
- package/dist/packages/_es/Uploader.js +108 -139
- package/dist/packages/_es/Video.js +14 -10
- package/dist/packages/_es/common.js +2 -2
- package/dist/packages/_es/component.js +2 -2
- package/dist/packages/_es/index.js +45 -7
- package/dist/packages/_es/index.taro.js +719 -0
- package/dist/packages/_es/index2.js +2 -2
- package/dist/packages/_es/index3.js +57 -29
- package/dist/packages/_es/index4.js +414 -57
- package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
- package/dist/packages/_es/pxCheck.js +2 -2
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +2 -2
- package/dist/packages/badge/index.scss +11 -13
- package/dist/packages/button/index.scss +1 -0
- package/dist/packages/calendar/index.scss +9 -4
- package/dist/packages/calendaritem/index.scss +0 -207
- package/dist/packages/cell/index.scss +6 -6
- package/dist/packages/checkbox/index.scss +4 -3
- package/dist/packages/collapseitem/index.scss +21 -11
- package/dist/packages/countdown/index.scss +3 -1
- package/dist/packages/divider/index.scss +8 -8
- package/dist/packages/elevator/index.scss +36 -36
- package/dist/packages/formitem/index.scss +15 -8
- package/dist/packages/indicator/index.scss +1 -1
- package/dist/packages/input/index.scss +70 -24
- package/dist/packages/inputnumber/index.scss +4 -2
- package/dist/packages/list/index.scss +24 -0
- package/dist/packages/menu/index.scss +3 -3
- package/dist/packages/navbar/index.scss +28 -8
- package/dist/packages/noticebar/index.scss +7 -8
- package/dist/packages/notify/index.scss +9 -0
- package/dist/packages/numberkeyboard/index.scss +22 -21
- package/dist/packages/oldpicker/index.scss +131 -0
- package/dist/packages/picker/index.scss +38 -32
- package/dist/packages/progress/index.scss +6 -5
- package/dist/packages/radio/index.scss +7 -6
- package/dist/packages/range/index.scss +109 -2
- package/dist/packages/searchbar/index.scss +7 -7
- package/dist/packages/sidenavbaritem/index.scss +5 -5
- package/dist/packages/step/index.scss +29 -29
- package/dist/packages/subsidenavbar/index.scss +10 -8
- package/dist/packages/tabbaritem/index.scss +15 -0
- package/dist/packages/timedetail/index.scss +13 -13
- package/dist/packages/timepannel/index.scss +7 -7
- package/dist/packages/timeselect/index.scss +3 -3
- package/dist/packages/uploader/index.scss +6 -6
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +64 -62
- package/dist/styles/themes/jdt.scss +91 -0
- package/dist/styles/variables-jdt.scss +728 -0
- package/dist/styles/variables.scss +250 -44
- package/package.json +2 -1
- package/dist/packages/_es/raf.js +0 -19
- package/dist/styles/themes/jdd.scss +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { getCurrentInstance } from "vue";
|
|
@@ -1,36 +1,64 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const element = unref(elementRef);
|
|
12
|
-
if (isWindow(element)) {
|
|
13
|
-
const width = element.innerWidth;
|
|
14
|
-
const height = element.innerHeight;
|
|
15
|
-
return {
|
|
16
|
-
top: 0,
|
|
17
|
-
left: 0,
|
|
18
|
-
right: width,
|
|
19
|
-
bottom: height,
|
|
20
|
-
width,
|
|
21
|
-
height
|
|
22
|
-
};
|
|
6
|
+
import { ref } from "vue";
|
|
7
|
+
const MIN_DISTANCE = 10;
|
|
8
|
+
function getDirection(x, y) {
|
|
9
|
+
if (x > y && x > MIN_DISTANCE) {
|
|
10
|
+
return "horizontal";
|
|
23
11
|
}
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
12
|
+
if (y > x && y > MIN_DISTANCE) {
|
|
13
|
+
return "vertical";
|
|
26
14
|
}
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
function useTouch() {
|
|
18
|
+
const startX = ref(0);
|
|
19
|
+
const startY = ref(0);
|
|
20
|
+
const deltaX = ref(0);
|
|
21
|
+
const deltaY = ref(0);
|
|
22
|
+
const offsetX = ref(0);
|
|
23
|
+
const offsetY = ref(0);
|
|
24
|
+
const direction = ref("");
|
|
25
|
+
const isVertical = () => direction.value === "vertical";
|
|
26
|
+
const isHorizontal = () => direction.value === "horizontal";
|
|
27
|
+
const reset = () => {
|
|
28
|
+
deltaX.value = 0;
|
|
29
|
+
deltaY.value = 0;
|
|
30
|
+
offsetX.value = 0;
|
|
31
|
+
offsetY.value = 0;
|
|
32
|
+
direction.value = "";
|
|
33
|
+
};
|
|
34
|
+
const start = (event) => {
|
|
35
|
+
reset();
|
|
36
|
+
startX.value = event.touches[0].clientX;
|
|
37
|
+
startY.value = event.touches[0].clientY;
|
|
38
|
+
};
|
|
39
|
+
const move = (event) => {
|
|
40
|
+
const touch = event.touches[0];
|
|
41
|
+
deltaX.value = touch.clientX - startX.value;
|
|
42
|
+
deltaY.value = touch.clientY - startY.value;
|
|
43
|
+
offsetX.value = Math.abs(deltaX.value);
|
|
44
|
+
offsetY.value = Math.abs(deltaY.value);
|
|
45
|
+
if (!direction.value) {
|
|
46
|
+
direction.value = getDirection(offsetX.value, offsetY.value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
27
49
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
move,
|
|
51
|
+
start,
|
|
52
|
+
reset,
|
|
53
|
+
startX,
|
|
54
|
+
startY,
|
|
55
|
+
deltaX,
|
|
56
|
+
deltaY,
|
|
57
|
+
offsetX,
|
|
58
|
+
offsetY,
|
|
59
|
+
direction,
|
|
60
|
+
isVertical,
|
|
61
|
+
isHorizontal
|
|
34
62
|
};
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
63
|
+
}
|
|
64
|
+
export { useTouch as u };
|
|
@@ -1,64 +1,421 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
4
23
|
* Released under the MIT License.
|
|
5
24
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
25
|
+
import { computed, watch, onDeactivated, onBeforeUnmount, onMounted, onActivated, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow, h, reactive, onBeforeMount, toRefs, resolveComponent, Teleport, createCommentVNode, createVNode, createElementBlock } from "vue";
|
|
26
|
+
import { u as useLockScroll } from "./use-lock-scroll.js";
|
|
27
|
+
import { c as createComponent } from "./component.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
30
|
+
const { componentName: componentName$2, create: create$2 } = createComponent("overlay");
|
|
31
|
+
const overlayProps = {
|
|
32
|
+
visible: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
zIndex: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: 2e3
|
|
39
|
+
},
|
|
40
|
+
duration: {
|
|
41
|
+
type: [Number, String],
|
|
42
|
+
default: 0.3
|
|
43
|
+
},
|
|
44
|
+
overlayClass: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ""
|
|
47
|
+
},
|
|
48
|
+
lockScroll: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
overlayStyle: {
|
|
53
|
+
type: Object
|
|
54
|
+
},
|
|
55
|
+
closeOnClickOverlay: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
11
58
|
}
|
|
12
|
-
|
|
13
|
-
|
|
59
|
+
};
|
|
60
|
+
const _sfc_main$2 = create$2({
|
|
61
|
+
props: overlayProps,
|
|
62
|
+
emits: ["click", "update:visible"],
|
|
63
|
+
setup(props, { emit }) {
|
|
64
|
+
const classes = computed(() => {
|
|
65
|
+
const prefixCls = componentName$2;
|
|
66
|
+
return {
|
|
67
|
+
[prefixCls]: true,
|
|
68
|
+
[props.overlayClass]: true
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
watch(() => props.visible, (value) => {
|
|
72
|
+
value ? lock() : unlock();
|
|
73
|
+
});
|
|
74
|
+
const lock = () => {
|
|
75
|
+
if (props.lockScroll && props.visible) {
|
|
76
|
+
document.body.classList.add("nut-overflow-hidden");
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const unlock = () => {
|
|
80
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
81
|
+
};
|
|
82
|
+
onDeactivated(unlock);
|
|
83
|
+
onBeforeUnmount(unlock);
|
|
84
|
+
onMounted(lock);
|
|
85
|
+
onActivated(lock);
|
|
86
|
+
const style = computed(() => {
|
|
87
|
+
return __spreadValues({
|
|
88
|
+
animationDuration: `${props.duration}s`,
|
|
89
|
+
zIndex: props.zIndex
|
|
90
|
+
}, props.overlayStyle);
|
|
91
|
+
});
|
|
92
|
+
const touchmove = (e) => {
|
|
93
|
+
if (props.lockScroll)
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
};
|
|
96
|
+
const onClick = (e) => {
|
|
97
|
+
emit("click", e);
|
|
98
|
+
if (props.closeOnClickOverlay) {
|
|
99
|
+
emit("update:visible", false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return { classes, style, touchmove, onClick };
|
|
14
103
|
}
|
|
15
|
-
|
|
104
|
+
});
|
|
105
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
106
|
+
return openBlock(), createBlock(Transition, { name: "overlay-fade" }, {
|
|
107
|
+
default: withCtx(() => [
|
|
108
|
+
withDirectives(createElementVNode("view", {
|
|
109
|
+
class: normalizeClass(_ctx.classes),
|
|
110
|
+
onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.touchmove && _ctx.touchmove(...args), ["stop"])),
|
|
111
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
112
|
+
style: normalizeStyle(_ctx.style)
|
|
113
|
+
}, [
|
|
114
|
+
renderSlot(_ctx.$slots, "default")
|
|
115
|
+
], 38), [
|
|
116
|
+
[vShow, _ctx.visible]
|
|
117
|
+
])
|
|
118
|
+
]),
|
|
119
|
+
_: 3
|
|
120
|
+
});
|
|
16
121
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
122
|
+
var overlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
|
|
123
|
+
const { componentName: componentName$1, create: create$1 } = createComponent("icon");
|
|
124
|
+
const _sfc_main$1 = create$1({
|
|
125
|
+
props: {
|
|
126
|
+
name: { type: String, default: "" },
|
|
127
|
+
size: { type: [String, Number], default: "" },
|
|
128
|
+
classPrefix: { type: String, default: "nut-icon" },
|
|
129
|
+
fontClassName: { type: String, default: "nutui-iconfont" },
|
|
130
|
+
color: { type: String, default: "" },
|
|
131
|
+
tag: { type: String, default: "i" }
|
|
132
|
+
},
|
|
133
|
+
emits: ["click"],
|
|
134
|
+
setup(props, { emit, slots }) {
|
|
135
|
+
const handleClick = (event) => {
|
|
136
|
+
emit("click", event);
|
|
137
|
+
};
|
|
138
|
+
const isImage = () => {
|
|
139
|
+
return props.name ? props.name.indexOf("/") !== -1 : false;
|
|
140
|
+
};
|
|
141
|
+
return () => {
|
|
142
|
+
var _a;
|
|
143
|
+
const _isImage = isImage();
|
|
144
|
+
return h(_isImage ? "img" : props.tag, {
|
|
145
|
+
class: _isImage ? `${componentName$1}__img` : `${props.fontClassName} ${componentName$1} ${props.classPrefix}-${props.name}`,
|
|
146
|
+
style: {
|
|
147
|
+
color: props.color,
|
|
148
|
+
fontSize: pxCheck(props.size),
|
|
149
|
+
width: pxCheck(props.size),
|
|
150
|
+
height: pxCheck(props.size)
|
|
151
|
+
},
|
|
152
|
+
onClick: handleClick,
|
|
153
|
+
src: _isImage ? props.name : ""
|
|
154
|
+
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
const { componentName, create } = createComponent("popup");
|
|
159
|
+
let _zIndex = 2e3;
|
|
160
|
+
const popupProps = __spreadProps(__spreadValues({}, overlayProps), {
|
|
161
|
+
position: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: "center"
|
|
164
|
+
},
|
|
165
|
+
transition: String,
|
|
166
|
+
style: {
|
|
167
|
+
type: Object
|
|
168
|
+
},
|
|
169
|
+
popClass: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: ""
|
|
172
|
+
},
|
|
173
|
+
closeable: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: false
|
|
176
|
+
},
|
|
177
|
+
closeIconPosition: {
|
|
178
|
+
type: String,
|
|
179
|
+
default: "top-right"
|
|
180
|
+
},
|
|
181
|
+
closeIcon: {
|
|
182
|
+
type: String,
|
|
183
|
+
default: "close"
|
|
184
|
+
},
|
|
185
|
+
destroyOnClose: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: true
|
|
188
|
+
},
|
|
189
|
+
teleport: {
|
|
190
|
+
type: [String, Element],
|
|
191
|
+
default: "body"
|
|
192
|
+
},
|
|
193
|
+
overlay: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: true
|
|
196
|
+
},
|
|
197
|
+
round: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: false
|
|
200
|
+
},
|
|
201
|
+
isWrapTeleport: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: true
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
const _sfc_main = create({
|
|
207
|
+
components: {
|
|
208
|
+
[overlay.name]: overlay,
|
|
209
|
+
[_sfc_main$1.name]: _sfc_main$1
|
|
210
|
+
},
|
|
211
|
+
props: __spreadValues({}, popupProps),
|
|
212
|
+
emits: ["click", "click-close-icon", "open", "close", "opend", "closed", "update:visible", "click-overlay"],
|
|
213
|
+
setup(props, { emit }) {
|
|
214
|
+
const state = reactive({
|
|
215
|
+
zIndex: props.zIndex ? props.zIndex : _zIndex,
|
|
216
|
+
showSlot: true,
|
|
217
|
+
transitionName: `popup-fade-${props.position}`,
|
|
218
|
+
overLayCount: 1,
|
|
219
|
+
keepAlive: false,
|
|
220
|
+
closed: props.closeable
|
|
221
|
+
});
|
|
222
|
+
const [lockScroll, unlockScroll] = useLockScroll(() => props.lockScroll);
|
|
223
|
+
const classes = computed(() => {
|
|
224
|
+
const prefixCls = componentName;
|
|
225
|
+
return {
|
|
226
|
+
[prefixCls]: true,
|
|
227
|
+
["round"]: props.round,
|
|
228
|
+
[`popup-${props.position}`]: true,
|
|
229
|
+
[props.popClass]: true
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
const popStyle = computed(() => {
|
|
233
|
+
return __spreadValues({
|
|
234
|
+
zIndex: state.zIndex,
|
|
235
|
+
animationDuration: props.duration ? `${props.duration}s` : "initial"
|
|
236
|
+
}, props.style);
|
|
237
|
+
});
|
|
238
|
+
const open = () => {
|
|
239
|
+
if (!props.visible) {
|
|
240
|
+
if (props.zIndex !== void 0) {
|
|
241
|
+
_zIndex = Number(props.zIndex);
|
|
242
|
+
}
|
|
243
|
+
emit("update:visible", true);
|
|
244
|
+
lockScroll();
|
|
245
|
+
state.zIndex = ++_zIndex;
|
|
246
|
+
}
|
|
247
|
+
if (props.destroyOnClose) {
|
|
248
|
+
state.showSlot = true;
|
|
249
|
+
}
|
|
250
|
+
emit("open");
|
|
251
|
+
};
|
|
252
|
+
const close = () => {
|
|
253
|
+
if (props.visible) {
|
|
254
|
+
unlockScroll();
|
|
255
|
+
emit("update:visible", false);
|
|
256
|
+
if (props.destroyOnClose) {
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
state.showSlot = false;
|
|
259
|
+
emit("close");
|
|
260
|
+
}, +props.duration * 1e3);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const onClick = (e) => {
|
|
265
|
+
emit("click", e);
|
|
266
|
+
};
|
|
267
|
+
const onClickCloseIcon = (e) => {
|
|
268
|
+
emit("click-close-icon", e);
|
|
269
|
+
close();
|
|
270
|
+
};
|
|
271
|
+
const onClickOverlay = (e) => {
|
|
272
|
+
if (props.closeOnClickOverlay) {
|
|
273
|
+
emit("click-overlay", e);
|
|
274
|
+
close();
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
const onOpened = (e) => {
|
|
278
|
+
emit("opend", e);
|
|
279
|
+
};
|
|
280
|
+
const onClosed = (e) => {
|
|
281
|
+
emit("closed", e);
|
|
282
|
+
};
|
|
283
|
+
onMounted(() => {
|
|
284
|
+
props.transition ? state.transitionName = props.transition : state.transitionName = `popup-slide-${props.position}`;
|
|
285
|
+
props.visible && open();
|
|
286
|
+
});
|
|
287
|
+
onBeforeUnmount(() => {
|
|
288
|
+
props.visible && close();
|
|
289
|
+
});
|
|
290
|
+
onBeforeMount(() => {
|
|
291
|
+
if (props.visible) {
|
|
292
|
+
unlockScroll();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
onActivated(() => {
|
|
296
|
+
if (state.keepAlive) {
|
|
297
|
+
emit("update:visible", true);
|
|
298
|
+
state.keepAlive = false;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
onDeactivated(() => {
|
|
302
|
+
if (props.visible) {
|
|
303
|
+
close();
|
|
304
|
+
state.keepAlive = true;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
watch(() => props.visible, (value) => {
|
|
308
|
+
if (value) {
|
|
309
|
+
open();
|
|
310
|
+
} else {
|
|
311
|
+
close();
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
watch(() => props.position, (value) => {
|
|
315
|
+
value === "center" ? state.transitionName = "popup-fade" : state.transitionName = `popup-slide-${value}`;
|
|
316
|
+
});
|
|
317
|
+
watch(() => props.closeable, (value) => {
|
|
318
|
+
state.closed = value;
|
|
319
|
+
});
|
|
320
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
321
|
+
popStyle,
|
|
322
|
+
classes,
|
|
323
|
+
onClick,
|
|
324
|
+
onClickCloseIcon,
|
|
325
|
+
onClickOverlay,
|
|
326
|
+
onOpened,
|
|
327
|
+
onClosed
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
const _hoisted_1 = { key: 1 };
|
|
332
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
333
|
+
const _component_nut_overlay = resolveComponent("nut-overlay");
|
|
334
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
335
|
+
return _ctx.isWrapTeleport ? (openBlock(), createBlock(Teleport, {
|
|
336
|
+
key: 0,
|
|
337
|
+
to: _ctx.teleport
|
|
338
|
+
}, [
|
|
339
|
+
_ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
|
|
340
|
+
key: 0,
|
|
341
|
+
visible: _ctx.visible,
|
|
342
|
+
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
343
|
+
class: normalizeClass(_ctx.overlayClass),
|
|
344
|
+
style: normalizeStyle(_ctx.overlayStyle),
|
|
345
|
+
"z-index": _ctx.zIndex,
|
|
346
|
+
"lock-scroll": _ctx.lockScroll,
|
|
347
|
+
duration: _ctx.duration,
|
|
348
|
+
onClick: _ctx.onClickOverlay
|
|
349
|
+
}, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
|
|
350
|
+
createVNode(Transition, {
|
|
351
|
+
name: _ctx.transitionName,
|
|
352
|
+
onAfterEnter: _ctx.onOpened,
|
|
353
|
+
onAfterLeave: _ctx.onClosed
|
|
354
|
+
}, {
|
|
355
|
+
default: withCtx(() => [
|
|
356
|
+
withDirectives(createElementVNode("view", {
|
|
357
|
+
class: normalizeClass(_ctx.classes),
|
|
358
|
+
style: normalizeStyle(_ctx.popStyle),
|
|
359
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
360
|
+
}, [
|
|
361
|
+
_ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
|
|
362
|
+
_ctx.closed ? (openBlock(), createElementBlock("view", {
|
|
363
|
+
key: 1,
|
|
364
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
|
|
365
|
+
class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
|
|
366
|
+
}, [
|
|
367
|
+
createVNode(_component_nut_icon, {
|
|
368
|
+
name: _ctx.closeIcon,
|
|
369
|
+
size: "12px"
|
|
370
|
+
}, null, 8, ["name"])
|
|
371
|
+
], 2)) : createCommentVNode("", true)
|
|
372
|
+
], 6), [
|
|
373
|
+
[vShow, _ctx.visible]
|
|
374
|
+
])
|
|
375
|
+
]),
|
|
376
|
+
_: 3
|
|
377
|
+
}, 8, ["name", "onAfterEnter", "onAfterLeave"])
|
|
378
|
+
], 8, ["to"])) : (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
379
|
+
_ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
|
|
380
|
+
key: 0,
|
|
381
|
+
visible: _ctx.visible,
|
|
382
|
+
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
383
|
+
class: normalizeClass(_ctx.overlayClass),
|
|
384
|
+
style: normalizeStyle(_ctx.overlayStyle),
|
|
385
|
+
"z-index": _ctx.zIndex,
|
|
386
|
+
"lock-scroll": _ctx.lockScroll,
|
|
387
|
+
duration: _ctx.duration,
|
|
388
|
+
onClick: _ctx.onClickOverlay
|
|
389
|
+
}, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
|
|
390
|
+
createVNode(Transition, {
|
|
391
|
+
name: _ctx.transitionName,
|
|
392
|
+
onAfterEnter: _ctx.onOpened,
|
|
393
|
+
onAfterLeave: _ctx.onClosed
|
|
394
|
+
}, {
|
|
395
|
+
default: withCtx(() => [
|
|
396
|
+
withDirectives(createElementVNode("view", {
|
|
397
|
+
class: normalizeClass(_ctx.classes),
|
|
398
|
+
style: normalizeStyle(_ctx.popStyle),
|
|
399
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
400
|
+
}, [
|
|
401
|
+
_ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
|
|
402
|
+
_ctx.closed ? (openBlock(), createElementBlock("view", {
|
|
403
|
+
key: 1,
|
|
404
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
|
|
405
|
+
class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
|
|
406
|
+
}, [
|
|
407
|
+
createVNode(_component_nut_icon, {
|
|
408
|
+
name: _ctx.closeIcon,
|
|
409
|
+
size: "12px"
|
|
410
|
+
}, null, 8, ["name"])
|
|
411
|
+
], 2)) : createCommentVNode("", true)
|
|
412
|
+
], 6), [
|
|
413
|
+
[vShow, _ctx.visible]
|
|
414
|
+
])
|
|
415
|
+
]),
|
|
416
|
+
_: 3
|
|
417
|
+
}, 8, ["name", "onAfterEnter", "onAfterLeave"])
|
|
418
|
+
]));
|
|
63
419
|
}
|
|
64
|
-
|
|
420
|
+
var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
421
|
+
export { Popup as P, _sfc_main$1 as _, popupProps as p };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
var _export_sfc = (sfc, props) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
const pxCheck = (value) => {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
let count = 0;
|
|
7
|
+
const CLSNAME = "nut-overflow-hidden";
|
|
8
|
+
const useLockScroll = (isLock) => {
|
|
9
|
+
const lock = () => {
|
|
10
|
+
if (isLock()) {
|
|
11
|
+
!count && document.body.classList.add(CLSNAME);
|
|
12
|
+
count++;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const unlock = () => {
|
|
16
|
+
if (isLock() && count) {
|
|
17
|
+
count--;
|
|
18
|
+
!count && document.body.classList.remove(CLSNAME);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return [lock, unlock];
|
|
22
|
+
};
|
|
23
|
+
export { useLockScroll as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
const TypeOfFun = (value) => {
|
|
@@ -4,32 +4,30 @@
|
|
|
4
4
|
.slot-icons {
|
|
5
5
|
position: absolute;
|
|
6
6
|
background: $badge-background-color;
|
|
7
|
-
border-radius: 7px;
|
|
8
7
|
top: -20%;
|
|
9
8
|
right: -20%;
|
|
10
|
-
padding:
|
|
9
|
+
padding: $badge-padding;
|
|
11
10
|
text-align: center;
|
|
12
|
-
border-radius:
|
|
13
|
-
z-index:
|
|
11
|
+
border-radius: $badge-border-radius;
|
|
12
|
+
z-index: $badge-z-index;
|
|
14
13
|
}
|
|
15
14
|
.sup {
|
|
16
15
|
position: absolute;
|
|
17
16
|
background: $badge-background-color;
|
|
18
|
-
|
|
19
|
-
padding: 0 5px;
|
|
17
|
+
padding: $badge-padding;
|
|
20
18
|
text-align: center;
|
|
21
|
-
border-radius:
|
|
19
|
+
border-radius: $badge-border-radius;
|
|
22
20
|
font-size: $badge-font-size;
|
|
23
21
|
font-weight: normal;
|
|
24
|
-
color: $badge-
|
|
22
|
+
color: $badge-color;
|
|
25
23
|
}
|
|
26
24
|
.nut-badge__content {
|
|
27
|
-
transform:
|
|
25
|
+
transform: $badge-content-transform;
|
|
28
26
|
}
|
|
29
27
|
.is-dot {
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
32
|
-
border-radius:
|
|
33
|
-
padding:
|
|
28
|
+
width: $badge-dot-width;
|
|
29
|
+
height: $badge-dot-height;
|
|
30
|
+
border-radius: $badge-dot-border-radius;
|
|
31
|
+
padding: $badge-dot-padding;
|
|
34
32
|
}
|
|
35
33
|
}
|