"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _locale = require("../../src/locale");
var _snippets = _interopRequireDefault(require("./snippets"));
var _setters = require("../_setters");
var _conditionRenderService = require("../_utils/conditionRenderService");
var _componentKey = _interopRequireDefault(require("../_com-props/componentKey"));
var _componentName = _interopRequireDefault(require("../_com-props/componentName"));
var _default = exports["default"] = {
  componentName: "Progress",
  label: (0, _locale.t)("progress.key_BZW9haNv6fsV"),
  group: (0, _locale.t)("progress.key_BZW9haNv6fsV"),
  category: "Element",
  props: [_componentKey["default"], _componentName["default"], {
    name: "percent",
    title: {
      label: (0, _locale.t)("progress.key_BZW9haNv6ftrc"),
      tip: (0, _locale.t)("progress.key_l3WSkTFaxqjba")
    },
    propType: "string",
    setter: {
      componentName: "NumberSetter",
      props: {
        precision: 2
      }
    },
    defaultValue: "30"
  }, {
    name: "defaultValue",
    title: {
      label: (0, _locale.t)("button.defaultValue"),
      tip: (0, _locale.t)("button.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("percent", exp);
        }
      }
    }
  }, {
    name: "type",
    title: {
      label: (0, _locale.t)("progress.key_BZW9haNv6fsc"),
      tip: (0, _locale.t)("progress.key_l3WSkTFaxqjaC")
    },
    propType: {
      type: "oneOf",
      value: ["line", "circle", "dashboard"]
    },
    setter: [{
      componentName: "RadioGroupSetter",
      props: {
        options: [{
          title: (0, _locale.t)("line"),
          value: "line"
        }, {
          title: (0, _locale.t)("circle"),
          value: "circle"
        }, {
          title: (0, _locale.t)("dashboard"),
          value: "dashboard"
        }]
      }
    }, "VariableSetter"],
    extraProps: {
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== "" && value !== "line") {
          target.parent.setPropValue("vertical", "right");
        }
      }
    },
    defaultValue: "line"
  }, {
    name: "vertical",
    title: {
      label: (0, _locale.t)("progress.key_BZW9hvertical"),
      tip: (0, _locale.t)("progress.key_BZverticaltip")
    },
    propType: {
      type: "oneOf",
      value: ["top", "bottom", "left", "right"]
    },
    setter: [{
      componentName: "RadioGroupSetter",
      props: {
        options: [{
          title: (0, _locale.t)("top"),
          value: "top"
        }, {
          title: (0, _locale.t)("bottom"),
          value: "bottom"
        }, {
          title: (0, _locale.t)("left"),
          value: "left"
        }, {
          title: (0, _locale.t)("right"),
          value: "right"
        }]
      }
    }, "VariableSetter"],
    condition: function condition(target) {
      var type = target.parent.getPropValue("type");
      return type === "line";
    },
    defaultValue: "right"
  }, {
    name: "trailStyle",
    title: (0, _locale.t)("progress.key_BZW9haNv6fshs"),
    type: "group",
    extraProps: {
      display: "entry"
    },
    items: [{
      name: "trailStyle",
      title: {
        label: (0, _locale.t)("progress.key_BZW9haNv6fshs"),
        tip: (0, _locale.t)("progress.key_l3WSkTFaxqjaA")
      },
      setter: "CStyleSetter",
      extraProps: {
        display: "block"
      }
    }],
    defaultValue: {
      backgroundColor: "#F5F5F5"
    }
  }, {
    name: "strokeStyle",
    title: (0, _locale.t)("progress.key_BZW9haNv6fsb"),
    type: "group",
    extraProps: {
      display: "entry"
    },
    items: [{
      name: "strokeStyle",
      title: {
        label: (0, _locale.t)("progress.key_BZW9haNv6fsb"),
        tip: (0, _locale.t)("progress.key_l3WSkTFaxqjaB")
      },
      setter: "CStyleSetter",
      extraProps: {
        display: "block"
      }
    }]
  }, {
    name: "textStyle",
    title: (0, _locale.t)("progress.key_BZW9haNv6ftba"),
    type: "group",
    extraProps: {
      display: "entry"
    },
    items: [{
      name: "textStyle",
      title: {
        label: (0, _locale.t)("progress.key_BZW9haNv6ftba"),
        tip: (0, _locale.t)("progress.key_l3WSkTFaxqjad")
      },
      setter: "CStyleSetter",
      extraProps: {
        display: "block"
      }
    }]
  }],
  configure: {
    supports: {
      events: false,
      style: true,
      loop: false,
      condition: false
    }
  },
  snippets: _snippets["default"]
};