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.

VAlert.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. require('../../../src/stylus/components/_alerts.styl');
  6. var _VIcon = require('../VIcon');
  7. var _VIcon2 = _interopRequireDefault(_VIcon);
  8. var _colorable = require('../../mixins/colorable');
  9. var _colorable2 = _interopRequireDefault(_colorable);
  10. var _toggleable = require('../../mixins/toggleable');
  11. var _toggleable2 = _interopRequireDefault(_toggleable);
  12. var _transitionable = require('../../mixins/transitionable');
  13. var _transitionable2 = _interopRequireDefault(_transitionable);
  14. var _mixins = require('../../util/mixins');
  15. var _mixins2 = _interopRequireDefault(_mixins);
  16. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17. /* @vue/component */
  18. // Mixins
  19. // Styles
  20. exports.default = (0, _mixins2.default)(_colorable2.default, _toggleable2.default, _transitionable2.default).extend({
  21. name: 'v-alert',
  22. props: {
  23. dismissible: Boolean,
  24. icon: String,
  25. outline: Boolean,
  26. type: {
  27. type: String,
  28. validator: function validator(val) {
  29. return ['info', 'error', 'success', 'warning'].includes(val);
  30. }
  31. }
  32. },
  33. computed: {
  34. computedColor: function computedColor() {
  35. return this.type && !this.color ? this.type : this.color || 'error';
  36. },
  37. computedIcon: function computedIcon() {
  38. if (this.icon || !this.type) return this.icon;
  39. switch (this.type) {
  40. case 'info':
  41. return '$vuetify.icons.info';
  42. case 'error':
  43. return '$vuetify.icons.error';
  44. case 'success':
  45. return '$vuetify.icons.success';
  46. case 'warning':
  47. return '$vuetify.icons.warning';
  48. }
  49. }
  50. },
  51. methods: {
  52. genIcon: function genIcon() {
  53. if (!this.computedIcon) return null;
  54. return this.$createElement(_VIcon2.default, {
  55. 'class': 'v-alert__icon'
  56. }, this.computedIcon);
  57. },
  58. genDismissible: function genDismissible() {
  59. var _this = this;
  60. if (!this.dismissible) return null;
  61. return this.$createElement('a', {
  62. 'class': 'v-alert__dismissible',
  63. on: { click: function click() {
  64. _this.isActive = false;
  65. } }
  66. }, [this.$createElement(_VIcon2.default, {
  67. props: {
  68. right: true
  69. }
  70. }, '$vuetify.icons.cancel')]);
  71. }
  72. },
  73. render: function render(h) {
  74. var children = [this.genIcon(), h('div', this.$slots.default), this.genDismissible()];
  75. var setColor = this.outline ? this.setTextColor : this.setBackgroundColor;
  76. var alert = h('div', setColor(this.computedColor, {
  77. staticClass: 'v-alert',
  78. 'class': {
  79. 'v-alert--outline': this.outline
  80. },
  81. directives: [{
  82. name: 'show',
  83. value: this.isActive
  84. }],
  85. on: this.$listeners
  86. }), children);
  87. if (!this.transition) return alert;
  88. return h('transition', {
  89. props: {
  90. name: this.transition,
  91. origin: this.origin,
  92. mode: this.mode
  93. }
  94. }, [alert]);
  95. }
  96. });
  97. // Components
  98. //# sourceMappingURL=VAlert.js.map