@salesforcedevs/dx-components 1.3.42 → 1.3.44
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.44",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"eventsourcemock": "^2.0.0",
|
|
41
41
|
"luxon": "^3.1.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "6fd47c4a90b3238225555542a33e2f10246cbc5b"
|
|
44
44
|
}
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
size="large"
|
|
70
70
|
href={buttonOneHref}
|
|
71
71
|
variant="primary"
|
|
72
|
+
target={buttonOneTarget}
|
|
72
73
|
font="sans"
|
|
73
74
|
icon-symbol={buttonOneIcon}
|
|
74
75
|
icon-size={buttonOneIconSize}
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
href={buttonOneHref}
|
|
83
84
|
variant="primary"
|
|
84
85
|
font="sans"
|
|
86
|
+
target={buttonOneTarget}
|
|
85
87
|
icon-symbol={buttonOneIcon}
|
|
86
88
|
icon-size={buttonOneIconSize}
|
|
87
89
|
>
|
|
@@ -71,6 +71,10 @@ export default class CardTrial extends LightningElement {
|
|
|
71
71
|
return this.hasButtons ? "menu" : "link";
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
get buttonOneTarget() {
|
|
75
|
+
return this.isExternalURL(this.buttonOneHref) ? "_blank" : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
private _details!: string[];
|
|
75
79
|
private _modalDetails!: [{ title: string; subtitle: string }];
|
|
76
80
|
private _modalOpen = false;
|
|
@@ -99,4 +103,17 @@ export default class CardTrial extends LightningElement {
|
|
|
99
103
|
window.location.assign(this.href);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
106
|
+
|
|
107
|
+
private isExternalURL(url: string | undefined): boolean {
|
|
108
|
+
if (!url) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const value = new URL(url);
|
|
114
|
+
return value.host !== window.location.host;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
102
119
|
}
|
|
@@ -9,7 +9,13 @@ declare module globalThis {
|
|
|
9
9
|
let singletonScrollManagerConnected: boolean;
|
|
10
10
|
}
|
|
11
11
|
// mostly components shouldn't be using this, but there are a few exceptions such as amfReference
|
|
12
|
+
|
|
13
|
+
let scrollUnlocked: boolean = false;
|
|
14
|
+
|
|
12
15
|
export const restoreScroll = () => {
|
|
16
|
+
if (scrollUnlocked) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
13
19
|
document.body.scrollTop = document.documentElement.scrollTop =
|
|
14
20
|
window.history.state?.scroll.value;
|
|
15
21
|
};
|
|
@@ -33,10 +39,10 @@ export default class ScrollManager extends LightningElement {
|
|
|
33
39
|
*/
|
|
34
40
|
|
|
35
41
|
protected scrollCount = 0; // this is for dark magic, basically we lock the user out of scrolling in the first quarter second, unless they really mean it. We do this because load timings mean that the scroll can get messed up in that period
|
|
36
|
-
protected scrollUnlocked = false;
|
|
37
42
|
|
|
38
43
|
renderedCallback() {
|
|
39
|
-
|
|
44
|
+
scrollUnlocked = window.location.hash !== ""; // if we have anchor links, skip the entire scroll restore
|
|
45
|
+
if (!globalThis.singletonScrollManagerRendered && !scrollUnlocked) {
|
|
40
46
|
globalThis.singletonScrollManagerRendered = true;
|
|
41
47
|
if (
|
|
42
48
|
window.history.state?.scroll?.docSize ===
|
|
@@ -50,10 +56,8 @@ export default class ScrollManager extends LightningElement {
|
|
|
50
56
|
// sometimes loading is slow, so we may want to reset the scroll to
|
|
51
57
|
// the correct position after loading is complete, to avoid weird behavior
|
|
52
58
|
// but only if the user hasn't scrolled around in the meantime
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.scrollUnlocked = true;
|
|
56
|
-
}
|
|
59
|
+
restoreScroll();
|
|
60
|
+
scrollUnlocked = true;
|
|
57
61
|
}, LOAD_TIME_SCROLL_RESTORE_DELAY);
|
|
58
62
|
}
|
|
59
63
|
} else {
|