cloud-b2b 1.1.50 → 1.1.52

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 (309) 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 -8
  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/src/ModalWithDrag/drag.js +128 -0
  27. package/src/NumberInput/NumberInput.js +137 -0
  28. package/src/Search/Search.js +368 -0
  29. package/src/Sidebar/Sidebar.js +111 -0
  30. package/src/Sidebar2/Sidebar.js +143 -0
  31. package/src/SuperForm/SuperForm.js +516 -0
  32. package/src/SuperForm2/SuperForm.js +588 -0
  33. package/src/SuperIcon/SuperIcon.js +14 -0
  34. package/src/SuperPagination/SuperPagination.js +65 -0
  35. package/src/SuperTab/SuperTab.js +84 -0
  36. package/src/SuperTab2/SuperTab2.js +94 -0
  37. package/src/SuperTable/DragSortRow.js +62 -0
  38. package/src/SuperTable/FilterDropDown.js +111 -0
  39. package/src/SuperTable/SuperTable.js +590 -0
  40. package/src/SuperTable/fixed.js +34 -0
  41. package/src/SuperTable2/SuperTable2.js +600 -0
  42. package/src/SuperTable2/SuperTableCell.js +144 -0
  43. package/src/SuperTable3/FilterDropDown.js +111 -0
  44. package/src/SuperTable3/SuperTable.js +498 -0
  45. package/src/SuperTable3/fixed.js +34 -0
  46. package/src/SuperToolbar/SuperToolbar.js +128 -0
  47. package/src/SuperUpload/SuperUpload.js +137 -0
  48. package/src/Title/Title.js +18 -0
  49. package/src/Viewer/ImageViews.js +220 -0
  50. package/src/Viewer/Viewer.js +97 -0
  51. package/src/WingBlank/WingBlank.js +14 -0
  52. package/src/helper.js +185 -0
  53. package/src/history.js +6 -0
  54. package/src/index.js +38 -0
  55. package/src/variables.js +5 -0
  56. package/test/index.html +10 -0
  57. package/test/test.js +16 -0
  58. package/test/test.less +12 -0
  59. package/test/webpack.config.js +71 -0
  60. package/tools/babel.config.js +14 -0
  61. package/tools/build.js +70 -0
  62. package/tools/publish.js +9 -0
  63. package/tools/util.js +53 -0
  64. package/es/Area/Area.js +0 -170
  65. package/es/Card/Card.js +0 -20
  66. package/es/CodeInput/CodeInput.js +0 -152
  67. package/es/Control/Control.js +0 -496
  68. package/es/Control/event.js +0 -57
  69. package/es/Enhance/Dialogs.js +0 -67
  70. package/es/Enhance/Loading.js +0 -151
  71. package/es/Header/Header.js +0 -194
  72. package/es/Header/Vertical.js +0 -129
  73. package/es/ImageView/ImageView.js +0 -117
  74. package/es/Indent/Indent.js +0 -23
  75. package/es/InpurCascader/InputCascader.js +0 -135
  76. package/es/InputEditor/InputEditor.js +0 -113
  77. package/es/InputSearch/InputSearch.js +0 -311
  78. package/es/InputSelect/InputSelect.js +0 -191
  79. package/es/InputTreeSelect/InputTreeSelect.js +0 -147
  80. package/es/InputWriting/InputWriting.js +0 -107
  81. package/es/Layout/Layout.js +0 -232
  82. package/es/LayoutLink/LayoutLink.js +0 -82
  83. package/es/Link/Link.js +0 -108
  84. package/es/Loading/Loading.js +0 -15
  85. package/es/Loading2/Loading2.js +0 -11
  86. package/es/ModalWithDrag/ModalWithDrag.js +0 -34
  87. package/es/ModalWithDrag/drag.js +0 -133
  88. package/es/NumberInput/NumberInput.js +0 -240
  89. package/es/Search/Search.js +0 -595
  90. package/es/Sidebar/Sidebar.js +0 -165
  91. package/es/Sidebar2/Sidebar.js +0 -192
  92. package/es/SuperForm/SuperForm.js +0 -720
  93. package/es/SuperForm2/SuperForm.js +0 -828
  94. package/es/SuperIcon/SuperIcon.js +0 -30
  95. package/es/SuperPagination/SuperPagination.js +0 -126
  96. package/es/SuperTab/SuperTab.js +0 -130
  97. package/es/SuperTab2/SuperTab2.js +0 -167
  98. package/es/SuperTable/DragSortRow.js +0 -125
  99. package/es/SuperTable/FilterDropDown.js +0 -188
  100. package/es/SuperTable/SuperTable.js +0 -940
  101. package/es/SuperTable/fixed.js +0 -42
  102. package/es/SuperTable2/SuperTable2.js +0 -1019
  103. package/es/SuperTable2/SuperTableCell.js +0 -242
  104. package/es/SuperTable3/FilterDropDown.js +0 -188
  105. package/es/SuperTable3/SuperTable.js +0 -790
  106. package/es/SuperTable3/fixed.js +0 -42
  107. package/es/SuperToolbar/SuperToolbar.js +0 -223
  108. package/es/SuperUpload/SuperUpload.js +0 -434
  109. package/es/Title/Title.js +0 -36
  110. package/es/Viewer/ImageViews.js +0 -311
  111. package/es/Viewer/Viewer.js +0 -149
  112. package/es/WingBlank/WingBlank.js +0 -20
  113. package/es/helper.js +0 -169
  114. package/es/history.js +0 -5
  115. package/es/index.js +0 -37
  116. package/es/variables.js +0 -4
  117. package/lib/Area/Area.js +0 -198
  118. package/lib/Area/package.json +0 -6
  119. package/lib/Card/Card.js +0 -38
  120. package/lib/Card/package.json +0 -6
  121. package/lib/CodeInput/CodeInput.js +0 -179
  122. package/lib/CodeInput/package.json +0 -6
  123. package/lib/Control/Control.js +0 -548
  124. package/lib/Control/event.js +0 -68
  125. package/lib/Control/package.json +0 -6
  126. package/lib/Enhance/Dialogs.js +0 -87
  127. package/lib/Enhance/Loading.js +0 -175
  128. package/lib/Enhance/index.js +0 -35
  129. package/lib/Enhance/package.json +0 -6
  130. package/lib/Header/Header.js +0 -215
  131. package/lib/Header/Header.less +0 -95
  132. package/lib/Header/Vertical.js +0 -150
  133. package/lib/Header/Vertical.less +0 -60
  134. package/lib/Header/package.json +0 -6
  135. package/lib/ImageView/ImageView.js +0 -134
  136. package/lib/ImageView/ImageView.less +0 -14
  137. package/lib/ImageView/package.json +0 -6
  138. package/lib/Indent/Indent.js +0 -38
  139. package/lib/Indent/package.json +0 -6
  140. package/lib/InpurCascader/InputCascader.js +0 -156
  141. package/lib/InpurCascader/package.json +0 -6
  142. package/lib/InputEditor/InputEditor.js +0 -131
  143. package/lib/InputEditor/inputEditor.less +0 -8
  144. package/lib/InputEditor/package.json +0 -6
  145. package/lib/InputSearch/InputSearch.js +0 -327
  146. package/lib/InputSearch/package.json +0 -6
  147. package/lib/InputSelect/InputSelect.js +0 -214
  148. package/lib/InputSelect/package.json +0 -6
  149. package/lib/InputTreeSelect/InputTreeSelect.js +0 -169
  150. package/lib/InputTreeSelect/package.json +0 -6
  151. package/lib/InputWriting/InputWriting.js +0 -123
  152. package/lib/InputWriting/package.json +0 -6
  153. package/lib/Layout/Layout.js +0 -258
  154. package/lib/Layout/Layout.less +0 -28
  155. package/lib/Layout/package.json +0 -6
  156. package/lib/LayoutLink/LayoutLink.js +0 -114
  157. package/lib/LayoutLink/LayoutLink.less +0 -53
  158. package/lib/LayoutLink/package.json +0 -6
  159. package/lib/Link/Link.js +0 -130
  160. package/lib/Link/package.json +0 -6
  161. package/lib/Loading/Loading.js +0 -30
  162. package/lib/Loading/Loading.less +0 -13
  163. package/lib/Loading/package.json +0 -6
  164. package/lib/Loading2/Loading2.js +0 -26
  165. package/lib/Loading2/Loading2.less +0 -19
  166. package/lib/Loading2/package.json +0 -6
  167. package/lib/ModalWithDrag/ModalWithDrag.js +0 -53
  168. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  169. package/lib/ModalWithDrag/drag.js +0 -147
  170. package/lib/ModalWithDrag/package.json +0 -6
  171. package/lib/NumberInput/NumberInput.js +0 -262
  172. package/lib/NumberInput/package.json +0 -6
  173. package/lib/Search/Search.js +0 -616
  174. package/lib/Search/Search.less +0 -63
  175. package/lib/Search/package.json +0 -6
  176. package/lib/Sidebar/Sidebar.js +0 -186
  177. package/lib/Sidebar/Sidebar.less +0 -78
  178. package/lib/Sidebar/package.json +0 -6
  179. package/lib/Sidebar2/Sidebar.js +0 -213
  180. package/lib/Sidebar2/Sidebar.less +0 -153
  181. package/lib/Sidebar2/package.json +0 -6
  182. package/lib/SuperForm/SuperForm.js +0 -731
  183. package/lib/SuperForm/SuperForm.less +0 -52
  184. package/lib/SuperForm/package.json +0 -6
  185. package/lib/SuperForm2/SuperForm.js +0 -834
  186. package/lib/SuperForm2/SuperForm.less +0 -52
  187. package/lib/SuperForm2/package.json +0 -6
  188. package/lib/SuperIcon/SuperIcon.js +0 -47
  189. package/lib/SuperIcon/package.json +0 -6
  190. package/lib/SuperPagination/SuperPagination.js +0 -145
  191. package/lib/SuperPagination/package.json +0 -6
  192. package/lib/SuperTab/SuperTab.js +0 -146
  193. package/lib/SuperTab/SuperTab.less +0 -43
  194. package/lib/SuperTab/package.json +0 -6
  195. package/lib/SuperTab2/SuperTab2.js +0 -191
  196. package/lib/SuperTab2/SuperTab2.less +0 -18
  197. package/lib/SuperTab2/package.json +0 -6
  198. package/lib/SuperTable/DragSortRow.js +0 -142
  199. package/lib/SuperTable/DragSortRow.less +0 -17
  200. package/lib/SuperTable/FilterDropDown.js +0 -205
  201. package/lib/SuperTable/FilterDropDown.less +0 -30
  202. package/lib/SuperTable/SuperTable.js +0 -945
  203. package/lib/SuperTable/SuperTable.less +0 -132
  204. package/lib/SuperTable/fixed.js +0 -55
  205. package/lib/SuperTable/package.json +0 -6
  206. package/lib/SuperTable2/SuperTable2.js +0 -1047
  207. package/lib/SuperTable2/SuperTable2.less +0 -118
  208. package/lib/SuperTable2/SuperTableCell.js +0 -258
  209. package/lib/SuperTable2/package.json +0 -6
  210. package/lib/SuperTable3/FilterDropDown.js +0 -205
  211. package/lib/SuperTable3/FilterDropDown.less +0 -29
  212. package/lib/SuperTable3/SuperTable.js +0 -795
  213. package/lib/SuperTable3/SuperTable.less +0 -99
  214. package/lib/SuperTable3/fixed.js +0 -55
  215. package/lib/SuperTable3/package.json +0 -6
  216. package/lib/SuperToolbar/SuperToolbar.js +0 -248
  217. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  218. package/lib/SuperToolbar/package.json +0 -6
  219. package/lib/SuperUpload/SuperUpload.js +0 -481
  220. package/lib/SuperUpload/SuperUpload.less +0 -28
  221. package/lib/SuperUpload/package.json +0 -6
  222. package/lib/Title/Title.js +0 -54
  223. package/lib/Title/Title.less +0 -35
  224. package/lib/Title/package.json +0 -6
  225. package/lib/Viewer/ImageViews.js +0 -323
  226. package/lib/Viewer/Viewer.js +0 -167
  227. package/lib/Viewer/Viewer.less +0 -67
  228. package/lib/Viewer/imgView.less +0 -59
  229. package/lib/Viewer/package.json +0 -7
  230. package/lib/WingBlank/WingBlank.js +0 -37
  231. package/lib/WingBlank/WingBlank.less +0 -12
  232. package/lib/WingBlank/package.json +0 -6
  233. package/lib/adjust.less +0 -89
  234. package/lib/helper.js +0 -204
  235. package/lib/history.js +0 -18
  236. package/lib/index.js +0 -347
  237. package/lib/index.less +0 -31
  238. package/lib/style.less +0 -30
  239. package/lib/variables.js +0 -16
  240. package/lib/variables.less +0 -73
  241. /package/{es → src}/Area/package.json +0 -0
  242. /package/{es → src}/Card/package.json +0 -0
  243. /package/{es → src}/CodeInput/package.json +0 -0
  244. /package/{es → src}/Control/package.json +0 -0
  245. /package/{es → src}/Enhance/package.json +0 -0
  246. /package/{es → src}/Header/Header.less +0 -0
  247. /package/{es → src}/Header/Vertical.less +0 -0
  248. /package/{es → src}/Header/package.json +0 -0
  249. /package/{es → src}/ImageView/ImageView.less +0 -0
  250. /package/{es → src}/ImageView/package.json +0 -0
  251. /package/{es → src}/Indent/package.json +0 -0
  252. /package/{es → src}/InpurCascader/package.json +0 -0
  253. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  254. /package/{es → src}/InputEditor/package.json +0 -0
  255. /package/{es → src}/InputSearch/package.json +0 -0
  256. /package/{es → src}/InputSelect/package.json +0 -0
  257. /package/{es → src}/InputTreeSelect/package.json +0 -0
  258. /package/{es → src}/InputWriting/package.json +0 -0
  259. /package/{es → src}/Layout/Layout.less +0 -0
  260. /package/{es → src}/Layout/package.json +0 -0
  261. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  262. /package/{es → src}/LayoutLink/package.json +0 -0
  263. /package/{es → src}/Link/package.json +0 -0
  264. /package/{es → src}/Loading/Loading.less +0 -0
  265. /package/{es → src}/Loading/package.json +0 -0
  266. /package/{es → src}/Loading2/Loading2.less +0 -0
  267. /package/{es → src}/Loading2/package.json +0 -0
  268. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  269. /package/{es → src}/ModalWithDrag/package.json +0 -0
  270. /package/{es → src}/NumberInput/package.json +0 -0
  271. /package/{es → src}/Search/Search.less +0 -0
  272. /package/{es → src}/Search/package.json +0 -0
  273. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  274. /package/{es → src}/Sidebar/package.json +0 -0
  275. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  276. /package/{es → src}/Sidebar2/package.json +0 -0
  277. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  278. /package/{es → src}/SuperForm/package.json +0 -0
  279. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  280. /package/{es → src}/SuperForm2/package.json +0 -0
  281. /package/{es → src}/SuperIcon/package.json +0 -0
  282. /package/{es → src}/SuperPagination/package.json +0 -0
  283. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  284. /package/{es → src}/SuperTab/package.json +0 -0
  285. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  286. /package/{es → src}/SuperTab2/package.json +0 -0
  287. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  288. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  289. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  290. /package/{es → src}/SuperTable/package.json +0 -0
  291. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  292. /package/{es → src}/SuperTable2/package.json +0 -0
  293. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  294. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  295. /package/{es → src}/SuperTable3/package.json +0 -0
  296. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  297. /package/{es → src}/SuperToolbar/package.json +0 -0
  298. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  299. /package/{es → src}/SuperUpload/package.json +0 -0
  300. /package/{es → src}/Title/Title.less +0 -0
  301. /package/{es → src}/Title/package.json +0 -0
  302. /package/{es → src}/Viewer/Viewer.less +0 -0
  303. /package/{es → src}/Viewer/imgView.less +0 -0
  304. /package/{es → src}/Viewer/package.json +0 -0
  305. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  306. /package/{es → src}/WingBlank/package.json +0 -0
  307. /package/{es → src}/adjust.less +0 -0
  308. /package/{es → src}/style.less +0 -0
  309. /package/{es → src}/variables.less +0 -0
@@ -1,1047 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
-
5
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
-
7
- var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
8
-
9
- var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
10
-
11
- var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
12
-
13
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
14
-
15
- var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
16
-
17
- var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
18
-
19
- var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
20
-
21
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
22
-
23
- var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
24
-
25
- var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
26
-
27
- var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
28
-
29
- var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
30
-
31
- var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
32
-
33
- var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
34
-
35
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
36
-
37
- _Object$defineProperty(exports, "__esModule", {
38
- value: true
39
- });
40
-
41
- exports["default"] = void 0;
42
-
43
- var _table = _interopRequireDefault(require("antd/lib/table"));
44
-
45
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
46
-
47
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
48
-
49
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
50
-
51
- var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
52
-
53
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
54
-
55
- var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
56
-
57
- var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
58
-
59
- var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
60
-
61
- var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
62
-
63
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
64
-
65
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
66
-
67
- var _switch = _interopRequireDefault(require("antd/lib/switch"));
68
-
69
- var _button = _interopRequireDefault(require("antd/lib/button"));
70
-
71
- var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
72
-
73
- var _icon = _interopRequireDefault(require("antd/lib/icon"));
74
-
75
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
76
-
77
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
78
-
79
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
80
-
81
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
82
-
83
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
84
-
85
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
86
-
87
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
88
-
89
- var _react = _interopRequireDefault(require("react"));
90
-
91
- var _propTypes = _interopRequireDefault(require("prop-types"));
92
-
93
- var _reactDom = _interopRequireDefault(require("react-dom"));
94
-
95
- var _Control = _interopRequireWildcard(require("../Control"));
96
-
97
- var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
98
-
99
- var _fixed = _interopRequireDefault(require("../SuperTable/fixed"));
100
-
101
- var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
102
-
103
- var _variables = _interopRequireDefault(require("../variables"));
104
-
105
- var _helper = _interopRequireWildcard(require("../helper"));
106
-
107
- var _DragSortRow = _interopRequireDefault(require("../SuperTable/DragSortRow"));
108
-
109
- var _excluded = ["onRowClick"];
110
-
111
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
112
-
113
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
114
-
115
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
116
-
117
- function _unsupportedIterableToArray(o, minLen) { var _context20; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
118
-
119
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
120
-
121
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
122
-
123
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context18, _context19; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context18 = ownKeys(Object(source), !0)).call(_context18, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context19 = ownKeys(Object(source))).call(_context19, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
124
-
125
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
126
-
127
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
128
-
129
- var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
130
- 'selectText', //存储title
131
- 'search', 'searchText', 'selectSearch', //多选下拉搜索
132
- 'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
133
- 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
134
- 'uploadImg', 'double'];
135
- /**
136
- * key:标识所在列,在一个表格中必须唯一
137
- * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
138
- * type:嵌入的表单元素类型
139
- * link: 是否为超链接,type未设置时,该属性才生效。为true表示内容来至items,为字符串表示超链接内容就是该字符串
140
- * options: 对象(包含value和title)数组
141
- * props:传递参数给被嵌入的组件
142
- * width: 嵌入的组件的宽度,默认值为100
143
- * align:对齐方式,index默认center,其他类型默认为left
144
- * showAdd: 表头是否显示+号,默认为false,加号会触发onAdd事件
145
- * hide: 为true时隐藏该列
146
- */
147
-
148
- var ColType = {
149
- key: _propTypes["default"].string.isRequired,
150
- title: _propTypes["default"].string.isRequired,
151
- type: _propTypes["default"].oneOf(TypeEnum),
152
- link: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string]),
153
- align: _propTypes["default"].oneOf(['left', 'center', 'right']),
154
- width: _propTypes["default"].number,
155
- options: _propTypes["default"].array,
156
- showAdd: _propTypes["default"].any,
157
- hide: _propTypes["default"].bool,
158
- props: _propTypes["default"].any
159
- };
160
- /**
161
- * onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
162
- * onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
163
- * onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
164
- * onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
165
- * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
166
- * onAdd:点击+号时触发,原型为function(keyName)
167
- * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
168
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
169
- * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
170
- */
171
-
172
- var CallbackType = {
173
- onExitValid: _propTypes["default"].func,
174
- onCheck: _propTypes["default"].func,
175
- onContentChange: _propTypes["default"].func,
176
- onBlur: _propTypes["default"].func,
177
- onSearch: _propTypes["default"].func,
178
- onLink: _propTypes["default"].func,
179
- onAdd: _propTypes["default"].func,
180
- onRenderCustom: _propTypes["default"].func,
181
- onToolbar: _propTypes["default"].func,
182
- onDoubleClick: _propTypes["default"].func,
183
- onTableFileChange: _propTypes["default"].func,
184
- buildSuperUploadProps: _propTypes["default"].func,
185
- //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
186
- onImgTileClick: _propTypes["default"].func,
187
- //点击img类型标题触发事件
188
- onMoveRow: _propTypes["default"].func
189
- };
190
- /**
191
- * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
192
- * isEmphasized: [可选],是否强调,行字体加粗显示, 除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
193
- */
194
-
195
- var SuperTable2 = /*#__PURE__*/function (_React$Component) {
196
- (0, _inherits2["default"])(SuperTable2, _React$Component);
197
-
198
- var _super = _createSuper(SuperTable2);
199
-
200
- function SuperTable2() {
201
- var _context;
202
-
203
- var _this;
204
-
205
- (0, _classCallCheck2["default"])(this, SuperTable2);
206
-
207
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
208
- args[_key] = arguments[_key];
209
- }
210
-
211
- _this = _super.call.apply(_super, (0, _concat["default"])(_context = [this]).call(_context, args));
212
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSwitch", function (key, rowIndex) {
213
- return function (value) {
214
- var _ref = _this.props.callback || {},
215
- onContentChange = _ref.onContentChange;
216
-
217
- onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
218
- };
219
- });
220
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCheck", function (key, rowIndex) {
221
- return function (e) {
222
- var _ref2 = _this.props.callback || {},
223
- onCheck = _ref2.onCheck;
224
-
225
- onCheck && onCheck(_this.getIndex(rowIndex), key, e.target.checked);
226
- };
227
- });
228
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (key, rowIndex) {
229
- return function (value) {
230
- var _ref3 = _this.props.callback || {},
231
- onContentChange = _ref3.onContentChange;
232
-
233
- _this.closeValid();
234
-
235
- onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
236
- };
237
- });
238
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleChange1", function (key, rowIndex) {
239
- return function (doublekey, value) {
240
- var _ref4 = _this.props.callback || {},
241
- onContentChange = _ref4.onContentChange;
242
-
243
- _this.closeValid();
244
-
245
- onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
246
- };
247
- });
248
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (key, rowIndex, config) {
249
- return function (value) {
250
- var _ref5 = _this.props.callback || {},
251
- onSearch = _ref5.onSearch;
252
-
253
- onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
254
- };
255
- });
256
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAdd", function (key) {
257
- return function () {
258
- var _ref6 = _this.props.callback || {},
259
- onAdd = _ref6.onAdd;
260
-
261
- onAdd && onAdd(key);
262
- };
263
- });
264
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRowAdd", function (key, index) {
265
- return function () {
266
- var _ref7 = _this.props.callback || {},
267
- onLink = _ref7.onLink;
268
-
269
- onLink && onLink(key, index, _this.props.items[index]);
270
- };
271
- });
272
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (key, rowIndex) {
273
- return function (value) {
274
- var _ref8 = _this.props.callback || {},
275
- onBlur = _ref8.onBlur;
276
-
277
- _this.closeValid();
278
-
279
- onBlur && onBlur(_this.getIndex(rowIndex), key, value);
280
- };
281
- });
282
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
283
- return function () {
284
- var _ref9 = _this.props.callback || {},
285
- onDoubleClick = _ref9.onDoubleClick;
286
-
287
- onDoubleClick && onDoubleClick(key, value);
288
- };
289
- });
290
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onImgTileClick", function (col, value, rowIndex) {
291
- return function () {
292
- var _ref10 = _this.props.callback || {},
293
- onImgTileClick = _ref10.onImgTileClick;
294
-
295
- onImgTileClick && onImgTileClick(col, value, rowIndex);
296
- };
297
- });
298
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMoveRow", function (dragIndex, targetIndex) {
299
- var _ref11 = _this.props.callback || {},
300
- onMoveRow = _ref11.onMoveRow;
301
-
302
- onMoveRow && onMoveRow(dragIndex, targetIndex);
303
- });
304
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
305
- var _this$props = _this.props,
306
- valid = _this$props.valid,
307
- _this$props$callback = _this$props.callback,
308
- callback = _this$props$callback === void 0 ? {} : _this$props$callback;
309
- valid && callback.onExitValid();
310
- });
311
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getOptions", function (key, colOptions, index) {
312
- var options = _this.props.items[index].options;
313
- var options2 = _this.props.options;
314
-
315
- if (options && (0, _isArray["default"])(options[key])) {
316
- return options[key];
317
- } else if (options2 && (0, _isArray["default"])(options2[key])) {
318
- return options2[key];
319
- } else {
320
- return colOptions;
321
- }
322
- });
323
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validField", function (required, value) {
324
- if (!_this.props.valid || _this.error || !required || value) {
325
- return false;
326
- } else if (typeof value === 'number') {
327
- return false;
328
- } else {
329
- _this.error = true;
330
- return true;
331
- }
332
- });
333
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderEditableCell", function (config, value, index) {
334
- var key = config.key,
335
- type = config.type,
336
- options = config.options,
337
- props = config.props,
338
- required = config.required,
339
- width = config.width,
340
- showRowAdd = config.showRowAdd;
341
-
342
- var _this$props$items$ind = _this.props.items[index],
343
- readonly = _this$props$items$ind.readonly,
344
- _this$props$items$ind2 = _this$props$items$ind.isReadonly,
345
- isReadonly = _this$props$items$ind2 === void 0 ? [] : _this$props$items$ind2,
346
- _this$props$items$ind3 = _this$props$items$ind.isRequired,
347
- isRequired = _this$props$items$ind3 === void 0 ? [] : _this$props$items$ind3,
348
- _this$props$items$ind4 = _this$props$items$ind._extraProps,
349
- _extraProps = _this$props$items$ind4 === void 0 ? {} : _this$props$items$ind4;
350
-
351
- var cellProps = {
352
- value: value,
353
- width: width,
354
- items: _this.props.items[index],
355
- type: readonly || (0, _isArray["default"])(isReadonly) && (0, _includes["default"])(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
356
- props: readonly ? {} : props,
357
- error: _this.validField(required, value),
358
- options: _this.getOptions(key, options, index),
359
- onChange: _this.onChange(key, index),
360
- onSearch: _this.onSearch(key, index, config),
361
- onBlur: _this.onBlur(key, index)
362
- };
363
-
364
- if (showRowAdd && (0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
365
- cellProps.error = _this.validField(true, value);
366
- cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
367
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", {
368
- style: {
369
- color: 'red',
370
- display: 'inline-block'
371
- }
372
- }, "*"), /*#__PURE__*/_react["default"].createElement("span", {
373
- style: {
374
- marginLeft: '5px',
375
- display: 'inline-block',
376
- width: 'calc(100% - 12px)'
377
- }
378
- }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)), /*#__PURE__*/_react["default"].createElement("span", {
379
- style: {
380
- color: '#2196f3',
381
- verticalAlign: 'super'
382
- }
383
- }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
384
- type: "plus-circle-o",
385
- role: "add",
386
- onClick: _this.onRowAdd(key, index)
387
- })));
388
- }
389
-
390
- if ((0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
391
- cellProps.error = _this.validField(true, value);
392
- cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
393
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", {
394
- style: {
395
- color: 'red',
396
- display: 'inline-block'
397
- }
398
- }, "*"), /*#__PURE__*/_react["default"].createElement("span", {
399
- style: {
400
- marginLeft: '5px',
401
- display: 'inline-block',
402
- width: 'calc(100% - 12px)'
403
- }
404
- }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)));
405
- }
406
-
407
- if (showRowAdd) {
408
- return /*#__PURE__*/_react["default"].createElement("div", {
409
- style: {
410
- clear: 'both'
411
- }
412
- }, /*#__PURE__*/_react["default"].createElement("span", {
413
- style: {
414
- marginRight: '5px',
415
- "float": 'left'
416
- }
417
- }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)), /*#__PURE__*/_react["default"].createElement("span", {
418
- style: {
419
- color: '#2196f3',
420
- verticalAlign: 'middle'
421
- }
422
- }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
423
- type: "plus-circle-o",
424
- role: "add",
425
- onClick: _this.onRowAdd(key, index)
426
- })));
427
- }
428
-
429
- return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
430
- });
431
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderDoubleEditableCell", function (config, value, index) {
432
- var key = config.key,
433
- type = config.type,
434
- options = config.options,
435
- props = config.props,
436
- required = config.required,
437
- width = config.width,
438
- showRowAdd = config.showRowAdd;
439
-
440
- var _this$props$items$ind5 = _this.props.items[index],
441
- readonly = _this$props$items$ind5.readonly,
442
- _this$props$items$ind6 = _this$props$items$ind5.isReadonly,
443
- isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
444
- _this$props$items$ind7 = _this$props$items$ind5.isRequired,
445
- isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
446
- _this$props$items$ind8 = _this$props$items$ind5._extraProps,
447
- _extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
448
-
449
- var cellProps = {
450
- value: value,
451
- width: width,
452
- items: _this.props.items[index],
453
- type: readonly || (0, _isArray["default"])(isReadonly) && (0, _includes["default"])(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
454
- props: readonly ? {} : props,
455
- error: _this.validField(required, value),
456
- options: _this.getOptions(key, options, index),
457
- onChange: _this.onDoubleChange1(key, index),
458
- onSearch: _this.onSearch(key, index, config),
459
- onBlur: _this.onBlur(key, index)
460
- };
461
- return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
462
- });
463
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderLinkCell", function (col, value, record, index) {
464
- if (col.link === 'list') {
465
- var list = value && (0, _isArray["default"])(value) ? value : [];
466
- return /*#__PURE__*/_react["default"].createElement("div", {
467
- style: {
468
- whiteSpace: 'pre-wrap'
469
- }
470
- }, (0, _map["default"])(list).call(list, function (item2, index2) {
471
- var _context2;
472
-
473
- var split = index2 === list.length - 1 ? '' : ',';
474
-
475
- var onClick = function onClick() {
476
- var _ref12 = _this.props.callback || {},
477
- onLink = _ref12.onLink;
478
-
479
- onLink && onLink(col.key, index, item2);
480
- };
481
-
482
- return /*#__PURE__*/_react["default"].createElement("a", {
483
- key: index2,
484
- onClick: onClick
485
- }, (0, _concat["default"])(_context2 = "".concat(item2[col.linkTitleKey])).call(_context2, split));
486
- }));
487
- } else {
488
- var title = typeof col.link === 'string' ? col.link : value;
489
-
490
- var onClick = function onClick() {
491
- var _ref13 = _this.props.callback || {},
492
- onLink = _ref13.onLink;
493
-
494
- onLink && onLink(col.key, index, record);
495
- };
496
-
497
- return /*#__PURE__*/_react["default"].createElement("a", {
498
- style: {
499
- whiteSpace: 'normal',
500
- wordBreak: "break-all"
501
- },
502
- onClick: onClick
503
- }, title);
504
- }
505
- });
506
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getIndex", function (index) {
507
- return (_this.props.base || 0) + index;
508
- });
509
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
510
- return function (value, record, index) {
511
- var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
512
-
513
- var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
514
-
515
- if (!realType) {
516
- return /*#__PURE__*/_react["default"].createElement("div", {
517
- onDoubleClick: _this.onDoubleClick(col.key, record.key),
518
- style: {
519
- minHeight: '20px',
520
- minWidth: '100px',
521
- maxWidth: "".concat(col.width - 16, "px"),
522
- color: col.isNeedShow ? '#1890ff' : '',
523
- overflow: 'hidden',
524
- textOverflow: 'ellipsis',
525
- display: '-webkit-box',
526
- WebkitLineClamp: 2,
527
- WebkitBoxOrient: "vertical",
528
- whiteSpace: 'break-spaces'
529
- },
530
- title: value
531
- }, value);
532
- }
533
-
534
- switch (realType) {
535
- case 'checkbox':
536
- return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
537
- onChange: _this.onCheck(col.key, record.key),
538
- checked: value || false
539
- });
540
-
541
- case 'index':
542
- return _this.getIndex(index) + 1;
543
-
544
- case 'link':
545
- return _this.renderLinkCell(col, value, record, record.key);
546
-
547
- case 'button':
548
- var onClick = _this.props.callback.onLink ? (0, _bind["default"])(_context3 = _this.props.callback.onLink).call(_context3, null, col.key, record.key, record) : undefined;
549
-
550
- if (col.icon === 'add') {
551
- return /*#__PURE__*/_react["default"].createElement(_button["default"], {
552
- onClick: onClick,
553
- type: "primary",
554
- shape: "circle",
555
- size: "small",
556
- ghost: true,
557
- icon: "plus"
558
- });
559
- } else {
560
- return /*#__PURE__*/_react["default"].createElement(_button["default"], {
561
- onClick: onClick,
562
- size: "small",
563
- ghost: true,
564
- type: col.bsStyle
565
- }, record[col.key] || col.typeRelated);
566
- }
567
-
568
- case 'switch':
569
- return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
570
- checkedChildren: col.props.checkedChildren || '',
571
- unCheckedChildren: col.props.unCheckedChildren || '',
572
- onChange: _this.onSwitch(col.key, record.key),
573
- size: "default",
574
- checked: typeof value === 'number' ? Boolean(value) : value || false,
575
- disabled: !(record._isEdit === true)
576
- });
577
-
578
- case 'custom':
579
- return _this.props.callback.onRenderCustom(record.key, col.key, value, col.props, col);
580
-
581
- case 'toolbar':
582
- //showByKey为true时,每条数据中与按钮key相同的属性值决定按钮是否显示,建议key用下划线开始命名,避免与后台数据冲突
583
- var props = {
584
- onClick: _this.props.callback.onToolbar ? (0, _bind["default"])(_context4 = _this.props.callback.onToolbar).call(_context4, null, col.key, record.key, record) : undefined,
585
- buttons: col.props.showByKey ? (0, _filter["default"])(_context5 = col.props.buttons).call(_context5, function (item) {
586
- return record[item.key] === true;
587
- }) : (0, _filter["default"])(_context6 = col.props.buttons).call(_context6, function (item) {
588
- return item.defaultShow === !record._isEdit;
589
- })
590
- };
591
- return /*#__PURE__*/_react["default"].createElement(_SuperToolbar["default"], props);
592
-
593
- case 'img':
594
- return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
595
- src: (0, _includes["default"])(value).call(value, 'http') ? value : (0, _concat["default"])(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
596
- style: {
597
- width: '80px',
598
- height: '80px'
599
- }
600
- }) : /*#__PURE__*/_react["default"].createElement("div", {
601
- role: 'imgBox',
602
- style: {
603
- maxWidth: "".concat(col.width, "px")
604
- }
605
- }, /*#__PURE__*/_react["default"].createElement("img", {
606
- src: value.img === '' ? '/productDefault.png' : (0, _includes["default"])(_context8 = value.img).call(_context8, 'http') ? value.img : (0, _concat["default"])(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
607
- onError: function onError(e) {
608
- return e.target.src = '/productDefault.png';
609
- },
610
- style: {
611
- width: '80px',
612
- height: '80px'
613
- }
614
- }), /*#__PURE__*/_react["default"].createElement("div", {
615
- style: {
616
- display: 'inline-block'
617
- }
618
- }, /*#__PURE__*/_react["default"].createElement("span", {
619
- style: {
620
- display: 'block',
621
- whiteSpace: 'nowrap',
622
- overflow: 'hidden',
623
- textOverflow: 'ellipsis',
624
- width: '100px'
625
- },
626
- onClick: _this.onImgTileClick(col, record, index)
627
- }, value.title), _helper["default"].isEmpty2(value.remark) ? null : /*#__PURE__*/_react["default"].createElement("span", {
628
- style: {
629
- display: 'block',
630
- whiteSpace: 'nowrap',
631
- overflow: 'hidden',
632
- textOverflow: 'ellipsis',
633
- width: '100px',
634
- color: '#333'
635
- }
636
- }, value.remark))) : /*#__PURE__*/_react["default"].createElement("div", null);
637
-
638
- case 'uploadImg':
639
- var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
640
-
641
- var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
642
- onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
643
- type: col.type
644
- }, col.props), _this.props), commonProps), {}, {
645
- value: _this.props.items[index][col.key]
646
- });
647
-
648
- return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
649
-
650
- case 'double':
651
- return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
652
- type: realType
653
- }), value, record.key);
654
-
655
- default:
656
- return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
657
- type: realType
658
- }), value, record.key);
659
- }
660
- };
661
- });
662
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCheckedStatus", function (key) {
663
- var has = false,
664
- not = false;
665
- var items = _this.props.items;
666
-
667
- var _iterator = _createForOfIteratorHelper(items),
668
- _step;
669
-
670
- try {
671
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
672
- var item = _step.value;
673
- item[key] ? has = true : not = true;
674
- }
675
- } catch (err) {
676
- _iterator.e(err);
677
- } finally {
678
- _iterator.f();
679
- }
680
-
681
- return {
682
- checked: has && !not,
683
- indeterminate: has && not
684
- };
685
- });
686
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toAdd", function (key, showAdd) {
687
- if (showAdd) {
688
- var onClick = _this.onAdd(key);
689
-
690
- return /*#__PURE__*/_react["default"].createElement(_icon["default"], {
691
- type: "plus-circle-o",
692
- role: "add",
693
- onClick: onClick
694
- });
695
- } else {
696
- return null;
697
- }
698
- });
699
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref14) {
700
- var required = _ref14.required,
701
- title = _ref14.title,
702
- type = _ref14.type,
703
- key = _ref14.key,
704
- showAdd = _ref14.showAdd;
705
-
706
- if (type === 'checkbox') {
707
- var status = _this.getCheckedStatus(key);
708
-
709
- return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], (0, _extends2["default"])({
710
- onChange: _this.onCheck(key, -1)
711
- }, status));
712
- } else {
713
- var className = required ? 'ant-form-item-required' : '';
714
- return /*#__PURE__*/_react["default"].createElement("span", {
715
- className: className
716
- }, title, _this.toAdd(key, showAdd));
717
- }
718
- });
719
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref15) {
720
- var type = _ref15.type,
721
- align = _ref15.align;
722
-
723
- if (type === 'index' || type === 'checkbox') {
724
- return 'ant-table-selection-column';
725
- } else {
726
- return align ? (0, _variables["default"])('SuperTable2')[align] : '';
727
- }
728
- });
729
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
730
- var _context11;
731
-
732
- return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
733
- });
734
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
735
- var _context12;
736
-
737
- var readonly = _this.props.readonly;
738
- return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
739
- return !col.hide;
740
- })).call(_context12, function (_ref16, index) {
741
- var _context13;
742
-
743
- var col = (0, _extends2["default"])({}, _ref16);
744
- col.className = _this.getColumnClassName(col);
745
- col.title = _this.getColumnTitle(col);
746
- col.dataIndex = col.key;
747
- col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} =
748
- // const {edit = false} = props
749
- // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
750
- // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
751
- // return col
752
- // }
753
- // }
754
-
755
- col.readonly = readonly;
756
- col.render = _this.getCellRender(col);
757
-
758
- if (col.link) {
759
- col.type = 'link';
760
- col.render = _this.getCellRender(col);
761
- } else if (col.showPrice || col.decimalPlaces) {
762
- col.render = function (text, record, index) {
763
- if (col.showPrice && text) {
764
- text = _helper["default"].toThousands(text, col.decimalPlaces ? col.decimalPlaces : 2);
765
- return "\uFFE5".concat(text);
766
- } else {
767
- return text ? "\uFFE5".concat(text.toFixed(2)) : text;
768
- }
769
- };
770
- }
771
-
772
- return col;
773
- });
774
- });
775
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
776
- return (0, _map["default"])(items).call(items, function (item, index) {
777
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref17) {
778
- var _context14, _context15;
779
-
780
- var key = _ref17.key,
781
- type = _ref17.type,
782
- options = _ref17.options;
783
-
784
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key)) || (0, _includes["default"])(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
785
- result[key] = item[key];
786
- } else {
787
- result[key] = (0, _Control.getTitle)(item[key], options);
788
- }
789
-
790
- return result;
791
- }, _objectSpread(_objectSpread({}, item), {}, {
792
- key: index,
793
- disabled: item.isCanConfigHide
794
- }));
795
- });
796
- });
797
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox", function () {
798
- var _this$props2 = _this.props,
799
- items = _this$props2.items,
800
- _this$props2$isEmphas = _this$props2.isEmphasized,
801
- isEmphasized = _this$props2$isEmphas === void 0 ? false : _this$props2$isEmphas;
802
-
803
- var rowClassName = function rowClassName(record) {
804
- if (isEmphasized && items[record.key].__isEmphasized) {
805
- return items[record.key].checked ? (0, _variables["default"])('SuperTable2').emphasizedSelectRow : (0, _variables["default"])('SuperTable2').emphasizedUnselectRow;
806
- }
807
-
808
- return items[record.key].checked ? (0, _variables["default"])('SuperTable2').select : '';
809
- };
810
-
811
- return {
812
- rowClassName: rowClassName
813
- };
814
- });
815
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getSelectedRowKeys", function (items) {
816
- return (0, _reduce["default"])(items).call(items, function (result, item, index) {
817
- item.checked && result.push(index);
818
- return result;
819
- }, []);
820
- });
821
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox2", function (items) {
822
- var _this$props3 = _this.props,
823
- _this$props3$checkbox = _this$props3.checkbox,
824
- checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
825
- _this$props3$radio = _this$props3.radio,
826
- radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
827
- isolation = _this$props3.isolation,
828
- _this$props3$checkedR = _this$props3.checkedRows,
829
- checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
830
- _this$props3$isEmphas = _this$props3.isEmphasized,
831
- isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
832
- _this$props3$isWeaken = _this$props3.isWeaken,
833
- isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
834
-
835
- var rowClassName1 = function rowClassName1(record) {
836
- if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
837
- if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
838
- return (0, _includes["default"])(checkedRows).call(checkedRows, record.key) ? (0, _variables["default"])('SuperTable').select : '';
839
- };
840
-
841
- var rowClassName2 = function rowClassName2(record) {
842
- if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
843
- if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
844
-
845
- if (isEmphasized && items[record.key].__isEmphasized) {
846
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').emphasizedSelectRow : (0, _variables["default"])('SuperTable').emphasizedUnselectRow;
847
- }
848
-
849
- if (isWeaken && items[record.key].__isWeaken) {
850
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').weakenedSelectRow : (0, _variables["default"])('SuperTable').weakenedUnselectRow;
851
- }
852
-
853
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').select : '';
854
- };
855
-
856
- if (checkbox) {
857
- if (radio) {
858
- return {
859
- rowClassName: rowClassName1,
860
- onRowClick: _this.onRadioRowClick,
861
- rowSelection: {
862
- type: 'radio',
863
- selectedRowKeys: checkedRows,
864
- onChange: _this.onRadioChange
865
- }
866
- };
867
- } else if (isolation) {
868
- return {
869
- rowClassName: rowClassName1,
870
- onRowClick: _this.onRowClick,
871
- rowSelection: {
872
- selectedRowKeys: checkedRows,
873
- onChange: _this.onCheckChange,
874
- getCheckboxProps: function getCheckboxProps(record) {
875
- var checked = (0, _includes["default"])(checkedRows).call(checkedRows, record.key);
876
- return {
877
- checked: checked,
878
- disabled: items[record.key].__isWeaken,
879
- style: items[record.key].__total ? {
880
- display: 'none'
881
- } : {}
882
- };
883
- }
884
- }
885
- };
886
- } else {
887
- return {
888
- rowClassName: rowClassName2,
889
- onRowClick: _this.onRowClick,
890
- rowSelection: {
891
- selectedRowKeys: _this.getSelectedRowKeys(items),
892
- onChange: _this.onChange,
893
- getCheckboxProps: function getCheckboxProps(record) {
894
- var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
895
- return {
896
- checked: checked,
897
- disabled: items[record.key].__isWeaken,
898
- style: items[record.key].__total ? {
899
- display: 'none'
900
- } : {}
901
- };
902
- }
903
- }
904
- };
905
- }
906
- } else {
907
- return {
908
- rowClassName: rowClassName2
909
- };
910
- }
911
- });
912
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowPropsForDrag", function () {
913
- return function (record, index) {
914
- return {
915
- index: index,
916
- onMoveRow: _this.onMoveRow
917
- };
918
- };
919
- });
920
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowProps", function (onRowClick) {
921
- return function (record) {
922
- return {
923
- onClick: function onClick() {
924
- return onRowClick && onRowClick(record);
925
- },
926
- onDoubleClick: function onDoubleClick() {
927
- return _this.onDoubleClick(record);
928
- }
929
- };
930
- };
931
- });
932
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
933
- var _context16;
934
-
935
- var _this$props4 = _this.props,
936
- cols = _this$props4.cols,
937
- items = _this$props4.items,
938
- _this$props4$style = _this$props4.style,
939
- style = _this$props4$style === void 0 ? {} : _this$props4$style,
940
- _this$props4$footer = _this$props4.footer,
941
- footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
942
- _this$props4$paginati = _this$props4.pagination,
943
- pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
944
- dragSort = _this$props4.dragSort,
945
- _this$props4$isEmphas = _this$props4.isEmphasized,
946
- isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
947
- maxHeight = _this$props4.maxHeight,
948
- _this$props4$expanded = _this$props4.expandedRowRender,
949
- expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
950
- _this$props4$onExpand = _this$props4.onExpand,
951
- onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
952
- var widthX = (0, _reduce["default"])(_context16 = (0, _filter["default"])(cols).call(cols, function (col) {
953
- return !col.hide;
954
- })).call(_context16, function (width, item) {
955
- var _context17;
956
-
957
- return width += item.width ? item.width : (0, _includes["default"])(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
958
- }, 0);
959
- var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
960
- expandedRowRender: expandedRowRender
961
- } : {
962
- scroll: {
963
- x: (0, _some["default"])(cols).call(cols, function (item) {
964
- return !_helper["default"].isEmpty2(item.fixed);
965
- }) ? widthX : true,
966
- y: maxHeight
967
- }
968
- };
969
-
970
- var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
971
- onRowClick = _this$getPropsByCheck.onRowClick,
972
- extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
973
-
974
- return _objectSpread(_objectSpread({
975
- className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
976
- columns: _this.getColumns(cols),
977
- dataSource: _this.getDataSource(items, cols),
978
- style: (0, _assign["default"])({}, {
979
- whiteSpace: 'nowrap'
980
- }, style),
981
- size: 'small',
982
- pagination: pagination,
983
- footer: footer,
984
- onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
985
- components: dragSort ? {
986
- body: {
987
- row: _DragSortRow["default"]
988
- }
989
- } : {},
990
- locale: _this.props.emptyText ? {
991
- emptyText: _this.props.emptyText
992
- } : null
993
- }, _this.getPropsByCheckbox()), {}, {
994
- onExpand: onExpand
995
- }, scrollProps);
996
- });
997
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
998
- if (_this.props.maxHeight && _this.props.items.length) {
999
- var root = _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this));
1000
-
1001
- var container = root.getElementsByClassName('ant-table-body')[0];
1002
- var header = root.getElementsByClassName('ant-table-thead')[0];
1003
- (0, _fixed["default"])(container, header, _this.props.maxHeight);
1004
- }
1005
- });
1006
- return _this;
1007
- }
1008
-
1009
- (0, _createClass2["default"])(SuperTable2, [{
1010
- key: "componentDidMount",
1011
- value: function componentDidMount() {
1012
- this.setScroll();
1013
- }
1014
- }, {
1015
- key: "componentDidUpdate",
1016
- value: function componentDidUpdate() {
1017
- this.setScroll();
1018
- }
1019
- }, {
1020
- key: "render",
1021
- value: function render() {
1022
- this.error = false;
1023
- return /*#__PURE__*/_react["default"].createElement(_table["default"], (0, _extends2["default"])({}, this.getProps(), {
1024
- key: this.props.items.length
1025
- }));
1026
- }
1027
- }]);
1028
- return SuperTable2;
1029
- }(_react["default"].Component);
1030
-
1031
- (0, _defineProperty2["default"])(SuperTable2, "propTypes", {
1032
- cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
1033
- items: _propTypes["default"].array.isRequired,
1034
- base: _propTypes["default"].number,
1035
- options: _propTypes["default"].object,
1036
- valid: _propTypes["default"].bool,
1037
- readonly: _propTypes["default"].bool,
1038
- style: _propTypes["default"].object,
1039
- maxHeight: _propTypes["default"].string,
1040
- emptyText: _propTypes["default"].string,
1041
- footer: _propTypes["default"].func,
1042
- callback: _propTypes["default"].shape(CallbackType),
1043
- isEmphasized: _propTypes["default"].bool,
1044
- dragSort: _propTypes["default"].bool
1045
- });
1046
- var _default = SuperTable2;
1047
- exports["default"] = _default;