@nutui/nutui 3.1.19-beta.1 → 3.1.19-beta.2
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/README.md +9 -8
- package/dist/nutui.es.js +2875 -3576
- package/dist/nutui.umd.js +2965 -3579
- package/dist/packages/_es/ActionSheet.js +18 -12
- package/dist/packages/_es/Address.js +69 -78
- package/dist/packages/_es/Audio.js +12 -12
- package/dist/packages/_es/AudioOperate.js +1 -1
- package/dist/packages/_es/Avatar.js +3 -3
- package/dist/packages/_es/BackTop.js +110 -68
- package/dist/packages/_es/Badge.js +3 -3
- package/dist/packages/_es/Barrage.js +55 -62
- package/dist/packages/_es/Button.js +2 -2
- package/dist/packages/_es/Calendar.js +27 -32
- package/dist/packages/_es/CalendarItem.js +3 -3
- package/dist/packages/_es/Card.js +5 -6
- package/dist/packages/_es/Cascader.js +7 -7
- package/dist/packages/_es/Cell.js +11 -4
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +13 -3
- package/dist/packages/_es/CheckboxGroup.js +2 -2
- package/dist/packages/_es/CircleProgress.js +40 -149
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +8 -34
- package/dist/packages/_es/CollapseItem.js +59 -90
- package/dist/packages/_es/CountDown.js +5 -5
- package/dist/packages/_es/CountUp.js +51 -43
- package/dist/packages/_es/DatePicker.js +20 -21
- package/dist/packages/_es/Dialog.js +91 -12
- package/dist/packages/_es/Divider.js +4 -4
- package/dist/packages/_es/Drag.js +54 -92
- package/dist/packages/_es/Elevator.js +50 -75
- package/dist/packages/_es/Empty.js +3 -3
- package/dist/packages/_es/FixedNav.js +10 -11
- package/dist/packages/_es/Form.js +5 -9
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +26 -8
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +83 -14
- package/dist/packages/_es/Indicator.js +3 -3
- package/dist/packages/_es/InfiniteLoading.js +107 -93
- package/dist/packages/_es/Input.js +8 -8
- package/dist/packages/_es/InputNumber.js +16 -23
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/List.js +34 -41
- package/dist/packages/_es/Menu.js +12 -15
- package/dist/packages/_es/MenuItem.js +7 -7
- package/dist/packages/_es/Navbar.js +4 -3
- package/dist/packages/_es/NoticeBar.js +40 -47
- package/dist/packages/_es/Notify.js +166 -27
- package/dist/packages/_es/NumberKeyboard.js +18 -8
- package/dist/packages/_es/OldPicker.js +120 -122
- package/dist/packages/_es/OverLay.js +25 -5
- package/dist/packages/_es/Pagination.js +14 -13
- package/dist/packages/_es/Picker.js +16 -39
- package/dist/packages/_es/Popover.js +29 -154
- package/dist/packages/_es/Popup.js +69 -6
- package/dist/packages/_es/Price.js +5 -17
- package/dist/packages/_es/Progress.js +8 -18
- package/dist/packages/_es/PullRefresh.js +1 -1
- package/dist/packages/_es/Radio.js +14 -4
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +33 -46
- package/dist/packages/_es/Rate.js +19 -16
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +11 -12
- package/dist/packages/_es/ShortPassword.js +67 -89
- package/dist/packages/_es/SideNavBar.js +16 -5
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +88 -69
- package/dist/packages/_es/Skeleton.js +11 -8
- package/dist/packages/_es/Sku.js +57 -49
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +23 -28
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +26 -39
- package/dist/packages/_es/Swiper.js +14 -32
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +3 -3
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +3 -3
- package/dist/packages/_es/TabbarItem.js +21 -11
- package/dist/packages/_es/Table.js +13 -13
- package/dist/packages/_es/Tabs.js +20 -21
- package/dist/packages/_es/Tag.js +4 -4
- package/dist/packages/_es/TextArea.js +42 -44
- package/dist/packages/_es/TimeDetail.js +3 -4
- package/dist/packages/_es/TimePannel.js +3 -3
- package/dist/packages/_es/TimeSelect.js +7 -8
- package/dist/packages/_es/Toast.js +170 -41
- package/dist/packages/_es/Uploader.js +138 -109
- package/dist/packages/_es/Video.js +9 -8
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +135 -3
- package/dist/packages/_es/index.js +6 -44
- package/dist/packages/_es/index2.js +31 -8
- package/dist/packages/_es/index3.js +7 -58
- package/dist/packages/_es/index4.js +56 -413
- package/dist/packages/_es/{index.taro.js → index5.js} +113 -140
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +19 -0
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +42 -42
- package/dist/styles/themes/jdt.scss +42 -42
- package/dist/types/__VUE/actionsheet/index.d.ts +269 -0
- package/dist/types/__VUE/address/index.d.ts +386 -0
- package/dist/types/__VUE/audio/index.d.ts +92 -0
- package/dist/types/__VUE/audiooperate/index.d.ts +68 -0
- package/dist/types/__VUE/avatar/index.d.ts +66 -0
- package/dist/types/__VUE/backtop/index.d.ts +105 -0
- package/dist/types/__VUE/badge/index.d.ts +94 -0
- package/dist/types/__VUE/barrage/index.d.ts +80 -0
- package/dist/types/__VUE/button/index.d.ts +116 -0
- package/dist/types/__VUE/calendar/index.d.ts +155 -0
- package/dist/types/__VUE/calendaritem/index.d.ts +195 -0
- package/dist/types/__VUE/card/index.d.ts +81 -0
- package/dist/types/__VUE/cascader/cascader-item.d.ts +76 -0
- package/dist/types/__VUE/cascader/helper.d.ts +8 -0
- package/dist/types/__VUE/cascader/index.d.ts +76 -0
- package/dist/types/__VUE/cascader/tree.d.ts +17 -0
- package/dist/types/__VUE/cascader/types.d.ts +30 -0
- package/dist/types/__VUE/cell/index.d.ts +109 -0
- package/dist/types/__VUE/cellgroup/index.d.ts +38 -0
- package/dist/types/__VUE/checkbox/index.d.ts +102 -0
- package/dist/types/__VUE/checkboxgroup/index.d.ts +39 -0
- package/dist/types/__VUE/circleprogress/index.d.ts +66 -0
- package/dist/types/__VUE/col/index.d.ts +42 -0
- package/dist/types/__VUE/collapse/index.d.ts +104 -0
- package/dist/types/__VUE/collapseitem/index.d.ts +83 -0
- package/dist/types/__VUE/countdown/index.d.ts +90 -0
- package/dist/types/__VUE/countup/index.d.ts +216 -0
- package/dist/types/__VUE/datepicker/index.d.ts +347 -0
- package/dist/types/__VUE/datepicker/utils.d.ts +5 -0
- package/dist/types/__VUE/dialog/index.d.ts +306 -0
- package/dist/types/__VUE/divider/index.d.ts +47 -0
- package/dist/types/__VUE/drag/index.d.ts +61 -0
- package/dist/types/__VUE/elevator/index.d.ts +71 -0
- package/dist/types/__VUE/empty/index.d.ts +46 -0
- package/dist/types/__VUE/fixednav/index.d.ts +96 -0
- package/dist/types/__VUE/form/common.d.ts +20 -0
- package/dist/types/__VUE/form/index.d.ts +32 -0
- package/dist/types/__VUE/form/types.d.ts +13 -0
- package/dist/types/__VUE/formitem/index.d.ts +120 -0
- package/dist/types/__VUE/formitem/types.d.ts +10 -0
- package/dist/types/__VUE/grid/common.d.ts +91 -0
- package/dist/types/__VUE/grid/index.d.ts +100 -0
- package/dist/types/__VUE/griditem/index.d.ts +80 -0
- package/dist/types/__VUE/icon/index.d.ts +74 -0
- package/dist/types/__VUE/imagepreview/index.d.ts +125 -0
- package/dist/types/__VUE/indicator/index.d.ts +70 -0
- package/dist/types/__VUE/infiniteloading/index.d.ts +140 -0
- package/dist/types/__VUE/input/index.d.ts +336 -0
- package/dist/types/__VUE/input/util.d.ts +5 -0
- package/dist/types/__VUE/inputnumber/index.d.ts +117 -0
- package/dist/types/__VUE/layout/index.d.ts +13 -0
- package/dist/types/__VUE/list/index.d.ts +48 -0
- package/dist/types/__VUE/menu/index.d.ts +51 -0
- package/dist/types/__VUE/menuitem/index.d.ts +77 -0
- package/dist/types/__VUE/navbar/index.d.ts +84 -0
- package/dist/types/__VUE/noticebar/index.d.ts +209 -0
- package/dist/types/__VUE/notify/index.d.ts +103 -0
- package/dist/types/__VUE/numberkeyboard/index.d.ts +123 -0
- package/dist/types/__VUE/oldpicker/Column.d.ts +96 -0
- package/dist/types/__VUE/oldpicker/commonProps.d.ts +22 -0
- package/dist/types/__VUE/oldpicker/index.d.ts +360 -0
- package/dist/types/__VUE/oldpicker/types.d.ts +24 -0
- package/dist/types/__VUE/overlay/index.d.ts +1614 -0
- package/dist/types/__VUE/pagination/index.d.ts +112 -0
- package/dist/types/__VUE/picker/Column.d.ts +90 -0
- package/dist/types/__VUE/picker/index.d.ts +342 -0
- package/dist/types/__VUE/picker/types.d.ts +26 -0
- package/dist/types/__VUE/popover/index.d.ts +233 -0
- package/dist/types/__VUE/popup/index.d.ts +1734 -0
- package/dist/types/__VUE/popup/use-lock-scroll.d.ts +5 -0
- package/dist/types/__VUE/price/index.d.ts +87 -0
- package/dist/types/__VUE/progress/index.d.ts +137 -0
- package/dist/types/__VUE/pullrefresh/index.d.ts +128 -0
- package/dist/types/__VUE/pullrefresh/use-touch.d.ts +20 -0
- package/dist/types/__VUE/pullrefresh/util.d.ts +6 -0
- package/dist/types/__VUE/radio/index.d.ts +90 -0
- package/dist/types/__VUE/radiogroup/index.d.ts +48 -0
- package/dist/types/__VUE/range/index.d.ts +156 -0
- package/dist/types/__VUE/rate/index.d.ts +142 -0
- package/dist/types/__VUE/row/index.d.ts +63 -0
- package/dist/types/__VUE/searchbar/index.d.ts +100 -0
- package/dist/types/__VUE/shortpassword/index.d.ts +136 -0
- package/dist/types/__VUE/sidenavbar/index.d.ts +36 -0
- package/dist/types/__VUE/sidenavbaritem/index.d.ts +41 -0
- package/dist/types/__VUE/signature/index.d.ts +73 -0
- package/dist/types/__VUE/skeleton/common.d.ts +63 -0
- package/dist/types/__VUE/skeleton/index.d.ts +117 -0
- package/dist/types/__VUE/sku/components/SkuHeader.d.ts +27 -0
- package/dist/types/__VUE/sku/components/SkuOperate.d.ts +70 -0
- package/dist/types/__VUE/sku/components/SkuSelect.d.ts +30 -0
- package/dist/types/__VUE/sku/components/SkuStepper.d.ts +67 -0
- package/dist/types/__VUE/sku/index.d.ts +300 -0
- package/dist/types/__VUE/step/index.d.ts +70 -0
- package/dist/types/__VUE/steps/index.d.ts +47 -0
- package/dist/types/__VUE/sticky/index.d.ts +63 -0
- package/dist/types/__VUE/subsidenavbar/index.d.ts +54 -0
- package/dist/types/__VUE/swipe/index.d.ts +69 -0
- package/dist/types/__VUE/swiper/index.d.ts +163 -0
- package/dist/types/__VUE/swiper/use-touch.d.ts +20 -0
- package/dist/types/__VUE/swiperitem/index.d.ts +24 -0
- package/dist/types/__VUE/switch/index.d.ts +136 -0
- package/dist/types/__VUE/tabbar/index.d.ts +84 -0
- package/dist/types/__VUE/tabbaritem/index.d.ts +108 -0
- package/dist/types/__VUE/table/common.d.ts +54 -0
- package/dist/types/__VUE/table/index.d.ts +75 -0
- package/dist/types/__VUE/table/renderColumn.d.ts +20 -0
- package/dist/types/__VUE/table/types.d.ts +19 -0
- package/dist/types/__VUE/tabpane/index.d.ts +47 -0
- package/dist/types/__VUE/tabs/index.d.ts +128 -0
- package/dist/types/__VUE/tag/index.d.ts +89 -0
- package/dist/types/__VUE/textarea/index.d.ts +120 -0
- package/dist/types/__VUE/timedetail/index.d.ts +48 -0
- package/dist/types/__VUE/timepannel/index.d.ts +43 -0
- package/dist/types/__VUE/timeselect/index.d.ts +82 -0
- package/dist/types/__VUE/toast/index.d.ts +149 -0
- package/dist/types/__VUE/uploader/index.d.ts +258 -0
- package/dist/types/__VUE/uploader/uploader.d.ts +25 -0
- package/dist/types/__VUE/video/index.d.ts +123 -0
- package/dist/{index.d.ts → types/index.d.ts} +0 -0
- package/dist/types/nutui.d.ts +92 -0
- package/package.json +14 -5
- package/dist/nutui.d.ts +0 -104
- package/dist/packages/_es/use-lock-scroll.js +0 -23
- package/dist/packages/_es/util.js +0 -47
|
@@ -19,7 +19,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
21
|
/*!
|
|
22
|
-
* @nutui/nutui v3.1.19-beta.
|
|
22
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
23
23
|
* (c) 2022 @jdf2e.
|
|
24
24
|
* Released under the MIT License.
|
|
25
25
|
*/
|
|
@@ -58,10 +58,6 @@ const _sfc_main = create({
|
|
|
58
58
|
type: String,
|
|
59
59
|
default: "line"
|
|
60
60
|
},
|
|
61
|
-
lineWidth: {
|
|
62
|
-
type: [String, Number],
|
|
63
|
-
default: ""
|
|
64
|
-
},
|
|
65
61
|
titleScroll: {
|
|
66
62
|
type: Boolean,
|
|
67
63
|
default: false
|
|
@@ -90,7 +86,7 @@ const _sfc_main = create({
|
|
|
90
86
|
const titles = ref([]);
|
|
91
87
|
const currentIndex = ref(props.modelValue || 0);
|
|
92
88
|
const renderTitles = (vnodes) => {
|
|
93
|
-
vnodes.forEach((vnode,
|
|
89
|
+
vnodes.forEach((vnode, index2) => {
|
|
94
90
|
var _a, _b, _c, _d, _e;
|
|
95
91
|
let type = vnode.type;
|
|
96
92
|
type = type.name || type;
|
|
@@ -98,7 +94,7 @@ const _sfc_main = create({
|
|
|
98
94
|
let title = new Title();
|
|
99
95
|
if (((_a = vnode.props) == null ? void 0 : _a.title) || ((_b = vnode.props) == null ? void 0 : _b["pane-key"])) {
|
|
100
96
|
title.title = (_c = vnode.props) == null ? void 0 : _c.title;
|
|
101
|
-
title.paneKey = ((_d = vnode.props) == null ? void 0 : _d["pane-key"]) ||
|
|
97
|
+
title.paneKey = ((_d = vnode.props) == null ? void 0 : _d["pane-key"]) || index2;
|
|
102
98
|
title.disabled = (_e = vnode.props) == null ? void 0 : _e.disabled;
|
|
103
99
|
}
|
|
104
100
|
titles.value.push(title);
|
|
@@ -107,21 +103,24 @@ const _sfc_main = create({
|
|
|
107
103
|
}
|
|
108
104
|
});
|
|
109
105
|
};
|
|
110
|
-
const init = (vnodes = slots.default()) => {
|
|
106
|
+
const init = (vnodes = ((_a) => (_a = slots.default) == null ? void 0 : _a.call(slots))()) => {
|
|
111
107
|
titles.value = [];
|
|
112
|
-
if (vnodes.length) {
|
|
108
|
+
if (vnodes && vnodes.length) {
|
|
113
109
|
renderTitles(vnodes);
|
|
114
110
|
}
|
|
115
111
|
};
|
|
116
|
-
watch(() =>
|
|
112
|
+
watch(() => {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
115
|
+
}, (vnodes) => {
|
|
117
116
|
init(vnodes);
|
|
118
117
|
});
|
|
119
118
|
watch(() => props.modelValue, (value) => {
|
|
120
|
-
let
|
|
121
|
-
if (
|
|
119
|
+
let index2 = titles.value.findIndex((item) => item.paneKey == value);
|
|
120
|
+
if (index2 == -1) {
|
|
122
121
|
console.error("[NutUI] <Tabs> \u8BF7\u68C0\u67E5 v-model \u503C\u662F\u5426\u4E3A paneKey ,\u5982 paneKey \u672A\u8BBE\u7F6E\uFF0C\u8BF7\u91C7\u7528\u4E0B\u6807\u63A7\u5236 .");
|
|
123
122
|
} else {
|
|
124
|
-
currentIndex.value =
|
|
123
|
+
currentIndex.value = index2;
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
onMounted(init);
|
|
@@ -150,12 +149,12 @@ const _sfc_main = create({
|
|
|
150
149
|
};
|
|
151
150
|
});
|
|
152
151
|
const methods = {
|
|
153
|
-
tabChange: (item,
|
|
152
|
+
tabChange: (item, index2) => {
|
|
154
153
|
emit("click", item);
|
|
155
154
|
if (item.disabled) {
|
|
156
155
|
return;
|
|
157
156
|
}
|
|
158
|
-
currentIndex.value =
|
|
157
|
+
currentIndex.value = index2;
|
|
159
158
|
emit("update:modelValue", item.paneKey);
|
|
160
159
|
emit("change", item);
|
|
161
160
|
}
|
|
@@ -164,8 +163,8 @@ const _sfc_main = create({
|
|
|
164
163
|
titles,
|
|
165
164
|
contentStyle,
|
|
166
165
|
tabsNavStyle,
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
tabsActiveStyle,
|
|
167
|
+
titleStyle
|
|
169
168
|
}, methods);
|
|
170
169
|
}
|
|
171
170
|
});
|
|
@@ -179,11 +178,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
179
178
|
class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
|
|
180
179
|
style: normalizeStyle(_ctx.tabsNavStyle)
|
|
181
180
|
}, [
|
|
182
|
-
_ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item,
|
|
181
|
+
_ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index2) => {
|
|
183
182
|
return openBlock(), createElementBlock("view", {
|
|
184
183
|
class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
|
|
185
184
|
style: normalizeStyle(_ctx.titleStyle),
|
|
186
|
-
onClick: ($event) => _ctx.tabChange(item,
|
|
185
|
+
onClick: ($event) => _ctx.tabChange(item, index2),
|
|
187
186
|
key: item.paneKey
|
|
188
187
|
}, [
|
|
189
188
|
_ctx.type == "line" ? (openBlock(), createElementBlock("view", {
|
|
@@ -215,5 +214,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
215
214
|
], 4)
|
|
216
215
|
], 2);
|
|
217
216
|
}
|
|
218
|
-
var
|
|
219
|
-
export {
|
|
217
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
218
|
+
export { index as default };
|
package/dist/packages/_es/Tag.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -92,10 +92,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
92
92
|
key: 0,
|
|
93
93
|
class: "nut-tag--close",
|
|
94
94
|
name: "close",
|
|
95
|
-
size: "
|
|
95
|
+
size: "12",
|
|
96
96
|
onClick: _ctx.onClose
|
|
97
97
|
}, null, 8, ["onClick"])) : createCommentVNode("", true)
|
|
98
98
|
], 6);
|
|
99
99
|
}
|
|
100
|
-
var
|
|
101
|
-
export {
|
|
100
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
101
|
+
export { index as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ref, computed, onMounted, nextTick, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createCommentVNode } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
const { componentName, create } = createComponent("textarea");
|
|
@@ -52,6 +52,7 @@ const _sfc_main = create({
|
|
|
52
52
|
},
|
|
53
53
|
emits: ["update:modelValue", "change", "blur", "focus"],
|
|
54
54
|
setup(props, { emit }) {
|
|
55
|
+
const textareaRef = ref();
|
|
55
56
|
const classes = computed(() => {
|
|
56
57
|
const prefixCls = componentName;
|
|
57
58
|
return {
|
|
@@ -59,11 +60,41 @@ const _sfc_main = create({
|
|
|
59
60
|
[`${prefixCls}--disabled`]: props.disabled
|
|
60
61
|
};
|
|
61
62
|
});
|
|
63
|
+
onMounted(() => {
|
|
64
|
+
if (props.modelValue) {
|
|
65
|
+
emitChange(String(props.modelValue));
|
|
66
|
+
}
|
|
67
|
+
if (props.autosize) {
|
|
68
|
+
nextTick(getContentHeight);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
62
71
|
const styles = computed(() => {
|
|
63
72
|
return {
|
|
64
73
|
textAlign: props.textAlign
|
|
65
74
|
};
|
|
66
75
|
});
|
|
76
|
+
const getContentHeight = () => {
|
|
77
|
+
let textarea = textareaRef.value;
|
|
78
|
+
textarea.style.height = "auto";
|
|
79
|
+
let height = textarea.scrollHeight;
|
|
80
|
+
if (typeof props.autosize === "object") {
|
|
81
|
+
const { maxHeight, minHeight } = props.autosize;
|
|
82
|
+
if (maxHeight !== void 0) {
|
|
83
|
+
height = Math.min(height, maxHeight);
|
|
84
|
+
}
|
|
85
|
+
if (minHeight !== void 0) {
|
|
86
|
+
height = Math.max(height, minHeight);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (height) {
|
|
90
|
+
textarea.style.height = height + "px";
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
watch(() => props.modelValue, () => {
|
|
94
|
+
if (props.autosize) {
|
|
95
|
+
nextTick(getContentHeight);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
67
98
|
const emitChange = (value, event) => {
|
|
68
99
|
if (props.maxLength && value.length > Number(props.maxLength)) {
|
|
69
100
|
value = value.substring(0, Number(props.maxLength));
|
|
@@ -90,36 +121,8 @@ const _sfc_main = create({
|
|
|
90
121
|
const input = event.target;
|
|
91
122
|
let value = input.value;
|
|
92
123
|
emitChange(value, event);
|
|
93
|
-
emit("blur", event);
|
|
124
|
+
emit("blur", { value, event });
|
|
94
125
|
};
|
|
95
|
-
const textareaRef = ref();
|
|
96
|
-
const getContentHeight = () => {
|
|
97
|
-
let textarea = textareaRef.value;
|
|
98
|
-
textarea.style.height = "auto";
|
|
99
|
-
let height = textarea.scrollHeight;
|
|
100
|
-
if (typeof props.autosize === "object") {
|
|
101
|
-
const { maxHeight, minHeight } = props.autosize;
|
|
102
|
-
if (maxHeight !== void 0) {
|
|
103
|
-
height = Math.min(height, maxHeight);
|
|
104
|
-
}
|
|
105
|
-
if (minHeight !== void 0) {
|
|
106
|
-
height = Math.max(height, minHeight);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (height) {
|
|
110
|
-
textarea.style.height = height + "px";
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
watch(() => props.modelValue, () => {
|
|
114
|
-
if (props.autosize) {
|
|
115
|
-
nextTick(getContentHeight);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
onMounted(() => {
|
|
119
|
-
if (props.autosize) {
|
|
120
|
-
nextTick(getContentHeight);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
126
|
return {
|
|
124
127
|
textareaRef,
|
|
125
128
|
classes,
|
|
@@ -130,21 +133,16 @@ const _sfc_main = create({
|
|
|
130
133
|
};
|
|
131
134
|
}
|
|
132
135
|
});
|
|
133
|
-
const _hoisted_1 =
|
|
136
|
+
const _hoisted_1 = ["rows", "disabled", "readonly", "value", "maxlength", "placeholder", "autofocus"];
|
|
137
|
+
const _hoisted_2 = {
|
|
134
138
|
key: 0,
|
|
135
|
-
class: "nut-textarea__textarea"
|
|
136
|
-
};
|
|
137
|
-
const _hoisted_2 = ["rows", "disabled", "readonly", "value", "maxlength", "placeholder", "auto-focus"];
|
|
138
|
-
const _hoisted_3 = {
|
|
139
|
-
key: 2,
|
|
140
139
|
class: "nut-textarea__limit"
|
|
141
140
|
};
|
|
142
141
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
143
142
|
return openBlock(), createElementBlock("view", {
|
|
144
143
|
class: normalizeClass(_ctx.classes)
|
|
145
144
|
}, [
|
|
146
|
-
|
|
147
|
-
key: 1,
|
|
145
|
+
createElementVNode("textarea", {
|
|
148
146
|
ref: "textareaRef",
|
|
149
147
|
class: "nut-textarea__textarea",
|
|
150
148
|
style: normalizeStyle(_ctx.styles),
|
|
@@ -157,10 +155,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
157
155
|
onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args)),
|
|
158
156
|
maxlength: _ctx.maxLength,
|
|
159
157
|
placeholder: _ctx.placeholder,
|
|
160
|
-
|
|
161
|
-
}, null, 44,
|
|
162
|
-
_ctx.limitShow ? (openBlock(), createElementBlock("view",
|
|
158
|
+
autofocus: _ctx.autofocus
|
|
159
|
+
}, null, 44, _hoisted_1),
|
|
160
|
+
_ctx.limitShow ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0) + "/" + toDisplayString(_ctx.maxLength), 1)) : createCommentVNode("", true)
|
|
163
161
|
], 2);
|
|
164
162
|
}
|
|
165
|
-
var
|
|
166
|
-
export {
|
|
163
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
164
|
+
export { index as default };
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -44,7 +44,6 @@ const _sfc_main = create({
|
|
|
44
44
|
setup: (props, context) => {
|
|
45
45
|
const currentKey = inject("currentKey");
|
|
46
46
|
const currentTime = inject("currentTime");
|
|
47
|
-
inject("muti");
|
|
48
47
|
const state = reactive({
|
|
49
48
|
currentKey,
|
|
50
49
|
currentTime
|
|
@@ -99,5 +98,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
99
98
|
])
|
|
100
99
|
], 2);
|
|
101
100
|
}
|
|
102
|
-
var
|
|
103
|
-
export {
|
|
101
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
102
|
+
export { index as default };
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -66,5 +66,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
66
66
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handlePannel(_ctx.pannelKey))
|
|
67
67
|
}, toDisplayString(_ctx.name), 3);
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
export {
|
|
69
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
70
|
+
export { index as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -31,8 +31,8 @@ const _sfc_main = create({
|
|
|
31
31
|
return [];
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
type:
|
|
34
|
+
isWrapTeleport: {
|
|
35
|
+
type: Boolean,
|
|
36
36
|
default: false
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -52,14 +52,12 @@ const _sfc_main = create({
|
|
|
52
52
|
});
|
|
53
53
|
const currentKey = computed(() => props.currentKey);
|
|
54
54
|
const currentTime = computed(() => props.currentTime);
|
|
55
|
-
const muti = computed(() => props.muti);
|
|
56
55
|
const close = () => {
|
|
57
56
|
context.emit("update:visible", false);
|
|
58
57
|
context.emit("select", currentTime.value);
|
|
59
58
|
};
|
|
60
59
|
provide("currentKey", currentKey);
|
|
61
60
|
provide("currentTime", currentTime);
|
|
62
|
-
provide("muti", muti);
|
|
63
61
|
return {
|
|
64
62
|
classes,
|
|
65
63
|
popStyle,
|
|
@@ -78,6 +76,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
78
76
|
position: "bottom",
|
|
79
77
|
closeable: "",
|
|
80
78
|
round: "",
|
|
79
|
+
isWrapTeleport: _ctx.isWrapTeleport,
|
|
81
80
|
visible: _ctx.visible,
|
|
82
81
|
style: normalizeStyle(_ctx.popStyle),
|
|
83
82
|
onClickOverlay: _ctx.close,
|
|
@@ -101,7 +100,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
101
100
|
], 2)
|
|
102
101
|
]),
|
|
103
102
|
_: 3
|
|
104
|
-
}, 8, ["visible", "style", "onClickOverlay", "onClickCloseIcon"]);
|
|
103
|
+
}, 8, ["isWrapTeleport", "visible", "style", "onClickOverlay", "onClickCloseIcon"]);
|
|
105
104
|
}
|
|
106
|
-
var
|
|
107
|
-
export {
|
|
105
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
106
|
+
export { index as default };
|
|
@@ -1,9 +1,28 @@
|
|
|
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.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
|
|
3
22
|
* (c) 2022 @jdf2e.
|
|
4
23
|
* Released under the MIT License.
|
|
5
24
|
*/
|
|
6
|
-
import { watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle,
|
|
25
|
+
import { reactive, onMounted, watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, createVNode, createCommentVNode, toDisplayString, vShow, render } from "vue";
|
|
7
26
|
import { c as createComponent } from "./component.js";
|
|
8
27
|
import _sfc_main$1 from "./Icon.js";
|
|
9
28
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
@@ -24,10 +43,7 @@ const _sfc_main = create({
|
|
|
24
43
|
type: Boolean,
|
|
25
44
|
default: true
|
|
26
45
|
},
|
|
27
|
-
type:
|
|
28
|
-
type: String,
|
|
29
|
-
default: "text"
|
|
30
|
-
},
|
|
46
|
+
type: String,
|
|
31
47
|
customClass: String,
|
|
32
48
|
bottom: {
|
|
33
49
|
type: String,
|
|
@@ -37,6 +53,10 @@ const _sfc_main = create({
|
|
|
37
53
|
type: [String, Number],
|
|
38
54
|
default: "base"
|
|
39
55
|
},
|
|
56
|
+
iconSize: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "20"
|
|
59
|
+
},
|
|
40
60
|
icon: String,
|
|
41
61
|
textAlignCenter: {
|
|
42
62
|
type: Boolean,
|
|
@@ -67,15 +87,17 @@ const _sfc_main = create({
|
|
|
67
87
|
closeOnClickOverlay: {
|
|
68
88
|
type: Boolean,
|
|
69
89
|
default: false
|
|
70
|
-
},
|
|
71
|
-
visible: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: false
|
|
74
90
|
}
|
|
75
91
|
},
|
|
76
|
-
emits: ["
|
|
92
|
+
emits: ["close"],
|
|
77
93
|
setup(props, { emit }) {
|
|
78
94
|
let timer;
|
|
95
|
+
const state = reactive({
|
|
96
|
+
mounted: false
|
|
97
|
+
});
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
state.mounted = true;
|
|
100
|
+
});
|
|
79
101
|
const clearTimer = () => {
|
|
80
102
|
if (timer) {
|
|
81
103
|
clearTimeout(timer);
|
|
@@ -83,8 +105,7 @@ const _sfc_main = create({
|
|
|
83
105
|
}
|
|
84
106
|
};
|
|
85
107
|
const hide = () => {
|
|
86
|
-
|
|
87
|
-
emit("closed");
|
|
108
|
+
state.mounted = false;
|
|
88
109
|
};
|
|
89
110
|
const show = () => {
|
|
90
111
|
clearTimer();
|
|
@@ -97,9 +118,13 @@ const _sfc_main = create({
|
|
|
97
118
|
const clickCover = () => {
|
|
98
119
|
if (props.closeOnClickOverlay) {
|
|
99
120
|
hide();
|
|
121
|
+
emit("close");
|
|
100
122
|
}
|
|
101
123
|
};
|
|
102
|
-
|
|
124
|
+
if (props.duration) {
|
|
125
|
+
show();
|
|
126
|
+
}
|
|
127
|
+
watch(() => props.duration, (val) => {
|
|
103
128
|
if (val) {
|
|
104
129
|
show();
|
|
105
130
|
}
|
|
@@ -111,18 +136,6 @@ const _sfc_main = create({
|
|
|
111
136
|
return !!props.icon;
|
|
112
137
|
}
|
|
113
138
|
});
|
|
114
|
-
const iconName = computed(() => {
|
|
115
|
-
if (props.icon) {
|
|
116
|
-
return props.icon;
|
|
117
|
-
} else {
|
|
118
|
-
return {
|
|
119
|
-
success: "success",
|
|
120
|
-
fail: "failure",
|
|
121
|
-
warn: "tips",
|
|
122
|
-
loading: "loading"
|
|
123
|
-
}[props.type];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
139
|
const toastBodyClass = computed(() => {
|
|
127
140
|
return [
|
|
128
141
|
"nut-toast",
|
|
@@ -135,15 +148,15 @@ const _sfc_main = create({
|
|
|
135
148
|
];
|
|
136
149
|
});
|
|
137
150
|
const onAfterLeave = () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
151
|
+
clearTimer();
|
|
152
|
+
props.unmount(props.id);
|
|
153
|
+
props.onClose && props.onClose();
|
|
142
154
|
};
|
|
143
155
|
return {
|
|
156
|
+
state,
|
|
157
|
+
hide,
|
|
144
158
|
clickCover,
|
|
145
159
|
hasIcon,
|
|
146
|
-
iconName,
|
|
147
160
|
toastBodyClass,
|
|
148
161
|
onAfterLeave
|
|
149
162
|
};
|
|
@@ -173,8 +186,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
173
186
|
}),
|
|
174
187
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
175
188
|
}, [
|
|
176
|
-
|
|
177
|
-
key: 1,
|
|
189
|
+
createElementVNode("view", {
|
|
178
190
|
class: "nut-toast-inner",
|
|
179
191
|
style: normalizeStyle({
|
|
180
192
|
"text-align": _ctx.textAlignCenter ? "center" : "left",
|
|
@@ -183,23 +195,140 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
183
195
|
}, [
|
|
184
196
|
_ctx.hasIcon ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
185
197
|
createVNode(_component_nut_icon, {
|
|
186
|
-
size:
|
|
198
|
+
size: _ctx.iconSize,
|
|
187
199
|
color: "#ffffff",
|
|
188
|
-
name: _ctx.
|
|
189
|
-
}, null, 8, ["name"])
|
|
200
|
+
name: _ctx.icon
|
|
201
|
+
}, null, 8, ["size", "name"])
|
|
190
202
|
])) : createCommentVNode("", true),
|
|
191
203
|
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
192
204
|
createElementVNode("view", {
|
|
193
205
|
class: "nut-toast-text",
|
|
194
206
|
innerHTML: _ctx.msg
|
|
195
207
|
}, null, 8, _hoisted_3)
|
|
196
|
-
], 4)
|
|
208
|
+
], 4)
|
|
197
209
|
], 6), [
|
|
198
|
-
[vShow, _ctx.
|
|
210
|
+
[vShow, _ctx.state.mounted]
|
|
199
211
|
])
|
|
200
212
|
]),
|
|
201
|
-
_:
|
|
213
|
+
_: 1
|
|
202
214
|
}, 8, ["onAfterLeave"]);
|
|
203
215
|
}
|
|
204
|
-
var
|
|
205
|
-
|
|
216
|
+
var Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
217
|
+
const defaultOptions = {
|
|
218
|
+
msg: "",
|
|
219
|
+
id: "",
|
|
220
|
+
duration: 2e3,
|
|
221
|
+
center: true,
|
|
222
|
+
type: "text",
|
|
223
|
+
title: "",
|
|
224
|
+
customClass: "",
|
|
225
|
+
bottom: "30px",
|
|
226
|
+
size: "base",
|
|
227
|
+
iconSize: "20",
|
|
228
|
+
icon: null,
|
|
229
|
+
textAlignCenter: true,
|
|
230
|
+
loadingRotate: true,
|
|
231
|
+
bgColor: "",
|
|
232
|
+
onClose: null,
|
|
233
|
+
unmount: null,
|
|
234
|
+
cover: false,
|
|
235
|
+
coverColor: "",
|
|
236
|
+
closeOnClickOverlay: false
|
|
237
|
+
};
|
|
238
|
+
let idsMap = [];
|
|
239
|
+
let optsMap = [];
|
|
240
|
+
const clearToast = (id) => {
|
|
241
|
+
if (id) {
|
|
242
|
+
const container = document.getElementById(id);
|
|
243
|
+
optsMap = optsMap.filter((item) => item.id !== id);
|
|
244
|
+
idsMap = idsMap.filter((item) => item !== id);
|
|
245
|
+
if (container) {
|
|
246
|
+
document.body.removeChild(container);
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
idsMap.forEach((item) => {
|
|
250
|
+
const container = document.getElementById(item);
|
|
251
|
+
if (container) {
|
|
252
|
+
document.body.removeChild(container);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
optsMap = [];
|
|
256
|
+
idsMap = [];
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const updateToast = (opts) => {
|
|
260
|
+
const container = document.getElementById(opts.id);
|
|
261
|
+
if (container) {
|
|
262
|
+
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
263
|
+
if (currentOpt) {
|
|
264
|
+
opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
|
|
265
|
+
} else {
|
|
266
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
267
|
+
}
|
|
268
|
+
const instance = createVNode(Toast, opts);
|
|
269
|
+
render(instance, container);
|
|
270
|
+
return instance.component.ctx;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const mountToast = (opts) => {
|
|
274
|
+
opts.unmount = clearToast;
|
|
275
|
+
let _id;
|
|
276
|
+
if (opts.id) {
|
|
277
|
+
_id = opts.id;
|
|
278
|
+
if (idsMap.find((item) => item === opts.id)) {
|
|
279
|
+
return updateToast(opts);
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
_id = new Date().getTime() + "";
|
|
283
|
+
}
|
|
284
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
285
|
+
opts.id = _id;
|
|
286
|
+
idsMap.push(opts.id);
|
|
287
|
+
optsMap.push(opts);
|
|
288
|
+
const container = document.createElement("div");
|
|
289
|
+
container.id = opts.id;
|
|
290
|
+
const instance = createVNode(Toast, opts);
|
|
291
|
+
render(instance, container);
|
|
292
|
+
document.body.appendChild(container);
|
|
293
|
+
return instance.component.ctx;
|
|
294
|
+
};
|
|
295
|
+
const errorMsg = (msg) => {
|
|
296
|
+
if (!msg) {
|
|
297
|
+
console.warn("[NutUI Toast]: msg\u4E0D\u80FD\u4E3A\u7A7A");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const ToastFunction = {
|
|
302
|
+
text(msg, opts = {}) {
|
|
303
|
+
errorMsg(msg);
|
|
304
|
+
return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
|
|
305
|
+
},
|
|
306
|
+
success(msg, opts = {}) {
|
|
307
|
+
errorMsg(msg);
|
|
308
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "success" }, opts), { msg, type: "success" }));
|
|
309
|
+
},
|
|
310
|
+
fail(msg, opts = {}) {
|
|
311
|
+
errorMsg(msg);
|
|
312
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "failure" }, opts), { msg, type: "fail" }));
|
|
313
|
+
},
|
|
314
|
+
warn(msg, opts = {}) {
|
|
315
|
+
errorMsg(msg);
|
|
316
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "tips" }, opts), { msg, type: "warn" }));
|
|
317
|
+
},
|
|
318
|
+
loading(msg, opts = {}) {
|
|
319
|
+
return mountToast(__spreadProps(__spreadValues({
|
|
320
|
+
icon: "loading"
|
|
321
|
+
}, opts), {
|
|
322
|
+
msg,
|
|
323
|
+
type: "loading"
|
|
324
|
+
}));
|
|
325
|
+
},
|
|
326
|
+
hide(id) {
|
|
327
|
+
clearToast(id);
|
|
328
|
+
},
|
|
329
|
+
install(app) {
|
|
330
|
+
app.use(Toast);
|
|
331
|
+
app.config.globalProperties.$toast = ToastFunction;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
export { Toast, ToastFunction, ToastFunction as default };
|