import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import * as React from "react";
// import { set } from "dot-prop-immutable";
import styled from "styled-components"; // import { useHandler } from "@whalecloud/page-builder/hooks/useHandler";
// import { PbElement } from "@whalecloud/page-builder/utils/types";
// import Slate from "@whalecloud/page-builder/editor/components/Slate";
// 根据form设置的labelWidth 渲染label宽度

var LabelContainer = /*#__PURE__*/styled('div', {
  target: "e1k7ga8m0",
  label: "LabelContainer"
})({
  position: "relative",
  display: 'inline-block'
});

var LabelRender = function LabelRender(props) {
  var label = props.label,
      formData = props.formData;
  var _formData$formSetting = formData.formSettings,
      formSettings = _formData$formSetting === void 0 ? {} : _formData$formSetting; // const onChange = useHandler(props, ({ element, updateElement }) => value => {
  //     const { text } = value.document.nodes[0].nodes[0].leaves[0];
  //     updateElement({ element: set(element, "data.formSettings.label", text) })
  // });
  // const TextRender = () => {
  //   return label ? <Slate value={label} onChange={onChange} /> : '';
  // }

  var styleProps = formSettings.labelWidth ? {
    width: formSettings.labelWidth
  } : {};
  return /*#__PURE__*/React.createElement(LabelContainer, {
    style: _objectSpread({}, styleProps)
  }, label);
}; // const mapDispatchToProps = dispatch => ({
//   updateElement: payload => {
//     dispatch({
//       type: 'appBuilder/updateAndFlattenElement',
//       payload,
//     });
//   },
// });
// export default connect<any, any, any>(null, mapDispatchToProps)(React.memo(LabelRender));


export default /*#__PURE__*/React.memo(LabelRender);
//# sourceMappingURL=LabelRender.js.map