<template>
  <widget-wrapper
    v-bind="$props"
    v-slot="{ inputEvents }"
    v-show="!isHidden"
    class="q-my-md"
  >
    <base-label-value :padded-label="paddedGroups">
      <template v-slot:label>
        {{ fieldNode.label ? fieldNode.label : '' }}
      </template>
      <template v-slot:value>
        <q-input
          outlined
          disable
          class="arm-text-area"
          ref="input"
          dense
          :readonly="true"
          :value="currentValue"
          :rows="3"
          type="textarea"
          autogrow
        />
      </template>
    </base-label-value>
  </widget-wrapper>
</template>

<script lang="ts">
import { Component, Prop } from 'vue-property-decorator';
import StringInput from './StringInput';
import { WidgetWrapper } from '@devsun/form-generator/dist';
import { QInput } from 'quasar';

@Component({
  components: {
    QInput,
    WidgetWrapper,
  },
})
export default class CardTextArea extends StringInput {
  @Prop({}) hideNulls!: boolean;
  @Prop({}) paddedGroups!: boolean;

  get isHidden(): boolean {
    return this.hideNulls && !this.currentValue;
  }
}
</script>
