@nutui/nutui 4.0.11 → 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 +2 -2
- 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 +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- 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,107 +1,165 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var r = (l) => {
|
|
15
|
-
try {
|
|
16
|
-
a(n.next(l));
|
|
17
|
-
} catch (c) {
|
|
18
|
-
m(c);
|
|
19
|
-
}
|
|
20
|
-
}, h = (l) => {
|
|
21
|
-
try {
|
|
22
|
-
a(n.throw(l));
|
|
23
|
-
} catch (c) {
|
|
24
|
-
m(c);
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
25
14
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __publicField = (obj, key, value) => {
|
|
18
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
var __async = (__this, __arguments, generator) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
var fulfilled = (value) => {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var rejected = (value) => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.throw(value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
import { c as createComponent, T as TypeOfFun } from "./component-81a4c1d0.js";
|
|
42
|
+
import { ref, onMounted, reactive, provide, computed, watch, onActivated, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode, createVNode, toDisplayString } from "vue";
|
|
43
|
+
import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
|
|
44
|
+
import { u as useRect } from "./index-29892cda.js";
|
|
45
|
+
import { r as requestAniFrame } from "./raf-729dad54.js";
|
|
46
|
+
import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_lang-cc5c4086.js";
|
|
47
|
+
import { JoySmile } from "@nutui/icons-vue";
|
|
48
|
+
import { u as useTouch } from "./index-7a7385e4.js";
|
|
49
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
38
50
|
import "../locale/lang";
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const useTabContentTouch = (props, tabMethods, taro, useTaroRect) => {
|
|
52
|
+
const tabsContentRef = ref();
|
|
53
|
+
const tabsContentRefRect = ref({ width: 0, height: 0 });
|
|
54
|
+
const initTaroWidth = () => __async(void 0, null, function* () {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (taro && taro.getEnv() !== taro.ENV_TYPE.WEB) {
|
|
57
|
+
let rect = yield useTaroRect(tabsContentRef, taro);
|
|
58
|
+
tabsContentRefRect.value.width = rect.width || 0;
|
|
59
|
+
tabsContentRefRect.value.height = rect.height || 0;
|
|
60
|
+
} else {
|
|
61
|
+
tabsContentRefRect.value.width = ((_a = tabsContentRef.value) == null ? void 0 : _a.clientWidth) || 0;
|
|
62
|
+
tabsContentRefRect.value.height = ((_b = tabsContentRef.value) == null ? void 0 : _b.clientHeight) || 0;
|
|
63
|
+
}
|
|
47
64
|
});
|
|
48
|
-
|
|
65
|
+
onMounted(() => {
|
|
49
66
|
setTimeout(() => {
|
|
50
|
-
|
|
67
|
+
initTaroWidth();
|
|
51
68
|
}, 100);
|
|
52
69
|
});
|
|
53
|
-
const
|
|
70
|
+
const touchState = reactive({
|
|
54
71
|
offset: 0,
|
|
55
|
-
moving:
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
moving: false
|
|
73
|
+
});
|
|
74
|
+
const touch = useTouch();
|
|
75
|
+
let position = "";
|
|
76
|
+
const setoffset = (deltaX, deltaY) => {
|
|
77
|
+
var _a;
|
|
78
|
+
let offset = deltaX;
|
|
79
|
+
if (props.direction == "horizontal") {
|
|
80
|
+
position = deltaX > 0 ? "right" : "left";
|
|
81
|
+
offset = Math.abs(offset) / tabsContentRefRect.value.width * 100;
|
|
82
|
+
} else {
|
|
83
|
+
position = deltaY > 0 ? "bottom" : "top";
|
|
84
|
+
offset = deltaY;
|
|
85
|
+
offset = Math.abs(offset) / ((_a = tabsContentRefRect.value) == null ? void 0 : _a.height) * 100;
|
|
86
|
+
}
|
|
87
|
+
if (offset > 85) {
|
|
88
|
+
offset = 85;
|
|
89
|
+
}
|
|
90
|
+
switch (position) {
|
|
62
91
|
case "left":
|
|
63
92
|
case "top":
|
|
64
|
-
|
|
93
|
+
if (tabMethods.isEnd()) {
|
|
94
|
+
offset = 0;
|
|
95
|
+
touchState.moving = false;
|
|
96
|
+
}
|
|
65
97
|
break;
|
|
66
98
|
case "right":
|
|
67
99
|
case "bottom":
|
|
68
|
-
|
|
100
|
+
offset = -offset;
|
|
101
|
+
if (tabMethods.isBegin()) {
|
|
102
|
+
offset = 0;
|
|
103
|
+
touchState.moving = false;
|
|
104
|
+
}
|
|
69
105
|
break;
|
|
70
106
|
}
|
|
71
|
-
|
|
107
|
+
touchState.offset = offset;
|
|
72
108
|
};
|
|
73
|
-
|
|
74
|
-
onTouchStart(
|
|
75
|
-
|
|
109
|
+
const touchMethods = {
|
|
110
|
+
onTouchStart(event) {
|
|
111
|
+
if (!props.swipeable)
|
|
112
|
+
return;
|
|
113
|
+
touch.start(event);
|
|
76
114
|
},
|
|
77
|
-
onTouchMove(
|
|
78
|
-
|
|
115
|
+
onTouchMove(event) {
|
|
116
|
+
if (!props.swipeable)
|
|
117
|
+
return;
|
|
118
|
+
touch.move(event);
|
|
119
|
+
touchState.moving = true;
|
|
120
|
+
setoffset(touch.deltaX.value, touch.deltaY.value);
|
|
121
|
+
if (props.direction == "horizontal" && touch.isHorizontal()) {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
}
|
|
125
|
+
if (props.direction == "vertical" && touch.isVertical()) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
event.stopPropagation();
|
|
128
|
+
}
|
|
79
129
|
},
|
|
80
130
|
onTouchEnd() {
|
|
81
|
-
if (
|
|
82
|
-
|
|
131
|
+
if (touchState.moving) {
|
|
132
|
+
touchState.moving = false;
|
|
133
|
+
switch (position) {
|
|
83
134
|
case "left":
|
|
84
135
|
case "top":
|
|
85
|
-
|
|
136
|
+
if (touchState.offset > 35) {
|
|
137
|
+
tabMethods.next();
|
|
138
|
+
}
|
|
86
139
|
break;
|
|
87
140
|
case "right":
|
|
88
141
|
case "bottom":
|
|
89
|
-
|
|
142
|
+
if (touchState.offset < -35) {
|
|
143
|
+
tabMethods.prev();
|
|
144
|
+
}
|
|
90
145
|
break;
|
|
91
146
|
}
|
|
147
|
+
}
|
|
92
148
|
}
|
|
93
|
-
}
|
|
149
|
+
};
|
|
150
|
+
return { touchMethods, touchState, tabsContentRef };
|
|
94
151
|
};
|
|
95
|
-
class
|
|
152
|
+
class Title {
|
|
96
153
|
constructor() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
154
|
+
__publicField(this, "title", "");
|
|
155
|
+
__publicField(this, "titleSlot");
|
|
156
|
+
__publicField(this, "paneKey", "");
|
|
157
|
+
__publicField(this, "disabled", false);
|
|
101
158
|
}
|
|
102
159
|
}
|
|
103
|
-
const { create
|
|
104
|
-
|
|
160
|
+
const { create } = createComponent("tabs");
|
|
161
|
+
const _sfc_main = create({
|
|
162
|
+
components: { [_sfc_main$1.name]: _sfc_main$1, JoySmile },
|
|
105
163
|
props: {
|
|
106
164
|
modelValue: {
|
|
107
165
|
type: [String, Number],
|
|
@@ -127,19 +185,19 @@ const { create: Re } = pe("tabs"), Be = Re({
|
|
|
127
185
|
},
|
|
128
186
|
titleScroll: {
|
|
129
187
|
type: Boolean,
|
|
130
|
-
default:
|
|
188
|
+
default: false
|
|
131
189
|
},
|
|
132
190
|
ellipsis: {
|
|
133
191
|
type: Boolean,
|
|
134
|
-
default:
|
|
192
|
+
default: true
|
|
135
193
|
},
|
|
136
194
|
swipeable: {
|
|
137
195
|
type: Boolean,
|
|
138
|
-
default:
|
|
196
|
+
default: false
|
|
139
197
|
},
|
|
140
198
|
autoHeight: {
|
|
141
199
|
type: Boolean,
|
|
142
|
-
default:
|
|
200
|
+
default: false
|
|
143
201
|
},
|
|
144
202
|
background: {
|
|
145
203
|
type: String,
|
|
@@ -155,7 +213,7 @@ const { create: Re } = pe("tabs"), Be = Re({
|
|
|
155
213
|
},
|
|
156
214
|
sticky: {
|
|
157
215
|
type: Boolean,
|
|
158
|
-
default:
|
|
216
|
+
default: false
|
|
159
217
|
},
|
|
160
218
|
top: {
|
|
161
219
|
type: Number,
|
|
@@ -163,217 +221,307 @@ const { create: Re } = pe("tabs"), Be = Re({
|
|
|
163
221
|
}
|
|
164
222
|
},
|
|
165
223
|
emits: ["update:modelValue", "click", "change"],
|
|
166
|
-
setup(
|
|
167
|
-
const
|
|
168
|
-
let
|
|
169
|
-
|
|
170
|
-
activeKey:
|
|
171
|
-
autoHeight:
|
|
172
|
-
animatedTime:
|
|
224
|
+
setup(props, { emit, slots }) {
|
|
225
|
+
const container = ref(null);
|
|
226
|
+
let stickyFixed;
|
|
227
|
+
provide("tabsOpiton", {
|
|
228
|
+
activeKey: computed(() => props.modelValue || "0"),
|
|
229
|
+
autoHeight: computed(() => props.autoHeight),
|
|
230
|
+
animatedTime: computed(() => props.animatedTime)
|
|
173
231
|
});
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
232
|
+
const titles = ref([]);
|
|
233
|
+
const renderTitles = (vnodes) => {
|
|
234
|
+
vnodes.forEach((vnode, index) => {
|
|
235
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
236
|
+
let type = vnode.type;
|
|
237
|
+
type = type.name || type;
|
|
238
|
+
if (type == "nut-tab-pane") {
|
|
239
|
+
let title = new Title();
|
|
240
|
+
if (((_a = vnode.props) == null ? void 0 : _a.title) || ((_b = vnode.props) == null ? void 0 : _b["pane-key"]) || ((_c = vnode.props) == null ? void 0 : _c["paneKey"])) {
|
|
241
|
+
let paneKeyType = TypeOfFun((_d = vnode.props) == null ? void 0 : _d["pane-key"]);
|
|
242
|
+
let paneIndex = paneKeyType == "number" || paneKeyType == "string" ? String((_e = vnode.props) == null ? void 0 : _e["pane-key"]) : null;
|
|
243
|
+
let camelPaneKeyType = TypeOfFun((_f = vnode.props) == null ? void 0 : _f["paneKey"]);
|
|
244
|
+
let camelPaneIndex = camelPaneKeyType == "number" || camelPaneKeyType == "string" ? String((_g = vnode.props) == null ? void 0 : _g["paneKey"]) : null;
|
|
245
|
+
title.title = (_h = vnode.props) == null ? void 0 : _h.title;
|
|
246
|
+
title.paneKey = paneIndex || camelPaneIndex || String(index);
|
|
247
|
+
title.disabled = (_i = vnode.props) == null ? void 0 : _i.disabled;
|
|
183
248
|
}
|
|
184
|
-
|
|
249
|
+
titles.value.push(title);
|
|
185
250
|
} else {
|
|
186
|
-
if (
|
|
251
|
+
if (vnode.children == " ") {
|
|
187
252
|
return;
|
|
188
|
-
|
|
253
|
+
}
|
|
254
|
+
renderTitles(vnode.children);
|
|
189
255
|
}
|
|
190
256
|
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
257
|
+
};
|
|
258
|
+
const currentIndex = ref(props.modelValue || 0);
|
|
259
|
+
const findTabsIndex = (value) => {
|
|
260
|
+
let index = titles.value.findIndex((item) => item.paneKey == value);
|
|
261
|
+
if (titles.value.length == 0)
|
|
262
|
+
;
|
|
263
|
+
else if (index == -1)
|
|
264
|
+
;
|
|
265
|
+
else {
|
|
266
|
+
currentIndex.value = index;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const getScrollY = computed(() => {
|
|
270
|
+
return props.titleScroll && props.direction === "vertical";
|
|
271
|
+
});
|
|
272
|
+
const navRef = ref();
|
|
273
|
+
const titleRef = ref([]);
|
|
274
|
+
const scrollIntoView = (immediate) => {
|
|
275
|
+
const nav = navRef.value;
|
|
276
|
+
const _titles = titleRef.value;
|
|
277
|
+
if (!nav || !_titles || !_titles[currentIndex.value]) {
|
|
197
278
|
return;
|
|
198
|
-
const d = f[a.value];
|
|
199
|
-
let g = 0;
|
|
200
|
-
e.direction === "vertical" ? g = d.offsetTop - o.offsetTop + 10 - (o.offsetHeight - d.offsetHeight) / 2 : g = d.offsetLeft - (o.offsetWidth - d.offsetWidth) / 2, k(o, g, t ? 0 : 0.3, e.direction);
|
|
201
|
-
}, k = (t, o, f, d) => {
|
|
202
|
-
let g = 0;
|
|
203
|
-
const C = d === "horizontal" ? t.scrollLeft : t.scrollTop, E = f === 0 ? 1 : Math.round(f * 1e3 / 16);
|
|
204
|
-
function z() {
|
|
205
|
-
d === "horizontal" ? t.scrollLeft += (o - C) / E : t.scrollTop += (o - C) / E, ++g < E && Ve(z);
|
|
206
279
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
280
|
+
const title = _titles[currentIndex.value];
|
|
281
|
+
let to = 0;
|
|
282
|
+
if (props.direction === "vertical") {
|
|
283
|
+
const runTop = title.offsetTop - nav.offsetTop + 10;
|
|
284
|
+
to = runTop - (nav.offsetHeight - title.offsetHeight) / 2;
|
|
285
|
+
} else {
|
|
286
|
+
to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
|
|
287
|
+
}
|
|
288
|
+
scrollDirection(nav, to, immediate ? 0 : 0.3, props.direction);
|
|
289
|
+
};
|
|
290
|
+
const scrollDirection = (nav, to, duration, direction) => {
|
|
291
|
+
let count = 0;
|
|
292
|
+
const from = direction === "horizontal" ? nav.scrollLeft : nav.scrollTop;
|
|
293
|
+
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
|
294
|
+
function animate() {
|
|
295
|
+
if (direction === "horizontal") {
|
|
296
|
+
nav.scrollLeft += (to - from) / frames;
|
|
297
|
+
} else {
|
|
298
|
+
nav.scrollTop += (to - from) / frames;
|
|
299
|
+
}
|
|
300
|
+
if (++count < frames) {
|
|
301
|
+
requestAniFrame(animate);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
animate();
|
|
305
|
+
};
|
|
306
|
+
const init = (vnodes = ((_a) => (_a = slots.default) == null ? void 0 : _a.call(slots))()) => {
|
|
307
|
+
titles.value = [];
|
|
308
|
+
vnodes = vnodes == null ? void 0 : vnodes.filter((item) => typeof item.children !== "string");
|
|
309
|
+
if (vnodes && vnodes.length) {
|
|
310
|
+
renderTitles(vnodes);
|
|
311
|
+
}
|
|
312
|
+
findTabsIndex(props.modelValue);
|
|
313
|
+
nextTick(() => {
|
|
314
|
+
scrollIntoView();
|
|
211
315
|
});
|
|
212
|
-
}, R = (t) => {
|
|
213
|
-
m = t.fixed;
|
|
214
316
|
};
|
|
215
|
-
|
|
317
|
+
const onStickyScroll = (params) => {
|
|
318
|
+
stickyFixed = params.fixed;
|
|
319
|
+
};
|
|
320
|
+
watch(
|
|
216
321
|
() => {
|
|
217
|
-
var
|
|
218
|
-
return (
|
|
322
|
+
var _a;
|
|
323
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
219
324
|
},
|
|
220
|
-
(
|
|
221
|
-
|
|
325
|
+
(vnodes) => {
|
|
326
|
+
init(vnodes);
|
|
222
327
|
}
|
|
223
328
|
);
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
329
|
+
const getScrollTopRoot = () => {
|
|
330
|
+
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
331
|
+
};
|
|
332
|
+
watch(
|
|
333
|
+
() => props.modelValue,
|
|
334
|
+
(value) => {
|
|
335
|
+
findTabsIndex(value);
|
|
336
|
+
scrollIntoView();
|
|
337
|
+
if (stickyFixed) {
|
|
338
|
+
let top = useRect(container.value).top + getScrollTopRoot();
|
|
339
|
+
let value2 = Math.ceil(top - props.top);
|
|
230
340
|
window.scrollTo({
|
|
231
|
-
top:
|
|
341
|
+
top: value2,
|
|
232
342
|
behavior: "smooth"
|
|
233
343
|
});
|
|
234
344
|
}
|
|
235
345
|
}
|
|
236
|
-
)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
346
|
+
);
|
|
347
|
+
onMounted(init);
|
|
348
|
+
onActivated(init);
|
|
349
|
+
const tabMethods = {
|
|
350
|
+
isBegin: () => {
|
|
351
|
+
return currentIndex.value == 0;
|
|
352
|
+
},
|
|
353
|
+
isEnd: () => {
|
|
354
|
+
return currentIndex.value == titles.value.length - 1;
|
|
355
|
+
},
|
|
240
356
|
next: () => {
|
|
241
|
-
|
|
357
|
+
currentIndex.value += 1;
|
|
358
|
+
tabMethods.updateValue(titles.value[currentIndex.value]);
|
|
242
359
|
},
|
|
243
360
|
prev: () => {
|
|
244
|
-
|
|
361
|
+
currentIndex.value -= 1;
|
|
362
|
+
tabMethods.updateValue(titles.value[currentIndex.value]);
|
|
245
363
|
},
|
|
246
|
-
updateValue: (
|
|
247
|
-
|
|
364
|
+
updateValue: (item) => {
|
|
365
|
+
emit("update:modelValue", item.paneKey);
|
|
366
|
+
emit("change", item);
|
|
248
367
|
},
|
|
249
|
-
tabChange: (
|
|
250
|
-
|
|
368
|
+
tabChange: (item, index) => {
|
|
369
|
+
emit("click", item);
|
|
370
|
+
if (item.disabled || currentIndex.value == index) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
currentIndex.value = index;
|
|
374
|
+
tabMethods.updateValue(item);
|
|
251
375
|
},
|
|
252
|
-
setTabItemRef: (
|
|
253
|
-
|
|
376
|
+
setTabItemRef: (el, index) => {
|
|
377
|
+
titleRef.value[index] = el;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
const { tabsContentRef, touchState, touchMethods } = useTabContentTouch(props, tabMethods);
|
|
381
|
+
const contentStyle = computed(() => {
|
|
382
|
+
let offsetPercent = currentIndex.value * 100;
|
|
383
|
+
if (touchState.moving) {
|
|
384
|
+
offsetPercent += touchState.offset;
|
|
254
385
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
let o = {
|
|
259
|
-
transform: e.direction == "horizontal" ? `translate3d(-${t}%, 0, 0)` : `translate3d( 0,-${t}%, 0)`,
|
|
260
|
-
transitionDuration: A.moving ? void 0 : `${e.animatedTime}ms`
|
|
386
|
+
let style = {
|
|
387
|
+
transform: props.direction == "horizontal" ? `translate3d(-${offsetPercent}%, 0, 0)` : `translate3d( 0,-${offsetPercent}%, 0)`,
|
|
388
|
+
transitionDuration: touchState.moving ? void 0 : `${props.animatedTime}ms`
|
|
261
389
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
390
|
+
if (props.animatedTime == 0) {
|
|
391
|
+
style = {};
|
|
392
|
+
}
|
|
393
|
+
return style;
|
|
394
|
+
});
|
|
395
|
+
const tabsNavStyle = computed(() => {
|
|
396
|
+
return {
|
|
397
|
+
background: props.background
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
const tabsActiveStyle = computed(() => {
|
|
401
|
+
return {
|
|
402
|
+
color: props.type == "smile" ? props.color : "",
|
|
403
|
+
background: props.type == "line" ? props.color : ""
|
|
404
|
+
};
|
|
405
|
+
});
|
|
406
|
+
const titleStyle = computed(() => {
|
|
407
|
+
if (!props.titleGutter)
|
|
270
408
|
return {};
|
|
271
|
-
const
|
|
272
|
-
|
|
409
|
+
const px = pxCheck(props.titleGutter);
|
|
410
|
+
if (props.direction === "vertical") {
|
|
411
|
+
return { marginTop: px, marginBottom: px };
|
|
412
|
+
}
|
|
413
|
+
return { marginLeft: px, marginRight: px };
|
|
273
414
|
});
|
|
274
|
-
return
|
|
275
|
-
navRef
|
|
276
|
-
tabsContentRef
|
|
277
|
-
titles
|
|
278
|
-
contentStyle
|
|
279
|
-
tabsNavStyle
|
|
280
|
-
titleStyle
|
|
281
|
-
tabsActiveStyle
|
|
282
|
-
container
|
|
283
|
-
getScrollY
|
|
284
|
-
onStickyScroll
|
|
285
|
-
},
|
|
415
|
+
return __spreadValues(__spreadValues({
|
|
416
|
+
navRef,
|
|
417
|
+
tabsContentRef,
|
|
418
|
+
titles,
|
|
419
|
+
contentStyle,
|
|
420
|
+
tabsNavStyle,
|
|
421
|
+
titleStyle,
|
|
422
|
+
tabsActiveStyle,
|
|
423
|
+
container,
|
|
424
|
+
getScrollY,
|
|
425
|
+
onStickyScroll
|
|
426
|
+
}, tabMethods), touchMethods);
|
|
286
427
|
}
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
428
|
+
});
|
|
429
|
+
const _hoisted_1 = ["onClick"];
|
|
430
|
+
const _hoisted_2 = ["onClick"];
|
|
431
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
432
|
+
const _component_JoySmile = resolveComponent("JoySmile");
|
|
433
|
+
const _component_nut_sticky = resolveComponent("nut-sticky");
|
|
434
|
+
return openBlock(), createElementBlock("view", {
|
|
435
|
+
class: normalizeClass(["nut-tabs", [_ctx.direction]]),
|
|
292
436
|
ref: "container"
|
|
293
437
|
}, [
|
|
294
|
-
|
|
438
|
+
_ctx.sticky ? (openBlock(), createBlock(_component_nut_sticky, {
|
|
295
439
|
key: 0,
|
|
296
|
-
top:
|
|
297
|
-
container:
|
|
298
|
-
onScroll:
|
|
440
|
+
top: _ctx.top,
|
|
441
|
+
container: _ctx.container,
|
|
442
|
+
onScroll: _ctx.onStickyScroll
|
|
299
443
|
}, {
|
|
300
|
-
default:
|
|
301
|
-
|
|
302
|
-
class:
|
|
303
|
-
style:
|
|
444
|
+
default: withCtx(() => [
|
|
445
|
+
createElementVNode("view", {
|
|
446
|
+
class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
|
|
447
|
+
style: normalizeStyle(_ctx.tabsNavStyle),
|
|
304
448
|
ref: "navRef"
|
|
305
449
|
}, [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
e.type == "line" ? (y(), p("view", {
|
|
313
|
-
key: 0,
|
|
314
|
-
class: "nut-tabs__titles-item__line",
|
|
315
|
-
style: b(e.tabsActiveStyle)
|
|
316
|
-
}, null, 4)) : M("", !0),
|
|
317
|
-
e.type == "smile" ? (y(), p("view", {
|
|
318
|
-
key: 1,
|
|
319
|
-
class: "nut-tabs__titles-item__smile",
|
|
320
|
-
style: b(e.tabsActiveStyle)
|
|
450
|
+
_ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
|
|
451
|
+
return openBlock(), createElementBlock("view", {
|
|
452
|
+
class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
|
|
453
|
+
style: normalizeStyle(_ctx.titleStyle),
|
|
454
|
+
onClick: ($event) => _ctx.tabChange(item, index),
|
|
455
|
+
key: item.paneKey
|
|
321
456
|
}, [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
457
|
+
_ctx.type == "line" ? (openBlock(), createElementBlock("view", {
|
|
458
|
+
key: 0,
|
|
459
|
+
class: "nut-tabs__titles-item__line",
|
|
460
|
+
style: normalizeStyle(_ctx.tabsActiveStyle)
|
|
461
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
462
|
+
_ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
|
|
463
|
+
key: 1,
|
|
464
|
+
class: "nut-tabs__titles-item__smile",
|
|
465
|
+
style: normalizeStyle(_ctx.tabsActiveStyle)
|
|
466
|
+
}, [
|
|
467
|
+
createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
|
|
468
|
+
], 4)) : createCommentVNode("", true),
|
|
469
|
+
createElementVNode("view", {
|
|
470
|
+
class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
|
|
471
|
+
}, toDisplayString(item.title), 3)
|
|
472
|
+
], 14, _hoisted_1);
|
|
473
|
+
}), 128))
|
|
328
474
|
], 6)
|
|
329
475
|
]),
|
|
330
476
|
_: 3
|
|
331
|
-
}, 8, ["top", "container", "onScroll"])) : (
|
|
477
|
+
}, 8, ["top", "container", "onScroll"])) : (openBlock(), createElementBlock("view", {
|
|
332
478
|
key: 1,
|
|
333
|
-
class:
|
|
334
|
-
style:
|
|
479
|
+
class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, "scroll-vertical": _ctx.getScrollY, [_ctx.size]: _ctx.size }]),
|
|
480
|
+
style: normalizeStyle(_ctx.tabsNavStyle),
|
|
335
481
|
ref: "navRef"
|
|
336
482
|
}, [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
e.type == "line" ? (y(), p("view", {
|
|
346
|
-
key: 0,
|
|
347
|
-
class: "nut-tabs__titles-item__line",
|
|
348
|
-
style: b(e.tabsActiveStyle)
|
|
349
|
-
}, null, 4)) : M("", !0),
|
|
350
|
-
e.type == "smile" ? (y(), p("view", {
|
|
351
|
-
key: 1,
|
|
352
|
-
class: "nut-tabs__titles-item__smile",
|
|
353
|
-
style: b(e.tabsActiveStyle)
|
|
483
|
+
_ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
|
|
484
|
+
return openBlock(), createElementBlock("view", {
|
|
485
|
+
class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
|
|
486
|
+
style: normalizeStyle(_ctx.titleStyle),
|
|
487
|
+
onClick: ($event) => _ctx.tabChange(item, index),
|
|
488
|
+
key: item.paneKey,
|
|
489
|
+
ref_for: true,
|
|
490
|
+
ref: (e) => _ctx.setTabItemRef(e, index)
|
|
354
491
|
}, [
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
492
|
+
_ctx.type == "line" ? (openBlock(), createElementBlock("view", {
|
|
493
|
+
key: 0,
|
|
494
|
+
class: "nut-tabs__titles-item__line",
|
|
495
|
+
style: normalizeStyle(_ctx.tabsActiveStyle)
|
|
496
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
497
|
+
_ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
|
|
498
|
+
key: 1,
|
|
499
|
+
class: "nut-tabs__titles-item__smile",
|
|
500
|
+
style: normalizeStyle(_ctx.tabsActiveStyle)
|
|
501
|
+
}, [
|
|
502
|
+
createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
|
|
503
|
+
], 4)) : createCommentVNode("", true),
|
|
504
|
+
createElementVNode("view", {
|
|
505
|
+
class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
|
|
506
|
+
}, toDisplayString(item.title), 3)
|
|
507
|
+
], 14, _hoisted_2);
|
|
508
|
+
}), 128))
|
|
361
509
|
], 6)),
|
|
362
|
-
|
|
510
|
+
createElementVNode("view", {
|
|
363
511
|
class: "nut-tabs__content",
|
|
364
512
|
ref: "tabsContentRef",
|
|
365
|
-
style:
|
|
366
|
-
onTouchstart:
|
|
367
|
-
onTouchmove:
|
|
368
|
-
onTouchend:
|
|
369
|
-
onTouchcancel:
|
|
513
|
+
style: normalizeStyle(_ctx.contentStyle),
|
|
514
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
515
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
516
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
517
|
+
onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
370
518
|
}, [
|
|
371
|
-
|
|
519
|
+
renderSlot(_ctx.$slots, "default")
|
|
372
520
|
], 36)
|
|
373
521
|
], 2);
|
|
374
522
|
}
|
|
375
|
-
const
|
|
523
|
+
const Tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
376
524
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
525
|
+
Title,
|
|
526
|
+
Tabs as default
|
|
379
527
|
};
|