Browse Source

dev: build

Roxas 4 years ago
parent
commit
aa25cab1bc
64 changed files with 1089 additions and 517 deletions
  1. 9
    9
      eslib/BraftEditor/index.js
  2. 1
    1
      eslib/BraftEditor/index.js.map
  3. 1
    1
      eslib/Common/index.d.ts
  4. 1
    1
      eslib/Common/index.js
  5. 19
    1
      eslib/Modal/index.d.ts
  6. 80
    2
      eslib/Modal/index.js
  7. 1
    1
      eslib/Modal/index.js.map
  8. 1
    1
      eslib/Payment/index.d.ts
  9. 2
    1
      eslib/Payment/index.js
  10. 1
    1
      eslib/Payment/index.js.map
  11. 1
    1
      eslib/WaitPayInfoView/index.d.ts
  12. 1
    1
      eslib/WaitPayInfoView/index.js
  13. 1
    1
      eslib/WaitPayInfoView/index.js.map
  14. 23
    0
      eslib/WantedPublish-b91e67a7.d.ts
  15. 45
    0
      eslib/WantedPublish-b91e67a7.js
  16. 1
    0
      eslib/WantedPublish-b91e67a7.js.map
  17. 5
    8
      eslib/WantedPublishModal/index.d.ts
  18. 41
    45
      eslib/WantedPublishModal/index.js
  19. 1
    1
      eslib/WantedPublishModal/index.js.map
  20. 4
    6
      eslib/WantedPublishPopover/index.d.ts
  21. 46
    45
      eslib/WantedPublishPopover/index.js
  22. 1
    1
      eslib/WantedPublishPopover/index.js.map
  23. 23
    4
      eslib/WantedPublishView/index.d.ts
  24. 82
    16
      eslib/WantedPublishView/index.js
  25. 1
    1
      eslib/WantedPublishView/index.js.map
  26. 3
    2
      eslib/index.js
  27. 1
    1
      eslib/index.js.map
  28. 10
    10
      lib/BraftEditor/index.js
  29. 1
    1
      lib/Common/index.d.ts
  30. 1
    0
      lib/Common/index.js
  31. 1
    1
      lib/Common/index.js.map
  32. 19
    1
      lib/Modal/index.d.ts
  33. 82
    3
      lib/Modal/index.js
  34. 1
    1
      lib/Modal/index.js.map
  35. 1
    1
      lib/Payment/index.d.ts
  36. 2
    0
      lib/Payment/index.js
  37. 1
    1
      lib/Payment/index.js.map
  38. 1
    1
      lib/WaitPayInfoView/index.d.ts
  39. 1
    1
      lib/WaitPayInfoView/index.js
  40. 1
    1
      lib/WaitPayInfoView/index.js.map
  41. 23
    0
      lib/WantedPublish-761aab8e.d.ts
  42. 50
    0
      lib/WantedPublish-761aab8e.js
  43. 1
    0
      lib/WantedPublish-761aab8e.js.map
  44. 5
    8
      lib/WantedPublishModal/index.d.ts
  45. 40
    44
      lib/WantedPublishModal/index.js
  46. 1
    1
      lib/WantedPublishModal/index.js.map
  47. 4
    6
      lib/WantedPublishPopover/index.d.ts
  48. 46
    45
      lib/WantedPublishPopover/index.js
  49. 1
    1
      lib/WantedPublishPopover/index.js.map
  50. 23
    4
      lib/WantedPublishView/index.d.ts
  51. 82
    16
      lib/WantedPublishView/index.js
  52. 1
    1
      lib/WantedPublishView/index.js.map
  53. 3
    0
      lib/index.js
  54. 1
    1
      lib/index.js.map
  55. 1
    2
      src/components/Common/Modal/index.tsx
  56. 2
    1
      src/components/Common/index.ts
  57. 46
    0
      src/components/Payment/BaseClassComponents/WantedPublish.tsx
  58. 33
    55
      src/components/Payment/WantedPublishModal/index.tsx
  59. 38
    61
      src/components/Payment/WantedPublishPopover/index.tsx
  60. 46
    45
      src/components/Payment/WantedPublishView/WantedPublishView.less
  61. 80
    40
      src/components/Payment/WantedPublishView/index.tsx
  62. 10
    7
      src/components/Payment/index.ts
  63. 1
    2
      stats.html
  64. 33
    3
      stories/Wanted.stories.tsx

+ 9
- 9
eslib/BraftEditor/index.js View File

@@ -1,5 +1,5 @@
1 1
 import React, { useState } from 'react';
2
-import reactDom from 'react-dom';
2
+import ReactDOM from 'react-dom';
3 3
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
4 4
 import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from '../_commonjsHelpers-97e6d7b1.js';
5 5
 import { _ as _slicedToArray } from '../slicedToArray-4cd9e6d3.js';
@@ -11069,7 +11069,7 @@ var DraftEditorTextNode = function (_React$Component) {
11069 11069
   }
11070 11070
 
11071 11071
   DraftEditorTextNode.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
11072
-    var node = reactDom.findDOMNode(this);
11072
+    var node = ReactDOM.findDOMNode(this);
11073 11073
     var shouldBeNewline = nextProps.children === '';
11074 11074
     !(node instanceof Element) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'node is not an Element') : invariant_1(false) : void 0;
11075 11075
     if (shouldBeNewline) {
@@ -11511,7 +11511,7 @@ var DraftEditorLeaf = function (_React$Component) {
11511 11511
     // Determine the appropriate target node for selection. If the child
11512 11512
     // is not a text node, it is a <br /> spacer. In this case, use the
11513 11513
     // <span> itself as the selection target.
11514
-    var node = reactDom.findDOMNode(this);
11514
+    var node = ReactDOM.findDOMNode(this);
11515 11515
     !node ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing node') : invariant_1(false) : void 0;
11516 11516
     var child = node.firstChild;
11517 11517
     !child ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing child') : invariant_1(false) : void 0;
@@ -11539,7 +11539,7 @@ var DraftEditorLeaf = function (_React$Component) {
11539 11539
    */
11540 11540
 
11541 11541
   DraftEditorLeaf.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
11542
-    var leafNode = reactDom.findDOMNode(this.leaf);
11542
+    var leafNode = ReactDOM.findDOMNode(this.leaf);
11543 11543
     !leafNode ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing leafNode') : invariant_1(false) : void 0;
11544 11544
     return leafNode.textContent !== nextProps.text || nextProps.styleSet !== this.props.styleSet || nextProps.forceSelection;
11545 11545
   };
@@ -12201,7 +12201,7 @@ var DraftEditorBlock = function (_React$Component) {
12201 12201
       return;
12202 12202
     }
12203 12203
 
12204
-    var blockNode = reactDom.findDOMNode(this);
12204
+    var blockNode = ReactDOM.findDOMNode(this);
12205 12205
     var scrollParent = Style_1.getScrollParent(blockNode);
12206 12206
     var scrollPosition = getScrollPosition_1(scrollParent);
12207 12207
     var scrollDelta = void 0;
@@ -16373,7 +16373,7 @@ function editOnSelect(editor) {
16373 16373
   }
16374 16374
 
16375 16375
   var editorState = editor.props.editorState;
16376
-  var editorNode = reactDom.findDOMNode(editor.editorContainer);
16376
+  var editorNode = ReactDOM.findDOMNode(editor.editorContainer);
16377 16377
   !editorNode ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing editorNode') : invariant_1(false) : void 0;
16378 16378
   !(editorNode.firstChild instanceof HTMLElement) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'editorNode.firstChild is not an HTMLElement') : invariant_1(false) : void 0;
16379 16379
   var documentSelection = getDraftEditorSelection_1(editorState, editorNode.firstChild);
@@ -16637,7 +16637,7 @@ var DraftEditor = function (_React$Component) {
16637 16637
       var editorState = _this.props.editorState;
16638 16638
 
16639 16639
       var alreadyHasFocus = editorState.getSelection().getHasFocus();
16640
-      var editorNode = reactDom.findDOMNode(_this.editor);
16640
+      var editorNode = ReactDOM.findDOMNode(_this.editor);
16641 16641
 
16642 16642
       if (!editorNode) {
16643 16643
         // once in a while people call 'focus' in a setTimeout, and the node has
@@ -16671,7 +16671,7 @@ var DraftEditor = function (_React$Component) {
16671 16671
     };
16672 16672
 
16673 16673
     _this.blur = function () {
16674
-      var editorNode = reactDom.findDOMNode(_this.editor);
16674
+      var editorNode = ReactDOM.findDOMNode(_this.editor);
16675 16675
       !(editorNode instanceof HTMLElement) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'editorNode is not an HTMLElement') : invariant_1(false) : void 0;
16676 16676
       editorNode.blur();
16677 16677
     };
@@ -33168,7 +33168,7 @@ unwrapExports(dist$2);
33168 33168
 
33169 33169
 var dist$3 = createCommonjsModule(function (module, exports) {
33170 33170
 (function webpackUniversalModuleDefinition(root, factory) {
33171
-	module.exports = factory(React, dist$1, Draft, immutable$1, dist, reactDom, dist$2, draftjsUtils);
33171
+	module.exports = factory(React, dist$1, Draft, immutable$1, dist, ReactDOM, dist$2, draftjsUtils);
33172 33172
 })(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__16__, __WEBPACK_EXTERNAL_MODULE__17__, __WEBPACK_EXTERNAL_MODULE__23__) {
33173 33173
 return /******/ (function(modules) { // webpackBootstrap
33174 33174
 /******/ 	// The module cache

+ 1
- 1
eslib/BraftEditor/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
eslib/Common/index.d.ts View File

@@ -1 +1 @@
1
-export { default as Modal } from "../Modal/index";
1
+export { default as Modal, ModalCMD } from "../Modal/index";

+ 1
- 1
eslib/Common/index.js View File

@@ -1,6 +1,6 @@
1 1
 import '../inherits-6cb67931.js';
2 2
 import 'react';
3 3
 import 'react-dom';
4
-export { default as Modal } from '../Modal/index.js';
4
+export { default as Modal, ModalCMD } from '../Modal/index.js';
5 5
 import '../style-inject.es-1f59c1d0.js';
6 6
 //# sourceMappingURL=index.js.map

+ 19
- 1
eslib/Modal/index.d.ts View File

@@ -9,4 +9,22 @@ declare class Modal extends React.PureComponent<ModalProps> {
9 9
     static hasShowWarning: boolean;
10 10
     render(): false | React.ReactPortal | null;
11 11
 }
12
-export { Modal as default, Modal, ModalProps };
12
+interface ModalCMDOptions {
13
+    children: any;
14
+    container?: HTMLElement;
15
+    options?: {
16
+        mask?: true;
17
+    };
18
+}
19
+interface ModalCMDRecord {
20
+    modalInstance: HTMLElement;
21
+}
22
+declare class ModalCMD {
23
+    static currentModal: ModalCMDRecord[];
24
+    constructor();
25
+    private static recordModal;
26
+    private static delModal;
27
+    static show({ children, container }: ModalCMDOptions): void;
28
+    static hide(targetId?: string | number): void;
29
+}
30
+export { Modal as default, Modal, ModalProps, ModalCMDOptions, ModalCMDRecord, ModalCMD };

+ 80
- 2
eslib/Modal/index.js View File

@@ -1,6 +1,6 @@
1 1
 import { _ as _typeof, a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
2 2
 import React from 'react';
3
-import { createPortal } from 'react-dom';
3
+import ReactDOM, { createPortal } from 'react-dom';
4 4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
5 5
 
6 6
 function isBrowser() {
@@ -71,7 +71,85 @@ function (_React$PureComponent) {
71 71
   return Modal;
72 72
 }(React.PureComponent);
73 73
 Modal.hasShowWarning = false;
74
+var ModalCMD =
75
+/*#__PURE__*/
76
+function () {
77
+  function ModalCMD() {
78
+    _classCallCheck(this, ModalCMD);
79
+
80
+    ModalCMD.currentModal = [];
81
+  }
82
+
83
+  _createClass(ModalCMD, null, [{
84
+    key: "recordModal",
85
+    value: function recordModal(record) {
86
+      ModalCMD.currentModal.push(record);
87
+    }
88
+  }, {
89
+    key: "delModal",
90
+    value: function delModal() {
91
+      return ModalCMD.currentModal.pop();
92
+    }
93
+  }, {
94
+    key: "show",
95
+    value: function show(_ref) {
96
+      var children = _ref.children,
97
+          container = _ref.container;
98
+      var modalInstance = document.createElement("div");
99
+      var targetMountDom = container ? container : document.body;
100
+      targetMountDom.appendChild(modalInstance);
101
+      ReactDOM.render(React.createElement(React.Fragment, null, React.createElement("div", {
102
+        style: {
103
+          position: "fixed",
104
+          top: 0,
105
+          bottom: 0,
106
+          left: 0,
107
+          right: 0,
108
+          zIndex: 1000
109
+        }
110
+      }, React.createElement("div", {
111
+        style: {
112
+          position: "absolute",
113
+          top: 0,
114
+          bottom: 0,
115
+          left: 0,
116
+          right: 0,
117
+          background: "rgba(0,0,0,1)",
118
+          opacity: 0.6,
119
+          zIndex: -1
120
+        },
121
+        onClick: function onClick() {
122
+          ModalCMD.hide(ModalCMD.currentModal.length);
123
+        }
124
+      }), React.createElement("div", {
125
+        style: {
126
+          position: "absolute",
127
+          top: "50%",
128
+          left: "50%",
129
+          transform: "translate(-50%, -50%)"
130
+        }
131
+      }, children))), modalInstance);
132
+      this.recordModal({
133
+        modalInstance: modalInstance
134
+      });
135
+    }
136
+  }, {
137
+    key: "hide",
138
+    value: function hide(targetId) {
139
+      var popModalRecord = this.delModal();
140
+
141
+      if (popModalRecord && popModalRecord.modalInstance) {
142
+        ReactDOM.unmountComponentAtNode(popModalRecord.modalInstance);
143
+        var parentNode = popModalRecord.modalInstance.parentNode;
144
+        parentNode && parentNode.removeChild(popModalRecord.modalInstance);
145
+      }
146
+    }
147
+  }]);
148
+
149
+  return ModalCMD;
150
+}();
151
+ModalCMD.currentModal = [];
74 152
 
75 153
 export default Modal;
76
-export { Modal };
154
+export { Modal, ModalCMD };
77 155
 //# sourceMappingURL=index.js.map

+ 1
- 1
eslib/Modal/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
eslib/Payment/index.d.ts View File

@@ -4,4 +4,4 @@ export { default as PriceOptions } from "../PriceOptions/index";
4 4
 export { default as WaitPayInfoView } from "../WaitPayInfoView/index";
5 5
 export { default as AllocWantedModal } from "../AllocWantedModal/index";
6 6
 export { default as WantedPublishPopover } from "../WantedPublishPopover/index";
7
-export { default as WantedPublishView } from "../WantedPublishView/index";
7
+export { default as WantedPublishView, WantedViewWranModel } from "../WantedPublishView/index";

+ 2
- 1
eslib/Payment/index.js View File

@@ -14,6 +14,7 @@ import 'antd';
14 14
 export { default as PriceOptions } from '../PriceOptions/index.js';
15 15
 export { default as WaitPayInfoView } from '../WaitPayInfoView/index.js';
16 16
 export { default as AllocWantedModal } from '../AllocWantedModal/index.js';
17
-export { default as WantedPublishView } from '../WantedPublishView/index.js';
17
+export { default as WantedPublishView, WantedViewWranModel } from '../WantedPublishView/index.js';
18 18
 export { default as WantedPublishPopover } from '../WantedPublishPopover/index.js';
19
+import '../WantedPublish-b91e67a7.js';
19 20
 //# sourceMappingURL=index.js.map

+ 1
- 1
eslib/Payment/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}

+ 1
- 1
eslib/WaitPayInfoView/index.d.ts View File

@@ -1,5 +1,5 @@
1 1
 /// <reference types="react" />
2
-import { Component } from 'react';
2
+import { Component } from "react";
3 3
 interface Props {
4 4
     onClickPayed?: Function;
5 5
     onClickProblem?: Function;

+ 1
- 1
eslib/WaitPayInfoView/index.js View File

@@ -58,7 +58,7 @@ function (_Component) {
58 58
         className: styles.btn_default,
59 59
         size: "small",
60 60
         style: {
61
-          marginLeft: '16px'
61
+          marginLeft: "16px"
62 62
         },
63 63
         onClick: function onClick() {
64 64
           onClickProblem && onClickProblem();

+ 1
- 1
eslib/WaitPayInfoView/index.js.map
File diff suppressed because it is too large
View File


+ 23
- 0
eslib/WantedPublish-b91e67a7.d.ts View File

@@ -0,0 +1,23 @@
1
+import { Component } from "react";
2
+interface WatnedPublishBaseP {
3
+    inputWantedRange?: [number, number];
4
+    handleConfirm?: Function;
5
+    currentWanted?: string | number | null;
6
+    viewConfig?: {
7
+        showInputWantedClear?: boolean;
8
+        viewTextOptions?: {
9
+            viewTitle: string;
10
+            imgLabelBottom: string;
11
+            inputTipTop: string;
12
+            numberSuffix: string;
13
+            inputTipBottom: string;
14
+            clearModalTitle?: string;
15
+            clearModalTip?: string;
16
+        };
17
+    };
18
+}
19
+declare class WatnedPublishBase<T extends WatnedPublishBaseP, S> extends Component<T, S> {
20
+    formatCurrentWanted: (value: string | number | null) => string | number | null;
21
+    formatResult: (value: string | number | null) => string | null;
22
+}
23
+export { WatnedPublishBaseP, WatnedPublishBase };

+ 45
- 0
eslib/WantedPublish-b91e67a7.js View File

@@ -0,0 +1,45 @@
1
+import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf } from './inherits-6cb67931.js';
2
+import { Component } from 'react';
3
+
4
+var WatnedPublishBase =
5
+/*#__PURE__*/
6
+function (_Component) {
7
+  _inherits(WatnedPublishBase, _Component);
8
+
9
+  function WatnedPublishBase() {
10
+    var _this;
11
+
12
+    _classCallCheck(this, WatnedPublishBase);
13
+
14
+    _this = _possibleConstructorReturn(this, _getPrototypeOf(WatnedPublishBase).apply(this, arguments));
15
+
16
+    _this.formatCurrentWanted = function (value) {
17
+      var _this$props$inputWant = _this.props.inputWantedRange,
18
+          inputWantedRange = _this$props$inputWant === void 0 ? [5, 10000] : _this$props$inputWant;
19
+      if (!value) return null;
20
+      var result;
21
+      result = value;
22
+
23
+      if (parseInt("".concat(value), 10) === value) {
24
+        result = Number(value);
25
+      }
26
+
27
+      if (!result) return null;
28
+      if (result > inputWantedRange[1]) result = inputWantedRange[1];
29
+      if (result < inputWantedRange[0]) result = inputWantedRange[0];
30
+      return result;
31
+    };
32
+
33
+    _this.formatResult = function (value) {
34
+      if (!value) return null;
35
+      return Number(value).toFixed(2);
36
+    };
37
+
38
+    return _this;
39
+  }
40
+
41
+  return WatnedPublishBase;
42
+}(Component);
43
+
44
+export { WatnedPublishBase as W };
45
+//# sourceMappingURL=WantedPublish-b91e67a7.js.map

+ 1
- 0
eslib/WantedPublish-b91e67a7.js.map View File

@@ -0,0 +1 @@
1
+{"version":3,"file":"WantedPublish-b91e67a7.js","sources":["../src/components/Payment/BaseClassComponents/WantedPublish.tsx"],"sourcesContent":["import React, { Component } from \"react\";\n\nexport interface WatnedPublishBaseP {\n  inputWantedRange?: [number, number];\n  handleConfirm?: Function;\n  currentWanted?: string | number | null;\n  viewConfig?: {\n    showInputWantedClear?: boolean;\n    viewTextOptions?: {\n      viewTitle: string;\n      imgLabelBottom: string;\n      inputTipTop: string;\n      numberSuffix: string;\n      inputTipBottom: string;\n      clearModalTitle?: string;\n      clearModalTip?: string;\n    };\n  };\n}\n\nexport class WatnedPublishBase<\n  T extends WatnedPublishBaseP,\n  S\n> extends Component<T, S> {\n  formatCurrentWanted = (\n    value: string | number | null\n  ): string | number | null => {\n    const { inputWantedRange = [5, 10000] } = this.props;\n    if (!value) return null;\n    let result: string | number;\n    result = value;\n    if (parseInt(`${value}`, 10) === value) {\n      // 无小数判断\n      result = Number(value);\n    }\n    if (!result) return null;\n    if (result > inputWantedRange[1]) result = inputWantedRange[1];\n    if (result < inputWantedRange[0]) result = inputWantedRange[0];\n    return result;\n  };\n\n  formatResult = (value: string | number | null) => {\n    if (!value) return null;\n    return Number(value).toFixed(2);\n  };\n}\n"],"names":["WatnedPublishBase","formatCurrentWanted","value","_this","props","inputWantedRange","result","parseInt","Number","formatResult","toFixed","Component"],"mappings":";;;IAoBaA,iBAAb;AAAA;AAAA,oBAAA;;;+BAAA;;;;;;;UAIEC,sBAAsB,UACpBC,KADoB,EAEM;kCACgBC,MAAKC,KAAL,CAAlCC;UAAAA,gBADkB,sCACC,CAAC,CAAD,EAAI,KAAJ;UACvB,CAACH,OAAO,OAAO,IAAP;UACRI;AACJA,MAAAA,MAAM,GAAGJ,KAAT;;UACIK,QAAQ,WAAIL,MAAJ,EAAa,EAAb,CAAR,KAA6BA,OAAO;AAEtCI,QAAAA,MAAM,GAAGE,MAAM,CAACN,KAAD,CAAf;;;UAEE,CAACI,QAAQ,OAAO,IAAP;UACTA,MAAM,GAAGD,gBAAgB,CAAC,CAAD,GAAKC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,CAAzB;UAC9BC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,GAAKC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,CAAzB;aAC3BC;AAdT;;UAiBAG,eAAe,UAACP,KAAD,EAAkC;UAC3C,CAACA,OAAO,OAAO,IAAP;aACLM,MAAM,CAACN,KAAD,CAAN,CAAcQ,OAAd,CAAsB,CAAtB;AAFT;;;;;;CArBF,CAGUC,SAHV;;;;"}

+ 5
- 8
eslib/WantedPublishModal/index.d.ts View File

@@ -1,20 +1,17 @@
1 1
 /// <reference types="react" />
2
-import { Component } from "react";
2
+import React from "react";
3 3
 import { ModalProps } from "../Modal/index";
4
-interface WantedPublishModalProps {
4
+import { WatnedPublishBase, WatnedPublishBaseP } from "../WantedPublish-b91e67a7";
5
+interface WantedPublishModalProps extends WatnedPublishBaseP {
5 6
     modalConfig?: ModalProps;
6
-    handleConfirm?: Function;
7 7
 }
8 8
 interface WantedPublishModalState {
9 9
     modalVisible: boolean;
10 10
     current_wanted: number | string | null;
11 11
 }
12
-declare class WantedPublishModal extends Component<WantedPublishModalProps, WantedPublishModalState> {
12
+declare class WantedPublishModal extends WatnedPublishBase<WantedPublishModalProps, WantedPublishModalState> {
13 13
     constructor(props: WantedPublishModalProps);
14
-    handleModalShow: () => void;
15
-    handleClose: () => void;
16
-    handleUpdateCurrentWanted: (value: string | number | null, afterUpdate?: Function | undefined) => void;
17
-    clearCurrentWanted: (cb: Function) => void;
14
+    handleConfirmButton: (containerRef?: React.RefObject<any> | undefined) => void;
18 15
     renderMain(): JSX.Element;
19 16
     render(): JSX.Element;
20 17
 }

+ 41
- 45
eslib/WantedPublishModal/index.js View File

@@ -1,5 +1,5 @@
1 1
 import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
2
-import React, { Component } from 'react';
2
+import React from 'react';
3 3
 import 'react-dom';
4 4
 import Modal from '../Modal/index.js';
5 5
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
@@ -8,6 +8,7 @@ import '../_commonjsHelpers-97e6d7b1.js';
8 8
 import '../index-c9837619.js';
9 9
 import 'antd';
10 10
 import WantedPublishView from '../WantedPublishView/index.js';
11
+import { W as WatnedPublishBase } from '../WantedPublish-b91e67a7.js';
11 12
 
12 13
 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 14
 var styles = {
@@ -17,8 +18,8 @@ styleInject(css);
17 18
 
18 19
 var WantedPublishModal =
19 20
 /*#__PURE__*/
20
-function (_Component) {
21
-  _inherits(WantedPublishModal, _Component);
21
+function (_WatnedPublishBase) {
22
+  _inherits(WantedPublishModal, _WatnedPublishBase);
22 23
 
23 24
   function WantedPublishModal(props) {
24 25
     var _this;
@@ -27,47 +28,17 @@ function (_Component) {
27 28
 
28 29
     _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishModal).call(this, props));
29 30
 
30
-    _this.handleModalShow = function () {};
31
-
32
-    _this.handleClose = function () {
31
+    _this.handleConfirmButton = function (containerRef) {
33 32
       var handleConfirm = _this.props.handleConfirm;
34 33
 
35 34
       if (handleConfirm) {
36
-        _this.handleUpdateCurrentWanted(_this.state.current_wanted, function (value) {
37
-          handleConfirm(Number(value).toFixed(2));
38
-        });
39
-      }
40
-
41
-      _this.setState({
42
-        modalVisible: false
43
-      });
44
-    };
45
-
46
-    _this.handleUpdateCurrentWanted = function (value, afterUpdate) {
47
-      if (!value) return;
48
-      var result;
49
-      result = value;
35
+        var value = _this.formatCurrentWanted(_this.state.current_wanted);
50 36
 
51
-      if (parseInt("".concat(value), 10) === value) {
52
-        result = Number(value);
37
+        handleConfirm(value ? Number(value).toFixed(2) : value);
53 38
       }
54 39
 
55
-      if (!result) return;
56
-      if (result > 10000) result = 10000;
57
-      if (result < 5) result = 5;
58
-
59
-      _this.setState({
60
-        current_wanted: result
61
-      }, function () {
62
-        return afterUpdate && afterUpdate(result);
63
-      });
64
-    };
65
-
66
-    _this.clearCurrentWanted = function (cb) {
67 40
       _this.setState({
68
-        current_wanted: null
69
-      }, function () {
70
-        return cb();
41
+        modalVisible: false
71 42
       });
72 43
     };
73 44
 
@@ -84,7 +55,7 @@ function (_Component) {
84 55
       var _this2 = this;
85 56
 
86 57
       var current_wanted = this.state.current_wanted;
87
-      return React.createElement(WantedPublishView, {
58
+      return React.createElement(WantedPublishView, Object.assign({
88 59
         wrapperClass: styles.modalBg,
89 60
         current_wanted: current_wanted,
90 61
         InputWantedValueChange: function InputWantedValueChange(v) {
@@ -93,16 +64,37 @@ function (_Component) {
93 64
           });
94 65
         },
95 66
         InputWantedPressEnter: function InputWantedPressEnter(v) {
96
-          return _this2.handleUpdateCurrentWanted(v, _this2.handleClose);
67
+          var value = _this2.formatCurrentWanted(v);
68
+
69
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
70
+
71
+          _this2.setState({
72
+            current_wanted: value,
73
+            modalVisible: false
74
+          });
97 75
         },
98 76
         InputWantedOnBlur: function InputWantedOnBlur(v) {
99
-          return _this2.handleUpdateCurrentWanted(v);
77
+          var value = _this2.formatCurrentWanted(v);
78
+
79
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
80
+
81
+          _this2.setState({
82
+            current_wanted: value
83
+          });
100 84
         },
101 85
         InputWantedClear: function InputWantedClear() {
102
-          return _this2.clearCurrentWanted(_this2.handleClose);
86
+          _this2.setState({
87
+            current_wanted: null
88
+          }, function () {
89
+            if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
90
+
91
+            _this2.setState({
92
+              modalVisible: false
93
+            });
94
+          });
103 95
         },
104
-        CloseFunction: this.handleClose
105
-      });
96
+        InputWantedConfirm: this.handleConfirmButton
97
+      }, this.props.viewConfig));
106 98
     }
107 99
   }, {
108 100
     key: "render",
@@ -117,13 +109,17 @@ function (_Component) {
117 109
         }
118 110
       }, this.props.children), React.createElement(Modal, Object.assign({
119 111
         visible: this.state.modalVisible,
120
-        onCancel: this.handleClose
112
+        onCancel: function onCancel() {
113
+          _this3.setState({
114
+            modalVisible: false
115
+          });
116
+        }
121 117
       }, this.props.modalConfig), this.renderMain()));
122 118
     }
123 119
   }]);
124 120
 
125 121
   return WantedPublishModal;
126
-}(Component);
122
+}(WatnedPublishBase);
127 123
 
128 124
 export default WantedPublishModal;
129 125
 export { WantedPublishModal };

+ 1
- 1
eslib/WantedPublishModal/index.js.map
File diff suppressed because it is too large
View File


+ 4
- 6
eslib/WantedPublishPopover/index.d.ts View File

@@ -1,19 +1,17 @@
1 1
 /// <reference types="react" />
2 2
 import React from "react";
3 3
 import { PopoverProps } from "antd/lib/popover";
4
-interface WantedPublishPopoverProp {
4
+import { WatnedPublishBase, WatnedPublishBaseP } from "../WantedPublish-b91e67a7";
5
+interface WantedPublishPopoverProp extends WatnedPublishBaseP {
5 6
     popoverConfig?: PopoverProps;
6
-    handleConfirm?: Function;
7 7
 }
8 8
 interface WantedPublishPopoverState {
9 9
     visible: boolean;
10 10
     current_wanted: number | string | null;
11 11
 }
12
-declare class WantedPublishPopover extends React.Component<WantedPublishPopoverProp, WantedPublishPopoverState> {
12
+declare class WantedPublishPopover extends WatnedPublishBase<WantedPublishPopoverProp, WantedPublishPopoverState> {
13 13
     constructor(props: WantedPublishPopoverProp);
14
-    handleClose: () => void;
15
-    clearCurrentWanted: (cb: Function) => void;
16
-    handleUpdateCurrentWanted: (value: string | number | null, afterUpdate?: Function | undefined) => void;
14
+    handleConfirmButton: (containerRef?: React.RefObject<any> | undefined) => void;
17 15
     renderInitView(): JSX.Element;
18 16
     render(): JSX.Element;
19 17
 }

+ 46
- 45
eslib/WantedPublishPopover/index.js View File

@@ -1,11 +1,14 @@
1 1
 import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
2 2
 import React from 'react';
3
+import 'react-dom';
4
+import '../Modal/index.js';
3 5
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
4 6
 import '../defineProperty-18999f8e.js';
5 7
 import '../_commonjsHelpers-97e6d7b1.js';
6 8
 import '../index-c9837619.js';
7 9
 import { Popover } from 'antd';
8 10
 import WantedPublishView from '../WantedPublishView/index.js';
11
+import { W as WatnedPublishBase } from '../WantedPublish-b91e67a7.js';
9 12
 
10 13
 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+WlpYug8EwLwD3HYAbnmApANL5OlZVVZ0wm806hUKhpHbz8/Nfq1Sqns3NzT1wdXV1J41GYwXXdnZ2lklNTb0sAEaK8JEnGKWHSKH1xY2Cn59fILVdXFz8RqVSXdrY2Nid16amptM1NTVvyeVy0laIGV23uJ+SpnJrTAHgTSEo7v/Kyso4k8l0XqlUUoWBpaUlW3p6epfdbn9oMpnO6HS6N+RyOfnE1NTUWFZW1hUx65H1T3I1z4E9AaBULBi1Ky8vj+ns7NQFBASE0PPKysqi1WqdKSsrK5XJZC61sFqtw2q1+jMpfgmK3ocDoymkqZRkJSUlUd3d3ReCgoJI6B+zwcHBzzUazTVJDh81XgJwnQOLY8Vasp+CgoKI3t7ed5VKJSmGy4aGhvrz8vIskp096kDF5TUOjCpR7X4c9fX1nS0sLCQJ27XV1dXbubm5HTabjSpZqfYTgAEOLAzAOake+vv787VaLSVlsh2Hw/EgODiY8iHsdvsdjUbTMT09/UCi3x9oeXJgtLvKpDgYHR0tzMnJoQISOzs7zq6urss9PT0LAwMDF0JDQ6mOw9ra2t38/Hzz5OTkHxJ8k0Lc5MDo+3UArsTJZ3K5HOPj469kZmbmsFDbHR0dH+j1+hl6TklJCRkZGdGFh4fH0PP6+vq94uJi8/DwsNh6/0sAt9y18kUAiXxQ/v7+MoZhXktLS8uidk6n82FbW9ul2trab937JSUlBVmt1vORkZGx9LvD4bhfWlpqtlgsvwm8NykIqcNf7mBUsb7E19FoNJ6qr6+vojbb29t/NzY2vt/Q0ECnnz0WGxsbODEx8U50dLSrhFpeXrYlJCRcFAD7BYBrN7uDkXzQOqOzoU+zWCwarVarNRgMF9vb2+nU49OioqKUDMO8HRIScjQ7O/u9hYUFoV1KZwCbJxg9vwDgjNA6U6vVx8bGxlzliZCFhYX5xcTEHJmbm1sXaEvnzysAtryB0eIvAeAS6EO2caoJuJjeSutTAFyL+xDtdwCkqbsViq9T0mHW/ZsArlLacx8IX2C0AV4G8PQBjxqlh34AP3vG4TvwkihrDhCOTkZ0+KBqYo8JXRHQyKkBnPiPR4524CAAnwlXCIzjOc3e9AhKlogXoCspOnnz5jSxYBSPLlaeB/AcAFfZLNHuAvgKwK9i+kkB4/xRjqP6jXSQhJpPKUi4aYToc08MEF8ek9KfRo675qRv7qqTu+6kVLAv28+I7SuQ1E7/AHTQdDZ7M6+KAAAAAElFTkSuQmCC";
11 14
 
@@ -19,8 +22,8 @@ styleInject(css);
19 22
 
20 23
 var WantedPublishPopover =
21 24
 /*#__PURE__*/
22
-function (_React$Component) {
23
-  _inherits(WantedPublishPopover, _React$Component);
25
+function (_WatnedPublishBase) {
26
+  _inherits(WantedPublishPopover, _WatnedPublishBase);
24 27
 
25 28
   function WantedPublishPopover(props) {
26 29
     var _this;
@@ -29,45 +32,17 @@ function (_React$Component) {
29 32
 
30 33
     _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishPopover).call(this, props));
31 34
 
32
-    _this.handleClose = function () {
35
+    _this.handleConfirmButton = function (containerRef) {
33 36
       var handleConfirm = _this.props.handleConfirm;
34 37
 
35 38
       if (handleConfirm) {
36
-        _this.handleUpdateCurrentWanted(_this.state.current_wanted, function (value) {
37
-          handleConfirm(Number(value).toFixed(2));
38
-        });
39
-      }
40
-
41
-      _this.setState({
42
-        visible: false
43
-      });
44
-    };
45
-
46
-    _this.clearCurrentWanted = function (cb) {
47
-      _this.setState({
48
-        current_wanted: null
49
-      }, function () {
50
-        return cb();
51
-      });
52
-    };
53
-
54
-    _this.handleUpdateCurrentWanted = function (value, afterUpdate) {
55
-      if (!value) return;
56
-      var result;
57
-      result = value;
39
+        var value = _this.formatCurrentWanted(_this.state.current_wanted);
58 40
 
59
-      if (parseInt("".concat(value), 10) === value) {
60
-        result = Number(value);
41
+        handleConfirm(_this.formatResult(value), containerRef);
61 42
       }
62 43
 
63
-      if (!result) return;
64
-      if (result > 10000) result = 10000;
65
-      if (result < 5) result = 5;
66
-
67 44
       _this.setState({
68
-        current_wanted: result
69
-      }, function () {
70
-        return afterUpdate && afterUpdate(result);
45
+        visible: false
71 46
       });
72 47
     };
73 48
 
@@ -84,7 +59,7 @@ function (_React$Component) {
84 59
       var _this2 = this;
85 60
 
86 61
       var current_wanted = this.state.current_wanted;
87
-      return React.createElement(WantedPublishView, {
62
+      return React.createElement(WantedPublishView, Object.assign({
88 63
         type: "pop",
89 64
         current_wanted: current_wanted,
90 65
         InputWantedValueChange: function InputWantedValueChange(v) {
@@ -93,16 +68,35 @@ function (_React$Component) {
93 68
           });
94 69
         },
95 70
         InputWantedPressEnter: function InputWantedPressEnter(v) {
96
-          return _this2.handleUpdateCurrentWanted(v, _this2.handleClose);
71
+          var value = _this2.formatCurrentWanted(v);
72
+
73
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
74
+
75
+          _this2.setState({
76
+            current_wanted: value,
77
+            visible: false
78
+          });
97 79
         },
98 80
         InputWantedOnBlur: function InputWantedOnBlur(v) {
99
-          return _this2.handleUpdateCurrentWanted(v);
81
+          var value = _this2.formatCurrentWanted(v);
82
+
83
+          _this2.setState({
84
+            current_wanted: value
85
+          });
100 86
         },
101 87
         InputWantedClear: function InputWantedClear() {
102
-          return _this2.clearCurrentWanted(_this2.handleClose);
88
+          _this2.setState({
89
+            current_wanted: null
90
+          }, function () {
91
+            if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
92
+
93
+            _this2.setState({
94
+              visible: false
95
+            });
96
+          });
103 97
         },
104
-        CloseFunction: this.handleClose
105
-      });
98
+        InputWantedConfirm: this.handleConfirmButton
99
+      }, this.props.viewConfig));
106 100
     }
107 101
   }, {
108 102
     key: "render",
@@ -112,14 +106,17 @@ function (_React$Component) {
112 106
       var _this$props = this.props,
113 107
           children = _this$props.children,
114 108
           _this$props$popoverCo = _this$props.popoverConfig,
115
-          popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo;
109
+          popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo,
110
+          currentWanted = _this$props.currentWanted;
116 111
       return React.createElement(Popover, Object.assign({
117 112
         placement: "left",
118 113
         trigger: "click",
119 114
         visible: this.state.visible,
120 115
         onVisibleChange: function onVisibleChange(value) {
121
-          if (!value) {
122
-            _this3.handleClose();
116
+          if (value && currentWanted) {
117
+            _this3.setState({
118
+              current_wanted: +currentWanted
119
+            });
123 120
           }
124 121
 
125 122
           _this3.setState({
@@ -135,7 +132,11 @@ function (_React$Component) {
135 132
           className: styles.closeBtnWrapper
136 133
         }, React.createElement("div", {
137 134
           className: styles.closeBtn,
138
-          onClick: this.handleClose
135
+          onClick: function onClick() {
136
+            _this3.setState({
137
+              visible: false
138
+            });
139
+          }
139 140
         }, React.createElement("img", {
140 141
           src: img,
141 142
           alt: "close wanted button"
@@ -145,7 +146,7 @@ function (_React$Component) {
145 146
   }]);
146 147
 
147 148
   return WantedPublishPopover;
148
-}(React.Component);
149
+}(WatnedPublishBase);
149 150
 
150 151
 export default WantedPublishPopover;
151 152
 export { WantedPublishPopover };

+ 1
- 1
eslib/WantedPublishPopover/index.js.map
File diff suppressed because it is too large
View File


+ 23
- 4
eslib/WantedPublishView/index.d.ts View File

@@ -1,20 +1,39 @@
1 1
 /// <reference types="react" />
2
-import React from 'react';
2
+import React from "react";
3 3
 interface WantedPublishViewProps {
4
-    type?: 'pop' | 'modal';
4
+    type?: "pop" | "modal";
5 5
     wrapperClass?: string;
6 6
     current_wanted: number | string | null;
7
+    showInputWantedClear?: boolean;
8
+    viewTextOptions?: {
9
+        viewTitle: string;
10
+        imgLabelBottom: string;
11
+        inputTipTop: string;
12
+        numberSuffix: string;
13
+        inputTipBottom: string;
14
+    };
7 15
     InputWantedValueChange: Function;
8 16
     InputWantedPressEnter: Function;
9 17
     InputWantedOnBlur: Function;
10 18
     InputWantedClear: Function;
11
-    CloseFunction: Function;
19
+    InputWantedConfirm: Function;
12 20
 }
13 21
 interface WantedPublishViewState {
14 22
     payment?: number;
15 23
 }
16 24
 declare class WantedPublishView extends React.Component<WantedPublishViewProps, WantedPublishViewState> {
25
+    private containerRef;
17 26
     constructor(props: WantedPublishViewProps);
27
+    componentWillUnmount(): void;
18 28
     render(): JSX.Element;
19 29
 }
20
-export { WantedPublishView as default };
30
+declare function WantedViewWranModel({ refMount, actionConfirm, actionCancel, viewTextOptions }: {
31
+    refMount: any;
32
+    actionConfirm: any;
33
+    actionCancel: any;
34
+    viewTextOptions?: {
35
+        warnModalTitle?: string;
36
+        warnModalTip?: string;
37
+    };
38
+}): void;
39
+export { WantedPublishView as default, WantedViewWranModel };

+ 82
- 16
eslib/WantedPublishView/index.js
File diff suppressed because it is too large
View File


+ 1
- 1
eslib/WantedPublishView/index.js.map
File diff suppressed because it is too large
View File


+ 3
- 2
eslib/index.js View File

@@ -1,7 +1,7 @@
1 1
 import './inherits-6cb67931.js';
2 2
 import 'react';
3 3
 import 'react-dom';
4
-export { default as Modal } from './Modal/index.js';
4
+export { default as Modal, ModalCMD } from './Modal/index.js';
5 5
 import './style-inject.es-1f59c1d0.js';
6 6
 import './defineProperty-18999f8e.js';
7 7
 import './_commonjsHelpers-97e6d7b1.js';
@@ -14,6 +14,7 @@ import 'antd';
14 14
 export { default as PriceOptions } from './PriceOptions/index.js';
15 15
 export { default as WaitPayInfoView } from './WaitPayInfoView/index.js';
16 16
 export { default as AllocWantedModal } from './AllocWantedModal/index.js';
17
-export { default as WantedPublishView } from './WantedPublishView/index.js';
17
+export { default as WantedPublishView, WantedViewWranModel } from './WantedPublishView/index.js';
18 18
 export { default as WantedPublishPopover } from './WantedPublishPopover/index.js';
19
+import './WantedPublish-b91e67a7.js';
19 20
 //# sourceMappingURL=index.js.map

+ 1
- 1
eslib/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}

+ 10
- 10
lib/BraftEditor/index.js View File

@@ -6,8 +6,8 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6 6
 
7 7
 var React = require('react');
8 8
 var React__default = _interopDefault(React);
9
-var reactDom = require('react-dom');
10
-var reactDom__default = _interopDefault(reactDom);
9
+var ReactDOM = require('react-dom');
10
+var ReactDOM__default = _interopDefault(ReactDOM);
11 11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
12 12
 var _commonjsHelpers = require('../_commonjsHelpers-72d386ba.js');
13 13
 var slicedToArray = require('../slicedToArray-172f4624.js');
@@ -11077,7 +11077,7 @@ var DraftEditorTextNode = function (_React$Component) {
11077 11077
   }
11078 11078
 
11079 11079
   DraftEditorTextNode.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
11080
-    var node = reactDom__default.findDOMNode(this);
11080
+    var node = ReactDOM__default.findDOMNode(this);
11081 11081
     var shouldBeNewline = nextProps.children === '';
11082 11082
     !(node instanceof Element) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'node is not an Element') : invariant_1(false) : void 0;
11083 11083
     if (shouldBeNewline) {
@@ -11519,7 +11519,7 @@ var DraftEditorLeaf = function (_React$Component) {
11519 11519
     // Determine the appropriate target node for selection. If the child
11520 11520
     // is not a text node, it is a <br /> spacer. In this case, use the
11521 11521
     // <span> itself as the selection target.
11522
-    var node = reactDom__default.findDOMNode(this);
11522
+    var node = ReactDOM__default.findDOMNode(this);
11523 11523
     !node ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing node') : invariant_1(false) : void 0;
11524 11524
     var child = node.firstChild;
11525 11525
     !child ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing child') : invariant_1(false) : void 0;
@@ -11547,7 +11547,7 @@ var DraftEditorLeaf = function (_React$Component) {
11547 11547
    */
11548 11548
 
11549 11549
   DraftEditorLeaf.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
11550
-    var leafNode = reactDom__default.findDOMNode(this.leaf);
11550
+    var leafNode = ReactDOM__default.findDOMNode(this.leaf);
11551 11551
     !leafNode ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing leafNode') : invariant_1(false) : void 0;
11552 11552
     return leafNode.textContent !== nextProps.text || nextProps.styleSet !== this.props.styleSet || nextProps.forceSelection;
11553 11553
   };
@@ -12209,7 +12209,7 @@ var DraftEditorBlock = function (_React$Component) {
12209 12209
       return;
12210 12210
     }
12211 12211
 
12212
-    var blockNode = reactDom__default.findDOMNode(this);
12212
+    var blockNode = ReactDOM__default.findDOMNode(this);
12213 12213
     var scrollParent = Style_1.getScrollParent(blockNode);
12214 12214
     var scrollPosition = getScrollPosition_1(scrollParent);
12215 12215
     var scrollDelta = void 0;
@@ -16381,7 +16381,7 @@ function editOnSelect(editor) {
16381 16381
   }
16382 16382
 
16383 16383
   var editorState = editor.props.editorState;
16384
-  var editorNode = reactDom__default.findDOMNode(editor.editorContainer);
16384
+  var editorNode = ReactDOM__default.findDOMNode(editor.editorContainer);
16385 16385
   !editorNode ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'Missing editorNode') : invariant_1(false) : void 0;
16386 16386
   !(editorNode.firstChild instanceof HTMLElement) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'editorNode.firstChild is not an HTMLElement') : invariant_1(false) : void 0;
16387 16387
   var documentSelection = getDraftEditorSelection_1(editorState, editorNode.firstChild);
@@ -16645,7 +16645,7 @@ var DraftEditor = function (_React$Component) {
16645 16645
       var editorState = _this.props.editorState;
16646 16646
 
16647 16647
       var alreadyHasFocus = editorState.getSelection().getHasFocus();
16648
-      var editorNode = reactDom__default.findDOMNode(_this.editor);
16648
+      var editorNode = ReactDOM__default.findDOMNode(_this.editor);
16649 16649
 
16650 16650
       if (!editorNode) {
16651 16651
         // once in a while people call 'focus' in a setTimeout, and the node has
@@ -16679,7 +16679,7 @@ var DraftEditor = function (_React$Component) {
16679 16679
     };
16680 16680
 
16681 16681
     _this.blur = function () {
16682
-      var editorNode = reactDom__default.findDOMNode(_this.editor);
16682
+      var editorNode = ReactDOM__default.findDOMNode(_this.editor);
16683 16683
       !(editorNode instanceof HTMLElement) ? process.env.NODE_ENV !== 'production' ? invariant_1(false, 'editorNode is not an HTMLElement') : invariant_1(false) : void 0;
16684 16684
       editorNode.blur();
16685 16685
     };
@@ -33176,7 +33176,7 @@ _commonjsHelpers.unwrapExports(dist$2);
33176 33176
 
33177 33177
 var dist$3 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
33178 33178
 (function webpackUniversalModuleDefinition(root, factory) {
33179
-	module.exports = factory(React__default, dist$1, Draft, immutable$1, dist, reactDom__default, dist$2, draftjsUtils);
33179
+	module.exports = factory(React__default, dist$1, Draft, immutable$1, dist, ReactDOM__default, dist$2, draftjsUtils);
33180 33180
 })(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__16__, __WEBPACK_EXTERNAL_MODULE__17__, __WEBPACK_EXTERNAL_MODULE__23__) {
33181 33181
 return /******/ (function(modules) { // webpackBootstrap
33182 33182
 /******/ 	// The module cache

+ 1
- 1
lib/Common/index.d.ts View File

@@ -1 +1 @@
1
-export { default as Modal } from "../Modal/index";
1
+export { default as Modal, ModalCMD } from "../Modal/index";

+ 1
- 0
lib/Common/index.js View File

@@ -11,4 +11,5 @@ require('../style-inject.es-dcee06b6.js');
11 11
 
12 12
 
13 13
 exports.Modal = Modal.default;
14
+exports.ModalCMD = Modal.ModalCMD;
14 15
 //# sourceMappingURL=index.js.map

+ 1
- 1
lib/Common/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}

+ 19
- 1
lib/Modal/index.d.ts View File

@@ -9,4 +9,22 @@ declare class Modal extends React.PureComponent<ModalProps> {
9 9
     static hasShowWarning: boolean;
10 10
     render(): false | React.ReactPortal | null;
11 11
 }
12
-export { Modal as default, Modal, ModalProps };
12
+interface ModalCMDOptions {
13
+    children: any;
14
+    container?: HTMLElement;
15
+    options?: {
16
+        mask?: true;
17
+    };
18
+}
19
+interface ModalCMDRecord {
20
+    modalInstance: HTMLElement;
21
+}
22
+declare class ModalCMD {
23
+    static currentModal: ModalCMDRecord[];
24
+    constructor();
25
+    private static recordModal;
26
+    private static delModal;
27
+    static show({ children, container }: ModalCMDOptions): void;
28
+    static hide(targetId?: string | number): void;
29
+}
30
+export { Modal as default, Modal, ModalProps, ModalCMDOptions, ModalCMDRecord, ModalCMD };

+ 82
- 3
lib/Modal/index.js View File

@@ -7,8 +7,8 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7 7
 var inherits = require('../inherits-c86d64c1.js');
8 8
 var React = require('react');
9 9
 var React__default = _interopDefault(React);
10
-var reactDom = require('react-dom');
11
-var reactDom__default = _interopDefault(reactDom);
10
+var ReactDOM = require('react-dom');
11
+var ReactDOM__default = _interopDefault(ReactDOM);
12 12
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
13 13
 
14 14
 function isBrowser() {
@@ -65,7 +65,7 @@ function (_React$PureComponent) {
65 65
         finalMountContainer = container;
66 66
       }
67 67
 
68
-      return visible && reactDom.createPortal(React__default.createElement("div", {
68
+      return visible && ReactDOM.createPortal(React__default.createElement("div", {
69 69
         className: styles.wrapper
70 70
       }, React__default.createElement("div", {
71 71
         className: styles.overlay,
@@ -79,7 +79,86 @@ function (_React$PureComponent) {
79 79
   return Modal;
80 80
 }(React__default.PureComponent);
81 81
 Modal.hasShowWarning = false;
82
+var ModalCMD =
83
+/*#__PURE__*/
84
+function () {
85
+  function ModalCMD() {
86
+    inherits._classCallCheck(this, ModalCMD);
87
+
88
+    ModalCMD.currentModal = [];
89
+  }
90
+
91
+  inherits._createClass(ModalCMD, null, [{
92
+    key: "recordModal",
93
+    value: function recordModal(record) {
94
+      ModalCMD.currentModal.push(record);
95
+    }
96
+  }, {
97
+    key: "delModal",
98
+    value: function delModal() {
99
+      return ModalCMD.currentModal.pop();
100
+    }
101
+  }, {
102
+    key: "show",
103
+    value: function show(_ref) {
104
+      var children = _ref.children,
105
+          container = _ref.container;
106
+      var modalInstance = document.createElement("div");
107
+      var targetMountDom = container ? container : document.body;
108
+      targetMountDom.appendChild(modalInstance);
109
+      ReactDOM__default.render(React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
110
+        style: {
111
+          position: "fixed",
112
+          top: 0,
113
+          bottom: 0,
114
+          left: 0,
115
+          right: 0,
116
+          zIndex: 1000
117
+        }
118
+      }, React__default.createElement("div", {
119
+        style: {
120
+          position: "absolute",
121
+          top: 0,
122
+          bottom: 0,
123
+          left: 0,
124
+          right: 0,
125
+          background: "rgba(0,0,0,1)",
126
+          opacity: 0.6,
127
+          zIndex: -1
128
+        },
129
+        onClick: function onClick() {
130
+          ModalCMD.hide(ModalCMD.currentModal.length);
131
+        }
132
+      }), React__default.createElement("div", {
133
+        style: {
134
+          position: "absolute",
135
+          top: "50%",
136
+          left: "50%",
137
+          transform: "translate(-50%, -50%)"
138
+        }
139
+      }, children))), modalInstance);
140
+      this.recordModal({
141
+        modalInstance: modalInstance
142
+      });
143
+    }
144
+  }, {
145
+    key: "hide",
146
+    value: function hide(targetId) {
147
+      var popModalRecord = this.delModal();
148
+
149
+      if (popModalRecord && popModalRecord.modalInstance) {
150
+        ReactDOM__default.unmountComponentAtNode(popModalRecord.modalInstance);
151
+        var parentNode = popModalRecord.modalInstance.parentNode;
152
+        parentNode && parentNode.removeChild(popModalRecord.modalInstance);
153
+      }
154
+    }
155
+  }]);
156
+
157
+  return ModalCMD;
158
+}();
159
+ModalCMD.currentModal = [];
82 160
 
83 161
 exports.Modal = Modal;
162
+exports.ModalCMD = ModalCMD;
84 163
 exports.default = Modal;
85 164
 //# sourceMappingURL=index.js.map

+ 1
- 1
lib/Modal/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/Payment/index.d.ts View File

@@ -4,4 +4,4 @@ export { default as PriceOptions } from "../PriceOptions/index";
4 4
 export { default as WaitPayInfoView } from "../WaitPayInfoView/index";
5 5
 export { default as AllocWantedModal } from "../AllocWantedModal/index";
6 6
 export { default as WantedPublishPopover } from "../WantedPublishPopover/index";
7
-export { default as WantedPublishView } from "../WantedPublishView/index";
7
+export { default as WantedPublishView, WantedViewWranModel } from "../WantedPublishView/index";

+ 2
- 0
lib/Payment/index.js View File

@@ -20,6 +20,7 @@ var WaitPayInfoView = require('../WaitPayInfoView/index.js');
20 20
 var AllocWantedModal = require('../AllocWantedModal/index.js');
21 21
 var WantedPublishView = require('../WantedPublishView/index.js');
22 22
 var WantedPublishPopover = require('../WantedPublishPopover/index.js');
23
+require('../WantedPublish-761aab8e.js');
23 24
 
24 25
 
25 26
 
@@ -29,5 +30,6 @@ exports.PriceOptions = PriceOptions.default;
29 30
 exports.WaitPayInfoView = WaitPayInfoView.default;
30 31
 exports.AllocWantedModal = AllocWantedModal.default;
31 32
 exports.WantedPublishView = WantedPublishView.default;
33
+exports.WantedViewWranModel = WantedPublishView.WantedViewWranModel;
32 34
 exports.WantedPublishPopover = WantedPublishPopover.default;
33 35
 //# sourceMappingURL=index.js.map

+ 1
- 1
lib/Payment/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

+ 1
- 1
lib/WaitPayInfoView/index.d.ts View File

@@ -1,5 +1,5 @@
1 1
 /// <reference types="react" />
2
-import { Component } from 'react';
2
+import { Component } from "react";
3 3
 interface Props {
4 4
     onClickPayed?: Function;
5 5
     onClickProblem?: Function;

+ 1
- 1
lib/WaitPayInfoView/index.js View File

@@ -65,7 +65,7 @@ function (_Component) {
65 65
         className: styles.btn_default,
66 66
         size: "small",
67 67
         style: {
68
-          marginLeft: '16px'
68
+          marginLeft: "16px"
69 69
         },
70 70
         onClick: function onClick() {
71 71
           onClickProblem && onClickProblem();

+ 1
- 1
lib/WaitPayInfoView/index.js.map
File diff suppressed because it is too large
View File


+ 23
- 0
lib/WantedPublish-761aab8e.d.ts View File

@@ -0,0 +1,23 @@
1
+import { Component } from "react";
2
+interface WatnedPublishBaseP {
3
+    inputWantedRange?: [number, number];
4
+    handleConfirm?: Function;
5
+    currentWanted?: string | number | null;
6
+    viewConfig?: {
7
+        showInputWantedClear?: boolean;
8
+        viewTextOptions?: {
9
+            viewTitle: string;
10
+            imgLabelBottom: string;
11
+            inputTipTop: string;
12
+            numberSuffix: string;
13
+            inputTipBottom: string;
14
+            clearModalTitle?: string;
15
+            clearModalTip?: string;
16
+        };
17
+    };
18
+}
19
+declare class WatnedPublishBase<T extends WatnedPublishBaseP, S> extends Component<T, S> {
20
+    formatCurrentWanted: (value: string | number | null) => string | number | null;
21
+    formatResult: (value: string | number | null) => string | null;
22
+}
23
+export { WatnedPublishBaseP, WatnedPublishBase };

+ 50
- 0
lib/WantedPublish-761aab8e.js View File

@@ -0,0 +1,50 @@
1
+'use strict';
2
+
3
+function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+var inherits = require('./inherits-c86d64c1.js');
6
+var React = require('react');
7
+var React__default = _interopDefault(React);
8
+
9
+var WatnedPublishBase =
10
+/*#__PURE__*/
11
+function (_Component) {
12
+  inherits._inherits(WatnedPublishBase, _Component);
13
+
14
+  function WatnedPublishBase() {
15
+    var _this;
16
+
17
+    inherits._classCallCheck(this, WatnedPublishBase);
18
+
19
+    _this = inherits._possibleConstructorReturn(this, inherits._getPrototypeOf(WatnedPublishBase).apply(this, arguments));
20
+
21
+    _this.formatCurrentWanted = function (value) {
22
+      var _this$props$inputWant = _this.props.inputWantedRange,
23
+          inputWantedRange = _this$props$inputWant === void 0 ? [5, 10000] : _this$props$inputWant;
24
+      if (!value) return null;
25
+      var result;
26
+      result = value;
27
+
28
+      if (parseInt("".concat(value), 10) === value) {
29
+        result = Number(value);
30
+      }
31
+
32
+      if (!result) return null;
33
+      if (result > inputWantedRange[1]) result = inputWantedRange[1];
34
+      if (result < inputWantedRange[0]) result = inputWantedRange[0];
35
+      return result;
36
+    };
37
+
38
+    _this.formatResult = function (value) {
39
+      if (!value) return null;
40
+      return Number(value).toFixed(2);
41
+    };
42
+
43
+    return _this;
44
+  }
45
+
46
+  return WatnedPublishBase;
47
+}(React.Component);
48
+
49
+exports.WatnedPublishBase = WatnedPublishBase;
50
+//# sourceMappingURL=WantedPublish-761aab8e.js.map

+ 1
- 0
lib/WantedPublish-761aab8e.js.map View File

@@ -0,0 +1 @@
1
+{"version":3,"file":"WantedPublish-b91e67a7.js","sources":["../src/components/Payment/BaseClassComponents/WantedPublish.tsx"],"sourcesContent":["import React, { Component } from \"react\";\n\nexport interface WatnedPublishBaseP {\n  inputWantedRange?: [number, number];\n  handleConfirm?: Function;\n  currentWanted?: string | number | null;\n  viewConfig?: {\n    showInputWantedClear?: boolean;\n    viewTextOptions?: {\n      viewTitle: string;\n      imgLabelBottom: string;\n      inputTipTop: string;\n      numberSuffix: string;\n      inputTipBottom: string;\n      clearModalTitle?: string;\n      clearModalTip?: string;\n    };\n  };\n}\n\nexport class WatnedPublishBase<\n  T extends WatnedPublishBaseP,\n  S\n> extends Component<T, S> {\n  formatCurrentWanted = (\n    value: string | number | null\n  ): string | number | null => {\n    const { inputWantedRange = [5, 10000] } = this.props;\n    if (!value) return null;\n    let result: string | number;\n    result = value;\n    if (parseInt(`${value}`, 10) === value) {\n      // 无小数判断\n      result = Number(value);\n    }\n    if (!result) return null;\n    if (result > inputWantedRange[1]) result = inputWantedRange[1];\n    if (result < inputWantedRange[0]) result = inputWantedRange[0];\n    return result;\n  };\n\n  formatResult = (value: string | number | null) => {\n    if (!value) return null;\n    return Number(value).toFixed(2);\n  };\n}\n"],"names":["WatnedPublishBase","formatCurrentWanted","value","_this","props","inputWantedRange","result","parseInt","Number","formatResult","toFixed","Component"],"mappings":";;;;;;;;IAoBaA,iBAAb;AAAA;AAAA,oBAAA;;;+BAAA;;;;;;;UAIEC,sBAAsB,UACpBC,KADoB,EAEM;kCACgBC,MAAKC,KAAL,CAAlCC;UAAAA,gBADkB,sCACC,CAAC,CAAD,EAAI,KAAJ;UACvB,CAACH,OAAO,OAAO,IAAP;UACRI;AACJA,MAAAA,MAAM,GAAGJ,KAAT;;UACIK,QAAQ,WAAIL,MAAJ,EAAa,EAAb,CAAR,KAA6BA,OAAO;AAEtCI,QAAAA,MAAM,GAAGE,MAAM,CAACN,KAAD,CAAf;;;UAEE,CAACI,QAAQ,OAAO,IAAP;UACTA,MAAM,GAAGD,gBAAgB,CAAC,CAAD,GAAKC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,CAAzB;UAC9BC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,GAAKC,MAAM,GAAGD,gBAAgB,CAAC,CAAD,CAAzB;aAC3BC;AAdT;;UAiBAG,eAAe,UAACP,KAAD,EAAkC;UAC3C,CAACA,OAAO,OAAO,IAAP;aACLM,MAAM,CAACN,KAAD,CAAN,CAAcQ,OAAd,CAAsB,CAAtB;AAFT;;;;;;CArBF,CAGUC,eAHV;;;;"}

+ 5
- 8
lib/WantedPublishModal/index.d.ts View File

@@ -1,20 +1,17 @@
1 1
 /// <reference types="react" />
2
-import { Component } from "react";
2
+import React from "react";
3 3
 import { ModalProps } from "../Modal/index";
4
-interface WantedPublishModalProps {
4
+import { WatnedPublishBase, WatnedPublishBaseP } from "../WantedPublish-761aab8e";
5
+interface WantedPublishModalProps extends WatnedPublishBaseP {
5 6
     modalConfig?: ModalProps;
6
-    handleConfirm?: Function;
7 7
 }
8 8
 interface WantedPublishModalState {
9 9
     modalVisible: boolean;
10 10
     current_wanted: number | string | null;
11 11
 }
12
-declare class WantedPublishModal extends Component<WantedPublishModalProps, WantedPublishModalState> {
12
+declare class WantedPublishModal extends WatnedPublishBase<WantedPublishModalProps, WantedPublishModalState> {
13 13
     constructor(props: WantedPublishModalProps);
14
-    handleModalShow: () => void;
15
-    handleClose: () => void;
16
-    handleUpdateCurrentWanted: (value: string | number | null, afterUpdate?: Function | undefined) => void;
17
-    clearCurrentWanted: (cb: Function) => void;
14
+    handleConfirmButton: (containerRef?: React.RefObject<any> | undefined) => void;
18 15
     renderMain(): JSX.Element;
19 16
     render(): JSX.Element;
20 17
 }

+ 40
- 44
lib/WantedPublishModal/index.js View File

@@ -15,6 +15,7 @@ require('../_commonjsHelpers-72d386ba.js');
15 15
 require('../index-44e17595.js');
16 16
 require('antd');
17 17
 var WantedPublishView = require('../WantedPublishView/index.js');
18
+var WantedPublish = require('../WantedPublish-761aab8e.js');
18 19
 
19 20
 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";
20 21
 var styles = {
@@ -24,8 +25,8 @@ styleInject_es.styleInject(css);
24 25
 
25 26
 var WantedPublishModal =
26 27
 /*#__PURE__*/
27
-function (_Component) {
28
-  inherits._inherits(WantedPublishModal, _Component);
28
+function (_WatnedPublishBase) {
29
+  inherits._inherits(WantedPublishModal, _WatnedPublishBase);
29 30
 
30 31
   function WantedPublishModal(props) {
31 32
     var _this;
@@ -34,47 +35,17 @@ function (_Component) {
34 35
 
35 36
     _this = inherits._possibleConstructorReturn(this, inherits._getPrototypeOf(WantedPublishModal).call(this, props));
36 37
 
37
-    _this.handleModalShow = function () {};
38
-
39
-    _this.handleClose = function () {
38
+    _this.handleConfirmButton = function (containerRef) {
40 39
       var handleConfirm = _this.props.handleConfirm;
41 40
 
42 41
       if (handleConfirm) {
43
-        _this.handleUpdateCurrentWanted(_this.state.current_wanted, function (value) {
44
-          handleConfirm(Number(value).toFixed(2));
45
-        });
46
-      }
47
-
48
-      _this.setState({
49
-        modalVisible: false
50
-      });
51
-    };
52
-
53
-    _this.handleUpdateCurrentWanted = function (value, afterUpdate) {
54
-      if (!value) return;
55
-      var result;
56
-      result = value;
42
+        var value = _this.formatCurrentWanted(_this.state.current_wanted);
57 43
 
58
-      if (parseInt("".concat(value), 10) === value) {
59
-        result = Number(value);
44
+        handleConfirm(value ? Number(value).toFixed(2) : value);
60 45
       }
61 46
 
62
-      if (!result) return;
63
-      if (result > 10000) result = 10000;
64
-      if (result < 5) result = 5;
65
-
66
-      _this.setState({
67
-        current_wanted: result
68
-      }, function () {
69
-        return afterUpdate && afterUpdate(result);
70
-      });
71
-    };
72
-
73
-    _this.clearCurrentWanted = function (cb) {
74 47
       _this.setState({
75
-        current_wanted: null
76
-      }, function () {
77
-        return cb();
48
+        modalVisible: false
78 49
       });
79 50
     };
80 51
 
@@ -91,7 +62,7 @@ function (_Component) {
91 62
       var _this2 = this;
92 63
 
93 64
       var current_wanted = this.state.current_wanted;
94
-      return React__default.createElement(WantedPublishView.default, {
65
+      return React__default.createElement(WantedPublishView.default, Object.assign({
95 66
         wrapperClass: styles.modalBg,
96 67
         current_wanted: current_wanted,
97 68
         InputWantedValueChange: function InputWantedValueChange(v) {
@@ -100,16 +71,37 @@ function (_Component) {
100 71
           });
101 72
         },
102 73
         InputWantedPressEnter: function InputWantedPressEnter(v) {
103
-          return _this2.handleUpdateCurrentWanted(v, _this2.handleClose);
74
+          var value = _this2.formatCurrentWanted(v);
75
+
76
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
77
+
78
+          _this2.setState({
79
+            current_wanted: value,
80
+            modalVisible: false
81
+          });
104 82
         },
105 83
         InputWantedOnBlur: function InputWantedOnBlur(v) {
106
-          return _this2.handleUpdateCurrentWanted(v);
84
+          var value = _this2.formatCurrentWanted(v);
85
+
86
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
87
+
88
+          _this2.setState({
89
+            current_wanted: value
90
+          });
107 91
         },
108 92
         InputWantedClear: function InputWantedClear() {
109
-          return _this2.clearCurrentWanted(_this2.handleClose);
93
+          _this2.setState({
94
+            current_wanted: null
95
+          }, function () {
96
+            if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
97
+
98
+            _this2.setState({
99
+              modalVisible: false
100
+            });
101
+          });
110 102
         },
111
-        CloseFunction: this.handleClose
112
-      });
103
+        InputWantedConfirm: this.handleConfirmButton
104
+      }, this.props.viewConfig));
113 105
     }
114 106
   }, {
115 107
     key: "render",
@@ -124,13 +116,17 @@ function (_Component) {
124 116
         }
125 117
       }, this.props.children), React__default.createElement(Modal.default, Object.assign({
126 118
         visible: this.state.modalVisible,
127
-        onCancel: this.handleClose
119
+        onCancel: function onCancel() {
120
+          _this3.setState({
121
+            modalVisible: false
122
+          });
123
+        }
128 124
       }, this.props.modalConfig), this.renderMain()));
129 125
     }
130 126
   }]);
131 127
 
132 128
   return WantedPublishModal;
133
-}(React.Component);
129
+}(WantedPublish.WatnedPublishBase);
134 130
 
135 131
 exports.WantedPublishModal = WantedPublishModal;
136 132
 exports.default = WantedPublishModal;

+ 1
- 1
lib/WantedPublishModal/index.js.map
File diff suppressed because it is too large
View File


+ 4
- 6
lib/WantedPublishPopover/index.d.ts View File

@@ -1,19 +1,17 @@
1 1
 /// <reference types="react" />
2 2
 import React from "react";
3 3
 import { PopoverProps } from "antd/lib/popover";
4
-interface WantedPublishPopoverProp {
4
+import { WatnedPublishBase, WatnedPublishBaseP } from "../WantedPublish-761aab8e";
5
+interface WantedPublishPopoverProp extends WatnedPublishBaseP {
5 6
     popoverConfig?: PopoverProps;
6
-    handleConfirm?: Function;
7 7
 }
8 8
 interface WantedPublishPopoverState {
9 9
     visible: boolean;
10 10
     current_wanted: number | string | null;
11 11
 }
12
-declare class WantedPublishPopover extends React.Component<WantedPublishPopoverProp, WantedPublishPopoverState> {
12
+declare class WantedPublishPopover extends WatnedPublishBase<WantedPublishPopoverProp, WantedPublishPopoverState> {
13 13
     constructor(props: WantedPublishPopoverProp);
14
-    handleClose: () => void;
15
-    clearCurrentWanted: (cb: Function) => void;
16
-    handleUpdateCurrentWanted: (value: string | number | null, afterUpdate?: Function | undefined) => void;
14
+    handleConfirmButton: (containerRef?: React.RefObject<any> | undefined) => void;
17 15
     renderInitView(): JSX.Element;
18 16
     render(): JSX.Element;
19 17
 }

+ 46
- 45
lib/WantedPublishPopover/index.js View File

@@ -7,12 +7,15 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7 7
 var inherits = require('../inherits-c86d64c1.js');
8 8
 var React = require('react');
9 9
 var React__default = _interopDefault(React);
10
+require('react-dom');
11
+require('../Modal/index.js');
10 12
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
11 13
 require('../defineProperty-ba7cd53d.js');
12 14
 require('../_commonjsHelpers-72d386ba.js');
13 15
 require('../index-44e17595.js');
14 16
 var antd = require('antd');
15 17
 var WantedPublishView = require('../WantedPublishView/index.js');
18
+var WantedPublish = require('../WantedPublish-761aab8e.js');
16 19
 
17 20
 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+WlpYug8EwLwD3HYAbnmApANL5OlZVVZ0wm806hUKhpHbz8/Nfq1Sqns3NzT1wdXV1J41GYwXXdnZ2lklNTb0sAEaK8JEnGKWHSKH1xY2Cn59fILVdXFz8RqVSXdrY2Nid16amptM1NTVvyeVy0laIGV23uJ+SpnJrTAHgTSEo7v/Kyso4k8l0XqlUUoWBpaUlW3p6epfdbn9oMpnO6HS6N+RyOfnE1NTUWFZW1hUx65H1T3I1z4E9AaBULBi1Ky8vj+ns7NQFBASE0PPKysqi1WqdKSsrK5XJZC61sFqtw2q1+jMpfgmK3ocDoymkqZRkJSUlUd3d3ReCgoJI6B+zwcHBzzUazTVJDh81XgJwnQOLY8Vasp+CgoKI3t7ed5VKJSmGy4aGhvrz8vIskp096kDF5TUOjCpR7X4c9fX1nS0sLCQJ27XV1dXbubm5HTabjSpZqfYTgAEOLAzAOake+vv787VaLSVlsh2Hw/EgODiY8iHsdvsdjUbTMT09/UCi3x9oeXJgtLvKpDgYHR0tzMnJoQISOzs7zq6urss9PT0LAwMDF0JDQ6mOw9ra2t38/Hzz5OTkHxJ8k0Lc5MDo+3UArsTJZ3K5HOPj469kZmbmsFDbHR0dH+j1+hl6TklJCRkZGdGFh4fH0PP6+vq94uJi8/DwsNh6/0sAt9y18kUAiXxQ/v7+MoZhXktLS8uidk6n82FbW9ul2trab937JSUlBVmt1vORkZGx9LvD4bhfWlpqtlgsvwm8NykIqcNf7mBUsb7E19FoNJ6qr6+vojbb29t/NzY2vt/Q0ECnnz0WGxsbODEx8U50dLSrhFpeXrYlJCRcFAD7BYBrN7uDkXzQOqOzoU+zWCwarVarNRgMF9vb2+nU49OioqKUDMO8HRIScjQ7O/u9hYUFoV1KZwCbJxg9vwDgjNA6U6vVx8bGxlzliZCFhYX5xcTEHJmbm1sXaEvnzysAtryB0eIvAeAS6EO2caoJuJjeSutTAFyL+xDtdwCkqbsViq9T0mHW/ZsArlLacx8IX2C0AV4G8PQBjxqlh34AP3vG4TvwkihrDhCOTkZ0+KBqYo8JXRHQyKkBnPiPR4524CAAnwlXCIzjOc3e9AhKlogXoCspOnnz5jSxYBSPLlaeB/AcAFfZLNHuAvgKwK9i+kkB4/xRjqP6jXSQhJpPKUi4aYToc08MEF8ek9KfRo675qRv7qqTu+6kVLAv28+I7SuQ1E7/AHTQdDZ7M6+KAAAAAElFTkSuQmCC";
18 21
 
@@ -26,8 +29,8 @@ styleInject_es.styleInject(css);
26 29
 
27 30
 var WantedPublishPopover =
28 31
 /*#__PURE__*/
29
-function (_React$Component) {
30
-  inherits._inherits(WantedPublishPopover, _React$Component);
32
+function (_WatnedPublishBase) {
33
+  inherits._inherits(WantedPublishPopover, _WatnedPublishBase);
31 34
 
32 35
   function WantedPublishPopover(props) {
33 36
     var _this;
@@ -36,45 +39,17 @@ function (_React$Component) {
36 39
 
37 40
     _this = inherits._possibleConstructorReturn(this, inherits._getPrototypeOf(WantedPublishPopover).call(this, props));
38 41
 
39
-    _this.handleClose = function () {
42
+    _this.handleConfirmButton = function (containerRef) {
40 43
       var handleConfirm = _this.props.handleConfirm;
41 44
 
42 45
       if (handleConfirm) {
43
-        _this.handleUpdateCurrentWanted(_this.state.current_wanted, function (value) {
44
-          handleConfirm(Number(value).toFixed(2));
45
-        });
46
-      }
47
-
48
-      _this.setState({
49
-        visible: false
50
-      });
51
-    };
52
-
53
-    _this.clearCurrentWanted = function (cb) {
54
-      _this.setState({
55
-        current_wanted: null
56
-      }, function () {
57
-        return cb();
58
-      });
59
-    };
60
-
61
-    _this.handleUpdateCurrentWanted = function (value, afterUpdate) {
62
-      if (!value) return;
63
-      var result;
64
-      result = value;
46
+        var value = _this.formatCurrentWanted(_this.state.current_wanted);
65 47
 
66
-      if (parseInt("".concat(value), 10) === value) {
67
-        result = Number(value);
48
+        handleConfirm(_this.formatResult(value), containerRef);
68 49
       }
69 50
 
70
-      if (!result) return;
71
-      if (result > 10000) result = 10000;
72
-      if (result < 5) result = 5;
73
-
74 51
       _this.setState({
75
-        current_wanted: result
76
-      }, function () {
77
-        return afterUpdate && afterUpdate(result);
52
+        visible: false
78 53
       });
79 54
     };
80 55
 
@@ -91,7 +66,7 @@ function (_React$Component) {
91 66
       var _this2 = this;
92 67
 
93 68
       var current_wanted = this.state.current_wanted;
94
-      return React__default.createElement(WantedPublishView.default, {
69
+      return React__default.createElement(WantedPublishView.default, Object.assign({
95 70
         type: "pop",
96 71
         current_wanted: current_wanted,
97 72
         InputWantedValueChange: function InputWantedValueChange(v) {
@@ -100,16 +75,35 @@ function (_React$Component) {
100 75
           });
101 76
         },
102 77
         InputWantedPressEnter: function InputWantedPressEnter(v) {
103
-          return _this2.handleUpdateCurrentWanted(v, _this2.handleClose);
78
+          var value = _this2.formatCurrentWanted(v);
79
+
80
+          if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
81
+
82
+          _this2.setState({
83
+            current_wanted: value,
84
+            visible: false
85
+          });
104 86
         },
105 87
         InputWantedOnBlur: function InputWantedOnBlur(v) {
106
-          return _this2.handleUpdateCurrentWanted(v);
88
+          var value = _this2.formatCurrentWanted(v);
89
+
90
+          _this2.setState({
91
+            current_wanted: value
92
+          });
107 93
         },
108 94
         InputWantedClear: function InputWantedClear() {
109
-          return _this2.clearCurrentWanted(_this2.handleClose);
95
+          _this2.setState({
96
+            current_wanted: null
97
+          }, function () {
98
+            if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
99
+
100
+            _this2.setState({
101
+              visible: false
102
+            });
103
+          });
110 104
         },
111
-        CloseFunction: this.handleClose
112
-      });
105
+        InputWantedConfirm: this.handleConfirmButton
106
+      }, this.props.viewConfig));
113 107
     }
114 108
   }, {
115 109
     key: "render",
@@ -119,14 +113,17 @@ function (_React$Component) {
119 113
       var _this$props = this.props,
120 114
           children = _this$props.children,
121 115
           _this$props$popoverCo = _this$props.popoverConfig,
122
-          popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo;
116
+          popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo,
117
+          currentWanted = _this$props.currentWanted;
123 118
       return React__default.createElement(antd.Popover, Object.assign({
124 119
         placement: "left",
125 120
         trigger: "click",
126 121
         visible: this.state.visible,
127 122
         onVisibleChange: function onVisibleChange(value) {
128
-          if (!value) {
129
-            _this3.handleClose();
123
+          if (value && currentWanted) {
124
+            _this3.setState({
125
+              current_wanted: +currentWanted
126
+            });
130 127
           }
131 128
 
132 129
           _this3.setState({
@@ -142,7 +139,11 @@ function (_React$Component) {
142 139
           className: styles.closeBtnWrapper
143 140
         }, React__default.createElement("div", {
144 141
           className: styles.closeBtn,
145
-          onClick: this.handleClose
142
+          onClick: function onClick() {
143
+            _this3.setState({
144
+              visible: false
145
+            });
146
+          }
146 147
         }, React__default.createElement("img", {
147 148
           src: img,
148 149
           alt: "close wanted button"
@@ -152,7 +153,7 @@ function (_React$Component) {
152 153
   }]);
153 154
 
154 155
   return WantedPublishPopover;
155
-}(React__default.Component);
156
+}(WantedPublish.WatnedPublishBase);
156 157
 
157 158
 exports.WantedPublishPopover = WantedPublishPopover;
158 159
 exports.default = WantedPublishPopover;

+ 1
- 1
lib/WantedPublishPopover/index.js.map
File diff suppressed because it is too large
View File


+ 23
- 4
lib/WantedPublishView/index.d.ts View File

@@ -1,20 +1,39 @@
1 1
 /// <reference types="react" />
2
-import React from 'react';
2
+import React from "react";
3 3
 interface WantedPublishViewProps {
4
-    type?: 'pop' | 'modal';
4
+    type?: "pop" | "modal";
5 5
     wrapperClass?: string;
6 6
     current_wanted: number | string | null;
7
+    showInputWantedClear?: boolean;
8
+    viewTextOptions?: {
9
+        viewTitle: string;
10
+        imgLabelBottom: string;
11
+        inputTipTop: string;
12
+        numberSuffix: string;
13
+        inputTipBottom: string;
14
+    };
7 15
     InputWantedValueChange: Function;
8 16
     InputWantedPressEnter: Function;
9 17
     InputWantedOnBlur: Function;
10 18
     InputWantedClear: Function;
11
-    CloseFunction: Function;
19
+    InputWantedConfirm: Function;
12 20
 }
13 21
 interface WantedPublishViewState {
14 22
     payment?: number;
15 23
 }
16 24
 declare class WantedPublishView extends React.Component<WantedPublishViewProps, WantedPublishViewState> {
25
+    private containerRef;
17 26
     constructor(props: WantedPublishViewProps);
27
+    componentWillUnmount(): void;
18 28
     render(): JSX.Element;
19 29
 }
20
-export { WantedPublishView as default };
30
+declare function WantedViewWranModel({ refMount, actionConfirm, actionCancel, viewTextOptions }: {
31
+    refMount: any;
32
+    actionConfirm: any;
33
+    actionCancel: any;
34
+    viewTextOptions?: {
35
+        warnModalTitle?: string;
36
+        warnModalTip?: string;
37
+    };
38
+}): void;
39
+export { WantedPublishView as default, WantedViewWranModel };

+ 82
- 16
lib/WantedPublishView/index.js
File diff suppressed because it is too large
View File


+ 1
- 1
lib/WantedPublishView/index.js.map
File diff suppressed because it is too large
View File


+ 3
- 0
lib/index.js View File

@@ -20,15 +20,18 @@ var WaitPayInfoView = require('./WaitPayInfoView/index.js');
20 20
 var AllocWantedModal = require('./AllocWantedModal/index.js');
21 21
 var WantedPublishView = require('./WantedPublishView/index.js');
22 22
 var WantedPublishPopover = require('./WantedPublishPopover/index.js');
23
+require('./WantedPublish-761aab8e.js');
23 24
 
24 25
 
25 26
 
26 27
 exports.Modal = Modal.default;
28
+exports.ModalCMD = Modal.ModalCMD;
27 29
 exports.ConsumeListView = ConsumeListView.default;
28 30
 exports.PayPlatformOptions = PayPlatformOptions.default;
29 31
 exports.PriceOptions = PriceOptions.default;
30 32
 exports.WaitPayInfoView = WaitPayInfoView.default;
31 33
 exports.AllocWantedModal = AllocWantedModal.default;
32 34
 exports.WantedPublishView = WantedPublishView.default;
35
+exports.WantedViewWranModel = WantedPublishView.WantedViewWranModel;
33 36
 exports.WantedPublishPopover = WantedPublishPopover.default;
34 37
 //# sourceMappingURL=index.js.map

+ 1
- 1
lib/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

+ 1
- 2
src/components/Common/Modal/index.tsx View File

@@ -113,8 +113,7 @@ export class ModalCMD {
113 113
               position: "absolute",
114 114
               top: "50%",
115 115
               left: "50%",
116
-              transform: "translate(-50%, -50%)",
117
-              backgroundColor: "white"
116
+              transform: "translate(-50%, -50%)"
118 117
             }}
119 118
           >
120 119
             {children}

+ 2
- 1
src/components/Common/index.ts View File

@@ -1 +1,2 @@
1
-export { default as Modal } from './Modal';
1
+export { default as Modal } from "./Modal";
2
+export { ModalCMD } from "./Modal";

+ 46
- 0
src/components/Payment/BaseClassComponents/WantedPublish.tsx View File

@@ -0,0 +1,46 @@
1
+import React, { Component } from "react";
2
+
3
+export interface WatnedPublishBaseP {
4
+  inputWantedRange?: [number, number];
5
+  handleConfirm?: Function;
6
+  currentWanted?: string | number | null;
7
+  viewConfig?: {
8
+    showInputWantedClear?: boolean;
9
+    viewTextOptions?: {
10
+      viewTitle: string;
11
+      imgLabelBottom: string;
12
+      inputTipTop: string;
13
+      numberSuffix: string;
14
+      inputTipBottom: string;
15
+      clearModalTitle?: string;
16
+      clearModalTip?: string;
17
+    };
18
+  };
19
+}
20
+
21
+export class WatnedPublishBase<
22
+  T extends WatnedPublishBaseP,
23
+  S
24
+> extends Component<T, S> {
25
+  formatCurrentWanted = (
26
+    value: string | number | null
27
+  ): string | number | null => {
28
+    const { inputWantedRange = [5, 10000] } = this.props;
29
+    if (!value) return null;
30
+    let result: string | number;
31
+    result = value;
32
+    if (parseInt(`${value}`, 10) === value) {
33
+      // 无小数判断
34
+      result = Number(value);
35
+    }
36
+    if (!result) return null;
37
+    if (result > inputWantedRange[1]) result = inputWantedRange[1];
38
+    if (result < inputWantedRange[0]) result = inputWantedRange[0];
39
+    return result;
40
+  };
41
+
42
+  formatResult = (value: string | number | null) => {
43
+    if (!value) return null;
44
+    return Number(value).toFixed(2);
45
+  };
46
+}

+ 33
- 55
src/components/Payment/WantedPublishModal/index.tsx View File

@@ -1,15 +1,15 @@
1
-import React, { Component } from "react";
1
+import React, { Component, Ref } from "react";
2 2
 
3 3
 import Modal, { ModalProps } from "../../Common/Modal";
4 4
 import WantedPublishView from "../WantedPublishView";
5 5
 import styles from "./WantedPublishModal.less";
6
+import {
7
+  WatnedPublishBase,
8
+  WatnedPublishBaseP
9
+} from "@components/Payment/BaseClassComponents/WantedPublish";
6 10
 
7
-interface WantedPublishModalProps {
11
+interface WantedPublishModalProps extends WatnedPublishBaseP {
8 12
   modalConfig?: ModalProps;
9
-  viewConfig?: {
10
-    showInputWantedClear?: boolean;
11
-  };
12
-  handleConfirm?: Function;
13 13
 }
14 14
 
15 15
 interface WantedPublishModalState {
@@ -17,7 +17,7 @@ interface WantedPublishModalState {
17 17
   current_wanted: number | string | null;
18 18
 }
19 19
 
20
-export class WantedPublishModal extends Component<
20
+export class WantedPublishModal extends WatnedPublishBase<
21 21
   WantedPublishModalProps,
22 22
   WantedPublishModalState
23 23
 > {
@@ -29,50 +29,15 @@ export class WantedPublishModal extends Component<
29 29
     };
30 30
   }
31 31
 
32
-  handleModalShow = () => {};
33
-
34
-  handleClose = () => {
32
+  handleConfirmButton = (containerRef?: React.RefObject<any>) => {
35 33
     const { handleConfirm } = this.props;
36 34
     if (handleConfirm) {
37
-      this.handleUpdateCurrentWanted(
38
-        this.state.current_wanted,
39
-        (value: string) => {
40
-          handleConfirm(Number(value).toFixed(2));
41
-        }
42
-      );
35
+      const value = this.formatCurrentWanted(this.state.current_wanted);
36
+      handleConfirm(value ? Number(value).toFixed(2) : value);
43 37
     }
44 38
     this.setState({ modalVisible: false });
45 39
   };
46 40
 
47
-  handleUpdateCurrentWanted = (
48
-    value: string | number | null,
49
-    afterUpdate?: Function
50
-  ) => {
51
-    if (!value) return;
52
-    let result: string | number;
53
-    result = value;
54
-    if (parseInt(`${value}`, 10) === value) {
55
-      // 无小数判断
56
-      result = Number(value);
57
-    }
58
-    if (!result) return;
59
-    if (result > 10000) result = 10000;
60
-    if (result < 5) result = 5;
61
-    this.setState(
62
-      { current_wanted: result },
63
-      () => afterUpdate && afterUpdate(result)
64
-    );
65
-  };
66
-
67
-  clearCurrentWanted = (cb: Function) => {
68
-    this.setState(
69
-      {
70
-        current_wanted: null
71
-      },
72
-      () => cb()
73
-    );
74
-  };
75
-
76 41
   renderMain() {
77 42
     const { current_wanted } = this.state;
78 43
     return (
@@ -82,17 +47,28 @@ export class WantedPublishModal extends Component<
82 47
         InputWantedValueChange={(v: string) =>
83 48
           this.setState({ current_wanted: v })
84 49
         }
85
-        InputWantedPressEnter={(v: string) =>
86
-          this.handleUpdateCurrentWanted(v, this.handleClose)
87
-        }
88
-        InputWantedOnBlur={(v: string) => this.handleUpdateCurrentWanted(v)}
50
+        InputWantedPressEnter={(v: string) => {
51
+          const value = this.formatCurrentWanted(v);
52
+          if (this.props.handleConfirm)
53
+            this.props.handleConfirm(this.formatResult(value));
54
+          this.setState({ current_wanted: value, modalVisible: false });
55
+        }}
56
+        InputWantedOnBlur={(v: string) => {
57
+          const value = this.formatCurrentWanted(v);
58
+          this.setState({ current_wanted: value });
59
+        }}
89 60
         InputWantedClear={() => {
90
-          this.clearCurrentWanted(() => {
91
-            if (this.props.handleConfirm) this.props.handleConfirm(null);
92
-            this.setState({ modalVisible: false });
93
-          });
61
+          this.setState(
62
+            {
63
+              current_wanted: null
64
+            },
65
+            () => {
66
+              if (this.props.handleConfirm) this.props.handleConfirm(null);
67
+              this.setState({ modalVisible: false });
68
+            }
69
+          );
94 70
         }}
95
-        CloseFunction={this.handleClose}
71
+        InputWantedConfirm={this.handleConfirmButton}
96 72
         {...this.props.viewConfig}
97 73
       />
98 74
     );
@@ -106,7 +82,9 @@ export class WantedPublishModal extends Component<
106 82
         </div>
107 83
         <Modal
108 84
           visible={this.state.modalVisible}
109
-          onCancel={this.handleClose}
85
+          onCancel={() => {
86
+            this.setState({ modalVisible: false });
87
+          }}
110 88
           {...this.props.modalConfig}
111 89
         >
112 90
           {this.renderMain()}

+ 38
- 61
src/components/Payment/WantedPublishPopover/index.tsx View File

@@ -5,13 +5,13 @@ import WantedPublishView from "../WantedPublishView";
5 5
 
6 6
 import popClose from "../assets/icon/close@2x.png";
7 7
 import styles from "./WantedPublishPopover.less";
8
+import {
9
+  WatnedPublishBase,
10
+  WatnedPublishBaseP
11
+} from "@components/Payment/BaseClassComponents/WantedPublish";
8 12
 
9
-export interface WantedPublishPopoverProp {
13
+export interface WantedPublishPopoverProp extends WatnedPublishBaseP {
10 14
   popoverConfig?: PopoverProps;
11
-  viewConfig?: {
12
-    showInputWantedClear?: boolean;
13
-  };
14
-  handleConfirm?: Function;
15 15
 }
16 16
 
17 17
 export interface WantedPublishPopoverState {
@@ -19,7 +19,7 @@ export interface WantedPublishPopoverState {
19 19
   current_wanted: number | string | null;
20 20
 }
21 21
 
22
-export class WantedPublishPopover extends React.Component<
22
+export class WantedPublishPopover extends WatnedPublishBase<
23 23
   WantedPublishPopoverProp,
24 24
   WantedPublishPopoverState
25 25
 > {
@@ -31,54 +31,15 @@ export class WantedPublishPopover extends React.Component<
31 31
     };
32 32
   }
33 33
 
34
-  handleClose = () => {
34
+  handleConfirmButton = (containerRef?: React.RefObject<any>) => {
35 35
     const { handleConfirm } = this.props;
36 36
     if (handleConfirm) {
37
-      this.handleUpdateCurrentWanted(
38
-        this.state.current_wanted,
39
-        (value: string) => {
40
-          handleConfirm(value ? Number(value).toFixed(2) : value);
41
-        }
42
-      );
37
+      const value = this.formatCurrentWanted(this.state.current_wanted);
38
+      handleConfirm(this.formatResult(value), containerRef);
43 39
     }
44 40
     this.setState({ visible: false });
45 41
   };
46 42
 
47
-  clearCurrentWanted = (cb: Function) => {
48
-    this.setState(
49
-      {
50
-        current_wanted: null
51
-      },
52
-      () => cb()
53
-    );
54
-  };
55
-
56
-  handleUpdateCurrentWanted = (
57
-    value: string | number | null,
58
-    afterUpdate?: Function
59
-  ) => {
60
-    if (!value) {
61
-      this.setState(
62
-        { current_wanted: null },
63
-        () => afterUpdate && afterUpdate(null)
64
-      );
65
-      return;
66
-    }
67
-    let result: string | number;
68
-    result = value;
69
-    if (parseInt(`${value}`, 10) === value) {
70
-      // 无小数判断
71
-      result = Number(value);
72
-    }
73
-    if (!result) return;
74
-    if (result > 10000) result = 10000;
75
-    if (result < 5) result = 5;
76
-    this.setState(
77
-      { current_wanted: result },
78
-      () => afterUpdate && afterUpdate(result)
79
-    );
80
-  };
81
-
82 43
   renderInitView() {
83 44
     const { current_wanted } = this.state;
84 45
     return (
@@ -88,24 +49,35 @@ export class WantedPublishPopover extends React.Component<
88 49
         InputWantedValueChange={(v: string) =>
89 50
           this.setState({ current_wanted: v })
90 51
         }
91
-        InputWantedPressEnter={(v: string) =>
92
-          this.handleUpdateCurrentWanted(v, this.handleClose)
93
-        }
94
-        InputWantedOnBlur={(v: string) => this.handleUpdateCurrentWanted(v)}
52
+        InputWantedPressEnter={(v: string) => {
53
+          const value = this.formatCurrentWanted(v);
54
+          if (this.props.handleConfirm)
55
+            this.props.handleConfirm(this.formatResult(value));
56
+          this.setState({ current_wanted: value, visible: false });
57
+        }}
58
+        InputWantedOnBlur={(v: string) => {
59
+          const value = this.formatCurrentWanted(v);
60
+          this.setState({ current_wanted: value });
61
+        }}
95 62
         InputWantedClear={() => {
96
-          this.clearCurrentWanted(() => {
97
-            if (this.props.handleConfirm) this.props.handleConfirm(null);
98
-            this.setState({ visible: false });
99
-          });
63
+          this.setState(
64
+            {
65
+              current_wanted: null
66
+            },
67
+            () => {
68
+              if (this.props.handleConfirm) this.props.handleConfirm(null);
69
+              this.setState({ visible: false });
70
+            }
71
+          );
100 72
         }}
101
-        CloseFunction={this.handleClose}
73
+        InputWantedConfirm={this.handleConfirmButton}
102 74
         {...this.props.viewConfig}
103 75
       />
104 76
     );
105 77
   }
106 78
 
107 79
   render() {
108
-    const { children, popoverConfig = {} } = this.props;
80
+    const { children, popoverConfig = {}, currentWanted } = this.props;
109 81
 
110 82
     return (
111 83
       <Popover
@@ -113,8 +85,8 @@ export class WantedPublishPopover extends React.Component<
113 85
         trigger="click"
114 86
         visible={this.state.visible}
115 87
         onVisibleChange={(value: boolean) => {
116
-          if (!value) {
117
-            this.handleClose();
88
+          if (value && currentWanted) {
89
+            this.setState({ current_wanted: +currentWanted });
118 90
           }
119 91
           this.setState({ visible: value });
120 92
         }}
@@ -122,7 +94,12 @@ export class WantedPublishPopover extends React.Component<
122 94
         content={
123 95
           <div className={styles.wantedWrapper}>
124 96
             <div role="button" tabIndex={1} className={styles.closeBtnWrapper}>
125
-              <div className={styles.closeBtn} onClick={this.handleClose}>
97
+              <div
98
+                className={styles.closeBtn}
99
+                onClick={() => {
100
+                  this.setState({ visible: false });
101
+                }}
102
+              >
126 103
                 <img src={popClose} alt="close wanted button" />
127 104
               </div>
128 105
             </div>

+ 46
- 45
src/components/Payment/WantedPublishView/WantedPublishView.less View File

@@ -73,58 +73,59 @@
73 73
       }
74 74
     }
75 75
   }
76
+}
76 77
 
77
-  .wantedCancelModal {
78
-    width: 320px;
79
-    height: 211px;
80
-    padding: 32px;
81
-    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);
82
-    border-radius: 4px;
83
-
84
-    .top {
85
-      display: flex;
86
-      .questionIcon {
87
-        width: 22px;
88
-        height: 22px;
89
-
90
-        img {
91
-          width: 100%;
92
-          height: 100%;
93
-        }
94
-      }
95
-      .title {
96
-        font-size: 16px;
97
-        color: rgba(0, 0, 0, 0.85);
98
-        font-weight: bold;
99
-        margin-left: 16px;
78
+.wantedCancelModal {
79
+  width: 320px;
80
+  padding: 32px 32px 24px 32px;
81
+  box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);
82
+  background-color: white;
83
+  border-radius: 4px;
84
+
85
+  .top {
86
+    display: flex;
87
+    .questionIcon {
88
+      width: 22px;
89
+      height: 22px;
90
+
91
+      img {
92
+        width: 100%;
93
+        height: 100%;
100 94
       }
101 95
     }
102
-
103
-    .content {
104
-      margin-left: 38px;
105
-      font-size: 14px;
96
+    .title {
97
+      font-size: 16px;
98
+      color: rgba(0, 0, 0, 0.85);
99
+      font-weight: bold;
100
+      margin-left: 16px;
106 101
     }
102
+  }
107 103
 
108
-    footer {
109
-      display: flex;
110
-      justify-content: flex-end;
111
-      align-items: center;
104
+  .content {
105
+    margin-left: 38px;
106
+    font-size: 14px;
107
+  }
112 108
 
113
-      .modalCancel {
114
-      }
115
-      .modalOk {
116
-        margin-left: 8px;
117
-        background-color: #71c135;
118
-        color: white;
109
+  footer {
110
+    display: flex;
111
+    justify-content: flex-end;
112
+    align-items: center;
113
+    margin-top: 20px;
119 114
 
120
-        &:hover,
121
-        &:focus {
122
-          color: white;
123
-          outline: none;
124
-          box-shadow: none;
125
-          background-color: lighten(#71c135, 10%);
126
-          border-color: lighten(#71c135, 50%);
127
-        }
115
+    .modalCancel {
116
+    }
117
+    .modalOk {
118
+      margin-left: 8px;
119
+      background-color: #71c135;
120
+      color: white;
121
+
122
+      &:hover,
123
+      &:focus {
124
+        color: white;
125
+        outline: none;
126
+        box-shadow: none;
127
+        background-color: lighten(#71c135, 10%);
128
+        border-color: lighten(#71c135, 50%);
128 129
       }
129 130
     }
130 131
   }

+ 80
- 40
src/components/Payment/WantedPublishView/index.tsx View File

@@ -13,11 +13,18 @@ interface WantedPublishViewProps {
13 13
   wrapperClass?: string;
14 14
   current_wanted: number | string | null;
15 15
   showInputWantedClear?: boolean;
16
+  viewTextOptions?: {
17
+    viewTitle: string;
18
+    imgLabelBottom: string;
19
+    inputTipTop: string;
20
+    numberSuffix: string;
21
+    inputTipBottom: string;
22
+  };
16 23
   InputWantedValueChange: Function;
17 24
   InputWantedPressEnter: Function;
18 25
   InputWantedOnBlur: Function;
19 26
   InputWantedClear: Function;
20
-  CloseFunction: Function;
27
+  InputWantedConfirm: Function;
21 28
 }
22 29
 interface WantedPublishViewState {
23 30
   payment?: number;
@@ -34,10 +41,19 @@ class WantedPublishView extends React.Component<
34 41
     this.state = {};
35 42
   }
36 43
 
44
+  componentWillUnmount(): void {}
45
+
37 46
   render() {
38 47
     const {
39 48
       current_wanted,
40 49
       wrapperClass,
50
+      viewTextOptions = {
51
+        viewTitle: "设置悬赏金额",
52
+        imgLabelBottom: "悬赏提问",
53
+        inputTipTop: "设置悬赏金额范围¥5.00~¥10000",
54
+        numberSuffix: "元",
55
+        inputTipBottom: "若5天内没人回答该问题, 所支付的金额将退还至您的钱包"
56
+      },
41 57
       showInputWantedClear = true
42 58
     } = this.props;
43 59
     return (
@@ -47,14 +63,14 @@ class WantedPublishView extends React.Component<
47 63
         })}
48 64
         ref={this.containerRef}
49 65
       >
50
-        <header>设置悬赏金额</header>
66
+        <header>{viewTextOptions.viewTitle}</header>
51 67
         <section className={styles.wanted_middle}>
52 68
           <img
53 69
             className={styles.wanted_cover}
54 70
             src={wantedCover}
55 71
             alt="wanted_image"
56 72
           />
57
-          <div>悬赏提问</div>
73
+          <div>{viewTextOptions.imgLabelBottom}</div>
58 74
         </section>
59 75
         <Divider
60 76
           style={{
@@ -66,11 +82,11 @@ class WantedPublishView extends React.Component<
66 82
         />
67 83
         <section className={styles.wanted_bottom}>
68 84
           <div className={styles.wanted_bottom_title}>
69
-            设置悬赏金额范围¥5.00~¥10000
85
+            {viewTextOptions.inputTipTop}
70 86
           </div>
71 87
           <Input
72 88
             className={styles.wanted_input_number}
73
-            suffix="元"
89
+            suffix={viewTextOptions.numberSuffix}
74 90
             value={current_wanted || ""}
75 91
             onChange={v => {
76 92
               if (!/^[.0-9]*$/g.test(v.target.value)) return;
@@ -85,13 +101,15 @@ class WantedPublishView extends React.Component<
85 101
             autoFocus
86 102
           />
87 103
           <div className={styles.wanted_bottom_tips}>
88
-            若5天内没人回答该问题, 所支付的金额将退还至您的钱包
104
+            {viewTextOptions.inputTipBottom}
89 105
           </div>
90 106
         </section>
91 107
         <footer>
92 108
           <Button
93 109
             className={styles.wanted_confirm_button}
94
-            onClick={() => this.props.CloseFunction()}
110
+            onClick={() => {
111
+              this.props.InputWantedConfirm(this.containerRef);
112
+            }}
95 113
           >
96 114
             确定
97 115
           </Button>
@@ -100,39 +118,7 @@ class WantedPublishView extends React.Component<
100 118
               role="button"
101 119
               tabIndex={-1}
102 120
               onClick={() => {
103
-                ModalCMD.show({
104
-                  container: this.containerRef.current || document.body,
105
-                  children: (
106
-                    <div className={styles.wantedCancelModal}>
107
-                      <div className={styles.top}>
108
-                        <div className={styles.questionIcon}>
109
-                          <img src={QuestionIcon} alt="question" />
110
-                        </div>
111
-                        <div className={styles.title}>确认减少悬赏金额</div>
112
-                      </div>
113
-                      <div className={styles.content}>
114
-                        若减少悬赏金额,您之前支付的金额中,已分配的赏金无法退回,剩余的¥2.00会退还至您的钱包。
115
-                      </div>
116
-                      <footer>
117
-                        <Button
118
-                          className={styles.modalCancel}
119
-                          onClick={() => ModalCMD.hide()}
120
-                        >
121
-                          取消
122
-                        </Button>
123
-                        <Button
124
-                          className={styles.modalOk}
125
-                          onClick={() => {
126
-                            this.props.InputWantedClear();
127
-                            ModalCMD.hide();
128
-                          }}
129
-                        >
130
-                          确认
131
-                        </Button>
132
-                      </footer>
133
-                    </div>
134
-                  )
135
-                });
121
+                this.props.InputWantedClear();
136 122
               }}
137 123
               className={styles.wanted_cancel_button}
138 124
             >
@@ -145,4 +131,58 @@ class WantedPublishView extends React.Component<
145 131
   }
146 132
 }
147 133
 
134
+export function WantedViewWranModel({
135
+  refMount,
136
+  actionConfirm,
137
+  actionCancel,
138
+  viewTextOptions = {
139
+    warnModalTitle: "确认减少悬赏金额",
140
+    warnModalTip:
141
+      "若减少悬赏金额,您之前支付的金额中,已分配的赏金无法退回,剩余的¥2.00会退还至您的钱包。"
142
+  }
143
+}: {
144
+  refMount: any;
145
+  actionConfirm: any;
146
+  actionCancel: any;
147
+  viewTextOptions?: {
148
+    warnModalTitle?: string;
149
+    warnModalTip?: string;
150
+  };
151
+}) {
152
+  ModalCMD.show({
153
+    container: refMount.current || document.body,
154
+    children: (
155
+      <div className={styles.wantedCancelModal}>
156
+        <div className={styles.top}>
157
+          <div className={styles.questionIcon}>
158
+            <img src={QuestionIcon} alt="question" />
159
+          </div>
160
+          <div className={styles.title}>{viewTextOptions.warnModalTitle}</div>
161
+        </div>
162
+        <div className={styles.content}>{viewTextOptions.warnModalTip}</div>
163
+        <footer>
164
+          <Button
165
+            className={styles.modalCancel}
166
+            onClick={() => {
167
+              actionCancel();
168
+              ModalCMD.hide();
169
+            }}
170
+          >
171
+            取消
172
+          </Button>
173
+          <Button
174
+            className={styles.modalOk}
175
+            onClick={() => {
176
+              actionConfirm();
177
+              ModalCMD.hide();
178
+            }}
179
+          >
180
+            确认
181
+          </Button>
182
+        </footer>
183
+      </div>
184
+    )
185
+  });
186
+}
187
+
148 188
 export default WantedPublishView;

+ 10
- 7
src/components/Payment/index.ts View File

@@ -1,7 +1,10 @@
1
-export { default as ConsumeListView } from './ConsumeListView';
2
-export { default as PayPlatformOptions } from './PayPlatformOptions';
3
-export { default as PriceOptions } from './PriceOptions';
4
-export { default as WaitPayInfoView } from './WaitPayInfoView';
5
-export { default as AllocWantedModal } from './AllocWantedModal';
6
-export { default as WantedPublishPopover } from './WantedPublishPopover';
7
-export { default as WantedPublishView } from './WantedPublishView';
1
+export { default as ConsumeListView } from "./ConsumeListView";
2
+export { default as PayPlatformOptions } from "./PayPlatformOptions";
3
+export { default as PriceOptions } from "./PriceOptions";
4
+export { default as WaitPayInfoView } from "./WaitPayInfoView";
5
+export { default as AllocWantedModal } from "./AllocWantedModal";
6
+export { default as WantedPublishPopover } from "./WantedPublishPopover";
7
+export {
8
+  default as WantedPublishView,
9
+  WantedViewWranModel
10
+} from "./WantedPublishView";

+ 1
- 2
stats.html
File diff suppressed because it is too large
View File


+ 33
- 3
stories/Wanted.stories.tsx View File

@@ -11,9 +11,12 @@ import { addReadme } from "storybook-readme";
11 11
 import React from "react";
12 12
 import AllocWantedModal from "@components/Payment/AllocWantedModal";
13 13
 import { Button, Divider, Modal } from "antd";
14
-import WantedPublishView from "@components/Payment/WantedPublishView";
14
+import WantedPublishView, {
15
+  WantedViewWranModel
16
+} from "@components/Payment/WantedPublishView";
15 17
 import WantedPublishModal from "@components/Payment/WantedPublishModal";
16 18
 import WantedPublishPopover from "@components/Payment/WantedPublishPopover";
19
+import { ModalCMD } from "@components/Common";
17 20
 
18 21
 const stories = storiesOf("Payment/Wanted", module);
19 22
 stories.addDecorator(storyFn => (
@@ -75,7 +78,7 @@ stories.add(
75 78
           InputWantedPressEnter={(enterValue: any) =>
76 79
             setCurrentWanted(enterValue)
77 80
           }
78
-          CloseFunction={() => {
81
+          InputWantedConfirm={() => {
79 82
             console.log("Close Button");
80 83
           }}
81 84
         />
@@ -99,6 +102,22 @@ stories.add(
99 102
       <div>
100 103
         <div>
101 104
           <WantedPublishModal
105
+            currentWanted={wanted}
106
+            handleConfirm={(value: any, ref: React.Ref<any>) => {
107
+              console.log("wanted", wanted);
108
+              console.log("value", value);
109
+              if (Number(wanted) - value > 0) {
110
+                WantedViewWranModel({
111
+                  refMount: document.body,
112
+                  actionConfirm: () => {
113
+                    setWanted(value);
114
+                  },
115
+                  actionCancel: () => {}
116
+                });
117
+                return;
118
+              }
119
+              setWanted(value);
120
+            }}
102 121
             viewConfig={{
103 122
               showInputWantedClear: boolean(
104 123
                 "viewConfig.showInputWantedClear",
@@ -144,7 +163,18 @@ stories.add(
144 163
                 undefined
145 164
               )
146 165
             }}
147
-            handleConfirm={(value: any) => {
166
+            currentWanted={wanted}
167
+            handleConfirm={(value: any, ref: React.Ref<any>) => {
168
+              if (Number(wanted) - value > 0) {
169
+                WantedViewWranModel({
170
+                  refMount: document.body,
171
+                  actionConfirm: () => {
172
+                    setWanted(value);
173
+                  },
174
+                  actionCancel: () => {}
175
+                });
176
+                return;
177
+              }
148 178
               setWanted(value);
149 179
             }}
150 180
             viewConfig={{