2021-02-10 11:14:51 -05:00
|
|
|
/*!
|
2021-05-05 15:32:12 -04:00
|
|
|
* Bootstrap base-component.js v5.0.0 (https://getbootstrap.com/)
|
2021-02-10 11:14:51 -05:00
|
|
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
|
|
*/
|
|
|
|
(function (global, factory) {
|
2021-05-05 15:32:12 -04:00
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
|
|
|
|
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
|
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
|
|
|
|
}(this, (function (Data, EventHandler) { 'use strict';
|
2021-02-10 11:14:51 -05:00
|
|
|
|
|
|
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
|
|
|
|
|
|
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
2021-05-05 15:32:12 -04:00
|
|
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
2021-02-10 11:14:51 -05:00
|
|
|
|
2021-03-23 12:26:54 -04:00
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
2021-05-05 15:32:12 -04:00
|
|
|
* Bootstrap (v5.0.0): base-component.js
|
2021-03-23 12:26:54 -04:00
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*/
|
2021-02-10 11:14:51 -05:00
|
|
|
/**
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Constants
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2021-05-05 15:32:12 -04:00
|
|
|
const VERSION = '5.0.0';
|
2021-03-23 12:26:54 -04:00
|
|
|
|
|
|
|
class BaseComponent {
|
|
|
|
constructor(element) {
|
|
|
|
element = typeof element === 'string' ? document.querySelector(element) : element;
|
2021-02-10 11:14:51 -05:00
|
|
|
|
|
|
|
if (!element) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._element = element;
|
2021-03-23 12:26:54 -04:00
|
|
|
Data__default['default'].set(this._element, this.constructor.DATA_KEY, this);
|
2021-02-10 11:14:51 -05:00
|
|
|
}
|
|
|
|
|
2021-03-23 12:26:54 -04:00
|
|
|
dispose() {
|
|
|
|
Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
|
2021-05-05 15:32:12 -04:00
|
|
|
EventHandler__default['default'].off(this._element, `.${this.constructor.DATA_KEY}`);
|
2021-02-10 11:14:51 -05:00
|
|
|
this._element = null;
|
|
|
|
}
|
|
|
|
/** Static */
|
|
|
|
|
|
|
|
|
2021-03-23 12:26:54 -04:00
|
|
|
static getInstance(element) {
|
|
|
|
return Data__default['default'].get(element, this.DATA_KEY);
|
|
|
|
}
|
2021-02-10 11:14:51 -05:00
|
|
|
|
2021-03-23 12:26:54 -04:00
|
|
|
static get VERSION() {
|
|
|
|
return VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-02-10 11:14:51 -05:00
|
|
|
|
|
|
|
return BaseComponent;
|
|
|
|
|
|
|
|
})));
|
|
|
|
//# sourceMappingURL=base-component.js.map
|