vuetify eingebunden + erster Versuch Combobox

This commit is contained in:
2019-04-17 15:58:15 +02:00
parent 24642ca1a8
commit 56f4a3f940
1846 changed files with 219701 additions and 53848 deletions
+139
View File
@@ -0,0 +1,139 @@
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; };
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
// Styles
import '../../../src/stylus/components/_radios.styl';
// Components
import VIcon from '../VIcon';
import VLabel from '../VLabel';
// Mixins
import Colorable from '../../mixins/colorable';
import Rippleable from '../../mixins/rippleable';
import Themeable from '../../mixins/themeable';
import Selectable from '../../mixins/selectable';
import { inject as RegistrableInject } from '../../mixins/registrable';
/* @vue/component */
export default {
name: 'v-radio',
mixins: [Colorable, Rippleable, RegistrableInject('radio', 'v-radio', 'v-radio-group'), Themeable],
inheritAttrs: false,
props: {
color: {
type: String,
default: 'accent'
},
disabled: Boolean,
label: String,
onIcon: {
type: String,
default: '$vuetify.icons.radioOn'
},
offIcon: {
type: String,
default: '$vuetify.icons.radioOff'
},
readonly: Boolean,
value: null
},
data: function data() {
return {
isActive: false,
isFocused: false,
parentError: false
};
},
computed: {
computedData: function computedData() {
return this.setTextColor(!this.parentError && this.isActive && this.color, {
staticClass: 'v-radio',
'class': _extends({
'v-radio--is-disabled': this.isDisabled,
'v-radio--is-focused': this.isFocused
}, this.themeClasses)
});
},
computedColor: function computedColor() {
return this.isActive ? this.color : this.radio.validationState || false;
},
computedIcon: function computedIcon() {
return this.isActive ? this.onIcon : this.offIcon;
},
hasState: function hasState() {
return this.isActive || !!this.radio.validationState;
},
isDisabled: function isDisabled() {
return this.disabled || !!this.radio.disabled;
},
isReadonly: function isReadonly() {
return this.readonly || !!this.radio.readonly;
}
},
mounted: function mounted() {
this.radio.register(this);
},
beforeDestroy: function beforeDestroy() {
this.radio.unregister(this);
},
methods: {
genInput: function genInput() {
var _Selectable$options$m;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// 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$options$m = Selectable.options.methods.genInput).call.apply(_Selectable$options$m, [this].concat(_toConsumableArray(args)));
},
genLabel: function genLabel() {
return this.$createElement(VLabel, {
on: { click: this.onChange },
attrs: {
for: this.id
},
props: {
color: this.radio.validationState || '',
dark: this.dark,
focused: this.hasState,
light: this.light
}
}, this.$slots.label || this.label);
},
genRadio: function genRadio() {
return this.$createElement('div', {
staticClass: 'v-input--selection-controls__input'
}, [this.genInput('radio', _extends({
name: this.radio.name || (this.radio._uid ? 'v-radio-' + this.radio._uid : false),
value: this.value
}, this.$attrs)), this.genRipple(this.setTextColor(this.computedColor)), this.$createElement(VIcon, this.setTextColor(this.computedColor, {
props: {
dark: this.dark,
light: this.light
}
}), 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) return;
if (!this.isDisabled && (!this.isActive || !this.radio.mandatory)) {
this.$emit('change', this.value);
}
},
onKeydown: function onKeydown() {}
},
render: function render(h) {
return h('div', this.computedData, [this.genRadio(), this.genLabel()]);
}
};
//# sourceMappingURL=VRadio.js.map
File diff suppressed because one or more lines are too long
+119
View File
@@ -0,0 +1,119 @@
// Styles
import '../../../src/stylus/components/_selection-controls.styl';
import '../../../src/stylus/components/_radio-group.styl';
// Components
import VInput from '../VInput';
// Mixins
import Comparable from '../../mixins/comparable';
import { provide as RegistrableProvide } from '../../mixins/registrable';
/* @vue/component */
export default VInput.extend({
name: 'v-radio-group',
mixins: [Comparable, RegistrableProvide('radio')],
model: {
prop: 'value',
event: 'change'
},
provide: function provide() {
return {
radio: this
};
},
props: {
column: {
type: Boolean,
default: true
},
height: {
type: [Number, String],
default: 'auto'
},
mandatory: {
type: Boolean,
default: true
},
name: String,
row: Boolean,
// If no value set on VRadio
// will match valueComparator
// force default to null
value: {
default: null
}
},
data: function data() {
return {
internalTabIndex: -1,
radios: []
};
},
computed: {
classes: function classes() {
return {
'v-input--selection-controls v-input--radio-group': true,
'v-input--radio-group--column': this.column && !this.row,
'v-input--radio-group--row': this.row
};
}
},
watch: {
hasError: 'setErrorState',
internalValue: 'setActiveRadio'
},
mounted: function mounted() {
this.setErrorState(this.hasError);
this.setActiveRadio();
},
methods: {
genDefaultSlot: function genDefaultSlot() {
return this.$createElement('div', {
staticClass: 'v-input--radio-group__input',
attrs: {
role: 'radiogroup'
}
}, VInput.options.methods.genDefaultSlot.call(this));
},
onRadioChange: function onRadioChange(value) {
if (this.disabled) return;
this.hasInput = true;
this.internalValue = value;
this.setActiveRadio();
this.$nextTick(this.validate);
},
onRadioBlur: function onRadioBlur(e) {
if (!e.relatedTarget || !e.relatedTarget.classList.contains('v-radio')) {
this.hasInput = true;
this.$emit('blur', e);
}
},
register: function register(radio) {
radio.isActive = this.valueComparator(this.internalValue, radio.value);
radio.$on('change', this.onRadioChange);
radio.$on('blur', this.onRadioBlur);
this.radios.push(radio);
},
setErrorState: function setErrorState(val) {
for (var index = this.radios.length; --index >= 0;) {
this.radios[index].parentError = val;
}
},
setActiveRadio: function setActiveRadio() {
for (var index = this.radios.length; --index >= 0;) {
var radio = this.radios[index];
radio.isActive = this.valueComparator(this.internalValue, radio.value);
}
},
unregister: function unregister(radio) {
radio.$off('change', this.onRadioChange);
radio.$off('blur', this.onRadioBlur);
var index = this.radios.findIndex(function (r) {
return r === radio;
});
/* istanbul ignore else */
if (index > -1) this.radios.splice(index, 1);
}
}
});
//# sourceMappingURL=VRadioGroup.js.map
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
import VRadioGroup from './VRadioGroup';
import VRadio from './VRadio';
export { VRadioGroup, VRadio };
export default {
$_vuetify_subcomponents: {
VRadioGroup: VRadioGroup,
VRadio: VRadio
}
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VRadioGroup/index.js"],"names":[],"mappings":"AAAA,OAAO,WAAP,MAAwB,eAAxB;AACA,OAAO,MAAP,MAAmB,UAAnB;AAEA,SAAS,WAAT,EAAsB,MAAtB;AAEA,eAAe;AACb,6BAAyB;AACvB,gCADuB;AAEvB;AAFuB;AADZ,CAAf","sourcesContent":["import VRadioGroup from './VRadioGroup'\nimport VRadio from './VRadio'\n\nexport { VRadioGroup, VRadio }\n\nexport default {\n $_vuetify_subcomponents: {\n VRadioGroup,\n VRadio\n }\n}\n"],"sourceRoot":""}