import snippets from './snippets';
import {
  formItemGeneralDataGroup, formItemGeneralOptionTypeGroup,
  formItemGeneralProps,
  generalItemMap, getFormItemGeneralAppearanceGroup,
  getFormItemGeneralInfoGroup, getFormItemValidateGroup
} from "../_utils/defaultSchema";

export default {
  snippets,
  componentName: 'FormItemCheckbox',
  title: '复选框(高级)',
  category: '无代码表单',
  group: '无代码组件',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'FormItemCheckbox',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  generalProps: [
    // 数据分组
    formItemGeneralDataGroup,
    // 信息分组
    getFormItemGeneralInfoGroup([
      generalItemMap['label'],
      generalItemMap['tooltip'],
      generalItemMap['extra'],
      generalItemMap['hideLabel'],
      generalItemMap['renderMode'],
    ]),
    // 选项类型分组
    formItemGeneralOptionTypeGroup,
    // 校验分组
    getFormItemValidateGroup([generalItemMap['requiredobj']]),
  ],
  configure: {
    props: [
      {
        name: 'children',
        title: { label: '内容', tip: '内容' },
        propType: 'string',
        setter: 'PisellI18nSetter',
        supportVariable: true,
      },
      {
        name: 'autoFocus',
        title: { label: '自动聚焦', tip: '自动获取焦点' },
        propType: 'bool',
        defaultValue: false,
        setter: 'BoolSetter',
        supportVariable: true,
      },
      {
        name: 'checked',
        title: { label: '当前值', tip: '指定当前是否选中' },
        propType: 'bool',
        defaultValue: false,
        setter: 'BoolSetter',
        supportVariable: true,
      },
      {
        name: 'defaultChecked',
        title: { label: '默认值', tip: '初始是否选中' },
        propType: 'bool',
        defaultValue: false,
        setter: 'BoolSetter',
        supportVariable: true,
      },
      {
        name: 'disabled',
        title: { label: '是否禁用', tip: '是否为禁用状态' },
        propType: 'bool',
        defaultValue: false,
        setter: 'BoolSetter',
        supportVariable: true,
      },
      {
        name: 'indeterminate',
        title: { label: '不确定状态', tip: 'indeterminate状态' },
        propType: 'bool',
        defaultValue: false,
        setter: 'BoolSetter',
        supportVariable: true,
      },
      {
        name: 'onChange',
        title: { label: '变化时回调函数', tip: '变化时回调函数' },
        propType: 'func',
      },
    ],
    supports: {
      style: true,
      events: [
        {
          name: 'onChange',
          template:
            "onChange(event,${extParams}){\n// 变化时回调函数\nconsole.log('onChange', event);}",
        },
      ],
    },
  },
};
