@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,18 +1,19 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
import { c as
|
|
3
|
-
import { P as
|
|
4
|
-
import { _ as
|
|
1
|
+
import { computed, provide, resolveComponent, openBlock, createBlock, normalizeStyle, withCtx, createElementVNode, normalizeClass, createElementBlock, toDisplayString, renderSlot } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { P as Popup } from "./index-da0a7662.js";
|
|
4
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
5
5
|
import "../locale/lang";
|
|
6
6
|
import "./Overlay.js";
|
|
7
7
|
import "@nutui/icons-vue";
|
|
8
|
-
const { componentName
|
|
8
|
+
const { componentName, create, translate } = createComponent("time-select");
|
|
9
|
+
const _sfc_main = create({
|
|
9
10
|
components: {
|
|
10
|
-
[
|
|
11
|
+
[Popup.name]: Popup
|
|
11
12
|
},
|
|
12
13
|
props: {
|
|
13
14
|
visible: {
|
|
14
15
|
type: Boolean,
|
|
15
|
-
defalut:
|
|
16
|
+
defalut: false
|
|
16
17
|
},
|
|
17
18
|
height: {
|
|
18
19
|
type: [String],
|
|
@@ -28,64 +29,84 @@ const { componentName: S, create: w, translate: $ } = b("time-select"), g = w({
|
|
|
28
29
|
},
|
|
29
30
|
currentTime: {
|
|
30
31
|
type: Array,
|
|
31
|
-
default: () =>
|
|
32
|
+
default: () => {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
32
35
|
},
|
|
33
36
|
lockScroll: {
|
|
34
37
|
type: [Boolean],
|
|
35
|
-
default:
|
|
38
|
+
default: true
|
|
36
39
|
},
|
|
37
40
|
teleportDisable: {
|
|
38
41
|
type: Boolean,
|
|
39
|
-
default:
|
|
42
|
+
default: false
|
|
40
43
|
}
|
|
41
44
|
},
|
|
42
45
|
emits: ["update:visible", "select"],
|
|
43
|
-
setup: (
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
|
|
46
|
+
setup: (props, context) => {
|
|
47
|
+
const classes = computed(() => {
|
|
48
|
+
const prefixCls = componentName;
|
|
49
|
+
return {
|
|
50
|
+
[prefixCls]: true
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
const popStyle = computed(() => {
|
|
54
|
+
return {
|
|
55
|
+
width: "100%",
|
|
56
|
+
height: props.height
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
const currentKey = computed(() => props.currentKey);
|
|
60
|
+
const currentTime = computed(() => props.currentTime);
|
|
61
|
+
const close = () => {
|
|
62
|
+
context.emit("update:visible", false);
|
|
63
|
+
context.emit("select", currentTime.value);
|
|
51
64
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
provide("currentKey", currentKey);
|
|
66
|
+
provide("currentTime", currentTime);
|
|
67
|
+
return {
|
|
68
|
+
classes,
|
|
69
|
+
popStyle,
|
|
70
|
+
props,
|
|
71
|
+
close,
|
|
72
|
+
translate
|
|
58
73
|
};
|
|
59
74
|
}
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
});
|
|
76
|
+
const _hoisted_1 = { class: "nut-time-select__title" };
|
|
77
|
+
const _hoisted_2 = { class: "nut-time-select__title__fixed" };
|
|
78
|
+
const _hoisted_3 = { key: 0 };
|
|
79
|
+
const _hoisted_4 = { class: "nut-time-select__content" };
|
|
80
|
+
const _hoisted_5 = { class: "nut-time-select__content__pannel" };
|
|
81
|
+
const _hoisted_6 = { class: "nut-time-select__content__detail" };
|
|
82
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
83
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
84
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
64
85
|
position: "bottom",
|
|
65
86
|
closeable: "",
|
|
66
87
|
round: "",
|
|
67
|
-
teleportDisable:
|
|
68
|
-
visible:
|
|
69
|
-
style:
|
|
70
|
-
"lock-scroll":
|
|
71
|
-
onClickOverlay:
|
|
72
|
-
onClickCloseIcon:
|
|
88
|
+
teleportDisable: _ctx.teleportDisable,
|
|
89
|
+
visible: _ctx.visible,
|
|
90
|
+
style: normalizeStyle(_ctx.popStyle),
|
|
91
|
+
"lock-scroll": _ctx.lockScroll,
|
|
92
|
+
onClickOverlay: _ctx.close,
|
|
93
|
+
onClickCloseIcon: _ctx.close
|
|
73
94
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
|
|
76
|
-
class:
|
|
95
|
+
default: withCtx(() => [
|
|
96
|
+
createElementVNode("view", {
|
|
97
|
+
class: normalizeClass(_ctx.classes)
|
|
77
98
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
createElementVNode("view", _hoisted_1, [
|
|
100
|
+
createElementVNode("view", _hoisted_2, [
|
|
101
|
+
!_ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.title || _ctx.translate("pickupTime")), 1)) : renderSlot(_ctx.$slots, "title", { key: 1 })
|
|
81
102
|
])
|
|
82
103
|
]),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
104
|
+
createElementVNode("view", _hoisted_4, [
|
|
105
|
+
createElementVNode("view", _hoisted_5, [
|
|
106
|
+
renderSlot(_ctx.$slots, "pannel")
|
|
86
107
|
]),
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
createElementVNode("view", _hoisted_6, [
|
|
109
|
+
renderSlot(_ctx.$slots, "detail")
|
|
89
110
|
])
|
|
90
111
|
])
|
|
91
112
|
], 2)
|
|
@@ -93,7 +114,7 @@ function E(e, o, r, c, a, s) {
|
|
|
93
114
|
_: 3
|
|
94
115
|
}, 8, ["teleportDisable", "visible", "style", "lock-scroll", "onClickOverlay", "onClickCloseIcon"]);
|
|
95
116
|
}
|
|
96
|
-
const
|
|
117
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
97
118
|
export {
|
|
98
|
-
|
|
119
|
+
index as default
|
|
99
120
|
};
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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));
|
|
20
|
+
import { reactive, onMounted, watch, computed, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, resolveDynamicComponent, createCommentVNode, toDisplayString, vShow, createVNode, render } from "vue";
|
|
21
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
22
|
+
import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
|
|
23
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
17
24
|
import "../locale/lang";
|
|
18
|
-
import { C as
|
|
19
|
-
import { Success
|
|
20
|
-
const { create
|
|
25
|
+
import { C as CreateComponent } from "./mountComponent-8b24c346.js";
|
|
26
|
+
import { Success, Failure, Tips, Loading } from "@nutui/icons-vue";
|
|
27
|
+
const { create } = createComponent("toast");
|
|
28
|
+
const _sfc_main = create({
|
|
21
29
|
components: {},
|
|
22
30
|
props: {
|
|
23
31
|
id: String,
|
|
@@ -28,7 +36,7 @@ const { create: ne } = Q("toast"), oe = ne({
|
|
|
28
36
|
},
|
|
29
37
|
center: {
|
|
30
38
|
type: Boolean,
|
|
31
|
-
default:
|
|
39
|
+
default: true
|
|
32
40
|
},
|
|
33
41
|
type: {
|
|
34
42
|
type: String,
|
|
@@ -49,11 +57,11 @@ const { create: ne } = Q("toast"), oe = ne({
|
|
|
49
57
|
},
|
|
50
58
|
textAlignCenter: {
|
|
51
59
|
type: Boolean,
|
|
52
|
-
default:
|
|
60
|
+
default: true
|
|
53
61
|
},
|
|
54
62
|
loadingRotate: {
|
|
55
63
|
type: Boolean,
|
|
56
|
-
default:
|
|
64
|
+
default: true
|
|
57
65
|
},
|
|
58
66
|
bgColor: {
|
|
59
67
|
type: String,
|
|
@@ -63,7 +71,7 @@ const { create: ne } = Q("toast"), oe = ne({
|
|
|
63
71
|
unmount: Function,
|
|
64
72
|
cover: {
|
|
65
73
|
type: Boolean,
|
|
66
|
-
default:
|
|
74
|
+
default: false
|
|
67
75
|
},
|
|
68
76
|
coverColor: {
|
|
69
77
|
type: String,
|
|
@@ -75,107 +83,142 @@ const { create: ne } = Q("toast"), oe = ne({
|
|
|
75
83
|
},
|
|
76
84
|
closeOnClickOverlay: {
|
|
77
85
|
type: Boolean,
|
|
78
|
-
default:
|
|
86
|
+
default: false
|
|
79
87
|
}
|
|
80
88
|
},
|
|
81
89
|
emits: ["close"],
|
|
82
|
-
setup(
|
|
83
|
-
let
|
|
84
|
-
const
|
|
85
|
-
mounted:
|
|
90
|
+
setup(props, { emit }) {
|
|
91
|
+
let timer;
|
|
92
|
+
const state = reactive({
|
|
93
|
+
mounted: false
|
|
86
94
|
});
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
state.mounted = true;
|
|
89
97
|
});
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, A = () => {
|
|
99
|
-
e.closeOnClickOverlay && (u(), t("close"));
|
|
98
|
+
const clearTimer = () => {
|
|
99
|
+
if (timer) {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
timer = null;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const hide = () => {
|
|
105
|
+
state.mounted = false;
|
|
100
106
|
};
|
|
101
|
-
|
|
102
|
-
()
|
|
103
|
-
(
|
|
104
|
-
|
|
107
|
+
const show = () => {
|
|
108
|
+
clearTimer();
|
|
109
|
+
if (props.duration) {
|
|
110
|
+
timer = setTimeout(() => {
|
|
111
|
+
hide();
|
|
112
|
+
}, props.duration);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const clickCover = () => {
|
|
116
|
+
if (props.closeOnClickOverlay) {
|
|
117
|
+
hide();
|
|
118
|
+
emit("close");
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
if (props.duration) {
|
|
122
|
+
show();
|
|
123
|
+
}
|
|
124
|
+
watch(
|
|
125
|
+
() => props.duration,
|
|
126
|
+
(val) => {
|
|
127
|
+
if (val) {
|
|
128
|
+
show();
|
|
129
|
+
}
|
|
105
130
|
}
|
|
106
131
|
);
|
|
107
|
-
const
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
const hasIcon = computed(() => {
|
|
133
|
+
if (props.type !== "text") {
|
|
134
|
+
return true;
|
|
135
|
+
} else {
|
|
136
|
+
return props.icon !== null;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const toastBodyClass = computed(() => {
|
|
140
|
+
return [
|
|
141
|
+
"nut-toast",
|
|
142
|
+
{ "nut-toast-center": props.center },
|
|
143
|
+
{ "nut-toast-has-icon": hasIcon.value },
|
|
144
|
+
{ "nut-toast-cover": props.cover },
|
|
145
|
+
{ "nut-toast-loading": props.type === "loading" },
|
|
146
|
+
props.customClass,
|
|
147
|
+
"nut-toast-" + props.size
|
|
148
|
+
];
|
|
149
|
+
});
|
|
150
|
+
const toastIconWrapperClass = computed(() => {
|
|
151
|
+
return ["nut-toast-icon-wrapper", { "nut-toast-icon-no-animation": !props.loadingRotate }];
|
|
152
|
+
});
|
|
153
|
+
const onAfterLeave = () => {
|
|
154
|
+
clearTimer();
|
|
155
|
+
props.unmount(props.id);
|
|
156
|
+
props.onClose && props.onClose();
|
|
157
|
+
};
|
|
116
158
|
return {
|
|
117
|
-
state
|
|
118
|
-
hide
|
|
119
|
-
clickCover
|
|
120
|
-
hasIcon
|
|
121
|
-
toastBodyClass
|
|
122
|
-
toastIconWrapperClass
|
|
123
|
-
onAfterLeave
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
renderIcon: X
|
|
159
|
+
state,
|
|
160
|
+
hide,
|
|
161
|
+
clickCover,
|
|
162
|
+
hasIcon,
|
|
163
|
+
toastBodyClass,
|
|
164
|
+
toastIconWrapperClass,
|
|
165
|
+
onAfterLeave,
|
|
166
|
+
renderIcon
|
|
127
167
|
};
|
|
128
168
|
}
|
|
129
|
-
})
|
|
169
|
+
});
|
|
170
|
+
const _hoisted_1 = {
|
|
130
171
|
key: 1,
|
|
131
172
|
class: "nut-toast-title"
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
173
|
+
};
|
|
174
|
+
const _hoisted_2 = ["innerHTML"];
|
|
175
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
176
|
+
return openBlock(), createBlock(Transition, {
|
|
135
177
|
name: "toast-fade",
|
|
136
|
-
onAfterLeave:
|
|
178
|
+
onAfterLeave: _ctx.onAfterLeave
|
|
137
179
|
}, {
|
|
138
|
-
default:
|
|
139
|
-
|
|
140
|
-
class:
|
|
141
|
-
style:
|
|
142
|
-
bottom:
|
|
143
|
-
"background-color":
|
|
180
|
+
default: withCtx(() => [
|
|
181
|
+
withDirectives(createElementVNode("view", {
|
|
182
|
+
class: normalizeClass(_ctx.toastBodyClass),
|
|
183
|
+
style: normalizeStyle({
|
|
184
|
+
bottom: _ctx.center ? "auto" : _ctx.bottom,
|
|
185
|
+
"background-color": _ctx.coverColor
|
|
144
186
|
}),
|
|
145
|
-
onClick:
|
|
187
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
146
188
|
}, [
|
|
147
|
-
|
|
189
|
+
createElementVNode("view", {
|
|
148
190
|
class: "nut-toast-inner",
|
|
149
|
-
style:
|
|
150
|
-
"text-align":
|
|
151
|
-
"background-color":
|
|
191
|
+
style: normalizeStyle({
|
|
192
|
+
"text-align": _ctx.textAlignCenter ? "center" : "left",
|
|
193
|
+
"background-color": _ctx.bgColor
|
|
152
194
|
})
|
|
153
195
|
}, [
|
|
154
|
-
|
|
196
|
+
_ctx.hasIcon ? (openBlock(), createElementBlock("view", {
|
|
155
197
|
key: 0,
|
|
156
|
-
class:
|
|
198
|
+
class: normalizeClass(_ctx.toastIconWrapperClass)
|
|
157
199
|
}, [
|
|
158
|
-
(
|
|
159
|
-
], 2)) :
|
|
160
|
-
|
|
161
|
-
|
|
200
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(_ctx.icon)), { color: "#ffffff" }))
|
|
201
|
+
], 2)) : createCommentVNode("", true),
|
|
202
|
+
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
203
|
+
createElementVNode("view", {
|
|
162
204
|
class: "nut-toast-text",
|
|
163
|
-
innerHTML:
|
|
164
|
-
}, null, 8,
|
|
205
|
+
innerHTML: _ctx.msg
|
|
206
|
+
}, null, 8, _hoisted_2)
|
|
165
207
|
], 4)
|
|
166
208
|
], 6), [
|
|
167
|
-
[
|
|
209
|
+
[vShow, _ctx.state.mounted]
|
|
168
210
|
])
|
|
169
211
|
]),
|
|
170
212
|
_: 1
|
|
171
213
|
}, 8, ["onAfterLeave"]);
|
|
172
214
|
}
|
|
173
|
-
const
|
|
215
|
+
const Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
216
|
+
const defaultOptions = {
|
|
174
217
|
msg: "",
|
|
175
218
|
id: "",
|
|
176
219
|
duration: 2e3,
|
|
177
220
|
//显示时间(毫秒)
|
|
178
|
-
center:
|
|
221
|
+
center: true,
|
|
179
222
|
// 未实现
|
|
180
223
|
type: "text",
|
|
181
224
|
title: "",
|
|
@@ -184,84 +227,115 @@ const v = /* @__PURE__ */ Y(oe, [["render", ie]]), g = {
|
|
|
184
227
|
size: "base",
|
|
185
228
|
iconSize: "20",
|
|
186
229
|
icon: null,
|
|
187
|
-
textAlignCenter:
|
|
230
|
+
textAlignCenter: true,
|
|
188
231
|
// 未实现
|
|
189
|
-
loadingRotate:
|
|
232
|
+
loadingRotate: true,
|
|
190
233
|
// 未实现
|
|
191
234
|
bgColor: "",
|
|
192
235
|
onClose: null,
|
|
193
236
|
// 未实现
|
|
194
237
|
unmount: null,
|
|
195
|
-
cover:
|
|
238
|
+
cover: false,
|
|
196
239
|
//透明遮罩层 // 未实现
|
|
197
240
|
coverColor: "",
|
|
198
241
|
// 未实现
|
|
199
|
-
closeOnClickOverlay:
|
|
242
|
+
closeOnClickOverlay: false
|
|
200
243
|
// 未实现
|
|
201
244
|
};
|
|
202
|
-
let
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
245
|
+
let idsMap = [];
|
|
246
|
+
let optsMap = [];
|
|
247
|
+
const clearToast = (id) => {
|
|
248
|
+
if (id) {
|
|
249
|
+
const container = document.getElementById(id);
|
|
250
|
+
optsMap = optsMap.filter((item) => item.id !== id);
|
|
251
|
+
idsMap = idsMap.filter((item) => item !== id);
|
|
252
|
+
if (container) {
|
|
253
|
+
document.body.removeChild(container);
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
idsMap.forEach((item) => {
|
|
257
|
+
const container = document.getElementById(item);
|
|
258
|
+
if (container) {
|
|
259
|
+
document.body.removeChild(container);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
optsMap = [];
|
|
263
|
+
idsMap = [];
|
|
219
264
|
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
265
|
+
};
|
|
266
|
+
const updateToast = (opts) => {
|
|
267
|
+
const container = document.getElementById(opts.id);
|
|
268
|
+
if (container) {
|
|
269
|
+
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
270
|
+
if (currentOpt) {
|
|
271
|
+
opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
|
|
272
|
+
} else {
|
|
273
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
274
|
+
}
|
|
275
|
+
const instance = createVNode(Toast, opts);
|
|
276
|
+
render(instance, container);
|
|
277
|
+
return showToast;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const mountToast = (opts) => {
|
|
281
|
+
opts.unmount = clearToast;
|
|
282
|
+
let _id;
|
|
283
|
+
if (opts.id) {
|
|
284
|
+
_id = opts.id;
|
|
285
|
+
if (idsMap.find((item) => item === opts.id)) {
|
|
286
|
+
return updateToast(opts);
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
_id = (/* @__PURE__ */ new Date()).getTime() + "";
|
|
290
|
+
}
|
|
291
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
292
|
+
opts.id = _id;
|
|
293
|
+
idsMap.push(opts.id);
|
|
294
|
+
optsMap.push(opts);
|
|
295
|
+
CreateComponent(opts, {
|
|
296
|
+
wrapper: Toast
|
|
297
|
+
});
|
|
298
|
+
return showToast;
|
|
299
|
+
};
|
|
300
|
+
const errorMsg = (msg) => {
|
|
301
|
+
if (!msg) {
|
|
233
302
|
console.warn("[NutUI Toast]: msg不能为空");
|
|
234
303
|
return;
|
|
235
304
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
305
|
+
};
|
|
306
|
+
const showToast = {
|
|
307
|
+
text(msg, opts = {}) {
|
|
308
|
+
errorMsg(msg);
|
|
309
|
+
return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
|
|
239
310
|
},
|
|
240
|
-
success(
|
|
241
|
-
|
|
311
|
+
success(msg, opts = {}) {
|
|
312
|
+
errorMsg(msg);
|
|
313
|
+
return mountToast(__spreadProps(__spreadValues({ icon: Success }, opts), { msg, type: "success" }));
|
|
242
314
|
},
|
|
243
|
-
fail(
|
|
244
|
-
|
|
315
|
+
fail(msg, opts = {}) {
|
|
316
|
+
errorMsg(msg);
|
|
317
|
+
return mountToast(__spreadProps(__spreadValues({ icon: Failure }, opts), { msg, type: "fail" }));
|
|
245
318
|
},
|
|
246
|
-
warn(
|
|
247
|
-
|
|
319
|
+
warn(msg, opts = {}) {
|
|
320
|
+
errorMsg(msg);
|
|
321
|
+
return mountToast(__spreadProps(__spreadValues({ icon: Tips }, opts), { msg, type: "warn" }));
|
|
248
322
|
},
|
|
249
|
-
loading(
|
|
250
|
-
return
|
|
251
|
-
icon:
|
|
252
|
-
},
|
|
253
|
-
msg
|
|
323
|
+
loading(msg, opts = {}) {
|
|
324
|
+
return mountToast(__spreadProps(__spreadValues({
|
|
325
|
+
icon: Loading
|
|
326
|
+
}, opts), {
|
|
327
|
+
msg,
|
|
254
328
|
type: "loading"
|
|
255
329
|
}));
|
|
256
330
|
},
|
|
257
|
-
hide(
|
|
258
|
-
|
|
331
|
+
hide(id) {
|
|
332
|
+
clearToast(id);
|
|
259
333
|
},
|
|
260
|
-
install(
|
|
261
|
-
|
|
334
|
+
install(app) {
|
|
335
|
+
app.use(Toast);
|
|
262
336
|
}
|
|
263
337
|
};
|
|
264
338
|
export {
|
|
265
|
-
|
|
266
|
-
|
|
339
|
+
Toast as default,
|
|
340
|
+
showToast
|
|
267
341
|
};
|