@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,20 +1,19 @@
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, toDisplayString, createCommentVNode, normalizeStyle, withDirectives, createVNode, vShow } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  function trimExtraChar(value, char, regExp) {
10
- const index2 = value.indexOf(char);
11
- if (index2 === -1) {
9
+ const index = value.indexOf(char);
10
+ if (index === -1) {
12
11
  return value;
13
12
  }
14
- if (char === "-" && index2 !== 0) {
15
- return value.slice(0, index2);
13
+ if (char === "-" && index !== 0) {
14
+ return value.slice(0, index);
16
15
  }
17
- return value.slice(0, index2 + 1) + value.slice(index2).replace(regExp, "");
16
+ return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
18
17
  }
19
18
  function formatNumber(value, allowDot = true, allowMinus = true) {
20
19
  if (allowDot) {
@@ -31,7 +30,7 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
31
30
  return value.replace(regExp, "");
32
31
  }
33
32
  const { componentName, create } = createComponent("input");
34
- const _sfc_main = create({
33
+ var _sfc_main = create({
35
34
  props: {
36
35
  type: {
37
36
  type: String,
@@ -67,7 +66,7 @@ const _sfc_main = create({
67
66
  },
68
67
  maxLength: {
69
68
  type: [String, Number],
70
- default: ""
69
+ default: "99999999"
71
70
  },
72
71
  clearable: {
73
72
  type: Boolean,
@@ -93,15 +92,15 @@ const _sfc_main = create({
93
92
  const valueChange = (event) => {
94
93
  const input = event.target;
95
94
  let val = input.value;
95
+ if (props.maxLength && val.length > Number(props.maxLength)) {
96
+ val = val.slice(0, Number(props.maxLength));
97
+ }
96
98
  if (props.type === "digit") {
97
99
  val = formatNumber(val, true);
98
100
  }
99
101
  if (props.type === "number") {
100
102
  val = formatNumber(val, false);
101
103
  }
102
- if (props.maxLength && val.length > Number(props.maxLength)) {
103
- val = val.slice(0, Number(props.maxLength));
104
- }
105
104
  emit("update:modelValue", val, event);
106
105
  emit("change", val, event);
107
106
  };
@@ -117,9 +116,6 @@ const _sfc_main = create({
117
116
  }, 0);
118
117
  const input = event.target;
119
118
  let value = input.value;
120
- if (props.maxLength && value.length > Number(props.maxLength)) {
121
- value = value.slice(0, Number(props.maxLength));
122
- }
123
119
  emit("blur", value, event);
124
120
  };
125
121
  const handleClear = (event) => {
@@ -143,7 +139,11 @@ const _hoisted_2 = {
143
139
  key: 0,
144
140
  class: "label-string"
145
141
  };
146
- const _hoisted_3 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value"];
142
+ const _hoisted_3 = {
143
+ key: 0,
144
+ class: "input-text"
145
+ };
146
+ const _hoisted_4 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value"];
147
147
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
148
148
  const _component_nut_icon = resolveComponent("nut-icon");
149
149
  return openBlock(), createElementBlock("view", {
@@ -152,7 +152,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
152
152
  createElementVNode("view", _hoisted_1, [
153
153
  _ctx.label ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true)
154
154
  ]),
155
- createElementVNode("input", {
155
+ _ctx.readonly ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.modelValue), 1)) : (openBlock(), createElementBlock("input", {
156
+ key: 1,
156
157
  class: "input-text",
157
158
  style: normalizeStyle(_ctx.styles),
158
159
  type: _ctx.type,
@@ -164,9 +165,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
164
165
  onInput: _cache[0] || (_cache[0] = (...args) => _ctx.valueChange && _ctx.valueChange(...args)),
165
166
  onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.valueFocus && _ctx.valueFocus(...args)),
166
167
  onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.valueBlur && _ctx.valueBlur(...args))
167
- }, null, 44, _hoisted_3),
168
+ }, null, 44, _hoisted_4)),
168
169
  _ctx.clearable && !_ctx.readonly ? withDirectives((openBlock(), createElementBlock("view", {
169
- key: 0,
170
+ key: 2,
170
171
  onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleClear && _ctx.handleClear(...args)),
171
172
  class: "nut-textinput-clear"
172
173
  }, [
@@ -179,5 +180,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
179
180
  ]) : createCommentVNode("", true)
180
181
  ], 2);
181
182
  }
182
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
183
- export { index as default };
183
+ _sfc_main.render = _sfc_render;
184
+ export { _sfc_main as default };
@@ -1,14 +1,13 @@
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 { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode } from "vue";
6
+ import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, toDisplayString } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
8
  import { p as pxCheck } from "./pxCheck.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
9
  const { componentName, create } = createComponent("inputnumber");
11
- const _sfc_main = create({
10
+ var _sfc_main = create({
12
11
  props: {
13
12
  modelValue: {
14
13
  type: [Number, String],
@@ -61,7 +60,7 @@ const _sfc_main = create({
61
60
  };
62
61
  const change = (event) => {
63
62
  const input = event.target;
64
- emit("update:modelValue", input.valueAsNumber, event);
63
+ emit("update:modelValue", input.value, event);
65
64
  };
66
65
  const emitChange = (value, event) => {
67
66
  let output_value = fixedDecimalPlaces(value);
@@ -92,20 +91,13 @@ const _sfc_main = create({
92
91
  emit("overlimit", event, "add");
93
92
  }
94
93
  };
95
- const focus = (event) => {
96
- if (props.disabled)
97
- return;
98
- if (props.readonly)
99
- return;
100
- emit("focus", event);
101
- };
102
94
  const blur = (event) => {
103
95
  if (props.disabled)
104
96
  return;
105
97
  if (props.readonly)
106
98
  return;
107
99
  const input = event.target;
108
- let value = input.valueAsNumber;
100
+ let value = +input.value;
109
101
  if (value < Number(props.min)) {
110
102
  value = Number(props.min);
111
103
  } else if (value > Number(props.max)) {
@@ -114,6 +106,15 @@ const _sfc_main = create({
114
106
  emitChange(value, event);
115
107
  emit("blur", event);
116
108
  };
109
+ const focus = (event) => {
110
+ if (props.disabled)
111
+ return;
112
+ if (props.readonly) {
113
+ blur(event);
114
+ return;
115
+ }
116
+ emit("focus", event);
117
+ };
117
118
  return {
118
119
  classes,
119
120
  change,
@@ -127,7 +128,11 @@ const _sfc_main = create({
127
128
  };
128
129
  }
129
130
  });
130
- const _hoisted_1 = ["min", "max", "disabled", "readonly", "value"];
131
+ const _hoisted_1 = {
132
+ key: 0,
133
+ class: "nut-inputnumber__text--readonly"
134
+ };
135
+ const _hoisted_2 = ["min", "max", "disabled", "readonly", "value"];
131
136
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
132
137
  const _component_nut_icon = resolveComponent("nut-icon");
133
138
  return openBlock(), createElementBlock("view", {
@@ -140,7 +145,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
140
145
  size: _ctx.buttonSize,
141
146
  onClick: _ctx.reduce
142
147
  }, null, 8, ["class", "size", "onClick"]),
143
- createElementVNode("input", {
148
+ _ctx.readonly ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.modelValue), 1)) : (openBlock(), createElementBlock("input", {
149
+ key: 1,
144
150
  type: "number",
145
151
  min: _ctx.min,
146
152
  max: _ctx.max,
@@ -151,7 +157,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
151
157
  onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
152
158
  onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
153
159
  onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
154
- }, null, 44, _hoisted_1),
160
+ }, null, 44, _hoisted_2)),
155
161
  createVNode(_component_nut_icon, {
156
162
  name: "plus",
157
163
  class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.addAllow() }]),
@@ -160,5 +166,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
160
166
  }, null, 8, ["class", "size", "onClick"])
161
167
  ], 6);
162
168
  }
163
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
164
- export { index as default };
169
+ _sfc_main.render = _sfc_render;
170
+ export { _sfc_main as default };
@@ -1,10 +1,10 @@
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 { c as createComponent } from "./component.js";
7
7
  import "vue";
8
8
  const { create } = createComponent("layout");
9
- const _sfc_main = create({});
9
+ var _sfc_main = create({});
10
10
  export { _sfc_main as default };
@@ -1,203 +1,121 @@
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 { 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";
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 = "";
8
+ import Taro from "@tarojs/taro";
12
9
  const { componentName, create } = createComponent("menu");
13
- const _sfc_main = create({
14
- components: {
15
- [_sfc_main$1.name]: _sfc_main$1
16
- },
10
+ var _sfc_main = create({
17
11
  props: {
18
- col: {
19
- type: [String, Number],
20
- default: 1
21
- },
22
12
  activeColor: {
23
13
  type: String,
24
- default: "#f00"
14
+ default: "#FA2C19"
15
+ },
16
+ overlay: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ duration: {
21
+ type: [Number, String],
22
+ default: 0.3
25
23
  }
26
24
  },
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;
25
+ setup(props, { emit, slots }) {
26
+ const barRef = ref();
27
+ const offset = ref(0);
28
+ const useChildren = () => {
29
+ const publicChildren = reactive([]);
30
+ const internalChildren = reactive([]);
31
+ const linkChildren2 = (value) => {
32
+ const link = (child) => {
33
+ if (child.proxy) {
34
+ internalChildren.push(child);
35
+ publicChildren.push(child.proxy);
49
36
  }
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);
37
+ };
38
+ provide("menuParent", Object.assign({
39
+ link,
40
+ children: publicChildren,
41
+ internalChildren
42
+ }, value));
43
+ };
44
+ return {
45
+ children: publicChildren,
46
+ linkChildren: linkChildren2
47
+ };
97
48
  };
49
+ const { children, linkChildren } = useChildren();
50
+ const opened = computed(() => children.some((item) => item.state.showWrapper));
98
51
  const classes = computed(() => {
99
52
  const prefixCls = componentName;
100
53
  return {
101
54
  [prefixCls]: true
102
55
  };
103
56
  });
104
- const handleClose = () => {
105
- activeTitle.value = "";
106
- nutMenuIndex.value = "auto";
107
- if (isShowCustomer.value) {
108
- isShowCustomer.value = false;
57
+ const updateOffset = () => {
58
+ if (barRef.value) {
59
+ setTimeout(() => {
60
+ Taro.createSelectorQuery().select(".nut-menu__bar.opened").boundingClientRect((rect) => {
61
+ offset.value = rect.bottom;
62
+ }).exec();
63
+ }, 100);
109
64
  }
110
65
  };
66
+ linkChildren({ props, offset });
67
+ const toggleItem = (active) => {
68
+ children.forEach((item, index) => {
69
+ if (index === active) {
70
+ updateOffset();
71
+ item.toggle();
72
+ } else if (item.state.showPopup) {
73
+ item.toggle(false, { immediate: true });
74
+ }
75
+ });
76
+ };
111
77
  return {
112
- menuList,
113
- activeTitle,
78
+ toggleItem,
79
+ children,
80
+ opened,
114
81
  classes,
115
- showMask,
116
- styleObj,
117
- nutMenuIndex,
118
- hasOptions,
119
- isShowCustomer,
120
- handleClickTitle,
121
- handleClickOption,
122
- handleClose
82
+ barRef
123
83
  };
124
84
  }
125
85
  });
126
- const _hoisted_1 = { class: "title-list" };
127
- const _hoisted_2 = ["onClick"];
128
- const _hoisted_3 = ["onClick"];
129
- const _hoisted_4 = { class: "customer-item" };
86
+ const _hoisted_1 = ["onClick"];
87
+ const _hoisted_2 = { class: "nut-menu__title-text" };
130
88
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
131
- const _component_nut_popup = resolveComponent("nut-popup");
132
89
  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 })
90
+ return openBlock(), createElementBlock("view", {
91
+ class: normalizeClass(_ctx.classes)
92
+ }, [
93
+ createElementVNode("view", {
94
+ class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
95
+ ref: "barRef"
142
96
  }, [
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)
97
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index) => {
98
+ return openBlock(), createElementBlock("view", {
99
+ key: index,
100
+ class: normalizeClass(["nut-menu__item", { disabled: item.disabled }]),
101
+ onClick: ($event) => !item.disabled && _ctx.toggleItem(index),
102
+ style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
103
+ }, [
104
+ createElementVNode("view", {
105
+ class: normalizeClass(["nut-menu__title", { active: item.state.showPopup }])
152
106
  }, [
153
- createTextVNode(toDisplayString(menu.title) + " ", 1),
154
- _ctx.activeTitle === menu.title ? (openBlock(), createBlock(_component_nut_icon, {
155
- key: 0,
107
+ createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
108
+ createVNode(_component_nut_icon, {
109
+ name: item.titleIcon,
156
110
  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", {
170
- key: index2,
171
- class: "option-list"
172
- }, [
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
- ]);
111
+ class: "nut-menu__title-icon"
112
+ }, null, 8, ["name"])
113
+ ], 2)
114
+ ], 14, _hoisted_1);
115
+ }), 128))
116
+ ], 2),
117
+ renderSlot(_ctx.$slots, "default")
118
+ ], 2);
201
119
  }
202
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
203
- export { index as default };
120
+ _sfc_main.render = _sfc_render;
121
+ export { _sfc_main as default };