UNPKG

uiv

Version:

Bootstrap 3 components implemented by Vue 2.

1,321 lines (1,230 loc) 37.1 kB
import Vue from 'vue'; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill function assign (target, varArgs) { var arguments$1 = arguments; if (target === null || target === undefined) { throw new TypeError('Cannot convert undefined or null to object') } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments$1[index]; if (nextSource !== null && nextSource !== undefined) { for (var nextKey in nextSource) { // Avoid bugs when hasOwnProperty is shadowed /* istanbul ignore else */ if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to } function isExist (obj) { return typeof obj !== 'undefined' && obj !== null } function isFunction (obj) { return typeof obj === 'function' } function isNumber (obj) { return typeof obj === 'number' } function isString (obj) { return typeof obj === 'string' } function isBoolean (obj) { return typeof obj === 'boolean' } function hasOwnProperty (o, k) { return Object.prototype.hasOwnProperty.call(o, k) } var EVENTS = { MOUSE_ENTER: 'mouseenter', MOUSE_LEAVE: 'mouseleave', MOUSE_DOWN: 'mousedown', MOUSE_UP: 'mouseup', FOCUS: 'focus', BLUR: 'blur', CLICK: 'click', INPUT: 'input', KEY_DOWN: 'keydown', KEY_UP: 'keyup', KEY_PRESS: 'keypress', RESIZE: 'resize', SCROLL: 'scroll', TOUCH_START: 'touchstart', TOUCH_END: 'touchend' }; function on (element, event, handler) { /* istanbul ignore next */ element.addEventListener(event, handler); } function off (element, event, handler) { /* istanbul ignore next */ element.removeEventListener(event, handler); } function isElement (el) { return el && el.nodeType === Node.ELEMENT_NODE } function setDropdownPosition (dropdown, trigger, options) { if ( options === void 0 ) options = {}; var doc = document.documentElement; var containerScrollLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); var containerScrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); var rect = trigger.getBoundingClientRect(); var dropdownRect = dropdown.getBoundingClientRect(); dropdown.style.right = 'auto'; dropdown.style.bottom = 'auto'; if (options.menuRight) { dropdown.style.left = containerScrollLeft + rect.left + rect.width - dropdownRect.width + 'px'; } else { dropdown.style.left = containerScrollLeft + rect.left + 'px'; } if (options.dropup) { dropdown.style.top = containerScrollTop + rect.top - dropdownRect.height - 4 + 'px'; } else { dropdown.style.top = containerScrollTop + rect.top + rect.height + 'px'; } } function focus (el) { if (!isElement(el)) { return } el.getAttribute('tabindex') ? null : el.setAttribute('tabindex', '-1'); el.focus(); } var DEFAULT_TAG = 'div'; var Dropdown = { render: function render (h) { return h( this.tag, { class: { 'btn-group': this.tag === DEFAULT_TAG, dropdown: !this.dropup, dropup: this.dropup, open: this.show } }, [ this.$slots.default, h( 'ul', { class: { 'dropdown-menu': true, 'dropdown-menu-right': this.menuRight }, ref: 'dropdown' }, [this.$slots.dropdown] ) ] ) }, props: { tag: { type: String, default: DEFAULT_TAG }, appendToBody: { type: Boolean, default: false }, value: Boolean, dropup: { type: Boolean, default: false }, menuRight: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, notCloseElements: Array, positionElement: null }, data: function data () { return { show: false, triggerEl: undefined } }, watch: { value: function value (v) { this.toggle(v); } }, mounted: function mounted () { this.initTrigger(); if (this.triggerEl) { on(this.triggerEl, EVENTS.CLICK, this.toggle); on(this.triggerEl, EVENTS.KEY_DOWN, this.onKeyPress); } on(this.$refs.dropdown, EVENTS.KEY_DOWN, this.onKeyPress); on(window, EVENTS.CLICK, this.windowClicked); on(window, EVENTS.TOUCH_END, this.windowClicked); if (this.value) { this.toggle(true); } }, beforeDestroy: function beforeDestroy () { this.removeDropdownFromBody(); if (this.triggerEl) { off(this.triggerEl, EVENTS.CLICK, this.toggle); off(this.triggerEl, EVENTS.KEY_DOWN, this.onKeyPress); } off(this.$refs.dropdown, EVENTS.KEY_DOWN, this.onKeyPress); off(window, EVENTS.CLICK, this.windowClicked); off(window, EVENTS.TOUCH_END, this.windowClicked); }, methods: { getFocusItem: function getFocusItem () { var dropdownEl = this.$refs.dropdown; /* istanbul ignore next */ return dropdownEl.querySelector('li > a:focus') }, onKeyPress: function onKeyPress (event) { if (this.show) { var dropdownEl = this.$refs.dropdown; var keyCode = event.keyCode; if (keyCode === 27) { // esc this.toggle(false); this.triggerEl && this.triggerEl.focus(); } else if (keyCode === 13) { // enter var currentFocus = this.getFocusItem(); currentFocus && currentFocus.click(); } else if (keyCode === 38 || keyCode === 40) { // up || down event.preventDefault(); event.stopPropagation(); var currentFocus$1 = this.getFocusItem(); var items = dropdownEl.querySelectorAll('li:not(.disabled) > a'); if (!currentFocus$1) { focus(items[0]); } else { for (var i = 0; i < items.length; i++) { if (currentFocus$1 === items[i]) { if (keyCode === 38 && i < items.length > 0) { focus(items[i - 1]); } else if (keyCode === 40 && i < items.length - 1) { focus(items[i + 1]); } break } } } } } }, initTrigger: function initTrigger () { var trigger = this.$el.querySelector('[data-role="trigger"]') || this.$el.querySelector('.dropdown-toggle') || this.$el.firstChild; this.triggerEl = trigger && trigger !== this.$refs.dropdown ? trigger : null; }, toggle: function toggle (show) { if (this.disabled) { return } if (isBoolean(show)) { this.show = show; } else { this.show = !this.show; } if (this.appendToBody) { this.show ? this.appendDropdownToBody() : this.removeDropdownFromBody(); } this.$emit('input', this.show); }, windowClicked: function windowClicked (event) { var target = event.target; if (this.show && target) { var targetInNotCloseElements = false; if (this.notCloseElements) { for (var i = 0, l = this.notCloseElements.length; i < l; i++) { var isTargetInElement = this.notCloseElements[i].contains(target); var shouldBreak = isTargetInElement; /* istanbul ignore else */ if (this.appendToBody) { var isTargetInDropdown = this.$refs.dropdown.contains(target); var isElInElements = this.notCloseElements.indexOf(this.$el) >= 0; shouldBreak = isTargetInElement || (isTargetInDropdown && isElInElements); } if (shouldBreak) { targetInNotCloseElements = true; break } } } var targetInDropdownBody = this.$refs.dropdown.contains(target); var targetInTrigger = this.$el.contains(target) && !targetInDropdownBody; // normally, a dropdown select event is handled by @click that trigger after @touchend // then @touchend event have to be ignore in this case var targetInDropdownAndIsTouchEvent = targetInDropdownBody && event.type === 'touchend'; if (!targetInTrigger && !targetInNotCloseElements && !targetInDropdownAndIsTouchEvent) { this.toggle(false); } } }, appendDropdownToBody: function appendDropdownToBody () { try { var el = this.$refs.dropdown; el.style.display = 'block'; document.body.appendChild(el); var positionElement = this.positionElement || this.$el; setDropdownPosition(el, positionElement, this); } catch (e) { // Silent } }, removeDropdownFromBody: function removeDropdownFromBody () { try { var el = this.$refs.dropdown; el.removeAttribute('style'); this.$el.appendChild(el); } catch (e) { // Silent } } } }; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") { return Array.from(iter); } } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } var inBrowser = typeof window !== 'undefined'; function freeze(item) { if (Array.isArray(item) || _typeof(item) === 'object') { return Object.freeze(item); } return item; } function combinePassengers(transports) { var slotProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return transports.reduce(function (passengers, transport) { var temp = transport.passengers[0]; var newPassengers = typeof temp === 'function' ? temp(slotProps) : transport.passengers; return passengers.concat(newPassengers); }, []); } function stableSort(array, compareFn) { return array.map(function (v, idx) { return [idx, v]; }).sort(function (a, b) { return compareFn(a[1], b[1]) || a[0] - b[0]; }).map(function (c) { return c[1]; }); } function pick(obj, keys) { return keys.reduce(function (acc, key) { if (obj.hasOwnProperty(key)) { acc[key] = obj[key]; } return acc; }, {}); } var transports = {}; var targets = {}; var sources = {}; var Wormhole = Vue.extend({ data: function data() { return { transports: transports, targets: targets, sources: sources, trackInstances: inBrowser }; }, methods: { open: function open(transport) { if (!inBrowser) { return; } var to = transport.to, from = transport.from, passengers = transport.passengers, _transport$order = transport.order, order = _transport$order === void 0 ? Infinity : _transport$order; if (!to || !from || !passengers) { return; } var newTransport = { to: to, from: from, passengers: freeze(passengers), order: order }; var keys = Object.keys(this.transports); if (keys.indexOf(to) === -1) { Vue.set(this.transports, to, []); } var currentIndex = this.$_getTransportIndex(newTransport); // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays var newTransports = this.transports[to].slice(0); if (currentIndex === -1) { newTransports.push(newTransport); } else { newTransports[currentIndex] = newTransport; } this.transports[to] = stableSort(newTransports, function (a, b) { return a.order - b.order; }); }, close: function close(transport) { var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var to = transport.to, from = transport.from; if (!to || !from && force === false) { return; } if (!this.transports[to]) { return; } if (force) { this.transports[to] = []; } else { var index = this.$_getTransportIndex(transport); if (index >= 0) { // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays var newTransports = this.transports[to].slice(0); newTransports.splice(index, 1); this.transports[to] = newTransports; } } }, registerTarget: function registerTarget(target, vm, force) { if (!inBrowser) { return; } if (this.trackInstances && !force && this.targets[target]) { console.warn("[portal-vue]: Target ".concat(target, " already exists")); } this.$set(this.targets, target, Object.freeze([vm])); }, unregisterTarget: function unregisterTarget(target) { this.$delete(this.targets, target); }, registerSource: function registerSource(source, vm, force) { if (!inBrowser) { return; } if (this.trackInstances && !force && this.sources[source]) { console.warn("[portal-vue]: source ".concat(source, " already exists")); } this.$set(this.sources, source, Object.freeze([vm])); }, unregisterSource: function unregisterSource(source) { this.$delete(this.sources, source); }, hasTarget: function hasTarget(to) { return !!(this.targets[to] && this.targets[to][0]); }, hasSource: function hasSource(to) { return !!(this.sources[to] && this.sources[to][0]); }, hasContentFor: function hasContentFor(to) { return !!this.transports[to] && !!this.transports[to].length; }, // Internal $_getTransportIndex: function $_getTransportIndex(_ref) { var to = _ref.to, from = _ref.from; for (var i in this.transports[to]) { if (this.transports[to][i].from === from) { return +i; } } return -1; } } }); var wormhole = new Wormhole(transports); var _id = 1; var Portal = Vue.extend({ name: 'portal', props: { disabled: { type: Boolean }, name: { type: String, default: function _default() { return String(_id++); } }, order: { type: Number, default: 0 }, slim: { type: Boolean }, slotProps: { type: Object, default: function _default() { return {}; } }, tag: { type: String, default: 'DIV' }, to: { type: String, default: function _default() { return String(Math.round(Math.random() * 10000000)); } } }, created: function created() { var _this = this; this.$nextTick(function () { wormhole.registerSource(_this.name, _this); }); }, mounted: function mounted() { if (!this.disabled) { this.sendUpdate(); } }, updated: function updated() { if (this.disabled) { this.clear(); } else { this.sendUpdate(); } }, beforeDestroy: function beforeDestroy() { wormhole.unregisterSource(this.name); this.clear(); }, watch: { to: function to(newValue, oldValue) { oldValue && oldValue !== newValue && this.clear(oldValue); this.sendUpdate(); } }, methods: { clear: function clear(target) { var closer = { from: this.name, to: target || this.to }; wormhole.close(closer); }, normalizeSlots: function normalizeSlots() { return this.$scopedSlots.default ? [this.$scopedSlots.default] : this.$slots.default; }, normalizeOwnChildren: function normalizeOwnChildren(children) { return typeof children === 'function' ? children(this.slotProps) : children; }, sendUpdate: function sendUpdate() { var slotContent = this.normalizeSlots(); if (slotContent) { var transport = { from: this.name, to: this.to, passengers: _toConsumableArray(slotContent), order: this.order }; wormhole.open(transport); } else { this.clear(); } } }, render: function render(h) { var children = this.$slots.default || this.$scopedSlots.default || []; var Tag = this.tag; if (children && this.disabled) { return children.length <= 1 && this.slim ? this.normalizeOwnChildren(children)[0] : h(Tag, [this.normalizeOwnChildren(children)]); } else { return this.slim ? h() : h(Tag, { class: { 'v-portal': true }, style: { display: 'none' }, key: 'v-portal-placeholder' }); } } }); var PortalTarget = Vue.extend({ name: 'portalTarget', props: { multiple: { type: Boolean, default: false }, name: { type: String, required: true }, slim: { type: Boolean, default: false }, slotProps: { type: Object, default: function _default() { return {}; } }, tag: { type: String, default: 'div' }, transition: { type: [String, Object, Function] } }, data: function data() { return { transports: wormhole.transports, firstRender: true }; }, created: function created() { var _this = this; this.$nextTick(function () { wormhole.registerTarget(_this.name, _this); }); }, watch: { ownTransports: function ownTransports() { this.$emit('change', this.children().length > 0); }, name: function name(newVal, oldVal) { /** * TODO * This should warn as well ... */ wormhole.unregisterTarget(oldVal); wormhole.registerTarget(newVal, this); } }, mounted: function mounted() { var _this2 = this; if (this.transition) { this.$nextTick(function () { // only when we have a transition, because it causes a re-render _this2.firstRender = false; }); } }, beforeDestroy: function beforeDestroy() { wormhole.unregisterTarget(this.name); }, computed: { ownTransports: function ownTransports() { var transports = this.transports[this.name] || []; if (this.multiple) { return transports; } return transports.length === 0 ? [] : [transports[transports.length - 1]]; }, passengers: function passengers() { return combinePassengers(this.ownTransports, this.slotProps); } }, methods: { // can't be a computed prop because it has to "react" to $slot changes. children: function children() { return this.passengers.length !== 0 ? this.passengers : this.$scopedSlots.default ? this.$scopedSlots.default(this.slotProps) : this.$slots.default || []; }, // can't be a computed prop because it has to "react" to this.children(). noWrapper: function noWrapper() { var noWrapper = this.slim && !this.transition; if (noWrapper && this.children().length > 1) { console.warn('[portal-vue]: PortalTarget with `slim` option received more than one child element.'); } return noWrapper; } }, render: function render(h) { var noWrapper = this.noWrapper(); var children = this.children(); var Tag = this.transition || this.tag; return noWrapper ? children[0] : this.slim && !Tag ? h() : h(Tag, { props: { // if we have a transition component, pass the tag if it exists tag: this.transition && this.tag ? this.tag : undefined }, class: { 'vue-portal-target': true } }, children); } }); var _id$1 = 0; var portalProps = ['disabled', 'name', 'order', 'slim', 'slotProps', 'tag', 'to']; var targetProps = ['multiple', 'transition']; Vue.extend({ name: 'MountingPortal', inheritAttrs: false, props: { append: { type: [Boolean, String] }, bail: { type: Boolean }, mountTo: { type: String, required: true }, // Portal disabled: { type: Boolean }, // name for the portal name: { type: String, default: function _default() { return 'mounted_' + String(_id$1++); } }, order: { type: Number, default: 0 }, slim: { type: Boolean }, slotProps: { type: Object, default: function _default() { return {}; } }, tag: { type: String, default: 'DIV' }, // name for the target to: { type: String, default: function _default() { return String(Math.round(Math.random() * 10000000)); } }, // Target multiple: { type: Boolean, default: false }, targetSlim: { type: Boolean }, targetSlotProps: { type: Object, default: function _default() { return {}; } }, targetTag: { type: String, default: 'div' }, transition: { type: [String, Object, Function] } }, created: function created() { if (typeof document === 'undefined') { return; } var el = document.querySelector(this.mountTo); if (!el) { console.error("[portal-vue]: Mount Point '".concat(this.mountTo, "' not found in document")); return; } var props = this.$props; // Target already exists if (wormhole.targets[props.name]) { if (props.bail) { console.warn("[portal-vue]: Target ".concat(props.name, " is already mounted.\n Aborting because 'bail: true' is set")); } else { this.portalTarget = wormhole.targets[props.name]; } return; } var append = props.append; if (append) { var type = typeof append === 'string' ? append : 'DIV'; var mountEl = document.createElement(type); el.appendChild(mountEl); el = mountEl; } // get props for target from $props // we have to rename a few of them var _props = pick(this.$props, targetProps); _props.slim = this.targetSlim; _props.tag = this.targetTag; _props.slotProps = this.targetSlotProps; _props.name = this.to; this.portalTarget = new PortalTarget({ el: el, parent: this.$parent || this, propsData: _props }); }, beforeDestroy: function beforeDestroy() { var target = this.portalTarget; if (this.append) { var el = target.$el; el.parentNode.removeChild(el); } target.$destroy(); }, render: function render(h) { if (!this.portalTarget) { console.warn("[portal-vue] Target wasn't mounted"); return h(); } // if there's no "manual" scoped slot, so we create a <Portal> ourselves if (!this.$scopedSlots.manual) { var props = pick(this.$props, portalProps); return h(Portal, { props: props, attrs: this.$attrs, on: this.$listeners, scopedSlots: this.$scopedSlots }, this.$slots.default); } // else, we render the scoped slot var content = this.$scopedSlots.manual({ to: this.to }); // if user used <template> for the scoped slot // content will be an array if (Array.isArray(content)) { content = content[0]; } if (!content) { return h(); } return content; } }); var BEFORE_CHANGE_EVENT = 'before-change'; var script = { components: { Dropdown: Dropdown, PortalTarget: PortalTarget }, props: { value: { type: Number, validator: function (v) { return v >= 0; } }, transition: { type: Number, default: 150 }, justified: Boolean, pills: Boolean, stacked: Boolean, customNavClass: null, customContentClass: null }, data: function data () { return { tabs: [], activeIndex: 0 // Make v-model not required } }, watch: { value: { immediate: true, handler: function handler (value) { if (isNumber(value)) { this.activeIndex = value; this.selectCurrent(); } } }, tabs: function tabs (tabs$1) { var this$1 = this; tabs$1.forEach(function (tab, index) { tab.transition = this$1.transition; if (index === this$1.activeIndex) { tab.show(); } }); this.selectCurrent(); } }, computed: { navClasses: function navClasses () { var obj; var tabClasses = { nav: true, 'nav-justified': this.justified, 'nav-tabs': !this.pills, 'nav-pills': this.pills, 'nav-stacked': this.stacked && this.pills }; var customNavClass = this.customNavClass; if (isExist(customNavClass)) { if (isString(customNavClass)) { return assign({}, tabClasses, ( obj = {}, obj[customNavClass] = true, obj )) } else { return assign({}, tabClasses, customNavClass) } } else { return tabClasses } }, contentClasses: function contentClasses () { var obj; var contentClasses = { 'tab-content': true }; var customContentClass = this.customContentClass; if (isExist(customContentClass)) { if (isString(customContentClass)) { return assign({}, contentClasses, ( obj = {}, obj[customContentClass] = true, obj )) } else { return assign({}, contentClasses, customContentClass) } } else { return contentClasses } }, groupedTabs: function groupedTabs () { var tabs = []; var hash = {}; this.tabs.forEach(function (tab) { if (tab.group) { if (hasOwnProperty(hash, tab.group)) { tabs[hash[tab.group]].tabs.push(tab); } else { tabs.push({ tabs: [tab], group: tab.group }); hash[tab.group] = tabs.length - 1; } if (tab.active) { tabs[hash[tab.group]].active = true; } if (tab.pullRight) { tabs[hash[tab.group]].pullRight = true; } } else { tabs.push(tab); } }); tabs = tabs.map(function (tab) { if (Array.isArray(tab.tabs)) { tab.hidden = tab.tabs.filter(function (v) { return v.hidden; }).length === tab.tabs.length; } return tab }); return tabs } }, methods: { getTabClasses: function getTabClasses (tab, isSubTab) { if ( isSubTab === void 0 ) isSubTab = false; var defaultClasses = { active: tab.active, disabled: tab.disabled, 'pull-right': tab.pullRight && !isSubTab }; // return with new classes added to tab return assign(defaultClasses, tab.tabClasses) }, selectCurrent: function selectCurrent () { var this$1 = this; var found = false; this.tabs.forEach(function (tab, index) { if (index === this$1.activeIndex) { found = !tab.active; tab.active = true; } else { tab.active = false; } }); if (found) { this.$emit('change', this.activeIndex); } }, selectValidate: function selectValidate (index) { var this$1 = this; if (isFunction(this.$listeners[BEFORE_CHANGE_EVENT])) { this.$emit(BEFORE_CHANGE_EVENT, this.activeIndex, index, function (result) { if (!isExist(result)) { this$1.$select(index); } }); } else { this.$select(index); } }, select: function select (index) { if (!this.tabs[index].disabled && index !== this.activeIndex) { this.selectValidate(index); } }, $select: function $select (index) { if (isNumber(this.value)) { this.$emit('input', index); } else { this.activeIndex = index; this.selectCurrent(); } } } }; function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { if (typeof shadowMode !== 'boolean') { createInjectorSSR = createInjector; createInjector = shadowMode; shadowMode = false; } // Vue.extend constructor export interop. var options = typeof script === 'function' ? script.options : script; // render functions if (template && template.render) { options.render = template.render; options.staticRenderFns = template.staticRenderFns; options._compiled = true; // functional template if (isFunctionalTemplate) { options.functional = true; } } // scopedId if (scopeId) { options._scopeId = scopeId; } var hook; if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__; } // inject component styles if (style) { style.call(this, createInjectorSSR(context)); } // register component module identifier for async chunk inference if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier); } }; // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook; } else if (style) { hook = shadowMode ? function (context) { style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot)); } : function (context) { style.call(this, createInjector(context)); }; } if (hook) { if (options.functional) { // register for functional component in vue file var originalRender = options.render; options.render = function renderWithStyleInjection(h, context) { hook.call(context); return originalRender(h, context); }; } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate; options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; } } return script; } /* script */ var __vue_script__ = script; /* template */ var __vue_render__ = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c("section", [ _c( "ul", { class: _vm.navClasses, attrs: { role: "tablist" } }, [ _vm._l(_vm.groupedTabs, function(tab, index) { return [ tab.tabs ? _c( "dropdown", { directives: [ { name: "show", rawName: "v-show", value: !tab.hidden, expression: "!tab.hidden" } ], class: _vm.getTabClasses(tab), attrs: { role: "presentation", tag: "li" } }, [ _c( "a", { staticClass: "dropdown-toggle", attrs: { role: "tab", href: "#" }, on: { click: function($event) { $event.preventDefault(); } } }, [ _vm._v(_vm._s(tab.group) + " "), _c("span", { staticClass: "caret" }) ] ), _vm._v(" "), _c( "template", { slot: "dropdown" }, _vm._l(tab.tabs, function(subTab) { return _c( "li", { directives: [ { name: "show", rawName: "v-show", value: !subTab.hidden, expression: "!subTab.hidden" } ], class: _vm.getTabClasses(subTab, true) }, [ _c( "a", { attrs: { href: "#" }, on: { click: function($event) { $event.preventDefault(); _vm.select(_vm.tabs.indexOf(subTab)); } } }, [_vm._v(_vm._s(subTab.title))] ) ] ) }), 0 ) ], 2 ) : _c( "li", { directives: [ { name: "show", rawName: "v-show", value: !tab.hidden, expression: "!tab.hidden" } ], class: _vm.getTabClasses(tab), attrs: { role: "presentation" } }, [ tab.$slots.title ? _c("portal-target", { attrs: { name: tab._uid.toString(), tag: "a", role: "tab", href: "#" }, nativeOn: { click: function($event) { $event.preventDefault(); _vm.select(_vm.tabs.indexOf(tab)); } } }) : _c("a", { attrs: { role: "tab", href: "#" }, domProps: { textContent: _vm._s(tab.title) }, on: { click: function($event) { $event.preventDefault(); _vm.select(_vm.tabs.indexOf(tab)); } } }) ], 1 ) ] }), _vm._v(" "), !_vm.justified && _vm.$slots["nav-right"] ? _c("li", { staticClass: "pull-right" }, [_vm._t("nav-right")], 2) : _vm._e() ], 2 ), _vm._v(" "), _c("div", { class: _vm.contentClasses }, [_vm._t("default")], 2) ]) }; var __vue_staticRenderFns__ = []; __vue_render__._withStripped = true; /* style */ var __vue_inject_styles__ = undefined; /* scoped */ var __vue_scope_id__ = undefined; /* module identifier */ var __vue_module_identifier__ = undefined; /* functional template */ var __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ /* style inject shadow dom */ var __vue_component__ = /*#__PURE__*/normalizeComponent( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined ); export default __vue_component__; //# sourceMappingURL=Tabs.js.map