@nutui/nutui 4.0.12-beta.1 → 4.0.12
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.
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +1 -1
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +50 -50
- package/dist/styles/themes/jdb.scss +50 -50
- package/dist/styles/themes/jddkh.scss +50 -50
- package/dist/styles/themes/jdt.scss +50 -50
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { ArrowUp2
|
|
5
|
-
import { _ as
|
|
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";
|
|
6
6
|
import "../locale/lang";
|
|
7
|
-
const { componentName
|
|
7
|
+
const { componentName, create } = createComponent("menu");
|
|
8
|
+
const _sfc_main = create({
|
|
8
9
|
components: {
|
|
9
|
-
ArrowUp2
|
|
10
|
-
ArrowDown2
|
|
10
|
+
ArrowUp2,
|
|
11
|
+
ArrowDown2
|
|
11
12
|
},
|
|
12
13
|
props: {
|
|
13
14
|
activeColor: {
|
|
@@ -16,11 +17,11 @@ const { componentName: W, create: Y } = z("menu"), q = Y({
|
|
|
16
17
|
},
|
|
17
18
|
overlay: {
|
|
18
19
|
type: Boolean,
|
|
19
|
-
default:
|
|
20
|
+
default: true
|
|
20
21
|
},
|
|
21
22
|
lockScroll: {
|
|
22
23
|
type: Boolean,
|
|
23
|
-
default:
|
|
24
|
+
default: true
|
|
24
25
|
},
|
|
25
26
|
duration: {
|
|
26
27
|
type: [Number, String],
|
|
@@ -28,7 +29,7 @@ const { componentName: W, create: Y } = z("menu"), q = Y({
|
|
|
28
29
|
},
|
|
29
30
|
closeOnClickOverlay: {
|
|
30
31
|
type: Boolean,
|
|
31
|
-
default:
|
|
32
|
+
default: true
|
|
32
33
|
},
|
|
33
34
|
direction: {
|
|
34
35
|
type: String,
|
|
@@ -36,108 +37,162 @@ const { componentName: W, create: Y } = z("menu"), q = Y({
|
|
|
36
37
|
},
|
|
37
38
|
scrollFixed: {
|
|
38
39
|
type: [Boolean, String, Number],
|
|
39
|
-
default:
|
|
40
|
+
default: false
|
|
40
41
|
},
|
|
41
42
|
titleClass: [String]
|
|
42
43
|
},
|
|
43
|
-
setup(
|
|
44
|
-
const
|
|
45
|
-
|
|
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
|
+
};
|
|
46
83
|
return {
|
|
47
|
-
children:
|
|
48
|
-
linkChildren:
|
|
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
|
-
);
|
|
70
|
-
}
|
|
84
|
+
children: publicChildren,
|
|
85
|
+
linkChildren: linkChildren2
|
|
71
86
|
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
};
|
|
88
|
+
const { children, linkChildren } = useChildren();
|
|
89
|
+
const opened = computed(() => children.some((item) => item.state.showWrapper));
|
|
90
|
+
const classes = computed(() => {
|
|
91
|
+
const prefixCls = componentName;
|
|
92
|
+
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;
|
|
104
|
+
}
|
|
79
105
|
}
|
|
80
106
|
};
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
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
|
+
}
|
|
85
116
|
});
|
|
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;
|
|
93
117
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const { scrollFixed
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
107
156
|
};
|
|
108
157
|
}
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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)
|
|
114
167
|
}, [
|
|
115
|
-
|
|
116
|
-
class:
|
|
168
|
+
createElementVNode("view", {
|
|
169
|
+
class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
|
|
117
170
|
ref: "barRef"
|
|
118
171
|
}, [
|
|
119
|
-
(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
p("view", {
|
|
126
|
-
class: u(["nut-menu__title", o.getClasses(n.state.showPopup)])
|
|
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 : "" })
|
|
127
178
|
}, [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
+
])
|
|
132
187
|
])
|
|
133
|
-
])
|
|
134
|
-
],
|
|
135
|
-
|
|
188
|
+
], 2)
|
|
189
|
+
], 14, _hoisted_1);
|
|
190
|
+
}), 128))
|
|
136
191
|
], 2),
|
|
137
|
-
|
|
192
|
+
renderSlot(_ctx.$slots, "default")
|
|
138
193
|
], 2);
|
|
139
194
|
}
|
|
140
|
-
const
|
|
195
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
141
196
|
export {
|
|
142
|
-
|
|
197
|
+
index as default
|
|
143
198
|
};
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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";
|
|
18
25
|
import "../locale/lang";
|
|
19
26
|
import "./Overlay.js";
|
|
20
|
-
const { create
|
|
27
|
+
const { create } = createComponent("menu-item");
|
|
28
|
+
const _sfc_main = create({
|
|
21
29
|
props: {
|
|
22
30
|
title: String,
|
|
23
31
|
options: {
|
|
@@ -26,7 +34,7 @@ const { create: X } = M("menu-item"), Y = X({
|
|
|
26
34
|
},
|
|
27
35
|
disabled: {
|
|
28
36
|
type: Boolean,
|
|
29
|
-
default:
|
|
37
|
+
default: false
|
|
30
38
|
},
|
|
31
39
|
modelValue: null,
|
|
32
40
|
cols: {
|
|
@@ -37,118 +45,155 @@ const { create: X } = M("menu-item"), Y = X({
|
|
|
37
45
|
inactiveTitleClass: String
|
|
38
46
|
},
|
|
39
47
|
components: {
|
|
40
|
-
[
|
|
41
|
-
Check
|
|
48
|
+
[Popup.name]: Popup,
|
|
49
|
+
Check
|
|
42
50
|
},
|
|
43
51
|
emits: ["update:modelValue", "change", "open", "close"],
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
46
|
-
showPopup:
|
|
47
|
-
showWrapper:
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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 };
|
|
55
67
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
+
};
|
|
63
76
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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");
|
|
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" });
|
|
87
83
|
}
|
|
84
|
+
});
|
|
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
|
+
return {
|
|
119
|
+
style,
|
|
120
|
+
placeholderElementStyle,
|
|
121
|
+
renderTitle,
|
|
122
|
+
state,
|
|
123
|
+
parent,
|
|
124
|
+
toggle,
|
|
125
|
+
onClick,
|
|
126
|
+
handleClose,
|
|
127
|
+
handleClickOutside
|
|
88
128
|
};
|
|
89
129
|
}
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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", {
|
|
94
137
|
class: "nut-menu-item",
|
|
95
|
-
style:
|
|
138
|
+
style: normalizeStyle(_ctx.style)
|
|
96
139
|
}, [
|
|
97
|
-
|
|
98
|
-
onClick:
|
|
140
|
+
withDirectives(createElementVNode("div", {
|
|
141
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
|
|
99
142
|
class: "nut-menu-item-placeholder-element",
|
|
100
|
-
style:
|
|
143
|
+
style: normalizeStyle(_ctx.placeholderElementStyle)
|
|
101
144
|
}, null, 4), [
|
|
102
|
-
[
|
|
145
|
+
[vShow, _ctx.state.showPopup]
|
|
103
146
|
]),
|
|
104
|
-
|
|
147
|
+
createVNode(_component_nut_popup, mergeProps({
|
|
105
148
|
style: { position: "absolute" },
|
|
106
149
|
overlayStyle: { position: "absolute" }
|
|
107
|
-
},
|
|
108
|
-
visible:
|
|
109
|
-
"onUpdate:visible":
|
|
110
|
-
position:
|
|
111
|
-
duration:
|
|
112
|
-
"destroy-on-close":
|
|
113
|
-
overlay:
|
|
114
|
-
onClosed:
|
|
115
|
-
lockScroll:
|
|
116
|
-
teleportDisable:
|
|
117
|
-
"close-on-click-overlay":
|
|
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
|
|
118
161
|
}), {
|
|
119
|
-
default:
|
|
120
|
-
|
|
121
|
-
(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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]])
|
|
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)
|
|
130
170
|
}, [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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")
|
|
143
188
|
])
|
|
144
189
|
]),
|
|
145
190
|
_: 3
|
|
146
191
|
}, 16, ["visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
|
|
147
192
|
], 4)), [
|
|
148
|
-
[
|
|
193
|
+
[vShow, _ctx.state.showWrapper]
|
|
149
194
|
]);
|
|
150
195
|
}
|
|
151
|
-
const
|
|
196
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
152
197
|
export {
|
|
153
|
-
|
|
198
|
+
index as default
|
|
154
199
|
};
|