UNPKG

vuetify

Version:

Vue.js 2 Semantic Component Framework

86 lines (81 loc) 3.9 kB
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /* @vue/component */ export default { methods: { genActivator: function genActivator() { if (!this.$slots.activator) return null; var options = { staticClass: 'v-menu__activator', 'class': { 'v-menu__activator--active': this.hasJustFocused || this.isActive, 'v-menu__activator--disabled': this.disabled }, ref: 'activator', on: {} }; if (this.openOnHover) { options.on['mouseenter'] = this.mouseEnterHandler; options.on['mouseleave'] = this.mouseLeaveHandler; } else if (this.openOnClick) { options.on['click'] = this.activatorClickHandler; } return this.$createElement('div', options, this.$slots.activator); }, genTransition: function genTransition() { if (!this.transition) return this.genContent(); return this.$createElement('transition', { props: { name: this.transition } }, [this.genContent()]); }, genDirectives: function genDirectives() { var _this = this; // Do not add click outside for hover menu var directives = !this.openOnHover && this.closeOnClick ? [{ name: 'click-outside', value: function value() { return _this.isActive = false; }, args: { closeConditional: this.closeConditional, include: function include() { return [_this.$el].concat(_toConsumableArray(_this.getOpenDependentElements())); } } }] : []; directives.push({ name: 'show', value: this.isContentActive }); return directives; }, genContent: function genContent() { var _this2 = this; var options = { attrs: this.getScopeIdAttrs(), staticClass: 'v-menu__content', 'class': _extends({}, this.rootThemeClasses, _defineProperty({ 'v-menu__content--auto': this.auto, 'menuable__content__active': this.isActive }, this.contentClass.trim(), true)), style: this.styles, directives: this.genDirectives(), ref: 'content', on: { click: function click(e) { e.stopPropagation(); if (e.target.getAttribute('disabled')) return; if (_this2.closeOnContentClick) _this2.isActive = false; } } }; !this.disabled && this.openOnHover && (options.on.mouseenter = this.mouseEnterHandler); this.openOnHover && (options.on.mouseleave = this.mouseLeaveHandler); return this.$createElement('div', options, this.showLazyContent(this.$slots.default)); } } }; //# sourceMappingURL=menu-generators.js.map