bootstrap.esm.js 145 KB
Newer Older
5001

XhmikosR's avatar
XhmikosR committed
5002
    this._element.classList.add(CLASS_NAME_SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
5003
5004

    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
5005
      var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
5006
5007
5008
5009
5010
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
5011
5012
5013
5014
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
5015

XhmikosR's avatar
XhmikosR committed
5016
    if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5017
5018
5019
      return;
    }

XhmikosR's avatar
XhmikosR committed
5020
    var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
5021
5022
5023
5024

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

XhmikosR's avatar
XhmikosR committed
5026
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
5027
      _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
5028

XhmikosR's avatar
XhmikosR committed
5029
      EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
5030
5031
    };

XhmikosR's avatar
XhmikosR committed
5032
    this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
5033
5034
5035
5036
5037

    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
5038
    } else {
XhmikosR's avatar
XhmikosR committed
5039
      complete();
XhmikosR's avatar
Dist.  
XhmikosR committed
5040
    }
XhmikosR's avatar
XhmikosR committed
5041
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5042

XhmikosR's avatar
XhmikosR committed
5043
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
5044
5045
5046
    clearTimeout(this._timeout);
    this._timeout = null;

XhmikosR's avatar
XhmikosR committed
5047
5048
    if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
      this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
5049
5050
    }

XhmikosR's avatar
XhmikosR committed
5051
    EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
5052
5053
5054
5055
    Data.removeData(this._element, DATA_KEY$a);
    this._element = null;
    this._config = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
5056
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
5057

XhmikosR's avatar
XhmikosR committed
5058
  _proto._getConfig = function _getConfig(config) {
5059
    config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
5060
5061
    typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
5062
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5063

XhmikosR's avatar
XhmikosR committed
5064
5065
  _proto._setListeners = function _setListeners() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
5066

XhmikosR's avatar
XhmikosR committed
5067
    EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
XhmikosR's avatar
XhmikosR committed
5068
5069
      return _this3.hide();
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
5070
  } // Static
XhmikosR's avatar
XhmikosR committed
5071
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
5072

XhmikosR's avatar
XhmikosR committed
5073
  Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5074
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5075
      var data = Data.getData(this, DATA_KEY$a);
XhmikosR's avatar
Dist.  
XhmikosR committed
5076

XhmikosR's avatar
XhmikosR committed
5077
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
5078
5079
5080
5081
5082
5083
5084

      if (!data) {
        data = new Toast(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
5085
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
5086
5087
5088
5089
5090
        }

        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
5091
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5092

XhmikosR's avatar
XhmikosR committed
5093
  Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5094
    return Data.getData(element, DATA_KEY$a);
XhmikosR's avatar
XhmikosR committed
5095
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5096

XhmikosR's avatar
XhmikosR committed
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
  _createClass(Toast, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$a;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$7;
    }
  }]);

  return Toast;
}();
XhmikosR's avatar
XhmikosR committed
5116
5117

var $$b = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
5118
5119
5120
5121
5122
5123
5124
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 *  add .toast to jQuery only if jQuery is present
 */

5125
5126
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5127
5128
5129
5130
if ($$b) {
  var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
  $$b.fn[NAME$a] = Toast.jQueryInterface;
  $$b.fn[NAME$a].Constructor = Toast;
XhmikosR's avatar
Dist.  
XhmikosR committed
5131

XhmikosR's avatar
XhmikosR committed
5132
5133
5134
  $$b.fn[NAME$a].noConflict = function () {
    $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
    return Toast.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
5135
5136
5137
5138
5139
  };
}

export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Popover, ScrollSpy, Tab, Toast, Tooltip };
//# sourceMappingURL=bootstrap.esm.js.map
For faster browsing, not all history is shown. View entire blame