mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-26 06:44:35 +02:00
create a base component
This commit is contained in:
@@ -20,6 +20,7 @@ import Data from './dom/data'
|
||||
import EventHandler from './dom/event-handler'
|
||||
import Manipulator from './dom/manipulator'
|
||||
import SelectorEngine from './dom/selector-engine'
|
||||
import BaseComponent from './base-component'
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
@@ -81,10 +82,11 @@ const SELECTOR_STICKY_CONTENT = '.sticky-top'
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Modal {
|
||||
class Modal extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
super(element)
|
||||
|
||||
this._config = this._getConfig(config)
|
||||
this._element = element
|
||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element)
|
||||
this._backdrop = null
|
||||
this._isShown = false
|
||||
@@ -105,6 +107,10 @@ class Modal {
|
||||
return Default
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY
|
||||
}
|
||||
|
||||
// Public
|
||||
|
||||
toggle(relatedTarget) {
|
||||
@@ -563,10 +569,6 @@ class Modal {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static getInstance(element) {
|
||||
return Data.getData(element, DATA_KEY)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user