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CAAP;AACD;AAnIgD,CAApC,C","sourcesContent":["// Styles\nimport '../../stylus/components/_buttons.styl'\n\n// Types\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\nimport mixins, { ExtractVue } from '../../util/mixins'\nimport { RippleOptions } from '../../directives/ripple'\n\n// Components\nimport VProgressCircular from '../VProgressCircular'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport { factory as GroupableFactory } from '../../mixins/groupable'\nimport Positionable from '../../mixins/positionable'\nimport Routable from '../../mixins/routable'\nimport Themeable from '../../mixins/themeable'\nimport { factory as ToggleableFactory } from '../../mixins/toggleable'\n\n// Utilities\nimport { getObjectValueByPath } from '../../util/helpers'\n\nconst baseMixins = mixins(\n Colorable,\n Routable,\n Positionable,\n Themeable,\n GroupableFactory('btnToggle'),\n ToggleableFactory('inputValue')\n /* @vue/component */\n)\ninterface options extends ExtractVue<typeof baseMixins> {\n $el: HTMLElement\n}\n\nexport default baseMixins.extend<options>().extend({\n name: 'v-btn',\n\n props: {\n activeClass: {\n type: String,\n default: 'v-btn--active'\n },\n block: Boolean,\n depressed: Boolean,\n fab: Boolean,\n flat: Boolean,\n icon: Boolean,\n large: Boolean,\n loading: Boolean,\n outline: Boolean,\n ripple: {\n type: [Boolean, Object],\n default: null\n },\n round: Boolean,\n small: Boolean,\n tag: {\n type: String,\n default: 'button'\n },\n type: {\n type: String,\n default: 'button'\n },\n value: null as any as PropValidator<any>\n },\n\n computed: {\n classes (): any {\n return {\n 'v-btn': true,\n [this.activeClass]: this.isActive,\n 'v-btn--absolute': this.absolute,\n 'v-btn--block': this.block,\n 'v-btn--bottom': this.bottom,\n 'v-btn--disabled': this.disabled,\n 'v-btn--flat': this.flat,\n 'v-btn--floating': this.fab,\n 'v-btn--fixed': this.fixed,\n 'v-btn--icon': this.icon,\n 'v-btn--large': this.large,\n 'v-btn--left': this.left,\n 'v-btn--loader': this.loading,\n 'v-btn--outline': this.outline,\n 'v-btn--depressed': (this.depressed && !this.flat) || this.outline,\n 'v-btn--right': this.right,\n 'v-btn--round': this.round,\n 'v-btn--router': this.to,\n 'v-btn--small': this.small,\n 'v-btn--top': this.top,\n ...this.themeClasses\n }\n },\n computedRipple (): RippleOptions | boolean {\n const defaultRipple = this.icon || this.fab ? { circle: true } : true\n if (this.disabled) return false\n else return this.ripple !== null ? this.ripple : defaultRipple\n }\n },\n\n watch: {\n '$route': 'onRouteChange'\n },\n\n methods: {\n // Prevent focus to match md spec\n click (e: MouseEvent): void {\n !this.fab &&\n e.detail &&\n this.$el.blur()\n\n this.$emit('click', e)\n\n this.btnToggle && this.toggle()\n },\n genContent (): VNode {\n return this.$createElement(\n 'div',\n { 'class': 'v-btn__content' },\n this.$slots.default\n )\n },\n genLoader (): VNode {\n return this.$createElement('span', {\n class: 'v-btn__loading'\n }, this.$slots.loader || [this.$createElement(VProgressCircular, {\n props: {\n indeterminate: true,\n size: 23,\n width: 2\n }\n })])\n },\n onRouteChange () {\n if (!this.to || !this.$refs.link) return\n\n const path = `_vnode.data.class.${this.activeClass}`\n\n this.$nextTick(() => {\n if (getObjectValueByPath(this.$refs.link, path)) {\n this.toggle()\n }\n })\n }\n },\n\n render (h): VNode {\n const setColor = (!this.outline && !this.flat && !this.disabled) ? this.setBackgroundColor : this.setTextColor\n const { tag, data } = this.generateRouteLink(this.classes)\n const children = [\n this.genContent(),\n this.loading && this.genLoader()\n ]\n\n if (tag === 'button') data.attrs!.type = this.type\n\n data.attrs!.value = ['string', 'number'].includes(typeof this.value)\n ? this.value\n : JSON.stringify(this.value)\n\n if (this.btnToggle) {\n data.ref = 'link'\n }\n\n return h(tag, setColor(this.color, data), children)\n }\n})\n"],"sourceRoot":""}
|