1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-24 14:13:06 +02:00

create a base component

This commit is contained in:
Johann-S
2019-09-04 17:58:29 +03:00
committed by XhmikosR
parent c63aebc86b
commit 9f6b342dc7
23 changed files with 229 additions and 113 deletions

View File

@@ -19,6 +19,7 @@ import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import Popper from 'popper.js'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
/**
* ------------------------------------------------------------------------
@@ -96,9 +97,10 @@ const DefaultType = {
* ------------------------------------------------------------------------
*/
class Dropdown {
class Dropdown extends BaseComponent {
constructor(element, config) {
this._element = element
super(element)
this._popper = null
this._config = this._getConfig(config)
this._menu = this._getMenuElement()
@@ -122,6 +124,10 @@ class Dropdown {
return DefaultType
}
static get DATA_KEY() {
return DATA_KEY
}
// Public
toggle() {
@@ -489,10 +495,6 @@ class Dropdown {
items[index].focus()
}
static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
/**