"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _box = _interopRequireDefault(require("@alifd/next/lib/box"));
var _switch = _interopRequireDefault(require("@alifd/next/lib/switch"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _react = _interopRequireDefault(require("react"));
var _variables = require("../../variables");
require("./index.scss");
var CommonSwitch = /*#__PURE__*/function (_React$Component) {
  (0, _inheritsLoose2["default"])(CommonSwitch, _React$Component);
  function CommonSwitch(props) {
    var _this;
    _this = _React$Component.call(this, props) || this;
    _this.onChange = function (value) {
      _this.props.onChange && _this.props.onChange(value);
      _this.setState({
        selectData: value
      });
    };
    _this.renderColumn = function () {
      var _this$props = _this.props,
        isEdit = _this$props.isEdit,
        defaultChecked = _this$props.defaultChecked;
      return /*#__PURE__*/_react["default"].createElement(_switch["default"], {
        checkedChildren: "\u5F00",
        defaultChecked: defaultChecked,
        unCheckedChildren: "\u5173",
        onChange: function onChange(e) {
          return _this.onChange(e);
        },
        disabled: isEdit
      });
    };
    _this.state = {
      childList: [],
      selectData: []
    };
    return _this;
  }
  var _proto = CommonSwitch.prototype;
  _proto.render = function render() {
    return /*#__PURE__*/_react["default"].createElement(_box["default"], {
      direction: "row",
      align: "center",
      className: _variables.bizCssPrefix + '-switch'
    }, this.renderColumn());
  };
  return CommonSwitch;
}(_react["default"].Component);
CommonSwitch.displayName = 'CommonSwitch';
CommonSwitch.displayName = 'CommonSwitch';
var _default = CommonSwitch;
exports["default"] = _default;