<template>
  <CollapseItem name="设置" :expanded="true">
    <SettingItemBox name="整体设置">
      <SettingItem name="上方距离">
        <n-input-number
          v-model:value="optionData.dataStyle.marginTop"
          :min="0"
          size="small"
          placeholder="上方距离"
        />
      </SettingItem>
      <SettingItem name="左侧距离">
        <n-input-number
          v-model:value="optionData.dataStyle.marginLeft"
          :min="0"
          size="small"
          placeholder="左侧距离"
        />
      </SettingItem>
      <SettingItem name="单项上方距离">
        <n-input-number
          v-model:value="optionData.dataStyle.listMarginTop"
          :min="0"
          size="small"
          placeholder="单项上方距离"
        />
      </SettingItem>
      <SettingItem name="单项左侧距离">
        <n-input-number
          v-model:value="optionData.dataStyle.listMarginLeft"
          :min="0"
          size="small"
          placeholder="单项左侧距离"
        />
      </SettingItem>
      <SettingItem name="背景颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.backgroud"
        ></n-color-picker>
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="标题设置">
      <SettingItem name="标题点颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.titleStyle.dotColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="标题点大小">
        <n-input-number
          v-model:value="optionData.titleStyle.dotSize"
          :min="0"
          size="small"
          placeholder="标题宽度"
        />
      </SettingItem>
      <SettingItem name="标题点与文字间的距离">
        <n-input-number
          v-model:value="optionData.titleStyle.dotMarginRight"
          :min="0"
          size="small"
          placeholder="标题宽度"
        />
      </SettingItem>
      <SettingItem name="标题宽度">
        <n-input-number
          v-model:value="optionData.titleStyle.width"
          :min="0"
          size="small"
          placeholder="标题宽度"
        />
      </SettingItem>
      <SettingItem name="标题高度">
        <n-input-number
          v-model:value="optionData.titleStyle.height"
          :min="0"
          size="small"
          placeholder="标题高度"
        />
      </SettingItem>
      <SettingItem name="标题字体颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.titleStyle.fontcolor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="标题字体大小">
        <n-input-number v-model:value="optionData.titleStyle.fontsize" :min="0" size="small" />
      </SettingItem>
      <SettingItem name="标题排列方式">
        <n-select
          v-model:value="optionData.titleStyle.align"
          size="small"
          :options="[
            { label: '左侧', value: 'left' },
            { label: '中间', value: 'center' },
            { label: '右侧', value: 'right' },
          ]"
        />
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="内容设置">
      <SettingItem name="内容宽度">
        <n-input-number
          v-model:value="optionData.contentStyle.width"
          :min="0"
          size="small"
          placeholder="内容宽度"
        />
      </SettingItem>
      <SettingItem name="内容字体颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.contentStyle.fontcolor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="内容字体大小">
        <n-input-number v-model:value="optionData.contentStyle.fontsize" :min="0" size="small" />
      </SettingItem>
      <SettingItem name="内容排列方式">
        <n-select
          v-model:value="optionData.contentStyle.align"
          size="small"
          :options="[
            { label: '左侧', value: 'left' },
            { label: '中间', value: 'center' },
            { label: '右侧', value: 'right' },
          ]"
        />
      </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,
    },
  });
</script>
