56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
|
import ngModule from '../../module';
|
||
|
import Textfield from '../textfield/textfield';
|
||
|
import './style.scss';
|
||
|
|
||
|
export default class InputTime extends Textfield {
|
||
|
|
||
|
constructor($element, $scope, $attrs, vnTemplate, $transclude, $filter) {
|
||
|
super($element, $scope, $attrs, vnTemplate, $transclude);
|
||
|
|
||
|
this.$filter = $filter;
|
||
|
}
|
||
|
|
||
|
get value() {
|
||
|
return this._value;
|
||
|
}
|
||
|
|
||
|
set value(value) {
|
||
|
this._value = value;
|
||
|
this.hasValue = this._value !== null;
|
||
|
|
||
|
if (this.hasValue) this.element.classList.add('not-empty');
|
||
|
|
||
|
this.element.querySelector('.infix').classList.remove('invalid', 'validated');
|
||
|
}
|
||
|
|
||
|
get step() {
|
||
|
return parseFloat(this.input.step);
|
||
|
}
|
||
|
|
||
|
set step(value) {
|
||
|
this.input.step = value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude', '$filter'];
|
||
|
|
||
|
ngModule.component('vnInputTime', {
|
||
|
template: require('./index.html'),
|
||
|
controller: InputTime,
|
||
|
transclude: {
|
||
|
leftIcons: '?tLeftIcons',
|
||
|
rightIcons: '?tRightIcons'
|
||
|
},
|
||
|
bindings: {
|
||
|
label: '@?',
|
||
|
disabled: '<?',
|
||
|
readonly: '<?',
|
||
|
step: '<?',
|
||
|
rule: '@?',
|
||
|
value: '=model',
|
||
|
vnTabIndex: '@?',
|
||
|
onChange: '&',
|
||
|
onClear: '&'
|
||
|
}
|
||
|
});
|