bootstrap.js 153 KB
Newer Older
Mark Otto's avatar
dist    
Mark Otto committed
5001
    };
Jacob Thornton's avatar
Jacob Thornton committed
5002

XhmikosR's avatar
XhmikosR committed
5003
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5004
5005
5006
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

    return Tab;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
5023
  EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5024
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
5025
5026
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
5027
  });
XhmikosR's avatar
XhmikosR committed
5028
  var $$a = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5029
5030
5031
5032
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5033
   * add .tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5034
5035
   */

5036
5037
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5038
5039
5040
5041
  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
5042

XhmikosR's avatar
XhmikosR committed
5043
5044
5045
    $$a.fn[NAME$9].noConflict = function () {
      $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
      return Tab.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5046
5047
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
5048
5049

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
5050
5051
5052
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
5053
   */
Mark Otto's avatar
dist    
Mark Otto committed
5054

XhmikosR's avatar
Dist    
XhmikosR committed
5055
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
5056
  var VERSION$a = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
5057
5058
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
5059
  var Event$b = {
XhmikosR's avatar
Dist    
XhmikosR committed
5060
5061
5062
5063
5064
5065
5066
5067
5068
    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
5069
5070
    SHOW: 'show',
    SHOWING: 'showing'
XhmikosR's avatar
Dist    
XhmikosR committed
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
  };
  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"]'
Mark Otto's avatar
dist    
Mark Otto committed
5084
5085
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
5086
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
5087
5088
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
5089

XhmikosR's avatar
Dist    
XhmikosR committed
5090
  };
Jacob Thornton's avatar
Jacob Thornton committed
5091

XhmikosR's avatar
Dist    
XhmikosR committed
5092
5093
5094
5095
5096
5097
5098
  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
5099

XhmikosR's avatar
Dist    
XhmikosR committed
5100
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
5101
5102

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
5106
    var _proto = Toast.prototype;
XhmikosR's avatar
Dist    
XhmikosR committed
5107

XhmikosR's avatar
Dist    
XhmikosR committed
5108
5109
5110
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
5111

Mark Otto's avatar
dist v5    
Mark Otto committed
5112
5113
5114
5115
5116
      var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

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

XhmikosR's avatar
Dist    
XhmikosR committed
5118
5119
5120
      if (this._config.animation) {
        this._element.classList.add(ClassName$a.FADE);
      }
Mark Otto's avatar
dist    
Mark Otto committed
5121

XhmikosR's avatar
Dist    
XhmikosR committed
5122
      var complete = function complete() {
Mark Otto's avatar
dist    
Mark Otto committed
5123
5124
5125
5126
        _this._element.classList.remove(ClassName$a.SHOWING);

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
5129
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
5130
5131
5132
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
5133
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5134
      };
Mark Otto's avatar
dist    
Mark Otto committed
5135

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

5138
5139
      reflow(this._element);

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

XhmikosR's avatar
Dist    
XhmikosR committed
5142
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
5143
5144
5145
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5146
5147
5148
5149
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5150

XhmikosR's avatar
XhmikosR committed
5151
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
5152
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5153

XhmikosR's avatar
Dist    
XhmikosR committed
5154
5155
5156
      if (!this._element.classList.contains(ClassName$a.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5157

Mark Otto's avatar
dist v5    
Mark Otto committed
5158
5159
5160
5161
5162
      var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

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

XhmikosR's avatar
XhmikosR committed
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
      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
5176
      } else {
XhmikosR's avatar
XhmikosR committed
5177
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
5178
5179
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
5180

XhmikosR's avatar
Dist    
XhmikosR committed
5181
5182
5183
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
dist    
Mark Otto committed
5184

XhmikosR's avatar
Dist    
XhmikosR committed
5185
5186
5187
      if (this._element.classList.contains(ClassName$a.SHOW)) {
        this._element.classList.remove(ClassName$a.SHOW);
      }
Jacob Thornton's avatar
Jacob Thornton committed
5188

XhmikosR's avatar
XhmikosR committed
5189
5190
      EventHandler.off(this._element, Event$b.CLICK_DISMISS);
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
5191
5192
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
5193
5194
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5195

XhmikosR's avatar
Dist    
XhmikosR committed
5196
    _proto._getConfig = function _getConfig(config) {
5197
      config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
5198
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
5199
5200
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5201

XhmikosR's avatar
Dist    
XhmikosR committed
5202
5203
    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5204

XhmikosR's avatar
XhmikosR committed
5205
      EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
XhmikosR's avatar
XhmikosR committed
5206
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
5207
      });
Mark Otto's avatar
Mark Otto committed
5208
5209
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
5210

XhmikosR's avatar
XhmikosR committed
5211
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
5212
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5213
        var data = Data.getData(this, DATA_KEY$a);
Jacob Thornton's avatar
Jacob Thornton committed
5214

XhmikosR's avatar
Dist    
XhmikosR committed
5215
5216
5217
5218
5219
        var _config = typeof config === 'object' && config;

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

XhmikosR's avatar
Dist    
XhmikosR committed
5221
5222
5223
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
grunt    
Mark Otto committed
5224
          }
Mark Otto's avatar
dist    
Mark Otto committed
5225

XhmikosR's avatar
Dist    
XhmikosR committed
5226
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
5227
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5228
5229
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
5230

XhmikosR's avatar
XhmikosR committed
5231
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5232
5233
5234
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
    _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
5245
5246
5247
5248
5249
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5250
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
5251

XhmikosR's avatar
Dist    
XhmikosR committed
5252
5253
    return Toast;
  }();
XhmikosR's avatar
XhmikosR committed
5254
5255

  var $$b = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5256
5257
5258
5259
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5260
   *  add .toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5261
   */
XhmikosR's avatar
Dist    
XhmikosR committed
5262

5263
5264
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5265
5266
5267
5268
  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
5269

XhmikosR's avatar
XhmikosR committed
5270
5271
5272
    $$b.fn[NAME$a].noConflict = function () {
      $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
      return Toast.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5273
5274
    };
  }
Mark Otto's avatar
grunt    
Mark Otto committed
5275

Mark Otto's avatar
dist    
Mark Otto committed
5276
5277
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist.    
XhmikosR committed
5278
   * Bootstrap (v4.3.1): index.umd.js
Mark Otto's avatar
dist    
Mark Otto committed
5279
5280
5281
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
  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
5295

XhmikosR's avatar
Dist.    
XhmikosR committed
5296
  return index_umd;
Mark Otto's avatar
dist    
Mark Otto committed
5297

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