cloud-b2b 1.0.0 → 1.0.3

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 (208) hide show
  1. package/es/Area/Area.js +166 -0
  2. package/es/Area/package.json +6 -0
  3. package/es/Card/Card.js +20 -0
  4. package/es/Card/package.json +6 -0
  5. package/es/Control/Control.js +428 -0
  6. package/es/Control/event.js +57 -0
  7. package/es/Control/package.json +6 -0
  8. package/es/Enhance/Dialogs.js +67 -0
  9. package/es/Enhance/Loading.js +151 -0
  10. package/es/Enhance/index.js +8 -0
  11. package/es/Enhance/package.json +6 -0
  12. package/es/Header/Header.js +194 -0
  13. package/es/Header/Header.less +95 -0
  14. package/es/Header/Vertical.js +129 -0
  15. package/es/Header/Vertical.less +60 -0
  16. package/es/Header/package.json +6 -0
  17. package/es/HomeHeader/Header.js +75 -0
  18. package/es/HomeHeader/Header.less +73 -0
  19. package/es/HomeHeader/package.json +6 -0
  20. package/es/ImageView/ImageView.js +117 -0
  21. package/es/ImageView/ImageView.less +14 -0
  22. package/es/ImageView/package.json +6 -0
  23. package/es/InpurCascader/InputCascader.js +135 -0
  24. package/es/InpurCascader/package.json +6 -0
  25. package/es/InputEditor/InputEditor.js +118 -0
  26. package/es/InputEditor/inputEditor.less +8 -0
  27. package/es/InputEditor/package.json +6 -0
  28. package/es/InputSearch/InputSearch.js +306 -0
  29. package/es/InputSearch/package.json +6 -0
  30. package/es/InputSelect/InputSelect.js +185 -0
  31. package/es/InputSelect/package.json +6 -0
  32. package/es/InputWriting/InputWriting.js +107 -0
  33. package/es/InputWriting/package.json +6 -0
  34. package/es/Layout/Layout.js +232 -0
  35. package/es/Layout/Layout.less +28 -0
  36. package/es/Layout/package.json +6 -0
  37. package/es/LayoutLink/LayoutLink.js +82 -0
  38. package/es/LayoutLink/LayoutLink.less +53 -0
  39. package/es/LayoutLink/package.json +6 -0
  40. package/es/Link/Link.js +108 -0
  41. package/es/Link/package.json +6 -0
  42. package/es/Loading/Loading.js +15 -0
  43. package/es/Loading/Loading.less +13 -0
  44. package/es/Loading/package.json +6 -0
  45. package/es/Loading2/Loading2.js +11 -0
  46. package/es/Loading2/Loading2.less +19 -0
  47. package/es/Loading2/package.json +6 -0
  48. package/es/ModalWithDrag/ModalWithDrag.js +34 -0
  49. package/es/ModalWithDrag/ModalWithDrag.less +6 -0
  50. package/es/ModalWithDrag/drag.js +133 -0
  51. package/es/ModalWithDrag/package.json +6 -0
  52. package/es/NumberInput/NumberInput.js +237 -0
  53. package/es/NumberInput/package.json +6 -0
  54. package/es/Search/Search.js +581 -0
  55. package/es/Search/Search.less +63 -0
  56. package/es/Search/package.json +6 -0
  57. package/es/Sidebar/Sidebar.js +165 -0
  58. package/es/Sidebar/Sidebar.less +78 -0
  59. package/es/Sidebar/package.json +6 -0
  60. package/es/Sidebar2/Sidebar.js +192 -0
  61. package/es/Sidebar2/Sidebar.less +153 -0
  62. package/es/Sidebar2/package.json +6 -0
  63. package/es/SuperForm/SuperForm.js +688 -0
  64. package/es/SuperForm/SuperForm.less +52 -0
  65. package/es/SuperForm/package.json +6 -0
  66. package/es/SuperIcon/SuperIcon.js +30 -0
  67. package/es/SuperIcon/package.json +6 -0
  68. package/es/SuperPagination/SuperPagination.js +126 -0
  69. package/es/SuperPagination/package.json +6 -0
  70. package/es/SuperTable/DragSortRow.js +125 -0
  71. package/es/SuperTable/DragSortRow.less +17 -0
  72. package/es/SuperTable/FilterDropDown.js +188 -0
  73. package/es/SuperTable/FilterDropDown.less +30 -0
  74. package/es/SuperTable/SuperTable.js +933 -0
  75. package/es/SuperTable/SuperTable.less +135 -0
  76. package/es/SuperTable/fixed.js +42 -0
  77. package/es/SuperTable/package.json +6 -0
  78. package/es/SuperTable2/SuperTable2.js +700 -0
  79. package/es/SuperTable2/SuperTable2.less +100 -0
  80. package/es/SuperTable2/SuperTableCell.js +215 -0
  81. package/es/SuperTable2/package.json +6 -0
  82. package/es/SuperToolbar/SuperToolbar.js +223 -0
  83. package/es/SuperToolbar/SuperToolbar.less +17 -0
  84. package/es/SuperToolbar/package.json +6 -0
  85. package/es/SuperUpload/SuperUpload.js +282 -0
  86. package/es/SuperUpload/SuperUpload.less +27 -0
  87. package/es/SuperUpload/package.json +6 -0
  88. package/es/Title/Title.less +35 -35
  89. package/es/Title/package.json +6 -6
  90. package/es/Viewer/ImageViews.js +311 -0
  91. package/es/Viewer/Viewer.js +149 -0
  92. package/es/Viewer/Viewer.less +67 -0
  93. package/es/Viewer/imgView.less +59 -0
  94. package/es/Viewer/package.json +7 -0
  95. package/es/WingBlank/WingBlank.js +20 -0
  96. package/es/WingBlank/WingBlank.less +12 -0
  97. package/es/WingBlank/package.json +6 -0
  98. package/es/adjust.less +89 -0
  99. package/es/helper.js +118 -0
  100. package/es/history.js +5 -0
  101. package/es/index.js +27 -1
  102. package/es/style.less +20 -1
  103. package/es/variables.less +73 -73
  104. package/lib/Area/Area.js +194 -0
  105. package/lib/Area/package.json +6 -0
  106. package/lib/Card/Card.js +38 -0
  107. package/lib/Card/package.json +6 -0
  108. package/lib/Control/Control.js +477 -0
  109. package/lib/Control/event.js +68 -0
  110. package/lib/Control/package.json +6 -0
  111. package/lib/Enhance/Dialogs.js +87 -0
  112. package/lib/Enhance/Loading.js +175 -0
  113. package/lib/Enhance/index.js +35 -0
  114. package/lib/Enhance/package.json +6 -0
  115. package/lib/Header/Header.js +215 -0
  116. package/lib/Header/Header.less +95 -0
  117. package/lib/Header/Vertical.js +150 -0
  118. package/lib/Header/Vertical.less +60 -0
  119. package/lib/Header/package.json +6 -0
  120. package/lib/HomeHeader/Header.js +95 -0
  121. package/lib/HomeHeader/Header.less +73 -0
  122. package/lib/HomeHeader/package.json +6 -0
  123. package/lib/ImageView/ImageView.js +134 -0
  124. package/lib/ImageView/ImageView.less +14 -0
  125. package/lib/ImageView/package.json +6 -0
  126. package/lib/InpurCascader/InputCascader.js +156 -0
  127. package/lib/InpurCascader/package.json +6 -0
  128. package/lib/InputEditor/InputEditor.js +136 -0
  129. package/lib/InputEditor/inputEditor.less +8 -0
  130. package/lib/InputEditor/package.json +6 -0
  131. package/lib/InputSearch/InputSearch.js +322 -0
  132. package/lib/InputSearch/package.json +6 -0
  133. package/lib/InputSelect/InputSelect.js +208 -0
  134. package/lib/InputSelect/package.json +6 -0
  135. package/lib/InputWriting/InputWriting.js +123 -0
  136. package/lib/InputWriting/package.json +6 -0
  137. package/lib/Layout/Layout.js +258 -0
  138. package/lib/Layout/Layout.less +28 -0
  139. package/lib/Layout/package.json +6 -0
  140. package/lib/LayoutLink/LayoutLink.js +114 -0
  141. package/lib/LayoutLink/LayoutLink.less +53 -0
  142. package/lib/LayoutLink/package.json +6 -0
  143. package/lib/Link/Link.js +130 -0
  144. package/lib/Link/package.json +6 -0
  145. package/lib/Loading/Loading.js +30 -0
  146. package/lib/Loading/Loading.less +13 -0
  147. package/lib/Loading/package.json +6 -0
  148. package/lib/Loading2/Loading2.js +26 -0
  149. package/lib/Loading2/Loading2.less +19 -0
  150. package/lib/Loading2/package.json +6 -0
  151. package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
  152. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  153. package/lib/ModalWithDrag/drag.js +147 -0
  154. package/lib/ModalWithDrag/package.json +6 -0
  155. package/lib/NumberInput/NumberInput.js +259 -0
  156. package/lib/NumberInput/package.json +6 -0
  157. package/lib/Search/Search.js +603 -0
  158. package/lib/Search/Search.less +63 -0
  159. package/lib/Search/package.json +6 -0
  160. package/lib/Sidebar/Sidebar.js +186 -0
  161. package/lib/Sidebar/Sidebar.less +78 -0
  162. package/lib/Sidebar/package.json +6 -0
  163. package/lib/Sidebar2/Sidebar.js +213 -0
  164. package/lib/Sidebar2/Sidebar.less +153 -0
  165. package/lib/Sidebar2/package.json +6 -0
  166. package/lib/SuperForm/SuperForm.js +702 -0
  167. package/lib/SuperForm/SuperForm.less +52 -0
  168. package/lib/SuperForm/package.json +6 -0
  169. package/lib/SuperIcon/SuperIcon.js +47 -0
  170. package/lib/SuperIcon/package.json +6 -0
  171. package/lib/SuperPagination/SuperPagination.js +145 -0
  172. package/lib/SuperPagination/package.json +6 -0
  173. package/lib/SuperTable/DragSortRow.js +142 -0
  174. package/lib/SuperTable/DragSortRow.less +17 -0
  175. package/lib/SuperTable/FilterDropDown.js +205 -0
  176. package/lib/SuperTable/FilterDropDown.less +30 -0
  177. package/lib/SuperTable/SuperTable.js +937 -0
  178. package/lib/SuperTable/SuperTable.less +135 -0
  179. package/lib/SuperTable/fixed.js +55 -0
  180. package/lib/SuperTable/package.json +6 -0
  181. package/lib/SuperTable2/SuperTable2.js +725 -0
  182. package/lib/SuperTable2/SuperTable2.less +100 -0
  183. package/lib/SuperTable2/SuperTableCell.js +231 -0
  184. package/lib/SuperTable2/package.json +6 -0
  185. package/lib/SuperToolbar/SuperToolbar.js +248 -0
  186. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  187. package/lib/SuperToolbar/package.json +6 -0
  188. package/lib/SuperUpload/SuperUpload.js +324 -0
  189. package/lib/SuperUpload/SuperUpload.less +27 -0
  190. package/lib/SuperUpload/package.json +6 -0
  191. package/lib/Title/Title.less +35 -35
  192. package/lib/Title/package.json +6 -6
  193. package/lib/Viewer/ImageViews.js +323 -0
  194. package/lib/Viewer/Viewer.js +167 -0
  195. package/lib/Viewer/Viewer.less +67 -0
  196. package/lib/Viewer/imgView.less +59 -0
  197. package/lib/Viewer/package.json +7 -0
  198. package/lib/WingBlank/WingBlank.js +37 -0
  199. package/lib/WingBlank/WingBlank.less +12 -0
  200. package/lib/WingBlank/package.json +6 -0
  201. package/lib/adjust.less +89 -0
  202. package/lib/helper.js +147 -0
  203. package/lib/history.js +18 -0
  204. package/lib/index.js +235 -1
  205. package/lib/index.less +25 -1
  206. package/lib/style.less +20 -1
  207. package/lib/variables.less +73 -73
  208. package/package.json +3 -2
@@ -0,0 +1,165 @@
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 _Menu from "antd/es/menu";
10
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
11
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
12
+
13
+ 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); }; }
14
+
15
+ 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; } }
16
+
17
+ import React from 'react';
18
+ import PropTypes from 'prop-types';
19
+ import Link from '../Link';
20
+ import SuperIcon from '../SuperIcon';
21
+ import variables from '../variables';
22
+ var SubMenu = _Menu.SubMenu;
23
+ var MenuItem = _Menu.Item;
24
+ /** 侧边栏二级条目的类型
25
+ * key: 唯一标识一个条目
26
+ * title:条目的标题
27
+ * href: 为跳转页面的url
28
+ */
29
+
30
+ var ChildType = {
31
+ key: PropTypes.string.isRequired,
32
+ title: PropTypes.string.isRequired,
33
+ href: PropTypes.string.isRequired
34
+ };
35
+ /** 侧边栏一级条目的类型
36
+ * key: 唯一标识一个条目
37
+ * title:条目的标题
38
+ * icon:条目左边图标url,大小为20*20px
39
+ * isFolder:为true表明有下级菜单,此时href被忽略,children存放下级菜单的信息
40
+ * href: isFolder为false时,为跳转页面的url,否则被忽略
41
+ * children:isFolder为true时,存放下级菜单的信息,否则被忽略
42
+ */
43
+
44
+ var ItemType = {
45
+ key: PropTypes.string.isRequired,
46
+ title: PropTypes.string.isRequired,
47
+ icon: PropTypes.string,
48
+ isFolder: PropTypes.bool,
49
+ href: PropTypes.string,
50
+ children: PropTypes.arrayOf(PropTypes.shape(ChildType))
51
+ };
52
+ /**
53
+ * activeKey:指定被选中的一级条目的key,不能是二级条目的key
54
+ * items:存放所有侧边栏条目的信息
55
+ * style: 样式
56
+ */
57
+
58
+ var Sidebar = /*#__PURE__*/function (_React$Component) {
59
+ _inherits(Sidebar, _React$Component);
60
+
61
+ var _super = _createSuper(Sidebar);
62
+
63
+ function Sidebar() {
64
+ var _context;
65
+
66
+ var _this;
67
+
68
+ _classCallCheck(this, Sidebar);
69
+
70
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
71
+ args[_key] = arguments[_key];
72
+ }
73
+
74
+ _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
75
+
76
+ _defineProperty(_assertThisInitialized(_this), "onOpenChange", function (openKeys) {
77
+ var onOpenChange = _this.props.onOpenChange;
78
+
79
+ if (onOpenChange) {
80
+ onOpenChange(openKeys);
81
+ }
82
+ });
83
+
84
+ _defineProperty(_assertThisInitialized(_this), "toIcon", function (type) {
85
+ if (type) {
86
+ return /*#__PURE__*/React.createElement(SuperIcon, {
87
+ type: type,
88
+ style: {
89
+ fontSize: 16,
90
+ verticalAlign: -2
91
+ }
92
+ });
93
+ } else {
94
+ return null;
95
+ }
96
+ });
97
+
98
+ _defineProperty(_assertThisInitialized(_this), "toItem", function (_ref) {
99
+ var key = _ref.key,
100
+ title = _ref.title,
101
+ isFolder = _ref.isFolder,
102
+ children = _ref.children,
103
+ href = _ref.href,
104
+ icon = _ref.icon,
105
+ unreadTotal = _ref.unreadTotal;
106
+
107
+ if (isFolder) {
108
+ var t = /*#__PURE__*/React.createElement("div", null, _this.toIcon(icon), title);
109
+ return /*#__PURE__*/React.createElement(SubMenu, {
110
+ key: key,
111
+ title: t
112
+ }, _this.toItems(children));
113
+ } else {
114
+ return /*#__PURE__*/React.createElement(MenuItem, {
115
+ key: key
116
+ }, /*#__PURE__*/React.createElement(Link, {
117
+ to: href,
118
+ title: title,
119
+ className: variables('Sidebar').unreadTotalLink
120
+ }, _this.toIcon(icon), title, unreadTotal && unreadTotal > 0 && /*#__PURE__*/React.createElement("span", {
121
+ className: variables('Sidebar').unreadTotalLink.unreadTotal
122
+ }, unreadTotal)));
123
+ }
124
+ });
125
+
126
+ _defineProperty(_assertThisInitialized(_this), "toItems", function (items) {
127
+ return _mapInstanceProperty(items).call(items, _this.toItem);
128
+ });
129
+
130
+ _defineProperty(_assertThisInitialized(_this), "getProps", function () {
131
+ var _this$props = _this.props,
132
+ style = _this$props.style,
133
+ activeKey = _this$props.activeKey,
134
+ _this$props$openKeys = _this$props.openKeys,
135
+ openKeys = _this$props$openKeys === void 0 ? [] : _this$props$openKeys;
136
+ return {
137
+ style: style,
138
+ openKeys: openKeys,
139
+ selectedKeys: [activeKey],
140
+ mode: 'inline',
141
+ onOpenChange: _this.onOpenChange,
142
+ className: variables('Sidebar')
143
+ };
144
+ });
145
+
146
+ return _this;
147
+ }
148
+
149
+ _createClass(Sidebar, [{
150
+ key: "render",
151
+ value: function render() {
152
+ return /*#__PURE__*/React.createElement(_Menu, this.getProps(), this.toItems(this.props.items));
153
+ }
154
+ }]);
155
+
156
+ return Sidebar;
157
+ }(React.Component);
158
+
159
+ _defineProperty(Sidebar, "propTypes", {
160
+ activeKey: PropTypes.string.isRequired,
161
+ items: PropTypes.arrayOf(PropTypes.shape(ItemType)).isRequired,
162
+ style: PropTypes.object
163
+ });
164
+
165
+ export default Sidebar;
@@ -0,0 +1,78 @@
1
+ @import "../variables";
2
+
3
+ .@{cloudlink-prefix}-Sidebar {
4
+ background-color: #162C55;
5
+ color: white;
6
+ border: none !important;
7
+
8
+ > li > a {
9
+ color: white;
10
+
11
+ &:hover {
12
+ color: @primary-color;
13
+ }
14
+ }
15
+
16
+ :global(.ant-menu-item-selected) {
17
+ background-color: #3370FF !important;
18
+
19
+ > a:hover {
20
+ color: white;
21
+ }
22
+ }
23
+
24
+ :global(.ant-menu-submenu-title) {
25
+ &:active {
26
+ background-color: #162C55 !important;
27
+ }
28
+
29
+ &:hover {
30
+ > i {
31
+ &::before,
32
+ &::after {
33
+ background-color: @primary-color !important;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ :global(.ant-menu-submenu-arrow) {
40
+ &::before,
41
+ &::after {
42
+ background-image: none !important;
43
+ }
44
+ }
45
+
46
+ [role='menu'] {
47
+ background-color: #162C55;
48
+
49
+ > li > a {
50
+ color: white;
51
+
52
+ &:hover {
53
+ color: @primary-color;
54
+ }
55
+ }
56
+
57
+ :global(.ant-menu-item-selected) {
58
+ background-color: #3370FF;
59
+
60
+ > a:hover {
61
+ color: white;
62
+ }
63
+ }
64
+ }
65
+ .unreadTotalLink {
66
+ position: relative;
67
+
68
+ .unreadTotal{
69
+ color: orangered;
70
+ float: right;
71
+ position: absolute;
72
+ right: 5px;
73
+ }
74
+ }
75
+ }
76
+
77
+
78
+
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Sidebar",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Sidebar.js"
6
+ }
@@ -0,0 +1,192 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _Icon from "antd/es/icon";
3
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
4
+ import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
5
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
6
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
7
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
8
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
9
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
10
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
11
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
12
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
13
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
14
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
15
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
16
+
17
+ 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); }; }
18
+
19
+ 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; } }
20
+
21
+ import React from 'react';
22
+ import PropTypes from 'prop-types';
23
+ import Link from '../Link';
24
+ import variables from '../variables';
25
+ var ITEM_HEIGHT = 40;
26
+ /** 侧边栏二级条目的类型
27
+ * key: 唯一标识一个条目
28
+ * title:条目的标题
29
+ * href: 为跳转页面的url
30
+ */
31
+
32
+ var ChildType = {
33
+ key: PropTypes.string.isRequired,
34
+ title: PropTypes.string.isRequired,
35
+ href: PropTypes.string.isRequired
36
+ };
37
+ /** 侧边栏一级条目的类型
38
+ * key: 唯一标识一个条目
39
+ * title:条目的标题
40
+ * isFolder:为true表明有下级菜单,此时href被忽略,children存放下级菜单的信息
41
+ * href: isFolder为false时,为跳转页面的url,否则被忽略
42
+ * children:isFolder为true时,存放下级菜单的信息,否则被忽略
43
+ */
44
+
45
+ var ItemType = {
46
+ key: PropTypes.string.isRequired,
47
+ title: PropTypes.string.isRequired,
48
+ isFolder: PropTypes.bool,
49
+ href: PropTypes.string,
50
+ children: PropTypes.arrayOf(PropTypes.shape(ChildType))
51
+ };
52
+ /**
53
+ * title: 侧边栏的标题
54
+ * mode: 显示模式,默认为expand(展开)
55
+ * activeKey:指定被选中的一级条目的key,不能是二级条目的key
56
+ * items:存放所有侧边栏条目的信息
57
+ * openKeys: 展开条目的key
58
+ * style: 样式
59
+ * onOpenChange: 展开条目信息改变时触发,原型为func(openKeys)
60
+ * onModeChange: 模式改变时触发,原型为func(mode)
61
+ */
62
+
63
+ var Sidebar = /*#__PURE__*/function (_React$Component) {
64
+ _inherits(Sidebar, _React$Component);
65
+
66
+ var _super = _createSuper(Sidebar);
67
+
68
+ function Sidebar() {
69
+ var _context;
70
+
71
+ var _this;
72
+
73
+ _classCallCheck(this, Sidebar);
74
+
75
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
76
+ args[_key] = arguments[_key];
77
+ }
78
+
79
+ _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
80
+
81
+ _defineProperty(_assertThisInitialized(_this), "onModeChange", function () {
82
+ var mode = _this.props.mode || 'expand';
83
+
84
+ _this.props.onModeChange(mode === 'expand' ? 'collapse' : 'expand');
85
+ });
86
+
87
+ _defineProperty(_assertThisInitialized(_this), "isSelect", function (item) {
88
+ return _this.props.activeKey === item.key;
89
+ });
90
+
91
+ _defineProperty(_assertThisInitialized(_this), "isOpen", function (item) {
92
+ var _context2;
93
+
94
+ return _includesInstanceProperty(_context2 = _this.props.openKeys).call(_context2, item.key);
95
+ });
96
+
97
+ _defineProperty(_assertThisInitialized(_this), "getHeight", function (item) {
98
+ if (item.isFolder && _this.isOpen(item)) {
99
+ return (item.children.length + 1) * ITEM_HEIGHT;
100
+ } else {
101
+ return ITEM_HEIGHT;
102
+ }
103
+ });
104
+
105
+ _defineProperty(_assertThisInitialized(_this), "linkProps", function (item) {
106
+ if (item.isFolder) {
107
+ return {
108
+ title: item.title,
109
+ onClick: function onClick() {
110
+ if (_this.isOpen(item)) {
111
+ var _context3;
112
+
113
+ _this.props.onOpenChange(_filterInstanceProperty(_context3 = _this.props.openKeys).call(_context3, function (key) {
114
+ return item.key !== key;
115
+ }));
116
+ } else {
117
+ var _context4;
118
+
119
+ _this.props.onOpenChange(_concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(_this.props.openKeys), [item.key]));
120
+ }
121
+ }
122
+ };
123
+ } else {
124
+ return {
125
+ title: item.title,
126
+ to: item.href,
127
+ 'data-select': _this.isSelect(item)
128
+ };
129
+ }
130
+ });
131
+
132
+ _defineProperty(_assertThisInitialized(_this), "renderChild", function (item, index) {
133
+ return /*#__PURE__*/React.createElement("li", {
134
+ key: index
135
+ }, /*#__PURE__*/React.createElement(Link, _extends({}, _this.linkProps(item), {
136
+ "data-role": "child-item"
137
+ }), /*#__PURE__*/React.createElement("span", null, item.title), item.unreadTotal && item.unreadTotal > 0 && /*#__PURE__*/React.createElement("span", {
138
+ className: s.unreadTotal
139
+ }, item.unreadTotal)));
140
+ });
141
+
142
+ _defineProperty(_assertThisInitialized(_this), "renderItem", function (item, index) {
143
+ var _context5;
144
+
145
+ return /*#__PURE__*/React.createElement("li", {
146
+ key: index,
147
+ style: {
148
+ height: _this.getHeight(item)
149
+ }
150
+ }, /*#__PURE__*/React.createElement(Link, _extends({}, _this.linkProps(item), {
151
+ "data-role": "parent-item"
152
+ }), /*#__PURE__*/React.createElement("span", null, item.isFolder ? /*#__PURE__*/React.createElement(_Icon, {
153
+ type: "caret-right",
154
+ "data-open": _this.isOpen(item)
155
+ }) : null), /*#__PURE__*/React.createElement("span", null, item.title)), item.isFolder && _this.isOpen(item) ? /*#__PURE__*/React.createElement("ul", null, _mapInstanceProperty(_context5 = item.children).call(_context5, _this.renderChild)) : null);
156
+ });
157
+
158
+ return _this;
159
+ }
160
+
161
+ _createClass(Sidebar, [{
162
+ key: "render",
163
+ value: function render() {
164
+ var _context6;
165
+
166
+ return /*#__PURE__*/React.createElement("div", {
167
+ className: variables('Sidebar2'),
168
+ "data-mode": this.props.mode || 'expand'
169
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, " "), /*#__PURE__*/React.createElement("span", null, this.props.title)), /*#__PURE__*/React.createElement("ul", null, _mapInstanceProperty(_context6 = this.props.items).call(_context6, this.renderItem)), !this.props.onModeChange ? null : /*#__PURE__*/React.createElement("div", {
170
+ "data-role": "shousuo",
171
+ onClick: this.onModeChange
172
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Icon, {
173
+ type: this.props.mode === 'expand' ? 'left' : 'right'
174
+ })))));
175
+ }
176
+ }]);
177
+
178
+ return Sidebar;
179
+ }(React.Component);
180
+
181
+ _defineProperty(Sidebar, "propTypes", {
182
+ title: PropTypes.string,
183
+ mode: PropTypes.oneOf(['collapse', 'expand']),
184
+ activeKey: PropTypes.string,
185
+ items: PropTypes.arrayOf(PropTypes.shape(ItemType)),
186
+ openKeys: PropTypes.array,
187
+ style: PropTypes.object,
188
+ onOpenChange: PropTypes.func,
189
+ onModeChange: PropTypes.func
190
+ });
191
+
192
+ export default Sidebar;
@@ -0,0 +1,153 @@
1
+ @import '../variables.less';
2
+
3
+ @arrow-width: 30px;
4
+ @item-height: 40px;
5
+ @shousuo-height: 52px;
6
+
7
+ .@{cloudlink-prefix}-Sidebar2 {
8
+ width: @sidebar-width;
9
+ height: inherit;
10
+ min-height: 101px;
11
+ background: #162C55;
12
+ position: relative;
13
+ transition: width 0.3s;
14
+ white-space: nowrap;
15
+
16
+ ::-webkit-scrollbar {
17
+ width: 6px;
18
+ height: 6px;
19
+ }
20
+
21
+ ::-webkit-scrollbar-thumb {
22
+ background-color: #3AA7F7;
23
+ border-radius: 6px;
24
+ }
25
+
26
+ &[data-mode='collapse'] {
27
+ width: 0;
28
+
29
+ > [data-role='shousuo'] {
30
+ transform-origin: 100% 50%;
31
+ transform: scaleX(-1);
32
+ }
33
+ }
34
+
35
+ > :first-child {
36
+ line-height: 60px;
37
+ border-bottom: 1px solid #999;
38
+ color: white;
39
+ font-size: 14px;
40
+ overflow: hidden;
41
+
42
+ > :first-child {
43
+ display: inline-block;
44
+ width: @arrow-width;
45
+ }
46
+ }
47
+
48
+ > ul {
49
+ padding-left: 0;
50
+ overflow-x: hidden;
51
+ overflow-y: auto;
52
+ height: ~'calc(100% - 61px)';
53
+
54
+ a {
55
+ color: white !important;
56
+ }
57
+
58
+ > li > ul {
59
+ padding-left: 0;
60
+ }
61
+ }
62
+
63
+ > [data-role='shousuo'] {
64
+ position: absolute;
65
+ z-index: 1;
66
+ top: ~'calc(50% - 25px)';
67
+ right: 0;
68
+ width: 20px;
69
+ height: @shousuo-height;
70
+ cursor: pointer;
71
+ overflow: hidden;
72
+
73
+ > div {
74
+ transform: translateX(5px);
75
+ transition: transform 0.1s;
76
+
77
+ &:hover {
78
+ transform: translateX(0);
79
+ }
80
+
81
+ > div {
82
+ line-height: @shousuo-height;
83
+ text-align: right;
84
+ font-size: 16px;
85
+ }
86
+
87
+ > i {
88
+ position: absolute;
89
+ z-index: -1;
90
+ top: 0;
91
+ height: @shousuo-height;
92
+ border-width: 10px 20px 10px 0;
93
+ border-color: transparent #dde7ff;
94
+ border-style: solid;
95
+ }
96
+ }
97
+ }
98
+
99
+ li {
100
+ line-height: @item-height;
101
+ overflow: hidden;
102
+ transition: height 0.3s;
103
+
104
+ > a {
105
+ display: block;
106
+ font-size: 12px;
107
+ transition: none;
108
+
109
+ &:hover {
110
+ color: @primary-color;
111
+ }
112
+
113
+ &[data-select='true'] {
114
+ background: @primary-color;
115
+ }
116
+ }
117
+ }
118
+
119
+ [data-role='parent-item'] {
120
+ > :first-child {
121
+ display: inline-block;
122
+ line-height: @item-height;
123
+ width: 30px;
124
+ text-align: center;
125
+
126
+ > * {
127
+ transition: transform 0.3s;
128
+ transform-origin: 50% 30%;
129
+
130
+ &[data-open='true'] {
131
+ transform: rotate(90deg);
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ [data-role='child-item'] {
138
+ padding-left: @arrow-width;
139
+
140
+ > :first-child::before {
141
+ display: inline-block;
142
+ content: '\2022';
143
+ margin-right: 2px;
144
+ }
145
+
146
+ .unreadTotal{
147
+ color: orangered;
148
+ float: right;
149
+ position: absolute;
150
+ right: 15px;
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Sidebar",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Sidebar.js"
6
+ }