mirror of https://github.com/ColorlibHQ/AdminLTE
fix(js): AdminLTE 3 collapse button (#1938)
https://github.com/almasaeed2010/AdminLTE/issues/1910pull/1997/head
parent
a8ed14c146
commit
261c5c714e
|
@ -23,17 +23,21 @@ const Widget = (($) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Selector = {
|
const Selector = {
|
||||||
DATA_REMOVE : '[data-widget="remove"]',
|
DATA_REMOVE : '[data-widget="remove"]',
|
||||||
DATA_COLLAPSE: '[data-widget="collapse"]',
|
DATA_COLLAPSE : '[data-widget="collapse"]',
|
||||||
CARD : '.card',
|
CARD : '.card',
|
||||||
CARD_HEADER : '.card-header',
|
CARD_HEADER : '.card-header',
|
||||||
CARD_BODY : '.card-body',
|
CARD_BODY : '.card-body',
|
||||||
CARD_FOOTER : '.card-footer',
|
CARD_FOOTER : '.card-footer',
|
||||||
COLLAPSED : '.collapsed-card'
|
COLLAPSED : '.collapsed-card',
|
||||||
|
COLLAPSE_ICON : '.fa-minus',
|
||||||
|
EXPAND_ICON : '.fa-plus'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
COLLAPSED: 'collapsed-card'
|
COLLAPSED : 'collapsed-card',
|
||||||
|
COLLAPSE_ICON : 'fa-minus',
|
||||||
|
EXPAND_ICON : 'fa-plus'
|
||||||
}
|
}
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
|
@ -55,6 +59,10 @@ const Widget = (($) => {
|
||||||
this._parent.addClass(ClassName.COLLAPSED)
|
this._parent.addClass(ClassName.COLLAPSED)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this._element.children(Selector.COLLAPSE_ICON)
|
||||||
|
.addClass(ClassName.EXPAND_ICON)
|
||||||
|
.removeClass(ClassName.COLLAPSE_ICON)
|
||||||
|
|
||||||
const collapsed = $.Event(Event.COLLAPSED)
|
const collapsed = $.Event(Event.COLLAPSED)
|
||||||
|
|
||||||
this._element.trigger(collapsed, this._parent)
|
this._element.trigger(collapsed, this._parent)
|
||||||
|
@ -66,6 +74,10 @@ const Widget = (($) => {
|
||||||
this._parent.removeClass(ClassName.COLLAPSED)
|
this._parent.removeClass(ClassName.COLLAPSED)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this._element.children(Selector.EXPAND_ICON)
|
||||||
|
.addClass(ClassName.COLLAPSE_ICON)
|
||||||
|
.removeClass(ClassName.EXPAND_ICON)
|
||||||
|
|
||||||
const expanded = $.Event(Event.EXPANDED)
|
const expanded = $.Event(Event.EXPANDED)
|
||||||
|
|
||||||
this._element.trigger(expanded, this._parent)
|
this._element.trigger(expanded, this._parent)
|
||||||
|
|
Loading…
Reference in New Issue