mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 12:21:07 +03:30
97 lines
4.3 KiB
JavaScript
Vendored
97 lines
4.3 KiB
JavaScript
Vendored
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); } }
|
|
|
|
import { getSlotType } from '../../../util/helpers';
|
|
/* @vue/component */
|
|
export default {
|
|
methods: {
|
|
genActivator: function genActivator() {
|
|
if (!this.$slots.activator && !this.$scopedSlots.activator) return null;
|
|
var listeners = {};
|
|
if (!this.disabled) {
|
|
if (this.openOnHover) {
|
|
listeners.mouseenter = this.mouseEnterHandler;
|
|
listeners.mouseleave = this.mouseLeaveHandler;
|
|
} else if (this.openOnClick) {
|
|
listeners.click = this.activatorClickHandler;
|
|
}
|
|
}
|
|
if (getSlotType(this, 'activator') === 'scoped') {
|
|
listeners.keydown = this.onKeyDown;
|
|
var activator = this.$scopedSlots.activator({ on: listeners });
|
|
this.activatorNode = activator;
|
|
return activator;
|
|
}
|
|
return this.$createElement('div', {
|
|
staticClass: 'v-menu__activator',
|
|
'class': {
|
|
'v-menu__activator--active': this.hasJustFocused || this.isActive,
|
|
'v-menu__activator--disabled': this.disabled
|
|
},
|
|
ref: 'activator',
|
|
on: listeners
|
|
}, 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() {
|
|
_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,
|
|
'v-menu__content--fixed': this.activatorFixed,
|
|
'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;
|
|
},
|
|
keydown: this.onKeyDown
|
|
}
|
|
};
|
|
!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
|