Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VSpeedDial.js 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2. import '../../../src/stylus/components/_speed-dial.styl';
  3. import Toggleable from '../../mixins/toggleable';
  4. import Positionable from '../../mixins/positionable';
  5. import Transitionable from '../../mixins/transitionable';
  6. import ClickOutside from '../../directives/click-outside';
  7. /* @vue/component */
  8. export default {
  9. name: 'v-speed-dial',
  10. directives: { ClickOutside: ClickOutside },
  11. mixins: [Positionable, Toggleable, Transitionable],
  12. props: {
  13. direction: {
  14. type: String,
  15. default: 'top',
  16. validator: function validator(val) {
  17. return ['top', 'right', 'bottom', 'left'].includes(val);
  18. }
  19. },
  20. openOnHover: Boolean,
  21. transition: {
  22. type: String,
  23. default: 'scale-transition'
  24. }
  25. },
  26. computed: {
  27. classes: function classes() {
  28. return _defineProperty({
  29. 'v-speed-dial': true,
  30. 'v-speed-dial--top': this.top,
  31. 'v-speed-dial--right': this.right,
  32. 'v-speed-dial--bottom': this.bottom,
  33. 'v-speed-dial--left': this.left,
  34. 'v-speed-dial--absolute': this.absolute,
  35. 'v-speed-dial--fixed': this.fixed
  36. }, 'v-speed-dial--direction-' + this.direction, true);
  37. }
  38. },
  39. render: function render(h) {
  40. var _this = this;
  41. var children = [];
  42. var data = {
  43. 'class': this.classes,
  44. directives: [{
  45. name: 'click-outside',
  46. value: function value() {
  47. return _this.isActive = false;
  48. }
  49. }],
  50. on: {
  51. click: function click() {
  52. return _this.isActive = !_this.isActive;
  53. }
  54. }
  55. };
  56. if (this.openOnHover) {
  57. data.on.mouseenter = function () {
  58. return _this.isActive = true;
  59. };
  60. data.on.mouseleave = function () {
  61. return _this.isActive = false;
  62. };
  63. }
  64. if (this.isActive) {
  65. var btnCount = 0;
  66. children = (this.$slots.default || []).map(function (b, i) {
  67. if (b.tag && typeof b.componentOptions !== 'undefined' && b.componentOptions.Ctor.options.name === 'v-btn') {
  68. btnCount++;
  69. return h('div', {
  70. style: {
  71. transitionDelay: btnCount * 0.05 + 's'
  72. },
  73. key: i
  74. }, [b]);
  75. } else {
  76. b.key = i;
  77. return b;
  78. }
  79. });
  80. }
  81. var list = h('transition-group', {
  82. 'class': 'v-speed-dial__list',
  83. props: {
  84. name: this.transition,
  85. mode: this.mode,
  86. origin: this.origin,
  87. tag: 'div'
  88. }
  89. }, children);
  90. return h('div', data, [this.$slots.activator, list]);
  91. }
  92. };
  93. //# sourceMappingURL=VSpeedDial.js.map