<template>
  <CollapseItem name="标题设置" :expanded="true">
    <n-tag type="primary">若配置无响应，请在预览页面查看效果</n-tag>
    <SettingItemBox :alone="true" name="标题名称">
      <SettingItem name="标题名称">
        <n-input v-model:value="optionData.dataset.value" type="text" size="small" />
      </SettingItem>
      <SettingItem name="重复报警弹窗常用标题名称">
        <n-select v-model:value="optionData.dataset.value" size="small" :options="titleList" />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="标题设置">
      <SettingItem name="标题横坐标位置">
        <n-input-number
          v-model:value="optionData.dataStyle.x"
          :min="0"
          size="small"
          placeholder="宽度"
        ></n-input-number>
      </SettingItem>
      <SettingItem name="标题纵坐标位置">
        <n-input-number
          v-model:value="optionData.dataStyle.y"
          :min="0"
          size="small"
          placeholder="高度"
        ></n-input-number>
      </SettingItem>
      <SettingItem name="标题字体颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.dataStyle.fontColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="标题字体大小">
        <n-input-number
          v-model:value="optionData.dataStyle.fontSize"
          :min="0"
          size="small"
        ></n-input-number>
      </SettingItem>
      <SettingItem name="标题矩形左侧颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.dataStyle.leftColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button size="small" @click="optionData.dataStyle.leftColor = dataStyleClone.leftColor">
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="标题渐变颜色(始)">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.dataStyle.startColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button size="small" @click="optionData.dataStyle.startColor = dataStyleClone.startColor">
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="标题渐变颜色(终)">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.dataStyle.endColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button size="small" @click="optionData.dataStyle.endColor = dataStyleClone.endColor">
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
</template>

<script setup lang="ts">
  import { PropType, watch, ref } from 'vue';
  import { option } from './config';
  import { cloneDeep } from 'lodash-es';
  import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting';

  const props = defineProps({
    optionData: {
      type: Object as PropType<typeof option>,
      required: true,
    },
  });

  const titleList = [
    { label: '预警信息', value: '预警信息' },
    { label: '高空瞭望信息', value: '高空瞭望信息' },
    { label: '现场核查信息', value: '现场核查信息' },
    { label: '无人机实况信息', value: '无人机实况信息' },
    { label: '监控实况信息', value: '监控实况信息' },
  ];

  const dataStyleClone = {
    leftColor: '#00611A',
    startColor: '#1F6B55',
    endColor: '#0A392A',
  };
</script>
