<template>
  <CollapseItem name="按钮设置" :expanded="true">
    <n-tag type="primary">若按钮内容配置无响应，请在预览页面查看效果</n-tag>
    <SettingItemBox :alone="true" name="按钮内容">
      <SettingItem :alone="true">
        <n-input v-model:value="optionData.buttonName" type="text" size="small" />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="字体设置">
      <SettingItem name="字体颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.buttonStyle.color"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="字体大小">
        <n-input-number
          v-model:value="optionData.buttonStyle.fontSize"
          type="text"
          :min="0"
          size="small"
        />
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox name="图标宽度">
      <SettingItem name="文字与图标的间隔">
        <n-input-number
          v-model:value="optionData.buttonStyle.iconMarginLeft"
          type="text"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem>
        <n-checkbox v-model:checked="optionData.buttonStyle.iconFlag" size="small">
          是否展示图标
        </n-checkbox>
      </SettingItem>
      <SettingItem>
        <n-input-number
          v-model:value="optionData.buttonStyle.iconWidth"
          type="text"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem name="图标长度">
        <n-input-number
          v-model:value="optionData.buttonStyle.iconHeight"
          type="text"
          :min="0"
          size="small"
        />
      </SettingItem>
      <SettingItem name="图标颜色">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="optionData.buttonStyle.iconColor"
        ></n-color-picker>
      </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,
    },
  });
</script>
