<template>
  <div :class="[`${prefixCls}__header pr-2 py-5 mb-4`, $attrs.class]">
    <BasicTitle :helpMessage="helpMessage" normal>
      <template v-if="title">
        <NodeHead :nodeName="title" v-if="hasLeftBorder" />
        <span v-else>{{ title }}</span>
      </template>
      <template v-else>
        <slot name="title"></slot>
      </template>
    </BasicTitle>
    <div :class="`${prefixCls}__action`">
      <slot name="action"></slot>
      <BasicArrow
        v-if="canExpan"
        up
        :expand="show"
        @click="$emit('expand')"
        :iconStyle="iconStyle"
      />
    </div>
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  import { BasicArrow, BasicTitle } from '/@/components/Basic';
  import { NodeHead } from '/@/components/ModalPanel/index';

  const props = {
    prefixCls: { type: String },
    helpMessage: {
      type: [Array, String] as PropType<string[] | string>,
      default: '',
    },
    title: { type: String },
    show: { type: Boolean },
    canExpan: { type: Boolean },
    hasLeftBorder: { type: Boolean },
    iconStyle: { type: Object },
  };

  export default defineComponent({
    components: { BasicArrow, BasicTitle, NodeHead },
    inheritAttrs: false,
    props,
    emits: ['expand'],
  });
</script>
