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.

VChip.js 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. 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; };
  2. import '../../../src/stylus/components/_chips.styl';
  3. import mixins from '../../util/mixins';
  4. // Components
  5. import VIcon from '../VIcon';
  6. // Mixins
  7. import Colorable from '../../mixins/colorable';
  8. import Themeable from '../../mixins/themeable';
  9. import Toggleable from '../../mixins/toggleable';
  10. /* @vue/component */
  11. export default mixins(Colorable, Themeable, Toggleable).extend({
  12. name: 'v-chip',
  13. props: {
  14. close: Boolean,
  15. disabled: Boolean,
  16. label: Boolean,
  17. outline: Boolean,
  18. // Used for selects/tagging
  19. selected: Boolean,
  20. small: Boolean,
  21. textColor: String,
  22. value: {
  23. type: Boolean,
  24. default: true
  25. }
  26. },
  27. computed: {
  28. classes: function classes() {
  29. return _extends({
  30. 'v-chip--disabled': this.disabled,
  31. 'v-chip--selected': this.selected && !this.disabled,
  32. 'v-chip--label': this.label,
  33. 'v-chip--outline': this.outline,
  34. 'v-chip--small': this.small,
  35. 'v-chip--removable': this.close
  36. }, this.themeClasses);
  37. }
  38. },
  39. methods: {
  40. genClose: function genClose(h) {
  41. var _this = this;
  42. var data = {
  43. staticClass: 'v-chip__close',
  44. on: {
  45. click: function click(e) {
  46. e.stopPropagation();
  47. _this.$emit('input', false);
  48. }
  49. }
  50. };
  51. return h('div', data, [h(VIcon, '$vuetify.icons.delete')]);
  52. },
  53. genContent: function genContent(h) {
  54. return h('span', {
  55. staticClass: 'v-chip__content'
  56. }, [this.$slots.default, this.close && this.genClose(h)]);
  57. }
  58. },
  59. render: function render(h) {
  60. var data = this.setBackgroundColor(this.color, {
  61. staticClass: 'v-chip',
  62. 'class': this.classes,
  63. attrs: { tabindex: this.disabled ? -1 : 0 },
  64. directives: [{
  65. name: 'show',
  66. value: this.isActive
  67. }],
  68. on: this.$listeners
  69. });
  70. var color = this.textColor || this.outline && this.color;
  71. return h('span', this.setTextColor(color, data), [this.genContent(h)]);
  72. }
  73. });
  74. //# sourceMappingURL=VChip.js.map