Sin descripción

index.js 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import {
  2. a as _inherits,
  3. b as _classCallCheck,
  4. c as _possibleConstructorReturn,
  5. d as _getPrototypeOf,
  6. e as _createClass
  7. } from "../inherits-6cb67931.js";
  8. import React from "react";
  9. import { s as styleInject } from "../style-inject.es-1f59c1d0.js";
  10. import "../defineProperty-18999f8e.js";
  11. import "../_commonjsHelpers-97e6d7b1.js";
  12. import "../index-c9837619.js";
  13. import { Popover } from "antd";
  14. import WantedPublishView from "../WantedPublishView/index.js";
  15. var img =
  16. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAFNElEQVRYR82Yf0jcdRjH33enp1NbTQ3FdKhTY64hTTsURc6keQeSqIPSQJIiMHM3zj8ST/BE/And+c8wmSSMomHl4EaaP2aeuq/R1MwrraEgLVbLXcvpReY847l9v3I7774/LKUHjuN79/k8z+v7+fG8n89Hhv+pyf4F1xEAxwE8BSAIQDAAPwB/AnCwnzsAVgHsSI0jFcwfwEkA8QAiRAYj0BUACwDsIvtALJgcwLMA0tjREevfs90tADcBbAg5EAN2FEAegFAhZyL/3wYwBeB7vvZCYFEAzgIIEBlUSjMCYwA4vXXiA6N1lAuApvGg7DaAL7zB+QILB1DA7rKDguL80shNegbxBkZbv4jd/gcNxfmfYHftbjxvYDR9CYdFxMahDfExm/tcP3mC0RQWHzIUF+5HAGPcgydYPoBn+MCSk5ODm5ubs4qKigadTq8b6rHuFRUVcYmJicf0ev2swAuTOnwC4L7niD0J4FW+zvHx8YEMw+gjIiKOz8zM3MjIyPhwa2vLp9xUV1cntra2VioUCv+WlpYug8EwLwD3HYAbnmApANL5OlZVVZ0wm806hUKhpH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KlogXoCspOnnz5jSxYBSPLlaeB/AcAFfZLNHuAvgKwK9i+kkB4/xRjqP6jXSQhJpPKUi4aYToc08MEF8ek9KfRo675qRv7qqTu+6kVLAv28+I7SuQ1E7/AHTQdDZ7M6+KAAAAAElFTkSuQmCC";
  17. var css =
  18. ".WantedPublishPopover_wantedWrapper__3CrCz {\n width: 366px;\n height: 424px;\n font-size: 18px;\n text-align: center;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 {\n position: absolute;\n top: 10px;\n right: 16px;\n width: 20px;\n height: 20px;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58:focus {\n outline: none;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 > div.WantedPublishPopover_closeBtn__1aBMB {\n border: none;\n padding: 0px;\n margin: 0px;\n cursor: pointer;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 > div.WantedPublishPopover_closeBtn__1aBMB > img {\n width: 100%;\n}\n";
  19. var styles = {
  20. wantedWrapper: "WantedPublishPopover_wantedWrapper__3CrCz",
  21. closeBtnWrapper: "WantedPublishPopover_closeBtnWrapper__1KV58",
  22. closeBtn: "WantedPublishPopover_closeBtn__1aBMB"
  23. };
  24. styleInject(css);
  25. var WantedPublishPopover =
  26. /*#__PURE__*/
  27. (function(_React$Component) {
  28. _inherits(WantedPublishPopover, _React$Component);
  29. function WantedPublishPopover(props) {
  30. var _this;
  31. _classCallCheck(this, WantedPublishPopover);
  32. _this = _possibleConstructorReturn(
  33. this,
  34. _getPrototypeOf(WantedPublishPopover).call(this, props)
  35. );
  36. _this.handleClose = function() {
  37. var handleConfirm = _this.props.handleConfirm;
  38. if (handleConfirm) {
  39. _this.handleUpdateCurrentWanted(_this.state.current_wanted, function(
  40. value
  41. ) {
  42. handleConfirm(Number(value).toFixed(2));
  43. });
  44. }
  45. _this.setState({
  46. visible: false
  47. });
  48. };
  49. _this.clearCurrentWanted = function(cb) {
  50. _this.setState(
  51. {
  52. current_wanted: null
  53. },
  54. function() {
  55. return cb();
  56. }
  57. );
  58. };
  59. _this.handleUpdateCurrentWanted = function(value, afterUpdate) {
  60. if (!value) return;
  61. var result;
  62. result = value;
  63. if (parseInt("".concat(value), 10) === value) {
  64. result = Number(value);
  65. }
  66. if (!result) return;
  67. if (result > 10000) result = 10000;
  68. if (result < 5) result = 5;
  69. _this.setState(
  70. {
  71. current_wanted: result
  72. },
  73. function() {
  74. return afterUpdate && afterUpdate(result);
  75. }
  76. );
  77. };
  78. _this.state = {
  79. visible: false,
  80. current_wanted: null
  81. };
  82. return _this;
  83. }
  84. _createClass(WantedPublishPopover, [
  85. {
  86. key: "renderInitView",
  87. value: function renderInitView() {
  88. var _this2 = this;
  89. var current_wanted = this.state.current_wanted;
  90. return React.createElement(WantedPublishView, {
  91. type: "pop",
  92. current_wanted: current_wanted,
  93. InputWantedValueChange: function InputWantedValueChange(v) {
  94. return _this2.setState({
  95. current_wanted: v
  96. });
  97. },
  98. InputWantedPressEnter: function InputWantedPressEnter(v) {
  99. return _this2.handleUpdateCurrentWanted(v, _this2.handleClose);
  100. },
  101. InputWantedOnBlur: function InputWantedOnBlur(v) {
  102. return _this2.handleUpdateCurrentWanted(v);
  103. },
  104. InputWantedClear: function InputWantedClear() {
  105. return _this2.clearCurrentWanted(_this2.handleClose);
  106. },
  107. CloseFunction: this.handleClose
  108. });
  109. }
  110. },
  111. {
  112. key: "render",
  113. value: function render() {
  114. var _this3 = this;
  115. var _this$props = this.props,
  116. children = _this$props.children,
  117. _this$props$popoverCo = _this$props.popoverConfig,
  118. popoverConfig =
  119. _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo;
  120. return React.createElement(
  121. Popover,
  122. Object.assign(
  123. {
  124. placement: "left",
  125. trigger: "click",
  126. visible: this.state.visible,
  127. onVisibleChange: function onVisibleChange(value) {
  128. if (!value) {
  129. _this3.handleClose();
  130. }
  131. _this3.setState({
  132. visible: value
  133. });
  134. }
  135. },
  136. popoverConfig,
  137. {
  138. content: React.createElement(
  139. "div",
  140. {
  141. className: styles.wantedWrapper
  142. },
  143. React.createElement(
  144. "div",
  145. {
  146. role: "button",
  147. tabIndex: 1,
  148. className: styles.closeBtnWrapper
  149. },
  150. React.createElement(
  151. "div",
  152. {
  153. className: styles.closeBtn,
  154. onClick: this.handleClose
  155. },
  156. React.createElement("img", {
  157. src: img,
  158. alt: "close wanted button"
  159. })
  160. )
  161. ),
  162. this.renderInitView()
  163. )
  164. }
  165. ),
  166. children
  167. );
  168. }
  169. }
  170. ]);
  171. return WantedPublishPopover;
  172. })(React.Component);
  173. export default WantedPublishPopover;
  174. export { WantedPublishPopover };
  175. //# sourceMappingURL=index.js.map