@salesforcedevs/dx-components 1.32.0-alpha.8 → 1.32.0
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 +1 -1
- package/package.json +3 -3
- package/src/modules/dx/agentMiawUi/agentMiawUi.css +4 -0
- package/src/modules/dx/agentMiawUi/agentMiawUi.html +3 -0
- package/src/modules/dx/agentMiawUi/agentMiawUi.ts +167 -0
- package/src/modules/dx/codeBlock/codeBlock.css +7 -0
- package/src/modules/dx/dropdownOption/dropdownOption.css +8 -13
- package/src/modules/dx/footer/footer.ts +55 -32
- package/src/modules/dx/globalHeader/globalHeader.html +2 -2
- package/src/modules/dx/globalHeader/globalHeader.ts +40 -30
- package/src/modules/dx/searchResults/searchResults.css +6 -105
- package/src/modules/dx/searchResults/searchResults.html +91 -87
- package/src/modules/dx/searchResults/searchResults.ts +477 -174
- package/src/modules/dx/sidebar/sidebar.css +0 -1
- package/src/modules/dx/sidebar/sidebar.html +5 -1
- package/src/modules/dx/sidebar/sidebar.ts +29 -44
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +343 -159
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +25 -43
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +4 -12
- package/src/modules/dx/tree/treeHandler.ts +2 -1
- package/src/modules/dx/treeTile/treeTile.css +4 -0
- package/src/modules/dx/treeTile/treeTile.html +10 -0
- package/src/modules/dx/treeTile/treeTile.ts +4 -0
- package/src/modules/dxUtils/async/async.ts +32 -0
- package/src/modules/dxUtils/data360Search/data360Search.ts +0 -168
|
@@ -13,7 +13,6 @@ dx-empty-state {
|
|
|
13
13
|
display: none;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/* Scrollable list: when content overflows, last visible item is cut by container to indicate more items (per spec). */
|
|
17
16
|
.sidebar-content {
|
|
18
17
|
overflow-y: auto;
|
|
19
18
|
padding: var(--dx-g-spacing-sm) 0 var(--dx-g-spacing-2xl);
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
<dx-sidebar-search
|
|
49
49
|
onchange={onSearchChange}
|
|
50
50
|
onloading={onSearchLoading}
|
|
51
|
+
coveo-organization-id={coveoOrganizationId}
|
|
52
|
+
coveo-public-access-token={coveoPublicAccessToken}
|
|
53
|
+
coveo-search-hub={coveoSearchHub}
|
|
54
|
+
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
51
55
|
></dx-sidebar-search>
|
|
52
56
|
</div>
|
|
53
57
|
<slot name="version-picker"></slot>
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
<img
|
|
66
70
|
lwc:if={isSearchLoading}
|
|
67
71
|
class="loading-skeleton padding-horizontal"
|
|
68
|
-
src="https://
|
|
72
|
+
src="https://developer.salesforce.com/ns-assets/sidebar-loading.svg"
|
|
69
73
|
alt="loading"
|
|
70
74
|
/>
|
|
71
75
|
<template
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import cx from "classnames";
|
|
2
2
|
import { api, track } from "lwc";
|
|
3
3
|
import { TreeNode, SidebarSearchResult } from "typings/custom";
|
|
4
|
+
import { getSidebarSearchParams } from "dxUtils/coveo";
|
|
4
5
|
import { toJson } from "dxUtils/normalizers";
|
|
5
6
|
import SidebarSearch from "dx/sidebarSearch";
|
|
6
7
|
import { SidebarBase } from "dxBaseElements/sidebarBase";
|
|
7
8
|
|
|
8
9
|
const MOBILE_SIZE_MATCH = "768px";
|
|
9
10
|
|
|
10
|
-
const getSearchQueryParam = (): string | null =>
|
|
11
|
-
typeof window !== "undefined"
|
|
12
|
-
? new URLSearchParams(window.location.search).get("q")
|
|
13
|
-
: null;
|
|
14
|
-
|
|
15
11
|
export default class Sidebar extends SidebarBase {
|
|
12
|
+
@api coveoOrganizationId!: string;
|
|
13
|
+
@api coveoPublicAccessToken!: string;
|
|
14
|
+
@api coveoSearchHub!: string;
|
|
15
|
+
@api coveoAdvancedQueryConfig!: string;
|
|
16
16
|
@api header: string = "";
|
|
17
17
|
|
|
18
18
|
@api
|
|
@@ -51,6 +51,7 @@ export default class Sidebar extends SidebarBase {
|
|
|
51
51
|
private searchValue: string | null = null;
|
|
52
52
|
private searchResults: SidebarSearchResult[] = [];
|
|
53
53
|
private scrollToSelectedSearchResult: boolean = false;
|
|
54
|
+
private selectedSearchResultIndex: number = -1;
|
|
54
55
|
private requestedFetchMoreResults: boolean = false;
|
|
55
56
|
|
|
56
57
|
private get areResultsEmpty(): boolean {
|
|
@@ -129,7 +130,7 @@ export default class Sidebar extends SidebarBase {
|
|
|
129
130
|
constructor() {
|
|
130
131
|
super();
|
|
131
132
|
|
|
132
|
-
if (
|
|
133
|
+
if (getSidebarSearchParams()) {
|
|
133
134
|
this.isSearchLoading = true;
|
|
134
135
|
this.scrollToSelectedSearchResult = true;
|
|
135
136
|
}
|
|
@@ -161,22 +162,20 @@ export default class Sidebar extends SidebarBase {
|
|
|
161
162
|
|
|
162
163
|
private onSearchChange(e: CustomEvent) {
|
|
163
164
|
this.requestedFetchMoreResults = false;
|
|
164
|
-
const isFirstSearchHydration = this.searchValue === null;
|
|
165
|
-
const hasSelectedResult = (e.detail.results || []).some(
|
|
166
|
-
(result: SidebarSearchResult) => !!result.selected
|
|
167
|
-
);
|
|
168
|
-
if (isFirstSearchHydration && hasSelectedResult) {
|
|
169
|
-
this.scrollToSelectedSearchResult = true;
|
|
170
|
-
}
|
|
171
165
|
this.searchResults = e.detail.results;
|
|
172
166
|
this.searchValue = e.detail.value;
|
|
173
167
|
}
|
|
174
168
|
|
|
175
169
|
private onSearchLoading(e: CustomEvent) {
|
|
170
|
+
if (!e.detail.loading && this.scrollToSelectedSearchResult) {
|
|
171
|
+
this.selectedSearchResultIndex = this.searchResults.findIndex(
|
|
172
|
+
(r) => r.selected
|
|
173
|
+
);
|
|
174
|
+
}
|
|
176
175
|
this.isSearchLoading = e.detail;
|
|
177
176
|
}
|
|
178
177
|
|
|
179
|
-
private onSidebarSearchContentScroll(scrollEvent
|
|
178
|
+
private onSidebarSearchContentScroll(scrollEvent) {
|
|
180
179
|
if (this.isSearchLoading) {
|
|
181
180
|
return;
|
|
182
181
|
}
|
|
@@ -197,37 +196,23 @@ export default class Sidebar extends SidebarBase {
|
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
private initializeSearchScrollPosition() {
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"dx-sidebar-search-result"
|
|
216
|
-
);
|
|
217
|
-
const selectedResult =
|
|
218
|
-
(allResultItems?.[selectedSearchResultIndex] as HTMLElement) ||
|
|
219
|
-
null;
|
|
220
|
-
if (!searchContent || !selectedResult) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
window.requestAnimationFrame(() => {
|
|
225
|
-
selectedResult.scrollIntoView({
|
|
226
|
-
block: "start",
|
|
227
|
-
inline: "nearest"
|
|
228
|
-
});
|
|
199
|
+
if (
|
|
200
|
+
this.scrollToSelectedSearchResult &&
|
|
201
|
+
this.selectedSearchResultIndex >= 0
|
|
202
|
+
) {
|
|
203
|
+
const selectedResult = this.template.querySelector(
|
|
204
|
+
`dx-sidebar-search-result:nth-child(${
|
|
205
|
+
this.selectedSearchResultIndex + 1
|
|
206
|
+
})`
|
|
207
|
+
);
|
|
208
|
+
if (!selectedResult || !selectedResult.parentNode) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
(selectedResult.parentNode as HTMLElement).scrollTop =
|
|
212
|
+
selectedResult.offsetTop -
|
|
213
|
+
(selectedResult.parentNode as HTMLElement).offsetTop;
|
|
229
214
|
this.scrollToSelectedSearchResult = false;
|
|
230
|
-
}
|
|
215
|
+
}
|
|
231
216
|
}
|
|
232
217
|
|
|
233
218
|
private assignValueToLabel(node: TreeNode): void {
|