diff options
author | Mario <mario@mariovavti.com> | 2022-08-19 13:15:48 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-08-19 13:15:48 +0000 |
commit | 185ddf1eaf82e08586be6c7689507ee924d9dd47 (patch) | |
tree | 218ff6da6fb1511a1b2823729607c7c4b13e30e9 /vendor/twbs/bootstrap/js/src/base-component.js | |
parent | 7dee47183d05b6e1f7d5c5588e2df9993fb294dd (diff) | |
download | volse-hubzilla-185ddf1eaf82e08586be6c7689507ee924d9dd47.tar.gz volse-hubzilla-185ddf1eaf82e08586be6c7689507ee924d9dd47.tar.bz2 volse-hubzilla-185ddf1eaf82e08586be6c7689507ee924d9dd47.zip |
update to bootstrap 5.2 and fixes
Diffstat (limited to 'vendor/twbs/bootstrap/js/src/base-component.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/src/base-component.js | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/vendor/twbs/bootstrap/js/src/base-component.js b/vendor/twbs/bootstrap/js/src/base-component.js index 28cf877fb..b5008b3a2 100644 --- a/vendor/twbs/bootstrap/js/src/base-component.js +++ b/vendor/twbs/bootstrap/js/src/base-component.js @@ -1,52 +1,62 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.3): base-component.js + * Bootstrap (v5.2.0): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ import Data from './dom/data' -import { - executeAfterTransition, - getElement -} from './util/index' +import { executeAfterTransition, getElement } from './util/index' import EventHandler from './dom/event-handler' +import Config from './util/config' /** - * ------------------------------------------------------------------------ * Constants - * ------------------------------------------------------------------------ */ -const VERSION = '5.1.3' +const VERSION = '5.2.0' -class BaseComponent { - constructor(element) { - element = getElement(element) +/** + * Class definition + */ +class BaseComponent extends Config { + constructor(element, config) { + super() + + element = getElement(element) if (!element) { return } this._element = element + this._config = this._getConfig(config) + Data.set(this._element, this.constructor.DATA_KEY, this) } + // Public dispose() { Data.remove(this._element, this.constructor.DATA_KEY) EventHandler.off(this._element, this.constructor.EVENT_KEY) - Object.getOwnPropertyNames(this).forEach(propertyName => { + for (const propertyName of Object.getOwnPropertyNames(this)) { this[propertyName] = null - }) + } } _queueCallback(callback, element, isAnimated = true) { executeAfterTransition(callback, element, isAnimated) } - /** Static */ + _getConfig(config) { + config = this._mergeConfigObj(config, this._element) + config = this._configAfterMerge(config) + this._typeCheckConfig(config) + return config + } + // Static static getInstance(element) { return Data.get(getElement(element), this.DATA_KEY) } @@ -59,10 +69,6 @@ class BaseComponent { return VERSION } - static get NAME() { - throw new Error('You have to implement the static method "NAME", for each component!') - } - static get DATA_KEY() { return `bs.${this.NAME}` } @@ -70,6 +76,10 @@ class BaseComponent { static get EVENT_KEY() { return `.${this.DATA_KEY}` } + + static eventName(name) { + return `${name}${this.EVENT_KEY}` + } } export default BaseComponent |