@nutui/nutui 3.1.22-beta.5 → 3.1.23-beta.1
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/CHANGELOG.md +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +20412 -4214
- package/dist/nutui.umd.js +20518 -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 +454 -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/packages/picker/index.scss +13 -0
- 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 +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +4 -1
- package/dist/styles/variables-jdt.scss +4 -1
- package/dist/styles/variables.scss +1 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
- package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- 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/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,25 +1,120 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { getCurrentInstance
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { getCurrentInstance, inject, reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, Fragment, toDisplayString, createCommentVNode, 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 { create
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
10
|
+
const { create, componentName } = createComponent("step");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
content: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
iconColor: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
default: "12px"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: ["click-step"],
|
|
35
|
+
setup(props, { emit, slots }) {
|
|
36
|
+
const { proxy } = getCurrentInstance();
|
|
37
|
+
const parent = inject("parent");
|
|
38
|
+
parent["relation"](proxy);
|
|
39
|
+
const state = reactive({
|
|
40
|
+
dot: parent.props.progressDot
|
|
41
|
+
});
|
|
42
|
+
const index2 = computed(() => parent.state.children.indexOf(proxy) + 1);
|
|
43
|
+
const getCurrentStatus = () => {
|
|
44
|
+
const activeIndex = index2.value;
|
|
45
|
+
if (activeIndex < +parent.props.current)
|
|
46
|
+
return "finish";
|
|
47
|
+
return activeIndex === +parent.props.current ? "process" : "wait";
|
|
48
|
+
};
|
|
49
|
+
const status = computed(() => {
|
|
50
|
+
return getCurrentStatus();
|
|
51
|
+
});
|
|
52
|
+
const classes = computed(() => {
|
|
53
|
+
const prefixCls = componentName;
|
|
54
|
+
return {
|
|
55
|
+
[prefixCls]: true,
|
|
56
|
+
[`${prefixCls}-${status.value}`]: true
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
const handleClickStep = () => {
|
|
60
|
+
parent["onEmit"](index2.value);
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
...toRefs(state),
|
|
64
|
+
index: index2,
|
|
65
|
+
classes,
|
|
66
|
+
handleClickStep
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const _hoisted_1 = { class: "nut-step-head" };
|
|
71
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("view", { class: "nut-step-line" }, null, -1);
|
|
72
|
+
const _hoisted_3 = {
|
|
73
|
+
key: 2,
|
|
74
|
+
class: "nut-step-inner"
|
|
75
|
+
};
|
|
76
|
+
const _hoisted_4 = { class: "nut-step-main" };
|
|
77
|
+
const _hoisted_5 = { class: "nut-step-title" };
|
|
78
|
+
const _hoisted_6 = { key: 0 };
|
|
79
|
+
const _hoisted_7 = {
|
|
80
|
+
key: 0,
|
|
81
|
+
class: "nut-step-content"
|
|
82
|
+
};
|
|
83
|
+
const _hoisted_8 = ["innerHTML"];
|
|
84
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
85
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
86
|
+
return openBlock(), createElementBlock("view", {
|
|
87
|
+
class: normalizeClass(_ctx.classes),
|
|
88
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickStep && _ctx.handleClickStep(...args))
|
|
89
|
+
}, [
|
|
90
|
+
createElementVNode("view", _hoisted_1, [
|
|
91
|
+
_hoisted_2,
|
|
92
|
+
createElementVNode("view", {
|
|
93
|
+
class: normalizeClass(["nut-step-icon", [!_ctx.dot ? _ctx.icon ? "is-icon" : "is-text" : ""]])
|
|
94
|
+
}, [
|
|
95
|
+
_ctx.icon ? (openBlock(), createBlock(_component_nut_icon, {
|
|
96
|
+
key: 0,
|
|
97
|
+
class: "nut-step-icon-inner",
|
|
98
|
+
color: _ctx.iconColor,
|
|
99
|
+
name: _ctx.icon,
|
|
100
|
+
size: _ctx.size
|
|
101
|
+
}, null, 8, ["color", "name", "size"])) : _ctx.dot ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [], 64)) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.index), 1))
|
|
102
|
+
], 2)
|
|
103
|
+
]),
|
|
104
|
+
createElementVNode("view", _hoisted_4, [
|
|
105
|
+
createElementVNode("view", _hoisted_5, [
|
|
106
|
+
!_ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
107
|
+
renderSlot(_ctx.$slots, "title")
|
|
108
|
+
]),
|
|
109
|
+
_ctx.content || _ctx.$slots.content ? (openBlock(), createElementBlock("view", _hoisted_7, [
|
|
110
|
+
!_ctx.$slots.content ? (openBlock(), createElementBlock("span", {
|
|
111
|
+
key: 0,
|
|
112
|
+
innerHTML: _ctx.content
|
|
113
|
+
}, null, 8, _hoisted_8)) : createCommentVNode("", true),
|
|
114
|
+
renderSlot(_ctx.$slots, "content")
|
|
115
|
+
])) : createCommentVNode("", true)
|
|
116
|
+
])
|
|
117
|
+
], 2);
|
|
118
|
+
}
|
|
119
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
120
|
+
export { index as default };
|
|
@@ -1,23 +1,58 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive
|
|
7
|
-
import { c as
|
|
6
|
+
import { reactive, computed, provide, h } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
8
|
import "../locale/lang";
|
|
9
|
-
const { create
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const { create, componentName } = createComponent("steps");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
direction: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "horizontal"
|
|
15
|
+
},
|
|
16
|
+
current: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: "0"
|
|
19
|
+
},
|
|
20
|
+
progressDot: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
emits: ["click-step"],
|
|
26
|
+
setup(props, { emit, slots }) {
|
|
27
|
+
const state = reactive({
|
|
28
|
+
children: []
|
|
29
|
+
});
|
|
30
|
+
const classes = computed(() => {
|
|
31
|
+
const prefixCls = componentName;
|
|
32
|
+
return {
|
|
33
|
+
[prefixCls]: true,
|
|
34
|
+
[`${prefixCls}-${props.direction}`]: true,
|
|
35
|
+
[`${prefixCls}-dot`]: !!props.progressDot
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const relation = (child) => {
|
|
39
|
+
child && state.children.push(child);
|
|
40
|
+
};
|
|
41
|
+
const onEmit = (index) => {
|
|
42
|
+
emit("click-step", index);
|
|
43
|
+
};
|
|
44
|
+
provide("parent", {
|
|
45
|
+
relation,
|
|
46
|
+
state,
|
|
47
|
+
props,
|
|
48
|
+
onEmit
|
|
49
|
+
});
|
|
50
|
+
return () => {
|
|
51
|
+
var _a;
|
|
52
|
+
return h("view", {
|
|
53
|
+
class: classes.value
|
|
54
|
+
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export { _sfc_main as default };
|
|
@@ -1,59 +1,144 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 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
|
|
6
|
+
import { ref, reactive, computed, watch, onMounted, onUnmounted, h, unref } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { u as useRect } from "./index2.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { componentName
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const n2 = d(u);
|
|
32
|
-
if ((n2.width || n2.height) && (c.width = n2.width, c.height = n2.height), e2 === "top")
|
|
33
|
-
if (t2) {
|
|
34
|
-
const e3 = d(t2), o3 = e3.bottom - +g.value - c.height;
|
|
35
|
-
c.fixed = +g.value > n2.top && e3.bottom > 0, c.transform = o3 < 0 ? o3 : 0;
|
|
36
|
-
} else
|
|
37
|
-
c.fixed = g.value > n2.top;
|
|
38
|
-
else if (e2 === "bottom") {
|
|
39
|
-
const e3 = document.documentElement.clientHeight;
|
|
40
|
-
if (t2) {
|
|
41
|
-
const o3 = d(t2), i3 = e3 - o3.top - +g.value - c.height;
|
|
42
|
-
c.fixed = e3 - +g.value < n2.bottom && e3 > o3.top, c.transform = i3 < 0 ? -i3 : 0;
|
|
43
|
-
} else
|
|
44
|
-
c.fixed = e3 - +g.value < n2.bottom;
|
|
10
|
+
const { componentName, create } = createComponent("sticky");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
position: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "top"
|
|
16
|
+
},
|
|
17
|
+
top: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 0
|
|
20
|
+
},
|
|
21
|
+
bottom: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: 0
|
|
24
|
+
},
|
|
25
|
+
container: {
|
|
26
|
+
type: Object
|
|
27
|
+
},
|
|
28
|
+
zIndex: {
|
|
29
|
+
type: [Number, String],
|
|
30
|
+
default: 2e3
|
|
45
31
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
},
|
|
33
|
+
emits: ["change", "scroll"],
|
|
34
|
+
setup(props, { emit, slots }) {
|
|
35
|
+
const root = ref();
|
|
36
|
+
const state = reactive({
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0,
|
|
39
|
+
fixed: false,
|
|
40
|
+
transform: 0
|
|
41
|
+
});
|
|
42
|
+
const rootStyle = computed(() => {
|
|
43
|
+
const { fixed, width, height } = state;
|
|
44
|
+
if (fixed) {
|
|
45
|
+
return {
|
|
46
|
+
width: `${width}px`,
|
|
47
|
+
height: `${height}px`
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const stickyStyle = computed(() => {
|
|
52
|
+
if (!state.fixed)
|
|
53
|
+
return;
|
|
54
|
+
const style = {
|
|
55
|
+
width: `${state.width}px`,
|
|
56
|
+
height: `${state.height}px`,
|
|
57
|
+
[props.position]: `${offset.value}px`,
|
|
58
|
+
zIndex: +props.zIndex
|
|
59
|
+
};
|
|
60
|
+
if (state.transform)
|
|
61
|
+
style.transform = `translate3d(0, ${state.transform}px, 0)`;
|
|
62
|
+
return style;
|
|
63
|
+
});
|
|
64
|
+
const offset = computed(() => {
|
|
65
|
+
return props.position === "top" ? props.top : props.bottom;
|
|
66
|
+
});
|
|
67
|
+
const isHidden = (elementRef) => {
|
|
68
|
+
const el = unref(elementRef);
|
|
69
|
+
if (!el)
|
|
70
|
+
return false;
|
|
71
|
+
const style = window.getComputedStyle(el);
|
|
72
|
+
const hidden = style.display === "none";
|
|
73
|
+
const parentHidden = el.offsetParent === null && style.position !== "fixed";
|
|
74
|
+
return hidden || parentHidden;
|
|
75
|
+
};
|
|
76
|
+
const isExistRoot = () => {
|
|
77
|
+
if (!root.value || isHidden(root))
|
|
78
|
+
return false;
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
const getScrollTop = (el) => {
|
|
82
|
+
return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
|
|
83
|
+
};
|
|
84
|
+
const renderFixed = () => {
|
|
85
|
+
var _a;
|
|
86
|
+
return h("view", {
|
|
87
|
+
style: stickyStyle.value,
|
|
88
|
+
class: state.fixed ? `${componentName} nut-sticky--fixed` : componentName
|
|
89
|
+
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
90
|
+
};
|
|
91
|
+
const onScroll = () => {
|
|
92
|
+
if (!isExistRoot())
|
|
93
|
+
return;
|
|
94
|
+
const { container, position } = props;
|
|
95
|
+
const scrollTop = getScrollTop(window);
|
|
96
|
+
const rootRect = useRect(root);
|
|
97
|
+
if (rootRect.width || rootRect.height) {
|
|
98
|
+
state.width = rootRect.width;
|
|
99
|
+
state.height = rootRect.height;
|
|
100
|
+
}
|
|
101
|
+
if (position === "top") {
|
|
102
|
+
if (container) {
|
|
103
|
+
const containerRect = useRect(container);
|
|
104
|
+
const diff = containerRect.bottom - +offset.value - state.height;
|
|
105
|
+
state.fixed = +offset.value > rootRect.top && containerRect.bottom > 0;
|
|
106
|
+
state.transform = diff < 0 ? diff : 0;
|
|
107
|
+
} else {
|
|
108
|
+
state.fixed = offset.value > rootRect.top;
|
|
109
|
+
}
|
|
110
|
+
} else if (position === "bottom") {
|
|
111
|
+
const clientHeight = document.documentElement.clientHeight;
|
|
112
|
+
if (container) {
|
|
113
|
+
const containerRect = useRect(container);
|
|
114
|
+
const diff = clientHeight - containerRect.top - +offset.value - state.height;
|
|
115
|
+
state.fixed = clientHeight - +offset.value < rootRect.bottom && clientHeight > containerRect.top;
|
|
116
|
+
state.transform = diff < 0 ? -diff : 0;
|
|
117
|
+
} else {
|
|
118
|
+
state.fixed = clientHeight - +offset.value < rootRect.bottom;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
emit("scroll", {
|
|
122
|
+
top: scrollTop,
|
|
123
|
+
fixed: state.fixed
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
watch(() => state.fixed, (val) => {
|
|
127
|
+
emit("change", val);
|
|
128
|
+
});
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
window.addEventListener("scroll", onScroll);
|
|
131
|
+
onScroll();
|
|
132
|
+
});
|
|
133
|
+
onUnmounted(() => {
|
|
134
|
+
window.removeEventListener("scroll", onScroll);
|
|
135
|
+
});
|
|
136
|
+
return () => {
|
|
137
|
+
return h("view", {
|
|
138
|
+
style: rootStyle.value,
|
|
139
|
+
ref: root
|
|
140
|
+
}, [renderFixed()]);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
export { _sfc_main as default };
|
|
@@ -1,22 +1,87 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { reactive, computed, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, toDisplayString, createVNode, normalizeStyle, 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
|
-
|
|
10
|
+
const { componentName, create } = createComponent("subsidenavbar");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
ikey: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
open: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ["title-click"],
|
|
27
|
+
setup: (props, context) => {
|
|
28
|
+
const state = reactive({
|
|
29
|
+
direction: ""
|
|
30
|
+
});
|
|
31
|
+
const classes = computed(() => {
|
|
32
|
+
const prefixCls = componentName;
|
|
33
|
+
return {
|
|
34
|
+
[prefixCls]: true
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const style = computed(() => {
|
|
38
|
+
return {
|
|
39
|
+
height: !state.direction ? "auto" : "0px"
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
const handleClick = () => {
|
|
43
|
+
context.emit("title-click");
|
|
44
|
+
state.direction = !state.direction ? "up" : "";
|
|
45
|
+
};
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
state.direction = props.open ? "" : "up";
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
...toRefs(state),
|
|
51
|
+
classes,
|
|
52
|
+
style,
|
|
53
|
+
handleClick
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const _hoisted_1 = ["ikey"];
|
|
58
|
+
const _hoisted_2 = { class: "nut-subsidenavbar__title__text" };
|
|
59
|
+
const _hoisted_3 = { class: "nut-subsidenavbar__title__icon" };
|
|
60
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
61
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
62
|
+
return openBlock(), createElementBlock("view", {
|
|
63
|
+
class: normalizeClass(_ctx.classes),
|
|
64
|
+
ikey: _ctx.ikey
|
|
65
|
+
}, [
|
|
66
|
+
createElementVNode("view", {
|
|
67
|
+
class: "nut-subsidenavbar__title",
|
|
68
|
+
onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"]))
|
|
69
|
+
}, [
|
|
70
|
+
createElementVNode("span", _hoisted_2, toDisplayString(_ctx.title), 1),
|
|
71
|
+
createElementVNode("span", _hoisted_3, [
|
|
72
|
+
createVNode(_component_nut_icon, {
|
|
73
|
+
name: "down-arrow",
|
|
74
|
+
class: normalizeClass(_ctx.direction)
|
|
75
|
+
}, null, 8, ["class"])
|
|
76
|
+
])
|
|
77
|
+
]),
|
|
78
|
+
createElementVNode("view", {
|
|
79
|
+
class: normalizeClass(["nut-subsidenavbar__list", !_ctx.direction ? "nutFadeIn" : "nutFadeOut"]),
|
|
80
|
+
style: normalizeStyle(_ctx.style)
|
|
81
|
+
}, [
|
|
82
|
+
renderSlot(_ctx.$slots, "default")
|
|
83
|
+
], 6)
|
|
84
|
+
], 10, _hoisted_1);
|
|
85
|
+
}
|
|
86
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
87
|
+
export { index as default };
|