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.

VStepperStep.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _VIcon = require('../VIcon');
  6. var _VIcon2 = _interopRequireDefault(_VIcon);
  7. var _colorable = require('../../mixins/colorable');
  8. var _colorable2 = _interopRequireDefault(_colorable);
  9. var _registrable = require('../../mixins/registrable');
  10. var _ripple = require('../../directives/ripple');
  11. var _ripple2 = _interopRequireDefault(_ripple);
  12. var _mixins = require('../../util/mixins');
  13. var _mixins2 = _interopRequireDefault(_mixins);
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. // Directives
  16. // Mixins
  17. exports.default = (0, _mixins2.default)(_colorable2.default, (0, _registrable.inject)('stepper', 'v-stepper-step', 'v-stepper')
  18. /* @vue/component */
  19. ).extend({
  20. name: 'v-stepper-step',
  21. directives: { Ripple: _ripple2.default },
  22. inject: ['stepClick'],
  23. props: {
  24. color: {
  25. type: String,
  26. default: 'primary'
  27. },
  28. complete: Boolean,
  29. completeIcon: {
  30. type: String,
  31. default: '$vuetify.icons.complete'
  32. },
  33. editIcon: {
  34. type: String,
  35. default: '$vuetify.icons.edit'
  36. },
  37. errorIcon: {
  38. type: String,
  39. default: '$vuetify.icons.error'
  40. },
  41. editable: Boolean,
  42. rules: {
  43. type: Array,
  44. default: function _default() {
  45. return [];
  46. }
  47. },
  48. step: [Number, String]
  49. },
  50. data: function data() {
  51. return {
  52. isActive: false,
  53. isInactive: true
  54. };
  55. },
  56. computed: {
  57. classes: function classes() {
  58. return {
  59. 'v-stepper__step': true,
  60. 'v-stepper__step--active': this.isActive,
  61. 'v-stepper__step--editable': this.editable,
  62. 'v-stepper__step--inactive': this.isInactive,
  63. 'v-stepper__step--error': this.hasError,
  64. 'v-stepper__step--complete': this.complete,
  65. 'error--text': this.hasError
  66. };
  67. },
  68. hasError: function hasError() {
  69. return this.rules.some(function (validate) {
  70. return validate() !== true;
  71. });
  72. }
  73. },
  74. mounted: function mounted() {
  75. this.stepper && this.stepper.register(this);
  76. },
  77. beforeDestroy: function beforeDestroy() {
  78. this.stepper && this.stepper.unregister(this);
  79. },
  80. methods: {
  81. click: function click(e) {
  82. e.stopPropagation();
  83. this.$emit('click', e);
  84. if (this.editable) {
  85. this.stepClick(this.step);
  86. }
  87. },
  88. toggle: function toggle(step) {
  89. this.isActive = step.toString() === this.step.toString();
  90. this.isInactive = Number(step) < Number(this.step);
  91. }
  92. },
  93. render: function render(h) {
  94. var data = {
  95. 'class': this.classes,
  96. directives: [{
  97. name: 'ripple',
  98. value: this.editable
  99. }],
  100. on: { click: this.click }
  101. };
  102. var stepContent = void 0;
  103. if (this.hasError) {
  104. stepContent = [h(_VIcon2.default, {}, this.errorIcon)];
  105. } else if (this.complete) {
  106. if (this.editable) {
  107. stepContent = [h(_VIcon2.default, {}, this.editIcon)];
  108. } else {
  109. stepContent = [h(_VIcon2.default, {}, this.completeIcon)];
  110. }
  111. } else {
  112. stepContent = String(this.step);
  113. }
  114. var color = !this.hasError && (this.complete || this.isActive) ? this.color : false;
  115. var step = h('span', this.setBackgroundColor(color, {
  116. staticClass: 'v-stepper__step__step'
  117. }), stepContent);
  118. var label = h('div', {
  119. staticClass: 'v-stepper__label'
  120. }, this.$slots.default);
  121. return h('div', data, [step, label]);
  122. }
  123. });
  124. // Util
  125. // Components
  126. //# sourceMappingURL=VStepperStep.js.map