comindware.ui
Version:
Comindware Core UI provides the basic components like editors, lists, dropdowns, popups that we so desperately need while creating Marionette-based single-page applications.
54 lines (43 loc) • 1.19 kB
JavaScript
/**
* Developer: Stepan Burguchev
* Date: 7/23/2014
* Copyright: 2009-2016 Comindware®
* All Rights Reserved
* Published under the MIT license
*/
'use strict';
import 'lib';
const CollapsibleBehavior = function(model) {
};
_.extend(CollapsibleBehavior.prototype, {
collapse(internal) {
if (this.collapsed) {
return;
}
this.collapsed = true;
this.trigger('collapsed', this);
this.trigger('toggle:collapse', this);
if (!internal && this.collection && this.collection.collapse) {
this.collection.collapse(this);
}
},
expand(internal) {
if (!this.collapsed) {
return;
}
this.collapsed = false;
this.trigger('expanded', this);
this.trigger('toggle:collapse', this);
if (!internal && this.collection && this.collection.expand) {
this.collection.expand(this);
}
},
toggleCollapsed() {
if (this.collapsed) {
this.expand();
} else {
this.collapse();
}
}
});
export default CollapsibleBehavior;