2018-02-10 15:18:01 +00:00
|
|
|
import ngModule from '../../module';
|
2018-05-08 07:26:17 +00:00
|
|
|
import Input from '../../lib/input';
|
|
|
|
import './style.scss';
|
2018-02-10 15:18:01 +00:00
|
|
|
|
2018-05-08 07:26:17 +00:00
|
|
|
export default class Button extends Input {
|
|
|
|
constructor($element) {
|
|
|
|
super($element);
|
2018-08-20 11:01:36 +00:00
|
|
|
this.$element = $element;
|
2018-05-08 07:26:17 +00:00
|
|
|
this.input = this.element.querySelector('.mdl-button');
|
2018-08-20 11:01:36 +00:00
|
|
|
|
|
|
|
$element[0].addEventListener('click', event => {
|
|
|
|
if (this.disabled)
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
});
|
2018-05-08 07:26:17 +00:00
|
|
|
}
|
2018-10-17 07:28:38 +00:00
|
|
|
|
|
|
|
$onInit() {
|
|
|
|
if (!this.type) {
|
|
|
|
this.type = 'button';
|
|
|
|
}
|
|
|
|
}
|
2018-02-10 15:18:01 +00:00
|
|
|
}
|
2018-05-08 07:26:17 +00:00
|
|
|
Button.$inject = ['$element'];
|
|
|
|
|
|
|
|
ngModule.component('vnButton', {
|
|
|
|
controller: Button,
|
|
|
|
template: require('./button.html'),
|
|
|
|
bindings: {
|
|
|
|
label: '@?',
|
|
|
|
disabled: '<?',
|
2018-10-17 07:28:38 +00:00
|
|
|
icon: '@?',
|
|
|
|
type: '@?'
|
2018-05-08 07:26:17 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|