Bez popisu

index.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
  2. import React from 'react';
  3. import 'react-dom';
  4. import Modal from '../Modal/index.js';
  5. import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
  6. import '../defineProperty-18999f8e.js';
  7. import '../_commonjsHelpers-97e6d7b1.js';
  8. import '../index-c9837619.js';
  9. import 'antd';
  10. import WantedPublishView from '../WantedPublishView/index.js';
  11. import { W as WatnedPublishBase } from '../WantedPublish-b91e67a7.js';
  12. var css = ".WantedPublishModal_modalBg__3OlNh {\n background: white;\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n padding: 16px;\n text-align: center;\n border-radius: 4px;\n}\n";
  13. var styles = {
  14. "modalBg": "WantedPublishModal_modalBg__3OlNh"
  15. };
  16. styleInject(css);
  17. var WantedPublishModal =
  18. /*#__PURE__*/
  19. function (_WatnedPublishBase) {
  20. _inherits(WantedPublishModal, _WatnedPublishBase);
  21. function WantedPublishModal(props) {
  22. var _this;
  23. _classCallCheck(this, WantedPublishModal);
  24. _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishModal).call(this, props));
  25. _this.handleConfirmButton = function (containerRef) {
  26. var handleConfirm = _this.props.handleConfirm;
  27. if (handleConfirm) {
  28. var value = _this.formatCurrentWanted(_this.state.current_wanted);
  29. handleConfirm(value ? Number(value).toFixed(2) : value);
  30. }
  31. _this.setState({
  32. modalVisible: false
  33. });
  34. };
  35. _this.state = {
  36. modalVisible: false,
  37. current_wanted: null
  38. };
  39. return _this;
  40. }
  41. _createClass(WantedPublishModal, [{
  42. key: "renderMain",
  43. value: function renderMain() {
  44. var _this2 = this;
  45. var current_wanted = this.state.current_wanted;
  46. return React.createElement(WantedPublishView, Object.assign({
  47. wrapperClass: styles.modalBg,
  48. current_wanted: current_wanted,
  49. InputWantedValueChange: function InputWantedValueChange(v) {
  50. return _this2.setState({
  51. current_wanted: v
  52. });
  53. },
  54. InputWantedPressEnter: function InputWantedPressEnter(v) {
  55. var value = _this2.formatCurrentWanted(v);
  56. if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
  57. _this2.setState({
  58. current_wanted: value,
  59. modalVisible: false
  60. });
  61. },
  62. InputWantedOnBlur: function InputWantedOnBlur(v) {
  63. var value = _this2.formatCurrentWanted(v);
  64. if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
  65. _this2.setState({
  66. current_wanted: value
  67. });
  68. },
  69. InputWantedClear: function InputWantedClear() {
  70. _this2.setState({
  71. current_wanted: null
  72. }, function () {
  73. if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
  74. _this2.setState({
  75. modalVisible: false
  76. });
  77. });
  78. },
  79. InputWantedConfirm: this.handleConfirmButton
  80. }, this.props.viewConfig));
  81. }
  82. }, {
  83. key: "render",
  84. value: function render() {
  85. var _this3 = this;
  86. return React.createElement(React.Fragment, null, React.createElement("div", {
  87. onClick: function onClick() {
  88. return _this3.setState({
  89. modalVisible: true
  90. });
  91. }
  92. }, this.props.children), React.createElement(Modal, Object.assign({
  93. visible: this.state.modalVisible,
  94. onCancel: function onCancel() {
  95. _this3.setState({
  96. modalVisible: false
  97. });
  98. }
  99. }, this.props.modalConfig), this.renderMain()));
  100. }
  101. }]);
  102. return WantedPublishModal;
  103. }(WatnedPublishBase);
  104. export default WantedPublishModal;
  105. export { WantedPublishModal };
  106. //# sourceMappingURL=index.js.map