vuetify eingebunden + erster Versuch Combobox
This commit is contained in:
+212
@@ -0,0 +1,212 @@
|
||||
// Styles
|
||||
import '../../../src/stylus/components/_carousel.styl';
|
||||
// Extensions
|
||||
import VWindow from '../VWindow/VWindow';
|
||||
// Components
|
||||
import VBtn from '../VBtn';
|
||||
import VIcon from '../VIcon';
|
||||
// Mixins
|
||||
// TODO: Move this into core components v2.0
|
||||
import ButtonGroup from '../../mixins/button-group';
|
||||
// Utilities
|
||||
import { convertToUnit } from '../../util/helpers';
|
||||
import { deprecate } from '../../util/console';
|
||||
export default VWindow.extend({
|
||||
name: 'v-carousel',
|
||||
props: {
|
||||
cycle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
delimiterIcon: {
|
||||
type: String,
|
||||
default: '$vuetify.icons.delimiter'
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: 500
|
||||
},
|
||||
hideControls: Boolean,
|
||||
hideDelimiters: Boolean,
|
||||
interval: {
|
||||
type: [Number, String],
|
||||
default: 6000,
|
||||
validator: function validator(value) {
|
||||
return value > 0;
|
||||
}
|
||||
},
|
||||
mandatory: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
nextIcon: {
|
||||
type: [Boolean, String],
|
||||
default: '$vuetify.icons.next'
|
||||
},
|
||||
prevIcon: {
|
||||
type: [Boolean, String],
|
||||
default: '$vuetify.icons.prev'
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
changedByDelimiters: false,
|
||||
internalHeight: this.height,
|
||||
slideTimeout: undefined
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
isDark: function isDark() {
|
||||
return this.dark || !this.light;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
internalValue: function internalValue(val) {
|
||||
this.restartTimeout();
|
||||
/* @deprecate */
|
||||
/* istanbul ignore else */
|
||||
if (!this.$listeners['input']) return;
|
||||
this.$emit('input', val);
|
||||
},
|
||||
|
||||
interval: 'restartTimeout',
|
||||
height: function height(val, oldVal) {
|
||||
if (val === oldVal || !val) return;
|
||||
this.internalHeight = val;
|
||||
},
|
||||
cycle: function cycle(val) {
|
||||
if (val) {
|
||||
this.restartTimeout();
|
||||
} else {
|
||||
clearTimeout(this.slideTimeout);
|
||||
this.slideTimeout = undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
/* @deprecate */
|
||||
/* istanbul ignore next */
|
||||
if (this.$listeners['input']) {
|
||||
deprecate('@input', '@change', this);
|
||||
}
|
||||
this.startTimeout();
|
||||
},
|
||||
|
||||
methods: {
|
||||
genDelimiters: function genDelimiters() {
|
||||
return this.$createElement('div', {
|
||||
staticClass: 'v-carousel__controls'
|
||||
}, [this.genItems()]);
|
||||
},
|
||||
genIcon: function genIcon(direction, icon, fn) {
|
||||
var _this = this;
|
||||
|
||||
return this.$createElement('div', {
|
||||
staticClass: 'v-carousel__' + direction
|
||||
}, [this.$createElement(VBtn, {
|
||||
props: {
|
||||
icon: true
|
||||
},
|
||||
attrs: {
|
||||
'aria-label': this.$vuetify.t('$vuetify.carousel.' + direction)
|
||||
},
|
||||
on: {
|
||||
click: function click() {
|
||||
_this.changedByDelimiters = true;
|
||||
fn();
|
||||
}
|
||||
}
|
||||
}, [this.$createElement(VIcon, {
|
||||
props: { 'size': '46px' }
|
||||
}, icon)])]);
|
||||
},
|
||||
genIcons: function genIcons() {
|
||||
var icons = [];
|
||||
var prevIcon = this.$vuetify.rtl ? this.nextIcon : this.prevIcon;
|
||||
if (prevIcon && typeof prevIcon === 'string') {
|
||||
icons.push(this.genIcon('prev', prevIcon, this.prev));
|
||||
}
|
||||
var nextIcon = this.$vuetify.rtl ? this.prevIcon : this.nextIcon;
|
||||
if (nextIcon && typeof nextIcon === 'string') {
|
||||
icons.push(this.genIcon('next', nextIcon, this.next));
|
||||
}
|
||||
return icons;
|
||||
},
|
||||
genItems: function genItems() {
|
||||
var _this2 = this;
|
||||
|
||||
var length = this.items.length;
|
||||
var children = [];
|
||||
for (var i = 0; i < length; i++) {
|
||||
var child = this.$createElement(VBtn, {
|
||||
class: {
|
||||
'v-carousel__controls__item': true
|
||||
},
|
||||
props: {
|
||||
icon: true,
|
||||
small: true,
|
||||
value: this.getValue(this.items[i], i)
|
||||
}
|
||||
}, [this.$createElement(VIcon, {
|
||||
props: { size: 18 }
|
||||
}, this.delimiterIcon)]);
|
||||
children.push(child);
|
||||
}
|
||||
return this.$createElement(ButtonGroup, {
|
||||
props: {
|
||||
value: this.internalValue
|
||||
},
|
||||
on: {
|
||||
change: function change(val) {
|
||||
_this2.internalValue = val;
|
||||
}
|
||||
}
|
||||
}, children);
|
||||
},
|
||||
restartTimeout: function restartTimeout() {
|
||||
this.slideTimeout && clearTimeout(this.slideTimeout);
|
||||
this.slideTimeout = undefined;
|
||||
var raf = requestAnimationFrame || setTimeout;
|
||||
raf(this.startTimeout);
|
||||
},
|
||||
startTimeout: function startTimeout() {
|
||||
if (!this.cycle) return;
|
||||
this.slideTimeout = window.setTimeout(this.next, +this.interval > 0 ? +this.interval : 6000);
|
||||
},
|
||||
updateReverse: function updateReverse(val, oldVal) {
|
||||
if (this.changedByDelimiters) {
|
||||
this.changedByDelimiters = false;
|
||||
return;
|
||||
}
|
||||
VWindow.options.methods.updateReverse.call(this, val, oldVal);
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var children = [];
|
||||
var data = {
|
||||
staticClass: 'v-window v-carousel',
|
||||
style: {
|
||||
height: convertToUnit(this.height)
|
||||
},
|
||||
directives: []
|
||||
};
|
||||
if (!this.touchless) {
|
||||
data.directives.push({
|
||||
name: 'touch',
|
||||
value: {
|
||||
left: this.next,
|
||||
right: this.prev
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!this.hideControls) {
|
||||
children.push(this.genIcons());
|
||||
}
|
||||
if (!this.hideDelimiters) {
|
||||
children.push(this.genDelimiters());
|
||||
}
|
||||
return h('div', data, [this.genContainer(), children]);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VCarousel.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+28
@@ -0,0 +1,28 @@
|
||||
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; };
|
||||
|
||||
// Extensions
|
||||
import VWindowItem from '../VWindow/VWindowItem';
|
||||
// Components
|
||||
import { VImg } from '../VImg';
|
||||
/* @vue/component */
|
||||
export default VWindowItem.extend({
|
||||
name: 'v-carousel-item',
|
||||
inheritAttrs: false,
|
||||
methods: {
|
||||
genDefaultSlot: function genDefaultSlot() {
|
||||
return [this.$createElement(VImg, {
|
||||
staticClass: 'v-carousel__item',
|
||||
props: _extends({}, this.$attrs, {
|
||||
height: this.windowGroup.internalHeight
|
||||
}),
|
||||
on: this.$listeners
|
||||
}, this.$slots.default)];
|
||||
},
|
||||
onBeforeEnter: function onBeforeEnter() {},
|
||||
onEnter: function onEnter() {},
|
||||
onAfterEnter: function onAfterEnter() {},
|
||||
onBeforeLeave: function onBeforeLeave() {},
|
||||
onEnterCancelled: function onEnterCancelled() {}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VCarouselItem.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VCarousel/VCarouselItem.ts"],"names":[],"mappings":";;;AACA,OAAO,WAAP,MAAwB,wBAAxB;AAEA;AACA,SAAS,IAAT,QAAqB,SAArB;AAEA;AACA,eAAe,YAAY,MAAZ,CAAmB;AAChC,UAAM,iBAD0B;AAGhC,kBAAc,KAHkB;AAKhC,aAAS;AACP,sBADO,4BACO;AACZ,mBAAO,CACL,KAAK,cAAL,CAAoB,IAApB,EAA0B;AACxB,6BAAa,kBADW;AAExB,oCACK,KAAK,MADV;AAEE,4BAAQ,KAAK,WAAL,CAAiB;AAF3B,kBAFwB;AAMxB,oBAAI,KAAK;AANe,aAA1B,EAOG,KAAK,MAAL,CAAY,OAPf,CADK,CAAP;AAUD,SAZM;AAaP,qBAbO,2BAaM,CAAkB,CAbxB;AAcP,eAdO,qBAcA,CAAkB,CAdlB;AAeP,oBAfO,0BAeK,CAAkB,CAfvB;AAgBP,qBAhBO,2BAgBM,CAAkB,CAhBxB;AAiBP,wBAjBO,8BAiBS,CAAkB;AAjB3B;AALuB,CAAnB,CAAf","sourcesContent":["// Extensions\nimport VWindowItem from '../VWindow/VWindowItem'\n\n// Components\nimport { VImg } from '../VImg'\n\n/* @vue/component */\nexport default VWindowItem.extend({\n name: 'v-carousel-item',\n\n inheritAttrs: false,\n\n methods: {\n genDefaultSlot () {\n return [\n this.$createElement(VImg, {\n staticClass: 'v-carousel__item',\n props: {\n ...this.$attrs,\n height: this.windowGroup.internalHeight\n },\n on: this.$listeners\n }, this.$slots.default)\n ]\n },\n onBeforeEnter () { /* noop */ },\n onEnter () { /* noop */ },\n onAfterEnter () { /* noop */ },\n onBeforeLeave () { /* noop */ },\n onEnterCancelled () { /* noop */ }\n }\n})\n"],"sourceRoot":""}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import VCarousel from './VCarousel';
|
||||
import VCarouselItem from './VCarouselItem';
|
||||
export { VCarousel, VCarouselItem };
|
||||
export default {
|
||||
$_vuetify_subcomponents: {
|
||||
VCarousel: VCarousel,
|
||||
VCarouselItem: VCarouselItem
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VCarousel/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAP,MAAsB,aAAtB;AACA,OAAO,aAAP,MAA0B,iBAA1B;AAEA,SAAS,SAAT,EAAoB,aAApB;AAEA,eAAe;AACb,6BAAyB;AACvB,4BADuB;AAEvB;AAFuB;AADZ,CAAf","sourcesContent":["import VCarousel from './VCarousel'\nimport VCarouselItem from './VCarouselItem'\n\nexport { VCarousel, VCarouselItem }\n\nexport default {\n $_vuetify_subcomponents: {\n VCarousel,\n VCarouselItem\n }\n}\n"],"sourceRoot":""}
|
||||
Reference in New Issue
Block a user