salix/client/core/src/drop-down/drop-down.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

import {module} from '../module';
import './style.scss';
export default class DropDown {
constructor($element, $scope) {
this.$element = $element;
this.$ = $scope;
2017-06-29 06:13:30 +00:00
this._showLoadMore = false;
}
2017-06-29 06:13:30 +00:00
get showLoadMore() {
return this._showLoadMore;
}
set showLoadMore(value) {
this._showLoadMore = value;
}
$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;
}
}
clearSearch() {
this.$.search = '';
}
$onInit() {
this.clearSearch();
}
}
DropDown.$inject = ['$element', '$scope'];
module.component('vnDropDown', {
template: require('./drop-down.html'),
controller: DropDown,
bindings: {
items: '<',
show: '<',
2017-06-21 11:16:37 +00:00
filter: '@?',
selected: '=',
2017-06-29 06:13:30 +00:00
loadMore: '&?',
top: '<?'
2017-06-21 11:16:37 +00:00
}
});