@nutui/nutui 3.1.21 → 3.1.22-beta.5
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 +4203 -19263
- package/dist/nutui.umd.js +4208 -19368
- package/dist/packages/_es/ActionSheet.js +17 -167
- package/dist/packages/_es/Address.js +110 -552
- package/dist/packages/_es/AddressList.js +113 -613
- package/dist/packages/_es/Animate.js +22 -0
- package/dist/packages/_es/Audio.js +53 -274
- package/dist/packages/_es/AudioOperate.js +13 -121
- package/dist/packages/_es/Avatar.js +38 -177
- package/dist/packages/_es/AvatarGroup.js +14 -73
- package/dist/packages/_es/BackTop.js +43 -156
- package/dist/packages/_es/Badge.js +14 -86
- package/dist/packages/_es/Barrage.js +41 -120
- package/dist/packages/_es/Button.js +23 -128
- package/dist/packages/_es/Calendar.js +30 -237
- package/dist/packages/_es/CalendarItem.js +2 -1
- package/dist/packages/_es/Card.js +10 -107
- package/dist/packages/_es/Cascader.js +147 -523
- package/dist/packages/_es/Category.js +15 -58
- package/dist/packages/_es/CategoryPane.js +11 -111
- package/dist/packages/_es/Cell.js +21 -100
- package/dist/packages/_es/CellGroup.js +9 -44
- package/dist/packages/_es/Checkbox.js +31 -113
- package/dist/packages/_es/CheckboxGroup.js +29 -58
- package/dist/packages/_es/CircleProgress.js +28 -151
- package/dist/packages/_es/Col.js +14 -56
- package/dist/packages/_es/Collapse.js +32 -84
- package/dist/packages/_es/CollapseItem.js +59 -272
- package/dist/packages/_es/Comment.js +64 -434
- package/dist/packages/_es/ConfigProvider.js +13 -0
- package/dist/packages/_es/CountDown.js +56 -256
- package/dist/packages/_es/CountUp.js +140 -556
- package/dist/packages/_es/DatePicker.js +98 -332
- package/dist/packages/_es/Dialog.js +60 -271
- package/dist/packages/_es/Divider.js +13 -82
- package/dist/packages/_es/Drag.js +56 -197
- package/dist/packages/_es/Ecard.js +24 -159
- package/dist/packages/_es/Elevator.js +58 -212
- package/dist/packages/_es/Ellipsis.js +64 -0
- package/dist/packages/_es/Empty.js +12 -71
- package/dist/packages/_es/FixedNav.js +15 -122
- package/dist/packages/_es/Form.js +64 -151
- package/dist/packages/_es/FormItem.js +15 -110
- package/dist/packages/_es/Grid.js +5 -6
- package/dist/packages/_es/GridItem.js +33 -144
- package/dist/packages/_es/Icon.js +15 -40
- package/dist/packages/_es/Image.js +31 -0
- package/dist/packages/_es/ImagePreview.js +77 -309
- package/dist/packages/_es/Indicator.js +15 -62
- package/dist/packages/_es/InfiniteLoading.js +57 -268
- package/dist/packages/_es/Input.js +51 -413
- package/dist/packages/_es/InputNumber.js +41 -160
- package/dist/packages/_es/Layout.js +4 -5
- package/dist/packages/_es/List.js +18 -124
- package/dist/packages/_es/Menu.js +45 -118
- package/dist/packages/_es/MenuItem.js +37 -162
- package/dist/packages/_es/Navbar.js +30 -192
- package/dist/packages/_es/NoticeBar.js +74 -397
- package/dist/packages/_es/Notify.js +72 -246
- package/dist/packages/_es/NumberKeyboard.js +41 -272
- package/dist/packages/_es/OldPicker.js +131 -474
- package/dist/packages/_es/OverLay.js +24 -113
- package/dist/packages/_es/Pagination.js +39 -157
- package/dist/packages/_es/Picker.js +129 -469
- package/dist/packages/_es/Popover.js +318 -975
- package/dist/packages/_es/Popup.js +55 -313
- package/dist/packages/_es/Price.js +16 -118
- package/dist/packages/_es/Progress.js +14 -146
- package/dist/packages/_es/PullRefresh.js +84 -354
- package/dist/packages/_es/Radio.js +22 -90
- package/dist/packages/_es/RadioGroup.js +8 -37
- package/dist/packages/_es/Range.js +83 -427
- package/dist/packages/_es/Rate.js +35 -137
- package/dist/packages/_es/Row.js +22 -64
- package/dist/packages/_es/SearchBar.js +37 -257
- package/dist/packages/_es/ShortPassword.js +35 -225
- package/dist/packages/_es/SideNavBar.js +24 -99
- package/dist/packages/_es/SideNavBarItem.js +11 -46
- package/dist/packages/_es/Signature.js +41 -179
- package/dist/packages/_es/Skeleton.js +20 -136
- package/dist/packages/_es/Sku.js +84 -509
- package/dist/packages/_es/Step.js +20 -133
- package/dist/packages/_es/Steps.js +18 -53
- package/dist/packages/_es/Sticky.js +53 -138
- package/dist/packages/_es/SubSideNavBar.js +17 -100
- package/dist/packages/_es/Swipe.js +41 -197
- package/dist/packages/_es/Swiper.js +121 -433
- package/dist/packages/_es/SwiperItem.js +22 -53
- package/dist/packages/_es/Switch.js +21 -116
- package/dist/packages/_es/TabPane.js +12 -39
- package/dist/packages/_es/Tabbar.js +17 -72
- package/dist/packages/_es/TabbarItem.js +29 -151
- package/dist/packages/_es/Table.js +18 -196
- package/dist/packages/_es/Tabs.js +43 -217
- package/dist/packages/_es/Tag.js +20 -97
- package/dist/packages/_es/TextArea.js +42 -160
- package/dist/packages/_es/TimeDetail.js +18 -98
- package/dist/packages/_es/TimePannel.js +14 -66
- package/dist/packages/_es/TimeSelect.js +15 -103
- package/dist/packages/_es/Toast.js +71 -329
- package/dist/packages/_es/Uploader.js +104 -468
- package/dist/packages/_es/Video.js +74 -350
- package/dist/packages/_es/common.js +38 -128
- package/dist/packages/_es/component.js +35 -76
- package/dist/packages/_es/index.js +5 -6
- package/dist/packages/_es/index2.js +9 -30
- package/dist/packages/_es/index3.js +6 -8
- package/dist/packages/_es/index4.js +13 -58
- package/dist/packages/_es/index5.js +164 -682
- package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
- package/dist/packages/_es/pxCheck.js +3 -5
- package/dist/packages/_es/raf.js +8 -15
- package/dist/packages/animate/index.scss +299 -0
- package/dist/packages/button/index.scss +2 -1
- package/dist/packages/cell/index.scss +18 -1
- package/dist/packages/checkbox/index.scss +16 -0
- package/dist/packages/configprovider/index.scss +2 -0
- package/dist/packages/dialog/index.scss +1 -0
- package/dist/packages/elevator/index.scss +21 -0
- package/dist/packages/ellipsis/index.scss +12 -0
- package/dist/packages/formitem/index.scss +12 -0
- package/dist/packages/griditem/index.scss +11 -0
- package/dist/packages/image/index.scss +39 -0
- package/dist/packages/imagepreview/index.scss +21 -2
- package/dist/packages/input/index.scss +26 -1
- package/dist/packages/inputnumber/index.scss +21 -0
- package/dist/packages/locale/lang/baseLang.d.ts +1 -0
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.d.ts +8 -0
- package/dist/packages/locale/lang/en-US.js +5 -97
- package/dist/packages/locale/lang/id-ID.d.ts +8 -0
- package/dist/packages/locale/lang/id-ID.js +5 -97
- package/dist/packages/locale/lang/index.js +16 -38
- package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
- package/dist/packages/locale/lang/zh-CN.js +5 -97
- package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
- package/dist/packages/locale/lang/zh-TW.js +5 -97
- package/dist/packages/menu/index.scss +45 -36
- package/dist/packages/menuitem/index.scss +4 -0
- package/dist/packages/navbar/index.scss +9 -0
- package/dist/packages/pagination/index.scss +19 -0
- package/dist/packages/radio/index.scss +19 -0
- package/dist/packages/range/index.scss +19 -0
- package/dist/packages/rate/index.scss +1 -1
- package/dist/packages/searchbar/index.scss +21 -0
- package/dist/packages/switch/index.scss +4 -3
- package/dist/packages/tabbar/index.scss +5 -0
- package/dist/packages/tabbaritem/index.scss +7 -0
- package/dist/packages/tabpane/index.scss +6 -0
- package/dist/packages/tabs/index.scss +22 -0
- package/dist/packages/textarea/index.scss +8 -0
- package/dist/smartips/attributes.json +192 -12
- package/dist/smartips/tags.json +70 -10
- package/dist/smartips/web-types.json +6945 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/font/config.json +3 -1
- package/dist/styles/font/demo_index.html +49 -3
- package/dist/styles/font/iconfont.css +11 -3
- package/dist/styles/font/iconfont.js +15 -15
- package/dist/styles/font/iconfont.json +14 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +54 -50
- package/dist/styles/themes/jdb.scss +54 -50
- package/dist/styles/themes/jdt.scss +54 -50
- package/dist/styles/variables-jdb.scss +19 -1
- package/dist/styles/variables-jdt.scss +19 -1
- package/dist/styles/variables.scss +22 -1
- package/dist/types/__VUE/address/index.vue.d.ts +2 -2
- package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
- package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
- package/dist/types/__VUE/animate/type.d.ts +6 -0
- package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
- package/dist/types/__VUE/avatar/index.vue.d.ts +7 -7
- package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +2 -2
- package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
- package/dist/types/__VUE/cell/index.vue.d.ts +13 -6
- package/dist/types/__VUE/checkbox/common.d.ts +59 -0
- package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
- package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
- package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +5 -3
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/configprovider/common.d.ts +20 -0
- package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
- package/dist/types/__VUE/datepicker/index.vue.d.ts +5 -5
- package/dist/types/__VUE/datepicker/type.d.ts +6 -0
- package/dist/types/__VUE/dialog/index.d.ts +9 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +26 -17
- package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
- package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
- package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
- package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
- package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
- package/dist/types/__VUE/grid/common.d.ts +3 -3
- package/dist/types/__VUE/grid/index.vue.d.ts +5 -5
- package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/image/index.vue.d.ts +105 -0
- package/dist/types/__VUE/image/type.d.ts +6 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
- package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +16 -7
- package/dist/types/__VUE/menuitem/type.d.ts +8 -0
- package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/index.vue.d.ts +1 -1
- package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/common.d.ts +149 -0
- package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/skeleton/common.d.ts +2 -4
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabs/common.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +8 -0
- package/dist/types/__VUE/toast/index.vue.d.ts +2 -2
- package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
- package/dist/types/__VUE/uploader/type.d.ts +2 -1
- package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
- package/dist/types/__VUE/video/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +5 -1
- package/package.json +7 -3
|
@@ -1,335 +1,77 @@
|
|
|
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
1
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
|
|
22
3
|
* (c) 2022 @jdf2e.
|
|
23
4
|
* Released under the MIT License.
|
|
24
5
|
*/
|
|
25
|
-
import { reactive, onMounted, watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, createVNode, createCommentVNode, toDisplayString, vShow, render } from "vue";
|
|
26
|
-
import { c as
|
|
27
|
-
import
|
|
28
|
-
import { _ as
|
|
6
|
+
import { reactive as t, onMounted as e, watch as o, computed as n, resolveComponent as i, openBlock as l, createBlock as s, Transition as a, withCtx as c, withDirectives as r, createElementVNode as u, normalizeClass as d, normalizeStyle as m, createElementBlock as p, createVNode as f, createCommentVNode as g, toDisplayString as y, vShow as v, render as C } from "vue";
|
|
7
|
+
import { c as b } from "./component.js";
|
|
8
|
+
import x from "./Icon.js";
|
|
9
|
+
import { _ as S } from "./plugin-vue_export-helper.js";
|
|
29
10
|
import "../locale/lang";
|
|
30
11
|
import "./pxCheck.js";
|
|
31
|
-
const { create } =
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
mounted: false
|
|
98
|
-
});
|
|
99
|
-
onMounted(() => {
|
|
100
|
-
state.mounted = true;
|
|
101
|
-
});
|
|
102
|
-
const clearTimer = () => {
|
|
103
|
-
if (timer) {
|
|
104
|
-
clearTimeout(timer);
|
|
105
|
-
timer = null;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const hide = () => {
|
|
109
|
-
state.mounted = false;
|
|
110
|
-
};
|
|
111
|
-
const show = () => {
|
|
112
|
-
clearTimer();
|
|
113
|
-
if (props.duration) {
|
|
114
|
-
timer = setTimeout(() => {
|
|
115
|
-
hide();
|
|
116
|
-
}, props.duration);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const clickCover = () => {
|
|
120
|
-
if (props.closeOnClickOverlay) {
|
|
121
|
-
hide();
|
|
122
|
-
emit("close");
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
if (props.duration) {
|
|
126
|
-
show();
|
|
127
|
-
}
|
|
128
|
-
watch(() => props.duration, (val) => {
|
|
129
|
-
if (val) {
|
|
130
|
-
show();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
const hasIcon = computed(() => {
|
|
134
|
-
if (props.type !== "text") {
|
|
135
|
-
return true;
|
|
136
|
-
} else {
|
|
137
|
-
return !!props.icon;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const toastBodyClass = computed(() => {
|
|
141
|
-
return [
|
|
142
|
-
"nut-toast",
|
|
143
|
-
{ "nut-toast-center": props.center },
|
|
144
|
-
{ "nut-toast-has-icon": hasIcon.value },
|
|
145
|
-
{ "nut-toast-cover": props.cover },
|
|
146
|
-
{ "nut-toast-loading": props.type === "loading" },
|
|
147
|
-
props.customClass,
|
|
148
|
-
"nut-toast-" + props.size
|
|
149
|
-
];
|
|
150
|
-
});
|
|
151
|
-
const onAfterLeave = () => {
|
|
152
|
-
clearTimer();
|
|
153
|
-
props.unmount(props.id);
|
|
154
|
-
props.onClose && props.onClose();
|
|
155
|
-
};
|
|
156
|
-
return {
|
|
157
|
-
state,
|
|
158
|
-
hide,
|
|
159
|
-
clickCover,
|
|
160
|
-
hasIcon,
|
|
161
|
-
toastBodyClass,
|
|
162
|
-
onAfterLeave
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
const _hoisted_1 = {
|
|
167
|
-
key: 0,
|
|
168
|
-
class: "nut-toast-icon-wrapper"
|
|
169
|
-
};
|
|
170
|
-
const _hoisted_2 = {
|
|
171
|
-
key: 1,
|
|
172
|
-
class: "nut-toast-title"
|
|
173
|
-
};
|
|
174
|
-
const _hoisted_3 = ["innerHTML"];
|
|
175
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
176
|
-
const _component_nut_icon = resolveComponent("nut-icon");
|
|
177
|
-
return openBlock(), createBlock(Transition, {
|
|
178
|
-
name: "toast-fade",
|
|
179
|
-
onAfterLeave: _ctx.onAfterLeave
|
|
180
|
-
}, {
|
|
181
|
-
default: withCtx(() => [
|
|
182
|
-
withDirectives(createElementVNode("view", {
|
|
183
|
-
class: normalizeClass(_ctx.toastBodyClass),
|
|
184
|
-
style: normalizeStyle({
|
|
185
|
-
bottom: _ctx.center ? "auto" : _ctx.bottom,
|
|
186
|
-
"background-color": _ctx.coverColor
|
|
187
|
-
}),
|
|
188
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
189
|
-
}, [
|
|
190
|
-
createElementVNode("view", {
|
|
191
|
-
class: "nut-toast-inner",
|
|
192
|
-
style: normalizeStyle({
|
|
193
|
-
"text-align": _ctx.textAlignCenter ? "center" : "left",
|
|
194
|
-
"background-color": _ctx.bgColor
|
|
195
|
-
})
|
|
196
|
-
}, [
|
|
197
|
-
_ctx.hasIcon ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
198
|
-
createVNode(_component_nut_icon, {
|
|
199
|
-
size: _ctx.iconSize,
|
|
200
|
-
color: "#ffffff",
|
|
201
|
-
name: _ctx.icon
|
|
202
|
-
}, null, 8, ["size", "name"])
|
|
203
|
-
])) : createCommentVNode("", true),
|
|
204
|
-
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
205
|
-
createElementVNode("view", {
|
|
206
|
-
class: "nut-toast-text",
|
|
207
|
-
innerHTML: _ctx.msg
|
|
208
|
-
}, null, 8, _hoisted_3)
|
|
209
|
-
], 4)
|
|
210
|
-
], 6), [
|
|
211
|
-
[vShow, _ctx.state.mounted]
|
|
212
|
-
])
|
|
213
|
-
]),
|
|
214
|
-
_: 1
|
|
215
|
-
}, 8, ["onAfterLeave"]);
|
|
216
|
-
}
|
|
217
|
-
var Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
218
|
-
const defaultOptions = {
|
|
219
|
-
msg: "",
|
|
220
|
-
id: "",
|
|
221
|
-
duration: 2e3,
|
|
222
|
-
center: true,
|
|
223
|
-
type: "text",
|
|
224
|
-
title: "",
|
|
225
|
-
customClass: "",
|
|
226
|
-
bottom: "30px",
|
|
227
|
-
size: "base",
|
|
228
|
-
iconSize: "20",
|
|
229
|
-
icon: null,
|
|
230
|
-
textAlignCenter: true,
|
|
231
|
-
loadingRotate: true,
|
|
232
|
-
bgColor: "",
|
|
233
|
-
onClose: null,
|
|
234
|
-
unmount: null,
|
|
235
|
-
cover: false,
|
|
236
|
-
coverColor: "",
|
|
237
|
-
closeOnClickOverlay: false
|
|
238
|
-
};
|
|
239
|
-
let idsMap = [];
|
|
240
|
-
let optsMap = [];
|
|
241
|
-
const clearToast = (id) => {
|
|
242
|
-
if (id) {
|
|
243
|
-
const container = document.getElementById(id);
|
|
244
|
-
optsMap = optsMap.filter((item) => item.id !== id);
|
|
245
|
-
idsMap = idsMap.filter((item) => item !== id);
|
|
246
|
-
if (container) {
|
|
247
|
-
document.body.removeChild(container);
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
idsMap.forEach((item) => {
|
|
251
|
-
const container = document.getElementById(item);
|
|
252
|
-
if (container) {
|
|
253
|
-
document.body.removeChild(container);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
optsMap = [];
|
|
257
|
-
idsMap = [];
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
const updateToast = (opts) => {
|
|
261
|
-
const container = document.getElementById(opts.id);
|
|
262
|
-
if (container) {
|
|
263
|
-
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
264
|
-
if (currentOpt) {
|
|
265
|
-
opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
|
|
266
|
-
} else {
|
|
267
|
-
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
268
|
-
}
|
|
269
|
-
const instance = createVNode(Toast, opts);
|
|
270
|
-
render(instance, container);
|
|
271
|
-
return instance.component.ctx;
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
const mountToast = (opts) => {
|
|
275
|
-
opts.unmount = clearToast;
|
|
276
|
-
let _id;
|
|
277
|
-
if (opts.id) {
|
|
278
|
-
_id = opts.id;
|
|
279
|
-
if (idsMap.find((item) => item === opts.id)) {
|
|
280
|
-
return updateToast(opts);
|
|
281
|
-
}
|
|
282
|
-
} else {
|
|
283
|
-
_id = new Date().getTime() + "";
|
|
284
|
-
}
|
|
285
|
-
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
286
|
-
opts.id = _id;
|
|
287
|
-
idsMap.push(opts.id);
|
|
288
|
-
optsMap.push(opts);
|
|
289
|
-
const container = document.createElement("div");
|
|
290
|
-
container.id = opts.id;
|
|
291
|
-
const instance = createVNode(Toast, opts);
|
|
292
|
-
render(instance, container);
|
|
293
|
-
document.body.appendChild(container);
|
|
294
|
-
return instance.component.ctx;
|
|
295
|
-
};
|
|
296
|
-
const errorMsg = (msg) => {
|
|
297
|
-
if (!msg) {
|
|
298
|
-
console.warn("[NutUI Toast]: msg\u4E0D\u80FD\u4E3A\u7A7A");
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const ToastFunction = {
|
|
303
|
-
text(msg, opts = {}) {
|
|
304
|
-
errorMsg(msg);
|
|
305
|
-
return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
|
|
306
|
-
},
|
|
307
|
-
success(msg, opts = {}) {
|
|
308
|
-
errorMsg(msg);
|
|
309
|
-
return mountToast(__spreadProps(__spreadValues({ icon: "success" }, opts), { msg, type: "success" }));
|
|
310
|
-
},
|
|
311
|
-
fail(msg, opts = {}) {
|
|
312
|
-
errorMsg(msg);
|
|
313
|
-
return mountToast(__spreadProps(__spreadValues({ icon: "failure" }, opts), { msg, type: "fail" }));
|
|
314
|
-
},
|
|
315
|
-
warn(msg, opts = {}) {
|
|
316
|
-
errorMsg(msg);
|
|
317
|
-
return mountToast(__spreadProps(__spreadValues({ icon: "tips" }, opts), { msg, type: "warn" }));
|
|
318
|
-
},
|
|
319
|
-
loading(msg, opts = {}) {
|
|
320
|
-
return mountToast(__spreadProps(__spreadValues({
|
|
321
|
-
icon: "loading"
|
|
322
|
-
}, opts), {
|
|
323
|
-
msg,
|
|
324
|
-
type: "loading"
|
|
325
|
-
}));
|
|
326
|
-
},
|
|
327
|
-
hide(id) {
|
|
328
|
-
clearToast(id);
|
|
329
|
-
},
|
|
330
|
-
install(app) {
|
|
331
|
-
app.use(Toast);
|
|
332
|
-
app.config.globalProperties.$toast = ToastFunction;
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
export { Toast, ToastFunction, ToastFunction as default };
|
|
12
|
+
const { create: h } = b("toast"), k = h({ components: { [x.name]: x }, props: { id: String, msg: String, duration: { type: Number, default: 2e3 }, center: { type: Boolean, default: true }, type: String, customClass: String, bottom: { type: String, default: "30px" }, size: { type: [String, Number], default: "base" }, iconSize: { type: String, default: "20" }, icon: String, textAlignCenter: { type: Boolean, default: true }, loadingRotate: { type: Boolean, default: true }, bgColor: { type: String, default: "" }, onClose: Function, unmount: Function, cover: { type: Boolean, default: false }, coverColor: { type: String, default: "" }, title: { type: String, default: "" }, closeOnClickOverlay: { type: Boolean, default: false } }, emits: ["close"], setup(i2, { emit: l2 }) {
|
|
13
|
+
let s2;
|
|
14
|
+
const a2 = t({ mounted: false });
|
|
15
|
+
e(() => {
|
|
16
|
+
a2.mounted = true;
|
|
17
|
+
});
|
|
18
|
+
const c2 = () => {
|
|
19
|
+
s2 && (clearTimeout(s2), s2 = null);
|
|
20
|
+
}, r2 = () => {
|
|
21
|
+
a2.mounted = false;
|
|
22
|
+
}, u2 = () => {
|
|
23
|
+
c2(), i2.duration && (s2 = setTimeout(() => {
|
|
24
|
+
r2();
|
|
25
|
+
}, i2.duration));
|
|
26
|
+
};
|
|
27
|
+
i2.duration && u2(), o(() => i2.duration, (t2) => {
|
|
28
|
+
t2 && u2();
|
|
29
|
+
});
|
|
30
|
+
const d2 = n(() => i2.type !== "text" || !!i2.icon), m2 = n(() => ["nut-toast", { "nut-toast-center": i2.center }, { "nut-toast-has-icon": d2.value }, { "nut-toast-cover": i2.cover }, { "nut-toast-loading": i2.type === "loading" }, i2.customClass, "nut-toast-" + i2.size]);
|
|
31
|
+
return { state: a2, hide: r2, clickCover: () => {
|
|
32
|
+
i2.closeOnClickOverlay && (r2(), l2("close"));
|
|
33
|
+
}, hasIcon: d2, toastBodyClass: m2, onAfterLeave: () => {
|
|
34
|
+
c2(), i2.unmount(i2.id), i2.onClose && i2.onClose();
|
|
35
|
+
} };
|
|
36
|
+
} }), B = { key: 0, class: "nut-toast-icon-wrapper" }, w = { key: 1, class: "nut-toast-title" }, z = ["innerHTML"];
|
|
37
|
+
var A = S(k, [["render", function(t2, e2, o2, n2, C2, b2) {
|
|
38
|
+
const x2 = i("nut-icon");
|
|
39
|
+
return l(), s(a, { name: "toast-fade", onAfterLeave: t2.onAfterLeave }, { default: c(() => [r(u("view", { class: d(t2.toastBodyClass), style: m({ bottom: t2.center ? "auto" : t2.bottom, "background-color": t2.coverColor }), onClick: e2[0] || (e2[0] = (...e3) => t2.clickCover && t2.clickCover(...e3)) }, [u("view", { class: "nut-toast-inner", style: m({ "text-align": t2.textAlignCenter ? "center" : "left", "background-color": t2.bgColor }) }, [t2.hasIcon ? (l(), p("view", B, [f(x2, { size: t2.iconSize, color: "#ffffff", name: t2.icon }, null, 8, ["size", "name"])])) : g("", true), t2.title ? (l(), p("div", w, y(t2.title), 1)) : g("", true), u("view", { class: "nut-toast-text", innerHTML: t2.msg }, null, 8, z)], 4)], 6), [[v, t2.state.mounted]])]), _: 1 }, 8, ["onAfterLeave"]);
|
|
40
|
+
}]]);
|
|
41
|
+
const I = { msg: "", id: "", duration: 2e3, center: true, type: "text", title: "", customClass: "", bottom: "30px", size: "base", iconSize: "20", icon: null, textAlignCenter: true, loadingRotate: true, bgColor: "", onClose: null, unmount: null, cover: false, coverColor: "", closeOnClickOverlay: false };
|
|
42
|
+
let L = [], O = [];
|
|
43
|
+
const E = (t2) => {
|
|
44
|
+
if (t2) {
|
|
45
|
+
const e2 = document.getElementById(t2);
|
|
46
|
+
O = O.filter((e3) => e3.id !== t2), L = L.filter((e3) => e3 !== t2), e2 && document.body.removeChild(e2);
|
|
47
|
+
} else
|
|
48
|
+
L.forEach((t3) => {
|
|
49
|
+
const e2 = document.getElementById(t3);
|
|
50
|
+
e2 && document.body.removeChild(e2);
|
|
51
|
+
}), O = [], L = [];
|
|
52
|
+
}, T = (t2) => {
|
|
53
|
+
let e2;
|
|
54
|
+
if (t2.unmount = E, t2.id) {
|
|
55
|
+
if (e2 = t2.id, L.find((e3) => e3 === t2.id))
|
|
56
|
+
return ((t3) => {
|
|
57
|
+
const e3 = document.getElementById(t3.id);
|
|
58
|
+
if (e3) {
|
|
59
|
+
const o3 = O.find((e4) => e4.id === t3.id);
|
|
60
|
+
t3 = o3 ? { ...I, ...o3, ...t3 } : { ...I, ...t3 };
|
|
61
|
+
const n3 = f(A, t3);
|
|
62
|
+
return C(n3, e3), n3.component.ctx;
|
|
63
|
+
}
|
|
64
|
+
})(t2);
|
|
65
|
+
} else
|
|
66
|
+
e2 = new Date().getTime() + "";
|
|
67
|
+
(t2 = { ...I, ...t2 }).id = e2, L.push(t2.id), O.push(t2);
|
|
68
|
+
const o2 = document.createElement("div");
|
|
69
|
+
o2.id = t2.id;
|
|
70
|
+
const n2 = f(A, t2);
|
|
71
|
+
return C(n2, o2), document.body.appendChild(o2), n2.component.ctx;
|
|
72
|
+
}, j = { text: (t2, e2 = {}) => T({ ...e2, type: "text", msg: t2 }), success: (t2, e2 = {}) => T({ icon: "success", ...e2, msg: t2, type: "success" }), fail: (t2, e2 = {}) => T({ icon: "failure", ...e2, msg: t2, type: "fail" }), warn: (t2, e2 = {}) => T({ icon: "tips", ...e2, msg: t2, type: "warn" }), loading: (t2, e2 = {}) => T({ icon: "loading", ...e2, msg: t2, type: "loading" }), hide(t2) {
|
|
73
|
+
E(t2);
|
|
74
|
+
}, install(t2) {
|
|
75
|
+
t2.use(A), t2.config.globalProperties.$toast = j;
|
|
76
|
+
} };
|
|
77
|
+
export { A as Toast, j as ToastFunction, j as default };
|