<template>
  <CollapseItem name="数据设置" :expanded="true">
    <SettingItemBox name="主题设置">
      <SettingItem name="背景颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.backgroud"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="上方边距">
        <n-input-number
          v-model:value="optionData.dataStyle.margintop"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="左侧边距">
        <n-input-number
          v-model:value="optionData.dataStyle.marginleft"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="视频设置">
      <SettingItem>
        <n-checkbox v-model:checked="optionData.dataStyle.videoloop" size="small">
          循环播放
        </n-checkbox>
      </SettingItem>
      <SettingItem>
        <n-checkbox v-model:checked="optionData.dataStyle.videomuted" size="small">
          静音
        </n-checkbox>
      </SettingItem>
      <SettingItem name="视频类型">
        <n-select v-model:value="optionData.dataStyle.videofit" size="small" :options="fitList" />
      </SettingItem>
      <SettingItem name="视频宽度">
        <n-input-number
          v-model:value="optionData.dataStyle.videowidth"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="视频高度">
        <n-input-number
          v-model:value="optionData.dataStyle.videoheight"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
    </SettingItemBox>

    <SettingItemBox name="标题设置">
      <SettingItem name="标题字体颜色">
        <n-color-picker
          size="small"
          :modes="['rgb']"
          v-model:value="optionData.dataStyle.titleColor"
        ></n-color-picker>
      </SettingItem>
      <SettingItem name="标题字体大小">
        <n-input-number
          v-model:value="optionData.dataStyle.titleFontSize"
          :min="0"
          size="small"
          placeholder="标题字体大小"
        ></n-input-number>
      </SettingItem>
      <!-- <SettingItem name="标题宽度">
        <n-input-number
          v-model:value="optionData.dataStyle.titleWidth"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem>
      <SettingItem name="标题高度">
        <n-input-number
          v-model:value="optionData.dataStyle.titleHeight"
          min="0"
          type="text"
          size="small"
        />
      </SettingItem> -->

      <SettingItem name="与标题的间隔距离">
        <n-input-number
          v-model:value="optionData.dataStyle.titleMarginTop"
          min="0"
          type="text"
          size="small"
        />
      </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,
    },
  });

  // 适应类型
  const fitList = [
    {
      value: 'fill',
      label: 'fill',
    },
    {
      value: 'contain',
      label: 'contain',
    },
    {
      value: 'cover',
      label: 'cover',
    },
    {
      value: 'scale-down',
      label: 'scale-down',
    },
    {
      value: 'none',
      label: 'none',
    },
  ];
</script>
