@nutui/nutui 3.1.22 → 3.1.23-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nutui.es.js +20418 -4214
- package/dist/nutui.umd.js +20524 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +460 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +41 -41
- package/dist/styles/themes/jdb.scss +41 -41
- package/dist/styles/themes/jdt.scss +41 -41
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
- package/dist/types/__VUE/address/index.vue.d.ts +7 -7
- package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
- package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +8 -8
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
- package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
- package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
- package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
- package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
- package/dist/types/__VUE/image/index.vue.d.ts +4 -4
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/input/index.vue.d.ts +4 -4
- package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
- package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
- package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
- package/dist/types/__VUE/popup/index.vue.d.ts +6 -6
- package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +4 -4
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
- package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
- package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,46 +1,165 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { computed
|
|
7
|
-
import { c as
|
|
8
|
-
import { p as
|
|
9
|
-
import { _ as
|
|
6
|
+
import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
10
|
import "../locale/lang";
|
|
11
|
-
const { componentName
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
11
|
+
const { componentName, create } = createComponent("inputnumber");
|
|
12
|
+
const _sfc_main = create({
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: [Number, String],
|
|
16
|
+
default: 0
|
|
17
|
+
},
|
|
18
|
+
inputWidth: {
|
|
19
|
+
type: [Number, String],
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
buttonSize: {
|
|
23
|
+
type: [Number, String],
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
min: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: 1
|
|
29
|
+
},
|
|
30
|
+
max: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: 9999
|
|
33
|
+
},
|
|
34
|
+
step: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: 1
|
|
37
|
+
},
|
|
38
|
+
decimalPlaces: {
|
|
39
|
+
type: [Number, String],
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
readonly: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: ["update:modelValue", "change", "blur", "focus", "reduce", "add", "overlimit"],
|
|
52
|
+
setup(props, { emit }) {
|
|
53
|
+
const classes = computed(() => {
|
|
54
|
+
const prefixCls = componentName;
|
|
55
|
+
return {
|
|
56
|
+
[prefixCls]: true,
|
|
57
|
+
[`${prefixCls}--disabled`]: props.disabled
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
const fixedDecimalPlaces = (v) => {
|
|
61
|
+
return Number(v).toFixed(Number(props.decimalPlaces));
|
|
62
|
+
};
|
|
63
|
+
const change = (event) => {
|
|
64
|
+
const input = event.target;
|
|
65
|
+
emit("update:modelValue", input.valueAsNumber, event);
|
|
66
|
+
};
|
|
67
|
+
const emitChange = (value, event) => {
|
|
68
|
+
let output_value = fixedDecimalPlaces(value);
|
|
69
|
+
emit("update:modelValue", output_value, event);
|
|
70
|
+
emit("change", output_value, event);
|
|
71
|
+
};
|
|
72
|
+
const addAllow = (value = Number(props.modelValue)) => {
|
|
73
|
+
return value < Number(props.max) && !props.disabled;
|
|
74
|
+
};
|
|
75
|
+
const reduceAllow = (value = Number(props.modelValue)) => {
|
|
76
|
+
return value > Number(props.min) && !props.disabled;
|
|
77
|
+
};
|
|
78
|
+
const reduce = (event) => {
|
|
79
|
+
emit("reduce", event);
|
|
80
|
+
if (reduceAllow()) {
|
|
81
|
+
let output_value = Number(props.modelValue) - Number(props.step);
|
|
82
|
+
emitChange(output_value, event);
|
|
83
|
+
} else {
|
|
84
|
+
emit("overlimit", event, "reduce");
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const add = (event) => {
|
|
88
|
+
emit("add", event);
|
|
89
|
+
if (addAllow()) {
|
|
90
|
+
let output_value = Number(props.modelValue) + Number(props.step);
|
|
91
|
+
emitChange(output_value, event);
|
|
92
|
+
} else {
|
|
93
|
+
emit("overlimit", event, "add");
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const focus = (event) => {
|
|
97
|
+
if (props.disabled)
|
|
98
|
+
return;
|
|
99
|
+
if (props.readonly)
|
|
100
|
+
return;
|
|
101
|
+
emit("focus", event);
|
|
102
|
+
};
|
|
103
|
+
const blur = (event) => {
|
|
104
|
+
if (props.disabled)
|
|
105
|
+
return;
|
|
106
|
+
if (props.readonly)
|
|
107
|
+
return;
|
|
108
|
+
const input = event.target;
|
|
109
|
+
let value = input.valueAsNumber;
|
|
110
|
+
if (value < Number(props.min)) {
|
|
111
|
+
value = Number(props.min);
|
|
112
|
+
} else if (value > Number(props.max)) {
|
|
113
|
+
value = Number(props.max);
|
|
114
|
+
}
|
|
115
|
+
emitChange(value, event);
|
|
116
|
+
emit("blur", event);
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
classes,
|
|
120
|
+
change,
|
|
121
|
+
blur,
|
|
122
|
+
focus,
|
|
123
|
+
add,
|
|
124
|
+
addAllow,
|
|
125
|
+
reduce,
|
|
126
|
+
reduceAllow,
|
|
127
|
+
pxCheck
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const _hoisted_1 = ["min", "max", "disabled", "readonly", "value"];
|
|
132
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
133
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
134
|
+
return openBlock(), createElementBlock("view", {
|
|
135
|
+
class: normalizeClass(_ctx.classes),
|
|
136
|
+
style: normalizeStyle({ height: _ctx.pxCheck(_ctx.buttonSize) })
|
|
137
|
+
}, [
|
|
138
|
+
createVNode(_component_nut_icon, {
|
|
139
|
+
name: "minus",
|
|
140
|
+
class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.reduceAllow() }]),
|
|
141
|
+
size: _ctx.buttonSize,
|
|
142
|
+
onClick: _ctx.reduce
|
|
143
|
+
}, null, 8, ["class", "size", "onClick"]),
|
|
144
|
+
createElementVNode("input", {
|
|
145
|
+
type: "number",
|
|
146
|
+
min: _ctx.min,
|
|
147
|
+
max: _ctx.max,
|
|
148
|
+
style: normalizeStyle({ width: _ctx.pxCheck(_ctx.inputWidth) }),
|
|
149
|
+
disabled: _ctx.disabled,
|
|
150
|
+
readonly: _ctx.readonly,
|
|
151
|
+
value: _ctx.modelValue,
|
|
152
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
|
|
153
|
+
onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
|
|
154
|
+
onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
|
|
155
|
+
}, null, 44, _hoisted_1),
|
|
156
|
+
createVNode(_component_nut_icon, {
|
|
157
|
+
name: "plus",
|
|
158
|
+
class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.addAllow() }]),
|
|
159
|
+
size: _ctx.buttonSize,
|
|
160
|
+
onClick: _ctx.add
|
|
161
|
+
}, null, 8, ["class", "size", "onClick"])
|
|
162
|
+
], 6);
|
|
163
|
+
}
|
|
164
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
165
|
+
export { index as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { c as
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
7
|
import "vue";
|
|
8
8
|
import "../locale/lang";
|
|
9
|
-
const { create
|
|
10
|
-
|
|
9
|
+
const { create } = createComponent("layout");
|
|
10
|
+
const _sfc_main = create({});
|
|
11
|
+
export { _sfc_main as default };
|
|
@@ -1,23 +1,111 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { componentName
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
10
|
+
const { componentName, create } = createComponent("list");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
height: {
|
|
14
|
+
type: [Number],
|
|
15
|
+
default: 50
|
|
16
|
+
},
|
|
17
|
+
listData: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
containerHeight: {
|
|
24
|
+
type: [Number],
|
|
25
|
+
default: document.documentElement.clientHeight || document.body.clientHeight || 667
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["scroll", "scroll-bottom"],
|
|
29
|
+
setup(props, { emit }) {
|
|
30
|
+
const list = ref(null);
|
|
31
|
+
const state = reactive({
|
|
32
|
+
startOffset: 0,
|
|
33
|
+
start: 0,
|
|
34
|
+
list: props.listData.slice()
|
|
35
|
+
});
|
|
36
|
+
const visibleCount = computed(() => {
|
|
37
|
+
return Math.ceil(props.containerHeight / props.height);
|
|
38
|
+
});
|
|
39
|
+
const end = computed(() => {
|
|
40
|
+
return state.start + visibleCount.value;
|
|
41
|
+
});
|
|
42
|
+
const getTransform = computed(() => {
|
|
43
|
+
return `translate3d(0, ${state.startOffset}px, 0)`;
|
|
44
|
+
});
|
|
45
|
+
const classes = computed(() => {
|
|
46
|
+
const prefixCls = componentName;
|
|
47
|
+
return {
|
|
48
|
+
[prefixCls]: true
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const listHeight = computed(() => {
|
|
52
|
+
return state.list.length * props.height;
|
|
53
|
+
});
|
|
54
|
+
const visibleData = computed(() => {
|
|
55
|
+
return state.list.slice(state.start, Math.min(end.value, state.list.length));
|
|
56
|
+
});
|
|
57
|
+
const handleScrollEvent = () => {
|
|
58
|
+
var _a;
|
|
59
|
+
const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
|
|
60
|
+
state.start = Math.floor(scrollTop / props.height);
|
|
61
|
+
if (end.value > state.list.length) {
|
|
62
|
+
emit("scroll");
|
|
63
|
+
emit("scroll-bottom");
|
|
64
|
+
}
|
|
65
|
+
state.startOffset = scrollTop - scrollTop % props.height;
|
|
66
|
+
};
|
|
67
|
+
watch(() => props.listData, () => {
|
|
68
|
+
state.list = props.listData.slice();
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
...toRefs(state),
|
|
72
|
+
list,
|
|
73
|
+
getTransform,
|
|
74
|
+
listHeight,
|
|
75
|
+
visibleData,
|
|
76
|
+
classes,
|
|
77
|
+
handleScrollEvent
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
82
|
+
return openBlock(), createElementBlock("view", {
|
|
83
|
+
class: normalizeClass(_ctx.classes),
|
|
84
|
+
onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
|
|
85
|
+
ref: "list"
|
|
86
|
+
}, [
|
|
87
|
+
createElementVNode("div", {
|
|
88
|
+
class: "nut-list-phantom",
|
|
89
|
+
style: normalizeStyle({ height: _ctx.listHeight + "px" })
|
|
90
|
+
}, null, 4),
|
|
91
|
+
createElementVNode("div", {
|
|
92
|
+
class: "nut-list-container",
|
|
93
|
+
style: normalizeStyle({ transform: _ctx.getTransform })
|
|
94
|
+
}, [
|
|
95
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
|
|
96
|
+
return openBlock(), createElementBlock("div", {
|
|
97
|
+
class: "nut-list-item",
|
|
98
|
+
style: normalizeStyle({ height: _ctx.height + "px" }),
|
|
99
|
+
key: item
|
|
100
|
+
}, [
|
|
101
|
+
renderSlot(_ctx.$slots, "default", {
|
|
102
|
+
item,
|
|
103
|
+
index: index2
|
|
104
|
+
})
|
|
105
|
+
], 4);
|
|
106
|
+
}), 128))
|
|
107
|
+
], 4)
|
|
108
|
+
], 34);
|
|
109
|
+
}
|
|
110
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
111
|
+
export { index as default };
|
|
@@ -1,51 +1,175 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref
|
|
7
|
-
import { c as
|
|
8
|
-
import { u as
|
|
9
|
-
import { _ as
|
|
6
|
+
import { ref, computed, onMounted, onUnmounted, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, createVNode, renderSlot } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { u as useRect } from "./index2.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
10
|
import "../locale/lang";
|
|
11
|
-
const { componentName
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
const { componentName, create } = createComponent("menu");
|
|
12
|
+
const _sfc_main = create({
|
|
13
|
+
props: {
|
|
14
|
+
activeColor: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
overlay: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
lockScroll: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
duration: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: 0
|
|
29
|
+
},
|
|
30
|
+
closeOnClickOverlay: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
direction: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "down"
|
|
37
|
+
},
|
|
38
|
+
scrollFixed: {
|
|
39
|
+
type: [Boolean, String, Number],
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
titleClass: [String]
|
|
43
|
+
},
|
|
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
|
+
provide("menuParent", Object.assign({
|
|
59
|
+
link,
|
|
60
|
+
children: publicChildren,
|
|
61
|
+
internalChildren
|
|
62
|
+
}, value));
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
children: publicChildren,
|
|
66
|
+
linkChildren: linkChildren2
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const { children, linkChildren } = useChildren();
|
|
70
|
+
const opened = computed(() => children.some((item) => item.state.showWrapper));
|
|
71
|
+
const classes = computed(() => {
|
|
72
|
+
const prefixCls = componentName;
|
|
73
|
+
return {
|
|
74
|
+
[prefixCls]: true,
|
|
75
|
+
"scroll-fixed": isScrollFixed.value
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
const updateOffset = () => {
|
|
79
|
+
if (barRef.value) {
|
|
80
|
+
const rect = useRect(barRef);
|
|
81
|
+
if (props.direction === "down") {
|
|
82
|
+
offset.value = rect.bottom;
|
|
83
|
+
} else {
|
|
84
|
+
offset.value = window.innerHeight - rect.top;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
linkChildren({ props, offset });
|
|
89
|
+
const toggleItem = (active) => {
|
|
90
|
+
children.forEach((item, index2) => {
|
|
91
|
+
if (index2 === active) {
|
|
92
|
+
updateOffset();
|
|
93
|
+
item.toggle();
|
|
94
|
+
} else if (item.state.showPopup) {
|
|
95
|
+
item.toggle(false, { immediate: true });
|
|
38
96
|
}
|
|
39
|
-
})
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const getScrollTop = (el) => {
|
|
100
|
+
return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
|
|
101
|
+
};
|
|
102
|
+
const onScroll = () => {
|
|
103
|
+
const { scrollFixed } = props;
|
|
104
|
+
const scrollTop = getScrollTop(window);
|
|
105
|
+
isScrollFixed.value = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
106
|
+
};
|
|
107
|
+
const getClasses = (showPopup) => {
|
|
108
|
+
let str = "";
|
|
109
|
+
const { titleClass } = props;
|
|
110
|
+
if (showPopup) {
|
|
111
|
+
str += "active";
|
|
112
|
+
}
|
|
113
|
+
if (titleClass) {
|
|
114
|
+
str += ` ${titleClass}`;
|
|
115
|
+
}
|
|
116
|
+
return str;
|
|
117
|
+
};
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
const { scrollFixed } = props;
|
|
120
|
+
if (scrollFixed) {
|
|
121
|
+
window.addEventListener("scroll", onScroll);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
onUnmounted(() => {
|
|
125
|
+
const { scrollFixed } = props;
|
|
126
|
+
if (scrollFixed) {
|
|
127
|
+
window.removeEventListener("scroll", onScroll);
|
|
128
|
+
}
|
|
40
129
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
130
|
+
return {
|
|
131
|
+
toggleItem,
|
|
132
|
+
children,
|
|
133
|
+
opened,
|
|
134
|
+
classes,
|
|
135
|
+
barRef,
|
|
136
|
+
getClasses
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const _hoisted_1 = ["onClick"];
|
|
141
|
+
const _hoisted_2 = { class: "nut-menu__title-text" };
|
|
142
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
143
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
144
|
+
return openBlock(), createElementBlock("view", {
|
|
145
|
+
class: normalizeClass(_ctx.classes)
|
|
146
|
+
}, [
|
|
147
|
+
createElementVNode("view", {
|
|
148
|
+
class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
|
|
149
|
+
ref: "barRef"
|
|
150
|
+
}, [
|
|
151
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
|
|
152
|
+
return openBlock(), createElementBlock("view", {
|
|
153
|
+
key: index2,
|
|
154
|
+
class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
|
|
155
|
+
onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
|
|
156
|
+
style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
|
|
157
|
+
}, [
|
|
158
|
+
createElementVNode("view", {
|
|
159
|
+
class: normalizeClass(["nut-menu__title", _ctx.getClasses(item.state.showPopup)])
|
|
160
|
+
}, [
|
|
161
|
+
createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
|
|
162
|
+
createVNode(_component_nut_icon, {
|
|
163
|
+
name: item.titleIcon || (_ctx.direction === "up" ? "arrow-up" : "down-arrow"),
|
|
164
|
+
size: "10",
|
|
165
|
+
class: "nut-menu__title-icon"
|
|
166
|
+
}, null, 8, ["name"])
|
|
167
|
+
], 2)
|
|
168
|
+
], 14, _hoisted_1);
|
|
169
|
+
}), 128))
|
|
170
|
+
], 2),
|
|
171
|
+
renderSlot(_ctx.$slots, "default")
|
|
172
|
+
], 2);
|
|
173
|
+
}
|
|
174
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
175
|
+
export { index as default };
|