import _extends from "@babel/runtime/helpers/extends";
import { uuid } from "../_utils/utils";
import { t } from "../../src/locale";
import { CDefaultValueSetter, CParentFlowEventListSetter, CTreeDataRelationSetter, CWebListSetter } from "../_setters";
import { BackgroundSize } from "../_utils/formKeyType";
import loopData from "../_com-props/loopData";
import componentKey from "../_com-props/componentKey";
import componentName from "../_com-props/componentName";
var Meta = {
  componentName: "WebRenderer",
  title: t("web-renderer.title"),
  group: t("web-renderer.group"),
  category: "Business",
  props: [loopData, componentKey, componentName, {
    name: "webRendererGid",
    title: {
      label: t("web-renderer.webGid"),
      tip: t("web-renderer.webGidTip")
    },
    setter: CWebListSetter
  }, {
    name: 'apiParams',
    title: {
      label: t('modal-default.key_dTxjwIh3VhjR'),
      tip: t('modal-default.key_xfWtbCjOuQ0A')
    },
    setter: CTreeDataRelationSetter,
    condition: function condition(target) {
      var data = target.getProps().getPropValue('webRendererGid');
      return data.webType === "default" && data.webGid.length > 0 || data.webType === "custom";
    }
  }, {
    name: 'parentFlowEvent',
    title: {
      label: t('modal-default.key_dTxjwIh4VhjR'),
      tip: t('modal-default.key_dTxjwIh4VhjR')
    },
    setter: CParentFlowEventListSetter,
    condition: function condition(target) {
      var data = target.getProps().getPropValue('webRendererGid');
      return data.webType === "default" && data.webGid.length > 0 || data.webType === "custom";
    }
  }, {
    name: "loadingStyleSetting",
    title: {
      label: t("web-renderer.loadingStyleSetting"),
      tip: t("web-renderer.loadingStyleSetting")
    },
    setter: {
      componentName: "ObjectSetter",
      props: {
        config: {
          items: [{
            name: "backgroundImage",
            title: {
              label: t("web-renderer.loadingBackgroundImage"),
              tip: t("web-renderer.loadingBackgroundImage")
            },
            setter: "CUploadImageDefaultSetter"
          }, {
            name: "backgroundColor",
            title: {
              label: t("web-renderer.loadingBackgroundColor"),
              tip: t("web-renderer.loadingBackgroundColor")
            },
            setter: "ColorSetter",
            defaultValue: "#212226"
          }, {
            name: "backgroundSize",
            title: {
              label: t("web-renderer.loadingBackgroundSize"),
              tip: t("web-renderer.loadingBackgroundSize")
            },
            setter: {
              componentName: "RadioGroupSetter",
              props: {
                options: [{
                  title: t("web-renderer.backgroundSizeAuto"),
                  value: ""
                }, {
                  title: t("web-renderer.backgroundSizeContain"),
                  value: BackgroundSize.Contain
                }, {
                  title: t("web-renderer.backgroundSizeCover"),
                  value: BackgroundSize.Cover
                }]
              },
              initialValue: ""
            }
          }, {
            name: "src",
            title: {
              label: t("web-renderer.loadingImageSrc"),
              tip: t("web-renderer.loadingImageSrcTip")
            },
            setter: "CUploadImageDefaultSetter"
          }, {
            name: "width",
            title: {
              label: t("web-renderer.loadingImageWidth") + " (px)",
              tip: t("web-renderer.loadingImageWidth")
            },
            setter: {
              componentName: "NumberSetter",
              props: {
                step: 1,
                min: 0
              },
              initialValue: 40
            }
          }, {
            name: "height",
            title: {
              label: t("web-renderer.loadingImageHeight") + " (px)",
              tip: t("web-renderer.loadingImageHeight")
            },
            setter: {
              componentName: "NumberSetter",
              props: {
                step: 1,
                min: 0
              },
              initialValue: 40
            }
          }]
        }
      }
    }
  }, {
    name: 'componentVisibleSetting',
    title: {
      label: t('web-renderer.componentVisibleSetting'),
      tip: t('web-renderer.componentVisibleSetting')
    },
    setter: {
      componentName: "ObjectSetter",
      props: {
        config: {
          items: [{
            name: "walletVisible",
            title: {
              label: t("web-renderer.walletVisible"),
              tip: t("web-renderer.walletVisible")
            },
            defaultValue: true,
            display: 'accordion',
            setter: CDefaultValueSetter
          }, {
            name: "localeVisible",
            title: {
              label: t("web-renderer.localeVisible"),
              tip: t("web-renderer.localeVisible")
            },
            defaultValue: true,
            display: 'accordion',
            setter: CDefaultValueSetter
          }]
        }
      }
    }
  }],
  configure: {
    supports: {
      events: false,
      style: true,
      loop: false,
      condition: false
    }
  }
};
var snippets = [{
  title: t("web-renderer.title"),
  screenshot: "https://d3r48att5ocy3q.cloudfront.net/p/240617/26e9930090b64a20a044c4b1f19f9858.jpg",
  schema: {
    componentName: "WebRenderer",
    props: {
      componentKey: "cr_" + uuid()
    }
  }
}];
export default _extends({}, Meta, {
  snippets: snippets
});