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.

VExpansionPanelContent.js 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  2. import { VExpandTransition } from '../transitions';
  3. import Bootable from '../../mixins/bootable';
  4. import Toggleable from '../../mixins/toggleable';
  5. import Rippleable from '../../mixins/rippleable';
  6. import { inject as RegistrableInject } from '../../mixins/registrable';
  7. import VIcon from '../VIcon';
  8. import mixins from '../../util/mixins';
  9. import { consoleWarn } from '../../util/console';
  10. export default mixins(Bootable, Toggleable, Rippleable, RegistrableInject('expansionPanel', 'v-expansion-panel-content', 'v-expansion-panel')
  11. /* @vue/component */
  12. ).extend({
  13. name: 'v-expansion-panel-content',
  14. props: {
  15. disabled: Boolean,
  16. readonly: Boolean,
  17. expandIcon: {
  18. type: String,
  19. default: '$vuetify.icons.expand'
  20. },
  21. hideActions: Boolean,
  22. ripple: {
  23. type: [Boolean, Object],
  24. default: false
  25. }
  26. },
  27. data: function data() {
  28. return {
  29. height: 'auto'
  30. };
  31. },
  32. computed: {
  33. containerClasses: function containerClasses() {
  34. return {
  35. 'v-expansion-panel__container--active': this.isActive,
  36. 'v-expansion-panel__container--disabled': this.isDisabled
  37. };
  38. },
  39. isDisabled: function isDisabled() {
  40. return this.expansionPanel.disabled || this.disabled;
  41. },
  42. isReadonly: function isReadonly() {
  43. return this.expansionPanel.readonly || this.readonly;
  44. }
  45. },
  46. beforeMount: function beforeMount() {
  47. this.expansionPanel.register(this);
  48. // Can be removed once fully deprecated
  49. if (typeof this.value !== 'undefined') consoleWarn('v-model has been deprecated', this);
  50. },
  51. beforeDestroy: function beforeDestroy() {
  52. this.expansionPanel.unregister(this);
  53. },
  54. methods: {
  55. onKeydown: function onKeydown(e) {
  56. // Ensure element is the activeElement
  57. if (e.keyCode === 13 && this.$el === document.activeElement) this.expansionPanel.panelClick(this._uid);
  58. },
  59. onHeaderClick: function onHeaderClick() {
  60. this.isReadonly || this.expansionPanel.panelClick(this._uid);
  61. },
  62. genBody: function genBody() {
  63. return this.$createElement('div', {
  64. ref: 'body',
  65. class: 'v-expansion-panel__body',
  66. directives: [{
  67. name: 'show',
  68. value: this.isActive
  69. }]
  70. }, this.showLazyContent(this.$slots.default));
  71. },
  72. genHeader: function genHeader() {
  73. var children = [].concat(_toConsumableArray(this.$slots.header || []));
  74. if (!this.hideActions) children.push(this.genIcon());
  75. return this.$createElement('div', {
  76. staticClass: 'v-expansion-panel__header',
  77. directives: [{
  78. name: 'ripple',
  79. value: this.ripple
  80. }],
  81. on: {
  82. click: this.onHeaderClick
  83. }
  84. }, children);
  85. },
  86. genIcon: function genIcon() {
  87. var icon = this.$slots.actions || [this.$createElement(VIcon, this.expandIcon)];
  88. return this.$createElement('transition', {
  89. attrs: { name: 'fade-transition' }
  90. }, [this.$createElement('div', {
  91. staticClass: 'v-expansion-panel__header__icon',
  92. directives: [{
  93. name: 'show',
  94. value: !this.isDisabled
  95. }]
  96. }, icon)]);
  97. },
  98. toggle: function toggle(active) {
  99. var _this = this;
  100. if (active) this.isBooted = true;
  101. this.$nextTick(function () {
  102. return _this.isActive = active;
  103. });
  104. }
  105. },
  106. render: function render(h) {
  107. return h('li', {
  108. staticClass: 'v-expansion-panel__container',
  109. class: this.containerClasses,
  110. attrs: {
  111. tabindex: this.isReadonly || this.isDisabled ? null : 0,
  112. 'aria-expanded': Boolean(this.isActive)
  113. },
  114. on: {
  115. keydown: this.onKeydown
  116. }
  117. }, [this.$slots.header && this.genHeader(), h(VExpandTransition, [this.genBody()])]);
  118. }
  119. });
  120. //# sourceMappingURL=VExpansionPanelContent.js.map