@nutui/nutui 4.0.10-beta.1 → 4.0.11

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 (160) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6316 -7237
  4. package/dist/nutui.umd.js +1 -1
  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 +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  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 -437
  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 +123 -174
  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/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +148 -45
  128. package/dist/styles/themes/jdb.scss +148 -45
  129. package/dist/styles/themes/jddkh.scss +148 -45
  130. package/dist/styles/themes/jdt.scss +148 -45
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. 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,11 +16,11 @@ 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],
@@ -29,7 +28,7 @@ const _sfc_main = create({
29
28
  },
30
29
  closeOnClickOverlay: {
31
30
  type: Boolean,
32
- default: true
31
+ default: !0
33
32
  },
34
33
  direction: {
35
34
  type: String,
@@ -37,162 +36,108 @@ const _sfc_main = create({
37
36
  },
38
37
  scrollFixed: {
39
38
  type: [Boolean, String, Number],
40
- default: false
39
+ default: !1
41
40
  },
42
41
  titleClass: [String]
43
42
  },
44
- setup(props, { emit, slots }) {
45
- const barRef = ref();
46
- const offset = ref(0);
47
- const isScrollFixed = ref(false);
48
- const useChildren = () => {
49
- const publicChildren = reactive([]);
50
- const internalChildren = reactive([]);
51
- const linkChildren2 = (value) => {
52
- const link = (child) => {
53
- if (child.proxy) {
54
- internalChildren.push(child);
55
- publicChildren.push(child.proxy);
56
- }
57
- };
58
- const removeLink = (child) => {
59
- if (child.proxy) {
60
- let internalIndex = internalChildren.indexOf(child);
61
- if (internalIndex > -1) {
62
- internalChildren.splice(internalIndex, 1);
63
- }
64
- let publicIndex = publicChildren.indexOf(child.proxy);
65
- if (internalIndex > -1) {
66
- publicChildren.splice(publicIndex, 1);
67
- }
68
- }
69
- };
70
- provide(
71
- "menuParent",
72
- Object.assign(
73
- {
74
- removeLink,
75
- link,
76
- children: publicChildren,
77
- internalChildren
78
- },
79
- value
80
- )
81
- );
82
- };
83
- return {
84
- children: publicChildren,
85
- linkChildren: linkChildren2
86
- };
87
- };
88
- const { children, linkChildren } = useChildren();
89
- const opened = computed(() => children.some((item) => item.state.showWrapper));
90
- const classes = computed(() => {
91
- const prefixCls = componentName;
43
+ setup(o, { emit: S, slots: $ }) {
44
+ const c = v(), a = v(0), f = v(!1), m = () => {
45
+ const e = _([]), t = _([]);
92
46
  return {
93
- [prefixCls]: true,
94
- "scroll-fixed": isScrollFixed.value
95
- };
96
- });
97
- const updateOffset = () => {
98
- if (barRef.value) {
99
- const rect = useRect(barRef);
100
- if (props.direction === "down") {
101
- offset.value = rect.bottom;
102
- } else {
103
- 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
+ );
104
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;
105
79
  }
106
80
  };
107
- linkChildren({ props, offset });
108
- const toggleItem = (active) => {
109
- children.forEach((item, index2) => {
110
- if (index2 === active) {
111
- updateOffset();
112
- item.toggle();
113
- } else if (item.state.showPopup) {
114
- item.toggle(false, { immediate: true });
115
- }
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 });
116
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;
117
93
  };
118
- const getScrollTop = (el) => {
119
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
120
- };
121
- const onScroll = () => {
122
- const { scrollFixed } = props;
123
- const scrollTop = getScrollTop(window);
124
- isScrollFixed.value = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
125
- };
126
- const getClasses = (showPopup) => {
127
- let str = "";
128
- const { titleClass } = props;
129
- if (showPopup) {
130
- str += "active";
131
- }
132
- if (titleClass) {
133
- str += ` ${titleClass}`;
134
- }
135
- return str;
136
- };
137
- onMounted(() => {
138
- const { scrollFixed } = props;
139
- if (scrollFixed) {
140
- window.addEventListener("scroll", onScroll);
141
- }
142
- });
143
- onUnmounted(() => {
144
- const { scrollFixed } = props;
145
- if (scrollFixed) {
146
- window.removeEventListener("scroll", onScroll);
147
- }
148
- });
149
- return {
150
- toggleItem,
151
- children,
152
- opened,
153
- classes,
154
- barRef,
155
- 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
156
107
  };
157
108
  }
158
- });
159
- const _hoisted_1 = ["onClick"];
160
- const _hoisted_2 = { class: "nut-menu__title-text" };
161
- const _hoisted_3 = { class: "nut-menu__title-icon" };
162
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
163
- const _component_ArrowUp2 = resolveComponent("ArrowUp2");
164
- const _component_ArrowDown2 = resolveComponent("ArrowDown2");
165
- return openBlock(), createElementBlock("view", {
166
- 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)
167
114
  }, [
168
- createElementVNode("view", {
169
- class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
115
+ p("view", {
116
+ class: u(["nut-menu__bar", { opened: o.opened }]),
170
117
  ref: "barRef"
171
118
  }, [
172
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
173
- return openBlock(), createElementBlock("view", {
174
- key: index2,
175
- class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
176
- onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
177
- 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)])
178
127
  }, [
179
- createElementVNode("view", {
180
- class: normalizeClass(["nut-menu__title", _ctx.getClasses(item.state.showPopup)])
181
- }, [
182
- createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
183
- createElementVNode("span", _hoisted_3, [
184
- renderSlot(_ctx.$slots, "icon", {}, () => [
185
- _ctx.direction === "up" ? (openBlock(), createBlock(_component_ArrowUp2, { key: 0 })) : (openBlock(), createBlock(_component_ArrowDown2, { key: 1 }))
186
- ])
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 }))
187
132
  ])
188
- ], 2)
189
- ], 14, _hoisted_1);
190
- }), 128))
133
+ ])
134
+ ], 2)
135
+ ], 14, G))), 128))
191
136
  ], 2),
192
- renderSlot(_ctx.$slots, "default")
137
+ b(o.$slots, "default")
193
138
  ], 2);
194
139
  }
195
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
140
+ const le = /* @__PURE__ */ V(q, [["render", Q]]);
196
141
  export {
197
- index as default
142
+ le as default
198
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, normalizeStyle, createElementVNode, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, normalizeClass, 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 { 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: {
@@ -45,155 +37,118 @@ const _sfc_main = create({
45
37
  inactiveTitleClass: String
46
38
  },
47
39
  components: {
48
- [Popup.name]: Popup,
49
- Check
40
+ [E.name]: E,
41
+ Check: Q
50
42
  },
51
43
  emits: ["update:modelValue", "change", "open", "close"],
52
- setup(props, { emit }) {
53
- const state = reactive({
54
- showPopup: false,
55
- showWrapper: false
56
- });
57
- const useParent = () => {
58
- const parent2 = inject("menuParent", null);
59
- if (parent2) {
60
- const instance = getCurrentInstance();
61
- const { link, removeLink } = parent2;
62
- link(instance);
63
- onUnmounted(() => {
64
- removeLink(instance);
65
- });
66
- return { parent: parent2 };
67
- }
68
- };
69
- const { parent } = useParent();
70
- const style = computed(() => {
71
- return parent.props.direction === "down" ? {
72
- top: parent.offset.value + "px"
73
- } : {
74
- bottom: parent.offset.value + "px"
75
- };
76
- });
77
- const placeholderElementStyle = computed(() => {
78
- const heightStyle = { height: parent.offset.value + "px" };
79
- if (parent.props.direction === "down") {
80
- return __spreadProps(__spreadValues({}, heightStyle), { top: "0px" });
81
- } else {
82
- return __spreadProps(__spreadValues({}, heightStyle), { bottom: "0px" });
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 };
83
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" });
84
63
  });
85
- const toggle = (show = !state.showPopup) => {
86
- if (show === state.showPopup) {
87
- return;
88
- }
89
- state.showPopup = show;
90
- if (show) {
91
- state.showWrapper = true;
92
- emit("open");
93
- }
94
- };
95
- const renderTitle = () => {
96
- var _a;
97
- if (props.title) {
98
- return props.title;
99
- }
100
- const match = (_a = props.options) == null ? void 0 : _a.find((option) => option.value === props.modelValue);
101
- return match ? match.text : "";
102
- };
103
- const onClick = (option) => {
104
- state.showPopup = false;
105
- if (option.value !== props.modelValue) {
106
- emit("update:modelValue", option.value);
107
- emit("change", option.value);
108
- }
109
- };
110
- const handleClose = () => {
111
- emit("close");
112
- state.showWrapper = false;
113
- };
114
- const handleClickOutside = () => {
115
- state.showPopup = false;
116
- emit("close");
117
- };
118
64
  return {
119
- style,
120
- placeholderElementStyle,
121
- renderTitle,
122
- state,
123
- parent,
124
- toggle,
125
- onClick,
126
- handleClose,
127
- 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
+ }
128
88
  };
129
89
  }
130
- });
131
- const _hoisted_1 = { class: "nut-menu-item__content nut-menu-item__overflow" };
132
- const _hoisted_2 = ["onClick"];
133
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
134
- const _component_Check = resolveComponent("Check");
135
- const _component_nut_popup = resolveComponent("nut-popup");
136
- return withDirectives((openBlock(), createElementBlock("view", {
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", {
137
94
  class: "nut-menu-item",
138
- style: normalizeStyle(_ctx.style)
95
+ style: p(e.style)
139
96
  }, [
140
- withDirectives(createElementVNode("div", {
141
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
97
+ V(v("div", {
98
+ onClick: o[0] || (o[0] = (...n) => e.handleClickOutside && e.handleClickOutside(...n)),
142
99
  class: "nut-menu-item-placeholder-element",
143
- style: normalizeStyle(_ctx.placeholderElementStyle)
100
+ style: p(e.placeholderElementStyle)
144
101
  }, null, 4), [
145
- [vShow, _ctx.state.showPopup]
102
+ [b, e.state.showPopup]
146
103
  ]),
147
- createVNode(_component_nut_popup, mergeProps({
104
+ $(y, T({
148
105
  style: { position: "absolute" },
149
106
  overlayStyle: { position: "absolute" }
150
- }, _ctx.$attrs, {
151
- visible: _ctx.state.showPopup,
152
- "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.state.showPopup = $event),
153
- position: _ctx.parent.props.direction === "down" ? "top" : "bottom",
154
- duration: _ctx.parent.props.duration,
155
- "destroy-on-close": false,
156
- overlay: _ctx.parent.props.overlay,
157
- onClosed: _ctx.handleClose,
158
- lockScroll: _ctx.parent.props.lockScroll,
159
- teleportDisable: false,
160
- "close-on-click-overlay": _ctx.parent.props.closeOnClickOverlay
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
161
118
  }), {
162
- default: withCtx(() => [
163
- createElementVNode("view", _hoisted_1, [
164
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index2) => {
165
- return openBlock(), createElementBlock("view", {
166
- key: index2,
167
- class: normalizeClass(["nut-menu-item__option", [{ active: option.value === _ctx.modelValue }]]),
168
- style: normalizeStyle({ "flex-basis": 100 / _ctx.cols + "%" }),
169
- 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]])
170
130
  }, [
171
- option.value === _ctx.modelValue ? (openBlock(), createElementBlock("span", {
172
- key: 0,
173
- class: normalizeClass(["nut-menu-item__span", [option.value === _ctx.modelValue ? _ctx.activeTitleClass : _ctx.inactiveTitleClass]])
174
- }, [
175
- renderSlot(_ctx.$slots, "icon", {}, () => [
176
- createVNode(_component_Check, mergeProps(_ctx.$attrs, {
177
- color: _ctx.parent.props.activeColor
178
- }), null, 16, ["color"])
179
- ])
180
- ], 2)) : createCommentVNode("", true),
181
- createElementVNode("view", {
182
- class: normalizeClass([option.value === _ctx.modelValue ? _ctx.activeTitleClass : _ctx.inactiveTitleClass]),
183
- style: normalizeStyle({ color: option.value === _ctx.modelValue ? _ctx.parent.props.activeColor : "" })
184
- }, toDisplayString(option.text), 7)
185
- ], 14, _hoisted_2);
186
- }), 128)),
187
- 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")
188
143
  ])
189
144
  ]),
190
145
  _: 3
191
146
  }, 16, ["visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
192
147
  ], 4)), [
193
- [vShow, _ctx.state.showWrapper]
148
+ [b, e.state.showWrapper]
194
149
  ]);
195
150
  }
196
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
151
+ const pe = /* @__PURE__ */ R(Y, [["render", x]]);
197
152
  export {
198
- index as default
153
+ pe as default
199
154
  };