2017-06-13 11:08:06 +00:00
|
|
|
import {module} from '../module';
|
|
|
|
import './style.scss';
|
|
|
|
|
2017-06-15 05:45:01 +00:00
|
|
|
export default class DropDown {
|
2017-06-22 10:03:01 +00:00
|
|
|
constructor($element, $scope) {
|
2017-06-15 05:45:01 +00:00
|
|
|
this.$element = $element;
|
2017-06-22 10:03:01 +00:00
|
|
|
this.$ = $scope;
|
2017-06-29 06:13:30 +00:00
|
|
|
this._showLoadMore = false;
|
2017-06-15 05:45:01 +00:00
|
|
|
}
|
2017-06-29 06:13:30 +00:00
|
|
|
get showLoadMore() {
|
|
|
|
return this._showLoadMore;
|
|
|
|
}
|
|
|
|
set showLoadMore(value) {
|
|
|
|
this._showLoadMore = value;
|
|
|
|
}
|
|
|
|
|
2017-06-15 05:45:01 +00:00
|
|
|
$onChanges(changesObj) {
|
|
|
|
if (changesObj.show && changesObj.top && changesObj.top.currentValue) {
|
|
|
|
this.$element.css('top', changesObj.top.currentValue + 'px');
|
|
|
|
}
|
2017-06-29 06:13:30 +00:00
|
|
|
if (this.loadMore) {
|
|
|
|
this.showLoadMore = true;
|
|
|
|
}
|
2017-06-15 05:45:01 +00:00
|
|
|
}
|
2017-06-22 10:03:01 +00:00
|
|
|
clearSearch() {
|
|
|
|
this.$.search = '';
|
|
|
|
}
|
|
|
|
$onInit() {
|
|
|
|
this.clearSearch();
|
|
|
|
}
|
2017-06-15 05:45:01 +00:00
|
|
|
}
|
2017-06-22 10:03:01 +00:00
|
|
|
DropDown.$inject = ['$element', '$scope'];
|
2017-06-13 11:08:06 +00:00
|
|
|
|
|
|
|
module.component('vnDropDown', {
|
|
|
|
template: require('./drop-down.html'),
|
2017-06-15 05:45:01 +00:00
|
|
|
controller: DropDown,
|
2017-06-13 11:08:06 +00:00
|
|
|
bindings: {
|
|
|
|
items: '<',
|
|
|
|
show: '<',
|
2017-06-21 11:16:37 +00:00
|
|
|
filter: '@?',
|
2017-06-15 05:45:01 +00:00
|
|
|
selected: '=',
|
2017-06-29 06:13:30 +00:00
|
|
|
loadMore: '&?',
|
2017-06-15 05:45:01 +00:00
|
|
|
top: '<?'
|
2017-06-21 11:16:37 +00:00
|
|
|
}
|
2017-06-13 11:08:06 +00:00
|
|
|
});
|