import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import React from "react";
import { i18n } from '@fishx/i18n';
import Form from "./Form";
import { ReactComponent as FormContainerIcon } from "@svgr/webpack!../../../assets/icons/form_container_setting.svg";
import { PreviewBox } from "../../../utils";
export default (function () {
  return {
    name: "pb-editor-page-element-form",
    type: "pb-editor-page-element",
    elementType: "form",
    toolbar: {
      title: i18n('PAGEBUIDER_ELEMENT_FORM_CONTAINER'),
      group: "pb-editor-element-group-container",
      toolBarPreview: /*#__PURE__*/React.createElement(FormContainerIcon, null),
      preview: function preview() {
        return /*#__PURE__*/React.createElement(PreviewBox, null, /*#__PURE__*/React.createElement(FormContainerIcon, null));
      }
    },
    settings: ["pb-editor-page-element-settings-form-set", "pb-editor-page-element-settings-style-set"],
    target: ['document'],
    create: function create() {
      var _options$data;

      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      return _objectSpread(_objectSpread({
        type: "form"
      }, options), {}, {
        elements: options.elements || [],
        data: _objectSpread(_objectSpread({}, options.data || {}), {}, {
          formInstance: null,
          // 表单实例化对象
          formSettings: _objectSpread({
            layout: "horizontal",
            // layout: "inline",
            colon: true,
            // initialValues: null,
            labelAlign: 'right',
            labelWidth: 100
          }, ((_options$data = options.data) === null || _options$data === void 0 ? void 0 : _options$data.formSettings) || {}),
          settings: _objectSpread({
            cols: {
              span: 24,
              offset: 0
            }
          }, options.settings || {})
        })
      });
    },
    render: function render(props) {
      return /*#__PURE__*/React.createElement(Form, props);
    }
  };
});
//# sourceMappingURL=index.js.map