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

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