@salesforcedevs/dx-components 1.18.9-rnb-scroll4 → 1.18.9-rnb-scroll5
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/package.json
CHANGED
|
@@ -43,6 +43,19 @@
|
|
|
43
43
|
padding-right: 10px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.scroll-shadow {
|
|
47
|
+
position: sticky;
|
|
48
|
+
bottom: -80px; /* toc-items are 80px padding from bottom */
|
|
49
|
+
height: 5px;
|
|
50
|
+
background: linear-gradient(
|
|
51
|
+
to bottom,
|
|
52
|
+
rgba(229, 229, 229, 0),
|
|
53
|
+
rgba(229, 229, 229, 0.8)
|
|
54
|
+
);
|
|
55
|
+
transition: opacity 0.3s;
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
.dx-text-display-8 {
|
|
47
60
|
padding-top: var(--dx-g-spacing-sm);
|
|
48
61
|
transition: var(--dx-g-transition-hue-1x);
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export function handleScroll(this: any, scrollEvent: any) {
|
|
2
|
-
const
|
|
2
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollEvent.target;
|
|
3
|
+
|
|
4
|
+
// to show shadow box at bottom of list container
|
|
5
|
+
const shadow = this.template.querySelector(".scroll-shadow");
|
|
6
|
+
|
|
7
|
+
if(shadow) {
|
|
8
|
+
const isScrollable = scrollHeight > clientHeight;
|
|
9
|
+
const isAtBottom = scrollTop + clientHeight >= scrollHeight - 75; //to maintain the padding 80px given to toc-items
|
|
10
|
+
|
|
11
|
+
shadow.style.opacity = (isScrollable && !isAtBottom) ? 1 : 0;
|
|
12
|
+
}
|
|
3
13
|
|
|
4
14
|
setTimeout(() => {
|
|
5
|
-
this.showBoxShadow = (
|
|
15
|
+
this.showBoxShadow = (scrollTop > 0 && scrollHeight > clientHeight);
|
|
6
16
|
}, 200);
|
|
7
17
|
}
|