1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("jquery"));
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define(["./foundation.core", "./foundation.util.box", "./foundation.util.keyboard", "./foundation.util.nest", "jquery"], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["foundation.drilldown"] = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("jquery"));
|
8 | else
|
9 | root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.drilldown"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.box"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.nest"], root["jQuery"]);
|
10 | })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_box__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.d = function(exports, name, getter) {
|
48 | if(!__webpack_require__.o(exports, name)) {
|
49 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
50 | }
|
51 | };
|
52 |
|
53 |
|
54 | __webpack_require__.r = function(exports) {
|
55 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
56 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
57 | }
|
58 | Object.defineProperty(exports, '__esModule', { value: true });
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | __webpack_require__.t = function(value, mode) {
|
67 | if(mode & 1) value = __webpack_require__(value);
|
68 | if(mode & 8) return value;
|
69 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
70 | var ns = Object.create(null);
|
71 | __webpack_require__.r(ns);
|
72 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
73 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
74 | return ns;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.n = function(module) {
|
79 | var getter = module && module.__esModule ?
|
80 | function getDefault() { return module['default']; } :
|
81 | function getModuleExports() { return module; };
|
82 | __webpack_require__.d(getter, 'a', getter);
|
83 | return getter;
|
84 | };
|
85 |
|
86 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "";
|
91 |
|
92 |
|
93 |
|
94 | return __webpack_require__(__webpack_require__.s = 3);
|
95 | })
|
96 |
|
97 | ({
|
98 |
|
99 | "./foundation.core":
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | (function(module, exports) {
|
105 |
|
106 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
|
107 |
|
108 | }),
|
109 |
|
110 | "./foundation.util.box":
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | (function(module, exports) {
|
116 |
|
117 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_box__;
|
118 |
|
119 | }),
|
120 |
|
121 | "./foundation.util.keyboard":
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | (function(module, exports) {
|
127 |
|
128 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
|
129 |
|
130 | }),
|
131 |
|
132 | "./foundation.util.nest":
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | (function(module, exports) {
|
138 |
|
139 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__;
|
140 |
|
141 | }),
|
142 |
|
143 | "./js/entries/plugins/foundation.drilldown.js":
|
144 |
|
145 |
|
146 |
|
147 |
|
148 | (function(module, __webpack_exports__, __webpack_require__) {
|
149 |
|
150 | "use strict";
|
151 | __webpack_require__.r(__webpack_exports__);
|
152 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
|
153 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
|
154 | __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
|
155 |
|
156 | var _foundation_drilldown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.drilldown.js");
|
157 | __webpack_require__.d(__webpack_exports__, "Drilldown", function() { return _foundation_drilldown__WEBPACK_IMPORTED_MODULE_1__["Drilldown"]; });
|
158 |
|
159 |
|
160 |
|
161 | _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_drilldown__WEBPACK_IMPORTED_MODULE_1__["Drilldown"], 'Drilldown');
|
162 |
|
163 |
|
164 | }),
|
165 |
|
166 | "./js/foundation.drilldown.js":
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | (function(module, __webpack_exports__, __webpack_require__) {
|
172 |
|
173 | "use strict";
|
174 | __webpack_require__.r(__webpack_exports__);
|
175 | __webpack_require__.d(__webpack_exports__, "Drilldown", function() { return Drilldown; });
|
176 | var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
|
177 | var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
178 | var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.util.keyboard");
|
179 | var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__);
|
180 | var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./foundation.util.nest");
|
181 | var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__);
|
182 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./foundation.core");
|
183 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__);
|
184 | var _foundation_util_box__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( "./foundation.util.box");
|
185 | var _foundation_util_box__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(_foundation_util_box__WEBPACK_IMPORTED_MODULE_4__);
|
186 |
|
187 |
|
188 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
189 |
|
190 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
191 |
|
192 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
193 |
|
194 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
195 |
|
196 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
197 |
|
198 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
199 |
|
200 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
201 |
|
202 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
203 |
|
204 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 | var Drilldown =
|
221 |
|
222 | function (_Plugin) {
|
223 | _inherits(Drilldown, _Plugin);
|
224 |
|
225 | function Drilldown() {
|
226 | _classCallCheck(this, Drilldown);
|
227 |
|
228 | return _possibleConstructorReturn(this, _getPrototypeOf(Drilldown).apply(this, arguments));
|
229 | }
|
230 |
|
231 | _createClass(Drilldown, [{
|
232 | key: "_setup",
|
233 |
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 | value: function _setup(element, options) {
|
242 | this.$element = element;
|
243 | this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Drilldown.defaults, this.$element.data(), options);
|
244 | this.className = 'Drilldown';
|
245 |
|
246 | this._init();
|
247 |
|
248 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].register('Drilldown', {
|
249 | 'ENTER': 'open',
|
250 | 'SPACE': 'open',
|
251 | 'ARROW_RIGHT': 'next',
|
252 | 'ARROW_UP': 'up',
|
253 | 'ARROW_DOWN': 'down',
|
254 | 'ARROW_LEFT': 'previous',
|
255 | 'ESCAPE': 'close',
|
256 | 'TAB': 'down',
|
257 | 'SHIFT_TAB': 'up'
|
258 | });
|
259 | }
|
260 | |
261 |
|
262 |
|
263 |
|
264 |
|
265 | }, {
|
266 | key: "_init",
|
267 | value: function _init() {
|
268 | _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__["Nest"].Feather(this.$element, 'drilldown');
|
269 |
|
270 | if (this.options.autoApplyClass) {
|
271 | this.$element.addClass('drilldown');
|
272 | }
|
273 |
|
274 | this.$element.attr({
|
275 | 'role': 'tree',
|
276 | 'aria-multiselectable': false
|
277 | });
|
278 | this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a');
|
279 | this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]').attr('role', 'group');
|
280 | this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'treeitem').find('a');
|
281 |
|
282 |
|
283 | this.$currentMenu = this.$element;
|
284 | this.$element.attr('data-mutate', this.$element.attr('data-drilldown') || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'drilldown'));
|
285 |
|
286 | this._prepareMenu();
|
287 |
|
288 | this._registerEvents();
|
289 |
|
290 | this._keyboardEvents();
|
291 | }
|
292 | |
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 | }, {
|
301 | key: "_prepareMenu",
|
302 | value: function _prepareMenu() {
|
303 | var _this = this;
|
304 |
|
305 |
|
306 |
|
307 |
|
308 | this.$submenuAnchors.each(function () {
|
309 | var $link = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
|
310 | var $sub = $link.parent();
|
311 |
|
312 | if (_this.options.parentLink) {
|
313 | $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li data-is-parent-link class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="none"></li>');
|
314 | }
|
315 |
|
316 | $link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0);
|
317 | $link.children('[data-submenu]').attr({
|
318 | 'aria-hidden': true,
|
319 | 'tabindex': 0,
|
320 | 'role': 'group'
|
321 | });
|
322 |
|
323 | _this._events($link);
|
324 | });
|
325 | this.$submenus.each(function () {
|
326 | var $menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
|
327 | $back = $menu.find('.js-drilldown-back');
|
328 |
|
329 | if (!$back.length) {
|
330 | switch (_this.options.backButtonPosition) {
|
331 | case "bottom":
|
332 | $menu.append(_this.options.backButton);
|
333 | break;
|
334 |
|
335 | case "top":
|
336 | $menu.prepend(_this.options.backButton);
|
337 | break;
|
338 |
|
339 | default:
|
340 | console.error("Unsupported backButtonPosition value '" + _this.options.backButtonPosition + "'");
|
341 | }
|
342 | }
|
343 |
|
344 | _this._back($menu);
|
345 | });
|
346 | this.$submenus.addClass('invisible');
|
347 |
|
348 | if (!this.options.autoHeight) {
|
349 | this.$submenus.addClass('drilldown-submenu-cover-previous');
|
350 | }
|
351 |
|
352 |
|
353 | if (!this.$element.parent().hasClass('is-drilldown')) {
|
354 | this.$wrapper = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.options.wrapper).addClass('is-drilldown');
|
355 | if (this.options.animateHeight) this.$wrapper.addClass('animate-height');
|
356 | this.$element.wrap(this.$wrapper);
|
357 | }
|
358 |
|
359 |
|
360 | this.$wrapper = this.$element.parent();
|
361 | this.$wrapper.css(this._getMaxDims());
|
362 | }
|
363 | }, {
|
364 | key: "_resize",
|
365 | value: function _resize() {
|
366 | this.$wrapper.css({
|
367 | 'max-width': 'none',
|
368 | 'min-height': 'none'
|
369 | });
|
370 |
|
371 | this.$wrapper.css(this._getMaxDims());
|
372 | }
|
373 | |
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | }, {
|
381 | key: "_events",
|
382 | value: function _events($elem) {
|
383 | var _this = this;
|
384 |
|
385 | $elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) {
|
386 | if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) {
|
387 | e.preventDefault();
|
388 | }
|
389 |
|
390 |
|
391 |
|
392 |
|
393 | _this._show($elem.parent('li'));
|
394 |
|
395 | if (_this.options.closeOnClick) {
|
396 | var $body = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body');
|
397 | $body.off('.zf.drilldown').on('click.zf.drilldown', function (e) {
|
398 | if (e.target === _this.$element[0] || jquery__WEBPACK_IMPORTED_MODULE_0___default.a.contains(_this.$element[0], e.target)) {
|
399 | return;
|
400 | }
|
401 |
|
402 | e.preventDefault();
|
403 |
|
404 | _this._hideAll();
|
405 |
|
406 | $body.off('.zf.drilldown');
|
407 | });
|
408 | }
|
409 | });
|
410 | }
|
411 | |
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | }, {
|
418 | key: "_registerEvents",
|
419 | value: function _registerEvents() {
|
420 | if (this.options.scrollTop) {
|
421 | this._bindHandler = this._scrollTop.bind(this);
|
422 | this.$element.on('open.zf.drilldown hide.zf.drilldown close.zf.drilldown closed.zf.drilldown', this._bindHandler);
|
423 | }
|
424 |
|
425 | this.$element.on('mutateme.zf.trigger', this._resize.bind(this));
|
426 | }
|
427 | |
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | }, {
|
434 | key: "_scrollTop",
|
435 | value: function _scrollTop() {
|
436 | var _this = this;
|
437 |
|
438 | var $scrollTopElement = _this.options.scrollTopElement != '' ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(_this.options.scrollTopElement) : _this.$element,
|
439 | scrollPos = parseInt($scrollTopElement.offset().top + _this.options.scrollTopOffset, 10);
|
440 | jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body').stop(true).animate({
|
441 | scrollTop: scrollPos
|
442 | }, _this.options.animationDuration, _this.options.animationEasing, function () {
|
443 | |
444 |
|
445 |
|
446 |
|
447 | if (this === jquery__WEBPACK_IMPORTED_MODULE_0___default()('html')[0]) _this.$element.trigger('scrollme.zf.drilldown');
|
448 | });
|
449 | }
|
450 | |
451 |
|
452 |
|
453 |
|
454 |
|
455 | }, {
|
456 | key: "_keyboardEvents",
|
457 | value: function _keyboardEvents() {
|
458 | var _this = this;
|
459 |
|
460 | this.$menuItems.add(this.$element.find('.js-drilldown-back > a, .is-submenu-parent-item > a')).on('keydown.zf.drilldown', function (e) {
|
461 | var $element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
|
462 | $elements = $element.parent('li').parent('ul').children('li').children('a'),
|
463 | $prevElement,
|
464 | $nextElement;
|
465 | $elements.each(function (i) {
|
466 | if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is($element)) {
|
467 | $prevElement = $elements.eq(Math.max(0, i - 1));
|
468 | $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1));
|
469 | return;
|
470 | }
|
471 | });
|
472 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].handleKey(e, 'Drilldown', {
|
473 | next: function next() {
|
474 | if ($element.is(_this.$submenuAnchors)) {
|
475 | _this._show($element.parent('li'));
|
476 |
|
477 | $element.parent('li').one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($element), function () {
|
478 | $element.parent('li').find('ul li a').not('.js-drilldown-back a').first().focus();
|
479 | });
|
480 | return true;
|
481 | }
|
482 | },
|
483 | previous: function previous() {
|
484 | _this._hide($element.parent('li').parent('ul'));
|
485 |
|
486 | $element.parent('li').parent('ul').one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($element), function () {
|
487 | setTimeout(function () {
|
488 | $element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
489 | }, 1);
|
490 | });
|
491 | return true;
|
492 | },
|
493 | up: function up() {
|
494 | $prevElement.focus();
|
495 |
|
496 | return !$element.is(_this.$element.find('> li:first-child > a'));
|
497 | },
|
498 | down: function down() {
|
499 | $nextElement.focus();
|
500 |
|
501 | return !$element.is(_this.$element.find('> li:last-child > a'));
|
502 | },
|
503 | close: function close() {
|
504 |
|
505 | if (!$element.is(_this.$element.find('> li > a'))) {
|
506 | _this._hide($element.parent().parent());
|
507 |
|
508 | $element.parent().parent().siblings('a').focus();
|
509 | }
|
510 | },
|
511 | open: function open() {
|
512 | if (_this.options.parentLink && $element.attr('href')) {
|
513 |
|
514 | return false;
|
515 | } else if (!$element.is(_this.$menuItems)) {
|
516 |
|
517 | _this._hide($element.parent('li').parent('ul'));
|
518 |
|
519 | $element.parent('li').parent('ul').one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($element), function () {
|
520 | setTimeout(function () {
|
521 | $element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
522 | }, 1);
|
523 | });
|
524 | return true;
|
525 | } else if ($element.is(_this.$submenuAnchors)) {
|
526 |
|
527 | _this._show($element.parent('li'));
|
528 |
|
529 | $element.parent('li').one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($element), function () {
|
530 | $element.parent('li').find('ul li a').not('.js-drilldown-back a').first().focus();
|
531 | });
|
532 | return true;
|
533 | }
|
534 | },
|
535 | handled: function handled(preventDefault) {
|
536 | if (preventDefault) {
|
537 | e.preventDefault();
|
538 | }
|
539 | }
|
540 | });
|
541 | });
|
542 | }
|
543 | |
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 | }, {
|
551 | key: "_hideAll",
|
552 | value: function _hideAll() {
|
553 | var _this2 = this;
|
554 |
|
555 | var $elem = this.$element.find('.is-drilldown-submenu.is-active');
|
556 | $elem.addClass('is-closing');
|
557 |
|
558 | if (this.options.autoHeight) {
|
559 | var calcHeight = $elem.parent().closest('ul').data('calcHeight');
|
560 | this.$wrapper.css({
|
561 | height: calcHeight
|
562 | });
|
563 | }
|
564 | |
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 | this.$element.trigger('close.zf.drilldown');
|
571 | $elem.one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($elem), function () {
|
572 | $elem.removeClass('is-active is-closing');
|
573 | |
574 |
|
575 |
|
576 |
|
577 |
|
578 | _this2.$element.trigger('closed.zf.drilldown');
|
579 | });
|
580 | }
|
581 | |
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | }, {
|
589 | key: "_back",
|
590 | value: function _back($elem) {
|
591 | var _this = this;
|
592 |
|
593 | $elem.off('click.zf.drilldown');
|
594 | $elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) {
|
595 |
|
596 | _this._hide($elem);
|
597 |
|
598 |
|
599 | var parentSubMenu = $elem.parent('li').parent('ul').parent('li');
|
600 |
|
601 | if (parentSubMenu.length) {
|
602 | _this._show(parentSubMenu);
|
603 | }
|
604 | });
|
605 | }
|
606 | |
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 | }, {
|
613 | key: "_menuLinkEvents",
|
614 | value: function _menuLinkEvents() {
|
615 | var _this = this;
|
616 |
|
617 | this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) {
|
618 | setTimeout(function () {
|
619 | _this._hideAll();
|
620 | }, 0);
|
621 | });
|
622 | }
|
623 | |
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 | }, {
|
632 | key: "_setShowSubMenuClasses",
|
633 | value: function _setShowSubMenuClasses($elem, trigger) {
|
634 | $elem.addClass('is-active').removeClass('invisible').attr('aria-hidden', false);
|
635 | $elem.parent('li').attr('aria-expanded', true);
|
636 |
|
637 | if (trigger === true) {
|
638 | this.$element.trigger('open.zf.drilldown', [$elem]);
|
639 | }
|
640 | }
|
641 | |
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 | }, {
|
650 | key: "_setHideSubMenuClasses",
|
651 | value: function _setHideSubMenuClasses($elem, trigger) {
|
652 | $elem.removeClass('is-active').addClass('invisible').attr('aria-hidden', true);
|
653 | $elem.parent('li').attr('aria-expanded', false);
|
654 |
|
655 | if (trigger === true) {
|
656 | $elem.trigger('hide.zf.drilldown', [$elem]);
|
657 | }
|
658 | }
|
659 | |
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 | }, {
|
669 | key: "_showMenu",
|
670 | value: function _showMenu($elem, autoFocus) {
|
671 | var _this = this;
|
672 |
|
673 |
|
674 | var $expandedSubmenus = this.$element.find('li[aria-expanded="true"] > ul[data-submenu]');
|
675 | $expandedSubmenus.each(function (index) {
|
676 | _this._setHideSubMenuClasses(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this));
|
677 | });
|
678 |
|
679 | this.$currentMenu = $elem;
|
680 |
|
681 | if ($elem.is('[data-drilldown]')) {
|
682 | if (autoFocus === true) $elem.find('li[role="treeitem"] > a').first().focus();
|
683 | if (this.options.autoHeight) this.$wrapper.css('height', $elem.data('calcHeight'));
|
684 | return;
|
685 | }
|
686 |
|
687 |
|
688 | var $submenus = $elem.children().first().parentsUntil('[data-drilldown]', '[data-submenu]');
|
689 |
|
690 | $submenus.each(function (index) {
|
691 |
|
692 | if (index === 0 && _this.options.autoHeight) {
|
693 | _this.$wrapper.css('height', jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('calcHeight'));
|
694 | }
|
695 |
|
696 | var isLastChild = index == $submenus.length - 1;
|
697 |
|
698 |
|
699 | if (isLastChild === true) {
|
700 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)), function () {
|
701 | if (autoFocus === true) {
|
702 | $elem.find('li[role="treeitem"] > a').first().focus();
|
703 | }
|
704 | });
|
705 | }
|
706 |
|
707 | _this._setShowSubMenuClasses(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), isLastChild);
|
708 | });
|
709 | }
|
710 | |
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | }, {
|
718 | key: "_show",
|
719 | value: function _show($elem) {
|
720 | var $submenu = $elem.children('[data-submenu]');
|
721 | $elem.attr('aria-expanded', true);
|
722 | this.$currentMenu = $submenu;
|
723 | $submenu.addClass('is-active').removeClass('invisible').attr('aria-hidden', false);
|
724 |
|
725 | if (this.options.autoHeight) {
|
726 | this.$wrapper.css({
|
727 | height: $submenu.data('calcHeight')
|
728 | });
|
729 | }
|
730 | |
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | this.$element.trigger('open.zf.drilldown', [$elem]);
|
737 | }
|
738 | |
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 | }, {
|
746 | key: "_hide",
|
747 | value: function _hide($elem) {
|
748 | if (this.options.autoHeight) this.$wrapper.css({
|
749 | height: $elem.parent().closest('ul').data('calcHeight')
|
750 | });
|
751 |
|
752 | var _this = this;
|
753 |
|
754 | $elem.parent('li').attr('aria-expanded', false);
|
755 | $elem.attr('aria-hidden', true);
|
756 | $elem.addClass('is-closing').one(Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"])($elem), function () {
|
757 | $elem.removeClass('is-active is-closing');
|
758 | $elem.blur().addClass('invisible');
|
759 | });
|
760 | |
761 |
|
762 |
|
763 |
|
764 |
|
765 | $elem.trigger('hide.zf.drilldown', [$elem]);
|
766 | }
|
767 | |
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 | }, {
|
775 | key: "_getMaxDims",
|
776 | value: function _getMaxDims() {
|
777 | var maxHeight = 0,
|
778 | result = {},
|
779 | _this = this;
|
780 |
|
781 |
|
782 | this.$submenus.add(this.$element).each(function () {
|
783 | var numOfElems = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('li').length;
|
784 | var height = _foundation_util_box__WEBPACK_IMPORTED_MODULE_4__["Box"].GetDimensions(this).height;
|
785 | maxHeight = height > maxHeight ? height : maxHeight;
|
786 |
|
787 | if (_this.options.autoHeight) {
|
788 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('calcHeight', height);
|
789 | }
|
790 | });
|
791 | if (this.options.autoHeight) result['height'] = this.$currentMenu.data('calcHeight');else result['min-height'] = "".concat(maxHeight, "px");
|
792 | result['max-width'] = "".concat(this.$element[0].getBoundingClientRect().width, "px");
|
793 | return result;
|
794 | }
|
795 | |
796 |
|
797 |
|
798 |
|
799 |
|
800 | }, {
|
801 | key: "_destroy",
|
802 | value: function _destroy() {
|
803 | if (this.options.scrollTop) this.$element.off('.zf.drilldown', this._bindHandler);
|
804 |
|
805 | this._hideAll();
|
806 |
|
807 | this.$element.off('mutateme.zf.trigger');
|
808 | _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__["Nest"].Burn(this.$element, 'drilldown');
|
809 | this.$element.unwrap().find('.js-drilldown-back, .is-submenu-parent-item').remove().end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu').end().find('[data-submenu]').removeAttr('aria-hidden tabindex role');
|
810 | this.$submenuAnchors.each(function () {
|
811 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).off('.zf.drilldown');
|
812 | });
|
813 | this.$element.find('[data-is-parent-link]').detach();
|
814 | this.$submenus.removeClass('drilldown-submenu-cover-previous invisible');
|
815 | this.$element.find('a').each(function () {
|
816 | var $link = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
|
817 | $link.removeAttr('tabindex');
|
818 |
|
819 | if ($link.data('savedHref')) {
|
820 | $link.attr('href', $link.data('savedHref')).removeData('savedHref');
|
821 | } else {
|
822 | return;
|
823 | }
|
824 | });
|
825 | }
|
826 | }]);
|
827 |
|
828 | return Drilldown;
|
829 | }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["Plugin"]);
|
830 |
|
831 | Drilldown.defaults = {
|
832 | |
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 | autoApplyClass: true,
|
840 |
|
841 | |
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 | backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>',
|
848 |
|
849 | |
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 | backButtonPosition: 'top',
|
856 |
|
857 | |
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 | wrapper: '<div></div>',
|
864 |
|
865 | |
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 | parentLink: false,
|
872 |
|
873 | |
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 | closeOnClick: false,
|
880 |
|
881 | |
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 | autoHeight: false,
|
888 |
|
889 | |
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 | animateHeight: false,
|
896 |
|
897 | |
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 | scrollTop: false,
|
904 |
|
905 | |
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 | scrollTopElement: '',
|
912 |
|
913 | |
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | scrollTopOffset: 0,
|
920 |
|
921 | |
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 | animationDuration: 500,
|
928 |
|
929 | |
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 | animationEasing: 'swing'
|
937 |
|
938 | };
|
939 |
|
940 |
|
941 | }),
|
942 |
|
943 | 3:
|
944 |
|
945 |
|
946 |
|
947 |
|
948 | (function(module, exports, __webpack_require__) {
|
949 |
|
950 | module.exports = __webpack_require__("./js/entries/plugins/foundation.drilldown.js");
|
951 |
|
952 |
|
953 | }),
|
954 |
|
955 | "jquery":
|
956 |
|
957 |
|
958 |
|
959 |
|
960 | (function(module, exports) {
|
961 |
|
962 | module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
|
963 |
|
964 | })
|
965 |
|
966 | });
|
967 | });
|
968 |
|
\ | No newline at end of file |