"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _setters = require("../_setters");
var _snippets = _interopRequireDefault(require("./snippets"));
var _loopData = _interopRequireDefault(require("../_com-props/loopData"));
var _flowEventConfig = require("../_com-props/flowEventConfig");
var _conditionRenderService = require("../_utils/conditionRenderService");
var _locale = require("../../src/locale");
var _componentKey = _interopRequireDefault(require("../_com-props/componentKey"));
var _componentName = _interopRequireDefault(require("../_com-props/componentName"));
var _default = exports["default"] = {
  snippets: _snippets["default"],
  componentName: 'Image',
  title: (0, _locale.t)('image.title'),
  category: (0, _locale.t)('image.category'),
  group: (0, _locale.t)('image.group'),
  props: [_loopData["default"], _componentKey["default"], _componentName["default"],
  // {
  //   name: 'groupId',
  //   title: {
  //     label: t('image.groupId'),
  //     tip: t('image.groupIdTip'),
  //   },
  //   propType: "string",
  //   setter: CStringOnlySetter,
  // },
  // {
  //   name: 'groupIdDefault',
  //   title: {
  //     label: t('image.groupIdDefault'),
  //     tip: t('image.groupIdDefaultTip'),
  //   },
  //   setter: 'BoolSetter',
  //   condition: (target: any) => {
  //     return target.parent.getPropValue('groupId') !== undefined
  //   },
  // },
  {
    name: 'dictionaryKey',
    title: {
      label: (0, _locale.t)('typographyText.key_kbMeuiEtQtNa'),
      tip: (0, _locale.t)('typographyText.key_kbMeuiEtQtNb')
    },
    setter: 'DictionarySetter',
    props: {
      type: 'img'
    }
  }, {
    name: 'src',
    title: {
      label: (0, _locale.t)('image.src'),
      tip: (0, _locale.t)('image.srcTip')
    },
    propType: {
      type: 'string',
      isRequired: true
    }
  }, {
    name: 'updateSrc',
    title: {
      label: (0, _locale.t)('image.updateSrc'),
      tip: (0, _locale.t)('image.updateSrcTip')
    },
    setter: 'CUploadImageDefaultSetter',
    extraProps: {
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          target.parent.setPropValue('src', value);
        }
      }
    }
  }, {
    name: 'defaultValue',
    title: {
      label: (0, _locale.t)('image.defaultValue'),
      tip: (0, _locale.t)('image.defaultValueTip')
    },
    propType: 'string',
    defaultValue: '',
    setter: _setters.CComputedSetter,
    extraProps: {
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          var conditionRenderService = new _conditionRenderService.ConditionRenderService();
          conditionRenderService.load(value.data);
          var exp = conditionRenderService.getConditionExpression();
          target.parent.setPropValue('src', exp);
        }
      }
    }
  }, {
    name: 'alt',
    title: {
      label: (0, _locale.t)('image.alt'),
      tip: (0, _locale.t)('image.altTip')
    },
    propType: 'string'
  }, {
    name: 'preview',
    title: {
      label: (0, _locale.t)('image.preview'),
      tip: (0, _locale.t)('image.previewTip')
    },
    defaultValue: true,
    propType: 'bool'
  }, {
    name: 'fallback',
    title: {
      label: (0, _locale.t)('image.fallback'),
      tip: (0, _locale.t)('image.fallbackTip')
    },
    propType: 'string'
  }, {
    name: 'updateFallback',
    title: {
      label: (0, _locale.t)('image.updateFallback'),
      tip: (0, _locale.t)('image.updateFallbackTip')
    },
    setter: 'CUploadImageDefaultSetter',
    extraProps: {
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          target.parent.setPropValue('fallback', value);
        }
      }
    }
  },
  // {
  //   name: 'width',
  //   title: { label: t('image.width'), tip: t('image.widthTip') },
  //   propType: 'number',
  //   setter: CStringOnlySetter,
  // },
  // {
  //   name: 'height',
  //   title: { label: t('image.height'), tip: t('image.heightTip') },
  //   propType: 'number',
  //   setter: CStringOnlySetter,
  // },
  (0, _flowEventConfig.getFlowEventConfig)(), {
    title: (0, _locale.t)('image.buttonStatus'),
    display: 'block',
    type: 'group',
    items: [{
      name: 'hoverStyle',
      title: (0, _locale.t)('image.hoverStyle'),
      type: 'group',
      extraProps: {
        display: 'entry'
      },
      items: [{
        name: 'hoverStyle',
        title: {
          label: (0, _locale.t)('image.hoverStyle'),
          tip: (0, _locale.t)('image.hoverStyleTip')
        },
        setter: 'CStyleSetter',
        extraProps: {
          display: 'block'
        }
      }]
    }, {
      name: 'clickStyle',
      title: (0, _locale.t)('image.clickStyle'),
      type: 'group',
      extraProps: {
        display: 'entry'
      },
      items: [{
        name: 'clickStyle',
        title: {
          label: (0, _locale.t)('image.clickStyle'),
          tip: (0, _locale.t)('image.clickStyleTip')
        },
        setter: 'CStyleSetter',
        extraProps: {
          display: 'block'
        }
      }]
    }, {
      name: 'selectStyle',
      title: (0, _locale.t)('image.selectStyle'),
      type: 'group',
      extraProps: {
        display: 'entry'
      },
      items: [{
        name: 'selectStyle',
        title: {
          label: (0, _locale.t)('image.selectStyle'),
          tip: (0, _locale.t)('image.selectStyleTip')
        },
        setter: 'CStyleSetter',
        extraProps: {
          display: 'block'
        }
      }]
    }, {
      name: 'loadingStyle',
      title: (0, _locale.t)('button.loadingStyle'),
      type: 'group',
      extraProps: {
        display: 'entry'
      },
      items: [{
        name: 'loadingStyle',
        title: {
          label: (0, _locale.t)('button.loadingStyle'),
          tip: (0, _locale.t)('button.loadingStyleTip')
        },
        setter: 'CStyleSetter',
        extraProps: {
          display: 'block'
        }
      }]
    }, {
      name: 'errorStyle',
      title: (0, _locale.t)('button.errorStyle'),
      type: 'group',
      extraProps: {
        display: 'entry'
      },
      items: [{
        name: 'errorStyle',
        title: {
          label: (0, _locale.t)('button.errorStyle'),
          tip: (0, _locale.t)('button.errorStyleTip')
        },
        setter: 'CStyleSetter',
        extraProps: {
          display: 'block'
        }
      }]
    }]
  }],
  configure: {
    supports: {
      events: false,
      style: true,
      "loop": false,
      "condition": false
    }
  }
};