@nutui/nutui 3.1.10-beta.3 → 3.1.12-beta.0

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 (96) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/nutui.d.ts +2 -1
  3. package/dist/nutui.es.js +1642 -926
  4. package/dist/nutui.umd.js +1648 -931
  5. package/dist/packages/_es/ActionSheet.js +1 -1
  6. package/dist/packages/_es/Address.js +1 -1
  7. package/dist/packages/_es/Avatar.js +1 -1
  8. package/dist/packages/_es/BackTop.js +1 -1
  9. package/dist/packages/_es/Badge.js +1 -1
  10. package/dist/packages/_es/Barrage.js +1 -1
  11. package/dist/packages/_es/Button.js +1 -1
  12. package/dist/packages/_es/Calendar.js +1 -1
  13. package/dist/packages/_es/Cell.js +1 -1
  14. package/dist/packages/_es/CellGroup.js +1 -1
  15. package/dist/packages/_es/Checkbox.js +1 -1
  16. package/dist/packages/_es/CheckboxGroup.js +2 -2
  17. package/dist/packages/_es/CircleProgress.js +1 -1
  18. package/dist/packages/_es/Col.js +1 -1
  19. package/dist/packages/_es/Collapse.js +1 -1
  20. package/dist/packages/_es/CollapseItem.js +1 -1
  21. package/dist/packages/_es/CountDown.js +1 -1
  22. package/dist/packages/_es/CountUp.js +1 -1
  23. package/dist/packages/_es/DatePicker.js +1 -1
  24. package/dist/packages/_es/Dialog.js +3 -12
  25. package/dist/packages/_es/Divider.js +1 -1
  26. package/dist/packages/_es/Drag.js +1 -1
  27. package/dist/packages/_es/Elevator.js +1 -1
  28. package/dist/packages/_es/FixedNav.js +1 -1
  29. package/dist/packages/_es/Icon.js +1 -1
  30. package/dist/packages/_es/ImagePreview.js +3 -2
  31. package/dist/packages/_es/InfiniteLoading.js +1 -1
  32. package/dist/packages/_es/Input.js +1 -1
  33. package/dist/packages/_es/InputNumber.js +1 -1
  34. package/dist/packages/_es/Layout.js +1 -1
  35. package/dist/packages/_es/Menu.js +83 -167
  36. package/dist/packages/_es/MenuItem.js +154 -15
  37. package/dist/packages/_es/Navbar.js +1 -1
  38. package/dist/packages/_es/NoticeBar.js +1 -1
  39. package/dist/packages/_es/Notify.js +1 -1
  40. package/dist/packages/_es/NumberKeyboard.js +1 -1
  41. package/dist/packages/_es/OverLay.js +1 -1
  42. package/dist/packages/_es/Pagination.js +1 -1
  43. package/dist/packages/_es/Picker.js +1 -1
  44. package/dist/packages/_es/Popover.js +1 -1
  45. package/dist/packages/_es/Popup.js +52 -13
  46. package/dist/packages/_es/Price.js +1 -1
  47. package/dist/packages/_es/Progress.js +1 -1
  48. package/dist/packages/_es/Radio.js +18 -5
  49. package/dist/packages/_es/RadioGroup.js +6 -2
  50. package/dist/packages/_es/Range.js +3 -31
  51. package/dist/packages/_es/Rate.js +1 -1
  52. package/dist/packages/_es/Row.js +1 -1
  53. package/dist/packages/_es/SearchBar.js +52 -49
  54. package/dist/packages/_es/ShortPassword.js +1 -1
  55. package/dist/packages/_es/Signature.js +1 -1
  56. package/dist/packages/_es/Sku.js +533 -0
  57. package/dist/packages/_es/Step.js +1 -1
  58. package/dist/packages/_es/Steps.js +1 -1
  59. package/dist/packages/_es/Swipe.js +1 -1
  60. package/dist/packages/_es/Swiper.js +2 -2
  61. package/dist/packages/_es/SwiperItem.js +1 -1
  62. package/dist/packages/_es/Switch.js +1 -1
  63. package/dist/packages/_es/TabPane.js +1 -1
  64. package/dist/packages/_es/Tabbar.js +1 -1
  65. package/dist/packages/_es/TabbarItem.js +1 -1
  66. package/dist/packages/_es/Tabs.js +2 -2
  67. package/dist/packages/_es/Tag.js +1 -1
  68. package/dist/packages/_es/TextArea.js +1 -1
  69. package/dist/packages/_es/TimeDetail.js +1 -1
  70. package/dist/packages/_es/TimePannel.js +1 -1
  71. package/dist/packages/_es/TimeSelect.js +1 -1
  72. package/dist/packages/_es/Toast.js +3 -3
  73. package/dist/packages/_es/Uploader.js +159 -73
  74. package/dist/packages/_es/Video.js +1 -1
  75. package/dist/packages/_es/component.js +1 -1
  76. package/dist/packages/_es/index.js +1 -1
  77. package/dist/packages/_es/index2.js +31 -8
  78. package/dist/packages/_es/index3.js +13 -0
  79. package/dist/packages/_es/plugin-vue_export-helper.js +4 -3
  80. package/dist/packages/_es/pxCheck.js +1 -1
  81. package/dist/packages/_es/raf.js +1 -1
  82. package/dist/packages/button/index.scss +3 -0
  83. package/dist/packages/menu/index.scss +32 -60
  84. package/dist/packages/menuitem/index.scss +36 -99
  85. package/dist/packages/progress/index.scss +2 -0
  86. package/dist/packages/radio/index.scss +32 -4
  87. package/dist/packages/radiogroup/index.scss +20 -0
  88. package/dist/packages/searchbar/index.scss +25 -29
  89. package/dist/packages/sku/index.scss +147 -0
  90. package/dist/packages/uploader/index.scss +95 -8
  91. package/dist/style.css +1 -1
  92. package/dist/styles/mixins/index.scss +0 -4
  93. package/dist/styles/themes/default.scss +31 -30
  94. package/dist/styles/variables.scss +40 -3
  95. package/package.json +2 -1
  96. package/dist/packages/_es/style.css +0 -160
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
19
19
  * (c) 2021 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
19
19
  * (c) 2021 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, provide, computed, watch, h } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { u as useExpose } from "./index2.js";
8
+ import { u as useExpose } from "./index3.js";
9
9
  const { create, componentName } = createComponent("checkboxgroup");
10
10
  const _sfc_main = create({
11
11
  props: {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -22,7 +22,7 @@ var __publicField = (obj, key, value) => {
22
22
  return value;
23
23
  };
24
24
  /*!
25
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
25
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
26
26
  * (c) 2021 @jdf2e.
27
27
  * Released under the MIT License.
28
28
  */
@@ -107,16 +107,7 @@ const _sfc_main = create({
107
107
  default: false
108
108
  }
109
109
  }),
110
- emits: [
111
- "update",
112
- "update:visible",
113
- "ok",
114
- "cancel",
115
- "open",
116
- "opened",
117
- "close",
118
- "closed"
119
- ],
110
+ emits: ["update", "update:visible", "ok", "cancel", "open", "opened", "close", "closed"],
120
111
  setup(props, { emit }) {
121
112
  const showPopup = ref(props.visible);
122
113
  onMounted(() => {
@@ -149,8 +140,8 @@ const _sfc_main = create({
149
140
  }
150
141
  };
151
142
  const onOk = () => {
152
- closed();
153
143
  emit("ok");
144
+ closed();
154
145
  };
155
146
  return {
156
147
  closed,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -88,7 +88,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
88
88
  class: "nut-imagepreview-swiper",
89
89
  loop: true,
90
90
  direction: "horizontal",
91
- onChange: _ctx.slideChangeEnd
91
+ onChange: _ctx.slideChangeEnd,
92
+ "is-preventDefault": false
92
93
  }, {
93
94
  default: withCtx(() => [
94
95
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item, index2) => {
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,203 +1,119 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10-beta.3 Fri Nov 05 2021 14:31:48 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive, ref, computed, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createTextVNode, toDisplayString, createBlock, withDirectives, createCommentVNode, vShow, renderSlot } from "vue";
6
+ import { ref, computed, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, createVNode, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import _sfc_main$1 from "./Icon.js";
8
+ import { u as useRect } from "./index2.js";
9
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
- import "./pxCheck.js";
11
- var index_vue_vue_type_style_index_0_lang = "";
12
10
  const { componentName, create } = createComponent("menu");
13
11
  const _sfc_main = create({
14
- components: {
15
- [_sfc_main$1.name]: _sfc_main$1
16
- },
17
12
  props: {
18
- col: {
19
- type: [String, Number],
20
- default: 1
21
- },
22
13
  activeColor: {
23
14
  type: String,
24
- default: "#f00"
15
+ default: "#FA2C19"
16
+ },
17
+ overlay: {
18
+ type: Boolean,
19
+ default: true
20
+ },
21
+ duration: {
22
+ type: [Number, String],
23
+ default: 0
25
24
  }
26
25
  },
27
- emits: ["choose"],
28
- setup(props, { slots, emit }) {
29
- const menuList = reactive([]);
30
- let activeTitle = ref("");
31
- let showMask = ref(false);
32
- let styleObj = reactive({
33
- flexBasis: 100 / Number(props.col) + "%"
34
- });
35
- let nutMenuIndex = ref("auto");
36
- let hasOptions = ref(true);
37
- let isShowCustomer = ref(false);
38
- if (slots.default) {
39
- for (let i = 0; i < slots.default().length; i++) {
40
- if (slots.default()[i].type["name"] === "nut-menu-item") {
41
- let item = {
42
- title: slots.default()[i].props["title"],
43
- disabled: !!slots.default()[i].props["disabled"]
44
- };
45
- if (slots.default()[i].props["options"]) {
46
- item["options"] = slots.default()[i].props["options"];
47
- } else {
48
- hasOptions.value = false;
26
+ setup(props, { emit, slots }) {
27
+ const barRef = ref();
28
+ const offset = ref(0);
29
+ const useChildren = () => {
30
+ const publicChildren = reactive([]);
31
+ const internalChildren = reactive([]);
32
+ const linkChildren2 = (value) => {
33
+ const link = (child) => {
34
+ if (child.proxy) {
35
+ internalChildren.push(child);
36
+ publicChildren.push(child.proxy);
49
37
  }
50
- menuList.push(item);
51
- }
52
- }
53
- }
54
- const handleClickTitle = (title, index2) => {
55
- if (!hasOptions.value) {
56
- if (activeTitle.value) {
57
- activeTitle.value = "";
58
- isShowCustomer.value = false;
59
- showMask.value = false;
60
- nutMenuIndex.value = "auto";
61
- } else {
62
- activeTitle.value = title;
63
- isShowCustomer.value = true;
64
- showMask.value = true;
65
- nutMenuIndex.value = 2001;
66
- }
67
- return;
68
- }
69
- if (menuList.length > 1) {
70
- if (activeTitle.value === title) {
71
- activeTitle.value = "";
72
- nutMenuIndex.value = "auto";
73
- showMask.value = false;
74
- } else {
75
- activeTitle.value = title;
76
- nutMenuIndex.value = 2001;
77
- showMask.value = true;
78
- }
79
- } else {
80
- if (activeTitle.value) {
81
- activeTitle.value = "";
82
- nutMenuIndex.value = "auto";
83
- showMask.value = false;
84
- } else {
85
- activeTitle.value = title;
86
- nutMenuIndex.value = 2001;
87
- showMask.value = true;
88
- }
89
- }
90
- };
91
- const handleClickOption = (text, index2, value) => {
92
- menuList[index2].title = text;
93
- activeTitle.value = "";
94
- showMask.value = false;
95
- nutMenuIndex.value = "auto";
96
- emit("choose", text, value);
38
+ };
39
+ provide("menuParent", Object.assign({
40
+ link,
41
+ children: publicChildren,
42
+ internalChildren
43
+ }, value));
44
+ };
45
+ return {
46
+ children: publicChildren,
47
+ linkChildren: linkChildren2
48
+ };
97
49
  };
50
+ const { children, linkChildren } = useChildren();
51
+ const opened = computed(() => children.some((item) => item.state.showWrapper));
98
52
  const classes = computed(() => {
99
53
  const prefixCls = componentName;
100
54
  return {
101
55
  [prefixCls]: true
102
56
  };
103
57
  });
104
- const handleClose = () => {
105
- activeTitle.value = "";
106
- nutMenuIndex.value = "auto";
107
- if (isShowCustomer.value) {
108
- isShowCustomer.value = false;
58
+ const updateOffset = () => {
59
+ if (barRef.value) {
60
+ const rect = useRect(barRef);
61
+ offset.value = rect.bottom;
109
62
  }
110
63
  };
64
+ linkChildren({ props, offset });
65
+ const toggleItem = (active) => {
66
+ children.forEach((item, index2) => {
67
+ if (index2 === active) {
68
+ updateOffset();
69
+ item.toggle();
70
+ } else if (item.state.showPopup) {
71
+ item.toggle(false, { immediate: true });
72
+ }
73
+ });
74
+ };
111
75
  return {
112
- menuList,
113
- activeTitle,
76
+ toggleItem,
77
+ children,
78
+ opened,
114
79
  classes,
115
- showMask,
116
- styleObj,
117
- nutMenuIndex,
118
- hasOptions,
119
- isShowCustomer,
120
- handleClickTitle,
121
- handleClickOption,
122
- handleClose
80
+ barRef
123
81
  };
124
82
  }
125
83
  });
126
- const _hoisted_1 = { class: "title-list" };
127
- const _hoisted_2 = ["onClick"];
128
- const _hoisted_3 = ["onClick"];
129
- const _hoisted_4 = { class: "customer-item" };
84
+ const _hoisted_1 = ["onClick"];
85
+ const _hoisted_2 = { class: "nut-menu__title-text" };
130
86
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
131
- const _component_nut_popup = resolveComponent("nut-popup");
132
87
  const _component_nut_icon = resolveComponent("nut-icon");
133
- return openBlock(), createElementBlock("view", null, [
134
- createVNode(_component_nut_popup, mergeProps(_ctx.$attrs, {
135
- visible: _ctx.showMask,
136
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.showMask = $event),
137
- onClose: _ctx.handleClose
138
- }), null, 16, ["visible", "onClose"]),
139
- createElementVNode("div", {
140
- class: normalizeClass(_ctx.classes),
141
- style: normalizeStyle({ "z-index": _ctx.nutMenuIndex })
88
+ return openBlock(), createElementBlock("view", {
89
+ class: normalizeClass(_ctx.classes)
90
+ }, [
91
+ createElementVNode("view", {
92
+ class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
93
+ ref: "barRef"
142
94
  }, [
143
- createElementVNode("div", _hoisted_1, [
144
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuList, (menu, index2) => {
145
- return openBlock(), createElementBlock("div", {
146
- key: index2,
147
- class: normalizeClass(["title", {
148
- "is-active": _ctx.activeTitle === menu.title,
149
- disabled: menu.disabled
150
- }]),
151
- onClick: ($event) => !menu.disabled && _ctx.handleClickTitle(menu.title, index2)
152
- }, [
153
- createTextVNode(toDisplayString(menu.title) + " ", 1),
154
- _ctx.activeTitle === menu.title ? (openBlock(), createBlock(_component_nut_icon, {
155
- key: 0,
156
- size: "10",
157
- color: "#333",
158
- name: "arrow-up"
159
- })) : (openBlock(), createBlock(_component_nut_icon, {
160
- key: 1,
161
- size: "10",
162
- color: "#999",
163
- name: "arrow-down"
164
- }))
165
- ], 10, _hoisted_2);
166
- }), 128))
167
- ]),
168
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuList, (menu, index2) => {
169
- return withDirectives((openBlock(), createElementBlock("div", {
95
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
96
+ return openBlock(), createElementBlock("view", {
170
97
  key: index2,
171
- class: "option-list"
98
+ class: normalizeClass(["nut-menu__item", { disabled: item.disabled }]),
99
+ onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
100
+ style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
172
101
  }, [
173
- createElementVNode("ul", null, [
174
- (openBlock(true), createElementBlock(Fragment, null, renderList(menu.options, (option, index22) => {
175
- return openBlock(), createElementBlock("li", {
176
- key: index22,
177
- onClick: ($event) => _ctx.handleClickOption(option.text, index2, option.value),
178
- style: normalizeStyle(_ctx.styleObj)
179
- }, [
180
- menu.title === option.text ? (openBlock(), createBlock(_component_nut_icon, {
181
- key: 0,
182
- size: "20",
183
- color: _ctx.activeColor,
184
- name: "Check"
185
- }, null, 8, ["color"])) : createCommentVNode("", true),
186
- createTextVNode(toDisplayString(option.text), 1)
187
- ], 12, _hoisted_3);
188
- }), 128))
189
- ])
190
- ], 512)), [
191
- [vShow, _ctx.hasOptions && _ctx.activeTitle === menu.title]
192
- ]);
193
- }), 128)),
194
- withDirectives(createElementVNode("view", _hoisted_4, [
195
- renderSlot(_ctx.$slots, "default")
196
- ], 512), [
197
- [vShow, !_ctx.hasOptions && _ctx.isShowCustomer]
198
- ])
199
- ], 6)
200
- ]);
102
+ createElementVNode("view", {
103
+ class: normalizeClass(["nut-menu__title", { active: item.state.showPopup }])
104
+ }, [
105
+ createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
106
+ createVNode(_component_nut_icon, {
107
+ name: item.titleIcon,
108
+ size: "10",
109
+ class: "nut-menu__title-icon"
110
+ }, null, 8, ["name"])
111
+ ], 2)
112
+ ], 14, _hoisted_1);
113
+ }), 128))
114
+ ], 2),
115
+ renderSlot(_ctx.$slots, "default")
116
+ ], 2);
201
117
  }
202
118
  var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
203
119
  export { index as default };