pull/1186/head
Cory LaViska 2023-02-07 15:57:50 -05:00
rodzic 9e92d92684
commit 1f1024f4ca
9 zmienionych plików z 14 dodań i 15 usunięć

Wyświetl plik

@ -42,8 +42,7 @@ export default class SlCheckbox extends ShoelaceElement implements ShoelaceFormC
private readonly formControlController = new FormControlController(this, {
value: (control: SlCheckbox) => (control.checked ? control.value || 'on' : undefined),
defaultValue: (control: SlCheckbox) => control.defaultChecked,
setValue: (control: SlCheckbox, checked: boolean) => (control.checked = checked),
assumeInteractionOn: ['sl-input']
setValue: (control: SlCheckbox, checked: boolean) => (control.checked = checked)
});
@query('input[type="checkbox"]') input: HTMLInputElement;

Wyświetl plik

@ -90,9 +90,7 @@ declare const EyeDropper: EyeDropperConstructor;
export default class SlColorPicker extends ShoelaceElement implements ShoelaceFormControl {
static styles: CSSResultGroup = styles;
private readonly formControlController = new FormControlController(this, {
assumeInteractionOn: ['sl-input']
});
private readonly formControlController = new FormControlController(this);
private isSafeValue = false;
private readonly localize = new LocalizeController(this);

Wyświetl plik

@ -63,7 +63,9 @@ const isFirefox = isChromium ? false : navigator.userAgent.includes('Firefox');
export default class SlInput extends ShoelaceElement implements ShoelaceFormControl {
static styles: CSSResultGroup = styles;
private readonly formControlController = new FormControlController(this);
private readonly formControlController = new FormControlController(this, {
assumeInteractionOn: ['sl-blur', 'sl-input']
});
private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');
private readonly localize = new LocalizeController(this);

Wyświetl plik

@ -38,9 +38,7 @@ import type SlRadioButton from '../radio-button/radio-button';
export default class SlRadioGroup extends ShoelaceElement implements ShoelaceFormControl {
static styles: CSSResultGroup = styles;
protected readonly formControlController = new FormControlController(this, {
assumeInteractionOn: ['sl-input']
});
protected readonly formControlController = new FormControlController(this);
private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');
private customValidityMessage = '';
private validationTimeout: number;

Wyświetl plik

@ -146,7 +146,6 @@ export default class SlRange extends ShoelaceElement implements ShoelaceFormCont
}
private handleThumbDragStart() {
this.focus(); // force Safari to focus so we can listen for the sl-blur interaction
this.hasTooltip = true;
}

Wyświetl plik

@ -64,7 +64,9 @@ import type SlPopup from '../popup/popup';
export default class SlSelect extends ShoelaceElement implements ShoelaceFormControl {
static styles: CSSResultGroup = styles;
private readonly formControlController = new FormControlController(this);
private readonly formControlController = new FormControlController(this, {
assumeInteractionOn: ['sl-blur', 'sl-input']
});
private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');
private readonly localize = new LocalizeController(this);
private typeToSelectString = '';

Wyświetl plik

@ -40,8 +40,7 @@ export default class SlSwitch extends ShoelaceElement implements ShoelaceFormCon
private readonly formControlController = new FormControlController(this, {
value: (control: SlSwitch) => (control.checked ? control.value || 'on' : undefined),
defaultValue: (control: SlSwitch) => control.defaultChecked,
setValue: (control: SlSwitch, checked: boolean) => (control.checked = checked),
assumeInteractionOn: ['sl-input']
setValue: (control: SlSwitch, checked: boolean) => (control.checked = checked)
});
@query('input[type="checkbox"]') input: HTMLInputElement;

Wyświetl plik

@ -37,7 +37,9 @@ import type { ShoelaceFormControl } from '../../internal/shoelace-element';
export default class SlTextarea extends ShoelaceElement implements ShoelaceFormControl {
static styles: CSSResultGroup = styles;
private readonly formControlController = new FormControlController(this);
private readonly formControlController = new FormControlController(this, {
assumeInteractionOn: ['sl-blur', 'sl-input']
});
private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');
private resizeObserver: ResizeObserver;

Wyświetl plik

@ -78,7 +78,7 @@ export class FormControlController implements ReactiveController {
disabled: input => input.disabled ?? false,
reportValidity: input => (typeof input.reportValidity === 'function' ? input.reportValidity() : true),
setValue: (input, value: string) => (input.value = value),
assumeInteractionOn: ['sl-blur', 'sl-input'],
assumeInteractionOn: ['sl-input'],
...options
};
this.handleFormData = this.handleFormData.bind(this);