@salesforcedevs/dx-components 1.3.243-newdocux-alpha5 → 1.3.244-alpha
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/lwc.config.json +0 -1
- package/package.json +1 -1
- package/src/modules/dx/button/button.html +2 -2
- package/src/modules/dx/button/button.ts +1 -1
- package/src/modules/dx/coveoRecommendations/coveoRecommendations.ts +27 -2
- package/src/modules/dx/dropdownOption/dropdownOption.css +3 -5
- package/src/modules/dx/headerNav/headerNav.css +0 -9
- package/src/modules/dx/popover/popover.css +2 -2
- package/src/modules/dx/searchResults/coveo.css +1 -1
- package/src/modules/dx/sidebar/sidebar.css +5 -9
- package/src/modules/dx/sidebar/sidebar.html +16 -32
- package/src/modules/dx/sidebar/sidebar.ts +42 -2
- package/src/modules/dx/sidebarOld/sidebarOld.css +0 -1
- package/src/modules/dx/sidebarOld/sidebarOld.html +14 -31
- package/src/modules/dx/sidebarOld/sidebarOld.ts +38 -4
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +4 -35
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +10 -16
- package/src/modules/dx/tab/tab.css +19 -48
- package/src/modules/dx/treeItem/treeItem.css +2 -2
- package/src/modules/dx/treeTile/treeTile.css +28 -37
- package/src/modules/dx/treeTile/treeTile.html +6 -6
- package/src/modules/dx/treeTile/treeTile.ts +1 -2
- package/src/modules/dxBaseElements/sidebarBase/sidebarBase.ts +1 -100
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +2 -6
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +16 -38
- package/src/modules/dxHelpers/commonTreeItem/commonTreeItem.css +3 -26
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.css +0 -49
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.html +0 -55
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.ts +0 -106
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
aria-label={ariaLabel}
|
|
8
8
|
part="container"
|
|
9
9
|
>
|
|
10
|
-
<span if:false={loading}
|
|
10
|
+
<span if:false={loading}>
|
|
11
11
|
<slot onslotchange={onSlotChange}></slot>
|
|
12
12
|
</span>
|
|
13
13
|
<dx-icon
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
aria-label={ariaLabel}
|
|
30
30
|
part="container"
|
|
31
31
|
>
|
|
32
|
-
<span if:false={loading}
|
|
32
|
+
<span if:false={loading}>
|
|
33
33
|
<slot onslotchange={onSlotChange}></slot>
|
|
34
34
|
</span>
|
|
35
35
|
<dx-icon
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
|
|
3
|
+
const SEARCH_HUB = "developerWebsiteBlogs";
|
|
3
4
|
export default class CoveoRecommendations extends LightningElement {
|
|
4
5
|
@api coveoAuthToken!: string;
|
|
6
|
+
@api coveoOrganizationId!: string;
|
|
5
7
|
|
|
6
8
|
_recommendations = [] as any[];
|
|
9
|
+
_searchTime = 0;
|
|
7
10
|
|
|
8
11
|
private get recommendations(): any[] {
|
|
9
12
|
return this._recommendations || [];
|
|
@@ -17,6 +20,7 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
17
20
|
"__coveo.analytics.history"
|
|
18
21
|
);
|
|
19
22
|
const url = "https://platform.cloud.coveo.com/rest/search/v2";
|
|
23
|
+
const searchStart = performance.now();
|
|
20
24
|
fetch(url, {
|
|
21
25
|
headers: {
|
|
22
26
|
Authorization: `Bearer ${this.coveoAuthToken}`,
|
|
@@ -25,12 +29,15 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
25
29
|
method: "POST",
|
|
26
30
|
body: JSON.stringify({
|
|
27
31
|
pipeline: "Recommendations_Developer_Blogs",
|
|
28
|
-
searchHub:
|
|
32
|
+
searchHub: SEARCH_HUB,
|
|
29
33
|
numberOfResults: 3,
|
|
30
|
-
actionsHistory: JSON.parse(actionsHistory!)
|
|
34
|
+
actionsHistory: JSON.parse(actionsHistory!),
|
|
35
|
+
isGuestUser: true
|
|
31
36
|
})
|
|
32
37
|
}).then(
|
|
33
38
|
async (response) => {
|
|
39
|
+
this._searchTime = performance.now() - searchStart;
|
|
40
|
+
this.logSearchAnalytics();
|
|
34
41
|
try {
|
|
35
42
|
const results = (await response.json()).results;
|
|
36
43
|
const blogDataLoadTasks = results
|
|
@@ -57,4 +64,22 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
57
64
|
}
|
|
58
65
|
);
|
|
59
66
|
}
|
|
67
|
+
|
|
68
|
+
logSearchAnalytics = () => {
|
|
69
|
+
const payload = {
|
|
70
|
+
anonymous: true,
|
|
71
|
+
language: "en",
|
|
72
|
+
originLevel1: SEARCH_HUB,
|
|
73
|
+
originLevel2: SEARCH_HUB,
|
|
74
|
+
actionCause: "recommendationInterfaceLoad",
|
|
75
|
+
responseTime: this._searchTime
|
|
76
|
+
};
|
|
77
|
+
fetch(
|
|
78
|
+
`https://${this.coveoOrganizationId}.analytics.org.coveo.com/rest/ua/v15/analytics/search`,
|
|
79
|
+
{
|
|
80
|
+
method: "POST",
|
|
81
|
+
body: JSON.stringify(payload)
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
};
|
|
60
85
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.option:active {
|
|
41
|
-
background: var(--dx-g-
|
|
41
|
+
background: var(--dx-g-blue-vibrant-95) !important;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.option:not(.option-active):hover {
|
|
@@ -46,9 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.option-active {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
background: var(--dx-g-cloud-blue-vibrant-95);
|
|
49
|
+
background: var(--dx-g-blue-vibrant-95);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
.option_details {
|
|
@@ -69,7 +67,7 @@
|
|
|
69
67
|
color: var(--dx-c-dropdown-option-label-color, var(--dx-g-blue-vibrant-50));
|
|
70
68
|
display: flex;
|
|
71
69
|
align-items: center;
|
|
72
|
-
font-weight: var(--dx-
|
|
70
|
+
font-weight: var(--dx-g-font-bold);
|
|
73
71
|
font-size: var(--dx-c-dropdown-option-font-size, var(--dx-g-text-base));
|
|
74
72
|
}
|
|
75
73
|
|
|
@@ -10,26 +10,17 @@ nav {
|
|
|
10
10
|
|
|
11
11
|
.nav-list {
|
|
12
12
|
display: flex;
|
|
13
|
-
margin-top: calc(var(--dx-g-spacing-2xs) + 1px);
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.nav-list li {
|
|
17
16
|
position: relative;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
.nav-list li:not(:last-child) {
|
|
21
|
-
margin-right: var(--dx-g-spacing-md);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
19
|
.nav-list-item-nav-menu {
|
|
25
20
|
display: none;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
@media (max-width: 768px) {
|
|
29
|
-
.nav-list {
|
|
30
|
-
margin-top: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
24
|
.nav-list-item-nav-menu {
|
|
34
25
|
display: flex;
|
|
35
26
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
max-height: 65vh;
|
|
29
29
|
padding: var(--popover-padding);
|
|
30
30
|
overflow-y: auto;
|
|
31
|
-
transition:
|
|
31
|
+
transition: opacity 0.2s linear, transform 0.2s linear;
|
|
32
32
|
transition-delay: 0.02s;
|
|
33
33
|
transform: translateY(var(--dx-g-spacing-xs));
|
|
34
34
|
opacity: 0;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
.popover-container_open .popover {
|
|
43
43
|
opacity: 1;
|
|
44
|
-
transform:
|
|
44
|
+
transform: translateY(0);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.popover-overridewidth {
|
|
@@ -7944,7 +7944,7 @@ select.coveo-dropdown::-ms-expand {
|
|
|
7944
7944
|
|
|
7945
7945
|
@font-face {
|
|
7946
7946
|
font-family: "Lato";
|
|
7947
|
-
src: url('https://static.cloud.coveo.com/searchui/v2.
|
|
7947
|
+
src: url('https://static.cloud.coveo.com/searchui/v2.10115/0/fonts/lato.woff2'), url('https://staticdev.cloud.coveo.com/searchui/v2.10115/0/fonts/lato.woff2'), url('../fonts/lato.woff2'), url('https://static.cloud.coveo.com/searchui/v2.10115/0/fonts/lato.woff'), url('https://staticdev.cloud.coveo.com/searchui/v2.10115/0/fonts/lato.woff'), url('../fonts/lato.woff');
|
|
7948
7948
|
font-weight: normal;
|
|
7949
7949
|
font-style: normal;
|
|
7950
7950
|
}
|
|
@@ -15,7 +15,7 @@ dx-empty-state {
|
|
|
15
15
|
|
|
16
16
|
.sidebar-content {
|
|
17
17
|
overflow-y: auto;
|
|
18
|
-
padding: var(--dx-g-spacing-
|
|
18
|
+
padding-bottom: var(--dx-g-spacing-md);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.loading-skeleton {
|
|
@@ -53,14 +53,6 @@ dx-empty-state {
|
|
|
53
53
|
--dx-c-button-secondary-color-hover: var(--dx-g-gray-80);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.results-heading {
|
|
57
|
-
--dx-g-text-body-color: var(--sds-g-gray-14);
|
|
58
|
-
|
|
59
|
-
margin-bottom: var(--dx-g-spacing-sm);
|
|
60
|
-
padding-top: var(--dx-g-spacing-smd);
|
|
61
|
-
font-weight: var(--dx-g-font-bold);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
56
|
@media (max-width: 768px) {
|
|
65
57
|
:host {
|
|
66
58
|
width: 100%;
|
|
@@ -69,4 +61,8 @@ dx-empty-state {
|
|
|
69
61
|
.loading-skeleton {
|
|
70
62
|
width: 100%;
|
|
71
63
|
}
|
|
64
|
+
|
|
65
|
+
.sidebar-content-tree {
|
|
66
|
+
padding: 0 var(--dx-g-spacing-sm);
|
|
67
|
+
}
|
|
72
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class={containerClass} part="container">
|
|
3
3
|
<div
|
|
4
|
-
|
|
4
|
+
if:true={mobile}
|
|
5
5
|
class="header padding-horizontal"
|
|
6
6
|
onclick={onToggleClick}
|
|
7
7
|
>
|
|
@@ -16,17 +16,22 @@
|
|
|
16
16
|
<dx-icon
|
|
17
17
|
sprite="utility"
|
|
18
18
|
symbol={menuSymbol}
|
|
19
|
-
color="blue-vibrant-
|
|
20
|
-
size="medium"
|
|
19
|
+
color="blue-vibrant-20"
|
|
21
20
|
></dx-icon>
|
|
22
21
|
</dx-button>
|
|
23
22
|
</div>
|
|
24
23
|
</div>
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
<div class="sidebar-header padding-horizontal">
|
|
26
|
+
<div class="header" if:false={mobile}>
|
|
27
27
|
<h2 class="dx-text-display-6 header-title">{header}</h2>
|
|
28
|
+
<slot name="header"></slot>
|
|
28
29
|
</div>
|
|
29
|
-
<div class="
|
|
30
|
+
<div class="mobile-header" if:true={mobile}>
|
|
31
|
+
<h2 class="dx-text-display-6">{header}</h2>
|
|
32
|
+
<slot name="header"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="search">
|
|
30
35
|
<dx-sidebar-search
|
|
31
36
|
onchange={onSearchChange}
|
|
32
37
|
onloading={onSearchLoading}
|
|
@@ -36,10 +41,9 @@
|
|
|
36
41
|
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
37
42
|
></dx-sidebar-search>
|
|
38
43
|
</div>
|
|
39
|
-
<slot name="version-picker"></slot>
|
|
40
44
|
<h2
|
|
41
|
-
class="results-heading dx-text-
|
|
42
|
-
|
|
45
|
+
class="results-heading dx-text-display-8"
|
|
46
|
+
if:true={showResultsHeading}
|
|
43
47
|
>
|
|
44
48
|
Results
|
|
45
49
|
</h2>
|
|
@@ -49,13 +53,13 @@
|
|
|
49
53
|
onscroll={onSidebarSearchContentScroll}
|
|
50
54
|
>
|
|
51
55
|
<img
|
|
52
|
-
|
|
56
|
+
if:true={isSearchLoading}
|
|
53
57
|
class="loading-skeleton padding-horizontal"
|
|
54
58
|
src="https://a.sfdcstatic.com/developer-website/images/sidebar-loading.svg"
|
|
55
59
|
alt="loading"
|
|
56
60
|
/>
|
|
57
61
|
<template
|
|
58
|
-
|
|
62
|
+
if:true={showSearchResults}
|
|
59
63
|
for:each={searchResults}
|
|
60
64
|
for:item="result"
|
|
61
65
|
>
|
|
@@ -79,7 +83,7 @@
|
|
|
79
83
|
size="small"
|
|
80
84
|
></dx-empty-state>
|
|
81
85
|
</div>
|
|
82
|
-
<div class=
|
|
86
|
+
<div class="sidebar-content sidebar-content-tree">
|
|
83
87
|
<dx-tree
|
|
84
88
|
for:each={trees}
|
|
85
89
|
for:item="tree"
|
|
@@ -91,25 +95,5 @@
|
|
|
91
95
|
onselecteditemrendered={onSelectedItemRendered}
|
|
92
96
|
></dx-tree>
|
|
93
97
|
</div>
|
|
94
|
-
<template lwc:if={mobile}>
|
|
95
|
-
<div lwc:if={hasMobileSidebarFooter} class="footer-nav">
|
|
96
|
-
<dx-sidebar-footer-nav
|
|
97
|
-
lang-value-path={langValuePath}
|
|
98
|
-
language={language}
|
|
99
|
-
languages={languages}
|
|
100
|
-
></dx-sidebar-footer-nav>
|
|
101
|
-
</div>
|
|
102
|
-
</template>
|
|
103
|
-
<template lwc:else>
|
|
104
|
-
<div lwc:if={hasSidebarFooter} class="footer-nav">
|
|
105
|
-
<dx-sidebar-footer-nav
|
|
106
|
-
lang-value-path={langValuePath}
|
|
107
|
-
language={language}
|
|
108
|
-
languages={languages}
|
|
109
|
-
bail-href={bailHref}
|
|
110
|
-
bail-label={bailLabel}
|
|
111
|
-
></dx-sidebar-footer-nav>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
114
98
|
</div>
|
|
115
99
|
</template>
|
|
@@ -15,6 +15,15 @@ export default class Sidebar extends SidebarBase {
|
|
|
15
15
|
@api coveoAdvancedQueryConfig!: string;
|
|
16
16
|
@api header: string = "";
|
|
17
17
|
|
|
18
|
+
@api
|
|
19
|
+
get value() {
|
|
20
|
+
return this._value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set value(value) {
|
|
24
|
+
this._value = value;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
@api
|
|
19
28
|
get trees() {
|
|
20
29
|
return this._trees;
|
|
@@ -43,10 +52,16 @@ export default class Sidebar extends SidebarBase {
|
|
|
43
52
|
)?.setInputValue(searchTerm);
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
private expanded: boolean = true;
|
|
56
|
+
private _value?: string = undefined;
|
|
57
|
+
|
|
46
58
|
@track
|
|
47
59
|
private _trees!: Array<TreeNode>;
|
|
60
|
+
|
|
61
|
+
private mobile: boolean = true;
|
|
48
62
|
private matchMedia!: MediaQueryList;
|
|
49
63
|
private valueToLabel: { [key: string]: string } = {};
|
|
64
|
+
|
|
50
65
|
private isSearchLoading: boolean = false;
|
|
51
66
|
private searchValue: string | null = null;
|
|
52
67
|
private searchResults: SidebarSearchResult[] = [];
|
|
@@ -156,6 +171,32 @@ export default class Sidebar extends SidebarBase {
|
|
|
156
171
|
this.matchMedia.removeEventListener("change", this.onMediaChange);
|
|
157
172
|
}
|
|
158
173
|
|
|
174
|
+
private onMediaChange = (event: MediaQueryListEvent | MediaQueryList) => {
|
|
175
|
+
this.mobile = event.matches;
|
|
176
|
+
this.expanded = !this.mobile;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
private onSelect(event: CustomEvent) {
|
|
180
|
+
this._value = event.detail.name;
|
|
181
|
+
|
|
182
|
+
if (this.mobile) {
|
|
183
|
+
this.onToggleClick();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private onToggleClick() {
|
|
188
|
+
this.expanded = !this.expanded;
|
|
189
|
+
this.dispatchEvent(
|
|
190
|
+
new CustomEvent("togglesidebar", {
|
|
191
|
+
detail: {
|
|
192
|
+
open: this.expanded,
|
|
193
|
+
bubbles: true,
|
|
194
|
+
composed: true
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
159
200
|
private makeKey(): string {
|
|
160
201
|
return Math.random().toString(36).substring(7);
|
|
161
202
|
}
|
|
@@ -175,7 +216,7 @@ export default class Sidebar extends SidebarBase {
|
|
|
175
216
|
this.isSearchLoading = e.detail;
|
|
176
217
|
}
|
|
177
218
|
|
|
178
|
-
private onSidebarSearchContentScroll(
|
|
219
|
+
private onSidebarSearchContentScroll() {
|
|
179
220
|
if (this.isSearchLoading) {
|
|
180
221
|
return;
|
|
181
222
|
}
|
|
@@ -192,7 +233,6 @@ export default class Sidebar extends SidebarBase {
|
|
|
192
233
|
this.requestedFetchMoreResults = true;
|
|
193
234
|
search.fetchMoreResults();
|
|
194
235
|
}
|
|
195
|
-
this.handleScroll(scrollEvent);
|
|
196
236
|
}
|
|
197
237
|
|
|
198
238
|
private initializeSearchScrollPosition() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class={containerClass}>
|
|
3
3
|
<div
|
|
4
|
-
|
|
4
|
+
if:true={mobile}
|
|
5
5
|
class="header padding-horizontal"
|
|
6
6
|
onclick={onToggleClick}
|
|
7
7
|
>
|
|
@@ -16,19 +16,23 @@
|
|
|
16
16
|
<dx-icon
|
|
17
17
|
sprite="utility"
|
|
18
18
|
symbol={menuSymbol}
|
|
19
|
-
color="blue-vibrant-
|
|
20
|
-
size="medium"
|
|
19
|
+
color="blue-vibrant-20"
|
|
21
20
|
></dx-icon>
|
|
22
21
|
</dx-button>
|
|
23
22
|
</div>
|
|
24
23
|
</div>
|
|
25
24
|
|
|
26
|
-
<template
|
|
27
|
-
<div class="
|
|
28
|
-
<div class="header
|
|
25
|
+
<template if:true={expanded}>
|
|
26
|
+
<div class="padding-horizontal">
|
|
27
|
+
<div class="header" if:false={mobile}>
|
|
29
28
|
<h2 class="dx-text-display-6 header-title">{header}</h2>
|
|
29
|
+
<slot name="header"></slot>
|
|
30
30
|
</div>
|
|
31
|
-
<div class="
|
|
31
|
+
<div class="mobile-header" if:true={mobile}>
|
|
32
|
+
<h2 class="dx-text-display-6">{header}</h2>
|
|
33
|
+
<slot name="header"></slot>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="search">
|
|
32
36
|
<dx-input
|
|
33
37
|
class="search-box"
|
|
34
38
|
type="search"
|
|
@@ -42,12 +46,10 @@
|
|
|
42
46
|
shortcut-key="j"
|
|
43
47
|
></dx-input>
|
|
44
48
|
</div>
|
|
45
|
-
<slot name="version-picker"></slot>
|
|
46
49
|
</div>
|
|
47
50
|
<div
|
|
48
|
-
class=
|
|
49
|
-
|
|
50
|
-
onscroll={handleScroll}
|
|
51
|
+
class="sidebar-content sidebar-content-tree"
|
|
52
|
+
if:true={anyResultMatch}
|
|
51
53
|
>
|
|
52
54
|
<dx-tree
|
|
53
55
|
for:each={filteredTrees}
|
|
@@ -66,27 +68,8 @@
|
|
|
66
68
|
title="No Results"
|
|
67
69
|
body={emptyStateBody}
|
|
68
70
|
suggestions={emptyStateSuggestions}
|
|
69
|
-
|
|
71
|
+
if:false={anyResultMatch}
|
|
70
72
|
></dx-empty-state>
|
|
71
|
-
<div lwc:if={hasMobileSidebarFooter} class="footer-nav">
|
|
72
|
-
<dx-sidebar-footer-nav
|
|
73
|
-
lang-value-path={langValuePath}
|
|
74
|
-
language={language}
|
|
75
|
-
languages={languages}
|
|
76
|
-
></dx-sidebar-footer-nav>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<template lwc:if={isDesktop}>
|
|
81
|
-
<div lwc:if={hasSidebarFooter} class="footer-nav">
|
|
82
|
-
<dx-sidebar-footer-nav
|
|
83
|
-
lang-value-path={langValuePath}
|
|
84
|
-
language={language}
|
|
85
|
-
languages={languages}
|
|
86
|
-
bail-href={bailHref}
|
|
87
|
-
bail-label={bailLabel}
|
|
88
|
-
></dx-sidebar-footer-nav>
|
|
89
|
-
</div>
|
|
90
73
|
</template>
|
|
91
74
|
</div>
|
|
92
75
|
</template>
|
|
@@ -11,6 +11,15 @@ const MOBILE_SIZE_MATCH = "768px";
|
|
|
11
11
|
export default class Sidebar extends SidebarBase {
|
|
12
12
|
@api header: string = "";
|
|
13
13
|
|
|
14
|
+
@api
|
|
15
|
+
get value() {
|
|
16
|
+
return this._value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
set value(value) {
|
|
20
|
+
this._value = value;
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
@api
|
|
15
24
|
get trees() {
|
|
16
25
|
return this._trees;
|
|
@@ -28,10 +37,13 @@ export default class Sidebar extends SidebarBase {
|
|
|
28
37
|
this.assignFilteredTrees();
|
|
29
38
|
}
|
|
30
39
|
|
|
40
|
+
private expanded: boolean = true;
|
|
31
41
|
private _searchTimeout?: number;
|
|
42
|
+
private _value?: string = undefined;
|
|
32
43
|
private _trees!: Array<TreeNode>;
|
|
33
44
|
|
|
34
45
|
private filteredTrees: Array<{ key: string; tree: TreeNode }> = [];
|
|
46
|
+
private mobile: boolean = true;
|
|
35
47
|
private searchText: string = "";
|
|
36
48
|
private matchMedia!: MediaQueryList;
|
|
37
49
|
private valueToLabel: { [key: string]: string } = {};
|
|
@@ -70,10 +82,6 @@ export default class Sidebar extends SidebarBase {
|
|
|
70
82
|
]);
|
|
71
83
|
}
|
|
72
84
|
|
|
73
|
-
private get isDesktop(): boolean {
|
|
74
|
-
return !this.mobile;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
85
|
connectedCallback() {
|
|
78
86
|
this.matchMedia = window.matchMedia(
|
|
79
87
|
`(max-width: ${MOBILE_SIZE_MATCH})`
|
|
@@ -93,6 +101,32 @@ export default class Sidebar extends SidebarBase {
|
|
|
93
101
|
this.matchMedia.removeEventListener("change", this.onMediaChange);
|
|
94
102
|
}
|
|
95
103
|
|
|
104
|
+
private onMediaChange = (event: MediaQueryListEvent | MediaQueryList) => {
|
|
105
|
+
this.mobile = event.matches;
|
|
106
|
+
this.expanded = !this.mobile;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
private onSelect(event: CustomEvent) {
|
|
110
|
+
this._value = event.detail.name;
|
|
111
|
+
|
|
112
|
+
if (this.mobile) {
|
|
113
|
+
this.onToggleClick();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private onToggleClick() {
|
|
118
|
+
this.expanded = !this.expanded;
|
|
119
|
+
this.dispatchEvent(
|
|
120
|
+
new CustomEvent("togglesidebar", {
|
|
121
|
+
detail: {
|
|
122
|
+
open: this.expanded,
|
|
123
|
+
bubbles: true,
|
|
124
|
+
composed: true
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
96
130
|
/*
|
|
97
131
|
* Debouncing this method: Do not apply searchText filter as long as this
|
|
98
132
|
* function is being called to avoid running the recursivity logic very often.
|
|
@@ -8,60 +8,29 @@ a {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.sidebar-item {
|
|
11
|
-
padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-
|
|
12
|
-
var(--dx-g-spacing-smd) var(--dx-g-global-header-padding-horizontal);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.sidebar-item:not(.sidebar-item-selected):focus-visible {
|
|
16
|
-
padding: var(--dx-g-spacing-smd) 0;
|
|
17
|
-
margin: 0 var(--dx-g-spacing-lg) 0
|
|
18
|
-
var(--dx-g-global-header-padding-horizontal);
|
|
19
|
-
outline: var(--dx-g-spacing-2xs) solid var(--dx-g-blue-vibrant-40);
|
|
20
|
-
border-radius: var(--dx-g-spacing-2xs);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.sidebar-item-selected:focus-visible {
|
|
24
|
-
padding: 0 var(--dx-g-spacing-lg) 0
|
|
25
|
-
var(--dx-g-global-header-padding-horizontal);
|
|
26
|
-
outline: none;
|
|
27
|
-
|
|
28
|
-
.search-result {
|
|
29
|
-
outline: var(--dx-g-spacing-2xs) solid var(--dx-g-blue-vibrant-40);
|
|
30
|
-
border-radius: var(--dx-g-spacing-2xs);
|
|
31
|
-
padding: var(--dx-g-spacing-smd) 0;
|
|
32
|
-
}
|
|
11
|
+
padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-md);
|
|
33
12
|
}
|
|
34
13
|
|
|
35
14
|
.search-text {
|
|
36
|
-
font-size: var(--dx-g-text-
|
|
15
|
+
font-size: var(--dx-g-text-xs);
|
|
37
16
|
font-family: var(--dx-g-font-sans);
|
|
38
|
-
line-height:
|
|
39
|
-
font-weight: var(--dx-g-font-bold);
|
|
17
|
+
line-height: 18px;
|
|
40
18
|
overflow-wrap: break-word;
|
|
41
19
|
}
|
|
42
20
|
|
|
43
21
|
.description {
|
|
44
22
|
-webkit-line-clamp: 3;
|
|
45
23
|
overflow-wrap: break-word;
|
|
46
|
-
|
|
47
|
-
--dx-g-text-body-color: var(--dx-g-blue-vibrant-20);
|
|
48
|
-
|
|
49
|
-
font-weight: var(--dx-g-font-normal);
|
|
50
|
-
display: block;
|
|
51
24
|
}
|
|
52
25
|
|
|
53
26
|
.title {
|
|
54
27
|
color: var(--dx-g-text-heading-color);
|
|
55
28
|
}
|
|
56
29
|
|
|
57
|
-
.title:hover {
|
|
58
|
-
color: var(--dx-g-blue-vibrant-50);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
30
|
.bold {
|
|
62
31
|
font-weight: 700;
|
|
63
32
|
}
|
|
64
33
|
|
|
65
34
|
a > *:not(:last-child) {
|
|
66
|
-
margin-bottom:
|
|
35
|
+
margin-bottom: 2px;
|
|
67
36
|
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<a class={className} href={href} onclick={onClick}>
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<span class={chunk.class} key={chunk.id}>
|
|
14
|
-
{chunk.value}
|
|
15
|
-
</span>
|
|
16
|
-
</template>
|
|
17
|
-
</span>
|
|
18
|
-
</div>
|
|
3
|
+
<span class="title search-text">
|
|
4
|
+
<template for:each={titleChunks} for:item="chunk">
|
|
5
|
+
<span class={chunk.class} key={chunk.id}>{chunk.value}</span>
|
|
6
|
+
</template>
|
|
7
|
+
</span>
|
|
8
|
+
<span class="description dx-text-body-3 sidebar-item-truncate-text">
|
|
9
|
+
<template for:each={descriptionChunks} for:item="chunk">
|
|
10
|
+
<span class={chunk.class} key={chunk.id}>{chunk.value}</span>
|
|
11
|
+
</template>
|
|
12
|
+
</span>
|
|
19
13
|
</a>
|
|
20
14
|
</template>
|