// Mixins import Delayable from '../delayable'; import Toggleable from '../toggleable'; // Utilities import mixins from '../../util/mixins'; import { getSlot, getSlotType } from '../../util/helpers'; import { consoleError } from '../../util/console'; const baseMixins = mixins(Delayable, Toggleable); /* @vue/component */ export default baseMixins.extend({ name: 'activatable', props: { activator: { default: null, validator: val => { return ['string', 'object'].includes(typeof val); } }, disabled: Boolean, internalActivator: Boolean, openOnHover: Boolean }, data: () => ({ // Do not use this directly, call getActivator() instead activatorElement: null, activatorNode: [], events: ['click', 'mouseenter', 'mouseleave'], listeners: {} }), watch: { activator: 'resetActivator', openOnHover: 'resetActivator' }, mounted() { const slotType = getSlotType(this, 'activator', true); if (slotType && ['v-slot', 'normal'].includes(slotType)) { consoleError(`The activator slot must be bound, try '