<template>
  <CollapseItem name="数据设置" :expanded="true">
    <SettingItemBox name="主题设置">
      <SettingItem name="背景颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.backgroud"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="上方边距">
        <n-input-number
          v-model:value="optionData.dataStyle.margintop"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="左侧边距">
        <n-input-number
          v-model:value="optionData.dataStyle.marginleft"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <!-- <SettingItem name="组件宽度">
        <n-input-number
          v-model:value="optionData.dataStyle.topWidth"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem> -->
      <SettingItem name="组件间隔">
        <n-input-number v-model:value="optionData.dataStyle.gap" min="0" type="text" size="small" />
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="上方组件设置">
      <SettingItem name="上方距离">
        <n-input-number
          v-model:value="optionData.dataStyle.topMarginTop"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="图标大小">
        <n-input-number
          v-model:value="optionData.dataStyle.iconSize"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="图标横坐标位置">
        <n-input-number
          v-model:value="optionData.dataStyle.iconX"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="图标纵坐标位置">
        <n-input-number
          v-model:value="optionData.dataStyle.iconY"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <!-- <SettingItem name="组件宽度">
        <n-input-number
          v-model:value="optionData.dataStyle.topWidth"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="组件高度">
        <n-input-number
          v-model:value="optionData.dataStyle.topHeight"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem> -->
      <SettingItem name="组件边框颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.rectStrokeColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.dataStyle.rectStrokeColor = option.dataStyleClone.rectStrokeColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="组件边角颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.gFillColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.dataStyle.gFillColor = option.dataStyleClone.gFillColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="组件填充颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.rectFillColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.dataStyle.rectFillColor = option.dataStyleClone.rectFillColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="下方组件设置">
      <SettingItem name="数量字体颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.bottomFontColor1"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="数量字体大小">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomFontSize1"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem name="单位字体颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.bottomFontColor2"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="单位字体大小">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomFontSize2"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem name="标题字体颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.bottomFontColor3"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="标题字体大小">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomFontSize3"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem name="横线颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.lineColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="距离上方组件距离">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomMarginTop"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>

      <!-- <SettingItem name="组件宽度">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomWidth"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="组件高度">
        <n-input-number
          v-model:value="optionData.dataStyle.bottomHeight"
          min="0"
          type="text"
          size="small"
        />
      </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 fitList = [
    {
      value: 'fill',
      label: 'fill',
    },
    {
      value: 'contain',
      label: 'contain',
    },
    {
      value: 'cover',
      label: 'cover',
    },
    {
      value: 'scale-down',
      label: 'scale-down',
    },
    {
      value: 'none',
      label: 'none',
    },
  ];
</script>
