fix(js): AdminLTE 3 collapse button (#1938)

https://github.com/almasaeed2010/AdminLTE/issues/1910
pull/1997/head
hendimarcos 2019-01-31 15:00:03 -03:00 committed by Abdullah Almsaeed
parent a8ed14c146
commit 261c5c714e
1 changed files with 20 additions and 8 deletions

View File

@ -23,17 +23,21 @@ const Widget = (($) => {
}
const Selector = {
DATA_REMOVE : '[data-widget="remove"]',
DATA_COLLAPSE: '[data-widget="collapse"]',
CARD : '.card',
CARD_HEADER : '.card-header',
CARD_BODY : '.card-body',
CARD_FOOTER : '.card-footer',
COLLAPSED : '.collapsed-card'
DATA_REMOVE : '[data-widget="remove"]',
DATA_COLLAPSE : '[data-widget="collapse"]',
CARD : '.card',
CARD_HEADER : '.card-header',
CARD_BODY : '.card-body',
CARD_FOOTER : '.card-footer',
COLLAPSED : '.collapsed-card',
COLLAPSE_ICON : '.fa-minus',
EXPAND_ICON : '.fa-plus'
}
const ClassName = {
COLLAPSED: 'collapsed-card'
COLLAPSED : 'collapsed-card',
COLLAPSE_ICON : 'fa-minus',
EXPAND_ICON : 'fa-plus'
}
const Default = {
@ -55,6 +59,10 @@ const Widget = (($) => {
this._parent.addClass(ClassName.COLLAPSED)
})
this._element.children(Selector.COLLAPSE_ICON)
.addClass(ClassName.EXPAND_ICON)
.removeClass(ClassName.COLLAPSE_ICON)
const collapsed = $.Event(Event.COLLAPSED)
this._element.trigger(collapsed, this._parent)
@ -66,6 +74,10 @@ const Widget = (($) => {
this._parent.removeClass(ClassName.COLLAPSED)
})
this._element.children(Selector.EXPAND_ICON)
.addClass(ClassName.COLLAPSE_ICON)
.removeClass(ClassName.EXPAND_ICON)
const expanded = $.Event(Event.EXPANDED)
this._element.trigger(expanded, this._parent)