corrade-http-templates – Blame information for rev 61

Subversion Repositories:
Rev:
Rev Author Line No. Line
61 office 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.Tab = 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): tab.js
29 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
30 * --------------------------------------------------------------------------
31 */
32  
33 var Tab = function ($$$1) {
34 /**
35 * ------------------------------------------------------------------------
36 * Constants
37 * ------------------------------------------------------------------------
38 */
39 var NAME = 'tab';
40 var VERSION = '4.1.3';
41 var DATA_KEY = 'bs.tab';
42 var EVENT_KEY = "." + DATA_KEY;
43 var DATA_API_KEY = '.data-api';
44 var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
45 var Event = {
46 HIDE: "hide" + EVENT_KEY,
47 HIDDEN: "hidden" + EVENT_KEY,
48 SHOW: "show" + EVENT_KEY,
49 SHOWN: "shown" + EVENT_KEY,
50 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
51 };
52 var ClassName = {
53 DROPDOWN_MENU: 'dropdown-menu',
54 ACTIVE: 'active',
55 DISABLED: 'disabled',
56 FADE: 'fade',
57 SHOW: 'show'
58 };
59 var Selector = {
60 DROPDOWN: '.dropdown',
61 NAV_LIST_GROUP: '.nav, .list-group',
62 ACTIVE: '.active',
63 ACTIVE_UL: '> li > .active',
64 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
65 DROPDOWN_TOGGLE: '.dropdown-toggle',
66 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
67 /**
68 * ------------------------------------------------------------------------
69 * Class Definition
70 * ------------------------------------------------------------------------
71 */
72  
73 };
74  
75 var Tab =
76 /*#__PURE__*/
77 function () {
78 function Tab(element) {
79 this._element = element;
80 } // Getters
81  
82  
83 var _proto = Tab.prototype;
84  
85 // Public
86 _proto.show = function show() {
87 var _this = this;
88  
89 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $$$1(this._element).hasClass(ClassName.ACTIVE) || $$$1(this._element).hasClass(ClassName.DISABLED)) {
90 return;
91 }
92  
93 var target;
94 var previous;
95 var listElement = $$$1(this._element).closest(Selector.NAV_LIST_GROUP)[0];
96 var selector = Util.getSelectorFromElement(this._element);
97  
98 if (listElement) {
99 var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
100 previous = $$$1.makeArray($$$1(listElement).find(itemSelector));
101 previous = previous[previous.length - 1];
102 }
103  
104 var hideEvent = $$$1.Event(Event.HIDE, {
105 relatedTarget: this._element
106 });
107 var showEvent = $$$1.Event(Event.SHOW, {
108 relatedTarget: previous
109 });
110  
111 if (previous) {
112 $$$1(previous).trigger(hideEvent);
113 }
114  
115 $$$1(this._element).trigger(showEvent);
116  
117 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
118 return;
119 }
120  
121 if (selector) {
122 target = document.querySelector(selector);
123 }
124  
125 this._activate(this._element, listElement);
126  
127 var complete = function complete() {
128 var hiddenEvent = $$$1.Event(Event.HIDDEN, {
129 relatedTarget: _this._element
130 });
131 var shownEvent = $$$1.Event(Event.SHOWN, {
132 relatedTarget: previous
133 });
134 $$$1(previous).trigger(hiddenEvent);
135 $$$1(_this._element).trigger(shownEvent);
136 };
137  
138 if (target) {
139 this._activate(target, target.parentNode, complete);
140 } else {
141 complete();
142 }
143 };
144  
145 _proto.dispose = function dispose() {
146 $$$1.removeData(this._element, DATA_KEY);
147 this._element = null;
148 }; // Private
149  
150  
151 _proto._activate = function _activate(element, container, callback) {
152 var _this2 = this;
153  
154 var activeElements;
155  
156 if (container.nodeName === 'UL') {
157 activeElements = $$$1(container).find(Selector.ACTIVE_UL);
158 } else {
159 activeElements = $$$1(container).children(Selector.ACTIVE);
160 }
161  
162 var active = activeElements[0];
163 var isTransitioning = callback && active && $$$1(active).hasClass(ClassName.FADE);
164  
165 var complete = function complete() {
166 return _this2._transitionComplete(element, active, callback);
167 };
168  
169 if (active && isTransitioning) {
170 var transitionDuration = Util.getTransitionDurationFromElement(active);
171 $$$1(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
172 } else {
173 complete();
174 }
175 };
176  
177 _proto._transitionComplete = function _transitionComplete(element, active, callback) {
178 if (active) {
179 $$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE);
180 var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
181  
182 if (dropdownChild) {
183 $$$1(dropdownChild).removeClass(ClassName.ACTIVE);
184 }
185  
186 if (active.getAttribute('role') === 'tab') {
187 active.setAttribute('aria-selected', false);
188 }
189 }
190  
191 $$$1(element).addClass(ClassName.ACTIVE);
192  
193 if (element.getAttribute('role') === 'tab') {
194 element.setAttribute('aria-selected', true);
195 }
196  
197 Util.reflow(element);
198 $$$1(element).addClass(ClassName.SHOW);
199  
200 if (element.parentNode && $$$1(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
201 var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0];
202  
203 if (dropdownElement) {
204 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
205 $$$1(dropdownToggleList).addClass(ClassName.ACTIVE);
206 }
207  
208 element.setAttribute('aria-expanded', true);
209 }
210  
211 if (callback) {
212 callback();
213 }
214 }; // Static
215  
216  
217 Tab._jQueryInterface = function _jQueryInterface(config) {
218 return this.each(function () {
219 var $this = $$$1(this);
220 var data = $this.data(DATA_KEY);
221  
222 if (!data) {
223 data = new Tab(this);
224 $this.data(DATA_KEY, data);
225 }
226  
227 if (typeof config === 'string') {
228 if (typeof data[config] === 'undefined') {
229 throw new TypeError("No method named \"" + config + "\"");
230 }
231  
232 data[config]();
233 }
234 });
235 };
236  
237 _createClass(Tab, null, [{
238 key: "VERSION",
239 get: function get() {
240 return VERSION;
241 }
242 }]);
243  
244 return Tab;
245 }();
246 /**
247 * ------------------------------------------------------------------------
248 * Data Api implementation
249 * ------------------------------------------------------------------------
250 */
251  
252  
253 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
254 event.preventDefault();
255  
256 Tab._jQueryInterface.call($$$1(this), 'show');
257 });
258 /**
259 * ------------------------------------------------------------------------
260 * jQuery
261 * ------------------------------------------------------------------------
262 */
263  
264 $$$1.fn[NAME] = Tab._jQueryInterface;
265 $$$1.fn[NAME].Constructor = Tab;
266  
267 $$$1.fn[NAME].noConflict = function () {
268 $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
269 return Tab._jQueryInterface;
270 };
271  
272 return Tab;
273 }($);
274  
275 return Tab;
276  
277 })));
278 //# sourceMappingURL=tab.js.map