vuetify eingebunden + erster Versuch Combobox
This commit is contained in:
+132
@@ -0,0 +1,132 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
require('../../../src/stylus/components/_windows.styl');
|
||||
|
||||
var _VItemGroup = require('../VItemGroup/VItemGroup');
|
||||
|
||||
var _touch = require('../../directives/touch');
|
||||
|
||||
var _touch2 = _interopRequireDefault(_touch);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* @vue/component */
|
||||
|
||||
// Components
|
||||
exports.default = _VItemGroup.BaseItemGroup.extend({
|
||||
name: 'v-window',
|
||||
provide: function provide() {
|
||||
return {
|
||||
windowGroup: this
|
||||
};
|
||||
},
|
||||
|
||||
directives: { Touch: _touch2.default },
|
||||
props: {
|
||||
mandatory: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
reverse: {
|
||||
type: Boolean,
|
||||
default: undefined
|
||||
},
|
||||
touch: Object,
|
||||
touchless: Boolean,
|
||||
value: {
|
||||
required: false
|
||||
},
|
||||
vertical: Boolean
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
internalHeight: undefined,
|
||||
isActive: false,
|
||||
isBooted: false,
|
||||
isReverse: false
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
computedTransition: function computedTransition() {
|
||||
if (!this.isBooted) return '';
|
||||
var axis = this.vertical ? 'y' : 'x';
|
||||
var direction = this.internalReverse === !this.$vuetify.rtl ? '-reverse' : '';
|
||||
return 'v-window-' + axis + direction + '-transition';
|
||||
},
|
||||
internalIndex: function internalIndex() {
|
||||
var _this = this;
|
||||
|
||||
return this.items.findIndex(function (item, i) {
|
||||
return _this.internalValue === _this.getValue(item, i);
|
||||
});
|
||||
},
|
||||
internalReverse: function internalReverse() {
|
||||
if (this.reverse !== undefined) return this.reverse;
|
||||
return this.isReverse;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
internalIndex: 'updateReverse'
|
||||
},
|
||||
mounted: function mounted() {
|
||||
var _this2 = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
return _this2.isBooted = true;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
genContainer: function genContainer() {
|
||||
return this.$createElement('div', {
|
||||
staticClass: 'v-window__container',
|
||||
class: {
|
||||
'v-window__container--is-active': this.isActive
|
||||
},
|
||||
style: {
|
||||
height: this.internalHeight
|
||||
}
|
||||
}, this.$slots.default);
|
||||
},
|
||||
next: function next() {
|
||||
this.isReverse = false;
|
||||
var nextIndex = (this.internalIndex + 1) % this.items.length;
|
||||
var item = this.items[nextIndex];
|
||||
this.internalValue = this.getValue(item, nextIndex);
|
||||
},
|
||||
prev: function prev() {
|
||||
this.isReverse = true;
|
||||
var lastIndex = (this.internalIndex + this.items.length - 1) % this.items.length;
|
||||
var item = this.items[lastIndex];
|
||||
this.internalValue = this.getValue(item, lastIndex);
|
||||
},
|
||||
updateReverse: function updateReverse(val, oldVal) {
|
||||
this.isReverse = val < oldVal;
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var data = {
|
||||
staticClass: 'v-window',
|
||||
directives: []
|
||||
};
|
||||
if (!this.touchless) {
|
||||
var value = this.touch || {
|
||||
left: this.next,
|
||||
right: this.prev
|
||||
};
|
||||
data.directives.push({
|
||||
name: 'touch',
|
||||
value: value
|
||||
});
|
||||
}
|
||||
return h('div', data, [this.genContainer()]);
|
||||
}
|
||||
});
|
||||
// Directives
|
||||
// Styles
|
||||
//# sourceMappingURL=VWindow.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+142
@@ -0,0 +1,142 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _bootable = require('../../mixins/bootable');
|
||||
|
||||
var _bootable2 = _interopRequireDefault(_bootable);
|
||||
|
||||
var _groupable = require('../../mixins/groupable');
|
||||
|
||||
var _touch = require('../../directives/touch');
|
||||
|
||||
var _touch2 = _interopRequireDefault(_touch);
|
||||
|
||||
var _helpers = require('../../util/helpers');
|
||||
|
||||
var _mixins = require('../../util/mixins');
|
||||
|
||||
var _mixins2 = _interopRequireDefault(_mixins);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Utilities
|
||||
exports.default = (0, _mixins2.default)(_bootable2.default, (0, _groupable.factory)('windowGroup', 'v-window-item', 'v-window')
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-window-item',
|
||||
directives: {
|
||||
Touch: _touch2.default
|
||||
},
|
||||
props: {
|
||||
reverseTransition: {
|
||||
type: [Boolean, String],
|
||||
default: undefined
|
||||
},
|
||||
transition: {
|
||||
type: [Boolean, String],
|
||||
default: undefined
|
||||
},
|
||||
value: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
done: null,
|
||||
isActive: false,
|
||||
wasCancelled: false
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
computedTransition: function computedTransition() {
|
||||
if (!this.windowGroup.internalReverse) {
|
||||
return typeof this.transition !== 'undefined' ? this.transition || '' : this.windowGroup.computedTransition;
|
||||
}
|
||||
return typeof this.reverseTransition !== 'undefined' ? this.reverseTransition || '' : this.windowGroup.computedTransition;
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.$el.addEventListener('transitionend', this.onTransitionEnd, false);
|
||||
},
|
||||
beforeDestroy: function beforeDestroy() {
|
||||
this.$el.removeEventListener('transitionend', this.onTransitionEnd, false);
|
||||
},
|
||||
|
||||
methods: {
|
||||
genDefaultSlot: function genDefaultSlot() {
|
||||
return this.$slots.default;
|
||||
},
|
||||
onAfterEnter: function onAfterEnter() {
|
||||
var _this = this;
|
||||
|
||||
if (this.wasCancelled) {
|
||||
this.wasCancelled = false;
|
||||
return;
|
||||
}
|
||||
requestAnimationFrame(function () {
|
||||
_this.windowGroup.internalHeight = undefined;
|
||||
_this.windowGroup.isActive = false;
|
||||
});
|
||||
},
|
||||
onBeforeEnter: function onBeforeEnter() {
|
||||
this.windowGroup.isActive = true;
|
||||
},
|
||||
onLeave: function onLeave(el) {
|
||||
this.windowGroup.internalHeight = (0, _helpers.convertToUnit)(el.clientHeight);
|
||||
},
|
||||
onEnterCancelled: function onEnterCancelled() {
|
||||
this.wasCancelled = true;
|
||||
},
|
||||
onEnter: function onEnter(el, done) {
|
||||
var _this2 = this;
|
||||
|
||||
var isBooted = this.windowGroup.isBooted;
|
||||
if (isBooted) this.done = done;
|
||||
requestAnimationFrame(function () {
|
||||
if (!_this2.computedTransition) return done();
|
||||
_this2.windowGroup.internalHeight = (0, _helpers.convertToUnit)(el.clientHeight);
|
||||
// On initial render, there is no transition
|
||||
// Vue leaves a `enter` transition class
|
||||
// if done is called too fast
|
||||
!isBooted && setTimeout(done, 100);
|
||||
});
|
||||
},
|
||||
onTransitionEnd: function onTransitionEnd(e) {
|
||||
// This ensures we only call done
|
||||
// when the element transform
|
||||
// completes
|
||||
if (e.propertyName !== 'transform' || e.target !== this.$el || !this.done) return;
|
||||
this.done();
|
||||
this.done = null;
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var div = h('div', {
|
||||
staticClass: 'v-window-item',
|
||||
directives: [{
|
||||
name: 'show',
|
||||
value: this.isActive
|
||||
}],
|
||||
on: this.$listeners
|
||||
}, this.showLazyContent(this.genDefaultSlot()));
|
||||
return h('transition', {
|
||||
props: {
|
||||
name: this.computedTransition
|
||||
},
|
||||
on: {
|
||||
afterEnter: this.onAfterEnter,
|
||||
beforeEnter: this.onBeforeEnter,
|
||||
leave: this.onLeave,
|
||||
enter: this.onEnter,
|
||||
enterCancelled: this.onEnterCancelled
|
||||
}
|
||||
}, [div]);
|
||||
}
|
||||
});
|
||||
// Directives
|
||||
// Mixins
|
||||
//# sourceMappingURL=VWindowItem.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+26
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.VWindowItem = exports.VWindow = undefined;
|
||||
|
||||
var _VWindow = require('./VWindow');
|
||||
|
||||
var _VWindow2 = _interopRequireDefault(_VWindow);
|
||||
|
||||
var _VWindowItem = require('./VWindowItem');
|
||||
|
||||
var _VWindowItem2 = _interopRequireDefault(_VWindowItem);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.VWindow = _VWindow2.default;
|
||||
exports.VWindowItem = _VWindowItem2.default;
|
||||
exports.default = {
|
||||
$_vuetify_subcomponents: {
|
||||
VWindow: _VWindow2.default,
|
||||
VWindowItem: _VWindowItem2.default
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VWindow/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA;;;;;;QAES,O,GAAA,iB;QAAS,W,GAAA,qB;kBAEH;AACb,6BAAyB;AACvB,kCADuB;AAEvB;AAFuB;AADZ,C","sourcesContent":["import VWindow from './VWindow'\nimport VWindowItem from './VWindowItem'\n\nexport { VWindow, VWindowItem }\n\nexport default {\n $_vuetify_subcomponents: {\n VWindow,\n VWindowItem\n }\n}\n"],"sourceRoot":""}
|
||||
Reference in New Issue
Block a user