OSDN Git Service

Remove unwanted dependencies
[bytom/vapor.git] / tools / side_chain_tool / web / node_modules / bootstrap / js / dist / alert.js
1 (function (global, factory) {
2   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
3   typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
4   (global.Alert = factory(global.jQuery,global.Util));
5 }(this, (function ($,Util) { 'use strict';
6
7   $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
8   Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
9
10   function _defineProperties(target, props) {
11     for (var i = 0; i < props.length; i++) {
12       var descriptor = props[i];
13       descriptor.enumerable = descriptor.enumerable || false;
14       descriptor.configurable = true;
15       if ("value" in descriptor) descriptor.writable = true;
16       Object.defineProperty(target, descriptor.key, descriptor);
17     }
18   }
19
20   function _createClass(Constructor, protoProps, staticProps) {
21     if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22     if (staticProps) _defineProperties(Constructor, staticProps);
23     return Constructor;
24   }
25
26   /**
27    * --------------------------------------------------------------------------
28    * Bootstrap (v4.1.3): alert.js
29    * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
30    * --------------------------------------------------------------------------
31    */
32
33   var Alert = function ($$$1) {
34     /**
35      * ------------------------------------------------------------------------
36      * Constants
37      * ------------------------------------------------------------------------
38      */
39     var NAME = 'alert';
40     var VERSION = '4.1.3';
41     var DATA_KEY = 'bs.alert';
42     var EVENT_KEY = "." + DATA_KEY;
43     var DATA_API_KEY = '.data-api';
44     var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
45     var Selector = {
46       DISMISS: '[data-dismiss="alert"]'
47     };
48     var Event = {
49       CLOSE: "close" + EVENT_KEY,
50       CLOSED: "closed" + EVENT_KEY,
51       CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
52     };
53     var ClassName = {
54       ALERT: 'alert',
55       FADE: 'fade',
56       SHOW: 'show'
57       /**
58        * ------------------------------------------------------------------------
59        * Class Definition
60        * ------------------------------------------------------------------------
61        */
62
63     };
64
65     var Alert =
66     /*#__PURE__*/
67     function () {
68       function Alert(element) {
69         this._element = element;
70       } // Getters
71
72
73       var _proto = Alert.prototype;
74
75       // Public
76       _proto.close = function close(element) {
77         var rootElement = this._element;
78
79         if (element) {
80           rootElement = this._getRootElement(element);
81         }
82
83         var customEvent = this._triggerCloseEvent(rootElement);
84
85         if (customEvent.isDefaultPrevented()) {
86           return;
87         }
88
89         this._removeElement(rootElement);
90       };
91
92       _proto.dispose = function dispose() {
93         $$$1.removeData(this._element, DATA_KEY);
94         this._element = null;
95       }; // Private
96
97
98       _proto._getRootElement = function _getRootElement(element) {
99         var selector = Util.getSelectorFromElement(element);
100         var parent = false;
101
102         if (selector) {
103           parent = document.querySelector(selector);
104         }
105
106         if (!parent) {
107           parent = $$$1(element).closest("." + ClassName.ALERT)[0];
108         }
109
110         return parent;
111       };
112
113       _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
114         var closeEvent = $$$1.Event(Event.CLOSE);
115         $$$1(element).trigger(closeEvent);
116         return closeEvent;
117       };
118
119       _proto._removeElement = function _removeElement(element) {
120         var _this = this;
121
122         $$$1(element).removeClass(ClassName.SHOW);
123
124         if (!$$$1(element).hasClass(ClassName.FADE)) {
125           this._destroyElement(element);
126
127           return;
128         }
129
130         var transitionDuration = Util.getTransitionDurationFromElement(element);
131         $$$1(element).one(Util.TRANSITION_END, function (event) {
132           return _this._destroyElement(element, event);
133         }).emulateTransitionEnd(transitionDuration);
134       };
135
136       _proto._destroyElement = function _destroyElement(element) {
137         $$$1(element).detach().trigger(Event.CLOSED).remove();
138       }; // Static
139
140
141       Alert._jQueryInterface = function _jQueryInterface(config) {
142         return this.each(function () {
143           var $element = $$$1(this);
144           var data = $element.data(DATA_KEY);
145
146           if (!data) {
147             data = new Alert(this);
148             $element.data(DATA_KEY, data);
149           }
150
151           if (config === 'close') {
152             data[config](this);
153           }
154         });
155       };
156
157       Alert._handleDismiss = function _handleDismiss(alertInstance) {
158         return function (event) {
159           if (event) {
160             event.preventDefault();
161           }
162
163           alertInstance.close(this);
164         };
165       };
166
167       _createClass(Alert, null, [{
168         key: "VERSION",
169         get: function get() {
170           return VERSION;
171         }
172       }]);
173
174       return Alert;
175     }();
176     /**
177      * ------------------------------------------------------------------------
178      * Data Api implementation
179      * ------------------------------------------------------------------------
180      */
181
182
183     $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
184     /**
185      * ------------------------------------------------------------------------
186      * jQuery
187      * ------------------------------------------------------------------------
188      */
189
190     $$$1.fn[NAME] = Alert._jQueryInterface;
191     $$$1.fn[NAME].Constructor = Alert;
192
193     $$$1.fn[NAME].noConflict = function () {
194       $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
195       return Alert._jQueryInterface;
196     };
197
198     return Alert;
199   }($);
200
201   return Alert;
202
203 })));
204 //# sourceMappingURL=alert.js.map