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.

applicationable.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = applicationable;
  6. var _positionable = require('./positionable');
  7. var _mixins = require('../util/mixins');
  8. var _mixins2 = _interopRequireDefault(_mixins);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. function applicationable(value) {
  11. var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  12. /* @vue/component */
  13. return (0, _mixins2.default)((0, _positionable.factory)(['absolute', 'fixed'])).extend({
  14. name: 'applicationable',
  15. props: {
  16. app: Boolean
  17. },
  18. computed: {
  19. applicationProperty: function applicationProperty() {
  20. return value;
  21. }
  22. },
  23. watch: {
  24. // If previous value was app
  25. // reset the provided prop
  26. app: function app(x, prev) {
  27. prev ? this.removeApplication(true) : this.callUpdate();
  28. },
  29. applicationProperty: function applicationProperty(newVal, oldVal) {
  30. this.$vuetify.application.unbind(this._uid, oldVal);
  31. }
  32. },
  33. activated: function activated() {
  34. this.callUpdate();
  35. },
  36. created: function created() {
  37. for (var i = 0, length = events.length; i < length; i++) {
  38. this.$watch(events[i], this.callUpdate);
  39. }
  40. this.callUpdate();
  41. },
  42. mounted: function mounted() {
  43. this.callUpdate();
  44. },
  45. deactivated: function deactivated() {
  46. this.removeApplication();
  47. },
  48. destroyed: function destroyed() {
  49. this.removeApplication();
  50. },
  51. methods: {
  52. callUpdate: function callUpdate() {
  53. if (!this.app) return;
  54. this.$vuetify.application.bind(this._uid, this.applicationProperty, this.updateApplication());
  55. },
  56. removeApplication: function removeApplication() {
  57. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  58. if (!force && !this.app) return;
  59. this.$vuetify.application.unbind(this._uid, this.applicationProperty);
  60. },
  61. updateApplication: function updateApplication() {
  62. return 0;
  63. }
  64. }
  65. });
  66. }
  67. // Util
  68. //# sourceMappingURL=applicationable.js.map