"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _locale = require("../../src/locale");
var _setters = require("../_setters");
var _snippets = _interopRequireDefault(require("./snippets"));
var _type = require("../_utils/treeDataRelationFn/type");
var _utils = require("../_utils/utils");
var _componentName = _interopRequireDefault(require("../_com-props/componentName"));
var _default = exports["default"] = {
  snippets: _snippets["default"],
  componentName: 'Modal',
  "group": (0, _locale.t)('modal.key_ENS3CgqiiNIk'),
  title: (0, _locale.t)('modal.key_S5Rb3c8Ee42Y'),
  category: (0, _locale.t)('modal.key_v8BHkxfIXk1q'),
  props: [{
    name: 'name',
    title: {
      label: (0, _locale.t)('modal.key_Kzx8uyJoNkPT'),
      tip: (0, _locale.t)('modal.key_oOKAFv7SPzKu')
    },
    isRequired: true,
    propType: 'string',
    setter: _setters.CStringOnlySetter,
    defaultValue: function defaultValue() {
      return "cr_" + (0, _utils.uuid)();
    },
    supportVariable: false,
    extraProps: {
      type: _type.PageStateFlag.Modal,
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          var exp = {
            "type": "JSExpression",
            "value": "this.state?." + _type.PageStateFlag.Modal + "?." + value + "?.visible",
            "mock": true
          };
          target.parent.setPropValue('open', exp);
          target.parent.setPropValue('componentName', value);
        }
      }
    }
  }, _componentName["default"], {
    name: 'title',
    title: {
      label: (0, _locale.t)('modal.key_Ibmj1lOvkYLP'),
      tip: (0, _locale.t)('modal.key_YYadZxCV2Jgk')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'cancelText',
    title: {
      label: (0, _locale.t)('modal.key_CKDl0Np5cfxo'),
      tip: (0, _locale.t)('modal.key_islKtUVJlJjT')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'okText',
    title: {
      label: (0, _locale.t)('modal.key_pPcPqhf0Sjuu'),
      tip: (0, _locale.t)('modal.key_rhLMaqf5GMIu')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'open',
    title: {
      label: (0, _locale.t)('modal.key_iw50lFEWs37b'),
      tip: (0, _locale.t)('modal.key_CStWvOwB0m20')
    },
    propType: 'bool',
    setter: 'BoolSetter',
    supportVariable: true,
    condition: function condition() {
      return false;
    }
  }, {
    name: 'centered',
    title: {
      label: (0, _locale.t)('modal.key_TGAepPCH64ax'),
      tip: (0, _locale.t)('modal.key_DJ3kaih4JRKd')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'closable',
    title: {
      label: (0, _locale.t)('modal.key_BVHRXTB9XEDq'),
      tip: (0, _locale.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: (0, _locale.t)('modal.key_WzZCoaQ6q90W'),
      tip: (0, _locale.t)('modal.key_HX0BBXaUFhXa')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    condition: function condition() {
      return false;
    }
  }, {
    name: 'refreshType',
    title: {
      label: (0, _locale.t)('drawer.refreshType'),
      tip: (0, _locale.t)('drawer.refreshTypeTip')
    },
    defaultValue: function defaultValue() {
      return "refresh";
    },
    setter: {
      componentName: 'SelectSetter',
      props: {
        options: [{
          title: (0, _locale.t)('drawer.refreshOption'),
          value: 'refresh'
        }, {
          title: (0, _locale.t)('drawer.dataRefreshOption'),
          value: 'dataRefresh'
        }, {
          title: (0, _locale.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: (0, _locale.t)('modal.key_M5R4zmd2jYEj'),
      tip: (0, _locale.t)('modal.key_p1DI9bqz8c67')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'keyboard',
    title: {
      label: (0, _locale.t)('modal.key_SV5uIGmEquKS'),
      tip: (0, _locale.t)('modal.key_jdrEQgyjaytx')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'mask',
    title: {
      label: (0, _locale.t)('modal.key_W7MwhwlgNE3P'),
      tip: (0, _locale.t)('modal.key_f12OLw6Max4p')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'maskClosable',
    title: {
      label: (0, _locale.t)('modal.key_LcPm2DwQI1D5'),
      tip: (0, _locale.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: (0, _locale.t)('modal.key_RoIrnj9UM6Hc'),
      tip: (0, _locale.t)('modal.key_ZVvUIlu5BbKE')
    },
    propType: 'object'
  }, {
    name: 'maskStyle',
    title: {
      label: (0, _locale.t)('modal.key_Vr8MDVHublca'),
      tip: (0, _locale.t)('modal.key_4FcvAEDH0BBI')
    },
    propType: 'object'
  }, {
    name: 'style',
    title: {
      label: (0, _locale.t)('modal.key_DFjwSrNB20PU'),
      tip: (0, _locale.t)('modal.key_okK7RRwepQe4')
    },
    propType: 'object'
  }, {
    name: 'onCancel',
    title: {
      label: (0, _locale.t)('modal.key_NeRJWqdsofVt'),
      tip: (0, _locale.t)('modal.key_2ptUL0j8wDF3')
    },
    propType: 'func'
  }, {
    name: 'onOk',
    title: {
      label: (0, _locale.t)('modal.key_9AhkZ9cVHI70'),
      tip: (0, _locale.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
    }
  }
};