2018-11-13 08:41:12 +02:00
|
|
|
/*!
|
2024-02-20 16:14:29 +01:00
|
|
|
* Bootstrap alert.js v5.3.3 (https://getbootstrap.com/)
|
|
|
|
* Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
2020-06-16 21:50:01 +03:00
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
2018-11-13 08:41:12 +02:00
|
|
|
*/
|
2018-07-23 17:51:14 -07:00
|
|
|
(function (global, factory) {
|
2023-04-03 10:26:50 +03:00
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./util/component-functions.js'), require('./util/index.js')) :
|
|
|
|
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './util/component-functions', './util/index'], factory) :
|
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.BaseComponent, global.EventHandler, global.ComponentFunctions, global.Index));
|
|
|
|
})(this, (function (BaseComponent, EventHandler, componentFunctions_js, index_js) { 'use strict';
|
2021-02-10 18:14:51 +02:00
|
|
|
|
2021-08-04 18:41:51 +03:00
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
2023-03-24 16:30:16 +02:00
|
|
|
* Bootstrap alert.js
|
2021-03-23 18:26:54 +02:00
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*/
|
2022-12-24 18:37:22 +02:00
|
|
|
|
2023-05-30 18:15:55 +03:00
|
|
|
|
2020-12-03 16:18:59 +02:00
|
|
|
/**
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
|
2021-03-23 18:26:54 +02:00
|
|
|
const NAME = 'alert';
|
|
|
|
const DATA_KEY = 'bs.alert';
|
|
|
|
const EVENT_KEY = `.${DATA_KEY}`;
|
|
|
|
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
|
|
|
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
|
|
|
const CLASS_NAME_FADE = 'fade';
|
|
|
|
const CLASS_NAME_SHOW = 'show';
|
2022-12-24 18:37:22 +02:00
|
|
|
|
2019-10-08 09:39:10 +03:00
|
|
|
/**
|
2022-05-13 09:07:23 +03:00
|
|
|
* Class definition
|
2019-10-08 09:39:10 +03:00
|
|
|
*/
|
2015-05-07 16:34:28 -07:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
class Alert extends BaseComponent {
|
2021-03-23 18:26:54 +02:00
|
|
|
// Getters
|
2021-05-13 19:22:20 +03:00
|
|
|
static get NAME() {
|
|
|
|
return NAME;
|
2022-12-24 18:37:22 +02:00
|
|
|
}
|
2015-08-12 21:12:03 -07:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
// Public
|
2021-08-04 18:41:51 +03:00
|
|
|
close() {
|
2022-12-24 18:37:22 +02:00
|
|
|
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
|
2021-08-04 18:41:51 +03:00
|
|
|
if (closeEvent.defaultPrevented) {
|
2018-11-13 08:41:12 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-08-04 18:41:51 +03:00
|
|
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
|
|
|
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
|
|
|
|
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
2022-12-24 18:37:22 +02:00
|
|
|
}
|
2016-10-31 21:36:10 -07:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
// Private
|
2021-08-04 18:41:51 +03:00
|
|
|
_destroyElement() {
|
|
|
|
this._element.remove();
|
2022-12-24 18:37:22 +02:00
|
|
|
EventHandler.trigger(this._element, EVENT_CLOSED);
|
2021-08-04 18:41:51 +03:00
|
|
|
this.dispose();
|
2022-12-24 18:37:22 +02:00
|
|
|
}
|
2021-03-23 18:26:54 +02:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
// Static
|
2021-03-23 18:26:54 +02:00
|
|
|
static jQueryInterface(config) {
|
2018-11-13 08:41:12 +02:00
|
|
|
return this.each(function () {
|
2021-06-22 21:29:16 +03:00
|
|
|
const data = Alert.getOrCreateInstance(this);
|
2021-08-04 18:41:51 +03:00
|
|
|
if (typeof config !== 'string') {
|
|
|
|
return;
|
2018-11-13 08:41:12 +02:00
|
|
|
}
|
2021-08-04 18:41:51 +03:00
|
|
|
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
|
|
|
throw new TypeError(`No method named "${config}"`);
|
2018-11-13 08:41:12 +02:00
|
|
|
}
|
2021-08-04 18:41:51 +03:00
|
|
|
data[config](this);
|
|
|
|
});
|
2021-03-23 18:26:54 +02:00
|
|
|
}
|
|
|
|
}
|
2022-12-24 18:37:22 +02:00
|
|
|
|
2018-11-13 08:41:12 +02:00
|
|
|
/**
|
2022-05-13 09:07:23 +03:00
|
|
|
* Data API implementation
|
2018-11-13 08:41:12 +02:00
|
|
|
*/
|
2015-05-07 12:48:22 -07:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
componentFunctions_js.enableDismissTrigger(Alert, 'close');
|
2015-05-07 12:48:22 -07:00
|
|
|
|
2018-11-13 08:41:12 +02:00
|
|
|
/**
|
|
|
|
* jQuery
|
|
|
|
*/
|
2017-09-30 14:28:03 -07:00
|
|
|
|
2022-12-24 18:37:22 +02:00
|
|
|
index_js.defineJQueryPlugin(Alert);
|
2015-05-07 12:48:22 -07:00
|
|
|
|
2015-05-07 16:34:28 -07:00
|
|
|
return Alert;
|
2018-07-23 17:51:14 -07:00
|
|
|
|
2021-10-05 18:50:18 +03:00
|
|
|
}));
|
2018-07-23 17:51:14 -07:00
|
|
|
//# sourceMappingURL=alert.js.map
|