salix/front/core/components/account-number/index.js

24 lines
684 B
JavaScript

import Textfield from '../textfield/textfield';
import ngModule from '../../module';
export default class AccountNumber extends Textfield {
constructor($element, $) {
super($element, $);
this.$ = $;
super.insertable = true;
super.maxLength = 10;
this.element.addEventListener('change', () => this.accountShortToStandard());
}
accountShortToStandard() {
this.field = this.field.replace('.', '0'.repeat(11 - this.field.length));
this.$.$emit('accountShortToStandard', this.field);
}
}
AccountNumber.$inject = ['$element', '$scope'];
ngModule.vnComponent('vnAccountNumber', {
controller: AccountNumber,
});