@salesforcedevs/dx-components 0.10.1-alpha.70 → 0.10.1-alpha.74
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
|
@@ -64,14 +64,6 @@ dx-tree:not(:last-child) {
|
|
|
64
64
|
transition: var(--dx-g-transition-transform-2x);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.container.collapsed {
|
|
68
|
-
width: var(--dx-g-spacing-xl);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.collapsed .header-toggle-button {
|
|
72
|
-
transform: rotate(180deg);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
67
|
.container {
|
|
76
68
|
background-color: var(--dx-g-gray-95);
|
|
77
69
|
display: flex;
|
|
@@ -101,26 +93,6 @@ dx-tree:not(:last-child) {
|
|
|
101
93
|
--border-color: transparent;
|
|
102
94
|
}
|
|
103
95
|
|
|
104
|
-
.collapsed.container .sidebar-header, .collased.container .sidebar-content {
|
|
105
|
-
display: none;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.search-empty.container dx-empty-state {
|
|
109
|
-
display: block;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.user-searching.container .sidebar-content-tree {
|
|
113
|
-
display: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.show-tree.container .sidebar-content-search {
|
|
117
|
-
display: none;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.container:hover .header-toggle-button {
|
|
121
|
-
--dx-c-button-opacity: 1;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
96
|
.container.container-border-active {
|
|
125
97
|
--border-color: var(--dx-c-sidebar-button-color);
|
|
126
98
|
}
|
|
@@ -178,3 +150,32 @@ dx-tree:not(:last-child) {
|
|
|
178
150
|
.loading-skeleton {
|
|
179
151
|
margin-top: var(--dx-g-spacing-md);
|
|
180
152
|
}
|
|
153
|
+
|
|
154
|
+
.collapsed.container .sidebar-header,
|
|
155
|
+
.collased.container .sidebar-content {
|
|
156
|
+
display: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.search-empty.container dx-empty-state {
|
|
160
|
+
display: block;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.user-searching.container .sidebar-content-tree {
|
|
164
|
+
display: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.show-tree.container .sidebar-content-search {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.container.collapsed {
|
|
172
|
+
width: var(--dx-g-spacing-xl);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.collapsed .header-toggle-button {
|
|
176
|
+
transform: rotate(180deg);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.container:hover .header-toggle-button {
|
|
180
|
+
--dx-c-button-opacity: 1;
|
|
181
|
+
}
|
|
@@ -130,7 +130,10 @@ export default class Sidebar extends LightningElement {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
renderedCallback() {
|
|
133
|
-
if (
|
|
133
|
+
if (
|
|
134
|
+
this.scrollToSelectedSearchResult &&
|
|
135
|
+
this.selectedSearchResultIndex >= 0
|
|
136
|
+
) {
|
|
134
137
|
const selectedResult = this.template.querySelector(
|
|
135
138
|
`dx-sidebar-search-result:nth-child(${
|
|
136
139
|
this.selectedSearchResultIndex + 1
|
|
@@ -21,6 +21,8 @@ const UserRecentSearches = new RecentSearches();
|
|
|
21
21
|
const normalizeCoveoAdvancedQueryValue = (version: string): string =>
|
|
22
22
|
version.split(".").join("\\.");
|
|
23
23
|
|
|
24
|
+
const DEFAULT_RESULT_COUNT = 20;
|
|
25
|
+
|
|
24
26
|
export default class SidebarSearch extends LightningElement {
|
|
25
27
|
@api coveoOrganizationId!: string;
|
|
26
28
|
@api coveoPublicAccessToken!: string;
|
|
@@ -44,6 +46,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
44
46
|
private dropdownRequestedOpen: boolean = false;
|
|
45
47
|
private recentSearches: Option[] = [];
|
|
46
48
|
private resultList: ResultList | null = null;
|
|
49
|
+
private initialResultCount: number = DEFAULT_RESULT_COUNT;
|
|
47
50
|
private searchBox: SearchBox | null = null;
|
|
48
51
|
private value?: string = undefined;
|
|
49
52
|
private engine: SearchEngine | null = null;
|
|
@@ -86,6 +89,18 @@ export default class SidebarSearch extends LightningElement {
|
|
|
86
89
|
if (initialValue && initialValue !== "") {
|
|
87
90
|
this.value = initialValue;
|
|
88
91
|
}
|
|
92
|
+
|
|
93
|
+
const stringified = window.sessionStorage.getItem(
|
|
94
|
+
"dx-sidebar-search-state"
|
|
95
|
+
);
|
|
96
|
+
if (!stringified) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const state = JSON.parse(stringified);
|
|
100
|
+
console.log(state);
|
|
101
|
+
if (state.value === this.value) {
|
|
102
|
+
this.initialResultCount = state.resultCount;
|
|
103
|
+
}
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
renderedCallback() {
|
|
@@ -115,20 +130,21 @@ export default class SidebarSearch extends LightningElement {
|
|
|
115
130
|
searchHub: this.coveoSearchHub
|
|
116
131
|
});
|
|
117
132
|
|
|
118
|
-
if (this.engine) {
|
|
119
|
-
|
|
120
|
-
options: { fieldsToInclude: ["sfhtml_url__c"] }
|
|
121
|
-
});
|
|
122
|
-
buildResultsPerPage(this.engine, {
|
|
123
|
-
initialState: {
|
|
124
|
-
numberOfResults: 20
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
this.searchBox = buildSearchBox(this.engine, { options });
|
|
128
|
-
this.setAdvancedFilters(this.engine);
|
|
133
|
+
if (!this.engine) {
|
|
134
|
+
return;
|
|
129
135
|
}
|
|
130
136
|
|
|
131
|
-
|
|
137
|
+
this.resultList = buildResultList(this.engine, {
|
|
138
|
+
options: { fieldsToInclude: ["sfhtml_url__c"] }
|
|
139
|
+
});
|
|
140
|
+
const ResultsPerPage = buildResultsPerPage(this.engine, {
|
|
141
|
+
initialState: {
|
|
142
|
+
numberOfResults: this.initialResultCount
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
this.searchBox = buildSearchBox(this.engine, { options });
|
|
146
|
+
this.setAdvancedFilters(this.engine);
|
|
147
|
+
|
|
132
148
|
this.resultList?.subscribe(this.onResultListChange);
|
|
133
149
|
|
|
134
150
|
if (!this.isValueEmpty) {
|
|
@@ -137,6 +153,8 @@ export default class SidebarSearch extends LightningElement {
|
|
|
137
153
|
} else {
|
|
138
154
|
this.dispatchOnLoading(false);
|
|
139
155
|
}
|
|
156
|
+
|
|
157
|
+
ResultsPerPage.set(DEFAULT_RESULT_COUNT);
|
|
140
158
|
}
|
|
141
159
|
|
|
142
160
|
private onResultListChange = () => {
|
|
@@ -203,6 +221,13 @@ export default class SidebarSearch extends LightningElement {
|
|
|
203
221
|
};
|
|
204
222
|
|
|
205
223
|
private dispatchOnChangeEvent(results: Result[]) {
|
|
224
|
+
window.sessionStorage.setItem(
|
|
225
|
+
"dx-sidebar-search-state",
|
|
226
|
+
JSON.stringify({
|
|
227
|
+
value: this.value,
|
|
228
|
+
resultCount: results.length
|
|
229
|
+
})
|
|
230
|
+
);
|
|
206
231
|
this.dispatchEvent(
|
|
207
232
|
new CustomEvent("change", {
|
|
208
233
|
detail: {
|