This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/es5/components/VBtn/VBtn.js
2019-08-11 20:48:02 +02:00

186 lines
No EOL
7.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("../../../src/components/VBtn/VBtn.sass");
var _VSheet = _interopRequireDefault(require("../VSheet"));
var _VProgressCircular = _interopRequireDefault(require("../VProgressCircular"));
var _groupable = require("../../mixins/groupable");
var _toggleable = require("../../mixins/toggleable");
var _positionable = _interopRequireDefault(require("../../mixins/positionable"));
var _routable = _interopRequireDefault(require("../../mixins/routable"));
var _sizeable = _interopRequireDefault(require("../../mixins/sizeable"));
var _mixins = _interopRequireDefault(require("../../util/mixins"));
var _console = require("../../util/console");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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, _mixins.default)(_VSheet.default, _routable.default, _positionable.default, _sizeable.default, (0, _groupable.factory)('btnToggle'), (0, _toggleable.factory)('inputValue')
/* @vue/component */
);
var _default2 = baseMixins.extend().extend({
name: 'v-btn',
props: {
activeClass: {
type: String,
default: function _default() {
if (!this.btnToggle) return '';
return this.btnToggle.activeClass;
}
},
block: Boolean,
depressed: Boolean,
fab: Boolean,
icon: Boolean,
loading: Boolean,
outlined: Boolean,
rounded: Boolean,
tag: {
type: String,
default: 'button'
},
text: Boolean,
type: {
type: String,
default: 'button'
},
value: null
},
data: function data() {
return {
proxyClass: 'v-btn--active'
};
},
computed: {
classes: function classes() {
return _objectSpread({
'v-btn': true
}, _routable.default.options.computed.classes.call(this), {
'v-btn--absolute': this.absolute,
'v-btn--block': this.block,
'v-btn--bottom': this.bottom,
'v-btn--contained': this.contained,
'v-btn--depressed': this.depressed || this.outlined,
'v-btn--disabled': this.disabled,
'v-btn--fab': this.isRound,
'v-btn--fixed': this.fixed,
'v-btn--flat': this.isFlat,
'v-btn--icon': this.icon,
'v-btn--left': this.left,
'v-btn--loading': this.loading,
'v-btn--outlined': this.outlined,
'v-btn--right': this.right,
'v-btn--round': this.isRound,
'v-btn--rounded': this.rounded,
'v-btn--router': this.to,
'v-btn--text': this.text,
'v-btn--tile': this.tile,
'v-btn--top': this.top
}, this.themeClasses, {}, this.groupClasses, {}, this.elevationClasses, {}, this.sizeableClasses);
},
contained: function contained() {
return Boolean(!this.isFlat && !this.depressed && // Contained class only adds elevation
// is not needed if user provides value
!this.elevation);
},
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;
},
isFlat: function isFlat() {
return Boolean(this.icon || this.text || this.outlined);
},
isRound: function isRound() {
return Boolean(this.icon || this.fab);
},
styles: function styles() {
return _objectSpread({}, this.measurableStyles);
}
},
created: function created() {
var _this = this;
var breakingProps = [['flat', 'text'], ['outline', 'outlined'], ['round', 'rounded']];
/* istanbul ignore next */
breakingProps.forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
original = _ref2[0],
replacement = _ref2[1];
if (_this.$attrs.hasOwnProperty(original)) (0, _console.breaking)(original, replacement, _this);
});
},
methods: {
click: function click(e) {
this.$emit('click', e);
this.btnToggle && this.toggle();
},
genContent: function genContent() {
return this.$createElement('span', {
staticClass: 'v-btn__content'
}, this.$slots.default);
},
genLoader: function genLoader() {
return this.$createElement('span', {
class: 'v-btn__loader'
}, this.$slots.loader || [this.$createElement(_VProgressCircular.default, {
props: {
indeterminate: true,
size: 23,
width: 2
}
})]);
}
},
render: function render(h) {
var children = [this.genContent(), this.loading && this.genLoader()];
var setColor = !this.isFlat ? this.setBackgroundColor : this.setTextColor;
var _this$generateRouteLi = this.generateRouteLink(),
tag = _this$generateRouteLi.tag,
data = _this$generateRouteLi.data;
if (tag === 'button') {
data.attrs.type = this.type;
data.attrs.disabled = this.disabled;
}
data.attrs.value = ['string', 'number'].includes(_typeof(this.value)) ? this.value : JSON.stringify(this.value);
return h(tag, setColor(this.color, data), children);
}
});
exports.default = _default2;
//# sourceMappingURL=VBtn.js.map