@salesforcedevs/dx-components 0.10.1-alpha.140 → 0.10.1-alpha.144
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/package.json +3 -2
- package/src/modules/dx/codeBlock/codeBlock.ts +6 -6
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +32 -23
- package/src/modules/dx/tree/tree.ts +1 -0
- package/src/modules/utils/coveo/coveo.ts +1 -1
- package/src/.DS_Store +0 -0
- package/src/modules/.DS_Store +0 -0
- package/src/modules/dx/.DS_Store +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.10.1-alpha.
|
|
3
|
+
"version": "0.10.1-alpha.144",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -28,5 +28,6 @@
|
|
|
28
28
|
"@types/classnames": "^2.2.10",
|
|
29
29
|
"@types/debounce": "^1.2.0",
|
|
30
30
|
"@types/lodash.get": "^4.4.6"
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "4cc21fc7e5a26c53794426454cbf630fe1d54413"
|
|
32
33
|
}
|
|
@@ -56,9 +56,10 @@ export default class CodeBlock extends LightningElement {
|
|
|
56
56
|
set codeBlock(value: string) {
|
|
57
57
|
this._codeBlockRendered = false;
|
|
58
58
|
let match;
|
|
59
|
-
this._codeBlock = (
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
this._codeBlock = (
|
|
60
|
+
(match = preTagRegexp.exec(value.trim())) === null
|
|
61
|
+
? value.trim()
|
|
62
|
+
: match[1]
|
|
62
63
|
).trim();
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -173,9 +174,8 @@ export default class CodeBlock extends LightningElement {
|
|
|
173
174
|
});
|
|
174
175
|
|
|
175
176
|
try {
|
|
176
|
-
const snippetContainer: HTMLElement | null =
|
|
177
|
-
".code-block-content"
|
|
178
|
-
);
|
|
177
|
+
const snippetContainer: HTMLElement | null =
|
|
178
|
+
this.template.querySelector(".code-block-content");
|
|
179
179
|
if (snippetContainer && snippetContainer.textContent) {
|
|
180
180
|
await navigator.clipboard.writeText(
|
|
181
181
|
snippetContainer.textContent
|
|
@@ -36,22 +36,21 @@ export default class SidebarSearch extends LightningElement {
|
|
|
36
36
|
get coveoAdvancedQueryConfig(): { [key: string]: any } {
|
|
37
37
|
return this._coveoAdvancedQueryConfig;
|
|
38
38
|
}
|
|
39
|
-
set coveoAdvancedQueryConfig(value
|
|
39
|
+
set coveoAdvancedQueryConfig(value) {
|
|
40
40
|
const jsonValue = toJson(value);
|
|
41
41
|
const hasChanged =
|
|
42
42
|
this._coveoAdvancedQueryConfig &&
|
|
43
|
-
Object.entries(jsonValue).
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
console.log({ hasChanged }, this._coveoAdvancedQueryConfig, value);
|
|
43
|
+
Object.entries(jsonValue).some(
|
|
44
|
+
([key, val]: [string, any]) =>
|
|
45
|
+
this._coveoAdvancedQueryConfig[key] !== val
|
|
46
|
+
);
|
|
48
47
|
this._coveoAdvancedQueryConfig = jsonValue;
|
|
49
48
|
|
|
50
49
|
if (hasChanged && this.engine) {
|
|
51
50
|
// set adnvanced filters needs access to the latest coveoAdvancedQueryConfig
|
|
52
51
|
this.dispatchOnLoading(true);
|
|
53
52
|
this.setAdvancedFilters(this.engine);
|
|
54
|
-
this.submitSearch();
|
|
53
|
+
this.submitSearch(true);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -66,6 +65,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
66
65
|
@api
|
|
67
66
|
setInputValue(searchTerm: string) {
|
|
68
67
|
this.value = searchTerm || "";
|
|
68
|
+
this.handleValueChange(true);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
private _coveoAdvancedQueryConfig!: { [key: string]: any };
|
|
@@ -116,7 +116,6 @@ export default class SidebarSearch extends LightningElement {
|
|
|
116
116
|
// in prod some of the critical coveo configuration attributes seem to arrive later
|
|
117
117
|
// so I needed to put this coveo startup flow here where we can wait for them to arrive
|
|
118
118
|
if (this.hasCorrectCoveoConfig && !this.engine) {
|
|
119
|
-
console.log("coveo config is good");
|
|
120
119
|
this.initializeUserSession();
|
|
121
120
|
this.initializeCoveo();
|
|
122
121
|
} else if (!this.hasCorrectCoveoConfig) {
|
|
@@ -300,7 +299,6 @@ export default class SidebarSearch extends LightningElement {
|
|
|
300
299
|
};
|
|
301
300
|
|
|
302
301
|
private updateSessionStorage() {
|
|
303
|
-
console.log("updating session storage");
|
|
304
302
|
window.sessionStorage.setItem(
|
|
305
303
|
SESSION_KEY,
|
|
306
304
|
JSON.stringify({
|
|
@@ -355,11 +353,17 @@ export default class SidebarSearch extends LightningElement {
|
|
|
355
353
|
);
|
|
356
354
|
}
|
|
357
355
|
|
|
358
|
-
private submitSearch = debounce(() => {
|
|
356
|
+
private submitSearch = debounce((isSyncingSearchValue = false) => {
|
|
359
357
|
if (this.searchBox) {
|
|
360
358
|
UserRecentSearches.add(this.value);
|
|
361
359
|
this.updateRecentSearches();
|
|
362
360
|
|
|
361
|
+
// When `isSyncingSearchValue` is true, we are submitting in a case
|
|
362
|
+
// where the search box is already synced correctly.
|
|
363
|
+
if (!isSyncingSearchValue) {
|
|
364
|
+
this.dispatchSidebarSearchChange(this.value);
|
|
365
|
+
}
|
|
366
|
+
|
|
363
367
|
this.searchBox.updateText(this.value || "");
|
|
364
368
|
this.searchBox.submit();
|
|
365
369
|
}
|
|
@@ -368,7 +372,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
368
372
|
private onClickRecentSearch(e: CustomEvent) {
|
|
369
373
|
this.value = e.detail;
|
|
370
374
|
this.dispatchSidebarSearchChange(this.value);
|
|
371
|
-
this.submitSearch();
|
|
375
|
+
this.submitSearch(true);
|
|
372
376
|
}
|
|
373
377
|
|
|
374
378
|
private onDropdownRequestClose(e: CustomEvent) {
|
|
@@ -385,27 +389,32 @@ export default class SidebarSearch extends LightningElement {
|
|
|
385
389
|
private onInputChange(e: CustomEvent) {
|
|
386
390
|
this.value = e.detail;
|
|
387
391
|
|
|
392
|
+
this.handleValueChange(false);
|
|
393
|
+
this.dispatchHighlightedTermChange();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
private onInputFocus() {
|
|
397
|
+
this.dropdownRequestedOpen = true;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
private onInputClear() {
|
|
401
|
+
this.dropdownRequestedOpen = false;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
private handleValueChange(isSyncingSearchValue = false) {
|
|
388
405
|
if (this.value) {
|
|
389
406
|
this.dispatchOnLoading(true);
|
|
390
407
|
if (this.searchBox) {
|
|
391
|
-
this.submitSearch();
|
|
408
|
+
this.submitSearch(isSyncingSearchValue);
|
|
392
409
|
}
|
|
393
410
|
} else {
|
|
394
411
|
// coveo's reaction to an empty value triggers a return of results
|
|
395
412
|
// bootlegging our own ux here`
|
|
396
413
|
this.dispatchOnLoading(false);
|
|
397
414
|
this.dispatchOnChangeEvent([]);
|
|
415
|
+
// Empty search values are not submitted for search, so we need to manually
|
|
416
|
+
// trigger a search change on our own here
|
|
417
|
+
this.dispatchSidebarSearchChange(this.value);
|
|
398
418
|
}
|
|
399
|
-
|
|
400
|
-
this.dispatchHighlightedTermChange();
|
|
401
|
-
this.dispatchSidebarSearchChange(this.value);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
private onInputFocus() {
|
|
405
|
-
this.dropdownRequestedOpen = true;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
private onInputClear() {
|
|
409
|
-
this.dropdownRequestedOpen = false;
|
|
410
419
|
}
|
|
411
420
|
}
|
|
@@ -43,7 +43,7 @@ export const coveoXMLDocsConfig = {
|
|
|
43
43
|
coveoSearchHub: "Developer_Docs_SS",
|
|
44
44
|
coveoAdvancedQueryConfig: JSON.stringify({
|
|
45
45
|
objecttype: "HTDeveloperDocumentsC",
|
|
46
|
-
|
|
46
|
+
sflocale__c: "en_US",
|
|
47
47
|
sfrelease__c: "232.0",
|
|
48
48
|
sfdelivarable__c: "apexcode"
|
|
49
49
|
})
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/modules/.DS_Store
DELETED
|
Binary file
|
package/src/modules/dx/.DS_Store
DELETED
|
Binary file
|