cloud-b2b 1.0.0 → 1.0.1

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 (172) hide show
  1. package/es/Card/Card.js +20 -0
  2. package/es/Card/package.json +6 -0
  3. package/es/Control/Control.js +402 -0
  4. package/es/Control/event.js +57 -0
  5. package/es/Control/package.json +6 -0
  6. package/es/Enhance/Dialogs.js +67 -0
  7. package/es/Enhance/Loading.js +151 -0
  8. package/es/Enhance/index.js +8 -0
  9. package/es/Enhance/package.json +6 -0
  10. package/es/Header/Header.js +194 -0
  11. package/es/Header/Header.less +94 -0
  12. package/es/Header/Vertical.js +129 -0
  13. package/es/Header/Vertical.less +60 -0
  14. package/es/Header/package.json +6 -0
  15. package/es/HomeHeader/Header.js +75 -0
  16. package/es/HomeHeader/Header.less +73 -0
  17. package/es/HomeHeader/package.json +6 -0
  18. package/es/ImageView/ImageView.js +117 -0
  19. package/es/ImageView/ImageView.less +14 -0
  20. package/es/ImageView/package.json +6 -0
  21. package/es/InpurCascader/InputCascader.js +135 -0
  22. package/es/InpurCascader/package.json +6 -0
  23. package/es/InputEditor/InputEditor.js +118 -0
  24. package/es/InputEditor/inputEditor.less +8 -0
  25. package/es/InputEditor/package.json +6 -0
  26. package/es/InputSearch/InputSearch.js +306 -0
  27. package/es/InputSearch/package.json +6 -0
  28. package/es/InputSelect/InputSelect.js +185 -0
  29. package/es/InputSelect/package.json +6 -0
  30. package/es/InputWriting/InputWriting.js +107 -0
  31. package/es/InputWriting/package.json +6 -0
  32. package/es/Layout/Layout.js +232 -0
  33. package/es/Layout/Layout.less +28 -0
  34. package/es/Layout/package.json +6 -0
  35. package/es/LayoutLink/LayoutLink.js +82 -0
  36. package/es/LayoutLink/LayoutLink.less +53 -0
  37. package/es/LayoutLink/package.json +6 -0
  38. package/es/Link/Link.js +108 -0
  39. package/es/Link/package.json +6 -0
  40. package/es/Loading/Loading.js +15 -0
  41. package/es/Loading/Loading.less +13 -0
  42. package/es/Loading/package.json +6 -0
  43. package/es/Loading2/Loading2.js +11 -0
  44. package/es/Loading2/Loading2.less +19 -0
  45. package/es/Loading2/package.json +6 -0
  46. package/es/ModalWithDrag/ModalWithDrag.js +34 -0
  47. package/es/ModalWithDrag/ModalWithDrag.less +6 -0
  48. package/es/ModalWithDrag/drag.js +133 -0
  49. package/es/ModalWithDrag/package.json +6 -0
  50. package/es/NumberInput/NumberInput.js +237 -0
  51. package/es/NumberInput/package.json +6 -0
  52. package/es/Search/Search.js +581 -0
  53. package/es/Search/Search.less +63 -0
  54. package/es/Search/package.json +6 -0
  55. package/es/Sidebar/Sidebar.js +165 -0
  56. package/es/Sidebar/Sidebar.less +77 -0
  57. package/es/Sidebar/package.json +6 -0
  58. package/es/Sidebar2/Sidebar.js +192 -0
  59. package/es/Sidebar2/Sidebar.less +153 -0
  60. package/es/Sidebar2/package.json +6 -0
  61. package/es/SuperForm/SuperForm.js +641 -0
  62. package/es/SuperForm/SuperForm.less +52 -0
  63. package/es/SuperForm/package.json +6 -0
  64. package/es/SuperIcon/SuperIcon.js +30 -0
  65. package/es/SuperIcon/package.json +6 -0
  66. package/es/SuperPagination/SuperPagination.js +126 -0
  67. package/es/SuperPagination/package.json +6 -0
  68. package/es/SuperToolbar/SuperToolbar.js +223 -0
  69. package/es/SuperToolbar/SuperToolbar.less +17 -0
  70. package/es/SuperToolbar/package.json +6 -0
  71. package/es/SuperUpload/SuperUpload.js +282 -0
  72. package/es/SuperUpload/SuperUpload.less +27 -0
  73. package/es/SuperUpload/package.json +6 -0
  74. package/es/Viewer/ImageViews.js +311 -0
  75. package/es/Viewer/Viewer.js +149 -0
  76. package/es/Viewer/Viewer.less +67 -0
  77. package/es/Viewer/imgView.less +59 -0
  78. package/es/Viewer/package.json +7 -0
  79. package/es/WingBlank/WingBlank.js +20 -0
  80. package/es/WingBlank/WingBlank.less +12 -0
  81. package/es/WingBlank/package.json +6 -0
  82. package/es/helper.js +118 -0
  83. package/es/history.js +5 -0
  84. package/es/index.js +24 -1
  85. package/es/variables.less +73 -73
  86. package/lib/Card/Card.js +38 -0
  87. package/lib/Card/package.json +6 -0
  88. package/lib/Control/Control.js +449 -0
  89. package/lib/Control/event.js +68 -0
  90. package/lib/Control/package.json +6 -0
  91. package/lib/Enhance/Dialogs.js +87 -0
  92. package/lib/Enhance/Loading.js +175 -0
  93. package/lib/Enhance/index.js +35 -0
  94. package/lib/Enhance/package.json +6 -0
  95. package/lib/Header/Header.js +215 -0
  96. package/lib/Header/Header.less +94 -0
  97. package/lib/Header/Vertical.js +150 -0
  98. package/lib/Header/Vertical.less +60 -0
  99. package/lib/Header/package.json +6 -0
  100. package/lib/HomeHeader/Header.js +95 -0
  101. package/lib/HomeHeader/Header.less +73 -0
  102. package/lib/HomeHeader/package.json +6 -0
  103. package/lib/ImageView/ImageView.js +134 -0
  104. package/lib/ImageView/ImageView.less +14 -0
  105. package/lib/ImageView/package.json +6 -0
  106. package/lib/InpurCascader/InputCascader.js +156 -0
  107. package/lib/InpurCascader/package.json +6 -0
  108. package/lib/InputEditor/InputEditor.js +136 -0
  109. package/lib/InputEditor/inputEditor.less +8 -0
  110. package/lib/InputEditor/package.json +6 -0
  111. package/lib/InputSearch/InputSearch.js +322 -0
  112. package/lib/InputSearch/package.json +6 -0
  113. package/lib/InputSelect/InputSelect.js +208 -0
  114. package/lib/InputSelect/package.json +6 -0
  115. package/lib/InputWriting/InputWriting.js +123 -0
  116. package/lib/InputWriting/package.json +6 -0
  117. package/lib/Layout/Layout.js +258 -0
  118. package/lib/Layout/Layout.less +28 -0
  119. package/lib/Layout/package.json +6 -0
  120. package/lib/LayoutLink/LayoutLink.js +114 -0
  121. package/lib/LayoutLink/LayoutLink.less +53 -0
  122. package/lib/LayoutLink/package.json +6 -0
  123. package/lib/Link/Link.js +130 -0
  124. package/lib/Link/package.json +6 -0
  125. package/lib/Loading/Loading.js +30 -0
  126. package/lib/Loading/Loading.less +13 -0
  127. package/lib/Loading/package.json +6 -0
  128. package/lib/Loading2/Loading2.js +26 -0
  129. package/lib/Loading2/Loading2.less +19 -0
  130. package/lib/Loading2/package.json +6 -0
  131. package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
  132. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  133. package/lib/ModalWithDrag/drag.js +147 -0
  134. package/lib/ModalWithDrag/package.json +6 -0
  135. package/lib/NumberInput/NumberInput.js +259 -0
  136. package/lib/NumberInput/package.json +6 -0
  137. package/lib/Search/Search.js +603 -0
  138. package/lib/Search/Search.less +63 -0
  139. package/lib/Search/package.json +6 -0
  140. package/lib/Sidebar/Sidebar.js +186 -0
  141. package/lib/Sidebar/Sidebar.less +77 -0
  142. package/lib/Sidebar/package.json +6 -0
  143. package/lib/Sidebar2/Sidebar.js +213 -0
  144. package/lib/Sidebar2/Sidebar.less +153 -0
  145. package/lib/Sidebar2/package.json +6 -0
  146. package/lib/SuperForm/SuperForm.js +657 -0
  147. package/lib/SuperForm/SuperForm.less +52 -0
  148. package/lib/SuperForm/package.json +6 -0
  149. package/lib/SuperIcon/SuperIcon.js +47 -0
  150. package/lib/SuperIcon/package.json +6 -0
  151. package/lib/SuperPagination/SuperPagination.js +145 -0
  152. package/lib/SuperPagination/package.json +6 -0
  153. package/lib/SuperToolbar/SuperToolbar.js +248 -0
  154. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  155. package/lib/SuperToolbar/package.json +6 -0
  156. package/lib/SuperUpload/SuperUpload.js +324 -0
  157. package/lib/SuperUpload/SuperUpload.less +27 -0
  158. package/lib/SuperUpload/package.json +6 -0
  159. package/lib/Viewer/ImageViews.js +323 -0
  160. package/lib/Viewer/Viewer.js +167 -0
  161. package/lib/Viewer/Viewer.less +67 -0
  162. package/lib/Viewer/imgView.less +59 -0
  163. package/lib/Viewer/package.json +7 -0
  164. package/lib/WingBlank/WingBlank.js +37 -0
  165. package/lib/WingBlank/WingBlank.less +12 -0
  166. package/lib/WingBlank/package.json +6 -0
  167. package/lib/helper.js +147 -0
  168. package/lib/history.js +18 -0
  169. package/lib/index.js +208 -1
  170. package/lib/index.less +20 -1
  171. package/lib/variables.less +73 -73
  172. package/package.json +3 -2
@@ -0,0 +1,151 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
7
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
8
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
9
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
10
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
11
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
12
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
13
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
14
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
15
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
16
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
17
+
18
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+
22
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
23
+
24
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
25
+
26
+ 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; } }
27
+
28
+ import React from 'react';
29
+ import PropTypes from 'prop-types';
30
+ import Loading from '../Loading';
31
+ var STATUS = ['loadingWithInit', // 显示加载画面,并自动触发onInit事件,默认值
32
+ 'loading', // 显示加载画面
33
+ 'retry', // 显示重试画面
34
+ 'retryForHome', // 显示重试画面(触发onInit时,home参数为true)
35
+ 'page' // 显示正常的页面(表明页面状态已经初始化好)
36
+ ];
37
+ /**
38
+ * status: [可选], 当前状态。默认为loadingWithInit
39
+ * home: [可选],为true表明接受首页触发的事件。默认为false
40
+ * onInit: [可选],原型为func(home),home为true表明初始化是来源首页
41
+ * onRefreshForHome:[可选],检测到来至首页时会触发该事件,原型为func()
42
+ */
43
+
44
+ var Enhance = function Enhance(Component) {
45
+ var _class;
46
+
47
+ return _class = /*#__PURE__*/function (_React$Component) {
48
+ _inherits(_class, _React$Component);
49
+
50
+ var _super = _createSuper(_class);
51
+
52
+ function _class() {
53
+ var _context;
54
+
55
+ var _this;
56
+
57
+ _classCallCheck(this, _class);
58
+
59
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
+ args[_key] = arguments[_key];
61
+ }
62
+
63
+ _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
64
+
65
+ _defineProperty(_assertThisInitialized(_this), "triggerEvent", function () {
66
+ if (!global.isServer) {
67
+ var _this$props = _this.props,
68
+ _this$props$status = _this$props.status,
69
+ status = _this$props$status === void 0 ? 'loadingWithInit' : _this$props$status,
70
+ home = _this$props.home,
71
+ onInit = _this$props.onInit,
72
+ onRefreshForHome = _this$props.onRefreshForHome;
73
+
74
+ if (!home) {
75
+ if (status === 'loadingWithInit') {
76
+ onInit && onInit(false);
77
+ }
78
+ } else {
79
+ var __home = global['__home'];
80
+ global['__home'] && (global['__home'] = false);
81
+
82
+ if (status === 'loadingWithInit') {
83
+ onInit && onInit(__home);
84
+ } else if (__home) {
85
+ if (status === 'page') {
86
+ onRefreshForHome && onRefreshForHome();
87
+ } else if (status !== 'loading') {
88
+ onInit && onInit(__home);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ });
94
+
95
+ _defineProperty(_assertThisInitialized(_this), "onRetry", function () {
96
+ var _this$props2 = _this.props,
97
+ status = _this$props2.status,
98
+ onInit = _this$props2.onInit;
99
+ onInit && onInit(status === 'retryForHome');
100
+ });
101
+
102
+ _defineProperty(_assertThisInitialized(_this), "getPageProps", function () {
103
+ var props = _objectSpread({}, _this.props);
104
+
105
+ delete props.status;
106
+ delete props.home;
107
+ delete props.onInit;
108
+ delete props.onRefreshForHome;
109
+ return props;
110
+ });
111
+
112
+ return _this;
113
+ }
114
+
115
+ _createClass(_class, [{
116
+ key: "componentDidMount",
117
+ value: function componentDidMount() {
118
+ this.triggerEvent();
119
+ }
120
+ }, {
121
+ key: "componentDidUpdate",
122
+ value: function componentDidUpdate() {
123
+ this.triggerEvent();
124
+ }
125
+ }, {
126
+ key: "render",
127
+ value: function render() {
128
+ var status = this.props.status;
129
+
130
+ if (status !== 'page') {
131
+ var retry = status === 'retry' || status === 'retryForHome';
132
+ return /*#__PURE__*/React.createElement(Loading, {
133
+ retry: retry,
134
+ onRetry: this.onRetry
135
+ });
136
+ } else {
137
+ return /*#__PURE__*/React.createElement(Component, this.getPageProps());
138
+ }
139
+ }
140
+ }]);
141
+
142
+ return _class;
143
+ }(React.Component), _defineProperty(_class, "propTypes", {
144
+ status: PropTypes.oneOf(STATUS),
145
+ home: PropTypes.bool,
146
+ onInit: PropTypes.func,
147
+ onRefreshForHome: PropTypes.func
148
+ }), _class;
149
+ };
150
+
151
+ export default Enhance;
@@ -0,0 +1,8 @@
1
+ import EnhanceLoading from './Loading';
2
+ import EnhanceDialogs from './Dialogs';
3
+
4
+ var EnhanceEditDialog = function EnhanceEditDialog(Container, EditDialog) {
5
+ return EnhanceDialogs(Container, ['edit'], [EditDialog]);
6
+ };
7
+
8
+ export { EnhanceLoading, EnhanceDialogs, EnhanceEditDialog };
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Enhance",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Enhance.js"
6
+ }
@@ -0,0 +1,194 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
7
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
8
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
9
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
10
+ import _Dropdown from "antd/es/dropdown";
11
+ import _Badge from "antd/es/badge";
12
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
13
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
14
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
15
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
16
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
17
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
18
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
19
+ import _Menu from "antd/es/menu";
20
+
21
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
+
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
24
+
25
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
26
+
27
+ 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; } }
28
+
29
+ import React from 'react';
30
+ import Link from '../Link';
31
+ import SuperIcon from '../SuperIcon';
32
+ import helper from '../helper';
33
+ import Vertical from './Vertical';
34
+ import variables from '../variables';
35
+ var MenuItem = _Menu.Item;
36
+
37
+ var Header = /*#__PURE__*/function (_React$Component) {
38
+ _inherits(Header, _React$Component);
39
+
40
+ var _super = _createSuper(Header);
41
+
42
+ function Header(_props) {
43
+ var _this;
44
+
45
+ _classCallCheck(this, Header);
46
+
47
+ _this = _super.call(this, _props);
48
+
49
+ _defineProperty(_assertThisInitialized(_this), "toLogo", function () {
50
+ var img = _this.props.logoImg || '/logo.png';
51
+
52
+ var props = _this.getLinkProps('home', _this.state['main'] || _this.props.homeUrl || '/', {
53
+ role: 'logo'
54
+ });
55
+
56
+ return /*#__PURE__*/React.createElement(Link, props, /*#__PURE__*/React.createElement("img", {
57
+ src: img,
58
+ alt: "logo"
59
+ }));
60
+ });
61
+
62
+ _defineProperty(_assertThisInitialized(_this), "toIcon", function (type) {
63
+ var style = {
64
+ fontSize: 18,
65
+ verticalAlign: 'middle'
66
+ };
67
+ return /*#__PURE__*/React.createElement(SuperIcon, {
68
+ type: type,
69
+ style: style
70
+ });
71
+ });
72
+
73
+ _defineProperty(_assertThisInitialized(_this), "getLinkProps", function (key, url) {
74
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
75
+ return _objectSpread(_objectSpread({}, props), {}, {
76
+ to: url,
77
+ 'data-role': 'block',
78
+ 'data-active': _this.props.selectKey === key ? 'true' : null
79
+ });
80
+ });
81
+
82
+ _defineProperty(_assertThisInitialized(_this), "toSetting", function (settingUrl) {
83
+ if (settingUrl) {
84
+ var props = _this.getLinkProps('setting', _this.state['setting'] || settingUrl);
85
+
86
+ return /*#__PURE__*/React.createElement(Link, props, _this.toIcon('pld-setting'));
87
+ } else {
88
+ return null;
89
+ }
90
+ });
91
+
92
+ _defineProperty(_assertThisInitialized(_this), "toMessage", function (messageUrl) {
93
+ var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
94
+
95
+ if (messageUrl) {
96
+ var props = _this.getLinkProps('message', _this.state['message'] || messageUrl);
97
+
98
+ var msgProps = {
99
+ overflowCount: 99,
100
+ title: "\u60A8\u6709".concat(count, "\u6761\u672A\u8BFB\u6D88\u606F"),
101
+ count: count
102
+ };
103
+ return /*#__PURE__*/React.createElement(Link, props, /*#__PURE__*/React.createElement("span", {
104
+ role: "message"
105
+ }, /*#__PURE__*/React.createElement(_Badge, msgProps, _this.toIcon('pld-xiaoxi'))));
106
+ } else {
107
+ return null;
108
+ }
109
+ });
110
+
111
+ _defineProperty(_assertThisInitialized(_this), "onMenuItemClick", function (_ref) {
112
+ var key = _ref.key;
113
+ var onMenuClick = _this.props.onMenuClick;
114
+ onMenuClick && onMenuClick(key);
115
+ });
116
+
117
+ _defineProperty(_assertThisInitialized(_this), "menu", function (hasImport) {
118
+ return /*#__PURE__*/React.createElement(_Menu, {
119
+ className: s.menu,
120
+ onClick: _this.onMenuItemClick
121
+ }, /*#__PURE__*/React.createElement(MenuItem, {
122
+ key: "person"
123
+ }, "\u4E2A\u4EBA\u4FE1\u606F"), hasImport ? /*#__PURE__*/React.createElement(MenuItem, {
124
+ key: "mode"
125
+ }, "\u5BFC\u5165\u6A21\u677F") : null, /*#__PURE__*/React.createElement(MenuItem, {
126
+ key: "modify"
127
+ }, "\u4FEE\u6539\u5BC6\u7801"));
128
+ });
129
+
130
+ _defineProperty(_assertThisInitialized(_this), "avatar", function (hasImport) {
131
+ return /*#__PURE__*/React.createElement(_Dropdown, {
132
+ placement: "bottomRight",
133
+ overlay: _this.menu(hasImport)
134
+ }, /*#__PURE__*/React.createElement("span", {
135
+ "data-role": "avatar",
136
+ style: {
137
+ cursor: 'pointer'
138
+ }
139
+ }, _this.toIcon(_this.props.userIcon)));
140
+ });
141
+
142
+ _defineProperty(_assertThisInitialized(_this), "toPerson", function () {
143
+ var hasImport = _this.props.hasImport || true;
144
+ return /*#__PURE__*/React.createElement("div", {
145
+ role: "person"
146
+ }, /*#__PURE__*/React.createElement("div", null), _this.avatar(hasImport), /*#__PURE__*/React.createElement("span", null, _this.props.userName));
147
+ });
148
+
149
+ _defineProperty(_assertThisInitialized(_this), "toLogout", function () {
150
+ var props = {
151
+ to: _this.props.loginUrl,
152
+ 'data-role': 'block',
153
+ onClick: _this.props.onLogout()
154
+ };
155
+ return /*#__PURE__*/React.createElement(Link, props, _this.toIcon('logout'), /*#__PURE__*/React.createElement("span", null, "\u9000\u51FA"));
156
+ });
157
+
158
+ _defineProperty(_assertThisInitialized(_this), "toTail", function () {
159
+ var _this$props = _this.props,
160
+ settingUrl = _this$props.settingUrl,
161
+ messageUrl = _this$props.messageUrl,
162
+ messageCount = _this$props.messageCount;
163
+ return /*#__PURE__*/React.createElement("span", null, _this.toSetting(settingUrl), _this.toMessage(messageUrl, messageCount), _this.toPerson(), _this.toLogout());
164
+ });
165
+
166
+ if (_props.selectUrl) {
167
+ _this.state = _defineProperty({}, _props.selectKey, _props.selectUrl);
168
+ }
169
+
170
+ return _this;
171
+ }
172
+
173
+ _createClass(Header, [{
174
+ key: "componentWillReceiveProps",
175
+ value: function componentWillReceiveProps(props) {
176
+ if (props.selectUrl) {
177
+ this.setState(_defineProperty({}, props.selectKey, props.selectUrl));
178
+ }
179
+ }
180
+ }, {
181
+ key: "render",
182
+ value: function render() {
183
+ return /*#__PURE__*/React.createElement("header", {
184
+ className: variables('Header')
185
+ }, this.toLogo(), this.toTail());
186
+ }
187
+ }]);
188
+
189
+ return Header;
190
+ }(React.Component);
191
+
192
+ _defineProperty(Header, "Vertical", Vertical);
193
+
194
+ export default Header;
@@ -0,0 +1,94 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-Header {
4
+ height: @header-height;
5
+ color: @header-color;
6
+ background-color: #000717;
7
+ font-size: @header-font-size;
8
+ line-height: @header-height;
9
+
10
+ > * {
11
+ display: inline-block;
12
+ text-align: center;
13
+ vertical-align: top;
14
+ }
15
+
16
+ > div:first-child {
17
+ margin-left: 20px;
18
+
19
+ > img {
20
+ width: 130px;
21
+ }
22
+ }
23
+
24
+ > :last-child {
25
+ float: right;
26
+ margin-right: 15px;
27
+ }
28
+
29
+ [role='person'] {
30
+ display: inline-block;
31
+ height: 40px;
32
+
33
+ >:first-child {
34
+ display: inline-block;
35
+ border-left: 1px solid white;
36
+ height: 14px;
37
+ vertical-align: middle;
38
+ }
39
+
40
+ > i {
41
+ margin: 8px;
42
+ }
43
+
44
+ > span {
45
+ font-size: 14px;
46
+ }
47
+ }
48
+
49
+ [data-role='block'] {
50
+ display: inline-block;
51
+ padding-left: 10px;
52
+ padding-right: 10px;
53
+ color: @header-color;
54
+ height: 40px;
55
+
56
+ > span:last-child {
57
+ font-size: 14px;
58
+ margin-left: 5px;
59
+ }
60
+
61
+ &:hover,
62
+ &[data-active] {
63
+ background-color: @header-hover-bg;
64
+ }
65
+ }
66
+
67
+ [data-role='avatar'] {
68
+ display: inline-block;
69
+ padding-left: 15px;
70
+ padding-right: 15px;
71
+ color: @header-color;
72
+ }
73
+
74
+ :global {
75
+ .ant-badge-count {
76
+ box-shadow: none;
77
+ padding: 0 6px;
78
+ top: -2px;
79
+ }
80
+ }
81
+ }
82
+
83
+ .menu {
84
+ :global {
85
+ .ant-dropdown-menu-item {
86
+ padding: 8px 20px;
87
+ }
88
+
89
+ .ant-dropdown-menu-item-group-title {
90
+ padding: 6px 20px;
91
+ color: #333;
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,129 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
5
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
8
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
9
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
10
+ import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
11
+ import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
12
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
13
+
14
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
+
16
+ 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; } }
17
+
18
+ import React from 'react';
19
+ import PropTypes from 'prop-types';
20
+ import Link from '../Link';
21
+ import SuperIcon from '../SuperIcon';
22
+ import variables from '../variables';
23
+ var ITEM_TYPE = {
24
+ key: PropTypes.string.isRequired,
25
+ href: PropTypes.string.isRequired,
26
+ title: PropTypes.string.isRequired,
27
+ icon: PropTypes.string.isRequired
28
+ };
29
+ /**
30
+ * selectKey: 选中的key
31
+ * url:url优先级高于item中的href
32
+ */
33
+
34
+ var Vertical = /*#__PURE__*/function (_React$Component) {
35
+ _inherits(Vertical, _React$Component);
36
+
37
+ var _super = _createSuper(Vertical);
38
+
39
+ function Vertical() {
40
+ var _context;
41
+
42
+ var _this;
43
+
44
+ _classCallCheck(this, Vertical);
45
+
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
48
+ }
49
+
50
+ _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
51
+
52
+ _defineProperty(_assertThisInitialized(_this), "state", {
53
+ id: ''
54
+ });
55
+
56
+ _defineProperty(_assertThisInitialized(_this), "isSelect", function (item) {
57
+ return item.key === _this.props.selectKey;
58
+ });
59
+
60
+ _defineProperty(_assertThisInitialized(_this), "getUrl", function (item) {
61
+ return _this.props.url[item.key] || item.href;
62
+ });
63
+
64
+ _defineProperty(_assertThisInitialized(_this), "onClick", function (selectKey) {
65
+ _this.props.onSelectKey && _this.props.onSelectKey(selectKey);
66
+
67
+ if (_this.state.id) {
68
+ clearTimeout(_this.state.id);
69
+ }
70
+
71
+ _this.setState({
72
+ id: _setTimeout(function () {
73
+ _this.setState({
74
+ id: ''
75
+ });
76
+ }, 500)
77
+ });
78
+ });
79
+
80
+ _defineProperty(_assertThisInitialized(_this), "toItem", function (item) {
81
+ if (!item.jumpOut) {
82
+ var _context2;
83
+
84
+ return /*#__PURE__*/React.createElement(Link, {
85
+ key: item.key,
86
+ to: _this.getUrl(item),
87
+ "data-select": _this.isSelect(item),
88
+ onClick: _bindInstanceProperty(_context2 = _this.onClick).call(_context2, null, item.key)
89
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(SuperIcon, {
90
+ type: item.icon
91
+ })), /*#__PURE__*/React.createElement("span", null, item.title));
92
+ } else {
93
+ var props = {
94
+ key: item.key,
95
+ href: item.href,
96
+ target: '_blank'
97
+ };
98
+ return /*#__PURE__*/React.createElement("a", props, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(SuperIcon, {
99
+ type: item.icon
100
+ })), /*#__PURE__*/React.createElement("span", null, item.title));
101
+ }
102
+ });
103
+
104
+ return _this;
105
+ }
106
+
107
+ _createClass(Vertical, [{
108
+ key: "render",
109
+ value: function render() {
110
+ var _context3;
111
+
112
+ return /*#__PURE__*/React.createElement("header", {
113
+ className: variables('Vertical'),
114
+ "data-click": !!this.state.id
115
+ }, _mapInstanceProperty(_context3 = this.props.items).call(_context3, this.toItem));
116
+ }
117
+ }]);
118
+
119
+ return Vertical;
120
+ }(React.Component);
121
+
122
+ _defineProperty(Vertical, "propTypes", {
123
+ selectKey: PropTypes.string,
124
+ url: PropTypes.object,
125
+ items: PropTypes.arrayOf(PropTypes.shape(ITEM_TYPE)),
126
+ onSelectKey: PropTypes.func
127
+ });
128
+
129
+ export default Vertical;
@@ -0,0 +1,60 @@
1
+ @import '../variables.less';
2
+
3
+ @width: @header-height;
4
+ @height: 40px;
5
+
6
+ .@{cloudlink-prefix}-Vertical {
7
+ position: relative;
8
+ z-index: 100;
9
+ background: #000717;
10
+ width: @width;
11
+ height: ~'calc(100vh - @{header-height})';
12
+ transition: width 0.4s;
13
+
14
+ > a {
15
+ display: block;
16
+ height: @height;
17
+ color: white;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ transition: none;
21
+
22
+ > :first-child {
23
+ display: inline-block;
24
+ vertical-align: top;
25
+ width: @width;
26
+ line-height: @height;
27
+ text-align: center;
28
+ font-size: 16px;
29
+ padding-top: 1px;
30
+ color: #d3eafd;
31
+ }
32
+
33
+ > :last-child {
34
+ line-height: @height;
35
+ font-size: 14px;
36
+ }
37
+
38
+ &:hover > :first-child {
39
+ color: white;
40
+ }
41
+
42
+ &[data-select='true'] {
43
+ background: @primary-color;
44
+ color: white;
45
+
46
+ > :first-child {
47
+ color: white;
48
+ }
49
+ }
50
+ }
51
+
52
+ &:hover {
53
+ width: @width + @sidebar-width;
54
+ }
55
+
56
+ &[data-click='true'] {
57
+ width: @width;
58
+ transition: none;
59
+ }
60
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Header",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Header.js"
6
+ }