@salesforcedevs/dx-components 1.40.0 → 1.40.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.1",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"luxon": "3.4.4",
|
|
45
45
|
"msw": "^2.12.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e14396ab322a7cec69a1ebf180adbf8ac2902c3b"
|
|
48
48
|
}
|
|
@@ -65,7 +65,8 @@ export class TreeHandler {
|
|
|
65
65
|
isChildrenLoading: node.isChildrenLoading || false,
|
|
66
66
|
link: node.link,
|
|
67
67
|
method: node.method,
|
|
68
|
-
showForwardArrow: node.showForwardArrow
|
|
68
|
+
showForwardArrow: node.showForwardArrow,
|
|
69
|
+
redirectToChild: node.redirectToChild
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
const mapItem = { node: convertedNode, parent };
|
|
@@ -49,6 +49,10 @@ export default class TreeItem extends LightningElement {
|
|
|
49
49
|
return this.hasChildren || this.isChildrenLoading;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
private get isContentlessParent(): boolean {
|
|
53
|
+
return this.isParent && !!this._treeNode?.redirectToChild;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
private get showChildren(): boolean {
|
|
53
57
|
return this.isExpanded && this.hasChildren;
|
|
54
58
|
}
|
|
@@ -140,6 +144,23 @@ export default class TreeItem extends LightningElement {
|
|
|
140
144
|
private onLinkClick(event: Event): void {
|
|
141
145
|
this.preventDefaultLinkBehavior(event);
|
|
142
146
|
|
|
147
|
+
/**
|
|
148
|
+
* A content-less parent that redirects to a content child navigates
|
|
149
|
+
* like a normal link (navigation handles selection and ancestor
|
|
150
|
+
* expansion). A content-less parent whose chain has no content page to
|
|
151
|
+
* redirect to only expands, it is never selected.
|
|
152
|
+
*/
|
|
153
|
+
if (this.isContentlessParent) {
|
|
154
|
+
if (this._treeNode.link?.href) {
|
|
155
|
+
this.sendGtm(event);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const isSelectAction = false;
|
|
159
|
+
this.doExpand(isSelectAction);
|
|
160
|
+
this.sendGtm(event);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
143
164
|
if (this.isParent) {
|
|
144
165
|
const isSelectAction = true;
|
|
145
166
|
this.doExpand(isSelectAction);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a href={href} class={tileClass} target={target}>
|
|
2
|
+
<a href={href} class={tileClass} target={target} aria-label={linkAriaLabel}>
|
|
3
3
|
<div class="flex indentation" role="heading" aria-level={tileAriaLevel}>
|
|
4
4
|
<div class="flex tile-expand-icon tile-icon" if:true={showArrow}>
|
|
5
5
|
<dx-icon
|
|
@@ -37,6 +37,28 @@ export default class TreeTile extends LightningElement {
|
|
|
37
37
|
return this.treeNode.level + 2;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Accessible name for the link. If a parent redirects to its first child,
|
|
42
|
+
* include both the parent and child labels so the destination is clear to
|
|
43
|
+
* screen reader users (WCAG 2.4.4)
|
|
44
|
+
*/
|
|
45
|
+
get linkAriaLabel(): string | null {
|
|
46
|
+
if (!this.treeNode.redirectToChild || !this.treeNode.link?.href) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The redirect can target a deep descendant, so walk the first-child
|
|
51
|
+
* chain to the node that owns the destination link and name it.
|
|
52
|
+
*/
|
|
53
|
+
let destination = this.treeNode.children?.[0];
|
|
54
|
+
while (destination?.redirectToChild) {
|
|
55
|
+
destination = destination.children?.[0];
|
|
56
|
+
}
|
|
57
|
+
return destination?.link?.href === this.treeNode.link.href
|
|
58
|
+
? `${this.treeNode.label}, opens ${destination.label}`
|
|
59
|
+
: null;
|
|
60
|
+
}
|
|
61
|
+
|
|
40
62
|
private get iconSize() {
|
|
41
63
|
return "xsmall";
|
|
42
64
|
}
|