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lB;AACD,aAJD;AAKD;AA9NM;AAlIe,CAAX,CAAf","sourcesContent":["import Vue from 'vue'\n\nimport Positionable from './positionable'\n\nimport Stackable from './stackable'\n\n/* eslint-disable object-property-newline */\nconst dimensions = {\n activator: {\n top: 0, left: 0,\n bottom: 0, right: 0,\n width: 0, height: 0,\n offsetTop: 0, scrollHeight: 0\n },\n content: {\n top: 0, left: 0,\n bottom: 0, right: 0,\n width: 0, height: 0,\n offsetTop: 0, scrollHeight: 0\n },\n hasWindow: false\n}\n/* eslint-enable object-property-newline */\n\n/**\n * Menuable\n *\n * @mixin\n *\n * Used for fixed or absolutely positioning\n * elements within the DOM\n * Can calculate X and Y axis overflows\n * As well as be manually positioned\n */\n/* @vue/component */\nexport default Vue.extend({\n name: 'menuable',\n\n mixins: [\n Positionable,\n Stackable\n ],\n\n props: {\n activator: {\n default: null,\n validator: val => {\n return ['string', 'object'].includes(typeof val)\n }\n },\n allowOverflow: Boolean,\n inputActivator: Boolean,\n light: Boolean,\n dark: Boolean,\n maxWidth: {\n type: [Number, String],\n default: 'auto'\n },\n minWidth: [Number, String],\n nudgeBottom: {\n type: [Number, String],\n default: 0\n },\n nudgeLeft: {\n type: [Number, String],\n default: 0\n },\n nudgeRight: {\n type: [Number, String],\n default: 0\n },\n nudgeTop: {\n type: [Number, String],\n default: 0\n },\n nudgeWidth: {\n type: [Number, String],\n default: 0\n },\n offsetOverflow: Boolean,\n positionX: {\n type: Number,\n default: null\n },\n positionY: {\n type: Number,\n default: null\n },\n zIndex: {\n type: [Number, String],\n default: null\n }\n },\n\n data: () => ({\n absoluteX: 0,\n absoluteY: 0,\n activatorFixed: false,\n dimensions: Object.assign({}, dimensions),\n isContentActive: false,\n pageWidth: 0,\n pageYOffset: 0,\n stackClass: 'v-menu__content--active',\n stackMinZIndex: 6\n }),\n\n computed: {\n computedLeft () {\n const a = this.dimensions.activator\n const c = this.dimensions.content\n const activatorLeft = (this.isAttached ? a.offsetLeft : a.left) || 0\n const minWidth = Math.max(a.width, c.width)\n let left = 0\n left += this.left ? activatorLeft - (minWidth - a.width) : activatorLeft\n if (this.offsetX) {\n const maxWidth = isNaN(this.maxWidth)\n ? a.width\n : Math.min(a.width, this.maxWidth)\n\n left += this.left ? -maxWidth : a.width\n }\n if (this.nudgeLeft) left -= parseInt(this.nudgeLeft)\n if (this.nudgeRight) left += parseInt(this.nudgeRight)\n\n return left\n },\n computedTop () {\n const a = this.dimensions.activator\n const c = this.dimensions.content\n let top = 0\n\n if (this.top) top += a.height - c.height\n if (this.isAttached) top += a.offsetTop\n else top += a.top + this.pageYOffset\n if (this.offsetY) top += this.top ? -a.height : a.height\n if (this.nudgeTop) top -= parseInt(this.nudgeTop)\n if (this.nudgeBottom) top += parseInt(this.nudgeBottom)\n\n return top\n },\n hasActivator () {\n return !!this.$slots.activator || !!this.$scopedSlots.activator || this.activator || this.inputActivator\n },\n isAttached () {\n return this.attach !== false\n }\n },\n\n watch: {\n disabled (val) {\n val && this.callDeactivate()\n },\n isActive (val) {\n if (this.disabled) return\n\n val ? this.callActivate() : this.callDeactivate()\n },\n positionX: 'updateDimensions',\n positionY: 'updateDimensions'\n },\n\n beforeMount () {\n this.checkForWindow()\n },\n\n methods: {\n absolutePosition () {\n return {\n offsetTop: 0,\n offsetLeft: 0,\n scrollHeight: 0,\n top: this.positionY || this.absoluteY,\n bottom: this.positionY || this.absoluteY,\n left: this.positionX || this.absoluteX,\n right: this.positionX || this.absoluteX,\n height: 0,\n width: 0\n }\n },\n activate () {},\n calcLeft (menuWidth) {\n return `${this.isAttached\n ? this.computedLeft\n : this.calcXOverflow(this.computedLeft, menuWidth)\n }px`\n },\n calcTop () {\n return `${this.isAttached\n ? this.computedTop\n : this.calcYOverflow(this.computedTop)\n }px`\n },\n calcXOverflow (left, menuWidth) {\n const xOverflow = left + menuWidth - this.pageWidth + 12\n\n if ((!this.left || this.right) && xOverflow > 0) {\n left = Math.max(left - xOverflow, 0)\n } else {\n left = Math.max(left, 12)\n }\n\n return left + this.getOffsetLeft()\n },\n calcYOverflow (top) {\n const documentHeight = this.getInnerHeight()\n const toTop = this.pageYOffset + documentHeight\n const activator = this.dimensions.activator\n const contentHeight = this.dimensions.content.height\n const totalHeight = top + contentHeight\n const isOverflowing = toTop < totalHeight\n\n // If overflowing bottom and offset\n // TODO: set 'bottom' position instead of 'top'\n if (isOverflowing &&\n this.offsetOverflow &&\n // If we don't have enough room to offset\n // the overflow, don't offset\n activator.top > contentHeight\n ) {\n top = this.pageYOffset + (activator.top - contentHeight)\n // If overflowing bottom\n } else if (isOverflowing && !this.allowOverflow) {\n top = toTop - contentHeight - 12\n // If overflowing top\n } else if (top < this.pageYOffset && !this.allowOverflow) {\n top = this.pageYOffset + 12\n }\n\n return top < 12 ? 12 : top\n },\n callActivate () {\n if (!this.hasWindow) return\n\n this.activate()\n },\n callDeactivate () {\n this.isContentActive = false\n\n this.deactivate()\n },\n checkForWindow () {\n if (!this.hasWindow) {\n this.hasWindow = typeof window !== 'undefined'\n }\n },\n checkForPageYOffset () {\n if (this.hasWindow) {\n this.pageYOffset = this.activatorFixed ? 0 : this.getOffsetTop()\n }\n },\n checkActivatorFixed () {\n if (this.attach !== false) return\n let el = this.getActivator()\n while (el) {\n if (window.getComputedStyle(el).position === 'fixed') {\n this.activatorFixed = true\n return\n }\n el = el.offsetParent\n }\n this.activatorFixed = false\n },\n deactivate () {},\n getActivator (e) {\n if (this.inputActivator) {\n return this.$el.querySelector('.v-input__slot')\n }\n\n if (this.activator) {\n return typeof this.activator === 'string'\n ? document.querySelector(this.activator)\n : this.activator\n }\n\n if (this.$refs.activator) {\n return this.$refs.activator.children.length > 0\n ? this.$refs.activator.children[0]\n : this.$refs.activator\n }\n\n if (e) {\n this.activatedBy = e.currentTarget || e.target\n return this.activatedBy\n }\n\n if (this.activatedBy) return this.activatedBy\n\n if (this.activatorNode) {\n const activator = Array.isArray(this.activatorNode) ? this.activatorNode[0] : this.activatorNode\n const el = activator && activator.elm\n if (el) return el\n }\n },\n getInnerHeight () {\n if (!this.hasWindow) return 0\n\n return window.innerHeight ||\n document.documentElement.clientHeight\n },\n getOffsetLeft () {\n if (!this.hasWindow) return 0\n\n return window.pageXOffset ||\n document.documentElement.scrollLeft\n },\n getOffsetTop () {\n if (!this.hasWindow) return 0\n\n return window.pageYOffset ||\n document.documentElement.scrollTop\n },\n getRoundedBoundedClientRect (el) {\n const rect = el.getBoundingClientRect()\n return {\n top: Math.round(rect.top),\n left: Math.round(rect.left),\n bottom: Math.round(rect.bottom),\n right: Math.round(rect.right),\n width: Math.round(rect.width),\n height: Math.round(rect.height)\n }\n },\n measure (el) {\n if (!el || !this.hasWindow) return null\n\n const rect = this.getRoundedBoundedClientRect(el)\n\n // Account for activator margin\n if (this.isAttached) {\n const style = window.getComputedStyle(el)\n\n rect.left = parseInt(style.marginLeft)\n rect.top = parseInt(style.marginTop)\n }\n\n return rect\n },\n sneakPeek (cb) {\n requestAnimationFrame(() => {\n const el = this.$refs.content\n\n if (!el || this.isShown(el)) return cb()\n\n el.style.display = 'inline-block'\n cb()\n el.style.display = 'none'\n })\n },\n startTransition () {\n return new Promise(resolve => requestAnimationFrame(() => {\n this.isContentActive = this.hasJustFocused = this.isActive\n resolve()\n }))\n },\n isShown (el) {\n return el.style.display !== 'none'\n },\n updateDimensions () {\n this.checkForWindow()\n this.checkActivatorFixed()\n this.checkForPageYOffset()\n this.pageWidth = document.documentElement.clientWidth\n\n const dimensions = {}\n\n // Activator should already be shown\n if (!this.hasActivator || this.absolute) {\n dimensions.activator = this.absolutePosition()\n } else {\n const activator = this.getActivator()\n dimensions.activator = this.measure(activator)\n dimensions.activator.offsetLeft = activator.offsetLeft\n if (this.isAttached) {\n // account for css padding causing things to not line up\n // this is mostly for v-autocomplete, hopefully it won't break anything\n dimensions.activator.offsetTop = activator.offsetTop\n } else {\n dimensions.activator.offsetTop = 0\n }\n }\n\n // Display and hide to get dimensions\n this.sneakPeek(() => {\n dimensions.content = this.measure(this.$refs.content)\n\n this.dimensions = dimensions\n })\n }\n }\n})\n"],"sourceRoot":""}
|