@nutui/nutui 4.0.10-beta.1 → 4.0.10

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6550 -8291
  4. package/dist/nutui.umd.js +1 -1
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -437
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +123 -174
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +154 -51
  128. package/dist/styles/themes/jdb.scss +154 -51
  129. package/dist/styles/themes/jddkh.scss +154 -51
  130. package/dist/styles/themes/jdt.scss +154 -51
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,19 +1,18 @@
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";
1
+ import { computed as l, provide as p, resolveComponent as d, openBlock as u, createBlock as _, normalizeStyle as f, withCtx as y, createElementVNode as t, normalizeClass as v, createElementBlock as h, toDisplayString as k, renderSlot as i } from "vue";
2
+ import { c as b } from "./component-234624bc.js";
3
+ import { P as m } from "./index-360c5092.js";
4
+ import { _ as C } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  import "../locale/lang";
6
6
  import "./Overlay.js";
7
7
  import "@nutui/icons-vue";
8
- const { componentName, create, translate } = createComponent("time-select");
9
- const _sfc_main = create({
8
+ const { componentName: S, create: w, translate: $ } = b("time-select"), g = w({
10
9
  components: {
11
- [Popup.name]: Popup
10
+ [m.name]: m
12
11
  },
13
12
  props: {
14
13
  visible: {
15
14
  type: Boolean,
16
- defalut: false
15
+ defalut: !1
17
16
  },
18
17
  height: {
19
18
  type: [String],
@@ -29,84 +28,64 @@ const _sfc_main = create({
29
28
  },
30
29
  currentTime: {
31
30
  type: Array,
32
- default: () => {
33
- return [];
34
- }
31
+ default: () => []
35
32
  },
36
33
  lockScroll: {
37
34
  type: [Boolean],
38
- default: true
35
+ default: !0
39
36
  },
40
37
  teleportDisable: {
41
38
  type: Boolean,
42
- default: false
39
+ default: !1
43
40
  }
44
41
  },
45
42
  emits: ["update:visible", "select"],
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);
43
+ setup: (e, o) => {
44
+ const r = l(() => ({
45
+ [S]: !0
46
+ })), c = l(() => ({
47
+ width: "100%",
48
+ height: e.height
49
+ })), a = l(() => e.currentKey), s = l(() => e.currentTime), n = () => {
50
+ o.emit("update:visible", !1), o.emit("select", s.value);
64
51
  };
65
- provide("currentKey", currentKey);
66
- provide("currentTime", currentTime);
67
- return {
68
- classes,
69
- popStyle,
70
- props,
71
- close,
72
- translate
52
+ return p("currentKey", a), p("currentTime", s), {
53
+ classes: r,
54
+ popStyle: c,
55
+ props: e,
56
+ close: n,
57
+ translate: $
73
58
  };
74
59
  }
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, {
60
+ }), B = { class: "nut-time-select__title" }, D = { class: "nut-time-select__title__fixed" }, T = { key: 0 }, K = { class: "nut-time-select__content" }, N = { class: "nut-time-select__content__pannel" }, z = { class: "nut-time-select__content__detail" };
61
+ function E(e, o, r, c, a, s) {
62
+ const n = d("nut-popup");
63
+ return u(), _(n, {
85
64
  position: "bottom",
86
65
  closeable: "",
87
66
  round: "",
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
67
+ teleportDisable: e.teleportDisable,
68
+ visible: e.visible,
69
+ style: f(e.popStyle),
70
+ "lock-scroll": e.lockScroll,
71
+ onClickOverlay: e.close,
72
+ onClickCloseIcon: e.close
94
73
  }, {
95
- default: withCtx(() => [
96
- createElementVNode("view", {
97
- class: normalizeClass(_ctx.classes)
74
+ default: y(() => [
75
+ t("view", {
76
+ class: v(e.classes)
98
77
  }, [
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 })
78
+ t("view", B, [
79
+ t("view", D, [
80
+ e.$slots.title ? i(e.$slots, "title", { key: 1 }) : (u(), h("span", T, k(e.title || e.translate("pickupTime")), 1))
102
81
  ])
103
82
  ]),
104
- createElementVNode("view", _hoisted_4, [
105
- createElementVNode("view", _hoisted_5, [
106
- renderSlot(_ctx.$slots, "pannel")
83
+ t("view", K, [
84
+ t("view", N, [
85
+ i(e.$slots, "pannel")
107
86
  ]),
108
- createElementVNode("view", _hoisted_6, [
109
- renderSlot(_ctx.$slots, "detail")
87
+ t("view", z, [
88
+ i(e.$slots, "detail")
110
89
  ])
111
90
  ])
112
91
  ], 2)
@@ -114,7 +93,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
114
93
  _: 3
115
94
  }, 8, ["teleportDisable", "visible", "style", "lock-scroll", "onClickOverlay", "onClickCloseIcon"]);
116
95
  }
117
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
96
+ const G = /* @__PURE__ */ C(g, [["render", E]]);
118
97
  export {
119
- index as default
98
+ G as default
120
99
  };
@@ -1,31 +1,23 @@
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";
1
+ var M = Object.defineProperty, N = Object.defineProperties;
2
+ var D = Object.getOwnPropertyDescriptors;
3
+ var b = Object.getOwnPropertySymbols;
4
+ var $ = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
5
+ var p = (e, t, n) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, o = (e, t) => {
6
+ for (var n in t || (t = {}))
7
+ $.call(t, n) && p(e, n, t[n]);
8
+ if (b)
9
+ for (var n of b(t))
10
+ F.call(t, n) && p(e, n, t[n]);
11
+ return e;
12
+ }, a = (e, t) => N(e, D(t));
13
+ import { reactive as R, onMounted as V, watch as H, computed as y, openBlock as f, createBlock as w, Transition as W, withCtx as j, withDirectives as U, createElementVNode as C, normalizeClass as k, normalizeStyle as S, createElementBlock as T, resolveDynamicComponent as q, createCommentVNode as B, toDisplayString as G, vShow as J, createVNode as K, render as P } from "vue";
14
+ import { c as Q } from "./component-234624bc.js";
15
+ import { r as X } from "./renderIcon-47498b32.js";
16
+ import { _ as Y } from "./_plugin-vue_export-helper-dad06003.js";
24
17
  import "../locale/lang";
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({
18
+ import { C as Z } from "./mountComponent-6d4ff200.js";
19
+ import { Success as x, Failure as _, Tips as ee, Loading as te } from "@nutui/icons-vue";
20
+ const { create: ne } = Q("toast"), oe = ne({
29
21
  components: {},
30
22
  props: {
31
23
  id: String,
@@ -36,7 +28,7 @@ const _sfc_main = create({
36
28
  },
37
29
  center: {
38
30
  type: Boolean,
39
- default: true
31
+ default: !0
40
32
  },
41
33
  type: {
42
34
  type: String,
@@ -57,11 +49,11 @@ const _sfc_main = create({
57
49
  },
58
50
  textAlignCenter: {
59
51
  type: Boolean,
60
- default: true
52
+ default: !0
61
53
  },
62
54
  loadingRotate: {
63
55
  type: Boolean,
64
- default: true
56
+ default: !0
65
57
  },
66
58
  bgColor: {
67
59
  type: String,
@@ -71,7 +63,7 @@ const _sfc_main = create({
71
63
  unmount: Function,
72
64
  cover: {
73
65
  type: Boolean,
74
- default: false
66
+ default: !1
75
67
  },
76
68
  coverColor: {
77
69
  type: String,
@@ -83,142 +75,107 @@ const _sfc_main = create({
83
75
  },
84
76
  closeOnClickOverlay: {
85
77
  type: Boolean,
86
- default: false
78
+ default: !1
87
79
  }
88
80
  },
89
81
  emits: ["close"],
90
- setup(props, { emit }) {
91
- let timer;
92
- const state = reactive({
93
- mounted: false
82
+ setup(e, { emit: t }) {
83
+ let n;
84
+ const r = R({
85
+ mounted: !1
94
86
  });
95
- onMounted(() => {
96
- state.mounted = true;
87
+ V(() => {
88
+ r.mounted = !0;
97
89
  });
98
- const clearTimer = () => {
99
- if (timer) {
100
- clearTimeout(timer);
101
- timer = null;
102
- }
103
- };
104
- const hide = () => {
105
- state.mounted = false;
90
+ const l = () => {
91
+ n && (clearTimeout(n), n = null);
92
+ }, u = () => {
93
+ r.mounted = !1;
94
+ }, d = () => {
95
+ l(), e.duration && (n = setTimeout(() => {
96
+ u();
97
+ }, e.duration));
98
+ }, A = () => {
99
+ e.closeOnClickOverlay && (u(), t("close"));
106
100
  };
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
- }
101
+ e.duration && d(), H(
102
+ () => e.duration,
103
+ (E) => {
104
+ E && d();
130
105
  }
131
106
  );
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
- };
107
+ const h = y(() => e.type !== "text" ? !0 : e.icon !== null), L = y(() => [
108
+ "nut-toast",
109
+ { "nut-toast-center": e.center },
110
+ { "nut-toast-has-icon": h.value },
111
+ { "nut-toast-cover": e.cover },
112
+ { "nut-toast-loading": e.type === "loading" },
113
+ e.customClass,
114
+ "nut-toast-" + e.size
115
+ ]), z = y(() => ["nut-toast-icon-wrapper", { "nut-toast-icon-no-animation": !e.loadingRotate }]);
158
116
  return {
159
- state,
160
- hide,
161
- clickCover,
162
- hasIcon,
163
- toastBodyClass,
164
- toastIconWrapperClass,
165
- onAfterLeave,
166
- renderIcon
117
+ state: r,
118
+ hide: u,
119
+ clickCover: A,
120
+ hasIcon: h,
121
+ toastBodyClass: L,
122
+ toastIconWrapperClass: z,
123
+ onAfterLeave: () => {
124
+ l(), e.unmount(e.id), e.onClose && e.onClose();
125
+ },
126
+ renderIcon: X
167
127
  };
168
128
  }
169
- });
170
- const _hoisted_1 = {
129
+ }), re = {
171
130
  key: 1,
172
131
  class: "nut-toast-title"
173
- };
174
- const _hoisted_2 = ["innerHTML"];
175
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
176
- return openBlock(), createBlock(Transition, {
132
+ }, ae = ["innerHTML"];
133
+ function ie(e, t, n, r, l, u) {
134
+ return f(), w(W, {
177
135
  name: "toast-fade",
178
- onAfterLeave: _ctx.onAfterLeave
136
+ onAfterLeave: e.onAfterLeave
179
137
  }, {
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
138
+ default: j(() => [
139
+ U(C("view", {
140
+ class: k(e.toastBodyClass),
141
+ style: S({
142
+ bottom: e.center ? "auto" : e.bottom,
143
+ "background-color": e.coverColor
186
144
  }),
187
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
145
+ onClick: t[0] || (t[0] = (...d) => e.clickCover && e.clickCover(...d))
188
146
  }, [
189
- createElementVNode("view", {
147
+ C("view", {
190
148
  class: "nut-toast-inner",
191
- style: normalizeStyle({
192
- "text-align": _ctx.textAlignCenter ? "center" : "left",
193
- "background-color": _ctx.bgColor
149
+ style: S({
150
+ "text-align": e.textAlignCenter ? "center" : "left",
151
+ "background-color": e.bgColor
194
152
  })
195
153
  }, [
196
- _ctx.hasIcon ? (openBlock(), createElementBlock("view", {
154
+ e.hasIcon ? (f(), T("view", {
197
155
  key: 0,
198
- class: normalizeClass(_ctx.toastIconWrapperClass)
156
+ class: k(e.toastIconWrapperClass)
199
157
  }, [
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", {
158
+ (f(), w(q(e.renderIcon(e.icon)), { color: "#ffffff" }))
159
+ ], 2)) : B("", !0),
160
+ e.title ? (f(), T("div", re, G(e.title), 1)) : B("", !0),
161
+ C("view", {
204
162
  class: "nut-toast-text",
205
- innerHTML: _ctx.msg
206
- }, null, 8, _hoisted_2)
163
+ innerHTML: e.msg
164
+ }, null, 8, ae)
207
165
  ], 4)
208
166
  ], 6), [
209
- [vShow, _ctx.state.mounted]
167
+ [J, e.state.mounted]
210
168
  ])
211
169
  ]),
212
170
  _: 1
213
171
  }, 8, ["onAfterLeave"]);
214
172
  }
215
- const Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
216
- const defaultOptions = {
173
+ const v = /* @__PURE__ */ Y(oe, [["render", ie]]), g = {
217
174
  msg: "",
218
175
  id: "",
219
176
  duration: 2e3,
220
177
  //显示时间(毫秒)
221
- center: true,
178
+ center: !0,
222
179
  // 未实现
223
180
  type: "text",
224
181
  title: "",
@@ -227,115 +184,84 @@ const defaultOptions = {
227
184
  size: "base",
228
185
  iconSize: "20",
229
186
  icon: null,
230
- textAlignCenter: true,
187
+ textAlignCenter: !0,
231
188
  // 未实现
232
- loadingRotate: true,
189
+ loadingRotate: !0,
233
190
  // 未实现
234
191
  bgColor: "",
235
192
  onClose: null,
236
193
  // 未实现
237
194
  unmount: null,
238
- cover: false,
195
+ cover: !1,
239
196
  //透明遮罩层 // 未实现
240
197
  coverColor: "",
241
198
  // 未实现
242
- closeOnClickOverlay: false
199
+ closeOnClickOverlay: !1
243
200
  // 未实现
244
201
  };
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 = [];
202
+ let i = [], c = [];
203
+ const I = (e) => {
204
+ if (e) {
205
+ const t = document.getElementById(e);
206
+ c = c.filter((n) => n.id !== e), i = i.filter((n) => n !== e), t && document.body.removeChild(t);
207
+ } else
208
+ i.forEach((t) => {
209
+ const n = document.getElementById(t);
210
+ n && document.body.removeChild(n);
211
+ }), c = [], i = [];
212
+ }, le = (e) => {
213
+ const t = document.getElementById(e.id);
214
+ if (t) {
215
+ const n = c.find((l) => l.id === e.id);
216
+ n ? e = o(o(o({}, g), n), e) : e = o(o({}, g), e);
217
+ const r = K(v, e);
218
+ return P(r, t), O;
264
219
  }
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) {
220
+ }, s = (e) => {
221
+ e.unmount = I;
222
+ let t;
223
+ if (e.id) {
224
+ if (t = e.id, i.find((n) => n === e.id))
225
+ return le(e);
226
+ } else
227
+ t = (/* @__PURE__ */ new Date()).getTime() + "";
228
+ return e = o(o({}, g), e), e.id = t, i.push(e.id), c.push(e), Z(e, {
229
+ wrapper: v
230
+ }), O;
231
+ }, m = (e) => {
232
+ if (!e) {
302
233
  console.warn("[NutUI Toast]: msg不能为空");
303
234
  return;
304
235
  }
305
- };
306
- const showToast = {
307
- text(msg, opts = {}) {
308
- errorMsg(msg);
309
- return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
236
+ }, O = {
237
+ text(e, t = {}) {
238
+ return m(e), s(a(o({}, t), { type: "text", msg: e }));
310
239
  },
311
- success(msg, opts = {}) {
312
- errorMsg(msg);
313
- return mountToast(__spreadProps(__spreadValues({ icon: Success }, opts), { msg, type: "success" }));
240
+ success(e, t = {}) {
241
+ return m(e), s(a(o({ icon: x }, t), { msg: e, type: "success" }));
314
242
  },
315
- fail(msg, opts = {}) {
316
- errorMsg(msg);
317
- return mountToast(__spreadProps(__spreadValues({ icon: Failure }, opts), { msg, type: "fail" }));
243
+ fail(e, t = {}) {
244
+ return m(e), s(a(o({ icon: _ }, t), { msg: e, type: "fail" }));
318
245
  },
319
- warn(msg, opts = {}) {
320
- errorMsg(msg);
321
- return mountToast(__spreadProps(__spreadValues({ icon: Tips }, opts), { msg, type: "warn" }));
246
+ warn(e, t = {}) {
247
+ return m(e), s(a(o({ icon: ee }, t), { msg: e, type: "warn" }));
322
248
  },
323
- loading(msg, opts = {}) {
324
- return mountToast(__spreadProps(__spreadValues({
325
- icon: Loading
326
- }, opts), {
327
- msg,
249
+ loading(e, t = {}) {
250
+ return s(a(o({
251
+ icon: te
252
+ }, t), {
253
+ msg: e,
328
254
  type: "loading"
329
255
  }));
330
256
  },
331
- hide(id) {
332
- clearToast(id);
257
+ hide(e) {
258
+ I(e);
333
259
  },
334
- install(app) {
335
- app.use(Toast);
260
+ install(e) {
261
+ e.use(v);
336
262
  }
337
263
  };
338
264
  export {
339
- Toast as default,
340
- showToast
265
+ v as default,
266
+ O as showToast
341
267
  };