text: "use strict";
  
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = void 0;
  
  var _form = _interopRequireDefault(require("antd-mobile/es/components/form"));
  
  var _button = _interopRequireDefault(require("antd-mobile/es/components/button"));
  
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
  
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
  
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
  
  var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
  
  var _react = _interopRequireWildcard(require("react"));
  
  var _FormRender = require("../../FormRender");
  
  require("./index.css");
  
  var citys = [{
    value: "浙江省",
    label: "浙江省",
    children: [{
      value: "宁波市",
      label: "宁波市"
    }, {
      value: "杭州市",
      label: "杭州市"
    }]
  }, {
    value: "上海市",
    label: "上海市",
    children: [{
      value: "浦东新区",
      label: "浦东新区"
    }, {
      value: "静安区",
      label: "静安区"
    }]
  }];
  var fruits = [{
    value: "苹果",
    label: "苹果"
  }, {
    value: "香蕉",
    label: "香蕉"
  }, {
    value: "菠萝",
    label: "菠萝"
  }, {
    value: "火龙果",
    label: "火龙果"
  }];
  var data = {
    name: "Hello World!",
    slider: 30,
    fruits: ["香蕉"],
    startDate: new Date(),
    stepper: 4,
    textarea: "\u4E0A\u6D77\u5E02\u6D66\u4E1C\u65B0\u533A\r\n\u4E0A\u6D77\u822A\u5929\u535A\u7269\u9986...",
    channels: ["旅游", "游戏"],
    switch: true,
    city: ["浙江省", "杭州市"],
    rate: 2.5
  };
  var channels = [{
    value: "科技",
    label: "科技"
  }, {
    value: "汽车",
    label: "汽车"
  }, {
    value: "体育",
    label: "体育"
  }, {
    value: "旅游",
    label: "旅游"
  }, {
    value: "游戏",
    label: "游戏"
  }];
  
  var DemoForm = /*#__PURE__*/function (_Component) {
    (0, _inherits2.default)(DemoForm, _Component);
  
    var _super = (0, _createSuper2.default)(DemoForm);
  
    function DemoForm() {
      var _this;
  
      (0, _classCallCheck2.default)(this, DemoForm);
  
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      _this = _super.call.apply(_super, [this].concat(args));
  
      _this.getFields = function () {
        return [{
          id: "name",
          label: "姓名",
          type: "string",
          widget: "inputItem",
          required: true,
          disabled: false
        }, {
          id: "city",
          label: "城市",
          type: "array",
          widget: "picker",
          required: false,
          disabled: false,
          data: citys
        }, {
          id: "startDate",
          label: "开始日期",
          type: "object",
          widget: "datePicker"
        }, {
          id: "fruits",
          label: "喜欢的水果",
          type: "array",
          widget: "selector",
          data: fruits,
          multiple: true
        }, {
          id: "slider",
          label: "评分",
          type: "number",
          widget: "slider",
          step: 10
        }, {
          id: "stepper",
          label: "数量",
          type: "number",
          widget: "stepper"
        }, {
          id: "textarea",
          label: "说明",
          type: "string",
          widget: "textArea",
          maxLength: 250,
          rows: 3
        }, {
          id: "channels",
          label: "频道",
          type: "array",
          widget: "checkbox",
          data: channels
        }, {
          id: "switch",
          label: "是否启用",
          type: "boolean",
          widget: "switch",
          checkedText: "ON",
          uncheckedText: "OFF"
        }, {
          id: "rate",
          label: "评分",
          type: "number",
          widget: "rate"
        }];
      };
  
      _this.handleFinish = function (values) {
        console.log("Form values:", values);
        if (_this.props.onFinish) _this.props.onFinish(values);
      };
  
      return _this;
    }
  
    (0, _createClass2.default)(DemoForm, [{
      key: "render",
      value: function render() {
        return /*#__PURE__*/_react.default.createElement("div", {
          className: "wtx-samples-form"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "wtx-samples-form-title"
        }, "\u57FA\u672C\u4FE1\u606F"), /*#__PURE__*/_react.default.createElement(_form.default, {
          initialValues: data,
          onFinish: this.handleFinish,
          footer: /*#__PURE__*/_react.default.createElement(_button.default, {
            block: true,
            type: "submit",
            color: "primary"
          }, "\u63D0\u4EA4")
        }, _FormRender.renderForm.call(this, {
          fields: this.getFields(),
          formDisabled: false
        })));
      }
    }]);
    return DemoForm;
  }(_react.Component);
  
  var _default = DemoForm;
  exports.default = _default;