"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: 'ModalDefault',
  "group": (0, _locale.t)('modal-default.key_s3RC1K1yvIpG'),
  title: (0, _locale.t)('modal-default.key_31LKuM8WQbh4'),
  category: (0, _locale.t)('modal-default.key_IOKH2HjSVvxX'),
  props: [{
    name: 'name',
    title: {
      label: (0, _locale.t)('modal-default.key_qojkRsjJK6py'),
      tip: (0, _locale.t)('modal-default.key_tdZMJoMN2gND')
    },
    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);
        }
      }
    }
  }, {
    name: 'open',
    title: {
      label: (0, _locale.t)('modal-default.key_Iji7pXOqTnJP'),
      tip: (0, _locale.t)('modal-default.key_ndqX7F1Ty4ix')
    },
    propType: 'bool',
    setter: 'BoolSetter',
    supportVariable: true,
    condition: function condition() {
      return false;
    }
  }, _componentName["default"], {
    name: 'title',
    title: {
      label: (0, _locale.t)('modal-default.key_ycOwukpENA7M'),
      tip: (0, _locale.t)('modal-default.key_fUw5uFQpiAs6')
    },
    propType: {
      type: 'oneOfType',
      value: ['string', 'node']
    }
  }, {
    name: 'apiParams',
    title: {
      label: (0, _locale.t)('modal-default.key_dTxjwIh3VhjR'),
      tip: (0, _locale.t)('modal-default.key_xfWtbCjOuQ0A')
    },
    setter: _setters.CTreeDataRelationSetter,
    extraProps: {
      componentName: 'ModalDefault'
    }
  }, {
    name: 'closeConfig',
    title: {
      label: (0, _locale.t)('modal-default.key_HJ5dlbSuGXWn'),
      tip: (0, _locale.t)('modal-default.key_YuYBBcrQnTcN')
    },
    supportVariable: false,
    propType: {
      type: 'oneOf',
      value: ['open', 'close', 'default']
    },
    defaultValue: 'open',
    setter: [{
      componentName: 'RadioGroupSetter',
      props: {
        options: [{
          title: (0, _locale.t)('modal-default.key_46DeyGpRTYn0'),
          value: 'open'
        }, {
          title: (0, _locale.t)('modal-default.key_406eyCjRbpWV'),
          value: 'close'
        }, {
          title: (0, _locale.t)('modal-default.key_BjxwjM46HO3L'),
          value: 'default'
        }]
      }
    }]
  }, {
    name: 'defaultConfigStyle',
    title: (0, _locale.t)('modal-default.key_MqNHx7TJPjiR'),
    extraProps: {
      display: 'entry'
    },
    type: 'group',
    items: [{
      name: 'imageUrl',
      title: {
        label: (0, _locale.t)('modal-default.key_7cvR8ZbiJ1AD'),
        tip: (0, _locale.t)('modal-default.key_SZ3vfaGJ2qqF')
      },
      setter: 'CUploadImageDefaultSetter',
      defaultValue: ''
    }, {
      name: 'defaultImageStyle',
      display: 'accordion',
      title: {
        label: (0, _locale.t)('modal-default.key_Hec8xhuViulK'),
        tip: (0, _locale.t)('modal-default.key_ZSmuPxkL91Tc')
      },
      setter: 'CStyleSetter',
      defaultValue: {
        width: '14px',
        height: '14px'
      }
    }],
    condition: function condition(target) {
      return target.parent.getPropValue('closeConfig') === 'default';
    }
  }, {
    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: t('modal-default.key_blyh6EDCZC1g'), tip: t('modal-default.key_fUoRP3OItcP8') },
  //   propType: 'bool',
  //   defaultValue: true,
  //   setter: 'BoolSetter',
  //   supportVariable: true
  // },
  // {
  //   name: 'closeIcon',
  //   title: { label: t('modal-default.key_52MOSQsgxFlo'), tip: t('modal-default.key_GMjflGENr726') },
  //   propType: 'node',
  // },
  // {
  //   name: 'confirmLoading',
  //   title: { label: t('modal-default.key_cUZyV9FeIESy'), tip: t('modal-default.key_eVYpUTtDtEKc') },
  //   propType: 'bool',
  //   defaultValue: false,
  //   setter: 'BoolSetter',
  //   supportVariable: true
  // },
  {
    name: 'destroyOnClose',
    title: {
      label: (0, _locale.t)('modal-default.key_z6SdXYCTHtnt'),
      tip: (0, _locale.t)('modal-default.key_uOAvXYx6me85')
    },
    propType: 'bool',
    defaultValue: true,
    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-default.key_pZpa38QCx9Yf'),
      tip: (0, _locale.t)('modal-default.key_AlLlyGncfrjs')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'keyboard',
    title: {
      label: (0, _locale.t)('modal-default.key_lWCXAfIhmQIM'),
      tip: (0, _locale.t)('modal-default.key_cICnrJGLzACr')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'mask',
    title: {
      label: (0, _locale.t)('modal-default.key_81SKTaLP4RX4'),
      tip: (0, _locale.t)('modal-default.key_3b94ZDTzapFO')
    },
    propType: 'bool',
    defaultValue: true,
    setter: 'BoolSetter',
    supportVariable: true
  }, {
    name: 'maskClosable',
    title: {
      label: (0, _locale.t)('modal-default.key_93tyFSZbUyLO'),
      tip: (0, _locale.t)('modal-default.key_rT80Wcd8FKAB')
    },
    propType: 'bool',
    defaultValue: false,
    setter: 'BoolSetter',
    supportVariable: true
  }],
  configure: {
    component: {
      isContainer: true,
      isModal: true,
      rootSelector: '.modalDefaultBox',
      nestingRule: {
        parentWhitelist: ['Page', 'Component']
      }
    },
    supports: {
      events: false,
      style: true,
      "loop": false,
      "condition": false
    }
  }
};