"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

var _balloon = _interopRequireDefault(require("../../balloon"));

var _button = _interopRequireDefault(require("../../button"));

var _checkbox = _interopRequireDefault(require("../../checkbox"));

var _datePicker = _interopRequireDefault(require("../../date-picker"));

var _field = _interopRequireDefault(require("../../field"));

var _ = _interopRequireDefault(require(".."));

var _grid = _interopRequireDefault(require("../../grid"));

var _input = _interopRequireDefault(require("../../input"));

var _numberPicker = _interopRequireDefault(require("../../number-picker"));

var _radio = _interopRequireDefault(require("../../radio"));

var _range = _interopRequireDefault(require("../../range"));

var _react = _interopRequireDefault(require("react"));

var _reactDom = _interopRequireDefault(require("react-dom"));

var _select = _interopRequireDefault(require("../../select"));

var _switch = _interopRequireDefault(require("../../switch"));

var _timePicker = _interopRequireDefault(require("../../time-picker"));

var _upload = _interopRequireDefault(require("../../upload"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var FormItem = _["default"].Item;
var Option = _select["default"].Option;
var RangePicker = _datePicker["default"].RangePicker;
var Row = _grid["default"].Row,
    Col = _grid["default"].Col;
var formItemLayout = {
  labelCol: {
    span: 6
  },
  wrapperCol: {
    span: 14
  }
};

var Demo = /*#__PURE__*/function (_React$Component) {
  _inherits(Demo, _React$Component);

  var _super = _createSuper(Demo);

  function Demo(props) {
    var _this;

    _classCallCheck(this, Demo);

    _this = _super.call(this, props);

    _defineProperty(_assertThisInitialized(_this), "field", void 0);

    _this.field = new _field["default"](_assertThisInitialized(_this));
    return _this;
  }

  _createClass(Demo, [{
    key: "handleSubmit",
    value: function handleSubmit(value) {
      console.log('Form values：', value);
    }
  }, {
    key: "render",
    value: function render() {
      var init = this.field.init;
      return /*#__PURE__*/_react["default"].createElement(_["default"], _extends({}, formItemLayout, {
        field: this.field
      }), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "I'm the title\uFF1A"
      }, /*#__PURE__*/_react["default"].createElement("p", {
        className: "next-form-text-align"
      }, "The quick brown fox jumps over the lazy dog."), /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("a", {
        href: "#"
      }, "Link"))), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Password:"
      }, /*#__PURE__*/_react["default"].createElement(_balloon["default"], {
        trigger: /*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
          htmlType: "password"
        }, init('pass'))),
        align: "r",
        closable: false,
        triggerType: "hover"
      }, "input password")), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "NumberPicker:"
      }, /*#__PURE__*/_react["default"].createElement(_numberPicker["default"], {
        min: 1,
        max: 10,
        name: "numberPicker",
        defaultValue: 3
      }), /*#__PURE__*/_react["default"].createElement("span", null, "Something in here")), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Switch:",
        required: true
      }, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
        name: "switch",
        defaultChecked: true
      })), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Range:",
        required: true
      }, /*#__PURE__*/_react["default"].createElement(_range["default"], {
        defaultValue: 30 // @ts-ignore
        ,
        scales: [0, 100],
        marks: [0, 100],
        name: "range"
      })), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Select:",
        required: true
      }, /*#__PURE__*/_react["default"].createElement(_select["default"], {
        style: {
          width: 200
        },
        name: "select"
      }, /*#__PURE__*/_react["default"].createElement(Option, {
        value: "jack"
      }, "jack"), /*#__PURE__*/_react["default"].createElement(Option, {
        value: "lucy"
      }, "lucy"), /*#__PURE__*/_react["default"].createElement(Option, {
        value: "disabled",
        disabled: true
      }, "disabled"), /*#__PURE__*/_react["default"].createElement(Option, {
        value: "hugohua"
      }, "hugohua"))), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "DatePicker:",
        labelCol: {
          span: 6
        },
        required: true
      }, /*#__PURE__*/_react["default"].createElement(Row, null, /*#__PURE__*/_react["default"].createElement(FormItem, {
        style: {
          marginRight: 10,
          marginBottom: 0
        }
      }, /*#__PURE__*/_react["default"].createElement(_datePicker["default"], {
        name: "startDate"
      })), /*#__PURE__*/_react["default"].createElement(FormItem, {
        style: {
          marginBottom: 0
        }
      }, /*#__PURE__*/_react["default"].createElement(_datePicker["default"], {
        name: "endDate"
      })))), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "RangePicker:",
        labelCol: {
          span: 6
        },
        required: true
      }, /*#__PURE__*/_react["default"].createElement(RangePicker, {
        name: "rangeDate"
      })), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "TimePicker:",
        required: true
      }, /*#__PURE__*/_react["default"].createElement(_timePicker["default"], {
        name: "time"
      })), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Checkbox:"
      }, /*#__PURE__*/_react["default"].createElement(_checkbox["default"].Group, {
        name: "checkbox"
      }, /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
        value: "a"
      }, "option 1 "), /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
        value: "b"
      }, "option 2 "), /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
        disabled: true,
        value: "c"
      }, "option 3\uFF08disabled\uFF09"))), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Radio:"
      }, /*#__PURE__*/_react["default"].createElement(_radio["default"].Group, {
        name: "radio"
      }, /*#__PURE__*/_react["default"].createElement(_radio["default"], {
        value: "apple"
      }, "apple"), /*#__PURE__*/_react["default"].createElement(_radio["default"], {
        value: "banana"
      }, "banana"), /*#__PURE__*/_react["default"].createElement(_radio["default"], {
        disabled: true,
        value: "cherry"
      }, "cherry\uFF08disabled\uFF09"))), /*#__PURE__*/_react["default"].createElement(FormItem, {
        label: "Logo\uFF1A"
      }, /*#__PURE__*/_react["default"].createElement(_upload["default"], {
        action: "/upload.do",
        listType: "text",
        name: "upload"
      }, /*#__PURE__*/_react["default"].createElement(_button["default"], {
        type: "primary",
        style: {
          margin: '0 0 10px'
        }
      }, "Upload"))), /*#__PURE__*/_react["default"].createElement(Row, {
        style: {
          marginTop: 24
        }
      }, /*#__PURE__*/_react["default"].createElement(Col, {
        offset: "6"
      }, /*#__PURE__*/_react["default"].createElement(_["default"].Submit, {
        type: "primary",
        onClick: this.handleSubmit.bind(this)
      }, "Submit"))));
    }
  }]);

  return Demo;
}(_react["default"].Component);

_reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(Demo, null), document.getElementById('form-demo-13'));