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.

VHover.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _delayable = require('../../mixins/delayable');
  6. var _delayable2 = _interopRequireDefault(_delayable);
  7. var _toggleable = require('../../mixins/toggleable');
  8. var _toggleable2 = _interopRequireDefault(_toggleable);
  9. var _mixins = require('../../util/mixins');
  10. var _mixins2 = _interopRequireDefault(_mixins);
  11. var _console = require('../../util/console');
  12. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13. // Utilities
  14. // Mixins
  15. exports.default = (0, _mixins2.default)(_delayable2.default, _toggleable2.default
  16. /* @vue/component */
  17. ).extend({
  18. name: 'v-hover',
  19. props: {
  20. disabled: {
  21. type: Boolean,
  22. default: false
  23. },
  24. value: {
  25. type: Boolean,
  26. default: undefined
  27. }
  28. },
  29. methods: {
  30. onMouseEnter: function onMouseEnter() {
  31. this.runDelay('open');
  32. },
  33. onMouseLeave: function onMouseLeave() {
  34. this.runDelay('close');
  35. }
  36. },
  37. render: function render() {
  38. if (!this.$scopedSlots.default && this.value === undefined) {
  39. (0, _console.consoleWarn)('v-hover is missing a default scopedSlot or bound value', this);
  40. return null;
  41. }
  42. var element = void 0;
  43. if (this.$scopedSlots.default) {
  44. element = this.$scopedSlots.default({ hover: this.isActive });
  45. } else if (this.$slots.default && this.$slots.default.length === 1) {
  46. element = this.$slots.default[0];
  47. }
  48. if (Array.isArray(element) && element.length === 1) {
  49. element = element[0];
  50. }
  51. if (!element || Array.isArray(element) || !element.tag) {
  52. (0, _console.consoleWarn)('v-hover should only contain a single element', this);
  53. return element;
  54. }
  55. if (!this.disabled) {
  56. element.data = element.data || {};
  57. this._g(element.data, {
  58. mouseenter: this.onMouseEnter,
  59. mouseleave: this.onMouseLeave
  60. });
  61. }
  62. return element;
  63. }
  64. });
  65. //# sourceMappingURL=VHover.js.map