<template>
  <CollapseItem name="按钮" :expanded="true">
    <SettingItemBox name="" 
      v-for="(item, index) in optionData.navsArr"
      :key="index">
      <SettingItem name="名称">
        <n-input
          size="small"
          v-model:value="item.label"
          placeholder="请输入"
        />
      </SettingItem>
      <SettingItem name="查询语句">
        <n-input
          size="small"
          v-model:value="item.sql"
          placeholder="请输入"
        />
      </SettingItem>
    </SettingItemBox> 
  </CollapseItem>
  <CollapseItem name="标签" :expanded="true">
    <SettingItemBox name="样式">
      <SettingItem name="背景颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.navsBackground"
        ></n-color-picker>
      </SettingItem>    
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.navsBackground = option.navsBackground"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="样式">
      <SettingItem name="文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.navsColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.navsColor = option.navsColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.navsSize"
          :min="10"
        />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="样式">
      <SettingItem name="文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.navsCheckColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.navsCheckColor = option.navsCheckColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.navsCheckSize"
          :min="12"
        />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="样式">
      <SettingItem name="背景颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.navsCheckBackground"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.navsCheckBackground = option.navsCheckBackground"
        >
          恢复默认
        </n-button>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="标题" :expanded="true">
    <SettingItemBox name="样式">
      <SettingItem name="标题文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.titleColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.titleColor = option.titleColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="标题文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.titleSize"
          :min="16"
        />
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox name="样式">
      <SettingItem name="文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.desColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.desColor = option.desColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.desSize"
          :min="12"
        />
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
  <CollapseItem name="样式" :expanded="true">
    <SettingItemBox name="样式">
      <SettingItem name="文字颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.datasColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem>
        <n-button
          size="small"
          @click="optionData.datasColor = option.datasColor"
        >
          恢复默认
        </n-button>
      </SettingItem>
      <SettingItem name="文字大小">
        <n-input-number
          size="small"
          v-model:value="optionData.datasSize"
          :min="12"
        />
      </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>
