@salesforcedevs/dx-components 1.40.7-tlv-alpha → 1.40.8
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/LICENSE +12 -0
- package/lwc.config.json +2 -3
- package/package.json +47 -46
- package/src/modules/dx/button/button.css +2 -2
- package/src/modules/dx/codeBlock/codeBlock.ts +6 -0
- package/src/modules/dx/dropdown/dropdown.css +1 -29
- package/src/modules/dx/dropdown/dropdown.html +1 -1
- package/src/modules/dx/dropdown/dropdown.ts +1 -16
- package/src/modules/dx/dropdownOption/dropdownOption.css +6 -29
- package/src/modules/dx/popover/popover.ts +7 -119
- package/src/modules/dx/sidebar/sidebar.html +0 -1
- package/src/modules/dx/sidebarOld/sidebarOld.html +0 -1
- package/src/modules/dx/tree/tree.html +0 -1
- package/src/modules/dx/tree/tree.ts +1 -5
- package/src/modules/dx/tree/treeHandler.ts +11 -85
- package/src/modules/dx/treeItem/treeItem.css +0 -30
- package/src/modules/dx/treeItem/treeItem.html +2 -17
- package/src/modules/dx/treeItem/treeItem.ts +11 -109
- package/src/modules/dx/treeTile/treeTile.css +0 -4
- package/src/modules/dx/treeTile/treeTile.ts +3 -12
- package/src/modules/dx/typeBadge/typeBadge.ts +2 -23
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +6 -1
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +3 -3
- package/src/modules/dxHelpers/commonTreeItem/commonTreeItem.css +0 -4
- package/src/modules/dxHelpers/typeBadge/typeBadge.css +0 -22
- package/src/modules/dx/versionPicker/versionPicker.css +0 -248
- package/src/modules/dx/versionPicker/versionPicker.html +0 -73
- package/src/modules/dx/versionPicker/versionPicker.ts +0 -157
- package/src/modules/dxUtils/topicVersion/topicVersion.ts +0 -511
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { InternalTreeNode, TreeNode } from "typings/custom";
|
|
2
|
-
import type { TopicVersionOption } from "dxUtils/topicVersion";
|
|
3
|
-
import {
|
|
4
|
-
applyVersionToHref,
|
|
5
|
-
normalizePath,
|
|
6
|
-
resolveSelectedVersion
|
|
7
|
-
} from "dxUtils/topicVersion";
|
|
8
|
-
|
|
9
|
-
type VersionedTreeNode = TreeNode & { versions?: TopicVersionOption[] };
|
|
10
|
-
type VersionedInternalTreeNode = InternalTreeNode & {
|
|
11
|
-
versions?: TopicVersionOption[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
2
|
type MapItem = {
|
|
15
|
-
node:
|
|
3
|
+
node: InternalTreeNode;
|
|
16
4
|
parent?: MapItem;
|
|
17
5
|
setExpanded?: Function;
|
|
18
6
|
};
|
|
@@ -22,10 +10,8 @@ const ROOT_KEY = "0";
|
|
|
22
10
|
export class TreeHandler {
|
|
23
11
|
private _nodeMap: { [key: string]: MapItem };
|
|
24
12
|
private _nameKeyMap: { [key: string]: string };
|
|
25
|
-
private _language?: string;
|
|
26
13
|
|
|
27
|
-
constructor(
|
|
28
|
-
this._language = language;
|
|
14
|
+
constructor() {
|
|
29
15
|
this._nodeMap = {};
|
|
30
16
|
this._nameKeyMap = {};
|
|
31
17
|
}
|
|
@@ -35,10 +21,7 @@ export class TreeHandler {
|
|
|
35
21
|
}
|
|
36
22
|
|
|
37
23
|
getKeyByName(name: string): string | undefined {
|
|
38
|
-
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
return this._nameKeyMap[name] || this._nameKeyMap[normalizePath(name)];
|
|
24
|
+
return name && this._nameKeyMap[name];
|
|
42
25
|
}
|
|
43
26
|
|
|
44
27
|
initialize(treeRoot: TreeNode): InternalTreeNode {
|
|
@@ -65,41 +48,12 @@ export class TreeHandler {
|
|
|
65
48
|
}
|
|
66
49
|
|
|
67
50
|
private convert(
|
|
68
|
-
node:
|
|
51
|
+
node: TreeNode,
|
|
69
52
|
level: number = 0,
|
|
70
53
|
parent?: MapItem,
|
|
71
|
-
position?: number
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
versions: TopicVersionOption[];
|
|
75
|
-
}
|
|
76
|
-
): VersionedInternalTreeNode {
|
|
77
|
-
const ownSelected = node.versions?.length
|
|
78
|
-
? resolveSelectedVersion(node, this._language)
|
|
79
|
-
: undefined;
|
|
80
|
-
const versionContext =
|
|
81
|
-
ownSelected && node.versions
|
|
82
|
-
? { selected: ownSelected, versions: node.versions }
|
|
83
|
-
: ancestorVersion;
|
|
84
|
-
|
|
85
|
-
let link = node.link;
|
|
86
|
-
if (
|
|
87
|
-
versionContext &&
|
|
88
|
-
!node.versions?.length &&
|
|
89
|
-
link?.href &&
|
|
90
|
-
link.target !== "_blank"
|
|
91
|
-
) {
|
|
92
|
-
const rewritten = applyVersionToHref(
|
|
93
|
-
link.href,
|
|
94
|
-
versionContext.selected,
|
|
95
|
-
versionContext.versions
|
|
96
|
-
);
|
|
97
|
-
if (rewritten && rewritten !== link.href) {
|
|
98
|
-
link = { ...link, href: rewritten };
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const convertedNode: VersionedInternalTreeNode = {
|
|
54
|
+
position?: number
|
|
55
|
+
): InternalTreeNode {
|
|
56
|
+
const convertedNode: InternalTreeNode = {
|
|
103
57
|
label: node.label,
|
|
104
58
|
name: node.name,
|
|
105
59
|
key: this.calculateKey(
|
|
@@ -109,52 +63,24 @@ export class TreeHandler {
|
|
|
109
63
|
level: level,
|
|
110
64
|
isExpanded: node.isExpanded || false,
|
|
111
65
|
isChildrenLoading: node.isChildrenLoading || false,
|
|
112
|
-
link,
|
|
66
|
+
link: node.link,
|
|
113
67
|
method: node.method,
|
|
114
68
|
showForwardArrow: node.showForwardArrow,
|
|
115
|
-
redirectToChild: node.redirectToChild
|
|
116
|
-
versions: node.versions
|
|
69
|
+
redirectToChild: node.redirectToChild
|
|
117
70
|
};
|
|
118
71
|
|
|
119
72
|
const mapItem = { node: convertedNode, parent };
|
|
120
73
|
if (node.children && node.children.length > 0) {
|
|
121
74
|
convertedNode.children = node.children.map((child, index) =>
|
|
122
|
-
this.convert(child, level + 1, mapItem, index
|
|
75
|
+
this.convert(child, level + 1, mapItem, index)
|
|
123
76
|
);
|
|
124
77
|
}
|
|
125
78
|
|
|
126
79
|
this._nodeMap[convertedNode.key] = mapItem;
|
|
127
|
-
this.
|
|
128
|
-
// A redirect parent can carry a child's href. This index runs after
|
|
129
|
-
// the child, so recording it would make the parent win selection.
|
|
130
|
-
if (!convertedNode.redirectToChild) {
|
|
131
|
-
this.indexName(convertedNode.link?.href, convertedNode.key);
|
|
132
|
-
}
|
|
133
|
-
// Index this topic's own versioned URLs only. Parent-only switching
|
|
134
|
-
// URLs point at a child with content and must not steal that child's
|
|
135
|
-
// selection.
|
|
136
|
-
if (node.name && node.versions) {
|
|
137
|
-
for (const version of node.versions) {
|
|
138
|
-
this.indexName(
|
|
139
|
-
applyVersionToHref(node.name, version, node.versions),
|
|
140
|
-
convertedNode.key
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
80
|
+
this._nameKeyMap[convertedNode.name] = convertedNode.key;
|
|
144
81
|
return convertedNode;
|
|
145
82
|
}
|
|
146
83
|
|
|
147
|
-
private indexName(name: string | undefined, key: string): void {
|
|
148
|
-
if (!name) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
this._nameKeyMap[name] = key;
|
|
152
|
-
const normalized = normalizePath(name);
|
|
153
|
-
if (normalized && normalized !== name) {
|
|
154
|
-
this._nameKeyMap[normalized] = key;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
84
|
private calculateKey(parentKey: string, position?: number): string {
|
|
159
85
|
if (position === undefined) {
|
|
160
86
|
return parentKey;
|
|
@@ -2,36 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
-
|
|
6
|
-
/* Keep a stable containing block; z-index still lifts the open menu. */
|
|
7
|
-
position: relative;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Lift this row above later sibling pickers while its menu is open. */
|
|
11
|
-
:host(:focus-within) {
|
|
12
|
-
z-index: 2;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.tree-item-row {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
min-width: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.tree-item-row dx-tree-tile {
|
|
22
|
-
flex: 1;
|
|
23
|
-
min-width: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.tree-item-version-picker {
|
|
27
|
-
flex: 0 0 auto;
|
|
28
|
-
margin-right: var(--dx-g-spacing-lg);
|
|
29
|
-
overflow: visible;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.tree-item-row-selected {
|
|
33
|
-
background: var(--dx-g-cloud-blue-vibrant-95);
|
|
34
|
-
box-shadow: inset var(--dx-g-spacing-xs) 0 0 0 var(--dx-g-blue-vibrant-40);
|
|
35
5
|
}
|
|
36
6
|
|
|
37
7
|
button {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<a href={href} target={target} onclick={onLinkClick} tabindex="-1">
|
|
3
3
|
<dx-tree-tile
|
|
4
4
|
href={href}
|
|
5
5
|
is-root={isRoot}
|
|
@@ -7,26 +7,12 @@
|
|
|
7
7
|
is-expanded={isExpanded}
|
|
8
8
|
has-children={hasChildren}
|
|
9
9
|
is-selected={isSelected}
|
|
10
|
-
is-contained-selection={isContainedSelection}
|
|
11
10
|
oniconclick={onIconClick}
|
|
12
11
|
show-arrow={isParent}
|
|
13
12
|
target={target}
|
|
14
13
|
is-external-link={isExternalLink}
|
|
15
|
-
has-version-picker={showVersionPicker}
|
|
16
|
-
onclick={onLinkClick}
|
|
17
14
|
></dx-tree-tile>
|
|
18
|
-
|
|
19
|
-
if:true={showVersionPicker}
|
|
20
|
-
class="tree-item-version-picker"
|
|
21
|
-
small="true"
|
|
22
|
-
versions={versionPickerOptions}
|
|
23
|
-
selected-version={selectedVersion}
|
|
24
|
-
latest-version={isLatestVersion}
|
|
25
|
-
onchange={onVersionChange}
|
|
26
|
-
onclick={onVersionPickerClick}
|
|
27
|
-
onmousedown={onVersionPickerClick}
|
|
28
|
-
></dx-version-picker>
|
|
29
|
-
</div>
|
|
15
|
+
</a>
|
|
30
16
|
<img
|
|
31
17
|
if:true={showChildrenLoading}
|
|
32
18
|
class="tree-children-loading"
|
|
@@ -39,7 +25,6 @@
|
|
|
39
25
|
key={child.key}
|
|
40
26
|
tree-node={child}
|
|
41
27
|
selected-key={selectedKey}
|
|
42
|
-
language={language}
|
|
43
28
|
></dx-tree-item>
|
|
44
29
|
</template>
|
|
45
30
|
</template>
|
|
@@ -2,28 +2,12 @@ import { LightningElement, api } from "lwc";
|
|
|
2
2
|
import { InternalTreeNode } from "typings/custom";
|
|
3
3
|
import { track } from "dxUtils/analytics";
|
|
4
4
|
import { isInViewport } from "dxUtils/browser";
|
|
5
|
-
import type { TopicVersionOption } from "dxUtils/topicVersion";
|
|
6
|
-
import {
|
|
7
|
-
firstContentNode,
|
|
8
|
-
getTopicVersionKey,
|
|
9
|
-
getVersionPickerOptions,
|
|
10
|
-
isParentOnlyTopic,
|
|
11
|
-
normalizePath,
|
|
12
|
-
persistTopicVersion,
|
|
13
|
-
resolveSelectedVersion,
|
|
14
|
-
shouldShowTopicVersionPicker
|
|
15
|
-
} from "dxUtils/topicVersion";
|
|
16
5
|
|
|
17
6
|
const DEFAULT_TARGET = "_self";
|
|
18
7
|
|
|
19
|
-
type VersionedInternalTreeNode = InternalTreeNode & {
|
|
20
|
-
versions?: TopicVersionOption[];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
8
|
export default class TreeItem extends LightningElement {
|
|
24
9
|
@api selectedKey?: string;
|
|
25
10
|
@api isRoot: boolean = false;
|
|
26
|
-
@api language?: string;
|
|
27
11
|
|
|
28
12
|
@api
|
|
29
13
|
public get treeNode() {
|
|
@@ -36,7 +20,7 @@ export default class TreeItem extends LightningElement {
|
|
|
36
20
|
this.isChildrenLoading = (node && node.isChildrenLoading) || false;
|
|
37
21
|
}
|
|
38
22
|
|
|
39
|
-
private _treeNode!:
|
|
23
|
+
private _treeNode!: InternalTreeNode;
|
|
40
24
|
private isExpanded: boolean = false;
|
|
41
25
|
private isChildrenLoading: boolean = false;
|
|
42
26
|
private rootParentLabel: string = "";
|
|
@@ -46,22 +30,9 @@ export default class TreeItem extends LightningElement {
|
|
|
46
30
|
}
|
|
47
31
|
|
|
48
32
|
private get isSelected(): boolean {
|
|
49
|
-
if (isParentOnlyTopic(this._treeNode)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
33
|
return this._treeNode.key === this.selectedKey && !this.isExternalLink;
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
private get rowClass(): string {
|
|
56
|
-
return this.isSelected && this.showVersionPicker
|
|
57
|
-
? "tree-item-row tree-item-row-selected"
|
|
58
|
-
: "tree-item-row";
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private get isContainedSelection(): boolean {
|
|
62
|
-
return this.isSelected && this.showVersionPicker;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
36
|
private get hasChildren(): boolean {
|
|
66
37
|
return !!(
|
|
67
38
|
this.treeNode &&
|
|
@@ -112,48 +83,8 @@ export default class TreeItem extends LightningElement {
|
|
|
112
83
|
return `${parentLabels.reverse().join(":")}:${this.treeNode.label}`;
|
|
113
84
|
}
|
|
114
85
|
|
|
115
|
-
private get versions(): TopicVersionOption[] | undefined {
|
|
116
|
-
return this._treeNode?.versions;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
private get versionPickerOptions(): TopicVersionOption[] | undefined {
|
|
120
|
-
return getVersionPickerOptions(this._treeNode);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
private get showVersionPicker(): boolean {
|
|
124
|
-
return shouldShowTopicVersionPicker(
|
|
125
|
-
this.versions,
|
|
126
|
-
this._treeNode?.showForwardArrow
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private get selectedVersion(): TopicVersionOption | undefined {
|
|
131
|
-
return resolveSelectedVersion(this._treeNode, this.language);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private get topicVersionKey(): string {
|
|
135
|
-
return getTopicVersionKey(this._treeNode, this.language);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private get isLatestVersion(): boolean {
|
|
139
|
-
return (
|
|
140
|
-
!!this.selectedVersion &&
|
|
141
|
-
this.selectedVersion.id === this.versions?.[0]?.id
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
86
|
private get href(): string | undefined {
|
|
146
|
-
if (isParentOnlyTopic(this._treeNode)) {
|
|
147
|
-
const contentNode = firstContentNode(this._treeNode);
|
|
148
|
-
return (
|
|
149
|
-
contentNode?.link?.href ||
|
|
150
|
-
contentNode?.name ||
|
|
151
|
-
this.selectedVersion?.link?.href ||
|
|
152
|
-
""
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
87
|
return (
|
|
156
|
-
this.selectedVersion?.link?.href ||
|
|
157
88
|
(this._treeNode.link && this._treeNode.link.href) ||
|
|
158
89
|
this._treeNode.name ||
|
|
159
90
|
""
|
|
@@ -173,23 +104,6 @@ export default class TreeItem extends LightningElement {
|
|
|
173
104
|
setExpanded: this.setExpanded.bind(this)
|
|
174
105
|
});
|
|
175
106
|
}
|
|
176
|
-
|
|
177
|
-
// Remember this topic's resolved version (own URL, descendant URL, or
|
|
178
|
-
// session) so sibling pickers stay independent for the tab.
|
|
179
|
-
const selected = this.selectedVersion;
|
|
180
|
-
const topicKey = this.topicVersionKey;
|
|
181
|
-
if (this.versions?.length && selected && topicKey) {
|
|
182
|
-
persistTopicVersion(topicKey, selected.id);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
private onVersionChange(event: CustomEvent): void {
|
|
187
|
-
event.stopPropagation();
|
|
188
|
-
persistTopicVersion(this.topicVersionKey, event.detail);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
private onVersionPickerClick(event: Event): void {
|
|
192
|
-
event.stopPropagation();
|
|
193
107
|
}
|
|
194
108
|
|
|
195
109
|
renderedCallback(): void {
|
|
@@ -218,14 +132,10 @@ export default class TreeItem extends LightningElement {
|
|
|
218
132
|
}
|
|
219
133
|
|
|
220
134
|
private preventDefaultLinkBehavior(event: Event) {
|
|
221
|
-
//
|
|
222
|
-
// anchor. Parent-only topics are excluded: their href is the child page.
|
|
223
|
-
// Otherwise cancel only an empty href or a click on the current path.
|
|
135
|
+
// prevent page refresh if href isn't present or link is already active
|
|
224
136
|
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
!this.href ||
|
|
228
|
-
normalizePath(this.href) === normalizePath(window.location.pathname)
|
|
137
|
+
!this._treeNode.link?.href ||
|
|
138
|
+
this._treeNode.link?.href === window.location.pathname
|
|
229
139
|
) {
|
|
230
140
|
event.preventDefault();
|
|
231
141
|
}
|
|
@@ -245,14 +155,10 @@ export default class TreeItem extends LightningElement {
|
|
|
245
155
|
this.sendGtm(event);
|
|
246
156
|
return;
|
|
247
157
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this.doExpand(isSelectAction);
|
|
253
|
-
this.sendGtm(event);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
158
|
+
const isSelectAction = false;
|
|
159
|
+
this.doExpand(isSelectAction);
|
|
160
|
+
this.sendGtm(event);
|
|
161
|
+
return;
|
|
256
162
|
}
|
|
257
163
|
|
|
258
164
|
if (this.isParent) {
|
|
@@ -261,12 +167,8 @@ export default class TreeItem extends LightningElement {
|
|
|
261
167
|
}
|
|
262
168
|
|
|
263
169
|
this.sendGtm(event);
|
|
264
|
-
const contentNode = isParentOnlyTopic(this._treeNode)
|
|
265
|
-
? firstContentNode(this._treeNode)
|
|
266
|
-
: undefined;
|
|
267
170
|
this.fireEvent("tileselected", {
|
|
268
|
-
name:
|
|
269
|
-
...(contentNode?.key ? { key: contentNode.key } : {}),
|
|
171
|
+
name: this._treeNode.name,
|
|
270
172
|
isExternalLink: this.isExternalLink
|
|
271
173
|
});
|
|
272
174
|
}
|
|
@@ -284,8 +186,8 @@ export default class TreeItem extends LightningElement {
|
|
|
284
186
|
this.dispatchEvent(
|
|
285
187
|
new CustomEvent(type, {
|
|
286
188
|
detail: {
|
|
287
|
-
|
|
288
|
-
|
|
189
|
+
...detail,
|
|
190
|
+
key: this._treeNode.key
|
|
289
191
|
},
|
|
290
192
|
bubbles: true,
|
|
291
193
|
composed: true
|
|
@@ -28,12 +28,10 @@ export default class TreeTile extends LightningElement {
|
|
|
28
28
|
@api isExpanded = false;
|
|
29
29
|
@api hasChildren = false;
|
|
30
30
|
@api isSelected = false;
|
|
31
|
-
@api isContainedSelection = false;
|
|
32
31
|
@api href!: string;
|
|
33
32
|
@api showArrow = false;
|
|
34
33
|
@api target!: string;
|
|
35
34
|
@api isExternalLink = false;
|
|
36
|
-
@api hasVersionPicker = false;
|
|
37
35
|
|
|
38
36
|
get tileAriaLevel() {
|
|
39
37
|
return this.treeNode.level + 2;
|
|
@@ -45,21 +43,18 @@ export default class TreeTile extends LightningElement {
|
|
|
45
43
|
* screen reader users (WCAG 2.4.4)
|
|
46
44
|
*/
|
|
47
45
|
get linkAriaLabel(): string | null {
|
|
48
|
-
if (!this.treeNode.redirectToChild) {
|
|
46
|
+
if (!this.treeNode.redirectToChild || !this.treeNode.link?.href) {
|
|
49
47
|
return null;
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
52
50
|
* The redirect can target a deep descendant, so walk the first-child
|
|
53
51
|
* chain to the node that owns the destination link and name it.
|
|
54
|
-
* The destination href may live on this anchor (parent-only topics do
|
|
55
|
-
* not copy it onto the parent node).
|
|
56
52
|
*/
|
|
57
53
|
let destination = this.treeNode.children?.[0];
|
|
58
54
|
while (destination?.redirectToChild) {
|
|
59
55
|
destination = destination.children?.[0];
|
|
60
56
|
}
|
|
61
|
-
|
|
62
|
-
return destination?.link?.href && destination.link.href === triggerHref
|
|
57
|
+
return destination?.link?.href === this.treeNode.link.href
|
|
63
58
|
? `${this.treeNode.label}, opens ${destination.label}`
|
|
64
59
|
: null;
|
|
65
60
|
}
|
|
@@ -106,11 +101,7 @@ export default class TreeTile extends LightningElement {
|
|
|
106
101
|
"tile-root": this.isRoot,
|
|
107
102
|
"tile-with-children": !this.isRoot && this.hasChildren,
|
|
108
103
|
"tile-root-with-child": this.isRoot && this.showArrow,
|
|
109
|
-
"sidebar-item-selected":
|
|
110
|
-
this.isSelected && !this.isContainedSelection,
|
|
111
|
-
"sidebar-item-selected-text":
|
|
112
|
-
this.isSelected && this.isContainedSelection,
|
|
113
|
-
"tile-with-version-picker": this.hasVersionPicker
|
|
104
|
+
"sidebar-item-selected": this.isSelected
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
107
|
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
IconSprite,
|
|
8
8
|
IconData,
|
|
9
9
|
IconSymbol,
|
|
10
|
-
StatusBadgeVariant,
|
|
11
10
|
TypeBadgeSize
|
|
12
11
|
} from "typings/custom";
|
|
13
12
|
import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
|
|
@@ -21,16 +20,9 @@ import {
|
|
|
21
20
|
getContentTypeColorVariables
|
|
22
21
|
} from "dxUtils/contentTypes";
|
|
23
22
|
|
|
24
|
-
// Opt-in solid status variants (status-success/-warning/-error).
|
|
25
|
-
export const STATUS_BADGE_VARIANTS: StatusBadgeVariant[] = [
|
|
26
|
-
"status-success",
|
|
27
|
-
"status-warning",
|
|
28
|
-
"status-error"
|
|
29
|
-
];
|
|
30
|
-
|
|
31
23
|
export default class TypeBadge extends LightningElement {
|
|
32
24
|
@api size: TypeBadgeSize = "default";
|
|
33
|
-
@api variant: Brand | ContentType
|
|
25
|
+
@api variant: Brand | ContentType = "default";
|
|
34
26
|
@api color?: Color;
|
|
35
27
|
@api dark?: false;
|
|
36
28
|
|
|
@@ -95,24 +87,11 @@ export default class TypeBadge extends LightningElement {
|
|
|
95
87
|
return isContentType(this.variant);
|
|
96
88
|
}
|
|
97
89
|
|
|
98
|
-
private get isStatus(): boolean {
|
|
99
|
-
return STATUS_BADGE_VARIANTS.includes(
|
|
100
|
-
this.variant as StatusBadgeVariant
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
90
|
private get className(): string {
|
|
105
|
-
return cx(
|
|
106
|
-
"dx-badge",
|
|
107
|
-
`size-${this.size}`,
|
|
108
|
-
this.isStatus && this.variant
|
|
109
|
-
);
|
|
91
|
+
return cx("dx-badge", `size-${this.size}`);
|
|
110
92
|
}
|
|
111
93
|
|
|
112
94
|
private get style(): string {
|
|
113
|
-
if (this.isStatus) {
|
|
114
|
-
return "";
|
|
115
|
-
}
|
|
116
95
|
if (this.dark) {
|
|
117
96
|
return buildStyleColorVariables({
|
|
118
97
|
background: "--dx-g-purple-vibrant-40",
|
|
@@ -155,7 +155,12 @@ export abstract class HeaderBase extends LightningElement {
|
|
|
155
155
|
setTimeout(() => {
|
|
156
156
|
const id = hash.replace("#", "");
|
|
157
157
|
const element = document.getElementById(id);
|
|
158
|
-
|
|
158
|
+
// doc-heading targets are scrolled by doc-content-layout once the page has rendered
|
|
159
|
+
if (
|
|
160
|
+
element &&
|
|
161
|
+
element.tagName !== "DOC-HEADING" &&
|
|
162
|
+
element.scrollIntoView
|
|
163
|
+
) {
|
|
159
164
|
element.scrollIntoView();
|
|
160
165
|
}
|
|
161
166
|
}, 0);
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
--dx-c-sidebar-button-border-hover: var(--dx-g-blue-vibrant-50);
|
|
12
12
|
--dx-c-sidebar-left-padding: var(--dx-g-global-header-padding-horizontal);
|
|
13
13
|
--dx-c-sidebar-vertical-padding: var(--dx-g-spacing-md);
|
|
14
|
-
--
|
|
14
|
+
--doc-version-picker-width: 296px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.header {
|
|
@@ -170,9 +170,9 @@
|
|
|
170
170
|
margin-bottom: var(--dx-g-spacing-2xl);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
@media screen and (max-width:
|
|
173
|
+
@media screen and (max-width: 767px) {
|
|
174
174
|
:host {
|
|
175
|
-
--
|
|
175
|
+
--doc-version-picker-width: calc(
|
|
176
176
|
100vw - var(--dx-c-sidebar-left-padding) - var(--dx-g-spacing-lg)
|
|
177
177
|
);
|
|
178
178
|
}
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
color: var(--dx-g-blue-vibrant-40) !important;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.sidebar-item-selected-text {
|
|
17
|
-
color: var(--dx-g-blue-vibrant-40) !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
.sidebar-item {
|
|
21
17
|
padding: 6px var(--dx-g-spacing-lg) 6px
|
|
22
18
|
var(--dx-g-global-header-padding-horizontal);
|
|
@@ -26,28 +26,6 @@
|
|
|
26
26
|
--height: var(--dx-g-spacing-mlg);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.dx-badge.status-success,
|
|
30
|
-
.dx-badge.status-warning,
|
|
31
|
-
.dx-badge.status-error {
|
|
32
|
-
/* No spacing token maps to 10px; status badges need this exact padding. */
|
|
33
|
-
--horizontal-spacing: 10px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.dx-badge.status-success {
|
|
37
|
-
--color: var(--sds-g-gray-1);
|
|
38
|
-
--background: var(--dx-g-green-vibrant-50);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.dx-badge.status-warning {
|
|
42
|
-
--color: var(--dx-g-gray-15);
|
|
43
|
-
--background: var(--dx-g-yellow-vibrant-80);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.dx-badge.status-error {
|
|
47
|
-
--color: var(--sds-g-gray-1);
|
|
48
|
-
--background: var(--dx-g-red-vibrant-40);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
29
|
svg,
|
|
52
30
|
dx-icon {
|
|
53
31
|
margin-right: var(--dx-g-spacing-sm);
|