This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/components/VSpeedDial/VSpeedDial.js

98 lines
2.4 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
// Styles
import "../../../src/components/VSpeedDial/VSpeedDial.sass"; // Mixins
import Toggleable from '../../mixins/toggleable';
import Positionable from '../../mixins/positionable';
import Transitionable from '../../mixins/transitionable'; // Directives
import ClickOutside from '../../directives/click-outside'; // Types
import mixins from '../../util/mixins';
/* @vue/component */
export default mixins(Positionable, Toggleable, Transitionable).extend({
name: 'v-speed-dial',
directives: {
ClickOutside
},
props: {
direction: {
type: String,
default: 'top',
validator: val => {
return ['top', 'right', 'bottom', 'left'].includes(val);
}
},
openOnHover: Boolean,
transition: {
type: String,
default: 'scale-transition'
}
},
computed: {
classes() {
return {
'v-speed-dial': true,
'v-speed-dial--top': this.top,
'v-speed-dial--right': this.right,
'v-speed-dial--bottom': this.bottom,
'v-speed-dial--left': this.left,
'v-speed-dial--absolute': this.absolute,
'v-speed-dial--fixed': this.fixed,
[`v-speed-dial--direction-${this.direction}`]: true
};
}
},
render(h) {
let children = [];
const data = {
class: this.classes,
directives: [{
name: 'click-outside',
value: () => this.isActive = false
}],
on: {
click: () => this.isActive = !this.isActive
}
};
if (this.openOnHover) {
data.on.mouseenter = () => this.isActive = true;
data.on.mouseleave = () => this.isActive = false;
}
if (this.isActive) {
let btnCount = 0;
children = (this.$slots.default || []).map((b, i) => {
if (b.tag && typeof b.componentOptions !== 'undefined' && b.componentOptions.Ctor.options.name === 'v-btn') {
btnCount++;
return h('div', {
style: {
transitionDelay: btnCount * 0.05 + 's'
},
key: i
}, [b]);
} else {
b.key = i;
return b;
}
});
}
const list = h('transition-group', {
class: 'v-speed-dial__list',
props: {
name: this.transition,
mode: this.mode,
origin: this.origin,
tag: 'div'
}
}, children);
return h('div', data, [this.$slots.activator, list]);
}
});
//# sourceMappingURL=VSpeedDial.js.map