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.

VWindow.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. require('../../../src/stylus/components/_windows.styl');
  6. var _VItemGroup = require('../VItemGroup/VItemGroup');
  7. var _touch = require('../../directives/touch');
  8. var _touch2 = _interopRequireDefault(_touch);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /* @vue/component */
  11. // Components
  12. exports.default = _VItemGroup.BaseItemGroup.extend({
  13. name: 'v-window',
  14. provide: function provide() {
  15. return {
  16. windowGroup: this
  17. };
  18. },
  19. directives: { Touch: _touch2.default },
  20. props: {
  21. mandatory: {
  22. type: Boolean,
  23. default: true
  24. },
  25. reverse: {
  26. type: Boolean,
  27. default: undefined
  28. },
  29. touch: Object,
  30. touchless: Boolean,
  31. value: {
  32. required: false
  33. },
  34. vertical: Boolean
  35. },
  36. data: function data() {
  37. return {
  38. internalHeight: undefined,
  39. isActive: false,
  40. isBooted: false,
  41. isReverse: false
  42. };
  43. },
  44. computed: {
  45. computedTransition: function computedTransition() {
  46. if (!this.isBooted) return '';
  47. var axis = this.vertical ? 'y' : 'x';
  48. var direction = this.internalReverse === !this.$vuetify.rtl ? '-reverse' : '';
  49. return 'v-window-' + axis + direction + '-transition';
  50. },
  51. internalIndex: function internalIndex() {
  52. var _this = this;
  53. return this.items.findIndex(function (item, i) {
  54. return _this.internalValue === _this.getValue(item, i);
  55. });
  56. },
  57. internalReverse: function internalReverse() {
  58. if (this.reverse !== undefined) return this.reverse;
  59. return this.isReverse;
  60. }
  61. },
  62. watch: {
  63. internalIndex: 'updateReverse'
  64. },
  65. mounted: function mounted() {
  66. var _this2 = this;
  67. this.$nextTick(function () {
  68. return _this2.isBooted = true;
  69. });
  70. },
  71. methods: {
  72. genContainer: function genContainer() {
  73. return this.$createElement('div', {
  74. staticClass: 'v-window__container',
  75. class: {
  76. 'v-window__container--is-active': this.isActive
  77. },
  78. style: {
  79. height: this.internalHeight
  80. }
  81. }, this.$slots.default);
  82. },
  83. next: function next() {
  84. this.isReverse = false;
  85. var nextIndex = (this.internalIndex + 1) % this.items.length;
  86. var item = this.items[nextIndex];
  87. this.internalValue = this.getValue(item, nextIndex);
  88. },
  89. prev: function prev() {
  90. this.isReverse = true;
  91. var lastIndex = (this.internalIndex + this.items.length - 1) % this.items.length;
  92. var item = this.items[lastIndex];
  93. this.internalValue = this.getValue(item, lastIndex);
  94. },
  95. updateReverse: function updateReverse(val, oldVal) {
  96. this.isReverse = val < oldVal;
  97. }
  98. },
  99. render: function render(h) {
  100. var data = {
  101. staticClass: 'v-window',
  102. directives: []
  103. };
  104. if (!this.touchless) {
  105. var value = this.touch || {
  106. left: this.next,
  107. right: this.prev
  108. };
  109. data.directives.push({
  110. name: 'touch',
  111. value: value
  112. });
  113. }
  114. return h('div', data, [this.genContainer()]);
  115. }
  116. });
  117. // Directives
  118. // Styles
  119. //# sourceMappingURL=VWindow.js.map