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.

VBreadcrumbs.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. // Styles
  3. import '../../../src/stylus/components/_breadcrumbs.styl';
  4. // Components
  5. import { VBreadcrumbsDivider, VBreadcrumbsItem } from '.';
  6. // Mixins
  7. import Themeable from '../../mixins/themeable';
  8. // Utils
  9. import { deprecate } from '../../util/console';
  10. import mixins from '../../util/mixins';
  11. export default mixins(Themeable
  12. /* @vue/component */
  13. ).extend({
  14. name: 'v-breadcrumbs',
  15. props: {
  16. divider: {
  17. type: String,
  18. default: '/'
  19. },
  20. items: {
  21. type: Array,
  22. default: function _default() {
  23. return [];
  24. }
  25. },
  26. large: Boolean,
  27. justifyCenter: Boolean,
  28. justifyEnd: Boolean
  29. },
  30. computed: {
  31. classes: function classes() {
  32. return _extends({
  33. 'v-breadcrumbs--large': this.large,
  34. 'justify-center': this.justifyCenter,
  35. 'justify-end': this.justifyEnd
  36. }, this.themeClasses);
  37. }
  38. },
  39. mounted: function mounted() {
  40. if (this.justifyCenter) deprecate('justify-center', 'class="justify-center"', this);
  41. if (this.justifyEnd) deprecate('justify-end', 'class="justify-end"', this);
  42. if (this.$slots.default) deprecate('default slot', ':items and scoped slot "item"', this);
  43. },
  44. methods: {
  45. /* @deprecated */
  46. genChildren /* istanbul ignore next */: function genChildren() {
  47. if (!this.$slots.default) return undefined;
  48. var children = [];
  49. var createDividers = false;
  50. for (var i = 0; i < this.$slots.default.length; i++) {
  51. var elm = this.$slots.default[i];
  52. if (!elm.componentOptions || elm.componentOptions.Ctor.options.name !== 'v-breadcrumbs-item') {
  53. children.push(elm);
  54. } else {
  55. if (createDividers) {
  56. children.push(this.genDivider());
  57. }
  58. children.push(elm);
  59. createDividers = true;
  60. }
  61. }
  62. return children;
  63. },
  64. genDivider: function genDivider() {
  65. return this.$createElement(VBreadcrumbsDivider, this.$slots.divider ? this.$slots.divider : this.divider);
  66. },
  67. genItems: function genItems() {
  68. var items = [];
  69. var hasSlot = !!this.$scopedSlots.item;
  70. var keys = [];
  71. for (var i = 0; i < this.items.length; i++) {
  72. var item = this.items[i];
  73. keys.push(item.text);
  74. if (hasSlot) items.push(this.$scopedSlots.item({ item: item }));else items.push(this.$createElement(VBreadcrumbsItem, { key: keys.join('.'), props: item }, [item.text]));
  75. if (i < this.items.length - 1) items.push(this.genDivider());
  76. }
  77. return items;
  78. }
  79. },
  80. render: function render(h) {
  81. var children = this.$slots.default ? this.genChildren() : this.genItems();
  82. return h('ul', {
  83. staticClass: 'v-breadcrumbs',
  84. 'class': this.classes
  85. }, children);
  86. }
  87. });
  88. //# sourceMappingURL=VBreadcrumbs.js.map