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,167 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
+
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+
7
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
8
+
9
+ _Object$defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+
13
+ exports["default"] = void 0;
14
+
15
+ var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
16
+
17
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
18
+
19
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
20
+
21
+ var _icon = _interopRequireDefault(require("antd/lib/icon"));
22
+
23
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
24
+
25
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
26
+
27
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
28
+
29
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
30
+
31
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
32
+
33
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
34
+
35
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
36
+
37
+ var _react = _interopRequireDefault(require("react"));
38
+
39
+ var _propTypes = _interopRequireDefault(require("prop-types"));
40
+
41
+ var _ImageViews = _interopRequireDefault(require("./ImageViews"));
42
+
43
+ var _variables = _interopRequireDefault(require("../variables"));
44
+
45
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
46
+
47
+ 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; } }
48
+
49
+ var Viewers = /*#__PURE__*/function (_React$Component) {
50
+ (0, _inherits2["default"])(Viewers, _React$Component);
51
+
52
+ var _super = _createSuper(Viewers);
53
+
54
+ function Viewers(props) {
55
+ var _this;
56
+
57
+ (0, _classCallCheck2["default"])(this, Viewers);
58
+ _this = _super.call(this, props);
59
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "componentWillUnmount", function () {
60
+ _this.timeout = null;
61
+ });
62
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeViewers", function () {
63
+ var _this$props = _this.props,
64
+ onCancel = _this$props.onCancel,
65
+ onClose = _this$props.onClose;
66
+ _this.containerRef.style['opacity'] = 0;
67
+ _this.timeout = (0, _setTimeout2["default"])(function () {
68
+ onCancel && onCancel(onClose);
69
+ }, 1000);
70
+ });
71
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_onLeft", function () {
72
+ var imageIndex = _this.state.imageIndex;
73
+ var images = _this.props.images;
74
+ var index = imageIndex - 1;
75
+
76
+ if (index < 0) {
77
+ index = images.length - 1;
78
+ }
79
+
80
+ _this.setState({
81
+ imageIndex: index
82
+ });
83
+ });
84
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_onRight", function () {
85
+ var imageIndex = _this.state.imageIndex;
86
+ var images = _this.props.images;
87
+ var index = imageIndex + 1;
88
+
89
+ if (index > images.length - 1) {
90
+ index = 0;
91
+ }
92
+
93
+ _this.setState({
94
+ imageIndex: index
95
+ });
96
+ });
97
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_onSelect", function (index) {
98
+ _this.setState({
99
+ imageIndex: index
100
+ });
101
+ });
102
+ _this.state = {
103
+ imageIndex: props.imageIndex
104
+ };
105
+ return _this;
106
+ } //修复Warning报错
107
+
108
+
109
+ (0, _createClass2["default"])(Viewers, [{
110
+ key: "render",
111
+ value: function render() {
112
+ var _this2 = this;
113
+
114
+ var _this$props2 = this.props,
115
+ visible = _this$props2.visible,
116
+ images = _this$props2.images,
117
+ titles = _this$props2.titles;
118
+ var imageIndex = this.state.imageIndex;
119
+ return /*#__PURE__*/_react["default"].createElement("div", null, visible ? /*#__PURE__*/_react["default"].createElement("div", {
120
+ className: (0, _variables["default"])('Viewers'),
121
+ ref: function ref(container) {
122
+ _this2.containerRef = container;
123
+ }
124
+ }, /*#__PURE__*/_react["default"].createElement("div", {
125
+ className: (0, _variables["default"])('Viewers').mask
126
+ }), /*#__PURE__*/_react["default"].createElement("div", {
127
+ className: (0, _variables["default"])('Viewers').title
128
+ }, (0, _map["default"])(titles).call(titles, function (item, index) {
129
+ var _context;
130
+
131
+ return /*#__PURE__*/_react["default"].createElement("div", {
132
+ key: index,
133
+ onClick: (0, _bind["default"])(_context = _this2._onSelect).call(_context, _this2, index),
134
+ className: index === imageIndex ? s.selectTitle : ''
135
+ }, item);
136
+ })), /*#__PURE__*/_react["default"].createElement(_ImageViews["default"], {
137
+ image: images[imageIndex],
138
+ onLeft: this._onLeft,
139
+ onRight: this._onRight
140
+ }), /*#__PURE__*/_react["default"].createElement("div", {
141
+ className: (0, _variables["default"])('Viewers').close,
142
+ onClick: function onClick() {
143
+ return _this2.closeViewers();
144
+ }
145
+ }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
146
+ type: "close"
147
+ }))) : null);
148
+ }
149
+ }]);
150
+ return Viewers;
151
+ }(_react["default"].Component);
152
+
153
+ (0, _defineProperty2["default"])(Viewers, "propTypes", {
154
+ /** viewer是否可见 */
155
+ visible: _propTypes["default"].bool.isRequired,
156
+
157
+ /** 点击关闭按钮的回调 */
158
+ onCancel: _propTypes["default"].func.isRequired,
159
+
160
+ /** 需要进行浏览的图片地址集合 */
161
+ images: _propTypes["default"].array.isRequired,
162
+
163
+ /** 需要进行浏览的图片名称集合 */
164
+ titles: _propTypes["default"].array.isRequired
165
+ });
166
+ var _default = Viewers;
167
+ exports["default"] = _default;
@@ -0,0 +1,67 @@
1
+ @import '../variables.less';
2
+
3
+ html, body {
4
+ width: 100vw;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .@{cloudlink-prefix}-Viewers {
9
+ font-size: 13px;
10
+ opacity: 1;
11
+ transition: opacity 1s;
12
+ position: fixed;
13
+ left: 0;
14
+ right: 0;
15
+ bottom: 0;
16
+ top: 0;
17
+ height: 100%;
18
+ width: 100%;
19
+ overflow: hidden;
20
+ z-index: 1001;
21
+ .mask {
22
+ position: absolute;
23
+ left: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ top: 0;
27
+ height: 100%;
28
+ width: 100%;
29
+ background: rgba(55, 55, 55, 0.9);
30
+ overflow: hidden;
31
+ }
32
+ .close{
33
+ position: fixed;
34
+ right: 0;
35
+ top: 0;
36
+ height: 60px;
37
+ width: 60px;
38
+ border-radius: 0 0 0 60px;
39
+ background: rgba(0,0,0,0.6);
40
+ z-index: 1050;
41
+ i{
42
+ position: absolute;
43
+ left: 30px;
44
+ top: 15px;
45
+ color: white;
46
+ font-size: 16px;
47
+ }
48
+ }
49
+ .title{
50
+ position: absolute;
51
+ top: 15px;
52
+ left: 15px;
53
+ z-index: 2000;
54
+
55
+ > div {
56
+ color: white;
57
+ font-weight: bold;
58
+ font-size: 24px;
59
+ cursor: pointer;
60
+ }
61
+
62
+ .selectTitle {
63
+ color: #4db5ff;
64
+ }
65
+ }
66
+ }
67
+
@@ -0,0 +1,59 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-ImageViews {
4
+ position: absolute;
5
+ left: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ top: 0;
9
+ overflow: hidden;
10
+ z-index: 1050;
11
+ img{
12
+ position: absolute;
13
+ left: 50%;
14
+ top: 50%;
15
+ transform: translate(-50%,-50%);
16
+ transform-origin: center center;
17
+ cursor: pointer;
18
+ }
19
+ .footer{
20
+ position: fixed;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 50px;
24
+ height: 52px;
25
+ z-index: 1100;
26
+ .toolBar{
27
+ display: flex;
28
+ height: 58px;
29
+ flex-direction: column;
30
+ align-items: center;
31
+ justify-content: space-around;
32
+ >span{
33
+ font-size: 18px;
34
+ opacity:0.8;
35
+ line-height: 15px;
36
+ color: #ccc;
37
+ }
38
+ >ul{
39
+ overflow: hidden;
40
+ display: flex;
41
+ flex-direction: row;
42
+ >li{
43
+ height: 36px;
44
+ width: 36px;
45
+ border-radius: 50%;
46
+ background: rgba(0, 0, 0, 1);
47
+ margin-left: 5px;
48
+ text-align: center;
49
+ line-height: 36px;
50
+ cursor: pointer;
51
+ i{
52
+ color: white;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "Viewer",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Viewer"
6
+ }
7
+
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports["default"] = void 0;
12
+
13
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
14
+
15
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
16
+
17
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
18
+
19
+ var _react = _interopRequireDefault(require("react"));
20
+
21
+ var _variables = _interopRequireDefault(require("../variables"));
22
+
23
+ var _excluded = ["className", "children"];
24
+
25
+ function WingBlank(_ref) {
26
+ var _context;
27
+
28
+ var className = _ref.className,
29
+ children = _ref.children,
30
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
31
+ return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
32
+ className: (0, _concat["default"])(_context = "".concat(className, " ")).call(_context, (0, _variables["default"])('DragTable'))
33
+ }, props), /*#__PURE__*/_react["default"].createElement("div", null, children));
34
+ }
35
+
36
+ var _default = WingBlank;
37
+ exports["default"] = _default;
@@ -0,0 +1,12 @@
1
+ @import '../variables';
2
+
3
+ .@{cloudlink-prefix}-WingBlank {
4
+ padding-left: @padding;
5
+ padding-right: @padding;
6
+
7
+ > * {
8
+ max-width: @max-width;
9
+ margin-left: auto;
10
+ margin-right: auto;
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "WingBlank",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./WingBlank.js"
6
+ }
package/lib/helper.js ADDED
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports.showSuccessMsg = exports.showError = exports.isEmpty2 = exports.isEmpty = exports.getUsername = exports.getPathValue = exports.getObjectExclude = exports["default"] = void 0;
12
+
13
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
14
+
15
+ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
16
+
17
+ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
18
+
19
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
20
+
21
+ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
22
+
23
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
24
+
25
+ var _message = _interopRequireDefault(require("antd/lib/message"));
26
+
27
+ /**
28
+ * 功能:从obj中取出不包含keys指定的属性,并组成一个新的子对象
29
+ */
30
+ var getObjectExclude = function getObjectExclude(obj, keys) {
31
+ var _context;
32
+
33
+ var inKeys = function inKeys(key) {
34
+ return (0, _some["default"])(keys).call(keys, function (k) {
35
+ return k === key;
36
+ });
37
+ };
38
+
39
+ return (0, _reduce["default"])(_context = (0, _keys["default"])(obj)).call(_context, function (newObj, key) {
40
+ !inKeys(key) && (newObj[key] = obj[key]);
41
+ return newObj;
42
+ }, {});
43
+ }; // 获取当前登录的用户名
44
+
45
+
46
+ exports.getObjectExclude = getObjectExclude;
47
+
48
+ var getUsername = function getUsername() {
49
+ var username = 'username=';
50
+ var cookie = document.cookie;
51
+ var begin = (0, _indexOf["default"])(cookie).call(cookie, username) + username.length;
52
+ var end = (0, _indexOf["default"])(cookie).call(cookie, ';', begin);
53
+ return unescape(cookie.substring(begin, end < 0 ? cookie.length : end));
54
+ };
55
+ /**
56
+ * 确保path为数组
57
+ */
58
+
59
+
60
+ exports.getUsername = getUsername;
61
+
62
+ var makeArray = function makeArray(path) {
63
+ if ((0, _isArray["default"])(path)) {
64
+ return path;
65
+ } else if (!path) {
66
+ return [];
67
+ } else {
68
+ return [path];
69
+ }
70
+ };
71
+ /**
72
+ * 功能:获取对象关键路径的值,不存在则返回undefined
73
+ * obj:对象
74
+ * path:字符串或字符串数组,指定关键路径
75
+ */
76
+
77
+
78
+ var getPathValue = function getPathValue(obj, path) {
79
+ if (!path) {
80
+ return undefined;
81
+ } else {
82
+ var _context2;
83
+
84
+ return (0, _reduce["default"])(_context2 = makeArray(path)).call(_context2, function (value, key) {
85
+ return (0, _typeof2["default"])(value) !== 'object' ? undefined : value[key];
86
+ }, obj);
87
+ }
88
+ };
89
+ /**
90
+ * 功能:判断一个值是否为空(null,undefined和''属于空)
91
+ */
92
+
93
+
94
+ exports.getPathValue = getPathValue;
95
+
96
+ var isEmpty = function isEmpty(value) {
97
+ var type = (0, _typeof2["default"])(value);
98
+
99
+ if (type === 'number' || type === 'boolean') {
100
+ return false;
101
+ } else {
102
+ return !value;
103
+ }
104
+ };
105
+ /**
106
+ * 功能:判断一个值是否为空(null,undefined,''和[]属于空)
107
+ */
108
+
109
+
110
+ exports.isEmpty = isEmpty;
111
+
112
+ var isEmpty2 = function isEmpty2(value) {
113
+ var type = (0, _typeof2["default"])(value);
114
+
115
+ if (type === 'number' || type === 'boolean') {
116
+ return false;
117
+ } else if ((0, _isArray["default"])(value)) {
118
+ return !value.length;
119
+ } else {
120
+ return !value;
121
+ }
122
+ };
123
+
124
+ exports.isEmpty2 = isEmpty2;
125
+
126
+ var showError = function showError(msg) {
127
+ _message["default"].error(msg);
128
+ };
129
+
130
+ exports.showError = showError;
131
+
132
+ var showSuccessMsg = function showSuccessMsg(msg) {
133
+ _message["default"].success(msg);
134
+ };
135
+
136
+ exports.showSuccessMsg = showSuccessMsg;
137
+ var helper = {
138
+ getObjectExclude: getObjectExclude,
139
+ getUsername: getUsername,
140
+ getPathValue: getPathValue,
141
+ isEmpty: isEmpty,
142
+ isEmpty2: isEmpty2,
143
+ showError: showError,
144
+ showSuccessMsg: showSuccessMsg
145
+ };
146
+ var _default = helper;
147
+ exports["default"] = _default;
package/lib/history.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports["default"] = void 0;
10
+
11
+ var _history = require("history");
12
+
13
+ // import createBrowserHistory from 'history/createBrowserHistory';
14
+ // Navigation manager, e.g. history.push('/home')
15
+ // https://github.com/mjackson/history
16
+ var _default = process.env.BROWSER && (0, _history.createBrowserHistory)();
17
+
18
+ exports["default"] = _default;