UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

69 lines (68 loc) 2.65 kB
/*! * KoliBri - The accessible HTML-Standard */ import { validateHasCounter, validateMaxLength, validateMaxLengthBehavior, validatePlaceholder, validateReadOnly, validateRequired, validateResizeTextarea, validateRows, validateSpellCheck, watchString, } from "../../schema"; import { InputIconController } from "../@deprecated/input/controller-icon"; export class TextareaController extends InputIconController { constructor(component, name, host) { super(component, name, host); this.afterSyncCharCounter = () => { if (typeof this.component._value === 'string') { this.component.state._currentLength = this.component._value.length; this.updateCurrentLengthDebounced(this.component._value.length); } }; this.component = component; } validateHasCounter(value) { validateHasCounter(this.component, value); } validateMaxLengthBehavior(value) { validateMaxLengthBehavior(this.component, value); } validateMaxLength(value) { validateMaxLength(this.component, value, { hooks: { afterPatch: this.afterSyncCharCounter }, }); } validatePlaceholder(value) { validatePlaceholder(this.component, value); } validateReadOnly(value) { validateReadOnly(this.component, value); } validateResize(value) { validateResizeTextarea(this.component, value); } validateRequired(value) { validateRequired(this.component, value); } validateRows(value) { validateRows(this.component, value); } validateSpellCheck(value) { validateSpellCheck(this.component, value); } validateValue(value) { watchString(this.component, '_value', value, { hooks: { afterPatch: this.afterSyncCharCounter, }, }); this.setFormAssociatedValue(this.component._value); } componentWillLoad() { super.componentWillLoad(); this.validateHasCounter(this.component._hasCounter); this.validateMaxLengthBehavior(this.component._maxLengthBehavior); this.validateMaxLength(this.component._maxLength); this.validatePlaceholder(this.component._placeholder); this.validateReadOnly(this.component._readOnly); this.validateRequired(this.component._required); this.validateResize(this.component._resize); this.validateRows(this.component._rows); this.validateSpellCheck(this.component._spellCheck); this.validateValue(this.component._value); } } //# sourceMappingURL=controller.js.map