@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
93 lines (87 loc) • 3.55 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
'use strict';
var common = require('./common-DPb6NWR4.js');
var autoComplete = require('./auto-complete-DkzHjXc-.js');
var maxLengthBehavior = require('./max-length-behavior-CqAwfrV8.js');
var placeholder = require('./placeholder-DrjxGUF5.js');
var readOnly = require('./read-only-Dwp456Yc.js');
var required = require('./required-DriHzqmx.js');
var variantClassName = require('./variant-class-name-BCWuCRd0.js');
var controllerIcon = require('./controller-icon-j62graYQ.js');
const validatePattern = (component, value, options = {}) => {
common.watchString(component, '_pattern', value, options);
};
const validateVisibilityToggle = (component, value, hooks) => {
common.watchBoolean(component, '_visibilityToggle', value, hooks);
};
class InputPasswordController extends controllerIcon.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;
}
validateAutoComplete(value) {
autoComplete.validateAutoComplete(this.component, value);
}
validateHasCounter(value) {
maxLengthBehavior.validateHasCounter(this.component, value);
}
validateMaxLengthBehavior(value) {
maxLengthBehavior.validateMaxLengthBehavior(this.component, value);
}
validateMaxLength(value) {
maxLengthBehavior.validateMaxLength(this.component, value, {
hooks: { afterPatch: this.afterSyncCharCounter },
});
}
validatePattern(value) {
validatePattern(this.component, value);
}
validatePlaceholder(value) {
placeholder.validatePlaceholder(this.component, value);
}
validateReadOnly(value) {
readOnly.validateReadOnly(this.component, value);
}
validateRequired(value) {
required.validateRequired(this.component, value);
}
validateValue(value) {
common.watchString(this.component, '_value', value, {
hooks: {
afterPatch: this.afterSyncCharCounter,
},
});
this.setFormAssociatedValue(this.component.state._value);
}
validateVariant(value) {
variantClassName.validateVariantClassName(this.component, value);
}
validateVisibilityToggle(value) {
validateVisibilityToggle(this.component, value);
}
componentWillLoad() {
super.componentWillLoad();
this.validateAutoComplete(this.component._autoComplete);
this.validateHasCounter(this.component._hasCounter);
this.validateMaxLengthBehavior(this.component._maxLengthBehavior);
this.validateMaxLength(this.component._maxLength);
this.validatePattern(this.component._pattern);
this.validatePlaceholder(this.component._placeholder);
this.validateReadOnly(this.component._readOnly);
this.validateRequired(this.component._required);
this.validateValue(this.component._value);
this.validateVariant(this.component._variant);
this.validateVisibilityToggle(this.component._visibilityToggle);
}
}
exports.InputPasswordController = InputPasswordController;
//# sourceMappingURL=controller-B6zjPE-P.js.map
//# sourceMappingURL=controller-B6zjPE-P.js.map