暫無描述

index.js 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  4. var inherits = require('../inherits-c86d64c1.js');
  5. var React = require('react');
  6. var React__default = _interopDefault(React);
  7. require('react-dom');
  8. require('../Modal/index.js');
  9. var styleInject_es = require('../style-inject.es-dcee06b6.js');
  10. require('../defineProperty-ba7cd53d.js');
  11. require('../index-4c407188.js');
  12. var antd = require('antd');
  13. var WantedPublishView = require('../WantedPublishView/index.js');
  14. var WantedPublish = require('../WantedPublish-761aab8e.js');
  15. var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAFNElEQVRYR82Yf0jcdRjH33enp1NbTQ3FdKhTY64hTTsURc6keQeSqIPSQJIiMHM3zj8ST/BE/And+c8wmSSMomHl4EaaP2aeuq/R1MwrraEgLVbLXcvpReY847l9v3I7774/LKUHjuN79/k8z+v7+fG8n89Hhv+pyf4F1xEAxwE8BSAIQDAAPwB/AnCwnzsAVgHsSI0jFcwfwEkA8QAiRAYj0BUACwDsIvtALJgcwLMA0tjREevfs90tADcBbAg5EAN2FEAegFAhZyL/3wYwBeB7vvZCYFEAzgIIEBlUSjMCYwA4vXXiA6N1lAuApvGg7DaAL7zB+QILB1DA7rKDguL80shNegbxBkZbv4jd/gcNxfmfYHftbjxvYDR9CYdFxMahDfExm/tcP3mC0RQWHzIUF+5HAGPcgydYPoBn+MCSk5ODm5ubs4qKigadTq8b6rHuFRUVcYmJicf0ev2swAuTOnwC4L7niD0J4FW+zvHx8YEMw+gjIiKOz8zM3MjIyPhwa2vLp9xUV1cntra2VioUCv+WlpYug8EwLwD3H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BnPiPR4524CAAnwlXCIzjOc3e9AhKlogXoCspOnnz5jSxYBSPLlaeB/AcAFfZLNHuAvgKwK9i+kkB4/xRjqP6jXSQhJpPKUi4aYToc08MEF8ek9KfRo675qRv7qqTu+6kVLAv28+I7SuQ1E7/AHTQdDZ7M6+KAAAAAElFTkSuQmCC";
  16. var css = ".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";
  17. var styles = {
  18. "wantedWrapper": "WantedPublishPopover_wantedWrapper__3CrCz",
  19. "closeBtnWrapper": "WantedPublishPopover_closeBtnWrapper__1KV58",
  20. "closeBtn": "WantedPublishPopover_closeBtn__1aBMB"
  21. };
  22. styleInject_es.styleInject(css);
  23. var WantedPublishPopover =
  24. /*#__PURE__*/
  25. function (_WatnedPublishBase) {
  26. inherits._inherits(WantedPublishPopover, _WatnedPublishBase);
  27. function WantedPublishPopover(props) {
  28. var _this;
  29. inherits._classCallCheck(this, WantedPublishPopover);
  30. _this = inherits._possibleConstructorReturn(this, inherits._getPrototypeOf(WantedPublishPopover).call(this, props));
  31. _this.handleConfirmButton = function (containerRef) {
  32. var handleConfirm = _this.props.handleConfirm;
  33. if (handleConfirm) {
  34. var value = _this.formatCurrentWanted(_this.state.current_wanted);
  35. handleConfirm(_this.formatResult(value), containerRef);
  36. }
  37. _this.setState({
  38. visible: false
  39. });
  40. };
  41. _this.state = {
  42. visible: false,
  43. current_wanted: null
  44. };
  45. return _this;
  46. }
  47. inherits._createClass(WantedPublishPopover, [{
  48. key: "renderInitView",
  49. value: function renderInitView() {
  50. var _this2 = this;
  51. var current_wanted = this.state.current_wanted;
  52. return React__default.createElement(WantedPublishView.default, Object.assign({
  53. type: "pop",
  54. current_wanted: current_wanted,
  55. InputWantedValueChange: function InputWantedValueChange(v) {
  56. return _this2.setState({
  57. current_wanted: v
  58. });
  59. },
  60. InputWantedPressEnter: function InputWantedPressEnter(v) {
  61. var value = _this2.formatCurrentWanted(v);
  62. if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
  63. _this2.setState({
  64. current_wanted: value,
  65. visible: false
  66. });
  67. },
  68. InputWantedOnBlur: function InputWantedOnBlur(v) {
  69. var value = _this2.formatCurrentWanted(v);
  70. _this2.setState({
  71. current_wanted: value
  72. });
  73. },
  74. InputWantedClear: function InputWantedClear() {
  75. _this2.setState({
  76. current_wanted: null
  77. }, function () {
  78. if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
  79. _this2.setState({
  80. visible: false
  81. });
  82. });
  83. },
  84. InputWantedConfirm: this.handleConfirmButton
  85. }, this.props.viewConfig));
  86. }
  87. }, {
  88. key: "render",
  89. value: function render() {
  90. var _this3 = this;
  91. var _this$props = this.props,
  92. children = _this$props.children,
  93. _this$props$popoverCo = _this$props.popoverConfig,
  94. popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo,
  95. currentWanted = _this$props.currentWanted;
  96. return React__default.createElement(antd.Popover, Object.assign({
  97. placement: "left",
  98. trigger: "click",
  99. visible: this.state.visible,
  100. onVisibleChange: function onVisibleChange(value) {
  101. if (value && currentWanted) {
  102. _this3.setState({
  103. current_wanted: +currentWanted
  104. });
  105. }
  106. _this3.setState({
  107. visible: value
  108. });
  109. }
  110. }, popoverConfig, {
  111. content: React__default.createElement("div", {
  112. className: styles.wantedWrapper
  113. }, React__default.createElement("div", {
  114. role: "button",
  115. tabIndex: 1,
  116. className: styles.closeBtnWrapper
  117. }, React__default.createElement("div", {
  118. className: styles.closeBtn,
  119. onClick: function onClick() {
  120. _this3.setState({
  121. visible: false
  122. });
  123. }
  124. }, React__default.createElement("img", {
  125. src: img,
  126. alt: "close wanted button"
  127. }))), this.renderInitView())
  128. }), children);
  129. }
  130. }]);
  131. return WantedPublishPopover;
  132. }(WantedPublish.WatnedPublishBase);
  133. exports.WantedPublishPopover = WantedPublishPopover;
  134. exports.default = WantedPublishPopover;
  135. //# sourceMappingURL=index.js.map