mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
refactor emit into ShoelaceElement
This commit is contained in:
@@ -4,7 +4,6 @@ import { classMap } from 'lit/directives/class-map.js';
|
||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
import { live } from 'lit/directives/live.js';
|
||||
import { defaultValue } from '../../internal/default-value';
|
||||
import { emit } from '../../internal/event';
|
||||
import { FormSubmitController } from '../../internal/form';
|
||||
import ShoelaceElement from '../../internal/shoelace-element';
|
||||
import { HasSlotController } from '../../internal/slot';
|
||||
@@ -246,8 +245,8 @@ export default class SlInput extends ShoelaceElement {
|
||||
|
||||
if (this.value !== this.input.value) {
|
||||
this.value = this.input.value;
|
||||
emit(this, 'sl-input');
|
||||
emit(this, 'sl-change');
|
||||
this.emit('sl-input');
|
||||
this.emit('sl-change');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,19 +263,19 @@ export default class SlInput extends ShoelaceElement {
|
||||
|
||||
handleBlur() {
|
||||
this.hasFocus = false;
|
||||
emit(this, 'sl-blur');
|
||||
this.emit('sl-blur');
|
||||
}
|
||||
|
||||
handleChange() {
|
||||
this.value = this.input.value;
|
||||
emit(this, 'sl-change');
|
||||
this.emit('sl-change');
|
||||
}
|
||||
|
||||
handleClearClick(event: MouseEvent) {
|
||||
this.value = '';
|
||||
emit(this, 'sl-clear');
|
||||
emit(this, 'sl-input');
|
||||
emit(this, 'sl-change');
|
||||
this.emit('sl-clear');
|
||||
this.emit('sl-input');
|
||||
this.emit('sl-change');
|
||||
this.input.focus();
|
||||
|
||||
event.stopPropagation();
|
||||
@@ -299,12 +298,12 @@ export default class SlInput extends ShoelaceElement {
|
||||
|
||||
handleFocus() {
|
||||
this.hasFocus = true;
|
||||
emit(this, 'sl-focus');
|
||||
this.emit('sl-focus');
|
||||
}
|
||||
|
||||
handleInput() {
|
||||
this.value = this.input.value;
|
||||
emit(this, 'sl-input');
|
||||
this.emit('sl-input');
|
||||
}
|
||||
|
||||
handleInvalid() {
|
||||
|
||||
Reference in New Issue
Block a user