<template>
  <CollapseItem name="内容" :expanded="true">
    <SettingItemBox name="内容" :alone="true">
      <n-input
        size="small"
        v-model:value="optionData.text"
        :minlength="1"
        type="text"
        placeholder="请输入"
      />
    </SettingItemBox> 
  </CollapseItem>
  <CollapseItem name="文字样式" :expanded="true">
    <SettingItem name="大小">
      <n-input-number v-model:value="optionData.textSize1" size="small" :min="12"></n-input-number>
    </SettingItem>
    <SettingItem name="大小">
      <n-input-number v-model:value="optionData.textSize2" size="small" :min="12"></n-input-number>
    </SettingItem>
    <SettingItemBox
      :name="`颜色-${index + 1}`"
      v-for="(item, index) in optionData.colors"
      :key="index"
    >
      <SettingItem name="颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.colors[index]"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.colors[index] = option.colors[index]"
        >
          恢复默认
        </n-button>
      </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>
