cloud-b2b 1.1.46 → 1.1.51

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 (304) 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/InputTreeSelect/package.json +6 -0
  20. package/src/InputWriting/InputWriting.js +65 -0
  21. package/src/Layout/Layout.js +121 -0
  22. package/src/LayoutLink/LayoutLink.js +59 -0
  23. package/src/Link/Link.js +57 -0
  24. package/src/Loading/Loading.js +15 -0
  25. package/src/Loading2/Loading2.js +15 -0
  26. package/src/ModalWithDrag/ModalWithDrag.js +17 -0
  27. package/{es → src}/ModalWithDrag/drag.js +128 -116
  28. package/src/NumberInput/NumberInput.js +137 -0
  29. package/src/Search/Search.js +368 -0
  30. package/src/Sidebar/Sidebar.js +111 -0
  31. package/src/Sidebar2/Sidebar.js +143 -0
  32. package/src/SuperForm/SuperForm.js +516 -0
  33. package/src/SuperForm2/SuperForm.js +588 -0
  34. package/src/SuperIcon/SuperIcon.js +14 -0
  35. package/src/SuperPagination/SuperPagination.js +65 -0
  36. package/src/SuperTab/SuperTab.js +84 -0
  37. package/src/SuperTab2/SuperTab2.js +94 -0
  38. package/src/SuperTable/DragSortRow.js +62 -0
  39. package/src/SuperTable/FilterDropDown.js +111 -0
  40. package/src/SuperTable/SuperTable.js +590 -0
  41. package/src/SuperTable/fixed.js +34 -0
  42. package/src/SuperTable2/SuperTable2.js +600 -0
  43. package/src/SuperTable2/SuperTableCell.js +144 -0
  44. package/src/SuperTable3/FilterDropDown.js +111 -0
  45. package/src/SuperTable3/SuperTable.js +498 -0
  46. package/src/SuperTable3/fixed.js +34 -0
  47. package/src/SuperToolbar/SuperToolbar.js +128 -0
  48. package/src/SuperUpload/SuperUpload.js +137 -0
  49. package/src/Title/Title.js +18 -0
  50. package/src/Viewer/ImageViews.js +220 -0
  51. package/src/Viewer/Viewer.js +97 -0
  52. package/src/WingBlank/WingBlank.js +14 -0
  53. package/src/helper.js +185 -0
  54. package/{es → src}/history.js +6 -6
  55. package/src/index.js +38 -0
  56. package/src/variables.js +5 -0
  57. package/test/index.html +10 -0
  58. package/test/test.js +16 -0
  59. package/test/test.less +12 -0
  60. package/test/webpack.config.js +71 -0
  61. package/tools/babel.config.js +14 -0
  62. package/tools/build.js +70 -0
  63. package/tools/publish.js +9 -0
  64. package/tools/util.js +53 -0
  65. package/es/Area/Area.js +0 -141
  66. package/es/Card/Card.js +0 -19
  67. package/es/CodeInput/CodeInput.js +0 -123
  68. package/es/Control/Control.js +0 -437
  69. package/es/Control/event.js +0 -43
  70. package/es/Enhance/Dialogs.js +0 -52
  71. package/es/Enhance/Loading.js +0 -131
  72. package/es/Header/Header.js +0 -162
  73. package/es/Header/Vertical.js +0 -106
  74. package/es/ImageView/ImageView.js +0 -100
  75. package/es/Indent/Indent.js +0 -19
  76. package/es/InpurCascader/InputCascader.js +0 -109
  77. package/es/InputEditor/InputEditor.js +0 -114
  78. package/es/InputSearch/InputSearch.js +0 -266
  79. package/es/InputSelect/InputSelect.js +0 -160
  80. package/es/InputWriting/InputWriting.js +0 -85
  81. package/es/Layout/Layout.js +0 -201
  82. package/es/LayoutLink/LayoutLink.js +0 -73
  83. package/es/Link/Link.js +0 -85
  84. package/es/Loading/Loading.js +0 -13
  85. package/es/Loading2/Loading2.js +0 -9
  86. package/es/ModalWithDrag/ModalWithDrag.js +0 -29
  87. package/es/NumberInput/NumberInput.js +0 -200
  88. package/es/Search/Search.js +0 -485
  89. package/es/Sidebar/Sidebar.js +0 -144
  90. package/es/Sidebar2/Sidebar.js +0 -165
  91. package/es/SuperForm/SuperForm.js +0 -583
  92. package/es/SuperForm2/SuperForm.js +0 -677
  93. package/es/SuperIcon/SuperIcon.js +0 -27
  94. package/es/SuperPagination/SuperPagination.js +0 -109
  95. package/es/SuperTab/SuperTab.js +0 -107
  96. package/es/SuperTab2/SuperTab2.js +0 -145
  97. package/es/SuperTable/DragSortRow.js +0 -97
  98. package/es/SuperTable/FilterDropDown.js +0 -164
  99. package/es/SuperTable/SuperTable.js +0 -808
  100. package/es/SuperTable/fixed.js +0 -34
  101. package/es/SuperTable2/SuperTable2.js +0 -894
  102. package/es/SuperTable2/SuperTableCell.js +0 -198
  103. package/es/SuperTable3/FilterDropDown.js +0 -164
  104. package/es/SuperTable3/SuperTable.js +0 -665
  105. package/es/SuperTable3/fixed.js +0 -34
  106. package/es/SuperToolbar/SuperToolbar.js +0 -195
  107. package/es/SuperUpload/SuperUpload.js +0 -357
  108. package/es/Title/Title.js +0 -33
  109. package/es/Viewer/ImageViews.js +0 -258
  110. package/es/Viewer/Viewer.js +0 -122
  111. package/es/WingBlank/WingBlank.js +0 -16
  112. package/es/helper.js +0 -147
  113. package/es/index.js +0 -37
  114. package/es/variables.js +0 -4
  115. package/lib/Area/Area.js +0 -150
  116. package/lib/Area/package.json +0 -6
  117. package/lib/Card/Card.js +0 -28
  118. package/lib/Card/package.json +0 -6
  119. package/lib/CodeInput/CodeInput.js +0 -132
  120. package/lib/CodeInput/package.json +0 -6
  121. package/lib/Control/Control.js +0 -446
  122. package/lib/Control/event.js +0 -52
  123. package/lib/Control/package.json +0 -6
  124. package/lib/Enhance/Dialogs.js +0 -61
  125. package/lib/Enhance/Loading.js +0 -139
  126. package/lib/Enhance/index.js +0 -26
  127. package/lib/Enhance/package.json +0 -6
  128. package/lib/Header/Header.js +0 -170
  129. package/lib/Header/Header.less +0 -95
  130. package/lib/Header/Vertical.js +0 -115
  131. package/lib/Header/Vertical.less +0 -60
  132. package/lib/Header/package.json +0 -6
  133. package/lib/ImageView/ImageView.js +0 -109
  134. package/lib/ImageView/ImageView.less +0 -14
  135. package/lib/ImageView/package.json +0 -6
  136. package/lib/Indent/Indent.js +0 -28
  137. package/lib/Indent/package.json +0 -6
  138. package/lib/InpurCascader/InputCascader.js +0 -117
  139. package/lib/InpurCascader/package.json +0 -6
  140. package/lib/InputEditor/InputEditor.js +0 -123
  141. package/lib/InputEditor/inputEditor.less +0 -8
  142. package/lib/InputEditor/package.json +0 -6
  143. package/lib/InputSearch/InputSearch.js +0 -275
  144. package/lib/InputSearch/package.json +0 -6
  145. package/lib/InputSelect/InputSelect.js +0 -169
  146. package/lib/InputSelect/package.json +0 -6
  147. package/lib/InputWriting/InputWriting.js +0 -94
  148. package/lib/InputWriting/package.json +0 -6
  149. package/lib/Layout/Layout.js +0 -210
  150. package/lib/Layout/Layout.less +0 -28
  151. package/lib/Layout/package.json +0 -6
  152. package/lib/LayoutLink/LayoutLink.js +0 -87
  153. package/lib/LayoutLink/LayoutLink.less +0 -53
  154. package/lib/LayoutLink/package.json +0 -6
  155. package/lib/Link/Link.js +0 -94
  156. package/lib/Link/package.json +0 -6
  157. package/lib/Loading/Loading.js +0 -22
  158. package/lib/Loading/Loading.less +0 -13
  159. package/lib/Loading/package.json +0 -6
  160. package/lib/Loading2/Loading2.js +0 -18
  161. package/lib/Loading2/Loading2.less +0 -19
  162. package/lib/Loading2/package.json +0 -6
  163. package/lib/ModalWithDrag/ModalWithDrag.js +0 -38
  164. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  165. package/lib/ModalWithDrag/drag.js +0 -125
  166. package/lib/ModalWithDrag/package.json +0 -6
  167. package/lib/NumberInput/NumberInput.js +0 -209
  168. package/lib/NumberInput/package.json +0 -6
  169. package/lib/Search/Search.js +0 -499
  170. package/lib/Search/Search.less +0 -63
  171. package/lib/Search/package.json +0 -6
  172. package/lib/Sidebar/Sidebar.js +0 -153
  173. package/lib/Sidebar/Sidebar.less +0 -78
  174. package/lib/Sidebar/package.json +0 -6
  175. package/lib/Sidebar2/Sidebar.js +0 -174
  176. package/lib/Sidebar2/Sidebar.less +0 -153
  177. package/lib/Sidebar2/package.json +0 -6
  178. package/lib/SuperForm/SuperForm.js +0 -596
  179. package/lib/SuperForm/SuperForm.less +0 -52
  180. package/lib/SuperForm/package.json +0 -6
  181. package/lib/SuperForm2/SuperForm.js +0 -690
  182. package/lib/SuperForm2/SuperForm.less +0 -52
  183. package/lib/SuperForm2/package.json +0 -6
  184. package/lib/SuperIcon/SuperIcon.js +0 -36
  185. package/lib/SuperIcon/package.json +0 -6
  186. package/lib/SuperPagination/SuperPagination.js +0 -118
  187. package/lib/SuperPagination/package.json +0 -6
  188. package/lib/SuperTab/SuperTab.js +0 -116
  189. package/lib/SuperTab/SuperTab.less +0 -43
  190. package/lib/SuperTab/package.json +0 -6
  191. package/lib/SuperTab2/SuperTab2.js +0 -154
  192. package/lib/SuperTab2/SuperTab2.less +0 -18
  193. package/lib/SuperTab2/package.json +0 -6
  194. package/lib/SuperTable/DragSortRow.js +0 -106
  195. package/lib/SuperTable/DragSortRow.less +0 -17
  196. package/lib/SuperTable/FilterDropDown.js +0 -173
  197. package/lib/SuperTable/FilterDropDown.less +0 -30
  198. package/lib/SuperTable/SuperTable.js +0 -817
  199. package/lib/SuperTable/SuperTable.less +0 -132
  200. package/lib/SuperTable/fixed.js +0 -43
  201. package/lib/SuperTable/package.json +0 -6
  202. package/lib/SuperTable2/SuperTable2.js +0 -908
  203. package/lib/SuperTable2/SuperTable2.less +0 -118
  204. package/lib/SuperTable2/SuperTableCell.js +0 -204
  205. package/lib/SuperTable2/package.json +0 -6
  206. package/lib/SuperTable3/FilterDropDown.js +0 -173
  207. package/lib/SuperTable3/FilterDropDown.less +0 -29
  208. package/lib/SuperTable3/SuperTable.js +0 -674
  209. package/lib/SuperTable3/SuperTable.less +0 -99
  210. package/lib/SuperTable3/fixed.js +0 -43
  211. package/lib/SuperTable3/package.json +0 -6
  212. package/lib/SuperToolbar/SuperToolbar.js +0 -204
  213. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  214. package/lib/SuperToolbar/package.json +0 -6
  215. package/lib/SuperUpload/SuperUpload.js +0 -370
  216. package/lib/SuperUpload/SuperUpload.less +0 -28
  217. package/lib/SuperUpload/package.json +0 -6
  218. package/lib/Title/Title.js +0 -42
  219. package/lib/Title/Title.less +0 -35
  220. package/lib/Title/package.json +0 -6
  221. package/lib/Viewer/ImageViews.js +0 -267
  222. package/lib/Viewer/Viewer.js +0 -131
  223. package/lib/Viewer/Viewer.less +0 -67
  224. package/lib/Viewer/imgView.less +0 -59
  225. package/lib/Viewer/package.json +0 -7
  226. package/lib/WingBlank/WingBlank.js +0 -25
  227. package/lib/WingBlank/WingBlank.less +0 -12
  228. package/lib/WingBlank/package.json +0 -6
  229. package/lib/adjust.less +0 -89
  230. package/lib/helper.js +0 -163
  231. package/lib/history.js +0 -13
  232. package/lib/index.js +0 -271
  233. package/lib/index.less +0 -31
  234. package/lib/style.less +0 -30
  235. package/lib/variables.js +0 -12
  236. package/lib/variables.less +0 -73
  237. /package/{es → src}/Area/package.json +0 -0
  238. /package/{es → src}/Card/package.json +0 -0
  239. /package/{es → src}/CodeInput/package.json +0 -0
  240. /package/{es → src}/Control/package.json +0 -0
  241. /package/{es → src}/Enhance/package.json +0 -0
  242. /package/{es → src}/Header/Header.less +0 -0
  243. /package/{es → src}/Header/Vertical.less +0 -0
  244. /package/{es → src}/Header/package.json +0 -0
  245. /package/{es → src}/ImageView/ImageView.less +0 -0
  246. /package/{es → src}/ImageView/package.json +0 -0
  247. /package/{es → src}/Indent/package.json +0 -0
  248. /package/{es → src}/InpurCascader/package.json +0 -0
  249. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  250. /package/{es → src}/InputEditor/package.json +0 -0
  251. /package/{es → src}/InputSearch/package.json +0 -0
  252. /package/{es → src}/InputSelect/package.json +0 -0
  253. /package/{es → src}/InputWriting/package.json +0 -0
  254. /package/{es → src}/Layout/Layout.less +0 -0
  255. /package/{es → src}/Layout/package.json +0 -0
  256. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  257. /package/{es → src}/LayoutLink/package.json +0 -0
  258. /package/{es → src}/Link/package.json +0 -0
  259. /package/{es → src}/Loading/Loading.less +0 -0
  260. /package/{es → src}/Loading/package.json +0 -0
  261. /package/{es → src}/Loading2/Loading2.less +0 -0
  262. /package/{es → src}/Loading2/package.json +0 -0
  263. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  264. /package/{es → src}/ModalWithDrag/package.json +0 -0
  265. /package/{es → src}/NumberInput/package.json +0 -0
  266. /package/{es → src}/Search/Search.less +0 -0
  267. /package/{es → src}/Search/package.json +0 -0
  268. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  269. /package/{es → src}/Sidebar/package.json +0 -0
  270. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  271. /package/{es → src}/Sidebar2/package.json +0 -0
  272. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  273. /package/{es → src}/SuperForm/package.json +0 -0
  274. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  275. /package/{es → src}/SuperForm2/package.json +0 -0
  276. /package/{es → src}/SuperIcon/package.json +0 -0
  277. /package/{es → src}/SuperPagination/package.json +0 -0
  278. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  279. /package/{es → src}/SuperTab/package.json +0 -0
  280. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  281. /package/{es → src}/SuperTab2/package.json +0 -0
  282. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  283. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  284. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  285. /package/{es → src}/SuperTable/package.json +0 -0
  286. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  287. /package/{es → src}/SuperTable2/package.json +0 -0
  288. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  289. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  290. /package/{es → src}/SuperTable3/package.json +0 -0
  291. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  292. /package/{es → src}/SuperToolbar/package.json +0 -0
  293. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  294. /package/{es → src}/SuperUpload/package.json +0 -0
  295. /package/{es → src}/Title/Title.less +0 -0
  296. /package/{es → src}/Title/package.json +0 -0
  297. /package/{es → src}/Viewer/Viewer.less +0 -0
  298. /package/{es → src}/Viewer/imgView.less +0 -0
  299. /package/{es → src}/Viewer/package.json +0 -0
  300. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  301. /package/{es → src}/WingBlank/package.json +0 -0
  302. /package/{es → src}/adjust.less +0 -0
  303. /package/{es → src}/style.less +0 -0
  304. /package/{es → src}/variables.less +0 -0
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Loading from '../Loading';
4
+
5
+ const STATUS = [
6
+ 'loadingWithInit', // 显示加载画面,并自动触发onInit事件,默认值
7
+ 'loading', // 显示加载画面
8
+ 'retry', // 显示重试画面
9
+ 'retryForHome', // 显示重试画面(触发onInit时,home参数为true)
10
+ 'page', // 显示正常的页面(表明页面状态已经初始化好)
11
+ ];
12
+
13
+ /**
14
+ * status: [可选], 当前状态。默认为loadingWithInit
15
+ * home: [可选],为true表明接受首页触发的事件。默认为false
16
+ * onInit: [可选],原型为func(home),home为true表明初始化是来源首页
17
+ * onRefreshForHome:[可选],检测到来至首页时会触发该事件,原型为func()
18
+ */
19
+ const Enhance = Component => class extends React.Component {
20
+ static propTypes = {
21
+ status: PropTypes.oneOf(STATUS),
22
+ home: PropTypes.bool,
23
+ onInit: PropTypes.func,
24
+ onRefreshForHome: PropTypes.func
25
+ };
26
+
27
+ triggerEvent = () => {
28
+ if (!global.isServer) {
29
+ const {status='loadingWithInit', home, onInit, onRefreshForHome} = this.props;
30
+ if (!home) {
31
+ if (status === 'loadingWithInit') {
32
+ onInit && onInit(false);
33
+ }
34
+ } else {
35
+ const __home = global['__home'];
36
+ global['__home'] && (global['__home'] = false);
37
+ if (status === 'loadingWithInit') {
38
+ onInit && onInit(__home);
39
+ } else if (__home) {
40
+ if (status === 'page') {
41
+ onRefreshForHome && onRefreshForHome();
42
+ } else if (status !== 'loading') {
43
+ onInit && onInit(__home);
44
+ }
45
+ }
46
+ }
47
+ }
48
+ };
49
+
50
+ componentDidMount() {
51
+ this.triggerEvent();
52
+ }
53
+
54
+ componentDidUpdate() {
55
+ this.triggerEvent();
56
+ }
57
+
58
+ onRetry = () => {
59
+ const {status, onInit} = this.props;
60
+ onInit && onInit(status === 'retryForHome');
61
+ };
62
+
63
+ getPageProps = () => {
64
+ const props = {...this.props};
65
+ delete props.status;
66
+ delete props.home;
67
+ delete props.onInit;
68
+ delete props.onRefreshForHome;
69
+ return props;
70
+ };
71
+
72
+ render() {
73
+ const {status} = this.props;
74
+ if (status !== 'page') {
75
+ const retry = status === 'retry' || status === 'retryForHome';
76
+ return <Loading retry={retry} onRetry={this.onRetry}/>;
77
+ } else {
78
+ return <Component {...this.getPageProps()} />;
79
+ }
80
+ }
81
+ };
82
+
83
+ export default Enhance;
@@ -1,6 +1,8 @@
1
- import EnhanceLoading from './Loading';
2
- import EnhanceDialogs from './Dialogs';
3
- var EnhanceEditDialog = function EnhanceEditDialog(Container, EditDialog) {
4
- return EnhanceDialogs(Container, ['edit'], [EditDialog]);
5
- };
6
- export { EnhanceLoading, EnhanceDialogs, EnhanceEditDialog };
1
+ import EnhanceLoading from './Loading';
2
+ import EnhanceDialogs from './Dialogs';
3
+
4
+ const EnhanceEditDialog = (Container, EditDialog) => {
5
+ return EnhanceDialogs(Container, ['edit'], [EditDialog]);
6
+ };
7
+
8
+ export {EnhanceLoading, EnhanceDialogs, EnhanceEditDialog};
@@ -0,0 +1,149 @@
1
+ import React from 'react';
2
+ import {Badge, Avatar, Menu, Dropdown} from 'antd';
3
+ import Link from '../Link';
4
+ import SuperIcon from '../SuperIcon';
5
+ import helper from '../helper';
6
+ import Vertical from './Vertical';
7
+ import variables from '../variables';
8
+
9
+ const MenuItem = Menu.Item;
10
+
11
+ class Header extends React.Component {
12
+
13
+ static Vertical = Vertical;
14
+
15
+ constructor(props) {
16
+ super(props);
17
+ if (props.selectUrl) {
18
+ this.state = {[props.selectKey]: props.selectUrl};
19
+ }
20
+ }
21
+
22
+ componentWillReceiveProps(props) {
23
+ if (props.selectUrl) {
24
+ this.setState({[props.selectKey]: props.selectUrl});
25
+ }
26
+ }
27
+
28
+ toLogo = () => {
29
+ const img = this.props.logoImg || '/logo.png';
30
+ const props = this.getLinkProps('home', this.state['main'] || this.props.homeUrl || '/', {role: 'logo'});
31
+ return <Link {...props}><img src={img} alt='logo'/></Link>;
32
+ };
33
+
34
+ toIcon = (type) => {
35
+ const style = {fontSize: 18, verticalAlign: 'middle'};
36
+ return <SuperIcon type={type} style={style} />;
37
+ };
38
+
39
+ getLinkProps = (key, url, props={}) => {
40
+ return {
41
+ ...props,
42
+ to: url,
43
+ 'data-role': 'block',
44
+ 'data-active': this.props.selectKey === key ? 'true' : null
45
+ };
46
+ };
47
+
48
+ toSetting = (settingUrl) => {
49
+ if (settingUrl) {
50
+ const props = this.getLinkProps('setting', this.state['setting'] || settingUrl);
51
+ return <Link {...props}>{this.toIcon('pld-setting')}</Link>;
52
+ } else {
53
+ return null;
54
+ }
55
+ };
56
+
57
+ toMessage = (messageUrl, count=0) => {
58
+ if (messageUrl) {
59
+ const props = this.getLinkProps('message', this.state['message'] || messageUrl);
60
+ const msgProps = {
61
+ overflowCount: 99,
62
+ title: `您有${count}条未读消息`,
63
+ count
64
+ };
65
+ return (
66
+ <Link {...props}>
67
+ <span role='message'>
68
+ <Badge {...msgProps}>{this.toIcon('pld-xiaoxi')}</Badge>
69
+ </span>
70
+ </Link>
71
+ );
72
+ } else {
73
+ return null;
74
+ }
75
+ };
76
+
77
+ onMenuItemClick = ({key}) => {
78
+ const {onMenuClick} = this.props;
79
+ onMenuClick && onMenuClick(key);
80
+ };
81
+
82
+ menu = (hasImport) => {
83
+ return (
84
+ <Menu className={variables('Header').menu} onClick={this.onMenuItemClick}>
85
+ <MenuItem key='person'>个人信息</MenuItem>
86
+ {hasImport ? <MenuItem key='mode'>导入模板</MenuItem> : null}
87
+ <MenuItem key='modify'>修改密码</MenuItem>
88
+ </Menu>
89
+ );
90
+ };
91
+
92
+ avatar = (hasImport) => {
93
+ return (
94
+ <Dropdown placement='bottomRight' overlay={this.menu(hasImport)}>
95
+ <span data-role='avatar' style={{cursor: 'pointer'}}>
96
+ {this.toIcon(this.props.userIcon)}
97
+ </span>
98
+ </Dropdown>
99
+ );
100
+ };
101
+
102
+ toPerson = () => {
103
+ const hasImport = this.props.hasImport || true;
104
+ return (
105
+ <div role='person'>
106
+ <div/>
107
+ {this.avatar(hasImport)}
108
+ <span>{this.props.userName}</span>
109
+ </div>
110
+ );
111
+ };
112
+
113
+ toLogout = () => {
114
+ const props = {
115
+ to: this.props.loginUrl,
116
+ 'data-role': 'block',
117
+ onClick: this.props.onLogout()
118
+ };
119
+ return (
120
+ <Link {...props}>
121
+ {this.toIcon('logout')}
122
+ <span>退出</span>
123
+ </Link>
124
+ );
125
+ };
126
+
127
+ toTail = () => {
128
+ const {settingUrl,messageUrl,messageCount} = this.props;
129
+ return (
130
+ <span>
131
+ {this.toSetting(settingUrl)}
132
+ {this.toMessage(messageUrl,messageCount)}
133
+ {this.toPerson()}
134
+ {this.toLogout()}
135
+ </span>
136
+ );
137
+ };
138
+
139
+ render() {
140
+ return (
141
+ <header className={variables('Header')}>
142
+ {this.toLogo()}
143
+ {this.toTail()}
144
+ </header>
145
+ );
146
+ }
147
+ }
148
+
149
+ export default Header;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Link from '../Link';
4
+ import SuperIcon from '../SuperIcon';
5
+ import variables from '../variables';
6
+
7
+ const ITEM_TYPE = {
8
+ key: PropTypes.string.isRequired,
9
+ href: PropTypes.string.isRequired,
10
+ title: PropTypes.string.isRequired,
11
+ icon: PropTypes.string.isRequired
12
+ };
13
+
14
+ /**
15
+ * selectKey: 选中的key
16
+ * url:url优先级高于item中的href
17
+ */
18
+ class Vertical extends React.Component {
19
+ static propTypes = {
20
+ selectKey: PropTypes.string,
21
+ url: PropTypes.object,
22
+ items: PropTypes.arrayOf(PropTypes.shape(ITEM_TYPE)),
23
+ onSelectKey: PropTypes.func
24
+ };
25
+
26
+ state = {id: ''};
27
+
28
+ isSelect = (item) => {
29
+ return item.key === this.props.selectKey;
30
+ };
31
+
32
+ getUrl = (item) => {
33
+ return this.props.url[item.key] || item.href;
34
+ };
35
+
36
+ onClick = (selectKey) => {
37
+ this.props.onSelectKey && this.props.onSelectKey(selectKey);
38
+ if (this.state.id) {
39
+ clearTimeout(this.state.id);
40
+ }
41
+ this.setState({id: setTimeout(() => {
42
+ this.setState({id: ''});
43
+ }, 500)})
44
+ };
45
+
46
+ toItem = (item) => {
47
+ if (!item.jumpOut) {
48
+ return (
49
+ <Link key={item.key} to={this.getUrl(item)} data-select={this.isSelect(item)} onClick={this.onClick.bind(null, item.key)}>
50
+ <span><SuperIcon type={item.icon} /></span>
51
+ <span>{item.title}</span>
52
+ </Link>
53
+ );
54
+ } else {
55
+ const props = {key: item.key, href: item.href, target: '_blank'};
56
+ return (
57
+ <a {...props}>
58
+ <span><SuperIcon type={item.icon} /></span>
59
+ <span>{item.title}</span>
60
+ </a>
61
+ );
62
+ }
63
+ };
64
+
65
+ render() {
66
+ return (
67
+ <header className={variables('Vertical')} data-click={!!this.state.id}>
68
+ {this.props.items.map(this.toItem)}
69
+ </header>
70
+ );
71
+ }
72
+ }
73
+
74
+ export default Vertical;
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import {ModalWithDrag, Title} from '../index';
3
+ import { Empty } from 'antd';
4
+ import variables from '../variables';
5
+
6
+ class ImageView extends React.Component{
7
+ constructor(props) {
8
+ super(props);
9
+ this.state = {
10
+ previewVisible: false,
11
+ index: 0,
12
+ };
13
+ }
14
+ ClosePreview = () => {this.setState({ previewVisible: false })}
15
+ showBigImg = () =>{
16
+ const {imgList} = this.props;
17
+ const {previewVisible,index} = this.state;
18
+ const props = {
19
+ width: 900,
20
+ title: imgList[index].fileName,
21
+ onCancel: this.ClosePreview,
22
+ visible: previewVisible,
23
+ maskClosable: true,
24
+ footer: null
25
+ };
26
+ return (
27
+ <ModalWithDrag {...props}>
28
+ <img alt="example" style={{ width: '100%' }} src={imgList[index].fileUrl} />
29
+ </ModalWithDrag>
30
+ );
31
+ }
32
+
33
+ toSeeImg = (e) =>{
34
+ if (this.props.toSeeImg) {
35
+ this.props.toSeeImg(e);
36
+ } else {
37
+ this.myClick(e.index)
38
+ }
39
+ }
40
+
41
+ myClick = (index) =>{
42
+ this.setState({ previewVisible: true , index: index})
43
+ }
44
+
45
+ render (){
46
+ const {imgList,title, toSeeImg} = this.props;
47
+ return (
48
+ <div className={variables('ImageView')}>
49
+ {title ? <Title title={title}></Title> : null}
50
+ {imgList.length === 0 ? (<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />) : imgList.map((item,index) =>{
51
+ return (<div className={'imgBox'} key={index} onClick={() => this.toSeeImg({imgArr:imgList,index})}>
52
+ <img src={item.fileUrl}/>
53
+ <p>{item.fileName}</p>
54
+ </div>)
55
+ })}
56
+ {toSeeImg ? null : this.showBigImg()}
57
+ </div>
58
+ )
59
+ }
60
+ }
61
+
62
+ export default ImageView;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ function Indent({children, style={}, ...props}) {
4
+ Object.assign(style, {paddingLeft: 8, paddingRight: 8});
5
+ return (
6
+ <div style={style} {...props}>
7
+ {children}
8
+ </div>
9
+ );
10
+ }
11
+
12
+ export default Indent;
@@ -0,0 +1,83 @@
1
+ //级联选择input
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Cascader } from 'antd';
5
+ import { getObjectExclude } from '../helper';
6
+
7
+ const optionsType = {
8
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
9
+ disabled: PropTypes.bool,
10
+ children: PropTypes.array,
11
+ title: PropTypes.string,
12
+ isLeaf: PropTypes.bool //false 就会触发 loadData 方法,从而在loadData方法中请求下一级数据,
13
+ }
14
+
15
+
16
+ const PROPS = {
17
+ options: PropTypes.arrayOf(PropTypes.shape(optionsType)).isRequired,
18
+ value: PropTypes.array.isRequired,
19
+ placeholder: PropTypes.string,
20
+ onChange: PropTypes.func,
21
+ loadData: PropTypes.func, //动态加载 ps:loadData 与 showSearch 无法一起使用
22
+ showSearch: PropTypes.func
23
+ }
24
+
25
+ const PROPS_KEYS = Object.keys(PROPS);
26
+ class InputCascader extends React.Component {
27
+ static propTypes = PROPS;
28
+
29
+ constructor(props) {
30
+ super(props);
31
+ }
32
+
33
+ onChange = (value) => {
34
+ const { onChange } = this.props;
35
+ onChange && onChange(value)
36
+ };
37
+
38
+ loadData = selectedOptions => {
39
+ const { onSearch } = this.props;
40
+ onSearch && onSearch(selectedOptions[0])
41
+ };
42
+
43
+ getOptions = (options) => {
44
+ return options.map(option => {
45
+ let obj = { ...option, label: option.title};
46
+ if(option.children && option.children.length > 0){
47
+ obj.children = this.getOptions(option.children)
48
+ }
49
+ return obj;
50
+ })
51
+ }
52
+
53
+ showSearch = (inputValue, path) => {
54
+
55
+ };
56
+
57
+ getProps = () => {
58
+ const { options = [], placeholder, size,value,loadData,showSearch } = this.props;
59
+ const props = Object.assign(getObjectExclude({}, PROPS_KEYS), {
60
+ onChange: this.onChange,
61
+ value: value,
62
+ options: this.getOptions(options),
63
+ changeOnSelect: true,
64
+ placeholder: placeholder,
65
+ size
66
+ })
67
+ //动态加载 ps:loadData 与 showSearch 无法一起使用
68
+ if(loadData){
69
+ props.loadData = this.loadData
70
+ }else if(showSearch){
71
+ props.showSearch = this.showSearch;
72
+ }
73
+ return props;
74
+ };
75
+
76
+ render() {
77
+ return (
78
+ <Cascader {...this.getProps()} />
79
+ )
80
+ }
81
+ }
82
+
83
+ export default InputCascader;
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import variables from '../variables';
3
+ import helper from "../helper";
4
+
5
+ const defaultMenus = [
6
+ 'head', // 标题
7
+ 'bold', // 粗体
8
+ 'fontSize', // 字号
9
+ 'fontName', // 字体
10
+ 'italic', // 斜体
11
+ 'underline', // 下划线
12
+ 'strikeThrough', // 删除线
13
+ 'foreColor', // 文字颜色
14
+ 'backColor', // 背景颜色
15
+ 'link', // 插入链接
16
+ 'list', // 列表
17
+ 'justify', // 对齐方式
18
+ 'quote', // 引用
19
+ 'image', // 插入图片
20
+ 'table', // 表格
21
+ 'code', // 插入代码
22
+ 'video', // 插入视频
23
+ ];
24
+
25
+ class InputEditor extends React.Component {
26
+
27
+ componentDidMount() {
28
+ const {inputKey,menus,color,showLinkImg = true,uploadImgShowBase64 = true,onChange,value, readonly, uploadVideoServer='/api/proxy/base-server-service/file/client/upload/document',} = this.props;
29
+ if (!readonly) {
30
+ const elem = this.refs[inputKey];
31
+ this[inputKey] = new E(elem);
32
+ //配置菜单
33
+ menus && (this[inputKey].config.menus = menus);
34
+ //配置颜色
35
+ color && (this[inputKey].config.menus = color);
36
+ //配置菜单
37
+ this[inputKey].config.menus = defaultMenus;
38
+ if(menus){
39
+ this[inputKey].config.menus = menus
40
+ }
41
+ this[inputKey].config.uploadImgShowBase64 = uploadImgShowBase64; //是否可以上传图片
42
+ this[inputKey].config.showLinkImg = showLinkImg; //隐藏网络图片
43
+ if (uploadVideoServer) {
44
+ this[inputKey].config.uploadVideoServer = uploadVideoServer;
45
+ this[inputKey].config.uploadVideoMaxSize = 1024 * 1024 * 100; // 100MB
46
+ this[inputKey].config.uploadVideoAccept = ['mp4', 'webm', 'ogg']; // 支持的视频格式
47
+ this[inputKey].config.uploadVideoName = 'file'; // form-data fieldName
48
+ // 自定义视频插入回调
49
+ this[inputKey].config.uploadVideoHooks = {
50
+ customInsert: async (insertVideo, results) => {
51
+ console.log(results)
52
+ if (results.returnCode === 0 && results.result) {
53
+ const URL_DOWNLOAD= '/api/standard/download'; // 点击下载
54
+ const {returnCode, result, returnMsg} = await helper.fetchJson(`${URL_DOWNLOAD}/${results.result}`);
55
+ if (returnCode !== 0) {
56
+ return helper.showError(returnMsg);
57
+ }
58
+ const currentOrigin = window.location.origin; // 获取当前页面的协议+域名+端口
59
+ const videoUrl = `${currentOrigin}/api/proxy/base-server-service/file/url/documents/open/${results.result}`;
60
+ insertVideo(videoUrl);
61
+ } else {
62
+ alert('视频上传失败: ' + (results.message || '未知错误'));
63
+ }
64
+ },
65
+ };
66
+ }
67
+ this[inputKey].config.onchange = html => {
68
+ onChange && onChange(html);
69
+ };
70
+ //配置编辑区域的 z-index
71
+ this[inputKey].config.zIndex = 0;
72
+ this[inputKey].create();
73
+ this[inputKey].txt.html(value)
74
+ }
75
+ }
76
+
77
+ componentDidUpdate() {
78
+ // const {inputKey,value='', readonly} = this.props;
79
+ // !readonly && value && this[inputKey].txt.html(value); //支持清空操作
80
+ }
81
+
82
+ render() {
83
+ const {inputKey, readonly, value} = this.props;
84
+
85
+ return (
86
+ <div className={variables('InputEditor')}>
87
+ {readonly ? <div dangerouslySetInnerHTML = {{__html:`${value}`}}/> : <div ref={inputKey} />}
88
+ </div>
89
+ );
90
+ }
91
+ }
92
+
93
+ export default InputEditor;