2018-02-10 15:18:01 +00:00
|
|
|
import ngModule from '../../module';
|
2018-03-13 11:07:28 +00:00
|
|
|
import './style.scss';
|
2018-02-10 15:18:01 +00:00
|
|
|
|
2018-09-04 08:10:29 +00:00
|
|
|
export default class Textarea {
|
|
|
|
constructor($element, $scope, $attrs, vnTemplate) {
|
|
|
|
this.$ = $scope;
|
|
|
|
this.$attrs = $attrs;
|
|
|
|
this.element = $element;
|
|
|
|
vnTemplate.normalizeInputAttrs($attrs);
|
|
|
|
this.textarea = this.element[0].querySelector('textarea');
|
|
|
|
this.rows = null;
|
|
|
|
}
|
|
|
|
set model(value) {
|
|
|
|
this._model = value;
|
|
|
|
this.mdlUpdate();
|
|
|
|
}
|
|
|
|
set rows(value) {
|
|
|
|
this.textarea.rows = value ? value : 3;
|
|
|
|
}
|
|
|
|
get model() {
|
|
|
|
return this._model;
|
|
|
|
}
|
|
|
|
mdlUpdate() {
|
|
|
|
let mdlField = this.element[0].firstChild.MaterialTextfield;
|
|
|
|
if (mdlField)
|
|
|
|
mdlField.updateClasses_();
|
|
|
|
componentHandler.upgradeElement(this.element[0].firstChild);
|
|
|
|
}
|
2018-02-10 15:18:01 +00:00
|
|
|
}
|
2018-09-04 08:10:29 +00:00
|
|
|
Textarea.$inject = ['$element', '$scope', '$attrs', 'vnTemplate'];
|
|
|
|
|
|
|
|
ngModule.component('vnTextarea', {
|
|
|
|
template: require('./textarea.html'),
|
|
|
|
controller: Textarea,
|
|
|
|
bindings: {
|
|
|
|
model: '=model',
|
|
|
|
label: '@?',
|
|
|
|
rows: '@?',
|
|
|
|
name: '@?',
|
|
|
|
disabled: '<?',
|
|
|
|
rule: '@?'
|
|
|
|
}
|
|
|
|
});
|