framework/ember/app/components/ui/controls/dropdown-select.js

28 lines
825 B
JavaScript
Raw Normal View History

2015-01-03 09:56:14 +08:00
import Ember from 'ember';
export default Ember.Component.extend({
items: [],
2015-01-03 19:21:47 +08:00
layoutName: 'components/ui/controls/dropdown-select',
2015-01-03 09:56:14 +08:00
classNames: ['dropdown', 'dropdown-select', 'btn-group'],
classNameBindings: ['itemCountClass', 'class'],
2015-01-03 09:56:14 +08:00
buttonClass: 'btn btn-default',
menuClass: '',
2015-01-03 09:56:14 +08:00
icon: 'ellipsis-v',
mainButtonClass: function() {
return 'btn '+this.get('buttonClass');
}.property('buttonClass'),
dropdownMenuClass: function() {
return 'dropdown-menu '+this.get('menuClass');
}.property('menuClass'),
itemCountClass: function() {
return 'item-count-'+this.get('items.length');
}.property('items.length'),
2015-01-03 19:21:47 +08:00
activeItem: function() {
2015-01-03 09:56:14 +08:00
return this.get('menu.childViews').findBy('active');
}.property('menu.childViews.@each.active')
});