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.

VStepper.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // Styles
  6. // Mixins
  7. // Util
  8. require('../../../src/stylus/components/_steppers.styl');
  9. var _registrable = require('../../mixins/registrable');
  10. var _themeable = require('../../mixins/themeable');
  11. var _themeable2 = _interopRequireDefault(_themeable);
  12. var _mixins = require('../../util/mixins');
  13. var _mixins2 = _interopRequireDefault(_mixins);
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. exports.default = (0, _mixins2.default)((0, _registrable.provide)('stepper'), _themeable2.default
  16. /* @vue/component */
  17. ).extend({
  18. name: 'v-stepper',
  19. provide: function provide() {
  20. return {
  21. stepClick: this.stepClick,
  22. isVertical: this.vertical
  23. };
  24. },
  25. props: {
  26. nonLinear: Boolean,
  27. altLabels: Boolean,
  28. vertical: Boolean,
  29. value: [Number, String]
  30. },
  31. data: function data() {
  32. return {
  33. inputValue: null,
  34. isBooted: false,
  35. steps: [],
  36. content: [],
  37. isReverse: false
  38. };
  39. },
  40. computed: {
  41. classes: function classes() {
  42. return _extends({
  43. 'v-stepper': true,
  44. 'v-stepper--is-booted': this.isBooted,
  45. 'v-stepper--vertical': this.vertical,
  46. 'v-stepper--alt-labels': this.altLabels,
  47. 'v-stepper--non-linear': this.nonLinear
  48. }, this.themeClasses);
  49. }
  50. },
  51. watch: {
  52. inputValue: function inputValue(val, prev) {
  53. this.isReverse = Number(val) < Number(prev);
  54. for (var index = this.steps.length; --index >= 0;) {
  55. this.steps[index].toggle(this.inputValue);
  56. }
  57. for (var _index = this.content.length; --_index >= 0;) {
  58. this.content[_index].toggle(this.inputValue, this.isReverse);
  59. }
  60. this.$emit('input', this.inputValue);
  61. prev && (this.isBooted = true);
  62. },
  63. value: function value() {
  64. var _this = this;
  65. this.$nextTick(function () {
  66. return _this.inputValue = _this.value;
  67. });
  68. }
  69. },
  70. mounted: function mounted() {
  71. this.inputValue = this.value || this.steps[0].step || 1;
  72. },
  73. methods: {
  74. register: function register(item) {
  75. if (item.$options.name === 'v-stepper-step') {
  76. this.steps.push(item);
  77. } else if (item.$options.name === 'v-stepper-content') {
  78. item.isVertical = this.vertical;
  79. this.content.push(item);
  80. }
  81. },
  82. unregister: function unregister(item) {
  83. if (item.$options.name === 'v-stepper-step') {
  84. this.steps = this.steps.filter(function (i) {
  85. return i !== item;
  86. });
  87. } else if (item.$options.name === 'v-stepper-content') {
  88. item.isVertical = this.vertical;
  89. this.content = this.content.filter(function (i) {
  90. return i !== item;
  91. });
  92. }
  93. },
  94. stepClick: function stepClick(step) {
  95. var _this2 = this;
  96. this.$nextTick(function () {
  97. return _this2.inputValue = step;
  98. });
  99. }
  100. },
  101. render: function render(h) {
  102. return h('div', {
  103. 'class': this.classes
  104. }, this.$slots.default);
  105. }
  106. });
  107. //# sourceMappingURL=VStepper.js.map