import modalMeta from '../modal/meta';
import snippets from './snippets';

export default {
  snippets,
  componentName: 'PisellModal',
  title: 'pisell对话框',
  category: '反馈',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'PisellModal',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  props: [
    {
      name: 'platform',
      title: {
        label: '指定平台信息',
        tip: 'platform',
      },
      propType: { type: 'oneOf', value: ['h5', 'ipad', 'pc', null] },
      setter: [
        {
          componentName: 'RadioGroupSetter',
          props: {
            options: [
              {
                title: 'h5',
                value: 'h5',
              },
              {
                title: 'ipad',
                value: 'ipad',
              },
              {
                title: 'pc',
                value: 'pc',
              },
              {
                title: 'null',
                value: null,
              },
            ],
          },
        },
        'VariableSetter',
      ],
      defaultValue: null,
    },
    // {
    //   name: 'size',
    //   title: {
    //     label: 'size',
    //     tip: '弹框大小',
    //   },
    //   propType: { type: 'oneOf', value: ['large', 'middle', 'small'] },
    //   setter: [
    //     {
    //       componentName: 'RadioGroupSetter',
    //       props: {
    //         options: [
    //           {
    //             title: 'large',
    //             value: 'large',
    //           },
    //           {
    //             title: 'middle',
    //             value: 'middle',
    //           },
    //           {
    //             title: 'small',
    //             value: 'small',
    //           },
    //         ],
    //       },
    //     },
    //     'VariableSetter',
    //   ],
    //   defaultValue: 'middle',
    // },
    {
      name: 'headerDivider',
      title: { label: '顶部区域分割线', tip: '顶部区域分割线是否可见' },
      propType: 'bool',
      setter: 'BoolSetter',
      defaultValue: true,
    },
    {
      name: 'footerDivider',
      title: { label: '顶部区域分割线', tip: '顶部区域分割线是否可见' },
      propType: 'bool',
      setter: 'BoolSetter',
      defaultValue: true,
    },
    {
      name: 'mobileModalHeight',
      title: { label: '移动端高度', tip: '移动端展示时弹窗高度' },
      propType: { type: 'oneOfType', value: ['string', 'number'] },
      defaultValue: null,
    },
    {
      name: 'deleteButtonProps',
      title: { label: '删除按钮props', tip: '删除按钮props' },
      propType: 'object',
      setter: {
        componentName: 'ObjectSetter',
        defaultValue: null,
        props: {
          config: {
            items: [
              {
                name: 'disabled',
                title: { label: '是否可点击', tip: 'disabled' },
                propType: 'bool',
                setter: [
                  {
                    componentName: 'BoolSetter',

                    initialValue: false,
                  },
                  'VariableSetter',
                ],
                isRequired: true,
              },
            ],
          },
        },
      },
    },
    {
      name: "actions",
      title: { label: "操作按钮", tip: "footer中额外操作按钮" },
      propType: { type: "oneOfType", value: ["node"] },
      setter: ["SlotSetter"],
    },
    {
      name: 'cancelVisible',
      title: { label: '取消按钮', tip: '取消按钮是否可见' },
      propType: 'bool',
      setter: 'BoolSetter',
      defaultValue: true,
    },
    {
      name: 'okVisible',
      title: { label: '确认按钮', tip: '确认按钮是否可见' },
      propType: 'bool',
      setter: 'BoolSetter',
      defaultValue: true,
    },
    {
      name: 'header',
      title: { label: '展示header', tip: '是否展示header' },
      propType: 'bool',
      setter: 'BoolSetter',
      defaultValue: true,
    },
    ...modalMeta.props,
  ],
  configure: {
    component: {
      isContainer: true,
      isModal: true,
      rootSelector: '.pisell-lowcode-modal-content',
      nestingRule: {
        parentWhitelist: ['Page', 'Component'],
      },
    },
    supports: {
      style: true,
      events: [
        {
          name: 'afterClose',
          templete:
            "onCancel(${extParams}){\n// 完全关闭后的回调\nconsole.log('afterClose');}",
        },
        {
          name: 'onCancel',
          template:
            "onCancel(${extParams}){\n// 点击遮罩层或右上角叉或取消按钮的回调\nconsole.log('onCancel');}",
        },
        {
          name: 'onOk',
          template:
            "onOk(${extParams}){\n// 点击确定回调\nconsole.log('onOk');}",
        },
        {
          name: 'onDelete',
          template:
            "onDelete(${extParams}){\n// 点击删除回调\nconsole.log('onDelete');}",
        },
      ],
    },
  },
};
