@nutui/nutui 4.0.9 → 4.0.10

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 (168) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +15382 -0
  4. package/dist/nutui.umd.js +1 -7
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +96 -152
  59. package/dist/packages/_es/MenuItem.js +117 -172
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -441
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +130 -179
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/packages/col/index.scss +2 -2
  126. package/dist/packages/menuitem/index.scss +7 -10
  127. package/dist/packages/searchbar/index.scss +4 -0
  128. package/dist/smartips/web-types.json +2 -2
  129. package/dist/style.css +1 -1
  130. package/dist/styles/themes/default.scss +158 -55
  131. package/dist/styles/themes/jdb.scss +158 -55
  132. package/dist/styles/themes/jddkh.scss +158 -55
  133. package/dist/styles/themes/jdt.scss +158 -55
  134. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  135. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  138. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  139. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  141. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  142. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  143. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  144. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/table/common.d.ts +55 -2
  147. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  148. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  149. package/dist/types/index.d.ts +1 -1
  150. package/package.json +2 -2
  151. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  152. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  153. package/dist/packages/_es/common-b9a5e726.js +0 -145
  154. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  155. package/dist/packages/_es/index-29892cda.js +0 -33
  156. package/dist/packages/_es/index-43c34ac6.js +0 -30
  157. package/dist/packages/_es/index-54d03fc1.js +0 -8
  158. package/dist/packages/_es/index-79c5dc33.js +0 -10
  159. package/dist/packages/_es/index-7a7385e4.js +0 -67
  160. package/dist/packages/_es/index-87422be8.js +0 -942
  161. package/dist/packages/_es/index-da0a7662.js +0 -259
  162. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  163. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  164. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  165. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  166. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  167. package/dist/packages/_es/raf-729dad54.js +0 -25
  168. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,14 +1,13 @@
1
- import { ref, computed, onMounted, onUnmounted, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, renderSlot, createBlock } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { u as useRect } from "./index-29892cda.js";
4
- import { ArrowUp2, ArrowDown2 } from "@nutui/icons-vue";
5
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { ref as v, computed as y, onMounted as N, onUnmounted as P, reactive as _, provide as T, resolveComponent as k, openBlock as i, createElementBlock as g, normalizeClass as u, createElementVNode as p, Fragment as D, renderList as I, normalizeStyle as U, toDisplayString as R, renderSlot as b, createBlock as x } from "vue";
2
+ import { c as z } from "./component-234624bc.js";
3
+ import { u as M } from "./index-192a3ef6.js";
4
+ import { ArrowUp2 as j, ArrowDown2 as H } from "@nutui/icons-vue";
5
+ import { _ as V } from "./_plugin-vue_export-helper-dad06003.js";
6
6
  import "../locale/lang";
7
- const { componentName, create } = createComponent("menu");
8
- const _sfc_main = create({
7
+ const { componentName: W, create: Y } = z("menu"), q = Y({
9
8
  components: {
10
- ArrowUp2,
11
- ArrowDown2
9
+ ArrowUp2: j,
10
+ ArrowDown2: H
12
11
  },
13
12
  props: {
14
13
  activeColor: {
@@ -17,20 +16,19 @@ const _sfc_main = create({
17
16
  },
18
17
  overlay: {
19
18
  type: Boolean,
20
- default: true
19
+ default: !0
21
20
  },
22
21
  lockScroll: {
23
22
  type: Boolean,
24
- default: true
23
+ default: !0
25
24
  },
26
25
  duration: {
27
26
  type: [Number, String],
28
- default: 0
27
+ default: 0.3
29
28
  },
30
- titleIcon: String,
31
29
  closeOnClickOverlay: {
32
30
  type: Boolean,
33
- default: true
31
+ default: !0
34
32
  },
35
33
  direction: {
36
34
  type: String,
@@ -38,162 +36,108 @@ const _sfc_main = create({
38
36
  },
39
37
  scrollFixed: {
40
38
  type: [Boolean, String, Number],
41
- default: false
39
+ default: !1
42
40
  },
43
41
  titleClass: [String]
44
42
  },
45
- setup(props, { emit, slots }) {
46
- const barRef = ref();
47
- const offset = ref(0);
48
- const isScrollFixed = ref(false);
49
- const useChildren = () => {
50
- const publicChildren = reactive([]);
51
- const internalChildren = reactive([]);
52
- const linkChildren2 = (value) => {
53
- const link = (child) => {
54
- if (child.proxy) {
55
- internalChildren.push(child);
56
- publicChildren.push(child.proxy);
57
- }
58
- };
59
- const removeLink = (child) => {
60
- if (child.proxy) {
61
- let internalIndex = internalChildren.indexOf(child);
62
- if (internalIndex > -1) {
63
- internalChildren.splice(internalIndex, 1);
64
- }
65
- let publicIndex = publicChildren.indexOf(child.proxy);
66
- if (internalIndex > -1) {
67
- publicChildren.splice(publicIndex, 1);
68
- }
69
- }
70
- };
71
- provide(
72
- "menuParent",
73
- Object.assign(
74
- {
75
- removeLink,
76
- link,
77
- children: publicChildren,
78
- internalChildren
79
- },
80
- value
81
- )
82
- );
83
- };
84
- return {
85
- children: publicChildren,
86
- linkChildren: linkChildren2
87
- };
88
- };
89
- const { children, linkChildren } = useChildren();
90
- const opened = computed(() => children.some((item) => item.state.showWrapper));
91
- const classes = computed(() => {
92
- const prefixCls = componentName;
43
+ setup(o, { emit: S, slots: $ }) {
44
+ const c = v(), a = v(0), f = v(!1), m = () => {
45
+ const e = _([]), t = _([]);
93
46
  return {
94
- [prefixCls]: true,
95
- "scroll-fixed": isScrollFixed.value
96
- };
97
- });
98
- const updateOffset = () => {
99
- if (barRef.value) {
100
- const rect = useRect(barRef);
101
- if (props.direction === "down") {
102
- offset.value = rect.bottom;
103
- } else {
104
- offset.value = window.innerHeight - rect.top;
47
+ children: e,
48
+ linkChildren: (E) => {
49
+ T(
50
+ "menuParent",
51
+ Object.assign(
52
+ {
53
+ removeLink: (r) => {
54
+ if (r.proxy) {
55
+ let w = t.indexOf(r);
56
+ w > -1 && t.splice(w, 1);
57
+ let L = e.indexOf(r.proxy);
58
+ w > -1 && e.splice(L, 1);
59
+ }
60
+ },
61
+ link: (r) => {
62
+ r.proxy && (t.push(r), e.push(r.proxy));
63
+ },
64
+ children: e,
65
+ internalChildren: t
66
+ },
67
+ E
68
+ )
69
+ );
105
70
  }
71
+ };
72
+ }, { children: s, linkChildren: n } = m(), d = y(() => s.some((e) => e.state.showWrapper)), h = y(() => ({
73
+ [W]: !0,
74
+ "scroll-fixed": f.value
75
+ })), B = () => {
76
+ if (c.value) {
77
+ const e = M(c);
78
+ o.direction === "down" ? a.value = e.bottom : a.value = window.innerHeight - e.top;
106
79
  }
107
80
  };
108
- linkChildren({ props, offset });
109
- const toggleItem = (active) => {
110
- children.forEach((item, index2) => {
111
- if (index2 === active) {
112
- updateOffset();
113
- item.toggle();
114
- } else if (item.state.showPopup) {
115
- item.toggle(false, { immediate: true });
116
- }
81
+ n({ props: o, offset: a });
82
+ const O = (e) => {
83
+ s.forEach((t, l) => {
84
+ l === e ? (B(), t.toggle()) : t.state.showPopup && t.toggle(!1, { immediate: !0 });
117
85
  });
86
+ }, A = (e) => Math.max(0, "scrollTop" in e ? e.scrollTop : e.pageYOffset), C = () => {
87
+ const { scrollFixed: e } = o, t = A(window);
88
+ f.value = t > (typeof e == "boolean" ? 30 : Number(e));
89
+ }, F = (e) => {
90
+ let t = "";
91
+ const { titleClass: l } = o;
92
+ return e && (t += "active"), l && (t += ` ${l}`), t;
118
93
  };
119
- const getScrollTop = (el) => {
120
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
121
- };
122
- const onScroll = () => {
123
- const { scrollFixed } = props;
124
- const scrollTop = getScrollTop(window);
125
- isScrollFixed.value = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
126
- };
127
- const getClasses = (showPopup) => {
128
- let str = "";
129
- const { titleClass } = props;
130
- if (showPopup) {
131
- str += "active";
132
- }
133
- if (titleClass) {
134
- str += ` ${titleClass}`;
135
- }
136
- return str;
137
- };
138
- onMounted(() => {
139
- const { scrollFixed } = props;
140
- if (scrollFixed) {
141
- window.addEventListener("scroll", onScroll);
142
- }
143
- });
144
- onUnmounted(() => {
145
- const { scrollFixed } = props;
146
- if (scrollFixed) {
147
- window.removeEventListener("scroll", onScroll);
148
- }
149
- });
150
- return {
151
- toggleItem,
152
- children,
153
- opened,
154
- classes,
155
- barRef,
156
- getClasses
94
+ return N(() => {
95
+ const { scrollFixed: e } = o;
96
+ e && window.addEventListener("scroll", C);
97
+ }), P(() => {
98
+ const { scrollFixed: e } = o;
99
+ e && window.removeEventListener("scroll", C);
100
+ }), {
101
+ toggleItem: O,
102
+ children: s,
103
+ opened: d,
104
+ classes: h,
105
+ barRef: c,
106
+ getClasses: F
157
107
  };
158
108
  }
159
- });
160
- const _hoisted_1 = ["onClick"];
161
- const _hoisted_2 = { class: "nut-menu__title-text" };
162
- const _hoisted_3 = { class: "nut-menu__title-icon" };
163
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
164
- const _component_ArrowUp2 = resolveComponent("ArrowUp2");
165
- const _component_ArrowDown2 = resolveComponent("ArrowDown2");
166
- return openBlock(), createElementBlock("view", {
167
- class: normalizeClass(_ctx.classes)
109
+ }), G = ["onClick"], J = { class: "nut-menu__title-text" }, K = { class: "nut-menu__title-icon" };
110
+ function Q(o, S, $, c, a, f) {
111
+ const m = k("ArrowUp2"), s = k("ArrowDown2");
112
+ return i(), g("view", {
113
+ class: u(o.classes)
168
114
  }, [
169
- createElementVNode("view", {
170
- class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
115
+ p("view", {
116
+ class: u(["nut-menu__bar", { opened: o.opened }]),
171
117
  ref: "barRef"
172
118
  }, [
173
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
174
- return openBlock(), createElementBlock("view", {
175
- key: index2,
176
- class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
177
- onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
178
- style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
119
+ (i(!0), g(D, null, I(o.children, (n, d) => (i(), g("view", {
120
+ key: d,
121
+ class: u(["nut-menu__item", { disabled: n.disabled, active: n.state.showPopup }]),
122
+ onClick: (h) => !n.disabled && o.toggleItem(d),
123
+ style: U({ color: n.state.showPopup ? o.activeColor : "" })
124
+ }, [
125
+ p("view", {
126
+ class: u(["nut-menu__title", o.getClasses(n.state.showPopup)])
179
127
  }, [
180
- createElementVNode("view", {
181
- class: normalizeClass(["nut-menu__title", _ctx.getClasses(item.state.showPopup)])
182
- }, [
183
- createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
184
- createElementVNode("span", _hoisted_3, [
185
- renderSlot(_ctx.$slots, "icon", {}, () => [
186
- _ctx.direction === "up" ? (openBlock(), createBlock(_component_ArrowUp2, { key: 0 })) : (openBlock(), createBlock(_component_ArrowDown2, { key: 1 }))
187
- ])
128
+ p("view", J, R(n.renderTitle()), 1),
129
+ p("span", K, [
130
+ b(o.$slots, "icon", {}, () => [
131
+ o.direction === "up" ? (i(), x(m, { key: 0 })) : (i(), x(s, { key: 1 }))
188
132
  ])
189
- ], 2)
190
- ], 14, _hoisted_1);
191
- }), 128))
133
+ ])
134
+ ], 2)
135
+ ], 14, G))), 128))
192
136
  ], 2),
193
- renderSlot(_ctx.$slots, "default")
137
+ b(o.$slots, "default")
194
138
  ], 2);
195
139
  }
196
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
140
+ const le = /* @__PURE__ */ V(q, [["render", Q]]);
197
141
  export {
198
- index as default
142
+ le as default
199
143
  };
@@ -1,31 +1,23 @@
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
- import { reactive, computed, inject, getCurrentInstance, onUnmounted, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, renderSlot, createCommentVNode, toDisplayString } from "vue";
21
- import { c as createComponent } from "./component-81a4c1d0.js";
22
- import { P as Popup } from "./index-da0a7662.js";
23
- import { Check } from "@nutui/icons-vue";
24
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var B = Object.defineProperty, D = Object.defineProperties;
2
+ var z = Object.getOwnPropertyDescriptors;
3
+ var w = Object.getOwnPropertySymbols;
4
+ var L = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
5
+ var g = (e, o, t) => o in e ? B(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, d = (e, o) => {
6
+ for (var t in o || (o = {}))
7
+ L.call(o, t) && g(e, t, o[t]);
8
+ if (w)
9
+ for (var t of w(o))
10
+ U.call(o, t) && g(e, t, o[t]);
11
+ return e;
12
+ }, m = (e, o) => D(e, z(o));
13
+ import { reactive as j, computed as P, inject as A, getCurrentInstance as F, onUnmounted as I, resolveComponent as S, withDirectives as V, openBlock as r, createElementBlock as i, normalizeStyle as p, createElementVNode as v, vShow as b, createVNode as $, mergeProps as T, withCtx as q, Fragment as G, renderList as H, normalizeClass as f, renderSlot as O, createCommentVNode as J, toDisplayString as K } from "vue";
14
+ import { c as M } from "./component-234624bc.js";
15
+ import { P as E } from "./index-360c5092.js";
16
+ import { Check as Q } from "@nutui/icons-vue";
17
+ import { _ as R } from "./_plugin-vue_export-helper-dad06003.js";
25
18
  import "../locale/lang";
26
19
  import "./Overlay.js";
27
- const { componentName, create } = createComponent("menu-item");
28
- const _sfc_main = create({
20
+ const { create: X } = M("menu-item"), Y = X({
29
21
  props: {
30
22
  title: String,
31
23
  options: {
@@ -34,7 +26,7 @@ const _sfc_main = create({
34
26
  },
35
27
  disabled: {
36
28
  type: Boolean,
37
- default: false
29
+ default: !1
38
30
  },
39
31
  modelValue: null,
40
32
  cols: {
@@ -42,168 +34,121 @@ const _sfc_main = create({
42
34
  default: 1
43
35
  },
44
36
  activeTitleClass: String,
45
- inactiveTitleClass: String,
46
- optionIcon: {
47
- type: String,
48
- default: "Check"
49
- }
37
+ inactiveTitleClass: String
50
38
  },
51
39
  components: {
52
- [Popup.name]: Popup,
53
- Check
40
+ [E.name]: E,
41
+ Check: Q
54
42
  },
55
43
  emits: ["update:modelValue", "change", "open", "close"],
56
- setup(props, { emit, slots }) {
57
- const state = reactive({
58
- showPopup: false,
59
- transition: true,
60
- showWrapper: false,
61
- isShowPlaceholderElement: false
62
- });
63
- const useParent = () => {
64
- const parent2 = inject("menuParent", null);
65
- if (parent2) {
66
- const instance = getCurrentInstance();
67
- const { link, removeLink } = parent2;
68
- link(instance);
69
- onUnmounted(() => {
70
- removeLink(instance);
71
- });
72
- return {
73
- parent: parent2
74
- };
75
- }
76
- };
77
- const { parent } = useParent();
78
- const classes = computed(() => {
79
- const prefixCls = componentName;
80
- return {
81
- [prefixCls]: true
82
- };
83
- });
84
- const placeholderElementStyle = computed(() => {
85
- const heightStyle = { height: parent.offset.value + "px" };
86
- if (parent.props.direction === "down") {
87
- return heightStyle;
88
- } else {
89
- return __spreadProps(__spreadValues({}, heightStyle), { top: "auto" });
44
+ setup(e, { emit: o }) {
45
+ const t = j({
46
+ showPopup: !1,
47
+ showWrapper: !1
48
+ }), h = () => {
49
+ const l = A("menuParent", null);
50
+ if (l) {
51
+ const a = F(), { link: c, removeLink: W } = l;
52
+ return c(a), I(() => {
53
+ W(a);
54
+ }), { parent: l };
90
55
  }
56
+ }, { parent: s } = h(), C = P(() => s.props.direction === "down" ? {
57
+ top: s.offset.value + "px"
58
+ } : {
59
+ bottom: s.offset.value + "px"
60
+ }), u = P(() => {
61
+ const l = { height: s.offset.value + "px" };
62
+ return s.props.direction === "down" ? m(d({}, l), { top: "0px" }) : m(d({}, l), { bottom: "0px" });
91
63
  });
92
- const toggle = (show = !state.showPopup, options = {}) => {
93
- if (show === state.showPopup) {
94
- return;
95
- }
96
- state.showPopup = show;
97
- state.isShowPlaceholderElement = show;
98
- if (show) {
99
- state.showWrapper = true;
100
- emit("open");
101
- }
102
- };
103
- const renderTitle = () => {
104
- var _a;
105
- if (props.title) {
106
- return props.title;
107
- }
108
- const match = (_a = props.options) == null ? void 0 : _a.find((option) => option.value === props.modelValue);
109
- return match ? match.text : "";
110
- };
111
- const onClick = (option) => {
112
- state.showPopup = false;
113
- state.isShowPlaceholderElement = false;
114
- if (option.value !== props.modelValue) {
115
- emit("update:modelValue", option.value);
116
- emit("change", option.value);
117
- }
118
- };
119
- const handleClose = () => {
120
- emit("close");
121
- state.showWrapper = false;
122
- state.isShowPlaceholderElement = false;
123
- };
124
- const handleClickOutside = () => {
125
- state.showPopup = false;
126
- emit("close");
127
- };
128
64
  return {
129
- classes,
130
- placeholderElementStyle,
131
- renderTitle,
132
- state,
133
- parent,
134
- toggle,
135
- onClick,
136
- handleClose,
137
- handleClickOutside
65
+ style: C,
66
+ placeholderElementStyle: u,
67
+ renderTitle: () => {
68
+ var a;
69
+ if (e.title)
70
+ return e.title;
71
+ const l = (a = e.options) == null ? void 0 : a.find((c) => c.value === e.modelValue);
72
+ return l ? l.text : "";
73
+ },
74
+ state: t,
75
+ parent: s,
76
+ toggle: (l = !t.showPopup) => {
77
+ l !== t.showPopup && (t.showPopup = l, l && (t.showWrapper = !0, o("open")));
78
+ },
79
+ onClick: (l) => {
80
+ t.showPopup = !1, l.value !== e.modelValue && (o("update:modelValue", l.value), o("change", l.value));
81
+ },
82
+ handleClose: () => {
83
+ o("close"), t.showWrapper = !1;
84
+ },
85
+ handleClickOutside: () => {
86
+ t.showPopup = !1, o("close");
87
+ }
138
88
  };
139
89
  }
140
- });
141
- const _hoisted_1 = { class: "nut-menu-item__content nut-menu-item__overflow" };
142
- const _hoisted_2 = ["onClick"];
143
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
144
- const _component_Check = resolveComponent("Check");
145
- const _component_nut_popup = resolveComponent("nut-popup");
146
- return withDirectives((openBlock(), createElementBlock("view", {
147
- class: normalizeClass(_ctx.classes)
90
+ }), Z = { class: "nut-menu-item__content nut-menu-item__overflow" }, _ = ["onClick"];
91
+ function x(e, o, t, h, s, C) {
92
+ const u = S("Check"), y = S("nut-popup");
93
+ return V((r(), i("view", {
94
+ class: "nut-menu-item",
95
+ style: p(e.style)
148
96
  }, [
149
- withDirectives(createElementVNode("div", {
150
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
151
- class: normalizeClass(["nut-menu-item-placeholder-element", { up: _ctx.parent.props.direction === "up" }]),
152
- style: normalizeStyle(_ctx.placeholderElementStyle)
153
- }, null, 6), [
154
- [vShow, _ctx.state.isShowPlaceholderElement]
97
+ V(v("div", {
98
+ onClick: o[0] || (o[0] = (...n) => e.handleClickOutside && e.handleClickOutside(...n)),
99
+ class: "nut-menu-item-placeholder-element",
100
+ style: p(e.placeholderElementStyle)
101
+ }, null, 4), [
102
+ [b, e.state.showPopup]
155
103
  ]),
156
- createVNode(_component_nut_popup, mergeProps({
157
- style: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px" },
158
- overlayStyle: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px", top: "auto" }
159
- }, _ctx.$attrs, {
160
- visible: _ctx.state.showPopup,
161
- "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.state.showPopup = $event),
162
- position: _ctx.parent.props.direction === "down" ? "top" : "bottom",
163
- duration: _ctx.parent.props.duration,
164
- "pop-class": "nut-menu__pop",
165
- "destroy-on-close": false,
166
- overlay: _ctx.parent.props.overlay,
167
- onClosed: _ctx.handleClose,
168
- lockScroll: _ctx.parent.props.lockScroll,
169
- teleportDisable: false,
170
- "close-on-click-overlay": _ctx.parent.props.closeOnClickOverlay
104
+ $(y, T({
105
+ style: { position: "absolute" },
106
+ overlayStyle: { position: "absolute" }
107
+ }, e.$attrs, {
108
+ visible: e.state.showPopup,
109
+ "onUpdate:visible": o[1] || (o[1] = (n) => e.state.showPopup = n),
110
+ position: e.parent.props.direction === "down" ? "top" : "bottom",
111
+ duration: e.parent.props.duration,
112
+ "destroy-on-close": !1,
113
+ overlay: e.parent.props.overlay,
114
+ onClosed: e.handleClose,
115
+ lockScroll: e.parent.props.lockScroll,
116
+ teleportDisable: !1,
117
+ "close-on-click-overlay": e.parent.props.closeOnClickOverlay
171
118
  }), {
172
- default: withCtx(() => [
173
- createElementVNode("view", _hoisted_1, [
174
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index2) => {
175
- return openBlock(), createElementBlock("view", {
176
- key: index2,
177
- class: normalizeClass(["nut-menu-item__option", [{ active: option.value === _ctx.modelValue }]]),
178
- style: normalizeStyle({ "flex-basis": 100 / _ctx.cols + "%" }),
179
- onClick: ($event) => _ctx.onClick(option)
119
+ default: q(() => [
120
+ v("view", Z, [
121
+ (r(!0), i(G, null, H(e.options, (n, k) => (r(), i("view", {
122
+ key: k,
123
+ class: f(["nut-menu-item__option", [{ active: n.value === e.modelValue }]]),
124
+ style: p({ "flex-basis": 100 / e.cols + "%" }),
125
+ onClick: (N) => e.onClick(n)
126
+ }, [
127
+ n.value === e.modelValue ? (r(), i("span", {
128
+ key: 0,
129
+ class: f(["nut-menu-item__span", [n.value === e.modelValue ? e.activeTitleClass : e.inactiveTitleClass]])
180
130
  }, [
181
- option.value === _ctx.modelValue ? (openBlock(), createElementBlock("span", {
182
- key: 0,
183
- class: normalizeClass(["nut-menu-item__span", [option.value === _ctx.modelValue ? _ctx.activeTitleClass : _ctx.inactiveTitleClass]])
184
- }, [
185
- renderSlot(_ctx.$slots, "icon", {}, () => [
186
- createVNode(_component_Check, mergeProps(_ctx.$attrs, {
187
- color: _ctx.parent.props.activeColor
188
- }), null, 16, ["color"])
189
- ])
190
- ], 2)) : createCommentVNode("", true),
191
- createElementVNode("view", {
192
- class: normalizeClass([option.value === _ctx.modelValue ? _ctx.activeTitleClass : _ctx.inactiveTitleClass]),
193
- style: normalizeStyle({ color: option.value === _ctx.modelValue ? _ctx.parent.props.activeColor : "" })
194
- }, toDisplayString(option.text), 7)
195
- ], 14, _hoisted_2);
196
- }), 128)),
197
- renderSlot(_ctx.$slots, "default")
131
+ O(e.$slots, "icon", {}, () => [
132
+ $(u, T(e.$attrs, {
133
+ color: e.parent.props.activeColor
134
+ }), null, 16, ["color"])
135
+ ])
136
+ ], 2)) : J("", !0),
137
+ v("view", {
138
+ class: f([n.value === e.modelValue ? e.activeTitleClass : e.inactiveTitleClass]),
139
+ style: p({ color: n.value === e.modelValue ? e.parent.props.activeColor : "" })
140
+ }, K(n.text), 7)
141
+ ], 14, _))), 128)),
142
+ O(e.$slots, "default")
198
143
  ])
199
144
  ]),
200
145
  _: 3
201
- }, 16, ["style", "overlayStyle", "visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
202
- ], 2)), [
203
- [vShow, _ctx.state.showWrapper]
146
+ }, 16, ["visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
147
+ ], 4)), [
148
+ [b, e.state.showWrapper]
204
149
  ]);
205
150
  }
206
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
151
+ const pe = /* @__PURE__ */ R(Y, [["render", x]]);
207
152
  export {
208
- index as default
153
+ pe as default
209
154
  };