Refactor clear logic in input

pull/224/head
Cory LaViska 2020-09-09 16:19:48 -04:00
rodzic 6a731ca015
commit d8fc0464bb
2 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
- Added `input`, `label`, `prefix`, `clear-button`, `suffix`, `help-text` exported parts to `sl-select` to make the input customizable - Added `input`, `label`, `prefix`, `clear-button`, `suffix`, `help-text` exported parts to `sl-select` to make the input customizable
- Fixed bug where mouse events would bubble up when `sl-button` was disabled, causing tooltips to erroneously appear - Fixed bug where mouse events would bubble up when `sl-button` was disabled, causing tooltips to erroneously appear
- Refactored clear logic in `sl-input`
## 2.0.0-beta.18 ## 2.0.0-beta.18

Wyświetl plik

@ -229,15 +229,13 @@ export class Input {
} }
handleClearClick(event: MouseEvent) { handleClearClick(event: MouseEvent) {
if (this.input.value !== '') { this.value = '';
this.input.value = ''; this.slClear.emit();
this.input.dispatchEvent(new window.Event('input', { bubbles: true })); this.slInput.emit();
this.input.dispatchEvent(new window.Event('change', { bubbles: true })); this.slChange.emit();
} this.input.focus();
event.stopPropagation(); event.stopPropagation();
this.slClear.emit();
this.input.focus();
} }
handleMouseDown(event: MouseEvent) { handleMouseDown(event: MouseEvent) {