import { t } from "../../src/locale";
import { CStringOnlySetter } from "../_setters";
import snippets from "./snippets";
import { PageStateFlag } from "../_utils/treeDataRelationFn/type";
import { uuid } from "../_utils/utils";
import componentName from "../_com-props/componentName";
export default {
  snippets: snippets,
  componentName: 'Modal',
  "group": t('modal.key_ENS3CgqiiNIk'),
  title: t('modal.key_S5Rb3c8Ee42Y'),
  category: t('modal.key_v8BHkxfIXk1q'),
  props: [{
    name: 'name',
    title: {
      label: t('modal.key_Kzx8uyJoNkPT'),
      tip: t('modal.key_oOKAFv7SPzKu')
    },
    isRequired: true,
    propType: 'string',
    setter: CStringOnlySetter,
    defaultValue: function defaultValue() {
      return "cr_" + uuid();
    },
    supportVariable: false,
    extraProps: {
      type: PageStateFlag.Modal,
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          var exp = {
            "type": "JSExpression",
            "value": "this.state?." + PageStateFlag.Modal + "?." + value + "?.visible",
            "mock": true
          };
          target.parent.setPropValue('open', exp);
          target.parent.setPropValue('componentName', value);
        }
      }
    }
  }, componentName, {
    name: 'title',
    title: {
      label: t('modal.key_Ibmj1lOvkYLP'),
      tip: t('modal.key_YYadZxCV2Jgk')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'cancelText',
    title: {
      label: t('modal.key_CKDl0Np5cfxo'),
      tip: t('modal.key_islKtUVJlJjT')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'okText',
    title: {
      label: t('modal.key_pPcPqhf0Sjuu'),
      tip: t('modal.key_rhLMaqf5GMIu')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'open',
    title: {
      label: t('modal.key_iw50lFEWs37b'),
      tip: t('modal.key_CStWvOwB0m20')
    },
    propType: 'bool',
    setter: 'BoolSetter',
    supportVariable: true,
    condition: function condition() {
      return false;
    }
  }, {
    name: 'centered',
    title: {
      label: t('modal.key_TGAepPCH64ax'),
      tip: t('modal.key_DJ3kaih4JRKd')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'closable',
    title: {
      label: t('modal.key_BVHRXTB9XEDq'),
      tip: t('modal.key_ssjeMRDxzkJX')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  },
  // {
  //   name: 'closeIcon',
  //   title: { label: t('modal.key_L8bf69pKbkJX'), tip: t('modal.key_lLNOBh6BfbUd') },
  //   propType: 'node',
  // },
  // {
  //   name: 'confirmLoading',
  //   title: { label: t('modal.key_vzGJvilmLMya'), tip: t('modal.key_p5ACSGfAylwY') },
  //   propType: 'bool',
  //   defaultValue: false,
  //   setter: 'BoolSetter',
  //   supportVariable: true
  // },
  {
    name: 'destroyOnClose',
    title: {
      label: t('modal.key_WzZCoaQ6q90W'),
      tip: t('modal.key_HX0BBXaUFhXa')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    condition: function condition() {
      return false;
    }
  }, {
    name: 'refreshType',
    title: {
      label: t('drawer.refreshType'),
      tip: t('drawer.refreshTypeTip')
    },
    defaultValue: function defaultValue() {
      return "refresh";
    },
    setter: {
      componentName: 'SelectSetter',
      props: {
        options: [{
          title: t('drawer.refreshOption'),
          value: 'refresh'
        }, {
          title: t('drawer.dataRefreshOption'),
          value: 'dataRefresh'
        }, {
          title: t('drawer.noRefreshOption'),
          value: 'noRefresh'
        }]
      }
    },
    extraProps: {
      setValue: function setValue(target, value) {
        if (value) {
          var res = value === 'refresh';
          target.parent.setPropValue('destroyOnClose', res);
        }
      }
    }
  },
  // {
  //   name: 'containerName',
  //   title: { label: t('drawer.key_ghNpxbkvaFUE'), tip: t('drawer.key_qaIpQikiVXSC') },
  //   propType: 'string',
  //   setter: 'StringSetter',
  // },
  {
    name: 'forceRender',
    title: {
      label: t('modal.key_M5R4zmd2jYEj'),
      tip: t('modal.key_p1DI9bqz8c67')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'keyboard',
    title: {
      label: t('modal.key_SV5uIGmEquKS'),
      tip: t('modal.key_jdrEQgyjaytx')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'mask',
    title: {
      label: t('modal.key_W7MwhwlgNE3P'),
      tip: t('modal.key_f12OLw6Max4p')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'maskClosable',
    title: {
      label: t('modal.key_LcPm2DwQI1D5'),
      tip: t('modal.key_b4gLVrkBjY61')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  },
  // {
  //   name: 'footer',
  //   title: {
  //     label: t('modal.key_P8WRlRjs9Db3'),
  //     tip: t('modal.key_Aeg4ND74Vf2e'),
  //   },
  //   propType: { type: 'oneOfType', value: ['string', 'node'] },
  // },
  // {
  //   name: 'okType',
  //   title: { label: t('modal.key_cmCTRLSkuY5z'), tip: t('modal.key_6lAxMaM2vrGC') },
  //   propType: { type: 'oneOf', value: ['default', 'small'] },
  //   setter: {
  //     componentName: 'RadioGroupSetter',
  //     props: {
  //       options: [
  //         {
  //           title: 'primary',
  //           value: 'primary',
  //         },
  //         {
  //           title: 'ghost',
  //           value: 'ghost',
  //         },
  //         {
  //           title: 'dashed',
  //           value: 'dashed',
  //         },
  //         {
  //           title: 'link',
  //           value: 'link',
  //         },
  //         {
  //           title: 'text',
  //           value: 'text',
  //         },
  //         {
  //           title: 'default',
  //           value: 'default',
  //         },
  //       ],
  //     },
  //   },
  // },
  // {
  //   name: 'okButtonProps',
  //   title: { label: t('modal.key_sSaGlrX2HgzG'), tip: t('modal.key_mIBEfVfSco2M') },
  //   propType: 'object',
  //   setter: {
  //     componentName: 'ObjectSetter',
  //     props: {
  //       config: {
  //         items: [
  //           {
  //             name: 'disabled',
  //             title: { label: t('modal.key_jWVYAwr6L5Yd'), tip: 'disabled' },
  //             propType: 'bool',
  //             setter: [
  //               {
  //                 componentName: 'BoolSetter',

  //                 initialValue: false,
  //               },
  //               'VariableSetter',
  //             ],
  //             isRequired: true,
  //           },
  //         ],
  //       },
  //     },
  //   },
  // },
  {
    name: 'bodyStyle',
    title: {
      label: t('modal.key_RoIrnj9UM6Hc'),
      tip: t('modal.key_ZVvUIlu5BbKE')
    },
    propType: 'object'
  }, {
    name: 'maskStyle',
    title: {
      label: t('modal.key_Vr8MDVHublca'),
      tip: t('modal.key_4FcvAEDH0BBI')
    },
    propType: 'object'
  }, {
    name: 'style',
    title: {
      label: t('modal.key_DFjwSrNB20PU'),
      tip: t('modal.key_okK7RRwepQe4')
    },
    propType: 'object'
  }, {
    name: 'onCancel',
    title: {
      label: t('modal.key_NeRJWqdsofVt'),
      tip: t('modal.key_2ptUL0j8wDF3')
    },
    propType: 'func'
  }, {
    name: 'onOk',
    title: {
      label: t('modal.key_9AhkZ9cVHI70'),
      tip: t('modal.key_8FxHE1cTl3i5')
    },
    propType: 'func'
  }],
  configure: {
    component: {
      isContainer: true,
      isModal: true,
      rootSelector: '.ant-modal-content',
      nestingRule: {
        parentWhitelist: ['Page', 'Component']
      }
    },
    supports: {
      events: false,
      style: true,
      "loop": false,
      "condition": false
    }
  }
};