@varlet/ui 2.22.1-alpha.1706370837642 → 2.22.2-alpha.1706882566427
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/es/index-anchor/IndexAnchor.mjs +5 -7
- package/es/index-bar/IndexBar.mjs +5 -8
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/menu/usePopover.mjs +3 -0
- package/es/sticky/Sticky.mjs +17 -13
- package/es/style.css +1 -1
- package/es/tabs/tabs.css +1 -1
- package/es/test/style/index.mjs +0 -0
- package/es/varlet.esm.js +1226 -1228
- package/highlight/web-types.en-US.json +2 -2
- package/highlight/web-types.zh-CN.json +2 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +31 -29
- package/package.json +7 -7
- package/umd/varlet.js +5 -5
|
@@ -42,7 +42,6 @@ const __sfc__ = defineComponent({
|
|
|
42
42
|
inheritAttrs: false,
|
|
43
43
|
props,
|
|
44
44
|
setup(props2) {
|
|
45
|
-
const ownTop = ref(0);
|
|
46
45
|
const disabled = ref(false);
|
|
47
46
|
const name2 = computed(() => props2.index);
|
|
48
47
|
const anchorEl = ref(null);
|
|
@@ -51,16 +50,15 @@ const __sfc__ = defineComponent({
|
|
|
51
50
|
const indexAnchorProvider = {
|
|
52
51
|
index,
|
|
53
52
|
name: name2,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setDisabled
|
|
53
|
+
setDisabled,
|
|
54
|
+
getOffsetTop
|
|
57
55
|
};
|
|
58
56
|
bindIndexBar(indexAnchorProvider);
|
|
59
|
-
function
|
|
57
|
+
function getOffsetTop() {
|
|
60
58
|
if (!anchorEl.value) {
|
|
61
|
-
return;
|
|
59
|
+
return 0;
|
|
62
60
|
}
|
|
63
|
-
|
|
61
|
+
return anchorEl.value.$el ? anchorEl.value.$el.offsetTop : anchorEl.value.offsetTop;
|
|
64
62
|
}
|
|
65
63
|
function setDisabled(value) {
|
|
66
64
|
disabled.value = value;
|
|
@@ -112,11 +112,7 @@ const __sfc__ = defineComponent({
|
|
|
112
112
|
() => length.value,
|
|
113
113
|
() => __async(this, null, function* () {
|
|
114
114
|
yield doubleRaf();
|
|
115
|
-
indexAnchors.
|
|
116
|
-
if (name2.value)
|
|
117
|
-
anchorNameList.value.push(name2.value);
|
|
118
|
-
setOwnTop();
|
|
119
|
-
});
|
|
115
|
+
anchorNameList.value = indexAnchors.filter(({ name: name2 }) => name2.value != null).map(({ name: name2 }) => name2.value);
|
|
120
116
|
})
|
|
121
117
|
);
|
|
122
118
|
onSmartMounted(() => __async(this, null, function* () {
|
|
@@ -158,9 +154,9 @@ const __sfc__ = defineComponent({
|
|
|
158
154
|
const scrollHeight = scroller === window ? document.body.scrollHeight : scroller.scrollHeight;
|
|
159
155
|
const offsetTop = getOffsetTop();
|
|
160
156
|
indexAnchors.forEach((anchor, index) => {
|
|
161
|
-
const anchorTop = anchor.
|
|
157
|
+
const anchorTop = anchor.getOffsetTop();
|
|
162
158
|
const top = scrollTop - anchorTop + stickyOffsetTop.value - offsetTop;
|
|
163
|
-
const distance = index === indexAnchors.length - 1 ? scrollHeight : indexAnchors[index + 1].
|
|
159
|
+
const distance = index === indexAnchors.length - 1 ? scrollHeight : indexAnchors[index + 1].getOffsetTop() - anchor.getOffsetTop();
|
|
164
160
|
anchor.setDisabled(true);
|
|
165
161
|
if (top >= 0 && top < distance && clickedName.value === "") {
|
|
166
162
|
anchor.setDisabled(false);
|
|
@@ -181,7 +177,8 @@ const __sfc__ = defineComponent({
|
|
|
181
177
|
return;
|
|
182
178
|
}
|
|
183
179
|
const offsetTop = getOffsetTop();
|
|
184
|
-
const
|
|
180
|
+
const indexAnchorTop = indexAnchor.getOffsetTop();
|
|
181
|
+
const top = indexAnchorTop - stickyOffsetTop.value + offsetTop;
|
|
185
182
|
const left = getScrollLeft(scroller);
|
|
186
183
|
clickedName.value = anchorName;
|
|
187
184
|
emitEvent(anchorName, options);
|
package/es/index.bundle.mjs
CHANGED
|
@@ -262,7 +262,7 @@ import './tooltip/style/index.mjs'
|
|
|
262
262
|
import './uploader/style/index.mjs'
|
|
263
263
|
import './watermark/style/index.mjs'
|
|
264
264
|
|
|
265
|
-
const version = '2.22.
|
|
265
|
+
const version = '2.22.2-alpha.1706882566427'
|
|
266
266
|
|
|
267
267
|
function install(app) {
|
|
268
268
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -174,7 +174,7 @@ export * from './tooltip/index.mjs'
|
|
|
174
174
|
export * from './uploader/index.mjs'
|
|
175
175
|
export * from './watermark/index.mjs'
|
|
176
176
|
|
|
177
|
-
const version = '2.22.
|
|
177
|
+
const version = '2.22.2-alpha.1706882566427'
|
|
178
178
|
|
|
179
179
|
function install(app) {
|
|
180
180
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/menu/usePopover.mjs
CHANGED
package/es/sticky/Sticky.mjs
CHANGED
|
@@ -83,7 +83,10 @@ const __sfc__ = defineComponent({
|
|
|
83
83
|
const offsetTop = computed(() => toPxNum(props2.offsetTop));
|
|
84
84
|
let scroller;
|
|
85
85
|
watch(() => props2.disabled, resize);
|
|
86
|
-
onSmartMounted(
|
|
86
|
+
onSmartMounted(() => __async(this, null, function* () {
|
|
87
|
+
yield doubleRaf();
|
|
88
|
+
handleScroll();
|
|
89
|
+
}));
|
|
87
90
|
onSmartUnmounted(removeScrollListener);
|
|
88
91
|
onWindowResize(resize);
|
|
89
92
|
useEventListener(() => window, "scroll", handleScroll);
|
|
@@ -122,15 +125,27 @@ const __sfc__ = defineComponent({
|
|
|
122
125
|
isFixed: false
|
|
123
126
|
};
|
|
124
127
|
}
|
|
128
|
+
function setupScroller() {
|
|
129
|
+
scroller = getParentScroller(stickyEl.value);
|
|
130
|
+
if (scroller !== window) {
|
|
131
|
+
scroller.addEventListener("scroll", handleScroll);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
125
134
|
function handleScroll() {
|
|
126
135
|
if (!scroller) {
|
|
127
|
-
|
|
136
|
+
setupScroller();
|
|
128
137
|
}
|
|
129
138
|
const fixedParams = computeFixedParams();
|
|
130
139
|
if (fixedParams) {
|
|
131
140
|
call(props2.onScroll, fixedParams.offsetTop, fixedParams.isFixed);
|
|
132
141
|
}
|
|
133
142
|
}
|
|
143
|
+
function removeScrollListener() {
|
|
144
|
+
if (!scroller || scroller === window) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
scroller.removeEventListener("scroll", handleScroll);
|
|
148
|
+
}
|
|
134
149
|
function resize() {
|
|
135
150
|
return __async(this, null, function* () {
|
|
136
151
|
isFixed.value = false;
|
|
@@ -138,17 +153,6 @@ const __sfc__ = defineComponent({
|
|
|
138
153
|
computeFixedParams();
|
|
139
154
|
});
|
|
140
155
|
}
|
|
141
|
-
function addScrollListener() {
|
|
142
|
-
return __async(this, null, function* () {
|
|
143
|
-
yield doubleRaf();
|
|
144
|
-
scroller = getParentScroller(stickyEl.value);
|
|
145
|
-
scroller !== window && scroller.addEventListener("scroll", handleScroll);
|
|
146
|
-
handleScroll();
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function removeScrollListener() {
|
|
150
|
-
scroller !== window && scroller.removeEventListener("scroll", handleScroll);
|
|
151
|
-
}
|
|
152
156
|
return {
|
|
153
157
|
stickyEl,
|
|
154
158
|
wrapperEl,
|