"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _locale = require("../../src/locale");
var _snippets = _interopRequireDefault(require("./snippets"));
var _loopData = _interopRequireDefault(require("../_com-props/loopData"));
var _formKeyType = require("../_utils/formKeyType");
var _setters = require("../_setters");
var _componentKey = _interopRequireDefault(require("../_com-props/componentKey"));
var _componentName = _interopRequireDefault(require("../_com-props/componentName"));
var Meta = {
  componentName: "ToolVideo",
  title: "ToolVideo",
  docUrl: "",
  screenshot: "",
  devMode: "proCode",
  group: (0, _locale.t)("tool-video.key_0LG8nlYw0f50"),
  category: "Element",
  configure: {
    props: [_loopData["default"], _componentKey["default"], _componentName["default"], {
      name: "display",
      title: {
        label: (0, _locale.t)("page.display"),
        tip: (0, _locale.t)("page.displayTip")
      },
      propType: {
        type: "oneOf",
        value: [_formKeyType.VideoMade.Video, _formKeyType.VideoMade.VideoFrames]
      },
      setter: [{
        componentName: "RadioGroupSetter",
        props: {
          options: [{
            title: (0, _locale.t)("tool-video.key_YlYhW2fvideo"),
            value: _formKeyType.VideoMade.Video
          }, {
            title: (0, _locale.t)("tool-video.key_YlYhW2frames"),
            value: _formKeyType.VideoMade.VideoFrames
          }]
        }
      }, "VariableSetter"],
      defaultValue: _formKeyType.VideoMade.Video,
      extraProps: {
        setValue: function setValue(target, value) {
          target.parent.setPropValue("stepsVideo", []);
          // let val = target.getValue();
          // if (target.node.propsData.stepsVideo.length > 0) {
          //   Dialog.show({
          //     v2: true,
          //     title: t("tool-video.key_YlYhW2fititle"),
          //     content: t("tool-video.key_YlYhW2content"),
          //     onOk: () => {

          //     },
          //     onCancel: () => {
          //       if (val === "video") {
          //         target.parent.setPropValue("display", "videoframes");
          //       } else {
          //         target.parent.setPropValue("display", "video");
          //       }
          //     },
          //   });
          // }
        }
      }
    }, {
      display: "block",
      type: "group",
      items: [{
        name: "videoUrl",
        title: {
          label: "Web Link",
          tip: "url | Web Link"
        },
        propType: "string",
        setter: "StringSetter",
        condition: function condition(target) {
          var type = target.parent.getPropValue("display");
          return type === _formKeyType.VideoMade.Video;
        }
      }, {
        name: "uploadUrl",
        title: {
          label: (0, _locale.t)("tool-video.key_YlYhgW2xUplo"),
          tip: (0, _locale.t)("tool-video.key_YlYhgW2xUpfe")
        },
        propType: "string",
        setter: _setters.CVideoUploadSetter,
        extraProps: {
          setValue: function setValue(target, value) {
            if (value !== undefined && value !== "" && value.length !== 0) {
              target.parent.setPropValue("videoUrl", value);
              target.parent.setPropValue("uploadUrl", "");
            }
          }
        },
        condition: function condition(target) {
          var type = target.parent.getPropValue("display");
          return type === _formKeyType.VideoMade.Video;
        }
      }, {
        name: "controls",
        title: {
          label: (0, _locale.t)("tool-video.key_Tv3ar0I2Bf90"),
          tip: (0, _locale.t)("tool-video.key_U10uPHbV1qtm")
        },
        defaultValue: true,
        propType: "bool",
        setter: "BoolSetter",
        condition: function condition(target) {
          var type = target.parent.getPropValue("display");
          return type === _formKeyType.VideoMade.Video;
        }
      }]
    }, {
      display: "block",
      type: "group",
      items: [{
        name: "imgArrList",
        title: {
          label: (0, _locale.t)("tool-video.key_YlYhW2fimage"),
          tip: (0, _locale.t)("tool-video.key_YlYhW2fvidfr")
        },
        propType: "string",
        setter: _setters.CUploadBatchSetter,
        condition: function condition(target) {
          var type = target.parent.getPropValue("display");
          return type === _formKeyType.VideoMade.VideoFrames;
        }
      }, {
        name: "showRule",
        title: (0, _locale.t)("typographyText.key_7pYhGvcVjrOp"),
        display: "accordion",
        setter: {
          componentName: "ObjectSetter",
          props: {
            config: {
              items: [{
                name: "type",
                title: {
                  label: (0, _locale.t)("typographyText.key_IrNMKZtH0OR6"),
                  tip: (0, _locale.t)("typographyText.key_NlQnbupasWgL")
                },
                mode: "tag",
                defaultValue: function defaultValue() {
                  return "singular";
                },
                setter: {
                  componentName: "SelectSetter",
                  props: {
                    options: [{
                      title: (0, _locale.t)("tool-video.key_YlYhW2fimsece"),
                      value: "singular"
                    }, {
                      title: (0, _locale.t)("tool-video.key_YlYhW2fimrate"),
                      value: "total"
                    }]
                  },
                  initialValue: "singular"
                }
              }, {
                name: "secondsFrame",
                title: {
                  label: (0, _locale.t)("tool-video.key_YlYhW2fimsece"),
                  tip: (0, _locale.t)("tool-video.key_YlYhW2fimsece")
                },
                setter: {
                  componentName: "NumberSetter",
                  props: {
                    precision: 3
                  }
                },
                condition: function condition(target) {
                  var type = target.parent.getPropValue("type");
                  return type === "singular";
                }
              }, {
                name: "frameRate",
                title: {
                  label: (0, _locale.t)("tool-video.key_YlYhW2fimrate"),
                  tip: (0, _locale.t)("tool-video.key_YlYhW2fimrate")
                },
                setter: {
                  componentName: "NumberSetter",
                  props: {
                    precision: 3
                  }
                },
                condition: function condition(target) {
                  var type = target.parent.getPropValue("type");
                  return type === "total";
                }
              }]
            }
          }
        },
        condition: function condition(target) {
          var type = target.parent.getPropValue("display");
          return type === _formKeyType.VideoMade.VideoFrames;
        }
      }]
    }, {
      name: "coverSrc",
      title: {
        label: (0, _locale.t)("tool-video.key_FA0tRqqnGsie"),
        tip: (0, _locale.t)("tool-video.key_n2KfKMt16aBP")
      },
      propType: {
        type: "string",
        isRequired: true
      },
      setter: "StringSetter"
    }, {
      name: "updateSrc",
      title: {
        label: (0, _locale.t)("tool-video.key_US8tWvo4Wj5v"),
        tip: (0, _locale.t)("tool-video.key_4eynr37JiIF3")
      },
      setter: "CUploadImageDefaultSetter",
      extraProps: {
        setValue: function setValue(target, value) {
          if (value !== undefined && value !== "") {
            target.parent.setPropValue("coverSrc", value);
          }
        }
      }
    }, {
      name: "stepsVideo",
      title: {
        label: (0, _locale.t)("tool-video.groupManager"),
        tip: (0, _locale.t)("tool-video.groupManagerTip")
      },
      setter: _setters.CVideoStepsSetter
    }],
    supports: {
      style: true,
      events: false,
      loop: false,
      condition: false
    },
    component: {}
  },
  snippets: _snippets["default"]
};
var _default = exports["default"] = (0, _extends2["default"])({}, Meta, {
  snippets: _snippets["default"]
});