@nutui/nutui 3.1.10 → 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 (109) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.d.ts +5 -1
  3. package/dist/nutui.es.js +4041 -3518
  4. package/dist/nutui.umd.js +4084 -3627
  5. package/dist/packages/_es/ActionSheet.js +13 -12
  6. package/dist/packages/_es/Address.js +63 -49
  7. package/dist/packages/_es/Avatar.js +4 -5
  8. package/dist/packages/_es/BackTop.js +72 -109
  9. package/dist/packages/_es/Badge.js +4 -5
  10. package/dist/packages/_es/Barrage.js +63 -57
  11. package/dist/packages/_es/Button.js +5 -6
  12. package/dist/packages/_es/Calendar.js +27 -18
  13. package/dist/packages/_es/Card.js +104 -0
  14. package/dist/packages/_es/Cell.js +5 -13
  15. package/dist/packages/_es/CellGroup.js +4 -5
  16. package/dist/packages/_es/Checkbox.js +3 -3
  17. package/dist/packages/_es/CheckboxGroup.js +9 -4
  18. package/dist/packages/_es/CircleProgress.js +142 -46
  19. package/dist/packages/_es/Col.js +4 -5
  20. package/dist/packages/_es/Collapse.js +35 -10
  21. package/dist/packages/_es/CollapseItem.js +80 -35
  22. package/dist/packages/_es/CountDown.js +7 -5
  23. package/dist/packages/_es/CountUp.js +34 -31
  24. package/dist/packages/_es/DatePicker.js +451 -219
  25. package/dist/packages/_es/Dialog.js +13 -87
  26. package/dist/packages/_es/Divider.js +5 -6
  27. package/dist/packages/_es/Drag.js +76 -50
  28. package/dist/packages/_es/Elevator.js +81 -52
  29. package/dist/packages/_es/FixedNav.js +8 -9
  30. package/dist/packages/_es/Form.js +137 -0
  31. package/dist/packages/_es/FormItem.js +109 -0
  32. package/dist/packages/_es/Icon.js +6 -40
  33. package/dist/packages/_es/ImagePreview.js +23 -21
  34. package/dist/packages/_es/InfiniteLoading.js +95 -109
  35. package/dist/packages/_es/Input.js +22 -21
  36. package/dist/packages/_es/InputNumber.js +24 -18
  37. package/dist/packages/_es/Layout.js +2 -2
  38. package/dist/packages/_es/Menu.js +89 -171
  39. package/dist/packages/_es/MenuItem.js +155 -18
  40. package/dist/packages/_es/Navbar.js +7 -7
  41. package/dist/packages/_es/NoticeBar.js +39 -26
  42. package/dist/packages/_es/Notify.js +30 -166
  43. package/dist/packages/_es/NumberKeyboard.js +10 -6
  44. package/dist/packages/_es/OverLay.js +22 -29
  45. package/dist/packages/_es/Pagination.js +8 -9
  46. package/dist/packages/_es/Picker.js +61 -447
  47. package/dist/packages/_es/Popover.js +146 -25
  48. package/dist/packages/_es/Popup.js +18 -39
  49. package/dist/packages/_es/Price.js +18 -7
  50. package/dist/packages/_es/Progress.js +23 -12
  51. package/dist/packages/_es/Radio.js +20 -7
  52. package/dist/packages/_es/RadioGroup.js +7 -3
  53. package/dist/packages/_es/Range.js +38 -59
  54. package/dist/packages/_es/Rate.js +16 -20
  55. package/dist/packages/_es/Row.js +4 -5
  56. package/dist/packages/_es/SearchBar.js +7 -5
  57. package/dist/packages/_es/ShortPassword.js +89 -59
  58. package/dist/packages/_es/Signature.js +70 -71
  59. package/dist/packages/_es/Sku.js +508 -0
  60. package/dist/packages/_es/Step.js +10 -8
  61. package/dist/packages/_es/Steps.js +2 -2
  62. package/dist/packages/_es/Swipe.js +42 -27
  63. package/dist/packages/_es/Swiper.js +17 -418
  64. package/dist/packages/_es/SwiperItem.js +14 -39
  65. package/dist/packages/_es/Switch.js +4 -5
  66. package/dist/packages/_es/TabPane.js +4 -5
  67. package/dist/packages/_es/Tabbar.js +4 -5
  68. package/dist/packages/_es/TabbarItem.js +8 -9
  69. package/dist/packages/_es/Tabs.js +23 -17
  70. package/dist/packages/_es/Tag.js +5 -6
  71. package/dist/packages/_es/TextArea.js +16 -12
  72. package/dist/packages/_es/TimeDetail.js +7 -5
  73. package/dist/packages/_es/TimePannel.js +7 -5
  74. package/dist/packages/_es/TimeSelect.js +12 -7
  75. package/dist/packages/_es/Toast.js +41 -163
  76. package/dist/packages/_es/Uploader.js +210 -164
  77. package/dist/packages/_es/commonProps.js +30 -0
  78. package/dist/packages/_es/component.js +1 -1
  79. package/dist/packages/_es/index.js +1 -1
  80. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  81. package/dist/packages/_es/index2.js +44 -8
  82. package/dist/packages/_es/index3.js +419 -0
  83. package/dist/packages/_es/pxCheck.js +1 -1
  84. package/dist/packages/_es/raf.js +1 -1
  85. package/dist/packages/_es/use-lock-scroll.js +23 -0
  86. package/dist/packages/_es/util.js +47 -0
  87. package/dist/packages/button/index.scss +9 -0
  88. package/dist/packages/card/index.scss +97 -0
  89. package/dist/packages/checkbox/index.scss +1 -1
  90. package/dist/packages/form/index.scss +2 -0
  91. package/dist/packages/formitem/index.scss +60 -0
  92. package/dist/packages/menu/index.scss +32 -60
  93. package/dist/packages/menuitem/index.scss +36 -99
  94. package/dist/packages/numberkeyboard/index.scss +1 -1
  95. package/dist/packages/progress/index.scss +2 -0
  96. package/dist/packages/radio/index.scss +32 -4
  97. package/dist/packages/radiogroup/index.scss +20 -0
  98. package/dist/packages/sku/index.scss +147 -0
  99. package/dist/packages/switch/index.scss +1 -1
  100. package/dist/packages/uploader/index.scss +95 -8
  101. package/dist/style.css +1 -1
  102. package/dist/style.es.js +1 -2
  103. package/dist/styles/mixins/index.scss +0 -4
  104. package/dist/styles/themes/default.scss +34 -30
  105. package/dist/styles/variables.scss +45 -3
  106. package/package.json +3 -2
  107. package/dist/packages/_es/Video.js +0 -405
  108. package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
  109. package/dist/packages/_es/style.css +0 -160
@@ -1,29 +1,166 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 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 { getCurrentInstance, openBlock, createElementBlock, renderSlot } from "vue";
6
+ import { reactive, computed, inject, getCurrentInstance, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createCommentVNode, 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
- var index_vue_vue_type_style_index_0_scoped_true_lang = "";
10
- const { create, componentName } = createComponent("menu-item");
11
- const _sfc_main = create({
12
- setup() {
13
- let pro = getCurrentInstance().proxy;
14
- pro.toggle = () => {
15
- pro.$parent.activeTitle = "";
16
- pro.$parent.isShowCustomer = false;
17
- pro.$parent.showMask = false;
18
- pro.$parent.nutMenuIndex = "auto";
8
+ import { _ as _sfc_main$1, a as _sfc_main$2 } from "./index3.js";
9
+ import "./use-lock-scroll.js";
10
+ import "./pxCheck.js";
11
+ const { componentName, create } = createComponent("menu-item");
12
+ var _sfc_main = create({
13
+ props: {
14
+ title: String,
15
+ options: {
16
+ type: Array,
17
+ default: []
18
+ },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ modelValue: null,
24
+ cols: {
25
+ type: Number,
26
+ default: 1
27
+ },
28
+ titleIcon: {
29
+ type: String,
30
+ default: "down-arrow"
31
+ }
32
+ },
33
+ components: {
34
+ [_sfc_main$1.name]: _sfc_main$1,
35
+ [_sfc_main$2.name]: _sfc_main$2
36
+ },
37
+ emits: ["update:modelValue", "change"],
38
+ setup(props, { emit, slots }) {
39
+ const state = reactive({
40
+ showPopup: false,
41
+ transition: true,
42
+ showWrapper: false,
43
+ isShowPlaceholderElement: false
44
+ });
45
+ const useParent = () => {
46
+ const parent2 = inject("menuParent", null);
47
+ if (parent2) {
48
+ const instance = getCurrentInstance();
49
+ const { link } = parent2;
50
+ link(instance);
51
+ return {
52
+ parent: parent2
53
+ };
54
+ }
55
+ };
56
+ const { parent } = useParent();
57
+ const classes = computed(() => {
58
+ const prefixCls = componentName;
59
+ return {
60
+ [prefixCls]: true
61
+ };
62
+ });
63
+ const toggle = (show = !state.showPopup, options = {}) => {
64
+ if (show === state.showPopup) {
65
+ return;
66
+ }
67
+ state.showPopup = show;
68
+ state.isShowPlaceholderElement = show;
69
+ if (show) {
70
+ state.showWrapper = true;
71
+ }
72
+ };
73
+ const renderTitle = () => {
74
+ var _a;
75
+ if (props.title) {
76
+ return props.title;
77
+ }
78
+ const match = (_a = props.options) == null ? void 0 : _a.find((option) => option.value === props.modelValue);
79
+ return match ? match.text : "";
80
+ };
81
+ const onClick = (option) => {
82
+ state.showPopup = false;
83
+ state.isShowPlaceholderElement = false;
84
+ if (option.value !== props.modelValue) {
85
+ emit("update:modelValue", option.value);
86
+ emit("change", option.value);
87
+ }
88
+ };
89
+ const handleClose = () => {
90
+ state.showWrapper = false;
91
+ state.isShowPlaceholderElement = false;
92
+ };
93
+ const handleClickOutside = () => {
94
+ state.showPopup = false;
95
+ };
96
+ return {
97
+ classes,
98
+ renderTitle,
99
+ state,
100
+ parent,
101
+ toggle,
102
+ onClick,
103
+ handleClose,
104
+ handleClickOutside
19
105
  };
20
- return {};
21
106
  }
22
107
  });
108
+ const _hoisted_1 = { class: "nut-menu-item__content" };
109
+ const _hoisted_2 = ["onClick"];
23
110
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
24
- return openBlock(), createElementBlock("div", null, [
25
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
111
+ const _component_nut_icon = resolveComponent("nut-icon");
112
+ const _component_nut_popup = resolveComponent("nut-popup");
113
+ return withDirectives((openBlock(), createElementBlock("view", {
114
+ class: normalizeClass(_ctx.classes)
115
+ }, [
116
+ withDirectives(createElementVNode("div", {
117
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
118
+ class: "placeholder-element",
119
+ style: normalizeStyle({ height: _ctx.parent.offset.value + "px" })
120
+ }, null, 4), [
121
+ [vShow, _ctx.state.isShowPlaceholderElement]
122
+ ]),
123
+ createVNode(_component_nut_popup, mergeProps({
124
+ style: { top: _ctx.parent.offset.value + "px" },
125
+ overlayStyle: { top: _ctx.parent.offset.value + "px" }
126
+ }, _ctx.$attrs, {
127
+ visible: _ctx.state.showPopup,
128
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.state.showPopup = $event),
129
+ position: "top",
130
+ duration: _ctx.parent.props.duration,
131
+ "pop-class": "nut-menu__pop",
132
+ overlayClass: "nut-menu__overlay",
133
+ overlay: _ctx.parent.props.overlay,
134
+ onClosed: _ctx.handleClose,
135
+ isWrapTeleport: false
136
+ }), {
137
+ default: withCtx(() => [
138
+ createElementVNode("view", _hoisted_1, [
139
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
140
+ return openBlock(), createElementBlock("view", {
141
+ key: index,
142
+ class: normalizeClass(["nut-menu-item__option", { active: option.value === _ctx.modelValue }]),
143
+ style: normalizeStyle({ "flex-basis": 100 / _ctx.cols + "%" }),
144
+ onClick: ($event) => _ctx.onClick(option)
145
+ }, [
146
+ option.value === _ctx.modelValue ? (openBlock(), createBlock(_component_nut_icon, {
147
+ key: 0,
148
+ name: "Check",
149
+ color: _ctx.parent.props.activeColor
150
+ }, null, 8, ["color"])) : createCommentVNode("", true),
151
+ createElementVNode("view", {
152
+ style: normalizeStyle({ color: option.value === _ctx.modelValue ? _ctx.parent.props.activeColor : "" })
153
+ }, toDisplayString(option.text), 5)
154
+ ], 14, _hoisted_2);
155
+ }), 128)),
156
+ renderSlot(_ctx.$slots, "default")
157
+ ])
158
+ ]),
159
+ _: 3
160
+ }, 16, ["style", "overlayStyle", "visible", "duration", "overlay", "onClosed"])
161
+ ], 2)), [
162
+ [vShow, _ctx.state.showWrapper]
26
163
  ]);
27
164
  }
28
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-02edb907"]]);
29
- export { index as default };
165
+ _sfc_main.render = _sfc_render;
166
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 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 { ref, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, toDisplayString, Fragment, renderList, normalizeStyle, 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("navbar");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  leftShow: { type: Boolean, default: true },
13
12
  title: { type: String, default: "" },
@@ -109,6 +108,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
109
108
  }, [
110
109
  _ctx.title ? (openBlock(), createElementBlock("view", {
111
110
  key: 0,
111
+ class: "text__title",
112
112
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCenter && _ctx.handleCenter(...args))
113
113
  }, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
114
114
  _ctx.titIcon ? (openBlock(), createBlock(_component_nut_icon, {
@@ -118,11 +118,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
118
118
  onClick: _ctx.handleCenterIcon
119
119
  }, null, 8, ["name", "onClick"])) : createCommentVNode("", true),
120
120
  createElementVNode("view", _hoisted_2, [
121
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabs, (item, index2) => {
121
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabs, (item, index) => {
122
122
  return openBlock(), createElementBlock("view", {
123
123
  class: normalizeClass([
124
124
  "tab-title-box",
125
- { "nut-tab-active": _ctx.activeIndex == item.id || _ctx.activeIndex == index2 }
125
+ { "nut-tab-active": _ctx.activeIndex == item.id || _ctx.activeIndex == index }
126
126
  ]),
127
127
  onClick: ($event) => _ctx.switchTitle(item.id, item.name),
128
128
  key: item.id
@@ -156,5 +156,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
156
156
  ], 2)) : createCommentVNode("", true)
157
157
  ], 2);
158
158
  }
159
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
160
- export { index as default };
159
+ _sfc_main.render = _sfc_render;
160
+ export { _sfc_main as default };
@@ -17,16 +17,19 @@ 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.10 Fri Nov 05 2021 19:52:49 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 { h, ref, reactive, computed, watch, onMounted, onActivated, onDeactivated, onUnmounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, withDirectives, normalizeStyle, createBlock, createCommentVNode, createElementVNode, renderSlot, createTextVNode, toDisplayString, withModifiers, createVNode, vShow, Fragment, renderList } from "vue";
26
29
  import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
+ import Taro from "@tarojs/taro";
28
31
  const { componentName, create } = createComponent("noticebar");
29
- const _sfc_main = create({
32
+ var _sfc_main = create({
30
33
  props: {
31
34
  direction: {
32
35
  type: String,
@@ -65,11 +68,11 @@ const _sfc_main = create({
65
68
  leftIcon: { type: String, default: "" },
66
69
  color: {
67
70
  type: String,
68
- default: ""
71
+ default: "#F9911B"
69
72
  },
70
73
  background: {
71
74
  type: String,
72
- default: ""
75
+ default: "rgba(254,250,216,1)"
73
76
  },
74
77
  delay: {
75
78
  type: [String, Number],
@@ -122,9 +125,10 @@ const _sfc_main = create({
122
125
  }
123
126
  });
124
127
  const barStyle = computed(() => {
125
- let style = {};
126
- props.color && (style.color = props.color);
127
- props.background && (style.background = props.background);
128
+ let style = {
129
+ color: props.color,
130
+ background: props.background
131
+ };
128
132
  if (props.direction == "vertical") {
129
133
  style.height = `${props.height}px`;
130
134
  }
@@ -174,17 +178,25 @@ const _sfc_main = create({
174
178
  if (!wrap.value || !content.value) {
175
179
  return;
176
180
  }
177
- const wrapWidth = wrap.value.getBoundingClientRect().width;
178
- const offsetWidth = content.value.getBoundingClientRect().width;
179
- if (props.scrollable && offsetWidth > wrapWidth) {
180
- state.wrapWidth = wrapWidth;
181
- state.offsetWidth = offsetWidth;
182
- state.duration = offsetWidth / props.speed;
183
- state.animationClass = "play";
184
- } else {
185
- state.animationClass = "";
186
- }
187
- });
181
+ let wrapWidth = 0;
182
+ let offsetWidth = 0;
183
+ Taro.createSelectorQuery().select(".wrap").boundingClientRect((rect) => {
184
+ if (rect.width > 0)
185
+ wrapWidth = rect.width;
186
+ }).exec();
187
+ Taro.createSelectorQuery().select(`.content`).boundingClientRect((rect) => {
188
+ if (rect.width > 0)
189
+ offsetWidth = rect.width;
190
+ if (props.scrollable && offsetWidth > wrapWidth) {
191
+ state.wrapWidth = wrapWidth;
192
+ state.offsetWidth = offsetWidth;
193
+ state.duration = offsetWidth / props.speed;
194
+ state.animationClass = "play";
195
+ } else {
196
+ state.animationClass = "";
197
+ }
198
+ }).exec();
199
+ }, 100);
188
200
  };
189
201
  const handleClick = (event) => {
190
202
  emit("click", event);
@@ -323,7 +335,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
323
335
  onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
324
336
  }, [
325
337
  renderSlot(_ctx.$slots, "default", {}, () => [
326
- createTextVNode("1" + toDisplayString(_ctx.text), 1)
338
+ createTextVNode(toDisplayString(_ctx.text), 1)
327
339
  ])
328
340
  ], 38)
329
341
  ], 512),
@@ -334,6 +346,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
334
346
  }, [
335
347
  createVNode(_component_nut_icon, {
336
348
  name: "close",
349
+ size: "11",
337
350
  color: _ctx.color
338
351
  }, null, 8, ["color"])
339
352
  ])) : createCommentVNode("", true)
@@ -350,9 +363,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
350
363
  class: "horseLamp_list",
351
364
  style: normalizeStyle(_ctx.horseLampStyle)
352
365
  }, [
353
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
366
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index) => {
354
367
  return openBlock(), createBlock(_component_ScrollItem, {
355
- key: index2,
368
+ key: index,
356
369
  style: normalizeStyle({ height: _ctx.height + "px", "line-height": _ctx.height + "px" }),
357
370
  item
358
371
  }, null, 8, ["style", "item"]);
@@ -362,10 +375,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
362
375
  class: "horseLamp_list",
363
376
  style: normalizeStyle(_ctx.horseLampStyle)
364
377
  }, [
365
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
378
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index) => {
366
379
  return openBlock(), createElementBlock("li", {
367
380
  class: "horseLamp_list_item",
368
- key: index2,
381
+ key: index,
369
382
  style: normalizeStyle({ height: _ctx.height }),
370
383
  onClick: ($event) => _ctx.go(item)
371
384
  }, toDisplayString(item), 13, _hoisted_2);
@@ -385,5 +398,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
385
398
  ], 4)) : createCommentVNode("", true)
386
399
  ], 2);
387
400
  }
388
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
389
- export { index as default };
401
+ _sfc_main.render = _sfc_render;
402
+ export { _sfc_main as default };
@@ -1,38 +1,19 @@
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.10 Fri Nov 05 2021 19:52:49 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, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow, createVNode, render } from "vue";
6
+ import { watch, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow } from "vue";
26
7
  import { c as createComponent } from "./component.js";
27
- import Popup from "./Popup.js";
28
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
8
+ import _sfc_main$1 from "./Popup.js";
9
+ import "./use-lock-scroll.js";
29
10
  import "./OverLay.js";
30
- import "./Icon.js";
11
+ import "./index.taro.vue_vue&type=script&lang.js";
31
12
  import "./pxCheck.js";
32
13
  const { componentName, create } = createComponent("notify");
33
- const _sfc_main = create({
14
+ var _sfc_main = create({
34
15
  components: {
35
- [Popup.name]: Popup
16
+ [_sfc_main$1.name]: _sfc_main$1
36
17
  },
37
18
  props: {
38
19
  id: String,
@@ -48,24 +29,16 @@ const _sfc_main = create({
48
29
  type: String,
49
30
  default: "danger"
50
31
  },
51
- showPopup: {
32
+ visible: {
52
33
  type: Boolean,
53
34
  default: false
54
- },
55
- onClose: Function,
56
- onClick: Function,
57
- unmount: Function
35
+ }
58
36
  },
59
- setup(props, { slots }) {
37
+ emits: ["update:visible", "closed", "click"],
38
+ setup(props, { emit }) {
60
39
  let timer = null;
61
- const state = reactive({
62
- mounted: false
63
- });
64
- onMounted(() => {
65
- state.mounted = true;
66
- });
67
- const clickCover = () => {
68
- props.onClick && props.onClick();
40
+ const onClick = () => {
41
+ emit("click");
69
42
  };
70
43
  const clearTimer = () => {
71
44
  if (timer) {
@@ -74,8 +47,14 @@ const _sfc_main = create({
74
47
  }
75
48
  };
76
49
  const hide = () => {
77
- state.mounted = false;
50
+ emit("update:visible", false);
51
+ emit("closed");
78
52
  };
53
+ watch(() => props.visible, (value) => {
54
+ if (value) {
55
+ show();
56
+ }
57
+ });
79
58
  const show = () => {
80
59
  clearTimer();
81
60
  if (props.duration) {
@@ -84,150 +63,35 @@ const _sfc_main = create({
84
63
  }, props.duration);
85
64
  }
86
65
  };
87
- if (props.duration) {
88
- show();
89
- }
90
- watch(() => props.duration, (val) => {
91
- if (val) {
92
- show();
93
- }
94
- });
95
66
  const onAfterLeave = () => {
96
- clearTimer();
97
- props.unmount && props.unmount(props.id);
98
- props.onClose && props.onClose();
67
+ if (props.visible) {
68
+ clearTimer();
69
+ hide();
70
+ }
99
71
  };
100
- return { state, hide, onAfterLeave, clickCover };
72
+ return { hide, onAfterLeave, onClick };
101
73
  }
102
74
  });
103
75
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
104
76
  return openBlock(), createBlock(Transition, {
105
- name: "toast-fade",
77
+ name: "nut-fade",
106
78
  onAfterLeave: _ctx.onAfterLeave
107
79
  }, {
108
80
  default: withCtx(() => [
109
81
  withDirectives(createElementVNode("view", {
110
82
  class: normalizeClass(["popup-top", "nut-notify", `nut-notify--${_ctx.type}`, { className: _ctx.className }]),
111
83
  style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
112
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
84
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
113
85
  }, [
114
86
  _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
115
87
  createTextVNode(toDisplayString(_ctx.msg), 1)
116
88
  ], 64))
117
89
  ], 6), [
118
- [vShow, _ctx.state.mounted]
90
+ [vShow, _ctx.visible]
119
91
  ])
120
92
  ]),
121
93
  _: 3
122
94
  }, 8, ["onAfterLeave"]);
123
95
  }
124
- var Notify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
125
- const defaultOptions = {
126
- type: "base",
127
- showPopup: false,
128
- msg: "",
129
- color: void 0,
130
- background: void 0,
131
- duration: 3e3,
132
- className: "",
133
- onClosed: null,
134
- onClick: null,
135
- onOpened: null,
136
- textTimer: null,
137
- unmount: null
138
- };
139
- let idsMap = [];
140
- let optsMap = [];
141
- const clearNotify = (id) => {
142
- if (id) {
143
- const container = document.getElementById(id);
144
- optsMap = optsMap.filter((item) => item.id !== id);
145
- idsMap = idsMap.filter((item) => item !== id);
146
- if (container) {
147
- document.body.removeChild(container);
148
- }
149
- } else {
150
- idsMap.forEach((item) => {
151
- const container = document.getElementById(item);
152
- if (container) {
153
- document.body.removeChild(container);
154
- }
155
- });
156
- optsMap = [];
157
- idsMap = [];
158
- }
159
- };
160
- const updateNotify = (opts) => {
161
- const container = document.getElementById(opts.id);
162
- if (container) {
163
- const currentOpt = optsMap.find((item) => item.id === opts.id);
164
- if (currentOpt) {
165
- opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
166
- } else {
167
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
168
- }
169
- const instance = createVNode(Notify, opts);
170
- render(instance, container);
171
- return instance.component.ctx;
172
- }
173
- };
174
- const mountNotify = (opts) => {
175
- opts.unmount = clearNotify;
176
- let _id;
177
- if (opts.id) {
178
- _id = opts.id;
179
- if (idsMap.find((item) => item === opts.id)) {
180
- return updateNotify(opts);
181
- }
182
- } else {
183
- _id = new Date().getTime() + "";
184
- }
185
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
186
- opts.id = _id;
187
- idsMap.push(opts.id);
188
- optsMap.push(opts);
189
- const container = document.createElement("view");
190
- container.id = opts.id;
191
- const instance = createVNode(Notify, opts);
192
- render(instance, container);
193
- document.body.appendChild(container);
194
- setTimeout(() => {
195
- instance.showPopup = true;
196
- }, 0);
197
- return instance.component.ctx;
198
- };
199
- const errorMsg = (msg) => {
200
- if (!msg) {
201
- console.warn("[NutUI Notify]: msg\u4E0D\u80FD\u4E3A\u7A7A");
202
- return;
203
- }
204
- };
205
- const NotifyFunction = {
206
- text(msg, obj = {}) {
207
- errorMsg(msg);
208
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg }));
209
- },
210
- primary(msg, obj = {}) {
211
- errorMsg(msg);
212
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "primary" }));
213
- },
214
- success(msg, obj = {}) {
215
- errorMsg(msg);
216
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "success" }));
217
- },
218
- danger(msg, obj = {}) {
219
- errorMsg(msg);
220
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "danger" }));
221
- },
222
- warn(msg, obj = {}) {
223
- errorMsg(msg);
224
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "warning" }));
225
- },
226
- hide() {
227
- clearNotify();
228
- },
229
- install(app) {
230
- app.config.globalProperties.$notify = NotifyFunction;
231
- }
232
- };
233
- export { Notify, NotifyFunction, NotifyFunction as default };
96
+ _sfc_main.render = _sfc_render;
97
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 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 { ref, computed, watch, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createTextVNode } 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 { create } = createComponent("numberkeyboard");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  title: {
13
12
  type: String,
@@ -36,6 +35,10 @@ const _sfc_main = create({
36
35
  randomKeys: {
37
36
  type: Boolean,
38
37
  default: false
38
+ },
39
+ overlay: {
40
+ type: Boolean,
41
+ default: true
39
42
  }
40
43
  },
41
44
  emits: ["input", "delete", "close", "update:value"],
@@ -171,6 +174,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
171
174
  visible: _ctx.show,
172
175
  "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
173
176
  position: "bottom",
177
+ overlay: _ctx.overlay,
174
178
  onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
175
179
  "overlay-class": "nut-numberkeyboard-overlay"
176
180
  }, {
@@ -242,7 +246,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
242
246
  ], 512)
243
247
  ]),
244
248
  _: 1
245
- }, 8, ["visible"]);
249
+ }, 8, ["visible", "overlay"]);
246
250
  }
247
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
248
- export { index as default };
251
+ _sfc_main.render = _sfc_render;
252
+ export { _sfc_main as default };