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.

groupable.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.factory = factory;
  6. var _registrable = require('./registrable');
  7. 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; } // Mixins
  8. function factory(namespace, child, parent) {
  9. return (0, _registrable.inject)(namespace, child, parent).extend({
  10. name: 'groupable',
  11. props: {
  12. activeClass: {
  13. type: String,
  14. default: function _default() {
  15. if (!this[namespace]) return undefined;
  16. return this[namespace].activeClass;
  17. }
  18. },
  19. disabled: Boolean
  20. },
  21. data: function data() {
  22. return {
  23. isActive: false
  24. };
  25. },
  26. computed: {
  27. groupClasses: function groupClasses() {
  28. if (!this.activeClass) return {};
  29. return _defineProperty({}, this.activeClass, this.isActive);
  30. }
  31. },
  32. created: function created() {
  33. this[namespace] && this[namespace].register(this);
  34. },
  35. beforeDestroy: function beforeDestroy() {
  36. this[namespace] && this[namespace].unregister(this);
  37. },
  38. methods: {
  39. toggle: function toggle() {
  40. this.$emit('change');
  41. }
  42. }
  43. });
  44. }
  45. /* eslint-disable-next-line no-redeclare */
  46. var Groupable = factory('itemGroup');
  47. exports.default = Groupable;
  48. //# sourceMappingURL=groupable.js.map