bootstrap.js 153 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
5001
5002
5003
5004
5005
5006
5007
5008
5009
    return Tab;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
5010
  EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5011
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
5012
5013
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
5014
  });
XhmikosR's avatar
XhmikosR committed
5015
  var $$a = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5016
5017
5018
5019
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5020
   * add .tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5021
5022
   */

5023
5024
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5025
5026
5027
5028
  if ($$a) {
    var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
    $$a.fn[NAME$9] = Tab.jQueryInterface;
    $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist    
XhmikosR committed
5029

XhmikosR's avatar
XhmikosR committed
5030
5031
5032
    $$a.fn[NAME$9].noConflict = function () {
      $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
      return Tab.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5033
5034
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
5035
5036

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
5037
5038
5039
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
5040
   */
Mark Otto's avatar
dist    
Mark Otto committed
5041

XhmikosR's avatar
Dist    
XhmikosR committed
5042
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
5043
  var VERSION$a = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
5044
5045
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
5046
  var Event$b = {
XhmikosR's avatar
Dist    
XhmikosR committed
5047
5048
5049
5050
5051
5052
5053
5054
5055
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
    HIDE: "hide" + EVENT_KEY$a,
    HIDDEN: "hidden" + EVENT_KEY$a,
    SHOW: "show" + EVENT_KEY$a,
    SHOWN: "shown" + EVENT_KEY$a
  };
  var ClassName$a = {
    FADE: 'fade',
    HIDE: 'hide',
Mark Otto's avatar
dist    
Mark Otto committed
5056
5057
    SHOW: 'show',
    SHOWING: 'showing'
XhmikosR's avatar
Dist    
XhmikosR committed
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
  };
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
    delay: 500
  };
  var Selector$a = {
    DATA_DISMISS: '[data-dismiss="toast"]'
  };
XhmikosR's avatar
XhmikosR committed
5072
5073
5074
5075
5076
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
5077

XhmikosR's avatar
Dist    
XhmikosR committed
5078
5079
5080
5081
5082
5083
5084
  var Toast =
  /*#__PURE__*/
  function () {
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Jacob Thornton's avatar
Jacob Thornton committed
5085

XhmikosR's avatar
Dist    
XhmikosR committed
5086
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
5087
5088

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
5089
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
5090

Johann-S's avatar
build    
Johann-S committed
5091

XhmikosR's avatar
Dist    
XhmikosR committed
5092
    var _proto = Toast.prototype;
XhmikosR's avatar
Dist    
XhmikosR committed
5093

XhmikosR's avatar
Dist    
XhmikosR committed
5094
5095
5096
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
5097

Mark Otto's avatar
dist v5    
Mark Otto committed
5098
5099
5100
5101
5102
      var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

      if (showEvent.defaultPrevented) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
5103

XhmikosR's avatar
Dist    
XhmikosR committed
5104
5105
5106
      if (this._config.animation) {
        this._element.classList.add(ClassName$a.FADE);
      }
Mark Otto's avatar
dist    
Mark Otto committed
5107

XhmikosR's avatar
Dist    
XhmikosR committed
5108
      var complete = function complete() {
Mark Otto's avatar
dist    
Mark Otto committed
5109
5110
5111
5112
        _this._element.classList.remove(ClassName$a.SHOWING);

        _this._element.classList.add(ClassName$a.SHOW);

XhmikosR's avatar
XhmikosR committed
5113
        EventHandler.trigger(_this._element, Event$b.SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
5114

XhmikosR's avatar
Dist    
XhmikosR committed
5115
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
5116
5117
5118
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
5119
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5120
      };
Mark Otto's avatar
dist    
Mark Otto committed
5121

Mark Otto's avatar
dist    
Mark Otto committed
5122
5123
      this._element.classList.remove(ClassName$a.HIDE);

5124
5125
      reflow(this._element);

Mark Otto's avatar
dist    
Mark Otto committed
5126
      this._element.classList.add(ClassName$a.SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
5127

XhmikosR's avatar
Dist    
XhmikosR committed
5128
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
5129
5130
5131
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5132
5133
5134
5135
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5136

XhmikosR's avatar
XhmikosR committed
5137
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
5138
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5139

XhmikosR's avatar
Dist    
XhmikosR committed
5140
5141
5142
      if (!this._element.classList.contains(ClassName$a.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5143

Mark Otto's avatar
dist v5    
Mark Otto committed
5144
5145
5146
5147
5148
      var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5149

XhmikosR's avatar
XhmikosR committed
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
      var complete = function complete() {
        _this2._element.classList.add(ClassName$a.HIDE);

        EventHandler.trigger(_this2._element, Event$b.HIDDEN);
      };

      this._element.classList.remove(ClassName$a.SHOW);

      if (this._config.animation) {
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5162
      } else {
XhmikosR's avatar
XhmikosR committed
5163
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
5164
5165
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
5166

XhmikosR's avatar
Dist    
XhmikosR committed
5167
5168
5169
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
dist    
Mark Otto committed
5170

XhmikosR's avatar
Dist    
XhmikosR committed
5171
5172
5173
      if (this._element.classList.contains(ClassName$a.SHOW)) {
        this._element.classList.remove(ClassName$a.SHOW);
      }
Jacob Thornton's avatar
Jacob Thornton committed
5174

XhmikosR's avatar
XhmikosR committed
5175
5176
      EventHandler.off(this._element, Event$b.CLICK_DISMISS);
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
5177
5178
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
5179
5180
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5181

XhmikosR's avatar
Dist    
XhmikosR committed
5182
    _proto._getConfig = function _getConfig(config) {
5183
      config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
5184
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
5185
5186
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5187

XhmikosR's avatar
Dist    
XhmikosR committed
5188
5189
    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5190

XhmikosR's avatar
XhmikosR committed
5191
      EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
XhmikosR's avatar
XhmikosR committed
5192
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
5193
      });
Mark Otto's avatar
Mark Otto committed
5194
5195
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
5196

XhmikosR's avatar
XhmikosR committed
5197
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
5198
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5199
        var data = Data.getData(this, DATA_KEY$a);
Jacob Thornton's avatar
Jacob Thornton committed
5200

XhmikosR's avatar
Dist    
XhmikosR committed
5201
5202
5203
5204
5205
        var _config = typeof config === 'object' && config;

        if (!data) {
          data = new Toast(this, _config);
        }
Jacob Thornton's avatar
Jacob Thornton committed
5206

XhmikosR's avatar
Dist    
XhmikosR committed
5207
5208
5209
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
grunt    
Mark Otto committed
5210
          }
Mark Otto's avatar
dist    
Mark Otto committed
5211

XhmikosR's avatar
Dist    
XhmikosR committed
5212
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
5213
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5214
5215
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
5216

XhmikosR's avatar
XhmikosR committed
5217
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5218
5219
5220
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
    _createClass(Toast, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$a;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$7;
      }
Mark Otto's avatar
Mark Otto committed
5231
5232
5233
5234
5235
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5236
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
5237

XhmikosR's avatar
Dist    
XhmikosR committed
5238
5239
    return Toast;
  }();
XhmikosR's avatar
XhmikosR committed
5240
5241

  var $$b = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5242
5243
5244
5245
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5246
   *  add .toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5247
   */
XhmikosR's avatar
Dist    
XhmikosR committed
5248

5249
5250
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5251
5252
5253
5254
  if ($$b) {
    var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
    $$b.fn[NAME$a] = Toast.jQueryInterface;
    $$b.fn[NAME$a].Constructor = Toast;
Mark Otto's avatar
dist    
Mark Otto committed
5255

XhmikosR's avatar
XhmikosR committed
5256
5257
5258
    $$b.fn[NAME$a].noConflict = function () {
      $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
      return Toast.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5259
5260
    };
  }
Mark Otto's avatar
grunt    
Mark Otto committed
5261

Mark Otto's avatar
dist    
Mark Otto committed
5262
5263
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist.    
XhmikosR committed
5264
   * Bootstrap (v4.3.1): index.umd.js
Mark Otto's avatar
dist    
Mark Otto committed
5265
5266
5267
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
  var index_umd = {
    Alert: Alert,
    Button: Button,
    Carousel: Carousel,
    Collapse: Collapse,
    Dropdown: Dropdown,
    Modal: Modal,
    Popover: Popover,
    ScrollSpy: ScrollSpy,
    Tab: Tab,
    Toast: Toast,
    Tooltip: Tooltip
  };
Mark Otto's avatar
dist    
Mark Otto committed
5281

XhmikosR's avatar
Dist.    
XhmikosR committed
5282
  return index_umd;
Mark Otto's avatar
dist    
Mark Otto committed
5283

Mark Otto's avatar
Mark Otto committed
5284
}));
Mark Otto's avatar
dist    
Mark Otto committed
5285
//# sourceMappingURL=bootstrap.js.map
For faster browsing, not all history is shown. View entire blame