vuetify eingebunden + erster Versuch Combobox
This commit is contained in:
+237
@@ -0,0 +1,237 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
require('../../../src/stylus/components/_carousel.styl');
|
||||
|
||||
var _VWindow = require('../VWindow/VWindow');
|
||||
|
||||
var _VWindow2 = _interopRequireDefault(_VWindow);
|
||||
|
||||
var _VBtn = require('../VBtn');
|
||||
|
||||
var _VBtn2 = _interopRequireDefault(_VBtn);
|
||||
|
||||
var _VIcon = require('../VIcon');
|
||||
|
||||
var _VIcon2 = _interopRequireDefault(_VIcon);
|
||||
|
||||
var _buttonGroup = require('../../mixins/button-group');
|
||||
|
||||
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
|
||||
|
||||
var _helpers = require('../../util/helpers');
|
||||
|
||||
var _console = require('../../util/console');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Utilities
|
||||
|
||||
// Extensions
|
||||
exports.default = _VWindow2.default.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']) {
|
||||
(0, _console.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(_VBtn2.default, {
|
||||
props: {
|
||||
icon: true
|
||||
},
|
||||
attrs: {
|
||||
'aria-label': this.$vuetify.t('$vuetify.carousel.' + direction)
|
||||
},
|
||||
on: {
|
||||
click: function click() {
|
||||
_this.changedByDelimiters = true;
|
||||
fn();
|
||||
}
|
||||
}
|
||||
}, [this.$createElement(_VIcon2.default, {
|
||||
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(_VBtn2.default, {
|
||||
class: {
|
||||
'v-carousel__controls__item': true
|
||||
},
|
||||
props: {
|
||||
icon: true,
|
||||
small: true,
|
||||
value: this.getValue(this.items[i], i)
|
||||
}
|
||||
}, [this.$createElement(_VIcon2.default, {
|
||||
props: { size: 18 }
|
||||
}, this.delimiterIcon)]);
|
||||
children.push(child);
|
||||
}
|
||||
return this.$createElement(_buttonGroup2.default, {
|
||||
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;
|
||||
}
|
||||
_VWindow2.default.options.methods.updateReverse.call(this, val, oldVal);
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var children = [];
|
||||
var data = {
|
||||
staticClass: 'v-window v-carousel',
|
||||
style: {
|
||||
height: (0, _helpers.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]);
|
||||
}
|
||||
});
|
||||
// Mixins
|
||||
// TODO: Move this into core components v2.0
|
||||
|
||||
// Components
|
||||
// Styles
|
||||
//# sourceMappingURL=VCarousel.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+41
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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
|
||||
|
||||
// Components
|
||||
|
||||
|
||||
var _VWindowItem = require('../VWindow/VWindowItem');
|
||||
|
||||
var _VWindowItem2 = _interopRequireDefault(_VWindowItem);
|
||||
|
||||
var _VImg = require('../VImg');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* @vue/component */
|
||||
exports.default = _VWindowItem2.default.extend({
|
||||
name: 'v-carousel-item',
|
||||
inheritAttrs: false,
|
||||
methods: {
|
||||
genDefaultSlot: function genDefaultSlot() {
|
||||
return [this.$createElement(_VImg.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":";;;;;;;;AAGA;;;AAFA;;;;AAGA;;;;AAEA;kBACe,sBAAY,MAAZ,CAAmB;AAChC,UAAM,iBAD0B;AAGhC,kBAAc,KAHkB;AAKhC,aAAS;AACP,sBADO,4BACO;AACZ,mBAAO,CACL,KAAK,cAAL,CAAoB,UAApB,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,C","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":""}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.VCarouselItem = exports.VCarousel = undefined;
|
||||
|
||||
var _VCarousel = require('./VCarousel');
|
||||
|
||||
var _VCarousel2 = _interopRequireDefault(_VCarousel);
|
||||
|
||||
var _VCarouselItem = require('./VCarouselItem');
|
||||
|
||||
var _VCarouselItem2 = _interopRequireDefault(_VCarouselItem);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.VCarousel = _VCarousel2.default;
|
||||
exports.VCarouselItem = _VCarouselItem2.default;
|
||||
exports.default = {
|
||||
$_vuetify_subcomponents: {
|
||||
VCarousel: _VCarousel2.default,
|
||||
VCarouselItem: _VCarouselItem2.default
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VCarousel/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA;;;;;;QAES,S,GAAA,mB;QAAW,a,GAAA,uB;kBAEL;AACb,6BAAyB;AACvB,sCADuB;AAEvB;AAFuB;AADZ,C","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