<template>
  <div>
    <el-form :model="property" label-width="72px">
      <SerialNumber :property="property" />
      <BackgroundSet :property="property" />

      <el-form-item label="宽度">
        <el-input-number v-model="property.width" :min="1" :step="50" />
      </el-form-item>
      <el-form-item label="高度">
        <el-input-number v-model="property.height" :min="1" :step="50" />
      </el-form-item>
      <el-form-item label="行数">
        <el-input-number v-model="property.row_count" :min="1" />
      </el-form-item>
      <el-form-item label="列数">
        <el-input-number v-model="property.column_count" :min="1" />
      </el-form-item>
      <!-- <el-form-item label="自动换行">
        <el-radio-group v-model="property.auto_wrap">
          <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value">{{ label }}</el-radio>
        </el-radio-group>
      </el-form-item> -->
      <el-form-item label="填空方式">
        <el-radio-group v-model="property.fill_type">
          <el-radio v-for="{ value, label } in fillTypeList" :key="value" :label="value">
            {{ label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-divider />
      <el-form-item label="首行颜色">
        <el-color-picker v-model="property.first_line_color" />
      </el-form-item>
      <el-form-item label="首列颜色">
        <el-color-picker v-model="property.first_column_color" />
      </el-form-item>
      <el-form-item label="边框颜色">
        <el-color-picker v-model="property.border_color" />
      </el-form-item>
      <el-form-item label="装饰颜色">
        <el-color-picker v-model="property.decoration_color" />
      </el-form-item>
      <el-form-item label="拼音">
        <el-switch v-model="property.view_pinyin" active-value="true" inactive-value="false" />
      </el-form-item>
      <el-form-item label="拼音位置">
        <el-radio
          v-for="{ value, label } in pinyinPositionList"
          :key="value"
          v-model="property.pinyin_position"
          :label="value"
          :disabled="!isEnable(property.view_pinyin)"
        >
          {{ label }}
        </el-radio>
      </el-form-item>
      <el-form-item label="">
        <el-checkbox
          v-model="property.is_first_sentence_first_hz_pinyin_first_char_upper_case"
          :disabled="!isEnable(property.view_pinyin)"
          true-label="true"
          false-label="false"
          >句首大写</el-checkbox
        >
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';

import { getTableProperty, switchOption, alignTypeList, fillTypeList } from '@/views/book/courseware/data/table';
import { isEnable, pinyinPositionList } from '@/views/book/courseware/data/common';

export default {
  name: 'TableSetting',
  mixins: [SettingMixin],
  data() {
    return {
      property: getTableProperty(),
      switchOption,
      alignTypeList,
      pinyinPositionList,
      isEnable,
      fillTypeList,
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
@use '@/styles/mixin.scss' as *;

.el-form {
  @include setting-base;
}
</style>
