@salesforcedevs/dx-components 0.10.1-alpha.143 → 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 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.143",
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
  }
@@ -50,7 +50,7 @@ export default class SidebarSearch extends LightningElement {
50
50
  // set adnvanced filters needs access to the latest coveoAdvancedQueryConfig
51
51
  this.dispatchOnLoading(true);
52
52
  this.setAdvancedFilters(this.engine);
53
- this.submitSearch();
53
+ this.submitSearch(true);
54
54
  }
55
55
  }
56
56
 
@@ -65,6 +65,7 @@ export default class SidebarSearch extends LightningElement {
65
65
  @api
66
66
  setInputValue(searchTerm: string) {
67
67
  this.value = searchTerm || "";
68
+ this.handleValueChange(true);
68
69
  }
69
70
 
70
71
  private _coveoAdvancedQueryConfig!: { [key: string]: any };
@@ -352,11 +353,16 @@ export default class SidebarSearch extends LightningElement {
352
353
  );
353
354
  }
354
355
 
355
- private submitSearch = debounce(() => {
356
+ private submitSearch = debounce((isSyncingSearchValue = false) => {
356
357
  if (this.searchBox) {
357
358
  UserRecentSearches.add(this.value);
358
359
  this.updateRecentSearches();
359
- this.dispatchSidebarSearchChange(this.value);
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
+ }
360
366
 
361
367
  this.searchBox.updateText(this.value || "");
362
368
  this.searchBox.submit();
@@ -366,7 +372,7 @@ export default class SidebarSearch extends LightningElement {
366
372
  private onClickRecentSearch(e: CustomEvent) {
367
373
  this.value = e.detail;
368
374
  this.dispatchSidebarSearchChange(this.value);
369
- this.submitSearch();
375
+ this.submitSearch(true);
370
376
  }
371
377
 
372
378
  private onDropdownRequestClose(e: CustomEvent) {
@@ -383,26 +389,32 @@ export default class SidebarSearch extends LightningElement {
383
389
  private onInputChange(e: CustomEvent) {
384
390
  this.value = e.detail;
385
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) {
386
405
  if (this.value) {
387
406
  this.dispatchOnLoading(true);
388
407
  if (this.searchBox) {
389
- this.submitSearch();
408
+ this.submitSearch(isSyncingSearchValue);
390
409
  }
391
410
  } else {
392
411
  // coveo's reaction to an empty value triggers a return of results
393
412
  // bootlegging our own ux here`
394
413
  this.dispatchOnLoading(false);
395
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);
396
418
  }
397
-
398
- this.dispatchHighlightedTermChange();
399
- }
400
-
401
- private onInputFocus() {
402
- this.dropdownRequestedOpen = true;
403
- }
404
-
405
- private onInputClear() {
406
- this.dropdownRequestedOpen = false;
407
419
  }
408
420
  }
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file