vuetify eingebunden + erster Versuch Combobox
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
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
|
||||
import '../../../src/stylus/components/_steppers.styl';
|
||||
// Mixins
|
||||
import { provide as RegistrableProvide } from '../../mixins/registrable';
|
||||
import Themeable from '../../mixins/themeable';
|
||||
// Util
|
||||
import mixins from '../../util/mixins';
|
||||
export default mixins(RegistrableProvide('stepper'), Themeable
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-stepper',
|
||||
provide: function provide() {
|
||||
return {
|
||||
stepClick: this.stepClick,
|
||||
isVertical: this.vertical
|
||||
};
|
||||
},
|
||||
|
||||
props: {
|
||||
nonLinear: Boolean,
|
||||
altLabels: Boolean,
|
||||
vertical: Boolean,
|
||||
value: [Number, String]
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
inputValue: null,
|
||||
isBooted: false,
|
||||
steps: [],
|
||||
content: [],
|
||||
isReverse: false
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
classes: function classes() {
|
||||
return _extends({
|
||||
'v-stepper': true,
|
||||
'v-stepper--is-booted': this.isBooted,
|
||||
'v-stepper--vertical': this.vertical,
|
||||
'v-stepper--alt-labels': this.altLabels,
|
||||
'v-stepper--non-linear': this.nonLinear
|
||||
}, this.themeClasses);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
inputValue: function inputValue(val, prev) {
|
||||
this.isReverse = Number(val) < Number(prev);
|
||||
for (var index = this.steps.length; --index >= 0;) {
|
||||
this.steps[index].toggle(this.inputValue);
|
||||
}
|
||||
for (var _index = this.content.length; --_index >= 0;) {
|
||||
this.content[_index].toggle(this.inputValue, this.isReverse);
|
||||
}
|
||||
this.$emit('input', this.inputValue);
|
||||
prev && (this.isBooted = true);
|
||||
},
|
||||
value: function value() {
|
||||
var _this = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
return _this.inputValue = _this.value;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.inputValue = this.value || this.steps[0].step || 1;
|
||||
},
|
||||
|
||||
methods: {
|
||||
register: function register(item) {
|
||||
if (item.$options.name === 'v-stepper-step') {
|
||||
this.steps.push(item);
|
||||
} else if (item.$options.name === 'v-stepper-content') {
|
||||
item.isVertical = this.vertical;
|
||||
this.content.push(item);
|
||||
}
|
||||
},
|
||||
unregister: function unregister(item) {
|
||||
if (item.$options.name === 'v-stepper-step') {
|
||||
this.steps = this.steps.filter(function (i) {
|
||||
return i !== item;
|
||||
});
|
||||
} else if (item.$options.name === 'v-stepper-content') {
|
||||
item.isVertical = this.vertical;
|
||||
this.content = this.content.filter(function (i) {
|
||||
return i !== item;
|
||||
});
|
||||
}
|
||||
},
|
||||
stepClick: function stepClick(step) {
|
||||
var _this2 = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
return _this2.inputValue = step;
|
||||
});
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
return h('div', {
|
||||
'class': this.classes
|
||||
}, this.$slots.default);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VStepper.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+131
@@ -0,0 +1,131 @@
|
||||
// Components
|
||||
import { VTabTransition, VTabReverseTransition } from '../transitions';
|
||||
// Mixins
|
||||
import { inject as RegistrableInject } from '../../mixins/registrable';
|
||||
// Helpers
|
||||
import { convertToUnit } from '../../util/helpers';
|
||||
// Util
|
||||
import mixins from '../../util/mixins';
|
||||
export default mixins(RegistrableInject('stepper', 'v-stepper-content', 'v-stepper')
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-stepper-content',
|
||||
inject: {
|
||||
isVerticalProvided: {
|
||||
from: 'isVertical'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
step: {
|
||||
type: [Number, String],
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
height: 0,
|
||||
// Must be null to allow
|
||||
// previous comparison
|
||||
isActive: null,
|
||||
isReverse: false,
|
||||
isVertical: this.isVerticalProvided
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
classes: function classes() {
|
||||
return {
|
||||
'v-stepper__content': true
|
||||
};
|
||||
},
|
||||
computedTransition: function computedTransition() {
|
||||
return this.isReverse ? VTabReverseTransition : VTabTransition;
|
||||
},
|
||||
styles: function styles() {
|
||||
if (!this.isVertical) return {};
|
||||
return {
|
||||
height: convertToUnit(this.height)
|
||||
};
|
||||
},
|
||||
wrapperClasses: function wrapperClasses() {
|
||||
return {
|
||||
'v-stepper__wrapper': true
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isActive: function isActive(current, previous) {
|
||||
// If active and the previous state
|
||||
// was null, is just booting up
|
||||
if (current && previous == null) {
|
||||
this.height = 'auto';
|
||||
return;
|
||||
}
|
||||
if (!this.isVertical) return;
|
||||
if (this.isActive) this.enter();else this.leave();
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.$refs.wrapper.addEventListener('transitionend', this.onTransition, false);
|
||||
this.stepper && this.stepper.register(this);
|
||||
},
|
||||
beforeDestroy: function beforeDestroy() {
|
||||
this.$refs.wrapper.removeEventListener('transitionend', this.onTransition, false);
|
||||
this.stepper && this.stepper.unregister(this);
|
||||
},
|
||||
|
||||
methods: {
|
||||
onTransition: function onTransition(e) {
|
||||
if (!this.isActive || e.propertyName !== 'height') return;
|
||||
this.height = 'auto';
|
||||
},
|
||||
enter: function enter() {
|
||||
var _this = this;
|
||||
|
||||
var scrollHeight = 0;
|
||||
// Render bug with height
|
||||
requestAnimationFrame(function () {
|
||||
scrollHeight = _this.$refs.wrapper.scrollHeight;
|
||||
});
|
||||
this.height = 0;
|
||||
// Give the collapsing element time to collapse
|
||||
setTimeout(function () {
|
||||
return _this.isActive && (_this.height = scrollHeight || 'auto');
|
||||
}, 450);
|
||||
},
|
||||
leave: function leave() {
|
||||
var _this2 = this;
|
||||
|
||||
this.height = this.$refs.wrapper.clientHeight;
|
||||
setTimeout(function () {
|
||||
return _this2.height = 0;
|
||||
}, 10);
|
||||
},
|
||||
toggle: function toggle(step, reverse) {
|
||||
this.isActive = step.toString() === this.step.toString();
|
||||
this.isReverse = reverse;
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var contentData = {
|
||||
'class': this.classes
|
||||
};
|
||||
var wrapperData = {
|
||||
'class': this.wrapperClasses,
|
||||
style: this.styles,
|
||||
ref: 'wrapper'
|
||||
};
|
||||
if (!this.isVertical) {
|
||||
contentData.directives = [{
|
||||
name: 'show',
|
||||
value: this.isActive
|
||||
}];
|
||||
}
|
||||
var wrapper = h('div', wrapperData, [this.$slots.default]);
|
||||
var content = h('div', contentData, [wrapper]);
|
||||
return h(this.computedTransition, {
|
||||
on: this.$listeners
|
||||
}, [content]);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VStepperContent.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+119
@@ -0,0 +1,119 @@
|
||||
// Components
|
||||
import VIcon from '../VIcon';
|
||||
// Mixins
|
||||
import Colorable from '../../mixins/colorable';
|
||||
import { inject as RegistrableInject } from '../../mixins/registrable';
|
||||
// Directives
|
||||
import Ripple from '../../directives/ripple';
|
||||
// Util
|
||||
import mixins from '../../util/mixins';
|
||||
export default mixins(Colorable, RegistrableInject('stepper', 'v-stepper-step', 'v-stepper')
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-stepper-step',
|
||||
directives: { Ripple: Ripple },
|
||||
inject: ['stepClick'],
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: 'primary'
|
||||
},
|
||||
complete: Boolean,
|
||||
completeIcon: {
|
||||
type: String,
|
||||
default: '$vuetify.icons.complete'
|
||||
},
|
||||
editIcon: {
|
||||
type: String,
|
||||
default: '$vuetify.icons.edit'
|
||||
},
|
||||
errorIcon: {
|
||||
type: String,
|
||||
default: '$vuetify.icons.error'
|
||||
},
|
||||
editable: Boolean,
|
||||
rules: {
|
||||
type: Array,
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
step: [Number, String]
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
isActive: false,
|
||||
isInactive: true
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
classes: function classes() {
|
||||
return {
|
||||
'v-stepper__step': true,
|
||||
'v-stepper__step--active': this.isActive,
|
||||
'v-stepper__step--editable': this.editable,
|
||||
'v-stepper__step--inactive': this.isInactive,
|
||||
'v-stepper__step--error': this.hasError,
|
||||
'v-stepper__step--complete': this.complete,
|
||||
'error--text': this.hasError
|
||||
};
|
||||
},
|
||||
hasError: function hasError() {
|
||||
return this.rules.some(function (validate) {
|
||||
return validate() !== true;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.stepper && this.stepper.register(this);
|
||||
},
|
||||
beforeDestroy: function beforeDestroy() {
|
||||
this.stepper && this.stepper.unregister(this);
|
||||
},
|
||||
|
||||
methods: {
|
||||
click: function click(e) {
|
||||
e.stopPropagation();
|
||||
this.$emit('click', e);
|
||||
if (this.editable) {
|
||||
this.stepClick(this.step);
|
||||
}
|
||||
},
|
||||
toggle: function toggle(step) {
|
||||
this.isActive = step.toString() === this.step.toString();
|
||||
this.isInactive = Number(step) < Number(this.step);
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var data = {
|
||||
'class': this.classes,
|
||||
directives: [{
|
||||
name: 'ripple',
|
||||
value: this.editable
|
||||
}],
|
||||
on: { click: this.click }
|
||||
};
|
||||
var stepContent = void 0;
|
||||
if (this.hasError) {
|
||||
stepContent = [h(VIcon, {}, this.errorIcon)];
|
||||
} else if (this.complete) {
|
||||
if (this.editable) {
|
||||
stepContent = [h(VIcon, {}, this.editIcon)];
|
||||
} else {
|
||||
stepContent = [h(VIcon, {}, this.completeIcon)];
|
||||
}
|
||||
} else {
|
||||
stepContent = String(this.step);
|
||||
}
|
||||
var color = !this.hasError && (this.complete || this.isActive) ? this.color : false;
|
||||
var step = h('span', this.setBackgroundColor(color, {
|
||||
staticClass: 'v-stepper__step__step'
|
||||
}), stepContent);
|
||||
var label = h('div', {
|
||||
staticClass: 'v-stepper__label'
|
||||
}, this.$slots.default);
|
||||
return h('div', data, [step, label]);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VStepperStep.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+17
@@ -0,0 +1,17 @@
|
||||
import { createSimpleFunctional } from '../../util/helpers';
|
||||
import VStepper from './VStepper';
|
||||
import VStepperStep from './VStepperStep';
|
||||
import VStepperContent from './VStepperContent';
|
||||
var VStepperHeader = createSimpleFunctional('v-stepper__header');
|
||||
var VStepperItems = createSimpleFunctional('v-stepper__items');
|
||||
export { VStepper, VStepperContent, VStepperStep, VStepperHeader, VStepperItems };
|
||||
export default {
|
||||
$_vuetify_subcomponents: {
|
||||
VStepper: VStepper,
|
||||
VStepperContent: VStepperContent,
|
||||
VStepperStep: VStepperStep,
|
||||
VStepperHeader: VStepperHeader,
|
||||
VStepperItems: VStepperItems
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VStepper/index.ts"],"names":[],"mappings":"AAAA,SAAS,sBAAT,QAAuC,oBAAvC;AACA,OAAO,QAAP,MAAqB,YAArB;AACA,OAAO,YAAP,MAAyB,gBAAzB;AACA,OAAO,eAAP,MAA4B,mBAA5B;AAEA,IAAM,iBAAiB,uBAAuB,mBAAvB,CAAvB;AACA,IAAM,gBAAgB,uBAAuB,kBAAvB,CAAtB;AAEA,SACE,QADF,EAEE,eAFF,EAGE,YAHF,EAIE,cAJF,EAKE,aALF;AAQA,eAAe;AACb,6BAAyB;AACvB,0BADuB;AAEvB,wCAFuB;AAGvB,kCAHuB;AAIvB,sCAJuB;AAKvB;AALuB;AADZ,CAAf","sourcesContent":["import { createSimpleFunctional } from '../../util/helpers'\nimport VStepper from './VStepper'\nimport VStepperStep from './VStepperStep'\nimport VStepperContent from './VStepperContent'\n\nconst VStepperHeader = createSimpleFunctional('v-stepper__header')\nconst VStepperItems = createSimpleFunctional('v-stepper__items')\n\nexport {\n VStepper,\n VStepperContent,\n VStepperStep,\n VStepperHeader,\n VStepperItems\n}\n\nexport default {\n $_vuetify_subcomponents: {\n VStepper,\n VStepperContent,\n VStepperStep,\n VStepperHeader,\n VStepperItems\n }\n}\n"],"sourceRoot":""}
|
||||
Reference in New Issue
Block a user