import _Box from "@alifd/next/es/box";
import _Switch from "@alifd/next/es/switch";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import React from 'react';
import { bizCssPrefix } from "../../variables";
import "./index.scss";
var CommonSwitch = /*#__PURE__*/function (_React$Component) {
  _inheritsLoose(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.createElement(_Switch, {
        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.createElement(_Box, {
      direction: "row",
      align: "center",
      className: bizCssPrefix + '-switch'
    }, this.renderColumn());
  };
  return CommonSwitch;
}(React.Component);
CommonSwitch.displayName = 'CommonSwitch';
CommonSwitch.displayName = 'CommonSwitch';
export default CommonSwitch;