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 5.0KB

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