<template>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox
      :name="`颜色-${index + 1}`"
      v-for="(item, index) in optionData.secBackground"
      :key="index"
    >
      <SettingItem name="颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.secBackground[index]"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.secBackground[index] = option.secBackground[index]"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox
      :name="`颜色-${index + 1}`"
      v-for="(item, index) in optionData.textColor"
      :key="index"
    >
      <SettingItem name="颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.textColor[index]"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.textColor[index] = option.textColor[index]"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItem name="文字大小">
      <n-input-number
        size="small"
        v-model:value="optionData.textSize"
        :min="10"
      />
    </SettingItem>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox>
      <SettingItem name="输入框颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.InpBackgroundColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.InpBackgroundColor = option.InpBackgroundColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox>
      <SettingItem name="输入框边框颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.InpBorderColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.InpBorderColor = option.InpBorderColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox>
      <SettingItem name="输入框文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.InpTextColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.InpTextColor = option.InpTextColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItem name="输入框文字大小">
      <n-input-number
        size="small"
        v-model:value="optionData.InpTextSize"
        :min="10"
      />
    </SettingItem>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox>
      <SettingItem name="表格文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.treeColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.treeColor = option.treeColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox>
      <SettingItem name="表格文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.treeSize"
          :min="10"
        />
      </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>
