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AAK,cAAL,CAAoB,aAApB,EAAmC;AACjC,mBAAO;AACL,sBAAM,IADD;AAEL,uBAAO,KAAK,KAFP;AAGL,sBAAM,KAAK;AAHN;AAD0B,SAAnC,EAMG,CAAC,KAAK,aAAL,EAAD,CANH,CAFoB,CAAf,CAAP;AAUD;AA1NuB,CAAX,CAAf","sourcesContent":["import '../../stylus/components/_menus.styl'\n\nimport Vue from 'vue'\n\n// Mixins\nimport Delayable from '../../mixins/delayable'\nimport Dependent from '../../mixins/dependent'\nimport Detachable from '../../mixins/detachable'\nimport Menuable from '../../mixins/menuable.js'\nimport Returnable from '../../mixins/returnable'\nimport Toggleable from '../../mixins/toggleable'\nimport Themeable from '../../mixins/themeable'\n\n// Component level mixins\nimport Activator from './mixins/menu-activator'\nimport Generators from './mixins/menu-generators'\nimport Keyable from './mixins/menu-keyable'\nimport Position from './mixins/menu-position'\n\n// Directives\nimport ClickOutside from '../../directives/click-outside'\nimport Resize from '../../directives/resize'\n\n// Helpers\nimport { convertToUnit, getSlotType } from '../../util/helpers'\nimport ThemeProvider from '../../util/ThemeProvider'\nimport { consoleError } from '../../util/console'\n\n/* @vue/component */\nexport default Vue.extend({\n name: 'v-menu',\n\n provide () {\n return {\n // Pass theme through to default slot\n theme: this.theme\n }\n },\n\n directives: {\n ClickOutside,\n Resize\n },\n\n mixins: [\n Activator,\n Dependent,\n Delayable,\n Detachable,\n Generators,\n Keyable,\n Menuable,\n Position,\n Returnable,\n Toggleable,\n Themeable\n ],\n\n props: {\n auto: Boolean,\n closeOnClick: {\n type: Boolean,\n default: true\n },\n closeOnContentClick: {\n type: Boolean,\n default: true\n },\n disabled: Boolean,\n fullWidth: Boolean,\n maxHeight: { default: 'auto' },\n openOnClick: {\n type: Boolean,\n default: true\n },\n offsetX: Boolean,\n offsetY: Boolean,\n openOnHover: Boolean,\n origin: {\n type: String,\n default: 'top left'\n },\n transition: {\n type: [Boolean, String],\n default: 'v-menu-transition'\n }\n },\n\n data () {\n return {\n defaultOffset: 8,\n hasJustFocused: false,\n resizeTimeout: null\n }\n },\n\n computed: {\n calculatedLeft () {\n const menuWidth = Math.max(this.dimensions.content.width, parseFloat(this.calculatedMinWidth))\n\n if (!this.auto) return this.calcLeft(menuWidth)\n\n return `${this.calcXOverflow(this.calcLeftAuto(), menuWidth)}px`\n },\n calculatedMaxHeight () {\n return this.auto ? '200px' : convertToUnit(this.maxHeight)\n },\n calculatedMaxWidth () {\n return isNaN(this.maxWidth)\n ? this.maxWidth\n : `${this.maxWidth}px`\n },\n calculatedMinWidth () {\n if (this.minWidth) {\n return isNaN(this.minWidth)\n ? this.minWidth\n : `${this.minWidth}px`\n }\n\n const minWidth = Math.min(\n this.dimensions.activator.width +\n this.nudgeWidth +\n (this.auto ? 16 : 0),\n Math.max(this.pageWidth - 24, 0)\n )\n\n const calculatedMaxWidth = isNaN(parseInt(this.calculatedMaxWidth))\n ? minWidth\n : parseInt(this.calculatedMaxWidth)\n\n return `${Math.min(\n calculatedMaxWidth,\n minWidth\n )}px`\n },\n calculatedTop () {\n if (!this.auto || this.isAttached) return this.calcTop()\n\n return `${this.calcYOverflow(this.calculatedTopAuto)}px`\n },\n styles () {\n return {\n maxHeight: this.calculatedMaxHeight,\n minWidth: this.calculatedMinWidth,\n maxWidth: this.calculatedMaxWidth,\n top: this.calculatedTop,\n left: this.calculatedLeft,\n transformOrigin: this.origin,\n zIndex: this.zIndex || this.activeZIndex\n }\n }\n },\n\n watch: {\n activator (newActivator, oldActivator) {\n this.removeActivatorEvents(oldActivator)\n this.addActivatorEvents(newActivator)\n },\n disabled (disabled) {\n if (!this.activator) return\n\n if (disabled) {\n this.removeActivatorEvents(this.activator)\n } else {\n this.addActivatorEvents(this.activator)\n }\n },\n isContentActive (val) {\n this.hasJustFocused = val\n }\n },\n\n mounted () {\n this.isActive && this.activate()\n\n if (getSlotType(this, 'activator', true) === 'v-slot') {\n consoleError(`v-tooltip's activator slot must be bound, try '<template #activator=\"data\"><v-btn v-on=\"data.on>'`, this)\n }\n },\n\n methods: {\n activate () {\n // This exists primarily for v-select\n // helps determine which tiles to activate\n this.getTiles()\n // Update coordinates and dimensions of menu\n // and its activator\n this.updateDimensions()\n // Start the transition\n requestAnimationFrame(() => {\n // Once transitioning, calculate scroll and top position\n this.startTransition().then(() => {\n if (this.$refs.content) {\n this.calculatedTopAuto = this.calcTopAuto()\n this.auto && (this.$refs.content.scrollTop = this.calcScrollPosition())\n }\n })\n })\n },\n closeConditional (e) {\n return this.isActive &&\n this.closeOnClick &&\n !this.$refs.content.contains(e.target)\n },\n onResize () {\n if (!this.isActive) return\n\n // Account for screen resize\n // and orientation change\n // eslint-disable-next-line no-unused-expressions\n this.$refs.content.offsetWidth\n this.updateDimensions()\n\n // When resizing to a smaller width\n // content width is evaluated before\n // the new activator width has been\n // set, causing it to not size properly\n // hacky but will revisit in the future\n clearTimeout(this.resizeTimeout)\n this.resizeTimeout = setTimeout(this.updateDimensions, 100)\n }\n },\n\n render (h) {\n const data = {\n staticClass: 'v-menu',\n class: { 'v-menu--inline': !this.fullWidth && this.$slots.activator },\n directives: [{\n arg: 500,\n name: 'resize',\n value: this.onResize\n }],\n on: this.disableKeys ? undefined : {\n keydown: this.onKeyDown\n }\n }\n\n return h('div', data, [\n this.genActivator(),\n this.$createElement(ThemeProvider, {\n props: {\n root: true,\n light: this.light,\n dark: this.dark\n }\n }, [this.genTransition()])\n ])\n }\n})\n"],"sourceRoot":""}
|