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.7KB

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