cloud-b2b 1.1.57 → 1.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/package.json +44 -22
  2. package/src/Area/Area.js +94 -0
  3. package/src/Card/Card.js +16 -0
  4. package/src/CodeInput/CodeInput.js +76 -0
  5. package/src/Control/Control.js +338 -0
  6. package/src/Control/event.js +45 -0
  7. package/src/Enhance/Dialogs.js +24 -0
  8. package/src/Enhance/Loading.js +83 -0
  9. package/{es → src}/Enhance/index.js +8 -6
  10. package/src/Header/Header.js +149 -0
  11. package/src/Header/Vertical.js +74 -0
  12. package/src/ImageView/ImageView.js +62 -0
  13. package/src/Indent/Indent.js +12 -0
  14. package/src/InpurCascader/InputCascader.js +83 -0
  15. package/src/InputEditor/InputEditor.js +93 -0
  16. package/src/InputSearch/InputSearch.js +186 -0
  17. package/src/InputSelect/InputSelect.js +103 -0
  18. package/src/InputTreeSelect/InputTreeSelect.js +87 -0
  19. package/src/InputWriting/InputWriting.js +65 -0
  20. package/src/Layout/Layout.js +121 -0
  21. package/src/LayoutLink/LayoutLink.js +59 -0
  22. package/src/Link/Link.js +57 -0
  23. package/src/Loading/Loading.js +15 -0
  24. package/src/Loading2/Loading2.js +15 -0
  25. package/src/ModalWithDrag/ModalWithDrag.js +17 -0
  26. package/{es → src}/ModalWithDrag/drag.js +128 -116
  27. package/src/NumberInput/NumberInput.js +137 -0
  28. package/src/Search/Search.js +368 -0
  29. package/src/Search2/Search.js +436 -0
  30. package/{lib/Search → src/Search2}/Search.less +65 -63
  31. package/{lib/Search → src/Search2}/package.json +6 -6
  32. package/src/Sidebar/Sidebar.js +111 -0
  33. package/src/Sidebar2/Sidebar.js +143 -0
  34. package/src/SuperForm/SuperForm.js +519 -0
  35. package/src/SuperForm2/SuperForm.js +588 -0
  36. package/src/SuperIcon/SuperIcon.js +14 -0
  37. package/src/SuperPagination/SuperPagination.js +65 -0
  38. package/src/SuperTab/SuperTab.js +84 -0
  39. package/src/SuperTab2/SuperTab2.js +94 -0
  40. package/src/SuperTable/DragSortRow.js +62 -0
  41. package/src/SuperTable/FilterDropDown.js +111 -0
  42. package/src/SuperTable/SuperTable.js +590 -0
  43. package/src/SuperTable/fixed.js +34 -0
  44. package/src/SuperTable2/SuperTable2.js +624 -0
  45. package/src/SuperTable2/SuperTableCell.js +175 -0
  46. package/src/SuperTable3/FilterDropDown.js +111 -0
  47. package/src/SuperTable3/SuperTable.js +498 -0
  48. package/src/SuperTable3/fixed.js +34 -0
  49. package/src/SuperToolbar/SuperToolbar.js +128 -0
  50. package/src/SuperUpload/SuperUpload.js +137 -0
  51. package/src/Title/Title.js +18 -0
  52. package/src/Viewer/ImageViews.js +220 -0
  53. package/src/Viewer/Viewer.js +97 -0
  54. package/src/WingBlank/WingBlank.js +14 -0
  55. package/src/helper.js +185 -0
  56. package/{es → src}/history.js +6 -6
  57. package/src/index.js +39 -0
  58. package/src/variables.js +5 -0
  59. package/test/index.html +10 -0
  60. package/test/test.js +16 -0
  61. package/test/test.less +12 -0
  62. package/test/webpack.config.js +71 -0
  63. package/tools/babel.config.js +14 -0
  64. package/tools/build.js +70 -0
  65. package/tools/publish.js +9 -0
  66. package/tools/util.js +53 -0
  67. package/es/Area/Area.js +0 -138
  68. package/es/Card/Card.js +0 -19
  69. package/es/CodeInput/CodeInput.js +0 -120
  70. package/es/Control/Control.js +0 -444
  71. package/es/Control/event.js +0 -43
  72. package/es/Enhance/Dialogs.js +0 -49
  73. package/es/Enhance/Loading.js +0 -128
  74. package/es/Header/Header.js +0 -159
  75. package/es/Header/Vertical.js +0 -103
  76. package/es/ImageView/ImageView.js +0 -97
  77. package/es/Indent/Indent.js +0 -19
  78. package/es/InpurCascader/InputCascader.js +0 -114
  79. package/es/InputEditor/InputEditor.js +0 -171
  80. package/es/InputSearch/InputSearch.js +0 -263
  81. package/es/InputSelect/InputSelect.js +0 -157
  82. package/es/InputTreeSelect/InputTreeSelect.js +0 -118
  83. package/es/InputWriting/InputWriting.js +0 -82
  84. package/es/Layout/Layout.js +0 -198
  85. package/es/LayoutLink/LayoutLink.js +0 -73
  86. package/es/Link/Link.js +0 -82
  87. package/es/Loading/Loading.js +0 -13
  88. package/es/Loading2/Loading2.js +0 -9
  89. package/es/ModalWithDrag/ModalWithDrag.js +0 -29
  90. package/es/NumberInput/NumberInput.js +0 -197
  91. package/es/Search/Search.js +0 -494
  92. package/es/Sidebar/Sidebar.js +0 -141
  93. package/es/Sidebar2/Sidebar.js +0 -162
  94. package/es/SuperForm/SuperForm.js +0 -593
  95. package/es/SuperForm2/SuperForm.js +0 -682
  96. package/es/SuperIcon/SuperIcon.js +0 -27
  97. package/es/SuperPagination/SuperPagination.js +0 -106
  98. package/es/SuperTab/SuperTab.js +0 -104
  99. package/es/SuperTab2/SuperTab2.js +0 -142
  100. package/es/SuperTable/DragSortRow.js +0 -94
  101. package/es/SuperTable/FilterDropDown.js +0 -161
  102. package/es/SuperTable/SuperTable.js +0 -805
  103. package/es/SuperTable/fixed.js +0 -34
  104. package/es/SuperTable2/SuperTable2.js +0 -923
  105. package/es/SuperTable2/SuperTableCell.js +0 -215
  106. package/es/SuperTable3/FilterDropDown.js +0 -161
  107. package/es/SuperTable3/SuperTable.js +0 -662
  108. package/es/SuperTable3/fixed.js +0 -34
  109. package/es/SuperToolbar/SuperToolbar.js +0 -192
  110. package/es/SuperUpload/SuperUpload.js +0 -356
  111. package/es/Title/Title.js +0 -33
  112. package/es/Viewer/ImageViews.js +0 -255
  113. package/es/Viewer/Viewer.js +0 -119
  114. package/es/WingBlank/WingBlank.js +0 -16
  115. package/es/helper.js +0 -241
  116. package/es/index.js +0 -37
  117. package/es/variables.js +0 -6
  118. package/lib/Area/Area.js +0 -146
  119. package/lib/Area/package.json +0 -6
  120. package/lib/Card/Card.js +0 -27
  121. package/lib/Card/package.json +0 -6
  122. package/lib/CodeInput/CodeInput.js +0 -128
  123. package/lib/CodeInput/package.json +0 -6
  124. package/lib/Control/Control.js +0 -450
  125. package/lib/Control/event.js +0 -51
  126. package/lib/Control/package.json +0 -6
  127. package/lib/Enhance/Dialogs.js +0 -57
  128. package/lib/Enhance/Loading.js +0 -135
  129. package/lib/Enhance/index.js +0 -25
  130. package/lib/Enhance/package.json +0 -6
  131. package/lib/Header/Header.js +0 -166
  132. package/lib/Header/Header.less +0 -95
  133. package/lib/Header/Vertical.js +0 -111
  134. package/lib/Header/Vertical.less +0 -60
  135. package/lib/Header/package.json +0 -6
  136. package/lib/ImageView/ImageView.js +0 -105
  137. package/lib/ImageView/ImageView.less +0 -14
  138. package/lib/ImageView/package.json +0 -6
  139. package/lib/Indent/Indent.js +0 -27
  140. package/lib/Indent/package.json +0 -6
  141. package/lib/InpurCascader/InputCascader.js +0 -121
  142. package/lib/InpurCascader/package.json +0 -6
  143. package/lib/InputEditor/InputEditor.js +0 -179
  144. package/lib/InputEditor/inputEditor.less +0 -8
  145. package/lib/InputEditor/package.json +0 -6
  146. package/lib/InputSearch/InputSearch.js +0 -271
  147. package/lib/InputSearch/package.json +0 -6
  148. package/lib/InputSelect/InputSelect.js +0 -165
  149. package/lib/InputSelect/package.json +0 -6
  150. package/lib/InputTreeSelect/InputTreeSelect.js +0 -125
  151. package/lib/InputTreeSelect/package.json +0 -6
  152. package/lib/InputWriting/InputWriting.js +0 -90
  153. package/lib/InputWriting/package.json +0 -6
  154. package/lib/Layout/Layout.js +0 -206
  155. package/lib/Layout/Layout.less +0 -28
  156. package/lib/Layout/package.json +0 -6
  157. package/lib/LayoutLink/LayoutLink.js +0 -85
  158. package/lib/LayoutLink/LayoutLink.less +0 -53
  159. package/lib/LayoutLink/package.json +0 -6
  160. package/lib/Link/Link.js +0 -90
  161. package/lib/Link/package.json +0 -6
  162. package/lib/Loading/Loading.js +0 -21
  163. package/lib/Loading/Loading.less +0 -13
  164. package/lib/Loading/package.json +0 -6
  165. package/lib/Loading2/Loading2.js +0 -17
  166. package/lib/Loading2/Loading2.less +0 -19
  167. package/lib/Loading2/package.json +0 -6
  168. package/lib/ModalWithDrag/ModalWithDrag.js +0 -37
  169. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  170. package/lib/ModalWithDrag/drag.js +0 -124
  171. package/lib/ModalWithDrag/package.json +0 -6
  172. package/lib/NumberInput/NumberInput.js +0 -205
  173. package/lib/NumberInput/package.json +0 -6
  174. package/lib/Search/Search.js +0 -506
  175. package/lib/Sidebar/Sidebar.js +0 -149
  176. package/lib/Sidebar/Sidebar.less +0 -78
  177. package/lib/Sidebar/package.json +0 -6
  178. package/lib/Sidebar2/Sidebar.js +0 -170
  179. package/lib/Sidebar2/Sidebar.less +0 -153
  180. package/lib/Sidebar2/package.json +0 -6
  181. package/lib/SuperForm/SuperForm.js +0 -604
  182. package/lib/SuperForm/SuperForm.less +0 -52
  183. package/lib/SuperForm/package.json +0 -6
  184. package/lib/SuperForm2/SuperForm.js +0 -693
  185. package/lib/SuperForm2/SuperForm.less +0 -52
  186. package/lib/SuperForm2/package.json +0 -6
  187. package/lib/SuperIcon/SuperIcon.js +0 -35
  188. package/lib/SuperIcon/package.json +0 -6
  189. package/lib/SuperPagination/SuperPagination.js +0 -114
  190. package/lib/SuperPagination/package.json +0 -6
  191. package/lib/SuperTab/SuperTab.js +0 -112
  192. package/lib/SuperTab/SuperTab.less +0 -43
  193. package/lib/SuperTab/package.json +0 -6
  194. package/lib/SuperTab2/SuperTab2.js +0 -150
  195. package/lib/SuperTab2/SuperTab2.less +0 -18
  196. package/lib/SuperTab2/package.json +0 -6
  197. package/lib/SuperTable/DragSortRow.js +0 -102
  198. package/lib/SuperTable/DragSortRow.less +0 -17
  199. package/lib/SuperTable/FilterDropDown.js +0 -169
  200. package/lib/SuperTable/FilterDropDown.less +0 -30
  201. package/lib/SuperTable/SuperTable.js +0 -813
  202. package/lib/SuperTable/SuperTable.less +0 -132
  203. package/lib/SuperTable/fixed.js +0 -42
  204. package/lib/SuperTable/package.json +0 -6
  205. package/lib/SuperTable2/SuperTable2.js +0 -935
  206. package/lib/SuperTable2/SuperTable2.less +0 -118
  207. package/lib/SuperTable2/SuperTableCell.js +0 -220
  208. package/lib/SuperTable2/package.json +0 -6
  209. package/lib/SuperTable3/FilterDropDown.js +0 -169
  210. package/lib/SuperTable3/FilterDropDown.less +0 -29
  211. package/lib/SuperTable3/SuperTable.js +0 -670
  212. package/lib/SuperTable3/SuperTable.less +0 -99
  213. package/lib/SuperTable3/fixed.js +0 -42
  214. package/lib/SuperTable3/package.json +0 -6
  215. package/lib/SuperToolbar/SuperToolbar.js +0 -200
  216. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  217. package/lib/SuperToolbar/package.json +0 -6
  218. package/lib/SuperUpload/SuperUpload.js +0 -367
  219. package/lib/SuperUpload/SuperUpload.less +0 -28
  220. package/lib/SuperUpload/package.json +0 -6
  221. package/lib/Title/Title.js +0 -41
  222. package/lib/Title/Title.less +0 -35
  223. package/lib/Title/package.json +0 -6
  224. package/lib/Viewer/ImageViews.js +0 -263
  225. package/lib/Viewer/Viewer.js +0 -127
  226. package/lib/Viewer/Viewer.less +0 -67
  227. package/lib/Viewer/imgView.less +0 -59
  228. package/lib/Viewer/package.json +0 -7
  229. package/lib/WingBlank/WingBlank.js +0 -24
  230. package/lib/WingBlank/WingBlank.less +0 -12
  231. package/lib/WingBlank/package.json +0 -6
  232. package/lib/adjust.less +0 -89
  233. package/lib/helper.js +0 -247
  234. package/lib/history.js +0 -12
  235. package/lib/index.js +0 -271
  236. package/lib/index.less +0 -31
  237. package/lib/style.less +0 -30
  238. package/lib/variables.js +0 -14
  239. package/lib/variables.less +0 -73
  240. /package/{es → src}/Area/package.json +0 -0
  241. /package/{es → src}/Card/package.json +0 -0
  242. /package/{es → src}/CodeInput/package.json +0 -0
  243. /package/{es → src}/Control/package.json +0 -0
  244. /package/{es → src}/Enhance/package.json +0 -0
  245. /package/{es → src}/Header/Header.less +0 -0
  246. /package/{es → src}/Header/Vertical.less +0 -0
  247. /package/{es → src}/Header/package.json +0 -0
  248. /package/{es → src}/ImageView/ImageView.less +0 -0
  249. /package/{es → src}/ImageView/package.json +0 -0
  250. /package/{es → src}/Indent/package.json +0 -0
  251. /package/{es → src}/InpurCascader/package.json +0 -0
  252. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  253. /package/{es → src}/InputEditor/package.json +0 -0
  254. /package/{es → src}/InputSearch/package.json +0 -0
  255. /package/{es → src}/InputSelect/package.json +0 -0
  256. /package/{es → src}/InputTreeSelect/package.json +0 -0
  257. /package/{es → src}/InputWriting/package.json +0 -0
  258. /package/{es → src}/Layout/Layout.less +0 -0
  259. /package/{es → src}/Layout/package.json +0 -0
  260. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  261. /package/{es → src}/LayoutLink/package.json +0 -0
  262. /package/{es → src}/Link/package.json +0 -0
  263. /package/{es → src}/Loading/Loading.less +0 -0
  264. /package/{es → src}/Loading/package.json +0 -0
  265. /package/{es → src}/Loading2/Loading2.less +0 -0
  266. /package/{es → src}/Loading2/package.json +0 -0
  267. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  268. /package/{es → src}/ModalWithDrag/package.json +0 -0
  269. /package/{es → src}/NumberInput/package.json +0 -0
  270. /package/{es → src}/Search/Search.less +0 -0
  271. /package/{es → src}/Search/package.json +0 -0
  272. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  273. /package/{es → src}/Sidebar/package.json +0 -0
  274. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  275. /package/{es → src}/Sidebar2/package.json +0 -0
  276. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  277. /package/{es → src}/SuperForm/package.json +0 -0
  278. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  279. /package/{es → src}/SuperForm2/package.json +0 -0
  280. /package/{es → src}/SuperIcon/package.json +0 -0
  281. /package/{es → src}/SuperPagination/package.json +0 -0
  282. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  283. /package/{es → src}/SuperTab/package.json +0 -0
  284. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  285. /package/{es → src}/SuperTab2/package.json +0 -0
  286. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  287. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  288. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  289. /package/{es → src}/SuperTable/package.json +0 -0
  290. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  291. /package/{es → src}/SuperTable2/package.json +0 -0
  292. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  293. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  294. /package/{es → src}/SuperTable3/package.json +0 -0
  295. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  296. /package/{es → src}/SuperToolbar/package.json +0 -0
  297. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  298. /package/{es → src}/SuperUpload/package.json +0 -0
  299. /package/{es → src}/Title/Title.less +0 -0
  300. /package/{es → src}/Title/package.json +0 -0
  301. /package/{es → src}/Viewer/Viewer.less +0 -0
  302. /package/{es → src}/Viewer/imgView.less +0 -0
  303. /package/{es → src}/Viewer/package.json +0 -0
  304. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  305. /package/{es → src}/WingBlank/package.json +0 -0
  306. /package/{es → src}/adjust.less +0 -0
  307. /package/{es → src}/style.less +0 -0
  308. /package/{es → src}/variables.less +0 -0
@@ -1,263 +0,0 @@
1
- import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
- import _Input from "antd/es/input";
3
- import _typeof from "@babel/runtime-corejs3/helpers/typeof";
4
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
6
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
8
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
9
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
10
- import _Icon from "antd/es/icon";
11
- import _AutoComplete from "antd/es/auto-complete";
12
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
13
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
15
- import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
16
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
17
- import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
18
- import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
19
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
20
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
21
- import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
22
- import React from 'react';
23
- import PropTypes from 'prop-types';
24
- import { getObjectExclude } from '../helper';
25
- var SelectOption = _AutoComplete.Option;
26
-
27
- // 如果写在局部,每次渲染时生成的suffix引用值不同,会使antd的Input认为suffix动态变化了,从而导致Input报出警告 (antd的BUG)
28
- var suffix = /*#__PURE__*/React.createElement(_Icon, {
29
- type: "search",
30
- style: {
31
- color: 'black',
32
- opacity: 0.25,
33
- marginRight: -4
34
- }
35
- });
36
- var OPTION_STYLE = {
37
- "float": 'right',
38
- marginLeft: '1rem',
39
- color: '#aaa',
40
- whiteSpace: 'pre-wrap'
41
- };
42
- var OPTION_STYLE2 = {
43
- display: 'block',
44
- color: '#aaa',
45
- whiteSpace: 'pre-wrap'
46
- };
47
-
48
- /**
49
- * filter: 为true表示下拉列表会依据输入的值进行前端过滤,默认为true; 如果不想过滤,则设为false
50
- * remark: 为true表示options的option中含有remark字段,并需要用remark值进行过滤下拉,默认为false
51
- * searchWhenClick: 每次点击时,触发onSearch事件,默认为false
52
- * noSearchWhenTypo: 当输入时,不触发onSearch事件,默认为false
53
- */
54
- var PROPS = {
55
- filter: PropTypes.bool,
56
- remark: PropTypes.bool,
57
- searchWhenClick: PropTypes.bool,
58
- noSearchWhenTypo: PropTypes.bool,
59
- options: PropTypes.array,
60
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
61
- inputRef: PropTypes.func,
62
- onChange: PropTypes.func,
63
- onBlur: PropTypes.func,
64
- onSelect: PropTypes.func,
65
- onSearch: PropTypes.func
66
- };
67
- var PROPS_KEYS = _Object$keys(PROPS);
68
- var InputSearch = /*#__PURE__*/function (_React$Component) {
69
- function InputSearch(_props) {
70
- var _this;
71
- _classCallCheck(this, InputSearch);
72
- _this = _callSuper(this, InputSearch, [_props]);
73
- _defineProperty(_this, "onSearch", function (value) {
74
- _this.setState({
75
- value: value
76
- });
77
- var _this$props = _this.props,
78
- onSearch = _this$props.onSearch,
79
- noSearchWhenTypo = _this$props.noSearchWhenTypo;
80
- !noSearchWhenTypo && onSearch && onSearch(value);
81
- });
82
- _defineProperty(_this, "onBlur", function () {
83
- var _this$props2 = _this.props,
84
- _this$props2$autoAdd = _this$props2.autoAdd,
85
- autoAdd = _this$props2$autoAdd === void 0 ? false : _this$props2$autoAdd,
86
- _this$props2$options = _this$props2.options,
87
- options = _this$props2$options === void 0 ? [] : _this$props2$options,
88
- onChange = _this$props2.onChange,
89
- onBlur = _this$props2.onBlur;
90
- if (_this.props.value !== _this.state.value) {
91
- var index = _findIndexInstanceProperty(options).call(options, function (option) {
92
- return option.title === _this.state.value;
93
- });
94
- var value = '';
95
- if (index === -1) {
96
- if (autoAdd && _this.state.value) {
97
- if (typeof _this.state.value === 'string') {
98
- value = {
99
- value: -1,
100
- title: _this.state.value
101
- };
102
- } else if (_typeof(_this.state.value) === 'object' && _this.state.value.title && _this.state.value.value) {
103
- value = _this.state.value;
104
- }
105
- }
106
- } else {
107
- value = options[index];
108
- }
109
- _this.setState({
110
- value: value
111
- });
112
- onChange && onChange(value);
113
- onBlur && onBlur(value);
114
- } else {
115
- onBlur && onBlur(_this.props.value);
116
- }
117
- });
118
- _defineProperty(_this, "onSelect", function (value) {
119
- var _this$props3 = _this.props,
120
- onChange = _this$props3.onChange,
121
- _this$props3$options = _this$props3.options,
122
- options = _this$props3$options === void 0 ? [] : _this$props3$options;
123
- var index = _findIndexInstanceProperty(options).call(options, function (option) {
124
- return String(option.value) === value;
125
- });
126
- if (index > -1) {
127
- _this.setState({
128
- value: options[index]
129
- });
130
- onChange && onChange(options[index]);
131
- }
132
- });
133
- _defineProperty(_this, "onClick", function (e) {
134
- var _this$props4 = _this.props,
135
- _this$props4$options = _this$props4.options,
136
- options = _this$props4$options === void 0 ? [] : _this$props4$options,
137
- onSearch = _this$props4.onSearch,
138
- searchWhenClick = _this$props4.searchWhenClick,
139
- value = _this$props4.value;
140
- if (onSearch && (!options.length || !value && searchWhenClick)) {
141
- onSearch(e.target.value);
142
- }
143
- });
144
- _defineProperty(_this, "makeValueValid", function (value) {
145
- var _context;
146
- return _includesInstanceProperty(_context = [NaN, undefined, null]).call(_context, value) ? '' : value;
147
- });
148
- _defineProperty(_this, "getValue", function () {
149
- var value = _this.state.value;
150
- return String(_this.makeValueValid(_typeof(value) === 'object' ? value.value : value));
151
- });
152
- _defineProperty(_this, "isMatch", function (inputValue, option) {
153
- var _context2;
154
- return option.props.children && _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
155
- });
156
- _defineProperty(_this, "isMatchRemark", function (inputValue, option) {
157
- var _option$props = option.props,
158
- _option$props$text = _option$props.text,
159
- text = _option$props$text === void 0 ? '' : _option$props$text,
160
- _option$props$remark = _option$props.remark,
161
- remark = _option$props$remark === void 0 ? '' : _option$props$remark;
162
- return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
163
- });
164
- _defineProperty(_this, "isValidValue", function (value) {
165
- var _context3;
166
- // value必须为对象,且有属性value的值不等''或undefined
167
- return value && !_includesInstanceProperty(_context3 = ['', undefined]).call(_context3, value.value);
168
- });
169
- _defineProperty(_this, "getOptions", function () {
170
- var value = _this.state.value;
171
- var options = _this.props.options;
172
- if (options && options.length) {
173
- if (_this.isValidValue(value) && !_findInstanceProperty(options).call(options, function (option) {
174
- return option.value === value.value;
175
- })) {
176
- return [value];
177
- } else {
178
- return options;
179
- }
180
- } else if (_this.isValidValue(value)) {
181
- return [value];
182
- } else {
183
- return [];
184
- }
185
- });
186
- _defineProperty(_this, "getDataSource", function () {
187
- var _context4;
188
- return _mapInstanceProperty(_context4 = _this.getOptions()).call(_context4, function (option) {
189
- return {
190
- value: String(option.value),
191
- text: option.title
192
- };
193
- });
194
- });
195
- _defineProperty(_this, "getDataSourceRemark", function () {
196
- var _context5;
197
- return _mapInstanceProperty(_context5 = _this.getOptions()).call(_context5, function (option, index) {
198
- return /*#__PURE__*/React.createElement(SelectOption, {
199
- key: index,
200
- value: String(option.value),
201
- text: option.title,
202
- remark: option.remark || ''
203
- }, /*#__PURE__*/React.createElement("span", null, option.title), /*#__PURE__*/React.createElement("span", {
204
- style: OPTION_STYLE
205
- }, option.remark || ''), /*#__PURE__*/React.createElement("span", {
206
- style: OPTION_STYLE2
207
- }, option.description || ''));
208
- });
209
- });
210
- _defineProperty(_this, "getProps", function () {
211
- var _this$props5 = _this.props,
212
- inputRef = _this$props5.inputRef,
213
- _this$props5$filter = _filterInstanceProperty(_this$props5),
214
- filter = _this$props5$filter === void 0 ? true : _this$props5$filter;
215
- var props = _Object$assign(getObjectExclude(_this.props, PROPS_KEYS), {
216
- value: _this.getValue(),
217
- allowClear: true,
218
- ref: inputRef,
219
- onChange: _this.onSearch,
220
- filterOption: function filterOption(e, option) {
221
- return option;
222
- },
223
- onSelect: _this.onSelect,
224
- onBlur: _this.onBlur
225
- });
226
- if (_this.props.remark) {
227
- props.dataSource = _this.getDataSourceRemark();
228
- props.filterOption = filter ? _this.isMatchRemark : false;
229
- props.optionLabelProp = 'text';
230
- } else {
231
- props.dataSource = _this.getDataSource();
232
- props.filterOption = filter ? _this.isMatch : false;
233
- }
234
- return props;
235
- });
236
- _this.state = {
237
- value: _props.value
238
- };
239
- return _this;
240
- }
241
- _inherits(InputSearch, _React$Component);
242
- return _createClass(InputSearch, [{
243
- key: "componentWillReceiveProps",
244
- value: function componentWillReceiveProps(props) {
245
- if (props.value !== this.props.value) {
246
- this.setState({
247
- value: props.value
248
- });
249
- }
250
- }
251
- }, {
252
- key: "render",
253
- value: function render() {
254
- return /*#__PURE__*/React.createElement("div", {
255
- onClick: this.onClick
256
- }, /*#__PURE__*/React.createElement(_AutoComplete, this.getProps(), /*#__PURE__*/React.createElement(_Input, {
257
- suffix: suffix
258
- })));
259
- }
260
- }]);
261
- }(React.Component);
262
- _defineProperty(InputSearch, "propTypes", PROPS);
263
- export default InputSearch;
@@ -1,157 +0,0 @@
1
- import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _typeof from "@babel/runtime-corejs3/helpers/typeof";
10
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
11
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
12
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
13
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
14
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
15
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
16
- import _Select from "antd/es/select";
17
- function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
19
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
20
- import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
21
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
22
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
23
- import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
24
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
25
- import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
26
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
- import React from 'react';
29
- var SelectOption = _Select.Option;
30
- var OPTION_STYLE = {
31
- "float": 'right',
32
- marginLeft: '1rem',
33
- marginRight: '1rem',
34
- color: '#aaa',
35
- whiteSpace: 'pre-wrap'
36
- };
37
- var InputSelect = /*#__PURE__*/function (_React$Component) {
38
- function InputSelect() {
39
- var _context;
40
- var _this;
41
- _classCallCheck(this, InputSelect);
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
44
- }
45
- _this = _callSuper(this, InputSelect, _concatInstanceProperty(_context = []).call(_context, args));
46
- _defineProperty(_this, "onClick", function (e) {
47
- var _this$props = _this.props,
48
- _this$props$options = _this$props.options,
49
- options = _this$props$options === void 0 ? [] : _this$props$options,
50
- onSearch = _this$props.onSearch,
51
- _this$props$value = _this$props.value,
52
- value = _this$props$value === void 0 ? [] : _this$props$value,
53
- _this$props$searchWhe = _this$props.searchWhenClick,
54
- searchWhenClick = _this$props$searchWhe === void 0 ? false : _this$props$searchWhe;
55
- // if (onSearch && (options.length <= value.length)) {
56
- if (onSearch && searchWhenClick) {
57
- onSearch(e.target.value);
58
- }
59
- });
60
- _defineProperty(_this, "onSearch", function (value) {
61
- var onSearch = _this.props.onSearch;
62
- onSearch && onSearch(value);
63
- });
64
- _defineProperty(_this, "isMatch", function (inputValue, option) {
65
- var _context2;
66
- return _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
67
- });
68
- _defineProperty(_this, "isMatchRemark", function (inputValue, option) {
69
- var _option$props = option.props,
70
- text = _option$props.text,
71
- remark = _option$props.remark;
72
- return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
73
- });
74
- _defineProperty(_this, "toRemarkOption", function (option, index) {
75
- return /*#__PURE__*/React.createElement(SelectOption, {
76
- key: index,
77
- value: String(option.value),
78
- text: option.title,
79
- remark: option.remark || '',
80
- disabled: option.disabled || false
81
- }, /*#__PURE__*/React.createElement("span", null, option.title), /*#__PURE__*/React.createElement("span", {
82
- style: OPTION_STYLE
83
- }, option.remark || ''));
84
- });
85
- _defineProperty(_this, "toOption", function (option, index) {
86
- return /*#__PURE__*/React.createElement(SelectOption, {
87
- key: index,
88
- value: String(option.value),
89
- disabled: option.disabled || false
90
- }, option.title);
91
- });
92
- _defineProperty(_this, "onChange", function (options, keyValue) {
93
- var onChange = _this.props.onChange;
94
- var objValue = keyValue.length > 0 ? _mapInstanceProperty(keyValue).call(keyValue, function (item) {
95
- return _objectSpread(_objectSpread({}, _filterInstanceProperty(options).call(options, function (o) {
96
- return o.value === item.key;
97
- })[0]), {}, {
98
- value: item.key,
99
- title: item.label
100
- });
101
- }) : [];
102
- onChange && onChange(objValue);
103
- });
104
- _defineProperty(_this, "getValue", function () {
105
- var value = _this.props.value;
106
- if (_typeof(value) === 'object' && _Array$isArray(value)) {
107
- return _mapInstanceProperty(value).call(value, function (item) {
108
- return _objectSpread(_objectSpread({}, item), {}, {
109
- key: item.value,
110
- label: item.title
111
- });
112
- });
113
- } else {
114
- return [];
115
- }
116
- });
117
- return _this;
118
- }
119
- _inherits(InputSelect, _React$Component);
120
- return _createClass(InputSelect, [{
121
- key: "render",
122
- value: function render() {
123
- var _context3, _context4;
124
- var _this$props2 = this.props,
125
- _this$props2$options = _this$props2.options,
126
- options = _this$props2$options === void 0 ? [] : _this$props2$options,
127
- size = _this$props2.size,
128
- _this$props2$value = _this$props2.value,
129
- value = _this$props2$value === void 0 ? [] : _this$props2$value,
130
- _this$props2$allowCle = _this$props2.allowClear,
131
- allowClear = _this$props2$allowCle === void 0 ? true : _this$props2$allowCle;
132
- var values = _mapInstanceProperty(value).call(value, function (o) {
133
- return o.value;
134
- });
135
- var allOptions = _concatInstanceProperty(_context3 = _filterInstanceProperty(options).call(options, function (o) {
136
- return !_includesInstanceProperty(values).call(values, o.value);
137
- })).call(_context3, value);
138
- var props = {
139
- value: this.getValue(),
140
- style: this.props.style || {},
141
- mode: 'multiple',
142
- optionLabelProp: this.props.remark ? 'text' : 'children',
143
- dropdownMatchSelectWidth: false,
144
- filterOption: this.props.remark ? this.isMatchRemark : this.isMatch,
145
- onSearch: this.onSearch,
146
- onChange: _bindInstanceProperty(_context4 = this.onChange).call(_context4, this, allOptions),
147
- labelInValue: true,
148
- allowClear: allowClear,
149
- size: size
150
- };
151
- return /*#__PURE__*/React.createElement("div", {
152
- onClick: this.onClick
153
- }, /*#__PURE__*/React.createElement(_Select, props, this.props.remark ? _mapInstanceProperty(allOptions).call(allOptions, this.toRemarkOption) : _mapInstanceProperty(allOptions).call(allOptions, this.toOption)));
154
- }
155
- }]);
156
- }(React.Component);
157
- export default InputSelect;
@@ -1,118 +0,0 @@
1
- import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _TreeSelect from "antd/es/tree-select";
10
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
11
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
12
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
13
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
14
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
15
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
16
- function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
18
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
20
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
21
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
22
- import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
23
- //级联选择input
24
- import React from 'react';
25
- import PropTypes from 'prop-types';
26
- import { getObjectExclude } from '../helper';
27
- var optionsType = {
28
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
29
- key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
30
- disabled: PropTypes.bool,
31
- children: PropTypes.array,
32
- title: PropTypes.string,
33
- isLeaf: PropTypes.bool //false 就会触发 loadData 方法,从而在loadData方法中请求下一级数据,
34
- };
35
- var PROPS = {
36
- options: PropTypes.arrayOf(PropTypes.shape(optionsType)).isRequired,
37
- value: PropTypes.array.isRequired,
38
- placeholder: PropTypes.string,
39
- onChange: PropTypes.func,
40
- loadData: PropTypes.func,
41
- //动态加载 ps:loadData 与 showSearch 无法一起使用
42
- showSearch: PropTypes.bool,
43
- onTreeExpand: PropTypes.func,
44
- treeDefaultExpandAll: PropTypes.bool,
45
- treeDataSimpleMode: PropTypes.bool,
46
- multiple: PropTypes.bool
47
- };
48
- var PROPS_KEYS = _Object$keys(PROPS);
49
- var InputTreeSelect = /*#__PURE__*/function (_React$Component) {
50
- function InputTreeSelect(_props) {
51
- var _this;
52
- _classCallCheck(this, InputTreeSelect);
53
- _this = _callSuper(this, InputTreeSelect, [_props]);
54
- _defineProperty(_this, "onChange", function (value) {
55
- var onChange = _this.props.onChange;
56
- onChange && onChange(value);
57
- });
58
- _defineProperty(_this, "loadData", function (selectedOptions) {
59
- var onSearch = _this.props.onSearch;
60
- onSearch && onSearch(selectedOptions[0]);
61
- });
62
- _defineProperty(_this, "getOptions", function (options) {
63
- return _mapInstanceProperty(options).call(options, function (option) {
64
- var obj = _objectSpread(_objectSpread({}, option), {}, {
65
- label: option.title
66
- });
67
- if (option.children && option.children.length > 0) {
68
- obj.children = _this.getOptions(option.children);
69
- }
70
- return obj;
71
- });
72
- });
73
- _defineProperty(_this, "getProps", function () {
74
- var _this$props = _this.props,
75
- _this$props$options = _this$props.options,
76
- options = _this$props$options === void 0 ? [] : _this$props$options,
77
- placeholder = _this$props.placeholder,
78
- size = _this$props.size,
79
- value = _this$props.value,
80
- loadData = _this$props.loadData,
81
- _this$props$treeDefau = _this$props.treeDefaultExpandAll,
82
- treeDefaultExpandAll = _this$props$treeDefau === void 0 ? false : _this$props$treeDefau,
83
- _this$props$showSearc = _this$props.showSearch,
84
- showSearch = _this$props$showSearc === void 0 ? false : _this$props$showSearc,
85
- _this$props$treeDataS = _this$props.treeDataSimpleMode,
86
- treeDataSimpleMode = _this$props$treeDataS === void 0 ? false : _this$props$treeDataS,
87
- _this$props$multiple = _this$props.multiple,
88
- multiple = _this$props$multiple === void 0 ? false : _this$props$multiple;
89
- var props = _Object$assign(getObjectExclude({}, PROPS_KEYS), {
90
- onChange: _this.onChange,
91
- value: value,
92
- treeData: options,
93
- treeDataSimpleMode: treeDataSimpleMode,
94
- placeholder: placeholder,
95
- treeDefaultExpandAll: treeDefaultExpandAll,
96
- multiple: multiple,
97
- size: size
98
- });
99
- //动态加载 ps:loadData 与 showSearch 无法一起使用
100
- if (loadData) {
101
- props.loadData = _this.loadData;
102
- } else if (showSearch) {
103
- props.showSearch = showSearch;
104
- }
105
- return props;
106
- });
107
- return _this;
108
- }
109
- _inherits(InputTreeSelect, _React$Component);
110
- return _createClass(InputTreeSelect, [{
111
- key: "render",
112
- value: function render() {
113
- return /*#__PURE__*/React.createElement(_TreeSelect, this.getProps());
114
- }
115
- }]);
116
- }(React.Component);
117
- _defineProperty(InputTreeSelect, "propTypes", PROPS);
118
- export default InputTreeSelect;
@@ -1,82 +0,0 @@
1
- import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
4
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
6
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
7
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
8
- import _Select from "antd/es/select";
9
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
10
- import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
11
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- import React from 'react';
14
- var Option = _Select.Option;
15
- var InputWriting = /*#__PURE__*/function (_React$Component) {
16
- function InputWriting() {
17
- var _context;
18
- var _this;
19
- _classCallCheck(this, InputWriting);
20
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21
- args[_key] = arguments[_key];
22
- }
23
- _this = _callSuper(this, InputWriting, _concatInstanceProperty(_context = []).call(_context, args));
24
- _defineProperty(_this, "state", {
25
- options: [],
26
- value: [],
27
- fetching: false
28
- });
29
- _defineProperty(_this, "onClick", function (e) {
30
- var _this$props = _this.props,
31
- _this$props$options = _this$props.options,
32
- options = _this$props$options === void 0 ? [] : _this$props$options,
33
- onSearch = _this$props.onSearch,
34
- value = _this$props.value;
35
- if (onSearch && !options.length) {
36
- onSearch(e.target.value);
37
- }
38
- });
39
- _defineProperty(_this, "onSearch", function (value) {
40
- var onSearch = _this.props.onSearch;
41
- onSearch && onSearch(value);
42
- });
43
- _defineProperty(_this, "isMatch", function (inputValue, option) {
44
- var _context2;
45
- return _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
46
- });
47
- _defineProperty(_this, "toOption", function (option, index) {
48
- return /*#__PURE__*/React.createElement(SelectOption, {
49
- key: index,
50
- value: String(option.value)
51
- }, option.title);
52
- });
53
- _defineProperty(_this, "onChange", function (keyValue) {
54
- var _this$props2 = _this.props,
55
- onChange = _this$props2.onChange,
56
- value = _this$props2.value;
57
- onChange && onChange(keyValue);
58
- });
59
- return _this;
60
- }
61
- _inherits(InputWriting, _React$Component);
62
- return _createClass(InputWriting, [{
63
- key: "render",
64
- value: function render() {
65
- var value = this.props.value;
66
- var props = {
67
- value: value,
68
- size: 'small',
69
- mode: 'tags',
70
- allowClear: true,
71
- onSelect: this.onSelect,
72
- filterOption: this.isMatch,
73
- dropdownMatchSelectWidth: false,
74
- onChange: this.onChange
75
- };
76
- return /*#__PURE__*/React.createElement("div", {
77
- onClick: this.onClick
78
- }, /*#__PURE__*/React.createElement(_Select, props));
79
- }
80
- }]);
81
- }(React.Component);
82
- export default InputWriting;