@nutui/nutui 3.1.19-beta.0 → 3.1.19-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 (110) hide show
  1. package/dist/nutui.d.ts +38 -37
  2. package/dist/nutui.es.js +13439 -12616
  3. package/dist/nutui.umd.js +13431 -12695
  4. package/dist/packages/_es/ActionSheet.js +12 -18
  5. package/dist/packages/_es/Address.js +78 -69
  6. package/dist/packages/_es/Audio.js +12 -12
  7. package/dist/packages/_es/AudioOperate.js +1 -1
  8. package/dist/packages/_es/Avatar.js +3 -3
  9. package/dist/packages/_es/BackTop.js +68 -110
  10. package/dist/packages/_es/Badge.js +3 -3
  11. package/dist/packages/_es/Barrage.js +62 -55
  12. package/dist/packages/_es/Button.js +2 -2
  13. package/dist/packages/_es/Calendar.js +28 -23
  14. package/dist/packages/_es/CalendarItem.js +3 -3
  15. package/dist/packages/_es/Card.js +6 -5
  16. package/dist/packages/_es/Cascader.js +7 -7
  17. package/dist/packages/_es/Cell.js +4 -11
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +1 -1
  20. package/dist/packages/_es/CheckboxGroup.js +1 -1
  21. package/dist/packages/_es/CircleProgress.js +149 -40
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +34 -8
  24. package/dist/packages/_es/CollapseItem.js +90 -59
  25. package/dist/packages/_es/CountDown.js +5 -5
  26. package/dist/packages/_es/CountUp.js +43 -51
  27. package/dist/packages/_es/DatePicker.js +21 -20
  28. package/dist/packages/_es/Dialog.js +8 -86
  29. package/dist/packages/_es/Divider.js +4 -4
  30. package/dist/packages/_es/Drag.js +92 -54
  31. package/dist/packages/_es/Elevator.js +74 -49
  32. package/dist/packages/_es/Empty.js +3 -3
  33. package/dist/packages/_es/FixedNav.js +5 -5
  34. package/dist/packages/_es/Form.js +4 -4
  35. package/dist/packages/_es/FormItem.js +1 -1
  36. package/dist/packages/_es/Grid.js +1 -1
  37. package/dist/packages/_es/GridItem.js +8 -26
  38. package/dist/packages/_es/Icon.js +1 -1
  39. package/dist/packages/_es/ImagePreview.js +15 -84
  40. package/dist/packages/_es/Indicator.js +3 -3
  41. package/dist/packages/_es/InfiniteLoading.js +93 -107
  42. package/dist/packages/_es/Input.js +8 -8
  43. package/dist/packages/_es/InputNumber.js +23 -16
  44. package/dist/packages/_es/Layout.js +1 -1
  45. package/dist/packages/_es/List.js +41 -34
  46. package/dist/packages/_es/Menu.js +15 -12
  47. package/dist/packages/_es/MenuItem.js +9 -9
  48. package/dist/packages/_es/Navbar.js +3 -4
  49. package/dist/packages/_es/NoticeBar.js +47 -40
  50. package/dist/packages/_es/Notify.js +29 -168
  51. package/dist/packages/_es/NumberKeyboard.js +5 -10
  52. package/dist/packages/_es/OldPicker.js +122 -120
  53. package/dist/packages/_es/OverLay.js +5 -25
  54. package/dist/packages/_es/Pagination.js +7 -7
  55. package/dist/packages/_es/Picker.js +39 -16
  56. package/dist/packages/_es/Popover.js +155 -30
  57. package/dist/packages/_es/Popup.js +8 -71
  58. package/dist/packages/_es/Price.js +17 -5
  59. package/dist/packages/_es/Progress.js +18 -8
  60. package/dist/packages/_es/PullRefresh.js +1 -1
  61. package/dist/packages/_es/Radio.js +2 -2
  62. package/dist/packages/_es/RadioGroup.js +1 -1
  63. package/dist/packages/_es/Range.js +46 -33
  64. package/dist/packages/_es/Rate.js +16 -19
  65. package/dist/packages/_es/Row.js +1 -1
  66. package/dist/packages/_es/SearchBar.js +8 -6
  67. package/dist/packages/_es/ShortPassword.js +89 -67
  68. package/dist/packages/_es/SideNavBar.js +5 -16
  69. package/dist/packages/_es/SideNavBarItem.js +1 -1
  70. package/dist/packages/_es/Signature.js +69 -88
  71. package/dist/packages/_es/Skeleton.js +8 -11
  72. package/dist/packages/_es/Sku.js +47 -56
  73. package/dist/packages/_es/Step.js +1 -1
  74. package/dist/packages/_es/Steps.js +1 -1
  75. package/dist/packages/_es/Sticky.js +28 -23
  76. package/dist/packages/_es/SubSideNavBar.js +1 -1
  77. package/dist/packages/_es/Swipe.js +39 -26
  78. package/dist/packages/_es/Swiper.js +31 -13
  79. package/dist/packages/_es/SwiperItem.js +1 -1
  80. package/dist/packages/_es/Switch.js +3 -3
  81. package/dist/packages/_es/TabPane.js +1 -1
  82. package/dist/packages/_es/Tabbar.js +3 -3
  83. package/dist/packages/_es/TabbarItem.js +17 -23
  84. package/dist/packages/_es/Table.js +13 -13
  85. package/dist/packages/_es/Tabs.js +21 -20
  86. package/dist/packages/_es/Tag.js +4 -4
  87. package/dist/packages/_es/TextArea.js +44 -42
  88. package/dist/packages/_es/TimeDetail.js +4 -3
  89. package/dist/packages/_es/TimePannel.js +3 -3
  90. package/dist/packages/_es/TimeSelect.js +8 -7
  91. package/dist/packages/_es/Toast.js +41 -170
  92. package/dist/packages/_es/Uploader.js +109 -138
  93. package/dist/packages/_es/Video.js +3 -3
  94. package/dist/packages/_es/common.js +1 -1
  95. package/dist/packages/_es/component.js +1 -1
  96. package/dist/packages/_es/index.js +44 -6
  97. package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
  98. package/dist/packages/_es/index2.js +1 -1
  99. package/dist/packages/_es/index3.js +56 -28
  100. package/dist/packages/_es/index4.js +413 -56
  101. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  102. package/dist/packages/_es/pxCheck.js +1 -1
  103. package/dist/packages/_es/use-lock-scroll.js +23 -0
  104. package/dist/packages/_es/util.js +1 -1
  105. package/dist/packages/uploader/index.scss +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/styles/themes/default.scss +61 -61
  108. package/dist/styles/themes/jdt.scss +61 -61
  109. package/package.json +1 -1
  110. package/dist/packages/_es/raf.js +0 -19
@@ -1,28 +1,9 @@
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.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { reactive, onMounted, watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, createVNode, createCommentVNode, toDisplayString, vShow, render } from "vue";
6
+ import { watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, createVNode, createCommentVNode, toDisplayString, vShow } from "vue";
26
7
  import { c as createComponent } from "./component.js";
27
8
  import _sfc_main$1 from "./Icon.js";
28
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
@@ -43,7 +24,10 @@ const _sfc_main = create({
43
24
  type: Boolean,
44
25
  default: true
45
26
  },
46
- type: String,
27
+ type: {
28
+ type: String,
29
+ default: "text"
30
+ },
47
31
  customClass: String,
48
32
  bottom: {
49
33
  type: String,
@@ -53,10 +37,6 @@ const _sfc_main = create({
53
37
  type: [String, Number],
54
38
  default: "base"
55
39
  },
56
- iconSize: {
57
- type: String,
58
- default: "20"
59
- },
60
40
  icon: String,
61
41
  textAlignCenter: {
62
42
  type: Boolean,
@@ -87,17 +67,15 @@ const _sfc_main = create({
87
67
  closeOnClickOverlay: {
88
68
  type: Boolean,
89
69
  default: false
70
+ },
71
+ visible: {
72
+ type: Boolean,
73
+ default: false
90
74
  }
91
75
  },
92
- emits: ["close"],
76
+ emits: ["update:visible", "closed"],
93
77
  setup(props, { emit }) {
94
78
  let timer;
95
- const state = reactive({
96
- mounted: false
97
- });
98
- onMounted(() => {
99
- state.mounted = true;
100
- });
101
79
  const clearTimer = () => {
102
80
  if (timer) {
103
81
  clearTimeout(timer);
@@ -105,7 +83,8 @@ const _sfc_main = create({
105
83
  }
106
84
  };
107
85
  const hide = () => {
108
- state.mounted = false;
86
+ emit("update:visible", false);
87
+ emit("closed");
109
88
  };
110
89
  const show = () => {
111
90
  clearTimer();
@@ -118,13 +97,9 @@ const _sfc_main = create({
118
97
  const clickCover = () => {
119
98
  if (props.closeOnClickOverlay) {
120
99
  hide();
121
- emit("close");
122
100
  }
123
101
  };
124
- if (props.duration) {
125
- show();
126
- }
127
- watch(() => props.duration, (val) => {
102
+ watch(() => props.visible, (val) => {
128
103
  if (val) {
129
104
  show();
130
105
  }
@@ -136,6 +111,18 @@ const _sfc_main = create({
136
111
  return !!props.icon;
137
112
  }
138
113
  });
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
+ });
139
126
  const toastBodyClass = computed(() => {
140
127
  return [
141
128
  "nut-toast",
@@ -148,15 +135,15 @@ const _sfc_main = create({
148
135
  ];
149
136
  });
150
137
  const onAfterLeave = () => {
151
- clearTimer();
152
- props.unmount(props.id);
153
- props.onClose && props.onClose();
138
+ if (props.visible) {
139
+ clearTimer();
140
+ hide();
141
+ }
154
142
  };
155
143
  return {
156
- state,
157
- hide,
158
144
  clickCover,
159
145
  hasIcon,
146
+ iconName,
160
147
  toastBodyClass,
161
148
  onAfterLeave
162
149
  };
@@ -186,7 +173,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
186
173
  }),
187
174
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
188
175
  }, [
189
- createElementVNode("view", {
176
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock("view", {
177
+ key: 1,
190
178
  class: "nut-toast-inner",
191
179
  style: normalizeStyle({
192
180
  "text-align": _ctx.textAlignCenter ? "center" : "left",
@@ -195,140 +183,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
195
183
  }, [
196
184
  _ctx.hasIcon ? (openBlock(), createElementBlock("view", _hoisted_1, [
197
185
  createVNode(_component_nut_icon, {
198
- size: _ctx.iconSize,
186
+ size: "20",
199
187
  color: "#ffffff",
200
- name: _ctx.icon
201
- }, null, 8, ["size", "name"])
188
+ name: _ctx.iconName
189
+ }, null, 8, ["name"])
202
190
  ])) : createCommentVNode("", true),
203
191
  _ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
204
192
  createElementVNode("view", {
205
193
  class: "nut-toast-text",
206
194
  innerHTML: _ctx.msg
207
195
  }, null, 8, _hoisted_3)
208
- ], 4)
196
+ ], 4))
209
197
  ], 6), [
210
- [vShow, _ctx.state.mounted]
198
+ [vShow, _ctx.visible]
211
199
  ])
212
200
  ]),
213
- _: 1
201
+ _: 3
214
202
  }, 8, ["onAfterLeave"]);
215
203
  }
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 };
204
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
205
+ export { index_taro as default };