@nutui/nutui 3.1.12-beta.0 → 3.1.12-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/nutui.d.ts +4 -1
  2. package/dist/nutui.es.js +3943 -4130
  3. package/dist/nutui.umd.js +3947 -4201
  4. package/dist/packages/_es/ActionSheet.js +13 -12
  5. package/dist/packages/_es/Address.js +63 -49
  6. package/dist/packages/_es/Avatar.js +4 -5
  7. package/dist/packages/_es/BackTop.js +72 -109
  8. package/dist/packages/_es/Badge.js +4 -5
  9. package/dist/packages/_es/Barrage.js +63 -57
  10. package/dist/packages/_es/Button.js +5 -6
  11. package/dist/packages/_es/Calendar.js +27 -18
  12. package/dist/packages/_es/Card.js +104 -0
  13. package/dist/packages/_es/Cell.js +5 -13
  14. package/dist/packages/_es/CellGroup.js +4 -5
  15. package/dist/packages/_es/Checkbox.js +3 -3
  16. package/dist/packages/_es/CheckboxGroup.js +9 -4
  17. package/dist/packages/_es/CircleProgress.js +142 -46
  18. package/dist/packages/_es/Col.js +4 -5
  19. package/dist/packages/_es/Collapse.js +35 -10
  20. package/dist/packages/_es/CollapseItem.js +80 -35
  21. package/dist/packages/_es/CountDown.js +7 -5
  22. package/dist/packages/_es/CountUp.js +34 -31
  23. package/dist/packages/_es/DatePicker.js +451 -219
  24. package/dist/packages/_es/Dialog.js +24 -89
  25. package/dist/packages/_es/Divider.js +5 -6
  26. package/dist/packages/_es/Drag.js +76 -50
  27. package/dist/packages/_es/Elevator.js +81 -52
  28. package/dist/packages/_es/FixedNav.js +8 -9
  29. package/dist/packages/_es/Form.js +137 -0
  30. package/dist/packages/_es/FormItem.js +109 -0
  31. package/dist/packages/_es/Icon.js +6 -40
  32. package/dist/packages/_es/ImagePreview.js +23 -21
  33. package/dist/packages/_es/InfiniteLoading.js +95 -109
  34. package/dist/packages/_es/Input.js +22 -21
  35. package/dist/packages/_es/InputNumber.js +24 -18
  36. package/dist/packages/_es/Layout.js +2 -2
  37. package/dist/packages/_es/Menu.js +16 -14
  38. package/dist/packages/_es/MenuItem.js +9 -11
  39. package/dist/packages/_es/Navbar.js +7 -7
  40. package/dist/packages/_es/NoticeBar.js +39 -26
  41. package/dist/packages/_es/Notify.js +30 -166
  42. package/dist/packages/_es/NumberKeyboard.js +10 -6
  43. package/dist/packages/_es/OverLay.js +22 -29
  44. package/dist/packages/_es/Pagination.js +8 -9
  45. package/dist/packages/_es/Picker.js +61 -447
  46. package/dist/packages/_es/Popover.js +146 -25
  47. package/dist/packages/_es/Popup.js +17 -77
  48. package/dist/packages/_es/Price.js +18 -7
  49. package/dist/packages/_es/Progress.js +23 -12
  50. package/dist/packages/_es/Radio.js +3 -3
  51. package/dist/packages/_es/RadioGroup.js +2 -2
  52. package/dist/packages/_es/Range.js +37 -30
  53. package/dist/packages/_es/Rate.js +16 -20
  54. package/dist/packages/_es/Row.js +4 -5
  55. package/dist/packages/_es/SearchBar.js +7 -5
  56. package/dist/packages/_es/ShortPassword.js +89 -59
  57. package/dist/packages/_es/Signature.js +70 -71
  58. package/dist/packages/_es/Sku.js +54 -79
  59. package/dist/packages/_es/Step.js +10 -8
  60. package/dist/packages/_es/Steps.js +2 -2
  61. package/dist/packages/_es/Swipe.js +42 -27
  62. package/dist/packages/_es/Swiper.js +17 -418
  63. package/dist/packages/_es/SwiperItem.js +14 -39
  64. package/dist/packages/_es/Switch.js +4 -5
  65. package/dist/packages/_es/TabPane.js +4 -5
  66. package/dist/packages/_es/Tabbar.js +4 -5
  67. package/dist/packages/_es/TabbarItem.js +8 -9
  68. package/dist/packages/_es/Tabs.js +22 -16
  69. package/dist/packages/_es/Tag.js +5 -6
  70. package/dist/packages/_es/TextArea.js +16 -12
  71. package/dist/packages/_es/TimeDetail.js +7 -5
  72. package/dist/packages/_es/TimePannel.js +7 -5
  73. package/dist/packages/_es/TimeSelect.js +12 -7
  74. package/dist/packages/_es/Toast.js +41 -163
  75. package/dist/packages/_es/Uploader.js +109 -149
  76. package/dist/packages/_es/commonProps.js +30 -0
  77. package/dist/packages/_es/component.js +1 -1
  78. package/dist/packages/_es/index.js +1 -1
  79. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  80. package/dist/packages/_es/index2.js +40 -27
  81. package/dist/packages/_es/index3.js +413 -7
  82. package/dist/packages/_es/pxCheck.js +1 -1
  83. package/dist/packages/_es/raf.js +1 -1
  84. package/dist/packages/_es/use-lock-scroll.js +23 -0
  85. package/dist/packages/_es/util.js +47 -0
  86. package/dist/packages/button/index.scss +6 -0
  87. package/dist/packages/card/index.scss +97 -0
  88. package/dist/packages/checkbox/index.scss +1 -1
  89. package/dist/packages/form/index.scss +2 -0
  90. package/dist/packages/formitem/index.scss +60 -0
  91. package/dist/packages/numberkeyboard/index.scss +1 -1
  92. package/dist/packages/switch/index.scss +1 -1
  93. package/dist/style.css +1 -1
  94. package/dist/style.es.js +1 -2
  95. package/dist/styles/themes/default.scss +35 -32
  96. package/dist/styles/variables.scss +11 -1
  97. package/package.json +2 -2
  98. package/dist/packages/_es/Video.js +0 -405
  99. package/dist/packages/_es/plugin-vue_export-helper.js +0 -13
@@ -14,19 +14,21 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
+ var __require = typeof require !== "undefined" ? require : (x) => {
18
+ throw new Error('Dynamic require of "' + x + '" is not supported');
19
+ };
17
20
  var __publicField = (obj, key, value) => {
18
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
22
  return value;
20
23
  };
21
24
  /*!
22
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
25
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
23
26
  * (c) 2021 @jdf2e.
24
27
  * Released under the MIT License.
25
28
  */
26
29
  import { p as pxCheck } from "./pxCheck.js";
27
30
  import { provide, computed, ref, watch, onMounted, onActivated, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode, createVNode, toDisplayString } from "vue";
28
31
  import { c as createComponent } from "./component.js";
29
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
32
  const { create } = createComponent("tabs");
31
33
  class Title {
32
34
  constructor() {
@@ -36,7 +38,7 @@ class Title {
36
38
  __publicField(this, "disabled", false);
37
39
  }
38
40
  }
39
- const _sfc_main = create({
41
+ var _sfc_main = create({
40
42
  props: {
41
43
  modelValue: {
42
44
  type: [String, Number],
@@ -54,6 +56,10 @@ const _sfc_main = create({
54
56
  type: String,
55
57
  default: "line"
56
58
  },
59
+ lineWidth: {
60
+ type: [String, Number],
61
+ default: ""
62
+ },
57
63
  titleScroll: {
58
64
  type: Boolean,
59
65
  default: false
@@ -82,7 +88,7 @@ const _sfc_main = create({
82
88
  const titles = ref([]);
83
89
  const currentIndex = ref(props.modelValue || 0);
84
90
  const renderTitles = (vnodes) => {
85
- vnodes.forEach((vnode, index2) => {
91
+ vnodes.forEach((vnode, index) => {
86
92
  var _a, _b, _c, _d, _e;
87
93
  let type = vnode.type;
88
94
  type = type.name || type;
@@ -90,7 +96,7 @@ const _sfc_main = create({
90
96
  let title = new Title();
91
97
  if (((_a = vnode.props) == null ? void 0 : _a.title) || ((_b = vnode.props) == null ? void 0 : _b["pane-key"])) {
92
98
  title.title = (_c = vnode.props) == null ? void 0 : _c.title;
93
- title.paneKey = ((_d = vnode.props) == null ? void 0 : _d["pane-key"]) || index2;
99
+ title.paneKey = ((_d = vnode.props) == null ? void 0 : _d["pane-key"]) || index;
94
100
  title.disabled = (_e = vnode.props) == null ? void 0 : _e.disabled;
95
101
  }
96
102
  titles.value.push(title);
@@ -109,11 +115,11 @@ const _sfc_main = create({
109
115
  init(vnodes);
110
116
  });
111
117
  watch(() => props.modelValue, (value) => {
112
- let index2 = titles.value.findIndex((item) => item.paneKey == value);
113
- if (index2 == -1) {
118
+ let index = titles.value.findIndex((item) => item.paneKey == value);
119
+ if (index == -1) {
114
120
  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 .");
115
121
  } else {
116
- currentIndex.value = index2;
122
+ currentIndex.value = index;
117
123
  }
118
124
  });
119
125
  onMounted(init);
@@ -142,12 +148,12 @@ const _sfc_main = create({
142
148
  };
143
149
  });
144
150
  const methods = {
145
- tabChange: (item, index2) => {
151
+ tabChange: (item, index) => {
146
152
  emit("click", item);
147
153
  if (item.disabled) {
148
154
  return;
149
155
  }
150
- currentIndex.value = index2;
156
+ currentIndex.value = index;
151
157
  emit("update:modelValue", item.paneKey);
152
158
  emit("change", item);
153
159
  }
@@ -156,8 +162,8 @@ const _sfc_main = create({
156
162
  titles,
157
163
  contentStyle,
158
164
  tabsNavStyle,
159
- tabsActiveStyle,
160
- titleStyle
165
+ titleStyle,
166
+ tabsActiveStyle
161
167
  }, methods);
162
168
  }
163
169
  });
@@ -171,11 +177,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
171
177
  class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll }]),
172
178
  style: normalizeStyle(_ctx.tabsNavStyle)
173
179
  }, [
174
- _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index2) => {
180
+ _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
175
181
  return openBlock(), createElementBlock("view", {
176
182
  class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
177
183
  style: normalizeStyle(_ctx.titleStyle),
178
- onClick: ($event) => _ctx.tabChange(item, index2),
184
+ onClick: ($event) => _ctx.tabChange(item, index),
179
185
  key: item.paneKey
180
186
  }, [
181
187
  _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
@@ -207,5 +213,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
207
213
  ], 4)
208
214
  ], 2);
209
215
  }
210
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
211
- export { index as default };
216
+ _sfc_main.render = _sfc_render;
217
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createBlock, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { componentName, create } = createComponent("tag");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  color: { type: String, default: "" },
13
12
  textColor: { type: String, default: "" },
@@ -86,10 +85,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
86
85
  key: 0,
87
86
  class: "nut-tag--close",
88
87
  name: "close",
89
- size: "12",
88
+ size: "11",
90
89
  onClick: _ctx.onClose
91
90
  }, null, 8, ["onClick"])) : createCommentVNode("", true)
92
91
  ], 6);
93
92
  }
94
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
95
- export { index as default };
93
+ _sfc_main.render = _sfc_render;
94
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createCommentVNode } from "vue";
6
+ import { computed, openBlock, createElementBlock, normalizeClass, toDisplayString, normalizeStyle, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { componentName, create } = createComponent("textarea");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  modelValue: {
13
12
  type: [String, Number],
@@ -87,7 +86,7 @@ const _sfc_main = create({
87
86
  const input = event.target;
88
87
  let value = input.value;
89
88
  emitChange(value, event);
90
- emit("blur", { value, event });
89
+ emit("blur", event);
91
90
  };
92
91
  return {
93
92
  classes,
@@ -98,16 +97,21 @@ const _sfc_main = create({
98
97
  };
99
98
  }
100
99
  });
101
- const _hoisted_1 = ["rows", "disabled", "readonly", "value", "maxlength", "placeholder"];
102
- const _hoisted_2 = {
100
+ const _hoisted_1 = {
103
101
  key: 0,
102
+ class: "nut-textarea__textarea"
103
+ };
104
+ const _hoisted_2 = ["rows", "disabled", "readonly", "value", "maxlength", "placeholder"];
105
+ const _hoisted_3 = {
106
+ key: 2,
104
107
  class: "nut-textarea__limit"
105
108
  };
106
109
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
110
  return openBlock(), createElementBlock("view", {
108
111
  class: normalizeClass(_ctx.classes)
109
112
  }, [
110
- createElementVNode("textarea", {
113
+ _ctx.readonly ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.modelValue), 1)) : (openBlock(), createElementBlock("textarea", {
114
+ key: 1,
111
115
  class: "nut-textarea__textarea",
112
116
  style: normalizeStyle(_ctx.styles),
113
117
  rows: _ctx.rows,
@@ -119,9 +123,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
119
123
  onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args)),
120
124
  maxlength: _ctx.maxLength,
121
125
  placeholder: _ctx.placeholder
122
- }, null, 44, _hoisted_1),
123
- _ctx.limitShow ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0) + "/" + toDisplayString(_ctx.maxLength), 1)) : createCommentVNode("", true)
126
+ }, null, 44, _hoisted_2)),
127
+ _ctx.limitShow ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0) + "/" + toDisplayString(_ctx.maxLength), 1)) : createCommentVNode("", true)
124
128
  ], 2);
125
129
  }
126
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
127
- export { index as default };
130
+ _sfc_main.render = _sfc_render;
131
+ export { _sfc_main as default };
@@ -17,16 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
20
23
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
25
  * (c) 2021 @jdf2e.
23
26
  * Released under the MIT License.
24
27
  */
25
28
  import { inject, reactive, computed, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, toDisplayString } from "vue";
26
29
  import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
30
  const { componentName, create } = createComponent("timedetail");
29
- const _sfc_main = create({
31
+ var _sfc_main = create({
30
32
  name: "timedetail",
31
33
  props: {
32
34
  times: {
@@ -98,5 +100,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
98
100
  ])
99
101
  ], 2);
100
102
  }
101
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
102
- export { index as default };
103
+ _sfc_main.render = _sfc_render;
104
+ export { _sfc_main as default };
@@ -17,16 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
20
23
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
25
  * (c) 2021 @jdf2e.
23
26
  * Released under the MIT License.
24
27
  */
25
28
  import { inject, reactive, computed, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString } from "vue";
26
29
  import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
30
  const { componentName, create } = createComponent("timepannel");
29
- const _sfc_main = create({
31
+ var _sfc_main = create({
30
32
  name: "timepannel",
31
33
  props: {
32
34
  name: {
@@ -66,5 +68,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
66
68
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handlePannel(_ctx.pannelKey))
67
69
  }, toDisplayString(_ctx.name), 3);
68
70
  }
69
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
70
- export { index as default };
71
+ _sfc_main.render = _sfc_render;
72
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { computed, provide, resolveComponent, openBlock, createBlock, normalizeStyle, withCtx, createElementVNode, normalizeClass, toDisplayString, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { componentName, create } = createComponent("timeselect");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  visible: {
13
12
  type: Boolean,
@@ -30,9 +29,13 @@ const _sfc_main = create({
30
29
  default: () => {
31
30
  return [];
32
31
  }
32
+ },
33
+ muti: {
34
+ type: [Boolean],
35
+ default: false
33
36
  }
34
37
  },
35
- emits: ["update:visible", "select"],
38
+ emits: ["update:visible", "selected"],
36
39
  setup: (props, context) => {
37
40
  const classes = computed(() => {
38
41
  const prefixCls = componentName;
@@ -48,12 +51,14 @@ const _sfc_main = create({
48
51
  });
49
52
  const currentKey = computed(() => props.currentKey);
50
53
  const currentTime = computed(() => props.currentTime);
54
+ const muti = computed(() => props.muti);
51
55
  const close = () => {
52
56
  context.emit("update:visible", false);
53
- context.emit("select", currentTime.value);
57
+ context.emit("selected", currentTime.value);
54
58
  };
55
59
  provide("currentKey", currentKey);
56
60
  provide("currentTime", currentTime);
61
+ provide("muti", muti);
57
62
  return {
58
63
  classes,
59
64
  popStyle,
@@ -97,5 +102,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
97
102
  _: 3
98
103
  }, 8, ["visible", "style", "onClickOverlay", "onClickCloseIcon"]);
99
104
  }
100
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
101
- export { index as default };
105
+ _sfc_main.render = _sfc_render;
106
+ export { _sfc_main as default };
@@ -1,31 +1,11 @@
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.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
3
  * (c) 2021 @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, vShow, render } from "vue";
6
+ import { watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, createVNode, createCommentVNode, vShow } from "vue";
26
7
  import { c as createComponent } from "./component.js";
27
- import _sfc_main$1 from "./Icon.js";
28
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
8
+ import { _ as _sfc_main$1 } from "./index.taro.vue_vue&type=script&lang.js";
29
9
  import "./pxCheck.js";
30
10
  const { create } = createComponent("toast");
31
11
  const _sfc_main = create({
@@ -43,7 +23,10 @@ const _sfc_main = create({
43
23
  type: Boolean,
44
24
  default: true
45
25
  },
46
- type: String,
26
+ type: {
27
+ type: String,
28
+ default: "text"
29
+ },
47
30
  customClass: String,
48
31
  bottom: {
49
32
  type: Number,
@@ -79,16 +62,15 @@ const _sfc_main = create({
79
62
  closeOnClickOverlay: {
80
63
  type: Boolean,
81
64
  default: false
65
+ },
66
+ visible: {
67
+ type: Boolean,
68
+ default: false
82
69
  }
83
70
  },
84
- setup(props) {
71
+ emits: ["update:visible", "closed"],
72
+ setup(props, { emit }) {
85
73
  let timer;
86
- const state = reactive({
87
- mounted: false
88
- });
89
- onMounted(() => {
90
- state.mounted = true;
91
- });
92
74
  const clearTimer = () => {
93
75
  if (timer) {
94
76
  clearTimeout(timer);
@@ -96,7 +78,8 @@ const _sfc_main = create({
96
78
  }
97
79
  };
98
80
  const hide = () => {
99
- state.mounted = false;
81
+ emit("update:visible", false);
82
+ emit("closed");
100
83
  };
101
84
  const show = () => {
102
85
  clearTimer();
@@ -111,10 +94,7 @@ const _sfc_main = create({
111
94
  hide();
112
95
  }
113
96
  };
114
- if (props.duration) {
115
- show();
116
- }
117
- watch(() => props.duration, (val) => {
97
+ watch(() => props.visible, (val) => {
118
98
  if (val) {
119
99
  show();
120
100
  }
@@ -126,6 +106,18 @@ const _sfc_main = create({
126
106
  return !!props.icon;
127
107
  }
128
108
  });
109
+ const iconName = computed(() => {
110
+ if (props.icon) {
111
+ return props.icon;
112
+ } else {
113
+ return {
114
+ success: "success",
115
+ fail: "failure",
116
+ warn: "tips",
117
+ loading: "loading"
118
+ }[props.type];
119
+ }
120
+ });
129
121
  const toastBodyClass = computed(() => {
130
122
  return [
131
123
  "nut-toast",
@@ -138,15 +130,15 @@ const _sfc_main = create({
138
130
  ];
139
131
  });
140
132
  const onAfterLeave = () => {
141
- clearTimer();
142
- props.unmount(props.id);
143
- props.onClose && props.onClose();
133
+ if (props.visible) {
134
+ clearTimer();
135
+ hide();
136
+ }
144
137
  };
145
138
  return {
146
- state,
147
- hide,
148
139
  clickCover,
149
140
  hasIcon,
141
+ iconName,
150
142
  toastBodyClass,
151
143
  onAfterLeave
152
144
  };
@@ -172,7 +164,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
172
164
  }),
173
165
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
174
166
  }, [
175
- createElementVNode("view", {
167
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock("view", {
168
+ key: 1,
176
169
  class: "nut-toast-inner",
177
170
  style: normalizeStyle({
178
171
  "text-align": _ctx.textAlignCenter ? "center" : "left",
@@ -183,135 +176,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
183
176
  createVNode(_component_nut_icon, {
184
177
  size: "20",
185
178
  color: "#ffffff",
186
- name: _ctx.icon
179
+ name: _ctx.iconName
187
180
  }, null, 8, ["name"])
188
181
  ])) : createCommentVNode("", true),
189
182
  createElementVNode("view", {
190
183
  class: "nut-toast-text",
191
184
  innerHTML: _ctx.msg
192
185
  }, null, 8, _hoisted_2)
193
- ], 4)
186
+ ], 4))
194
187
  ], 6), [
195
- [vShow, _ctx.state.mounted]
188
+ [vShow, _ctx.visible]
196
189
  ])
197
190
  ]),
198
- _: 1
191
+ _: 3
199
192
  }, 8, ["onAfterLeave"]);
200
193
  }
201
- var Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
202
- const defaultOptions = {
203
- msg: "",
204
- id: "",
205
- duration: 2e3,
206
- center: true,
207
- type: "text",
208
- customClass: "",
209
- bottom: 30,
210
- size: "base",
211
- icon: null,
212
- textAlignCenter: true,
213
- loadingRotate: true,
214
- bgColor: "rgba(0, 0, 0, .8)",
215
- onClose: null,
216
- unmount: null,
217
- cover: false,
218
- coverColor: "rgba(0, 0, 0, 0)",
219
- closeOnClickOverlay: false
220
- };
221
- let idsMap = [];
222
- let optsMap = [];
223
- const clearToast = (id) => {
224
- if (id) {
225
- const container = document.getElementById(id);
226
- optsMap = optsMap.filter((item) => item.id !== id);
227
- idsMap = idsMap.filter((item) => item !== id);
228
- if (container) {
229
- document.body.removeChild(container);
230
- }
231
- } else {
232
- idsMap.forEach((item) => {
233
- const container = document.getElementById(item);
234
- if (container) {
235
- document.body.removeChild(container);
236
- }
237
- });
238
- optsMap = [];
239
- idsMap = [];
240
- }
241
- };
242
- const updateToast = (opts) => {
243
- const container = document.getElementById(opts.id);
244
- if (container) {
245
- const currentOpt = optsMap.find((item) => item.id === opts.id);
246
- if (currentOpt) {
247
- opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
248
- } else {
249
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
250
- }
251
- const instance = createVNode(Toast, opts);
252
- render(instance, container);
253
- return instance.component.ctx;
254
- }
255
- };
256
- const mountToast = (opts) => {
257
- opts.unmount = clearToast;
258
- let _id;
259
- if (opts.id) {
260
- _id = opts.id;
261
- if (idsMap.find((item) => item === opts.id)) {
262
- return updateToast(opts);
263
- }
264
- } else {
265
- _id = new Date().getTime() + "";
266
- }
267
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
268
- opts.id = _id;
269
- idsMap.push(opts.id);
270
- optsMap.push(opts);
271
- const container = document.createElement("div");
272
- container.id = opts.id;
273
- const instance = createVNode(Toast, opts);
274
- render(instance, container);
275
- document.body.appendChild(container);
276
- return instance.component.ctx;
277
- };
278
- const errorMsg = (msg) => {
279
- if (!msg) {
280
- console.warn("[NutUI Toast]: msg\u4E0D\u80FD\u4E3A\u7A7A");
281
- return;
282
- }
283
- };
284
- const ToastFunction = {
285
- text(msg, opts = {}) {
286
- errorMsg(msg);
287
- return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
288
- },
289
- success(msg, opts = {}) {
290
- errorMsg(msg);
291
- return mountToast(__spreadProps(__spreadValues({ icon: "success" }, opts), { msg, type: "success" }));
292
- },
293
- fail(msg, opts = {}) {
294
- errorMsg(msg);
295
- return mountToast(__spreadProps(__spreadValues({ icon: "failure" }, opts), { msg, type: "fail" }));
296
- },
297
- warn(msg, opts = {}) {
298
- errorMsg(msg);
299
- return mountToast(__spreadProps(__spreadValues({ icon: "tips" }, opts), { msg, type: "warn" }));
300
- },
301
- loading(msg, opts = {}) {
302
- return mountToast(__spreadProps(__spreadValues({
303
- icon: "loading"
304
- }, opts), {
305
- msg,
306
- type: "loading"
307
- }));
308
- },
309
- hide(id) {
310
- clearToast(id);
311
- },
312
- install(app) {
313
- app.use(Toast);
314
- app.config.globalProperties.$toast = ToastFunction;
315
- }
316
- };
317
- export { Toast, ToastFunction, ToastFunction as default };
194
+ _sfc_main.render = _sfc_render;
195
+ export { _sfc_main as default };