<template>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox name="颜色">
      <SettingItem name="">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.labelColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.labelColor = option.labelColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="大小">
      <SettingItem name="">
        <n-input-number
          v-model:value="optionData.labelSize"
          size="small"
          :min="10"
        ></n-input-number>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox name="文本">
      <SettingItem name="">
        <n-input
          size="small"
          v-model:value="optionData.labelText"
          placeholder="请输入"
        />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox
      :name="`颜色-${index + 1}`"
      v-for="(item, index) in optionData.valColors"
      :key="index"
    >
      <SettingItem name="颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.valColors[index]"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.valColors[index] = option.valColors[index]"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="大小">
      <SettingItem name="">
        <n-input-number
          v-model:value="optionData.valSize"
          size="small"
          :min="10"
        ></n-input-number>
      </SettingItem>
      <SettingItem name="粗细">
        <n-input-number v-model:value="optionData.valFlod" size="small" :min="400"></n-input-number>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
</template>

<script setup lang="ts">
import { PropType } from 'vue'
import {
  CollapseItem,
  SettingItemBox,
  SettingItem
} from '@/components/Pages/ChartItemSetting'
import { option } from './config'

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