import { AntdIconSetter } from '../../../../materials/lowcode/_setters';
export default [
  {
    name: 'avatar.icon',
    title: { label: '头像图标', tip: 'icon | 设置头像的自定义图标' },
    setter: AntdIconSetter,
  },
  {
    name: 'avatar.shape',
    title: { label: '头像形状', tip: 'shape | 指定头像的形状' },
    setter: {
      componentName: 'RadioGroupSetter',
      props: {
        options: ['circle', 'square'],
      },
      initialValue: 'circle',
    },
  },
  {
    name: 'avatar.borderRadius',
    title: { label: '圆角度数', tip: 'borderRadius | 方形头像的圆角大小' },
    setter: ['NumberSetter', 'StringSetter'],
    defaultValue: 4,
    condition: (target: any) => {
      const shape = target.getProps().getPropValue('avatar.shape');
      return shape === 'square';
    },
  },
  {
    name: 'avatar.size',
    title: { label: '尺寸', tip: 'size | 设置头像的大小' },
    setter: [
      {
        componentName: 'SelectSetter',
        props: {
          options: [
            {
              label: 'xs',
              value: 'xs',
            },
            {
              label: 'sm',
              value: 'sm',
            },
            {
              label: 'md',
              value: 'md',
            },
            {
              label: 'lg',
              value: 'lg',
            },
            {
              label: 'xl',
              value: 'xl',
            },
            {
              label: 'xxl',
              value: 'xxl',
            },
          ],
        },
      },
      'NumberSetter',
      'StringSetter',
    ],
    defaultValue: 'md',
  },
  {
    name: 'avatar.useTextAvatar',
    title: {
      label: '使用文本头像',
      tip: 'useTextAvatar | 是否使用文本作为头像',
    },
    setter: 'BoolSetter',
    defaultValue: false,
  },
  {
    name: 'avatar.children',
    title: { label: '文本内容', tip: 'children | 文本头像的内容' },
    setter: 'StringSetter',
    condition: {
      type: 'JSFunction',
      value: "target => target.getProps().getPropValue('avatar.useTextAvatar')",
    },
  },
];
