'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 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; }; // Styles // Components // Mixins // Utilities require('../../../src/stylus/components/_buttons.styl'); var _mixins = require('../../util/mixins'); var _mixins2 = _interopRequireDefault(_mixins); var _VProgressCircular = require('../VProgressCircular'); var _VProgressCircular2 = _interopRequireDefault(_VProgressCircular); var _colorable = require('../../mixins/colorable'); var _colorable2 = _interopRequireDefault(_colorable); var _groupable = require('../../mixins/groupable'); var _positionable = require('../../mixins/positionable'); var _positionable2 = _interopRequireDefault(_positionable); var _routable = require('../../mixins/routable'); var _routable2 = _interopRequireDefault(_routable); var _themeable = require('../../mixins/themeable'); var _themeable2 = _interopRequireDefault(_themeable); var _toggleable = require('../../mixins/toggleable'); var _helpers = require('../../util/helpers'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; } var baseMixins = (0, _mixins2.default)(_colorable2.default, _routable2.default, _positionable2.default, _themeable2.default, (0, _groupable.factory)('btnToggle'), (0, _toggleable.factory)('inputValue') /* @vue/component */ ); exports.default = baseMixins.extend().extend({ name: 'v-btn', props: { activeClass: { type: String, default: 'v-btn--active' }, block: Boolean, depressed: Boolean, fab: Boolean, flat: Boolean, icon: Boolean, large: Boolean, loading: Boolean, outline: Boolean, ripple: { type: [Boolean, Object], default: null }, round: Boolean, small: Boolean, tag: { type: String, default: 'button' }, type: { type: String, default: 'button' }, value: null }, computed: { classes: function classes() { var _extends2; return _extends((_extends2 = { 'v-btn': true }, _defineProperty(_extends2, this.activeClass, this.isActive), _defineProperty(_extends2, 'v-btn--absolute', this.absolute), _defineProperty(_extends2, 'v-btn--block', this.block), _defineProperty(_extends2, 'v-btn--bottom', this.bottom), _defineProperty(_extends2, 'v-btn--disabled', this.disabled), _defineProperty(_extends2, 'v-btn--flat', this.flat), _defineProperty(_extends2, 'v-btn--floating', this.fab), _defineProperty(_extends2, 'v-btn--fixed', this.fixed), _defineProperty(_extends2, 'v-btn--icon', this.icon), _defineProperty(_extends2, 'v-btn--large', this.large), _defineProperty(_extends2, 'v-btn--left', this.left), _defineProperty(_extends2, 'v-btn--loader', this.loading), _defineProperty(_extends2, 'v-btn--outline', this.outline), _defineProperty(_extends2, 'v-btn--depressed', this.depressed && !this.flat || this.outline), _defineProperty(_extends2, 'v-btn--right', this.right), _defineProperty(_extends2, 'v-btn--round', this.round), _defineProperty(_extends2, 'v-btn--router', this.to), _defineProperty(_extends2, 'v-btn--small', this.small), _defineProperty(_extends2, 'v-btn--top', this.top), _extends2), this.themeClasses); }, computedRipple: function computedRipple() { var defaultRipple = this.icon || this.fab ? { circle: true } : true; if (this.disabled) return false;else return this.ripple !== null ? this.ripple : defaultRipple; } }, watch: { '$route': 'onRouteChange' }, methods: { // Prevent focus to match md spec click: function click(e) { !this.fab && e.detail && this.$el.blur(); this.$emit('click', e); this.btnToggle && this.toggle(); }, genContent: function genContent() { return this.$createElement('div', { 'class': 'v-btn__content' }, this.$slots.default); }, genLoader: function genLoader() { return this.$createElement('span', { class: 'v-btn__loading' }, this.$slots.loader || [this.$createElement(_VProgressCircular2.default, { props: { indeterminate: true, size: 23, width: 2 } })]); }, onRouteChange: function onRouteChange() { var _this = this; if (!this.to || !this.$refs.link) return; var path = '_vnode.data.class.' + this.activeClass; this.$nextTick(function () { if ((0, _helpers.getObjectValueByPath)(_this.$refs.link, path)) { _this.toggle(); } }); } }, render: function render(h) { var setColor = !this.outline && !this.flat && !this.disabled ? this.setBackgroundColor : this.setTextColor; var _generateRouteLink = this.generateRouteLink(this.classes), tag = _generateRouteLink.tag, data = _generateRouteLink.data; var children = [this.genContent(), this.loading && this.genLoader()]; if (tag === 'button') data.attrs.type = this.type; data.attrs.value = ['string', 'number'].includes(_typeof(this.value)) ? this.value : JSON.stringify(this.value); if (this.btnToggle) { data.ref = 'link'; } return h(tag, setColor(this.color, data), children); } }); //# sourceMappingURL=VBtn.js.map