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/VRadioGroup/VRadio.js

167 lines
5.8 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("../../../src/components/VRadioGroup/VRadio.sass");
var _VLabel = _interopRequireDefault(require("../VLabel"));
var _VIcon = _interopRequireDefault(require("../VIcon"));
var _VInput = _interopRequireDefault(require("../VInput"));
var _colorable = _interopRequireDefault(require("../../mixins/colorable"));
var _groupable = require("../../mixins/groupable");
var _rippleable = _interopRequireDefault(require("../../mixins/rippleable"));
var _themeable = _interopRequireDefault(require("../../mixins/themeable"));
var _selectable = _interopRequireDefault(require("../../mixins/selectable"));
var _helpers = require("../../util/helpers");
var _mixins = _interopRequireDefault(require("../../util/mixins"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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)(_colorable.default, _rippleable.default, (0, _groupable.factory)('radioGroup'), _themeable.default);
/* @vue/component */
var _default = baseMixins.extend().extend({
name: 'v-radio',
inheritAttrs: false,
props: {
disabled: Boolean,
label: String,
name: String,
id: String,
onIcon: {
type: String,
default: '$vuetify.icons.radioOn'
},
offIcon: {
type: String,
default: '$vuetify.icons.radioOff'
},
readonly: Boolean,
value: {
default: null
}
},
data: function data() {
return {
isFocused: false
};
},
computed: {
classes: function classes() {
return _objectSpread({
'v-radio--is-disabled': this.isDisabled,
'v-radio--is-focused': this.isFocused
}, this.themeClasses, {}, this.groupClasses);
},
computedColor: function computedColor() {
return _selectable.default.options.computed.computedColor.call(this);
},
computedIcon: function computedIcon() {
return this.isActive ? this.onIcon : this.offIcon;
},
computedId: function computedId() {
return _VInput.default.options.computed.computedId.call(this);
},
hasLabel: _VInput.default.options.computed.hasLabel,
hasState: function hasState() {
return (this.radioGroup || {}).hasState;
},
isDisabled: function isDisabled() {
return this.disabled || !!(this.radioGroup || {}).disabled;
},
isReadonly: function isReadonly() {
return this.readonly || !!(this.radioGroup || {}).readonly;
},
computedName: function computedName() {
if (this.name || !this.radioGroup) {
return this.name;
}
return this.radioGroup.name || "radio-".concat(this.radioGroup._uid);
},
validationState: function validationState() {
return (this.radioGroup || {}).validationState || this.computedColor;
}
},
methods: {
genInput: function genInput(args) {
// We can't actually use the mixin directly because
// it's made for standalone components, but its
// genInput method is exactly what we need
return _selectable.default.options.methods.genInput.call(this, 'radio', args);
},
genLabel: function genLabel() {
var _this = this;
if (!this.hasLabel) return null;
return this.$createElement(_VLabel.default, {
on: {
click: function click(e) {
// Prevent label from
// causing the input
// to focus
e.preventDefault();
_this.onChange();
}
},
attrs: {
for: this.computedId
},
props: {
color: this.validationState,
focused: this.hasState
}
}, (0, _helpers.getSlot)(this, 'label') || this.label);
},
genRadio: function genRadio() {
return this.$createElement('div', {
staticClass: 'v-input--selection-controls__input'
}, [this.genInput(_objectSpread({
name: this.computedName,
value: this.value
}, this.$attrs)), this.genRipple(this.setTextColor(this.validationState)), this.$createElement(_VIcon.default, this.setTextColor(this.validationState, {}), this.computedIcon)]);
},
onFocus: function onFocus(e) {
this.isFocused = true;
this.$emit('focus', e);
},
onBlur: function onBlur(e) {
this.isFocused = false;
this.$emit('blur', e);
},
onChange: function onChange() {
if (this.isDisabled || this.isReadonly || this.isActive) return;
this.toggle();
},
onKeydown: function onKeydown() {}
},
render: function render(h) {
var data = {
staticClass: 'v-radio',
class: this.classes
};
return h('div', data, [this.genRadio(), this.genLabel()]);
}
});
exports.default = _default;
//# sourceMappingURL=VRadio.js.map