@salesforcedevs/dx-components 1.20.0-rnb-scroll-2 → 1.20.0-rnb-scroll-3
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
|
@@ -6,12 +6,16 @@ import { track as sendGtm } from "dxUtils/analytics";
|
|
|
6
6
|
import { handleScroll } from "dxUtils/handleScroll";
|
|
7
7
|
|
|
8
8
|
export default class Toc extends LightningElement {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// For showing shadow at the top
|
|
10
|
+
private showBoxShadow: boolean = false;
|
|
11
11
|
private scrolling: boolean = false;
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
handleScroll = handleScroll.bind(this);
|
|
14
14
|
|
|
15
|
+
// For showing shadow at the bottom
|
|
16
|
+
private showBottomShadow: boolean = false;
|
|
17
|
+
private scrollingToTop: boolean = false;
|
|
18
|
+
|
|
15
19
|
@api header!: string;
|
|
16
20
|
|
|
17
21
|
@api
|
|
@@ -49,20 +53,26 @@ export default class Toc extends LightningElement {
|
|
|
49
53
|
private showShadowAtBottom = (event: any) => {
|
|
50
54
|
const list = event.target;
|
|
51
55
|
|
|
52
|
-
if (!this.
|
|
53
|
-
this.
|
|
56
|
+
if (!this.scrollingToTop) {
|
|
57
|
+
this.scrollingToTop = true;
|
|
54
58
|
// Set a timeout to handle scroll event after a delay
|
|
55
59
|
setTimeout(() => {
|
|
56
60
|
const isScrollable = list.scrollHeight > list.clientHeight;
|
|
57
61
|
const isAtBottom =
|
|
58
62
|
list.scrollTop + list.clientHeight >=
|
|
59
|
-
list.scrollHeight -
|
|
63
|
+
list.scrollHeight -
|
|
64
|
+
parseInt(
|
|
65
|
+
getComputedStyle(
|
|
66
|
+
this.template.host
|
|
67
|
+
).getPropertyValue("--dx-c-toc-padding-bottom"),
|
|
68
|
+
10
|
|
69
|
+
);
|
|
60
70
|
|
|
61
|
-
this.
|
|
71
|
+
this.showBottomShadow = isScrollable && !isAtBottom;
|
|
62
72
|
|
|
63
73
|
// Reset scrolling back to false after handling the scroll
|
|
64
|
-
this.
|
|
65
|
-
},
|
|
74
|
+
this.scrollingToTop = false;
|
|
75
|
+
}, 200);
|
|
66
76
|
}
|
|
67
77
|
};
|
|
68
78
|
|