cloud-b2b 1.1.27 → 1.1.28
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.
- package/es/Area/Area.js +16 -45
- package/es/Card/Card.js +3 -4
- package/es/CodeInput/CodeInput.js +30 -59
- package/es/Control/Control.js +47 -94
- package/es/Control/event.js +0 -14
- package/es/Enhance/Dialogs.js +0 -15
- package/es/Enhance/Loading.js +16 -36
- package/es/Enhance/index.js +0 -2
- package/es/Header/Header.js +3 -35
- package/es/Header/Vertical.js +1 -24
- package/es/ImageView/ImageView.js +5 -22
- package/es/Indent/Indent.js +3 -7
- package/es/InpurCascader/InputCascader.js +10 -36
- package/es/InputEditor/InputEditor.js +55 -55
- package/es/InputSearch/InputSearch.js +26 -71
- package/es/InputSelect/InputSelect.js +17 -48
- package/es/InputWriting/InputWriting.js +6 -28
- package/es/Layout/Layout.js +28 -59
- package/es/LayoutLink/LayoutLink.js +11 -20
- package/es/Link/Link.js +4 -27
- package/es/Loading/Loading.js +1 -3
- package/es/Loading2/Loading2.js +0 -2
- package/es/ModalWithDrag/ModalWithDrag.js +3 -8
- package/es/ModalWithDrag/drag.js +12 -29
- package/es/NumberInput/NumberInput.js +24 -63
- package/es/Search/Search.js +53 -149
- package/es/Sidebar/Sidebar.js +13 -34
- package/es/Sidebar2/Sidebar.js +3 -30
- package/es/SuperForm/SuperForm.js +27 -150
- package/es/SuperForm2/SuperForm.js +31 -165
- package/es/SuperIcon/SuperIcon.js +3 -6
- package/es/SuperPagination/SuperPagination.js +15 -32
- package/es/SuperTab/SuperTab.js +4 -27
- package/es/SuperTab2/SuperTab2.js +11 -33
- package/es/SuperTable/DragSortRow.js +6 -34
- package/es/SuperTable/FilterDropDown.js +10 -34
- package/es/SuperTable/SuperTable.js +91 -216
- package/es/SuperTable/fixed.js +1 -9
- package/es/SuperTable2/SuperTable2.js +95 -206
- package/es/SuperTable2/SuperTableCell.js +16 -55
- package/es/SuperTable3/FilterDropDown.js +10 -34
- package/es/SuperTable3/SuperTable.js +57 -175
- package/es/SuperTable3/fixed.js +1 -9
- package/es/SuperToolbar/SuperToolbar.js +21 -49
- package/es/SuperUpload/SuperUpload.js +73 -110
- package/es/Title/Title.js +12 -15
- package/es/Viewer/ImageViews.js +7 -60
- package/es/Viewer/Viewer.js +7 -34
- package/es/WingBlank/WingBlank.js +2 -6
- package/es/helper.js +7 -27
- package/es/history.js +3 -2
- package/lib/Area/Area.js +16 -64
- package/lib/Card/Card.js +3 -13
- package/lib/CodeInput/CodeInput.js +30 -77
- package/lib/Control/Control.js +47 -135
- package/lib/Control/event.js +0 -16
- package/lib/Enhance/Dialogs.js +0 -26
- package/lib/Enhance/Loading.js +16 -52
- package/lib/Enhance/index.js +0 -9
- package/lib/Header/Header.js +3 -48
- package/lib/Header/Vertical.js +1 -36
- package/lib/ImageView/ImageView.js +5 -30
- package/lib/Indent/Indent.js +3 -13
- package/lib/InpurCascader/InputCascader.js +11 -50
- package/lib/InputEditor/InputEditor.js +55 -64
- package/lib/InputSearch/InputSearch.js +26 -78
- package/lib/InputSelect/InputSelect.js +17 -62
- package/lib/InputWriting/InputWriting.js +6 -35
- package/lib/Layout/Layout.js +28 -76
- package/lib/LayoutLink/LayoutLink.js +11 -38
- package/lib/Link/Link.js +4 -40
- package/lib/Loading/Loading.js +1 -9
- package/lib/Loading2/Loading2.js +0 -8
- package/lib/ModalWithDrag/ModalWithDrag.js +3 -18
- package/lib/ModalWithDrag/drag.js +12 -34
- package/lib/NumberInput/NumberInput.js +24 -76
- package/lib/Search/Search.js +53 -157
- package/lib/Sidebar/Sidebar.js +13 -46
- package/lib/Sidebar2/Sidebar.js +3 -42
- package/lib/SuperForm/SuperForm.js +27 -149
- package/lib/SuperForm2/SuperForm.js +31 -160
- package/lib/SuperIcon/SuperIcon.js +3 -14
- package/lib/SuperPagination/SuperPagination.js +15 -42
- package/lib/SuperTab/SuperTab.js +4 -34
- package/lib/SuperTab2/SuperTab2.js +11 -48
- package/lib/SuperTable/DragSortRow.js +6 -42
- package/lib/SuperTable/FilterDropDown.js +10 -42
- package/lib/SuperTable/SuperTable.js +90 -210
- package/lib/SuperTable/fixed.js +1 -13
- package/lib/SuperTable2/SuperTable2.js +95 -222
- package/lib/SuperTable2/SuperTableCell.js +13 -62
- package/lib/SuperTable3/FilterDropDown.js +10 -42
- package/lib/SuperTable3/SuperTable.js +56 -169
- package/lib/SuperTable3/fixed.js +1 -13
- package/lib/SuperToolbar/SuperToolbar.js +20 -64
- package/lib/SuperUpload/SuperUpload.js +73 -140
- package/lib/Title/Title.js +12 -24
- package/lib/Viewer/ImageViews.js +7 -63
- package/lib/Viewer/Viewer.js +7 -43
- package/lib/WingBlank/WingBlank.js +2 -14
- package/lib/helper.js +6 -44
- package/lib/history.js +0 -5
- package/lib/index.js +0 -76
- package/lib/variables.js +0 -4
- package/package.json +1 -1
package/es/SuperTable3/fixed.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
|
-
|
|
3
2
|
var isFirefox = function isFirefox() {
|
|
4
3
|
var _context;
|
|
5
|
-
|
|
6
4
|
return _indexOfInstanceProperty(_context = navigator.userAgent).call(_context, 'Firefox') > 0;
|
|
7
5
|
};
|
|
8
|
-
|
|
9
6
|
var getComputedStyle = function getComputedStyle(element) {
|
|
10
7
|
return window.getComputedStyle ? window.getComputedStyle(element, null) : element.currentStyle;
|
|
11
8
|
};
|
|
12
|
-
|
|
13
9
|
var fixed = function fixed(container, header, maxHeight) {
|
|
14
10
|
var totalFooter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
15
11
|
container.style.overflowY = 'auto';
|
|
16
12
|
container.style.maxHeight = maxHeight;
|
|
17
|
-
|
|
18
13
|
if (isFirefox()) {
|
|
19
14
|
container.style.position = 'relative';
|
|
20
15
|
header.style.top = '0';
|
|
@@ -23,14 +18,12 @@ var fixed = function fixed(container, header, maxHeight) {
|
|
|
23
18
|
} else {
|
|
24
19
|
header.parentNode.appendChild(header);
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
var containerHeight = Number(getComputedStyle(container).height.replace('px', ''));
|
|
28
22
|
var translateHeight = containerHeight - 10 - container.scrollHeight;
|
|
29
23
|
var pageTotalElement = totalFooter.pageTotalElement,
|
|
30
|
-
|
|
24
|
+
searchTotalElement = totalFooter.searchTotalElement;
|
|
31
25
|
pageTotalElement && (pageTotalElement.style.transform = "translateY(".concat(translateHeight + container.scrollTop, "px)"));
|
|
32
26
|
searchTotalElement && (searchTotalElement.style.transform = "translateY(".concat(translateHeight + container.scrollTop, "px)"));
|
|
33
|
-
|
|
34
27
|
container.onscroll = function () {
|
|
35
28
|
if (container.scrollTop + containerHeight - 10 > container.scrollHeight) return;
|
|
36
29
|
!isFirefox() && (header.style.transform = "translateY(".concat(container.scrollTop, "px)"));
|
|
@@ -38,5 +31,4 @@ var fixed = function fixed(container, header, maxHeight) {
|
|
|
38
31
|
searchTotalElement && (searchTotalElement.style.transform = "translateY(".concat(translateHeight + container.scrollTop, "px)"));
|
|
39
32
|
};
|
|
40
33
|
};
|
|
41
|
-
|
|
42
34
|
export default fixed;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
1
|
import _Popconfirm from "antd/es/popconfirm";
|
|
3
2
|
import _Dropdown from "antd/es/dropdown";
|
|
4
3
|
import _Icon from "antd/es/icon";
|
|
@@ -18,11 +17,9 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
18
17
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
19
18
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
20
19
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
21
|
-
|
|
20
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
22
21
|
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); }; }
|
|
23
|
-
|
|
24
22
|
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; } }
|
|
25
|
-
|
|
26
23
|
import React from 'react';
|
|
27
24
|
import PropTypes from 'prop-types';
|
|
28
25
|
import variables from '../variables';
|
|
@@ -35,12 +32,12 @@ var clicktag = 0; //被点击标识
|
|
|
35
32
|
* title: 菜单项上的文字
|
|
36
33
|
* subMenu: [可选],菜单项子列表,包含key和title的对象数组,此时点击菜单项不触发事件,只有点击子列表项才会触发onSubClick事件
|
|
37
34
|
*/
|
|
38
|
-
|
|
39
35
|
var MenuType = {
|
|
40
36
|
key: PropTypes.string.isRequired,
|
|
41
37
|
title: PropTypes.string.isRequired,
|
|
42
38
|
subMenu: PropTypes.array
|
|
43
39
|
};
|
|
40
|
+
|
|
44
41
|
/**
|
|
45
42
|
* key: 用于标识按钮
|
|
46
43
|
* title: 按钮上的文字
|
|
@@ -50,7 +47,6 @@ var MenuType = {
|
|
|
50
47
|
* 菜单项如果是包含key、title、subMenu的对象,则点击此菜单项不触发事件,必须点击子列表项时才会触发onSubClick事件
|
|
51
48
|
* loading: 是否正在加载,与antd中Button的loading取值一样
|
|
52
49
|
*/
|
|
53
|
-
|
|
54
50
|
var ButtonType = {
|
|
55
51
|
key: PropTypes.string.isRequired,
|
|
56
52
|
title: PropTypes.string.isRequired,
|
|
@@ -59,52 +55,41 @@ var ButtonType = {
|
|
|
59
55
|
menu: PropTypes.arrayOf(PropTypes.shape(MenuType)),
|
|
60
56
|
loading: PropTypes.bool
|
|
61
57
|
};
|
|
62
|
-
|
|
63
58
|
var ButtonEx = function ButtonEx(_ref) {
|
|
64
59
|
var type = _ref.type,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
children = _ref.children,
|
|
61
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
68
62
|
props[type === 'primary-o' ? 'data-btn-type' : 'type'] = type;
|
|
69
63
|
return /*#__PURE__*/React.createElement(_Button, props, children);
|
|
70
64
|
};
|
|
65
|
+
|
|
71
66
|
/**
|
|
72
67
|
* onClick: 纯按钮点击时或按钮下拉项中无子菜单列表项点击触发,原型为function(key)
|
|
73
68
|
* onSubClick: 按钮为下拉时下拉项子列表项点击时触发,原型为function(key, subKey)
|
|
74
69
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
70
|
var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
78
71
|
_inherits(SuperToolbar, _React$Component);
|
|
79
|
-
|
|
80
72
|
var _super = _createSuper(SuperToolbar);
|
|
81
|
-
|
|
82
73
|
function SuperToolbar() {
|
|
83
74
|
var _context;
|
|
84
|
-
|
|
85
75
|
var _this;
|
|
86
|
-
|
|
87
76
|
_classCallCheck(this, SuperToolbar);
|
|
88
|
-
|
|
89
77
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
90
78
|
args[_key] = arguments[_key];
|
|
91
79
|
}
|
|
92
|
-
|
|
93
80
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
94
|
-
|
|
95
81
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
96
82
|
var _this$props = _this.props,
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
onClick = _this$props.onClick,
|
|
84
|
+
onSubClick = _this$props.onSubClick;
|
|
99
85
|
var key = _typeof(e) === 'object' ? e.key : e;
|
|
100
|
-
|
|
101
86
|
if (_typeof(e) === 'object' && e.keyPath.length === 2 && onSubClick) {
|
|
102
87
|
onSubClick(e.keyPath[1], e.keyPath[0]);
|
|
103
88
|
} else if (onClick) {
|
|
104
89
|
if (clicktag === 0) {
|
|
105
90
|
clicktag = 1;
|
|
106
|
-
onClick(key);
|
|
107
|
-
|
|
91
|
+
onClick(key);
|
|
92
|
+
//1秒过后可以再次点击
|
|
108
93
|
_setTimeout(function () {
|
|
109
94
|
clicktag = 0;
|
|
110
95
|
}, 1000);
|
|
@@ -113,32 +98,29 @@ var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
113
98
|
}
|
|
114
99
|
}
|
|
115
100
|
});
|
|
116
|
-
|
|
117
101
|
_defineProperty(_assertThisInitialized(_this), "toSubMenu", function (_ref2) {
|
|
118
102
|
var key = _ref2.key,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
103
|
+
title = _ref2.title,
|
|
104
|
+
_ref2$subMenu = _ref2.subMenu,
|
|
105
|
+
subMenu = _ref2$subMenu === void 0 ? [] : _ref2$subMenu;
|
|
122
106
|
return /*#__PURE__*/React.createElement(SubMenu, {
|
|
123
107
|
key: key,
|
|
124
108
|
title: title
|
|
125
109
|
}, _mapInstanceProperty(subMenu).call(subMenu, function (_ref3) {
|
|
126
110
|
var key = _ref3.key,
|
|
127
|
-
|
|
111
|
+
title = _ref3.title;
|
|
128
112
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
129
113
|
key: key
|
|
130
114
|
}, title);
|
|
131
115
|
}));
|
|
132
116
|
});
|
|
133
|
-
|
|
134
117
|
_defineProperty(_assertThisInitialized(_this), "toMenu", function (menu) {
|
|
135
118
|
return /*#__PURE__*/React.createElement(_Menu, {
|
|
136
119
|
onClick: _this.onClick
|
|
137
120
|
}, _mapInstanceProperty(menu).call(menu, function (item) {
|
|
138
121
|
var key = item.key,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
title = item.title,
|
|
123
|
+
subMenu = item.subMenu;
|
|
142
124
|
if (subMenu) {
|
|
143
125
|
return _this.toSubMenu(item);
|
|
144
126
|
} else {
|
|
@@ -148,22 +130,17 @@ var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
148
130
|
}
|
|
149
131
|
}));
|
|
150
132
|
});
|
|
151
|
-
|
|
152
133
|
_defineProperty(_assertThisInitialized(_this), "toButton", function (_ref4) {
|
|
153
134
|
var _context2;
|
|
154
|
-
|
|
155
135
|
var key = _ref4.key,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
136
|
+
title = _ref4.title,
|
|
137
|
+
type = _ref4.bsStyle,
|
|
138
|
+
confirm = _ref4.confirm,
|
|
139
|
+
menu = _ref4.menu,
|
|
140
|
+
loading = _ref4.loading;
|
|
162
141
|
var onClick = _bindInstanceProperty(_context2 = _this.onClick).call(_context2, _assertThisInitialized(_this), key);
|
|
163
|
-
|
|
164
142
|
var _this$props$size = _this.props.size,
|
|
165
|
-
|
|
166
|
-
|
|
143
|
+
size = _this$props$size === void 0 ? 'small' : _this$props$size;
|
|
167
144
|
if (menu && menu.length) {
|
|
168
145
|
return /*#__PURE__*/React.createElement(_Dropdown, {
|
|
169
146
|
key: key,
|
|
@@ -195,10 +172,8 @@ var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
195
172
|
}, title));
|
|
196
173
|
}
|
|
197
174
|
});
|
|
198
|
-
|
|
199
175
|
return _this;
|
|
200
176
|
}
|
|
201
|
-
|
|
202
177
|
_createClass(SuperToolbar, [{
|
|
203
178
|
key: "render",
|
|
204
179
|
value: function render() {
|
|
@@ -209,15 +184,12 @@ var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
209
184
|
}, _mapInstanceProperty(buttons).call(buttons, this.toButton));
|
|
210
185
|
}
|
|
211
186
|
}]);
|
|
212
|
-
|
|
213
187
|
return SuperToolbar;
|
|
214
188
|
}(React.Component);
|
|
215
|
-
|
|
216
189
|
_defineProperty(SuperToolbar, "propTypes", {
|
|
217
190
|
buttons: PropTypes.arrayOf(PropTypes.shape(ButtonType)).isRequired,
|
|
218
191
|
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
219
192
|
onClick: PropTypes.func,
|
|
220
193
|
onSubClick: PropTypes.func
|
|
221
194
|
});
|
|
222
|
-
|
|
223
195
|
export default SuperToolbar;
|
|
@@ -5,11 +5,8 @@ import _Icon from "antd/es/icon";
|
|
|
5
5
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
6
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
8
|
-
|
|
9
8
|
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; }
|
|
10
|
-
|
|
11
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
10
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
14
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
12
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
@@ -26,8 +23,9 @@ import helper from '../helper';
|
|
|
26
23
|
import Title from '../Title';
|
|
27
24
|
import variables from '../variables';
|
|
28
25
|
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
|
|
29
|
-
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF'];
|
|
26
|
+
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF'];
|
|
30
27
|
|
|
28
|
+
//组件属性定义
|
|
31
29
|
var propTypes = {
|
|
32
30
|
fileList: PropTypes.array,
|
|
33
31
|
//文件列表
|
|
@@ -52,7 +50,6 @@ var propTypes = {
|
|
|
52
50
|
buttonTitle: PropTypes.string,
|
|
53
51
|
//上传按钮的标题,默认‘上传’
|
|
54
52
|
onFileChange: PropTypes.func //文件变更的回掉函数,func({fileList, fileDeleteList})
|
|
55
|
-
|
|
56
53
|
};
|
|
57
54
|
|
|
58
55
|
var convertFileList = function convertFileList(fileList) {
|
|
@@ -64,27 +61,23 @@ var convertFileList = function convertFileList(fileList) {
|
|
|
64
61
|
};
|
|
65
62
|
});
|
|
66
63
|
};
|
|
67
|
-
|
|
68
64
|
var getUploadProps = function getUploadProps(props, onPreview, fileList, setFileList) {
|
|
69
65
|
var _props$readonly = props.readonly,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
readonly = _props$readonly === void 0 ? false : _props$readonly,
|
|
67
|
+
_props$multiple = props.multiple,
|
|
68
|
+
multiple = _props$multiple === void 0 ? true : _props$multiple,
|
|
69
|
+
_props$limitSize = props.limitSize,
|
|
70
|
+
limitSize = _props$limitSize === void 0 ? 5 : _props$limitSize,
|
|
71
|
+
_props$listType = props.listType,
|
|
72
|
+
listType = _props$listType === void 0 ? 'picture-card' : _props$listType,
|
|
73
|
+
_props$fileDeleteList = props.fileDeleteList,
|
|
74
|
+
fileDeleteList = _props$fileDeleteList === void 0 ? [] : _props$fileDeleteList,
|
|
75
|
+
onFileChange = props.onFileChange;
|
|
81
76
|
var onChange = function onChange(_ref) {
|
|
82
77
|
var file = _ref.file,
|
|
83
|
-
|
|
78
|
+
fileList = _ref.fileList;
|
|
84
79
|
if (!file) return; //过滤掉不符合条件的响应
|
|
85
|
-
|
|
86
80
|
var newList = [];
|
|
87
|
-
|
|
88
81
|
if (file.response && file.response.returnCode !== 0) {
|
|
89
82
|
//检查是否上传到文件服务器成功
|
|
90
83
|
helper.showError("\u4E0A\u4F20\u5931\u8D25\uFF0C".concat(file.response.returnMsg || ''));
|
|
@@ -93,7 +86,6 @@ var getUploadProps = function getUploadProps(props, onPreview, fileList, setFile
|
|
|
93
86
|
});
|
|
94
87
|
} else {
|
|
95
88
|
var _context;
|
|
96
|
-
|
|
97
89
|
newList = _mapInstanceProperty(_context = _filterInstanceProperty(fileList).call(fileList, function (item) {
|
|
98
90
|
return item.status;
|
|
99
91
|
})).call(_context, function (item) {
|
|
@@ -102,35 +94,28 @@ var getUploadProps = function getUploadProps(props, onPreview, fileList, setFile
|
|
|
102
94
|
}) : item;
|
|
103
95
|
});
|
|
104
96
|
}
|
|
105
|
-
|
|
106
97
|
file.response && onFileChange && onFileChange({
|
|
107
98
|
fileList: convertFileList(newList),
|
|
108
99
|
fileDeleteList: fileDeleteList
|
|
109
100
|
});
|
|
110
101
|
setFileList(newList);
|
|
111
102
|
};
|
|
112
|
-
|
|
113
103
|
var onRemove = /*#__PURE__*/function () {
|
|
114
104
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileRemove) {
|
|
115
105
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
116
|
-
while (1) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
case "end":
|
|
123
|
-
return _context2.stop();
|
|
124
|
-
}
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
props.onRemove && props.onRemove(fileRemove, fileList, fileDeleteList, onFileChange);
|
|
109
|
+
case 1:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context2.stop();
|
|
125
112
|
}
|
|
126
113
|
}, _callee);
|
|
127
114
|
}));
|
|
128
|
-
|
|
129
115
|
return function onRemove(_x) {
|
|
130
116
|
return _ref2.apply(this, arguments);
|
|
131
117
|
};
|
|
132
118
|
}();
|
|
133
|
-
|
|
134
119
|
return {
|
|
135
120
|
action: props.action || '/api/proxy/zuul/archiver-service/file/upload/document',
|
|
136
121
|
fileList: fileList,
|
|
@@ -141,11 +126,9 @@ var getUploadProps = function getUploadProps(props, onPreview, fileList, setFile
|
|
|
141
126
|
onPreview: listType === 'text' ? undefined : onPreview,
|
|
142
127
|
beforeUpload: function beforeUpload(currentFile) {
|
|
143
128
|
var isLt = currentFile.size / 1024 / 1024 < limitSize; // 附件大小限制,单位M
|
|
144
|
-
|
|
145
129
|
if (!isLt) {
|
|
146
130
|
helper.showError("\u9644\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(limitSize, "M"));
|
|
147
131
|
}
|
|
148
|
-
|
|
149
132
|
return isLt;
|
|
150
133
|
},
|
|
151
134
|
showUploadList: {
|
|
@@ -155,26 +138,25 @@ var getUploadProps = function getUploadProps(props, onPreview, fileList, setFile
|
|
|
155
138
|
}
|
|
156
139
|
};
|
|
157
140
|
};
|
|
158
|
-
|
|
159
141
|
function UploadButton(_ref3) {
|
|
160
142
|
var _ref3$buttonLabel = _ref3.buttonLabel,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
143
|
+
buttonLabel = _ref3$buttonLabel === void 0 ? '上传' : _ref3$buttonLabel,
|
|
144
|
+
_ref3$title = _ref3.title,
|
|
145
|
+
title = _ref3$title === void 0 ? '附件' : _ref3$title,
|
|
146
|
+
_ref3$required = _ref3.required,
|
|
147
|
+
required = _ref3$required === void 0 ? false : _ref3$required,
|
|
148
|
+
_ref3$fileList = _ref3.fileList,
|
|
149
|
+
fileList = _ref3$fileList === void 0 ? [] : _ref3$fileList,
|
|
150
|
+
_ref3$limitText = _ref3.limitText,
|
|
151
|
+
limitText = _ref3$limitText === void 0 ? true : _ref3$limitText,
|
|
152
|
+
_ref3$limitNumber = _ref3.limitNumber,
|
|
153
|
+
limitNumber = _ref3$limitNumber === void 0 ? 10 : _ref3$limitNumber,
|
|
154
|
+
_ref3$listType = _ref3.listType,
|
|
155
|
+
listType = _ref3$listType === void 0 ? 'picture-card' : _ref3$listType,
|
|
156
|
+
_ref3$needText = _ref3.needText,
|
|
157
|
+
needText = _ref3$needText === void 0 ? false : _ref3$needText,
|
|
158
|
+
_ref3$remark = _ref3.remark,
|
|
159
|
+
remark = _ref3$remark === void 0 ? '大小>=5M' : _ref3$remark;
|
|
178
160
|
var canUpload = fileList.length < limitNumber;
|
|
179
161
|
return canUpload ? listType === 'picture-card' ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Icon, {
|
|
180
162
|
type: "plus"
|
|
@@ -194,92 +176,74 @@ function UploadButton(_ref3) {
|
|
|
194
176
|
required: required
|
|
195
177
|
}, !limitText ? null : /*#__PURE__*/React.createElement("span", null, limitText === true ? "\u9644\u4EF6\u4E2A\u6570\u82E5\u5927\u4E8E".concat(limitNumber, "\u4E2A\u8BF7\u538B\u7F29\u540E\u4E0A\u4F20") : limitText));
|
|
196
178
|
}
|
|
197
|
-
|
|
198
179
|
function SuperUpload(props) {
|
|
199
180
|
var _useState = useState(true),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
181
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
182
|
+
loading = _useState2[0],
|
|
183
|
+
setLoading = _useState2[1];
|
|
204
184
|
var _useState3 = useState([]),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
185
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
186
|
+
fileList = _useState4[0],
|
|
187
|
+
setFileList = _useState4[1];
|
|
209
188
|
useEffect(function () {
|
|
210
189
|
function fetchImgData() {
|
|
211
190
|
return _fetchImgData.apply(this, arguments);
|
|
212
191
|
}
|
|
213
|
-
|
|
214
192
|
function _fetchImgData() {
|
|
215
193
|
_fetchImgData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
216
194
|
var initFileList;
|
|
217
195
|
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
218
|
-
while (1) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
_context3.next = 6;
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
_context3.next = 3;
|
|
227
|
-
return props.getFileList(props.fileList);
|
|
228
|
-
|
|
229
|
-
case 3:
|
|
230
|
-
_context3.t0 = _context3.sent;
|
|
231
|
-
_context3.next = 7;
|
|
196
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
if (!props.getFileList) {
|
|
199
|
+
_context3.next = 6;
|
|
232
200
|
break;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
201
|
+
}
|
|
202
|
+
_context3.next = 3;
|
|
203
|
+
return props.getFileList(props.fileList);
|
|
204
|
+
case 3:
|
|
205
|
+
_context3.t0 = _context3.sent;
|
|
206
|
+
_context3.next = 7;
|
|
207
|
+
break;
|
|
208
|
+
case 6:
|
|
209
|
+
_context3.t0 = [];
|
|
210
|
+
case 7:
|
|
211
|
+
initFileList = _context3.t0;
|
|
212
|
+
setFileList(initFileList);
|
|
213
|
+
setLoading(false);
|
|
214
|
+
case 10:
|
|
215
|
+
case "end":
|
|
216
|
+
return _context3.stop();
|
|
246
217
|
}
|
|
247
218
|
}, _callee2);
|
|
248
219
|
}));
|
|
249
220
|
return _fetchImgData.apply(this, arguments);
|
|
250
221
|
}
|
|
251
|
-
|
|
252
222
|
fetchImgData();
|
|
253
223
|
}, []);
|
|
254
|
-
|
|
255
224
|
var onPreview = /*#__PURE__*/function () {
|
|
256
225
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(file) {
|
|
257
226
|
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
258
|
-
while (1) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
case "end":
|
|
265
|
-
return _context4.stop();
|
|
266
|
-
}
|
|
227
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
228
|
+
case 0:
|
|
229
|
+
props.onPreview && props.onPreview(file, fileList);
|
|
230
|
+
case 1:
|
|
231
|
+
case "end":
|
|
232
|
+
return _context4.stop();
|
|
267
233
|
}
|
|
268
234
|
}, _callee3);
|
|
269
235
|
}));
|
|
270
|
-
|
|
271
236
|
return function onPreview(_x2) {
|
|
272
237
|
return _ref4.apply(this, arguments);
|
|
273
238
|
};
|
|
274
239
|
}();
|
|
275
|
-
|
|
276
240
|
var uploadProps = getUploadProps(props, onPreview, fileList, setFileList);
|
|
277
241
|
var _props$listType2 = props.listType,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
242
|
+
listType = _props$listType2 === void 0 ? 'picture-card' : _props$listType2,
|
|
243
|
+
_props$limitNumber = props.limitNumber,
|
|
244
|
+
limitNumber = _props$limitNumber === void 0 ? 10 : _props$limitNumber,
|
|
245
|
+
readonly = props.readonly,
|
|
246
|
+
title = props.title;
|
|
283
247
|
var className = listType === 'picture-card' && fileList.length < limitNumber ? variables('SuperUpload') : variables('SuperUpload2');
|
|
284
248
|
return loading ? /*#__PURE__*/React.createElement("div", null, "loading...") : /*#__PURE__*/React.createElement("div", {
|
|
285
249
|
className: className
|
|
@@ -290,5 +254,4 @@ function SuperUpload(props) {
|
|
|
290
254
|
fileList: fileList
|
|
291
255
|
}))), props.needText ? /*#__PURE__*/React.createElement("span", null, props.remark) : null);
|
|
292
256
|
}
|
|
293
|
-
|
|
294
257
|
export default SuperUpload;
|
package/es/Title/Title.js
CHANGED
|
@@ -5,22 +5,20 @@ var _excluded = ["title", "children", "className", "required", "fold", "isFold",
|
|
|
5
5
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import variables from '../variables';
|
|
8
|
-
|
|
9
8
|
function Title(_ref) {
|
|
10
9
|
var title = _ref.title,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
children = _ref.children,
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
_ref$required = _ref.required,
|
|
13
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
14
|
+
_ref$fold = _ref.fold,
|
|
15
|
+
fold = _ref$fold === void 0 ? false : _ref$fold,
|
|
16
|
+
_ref$isFold = _ref.isFold,
|
|
17
|
+
isFold = _ref$isFold === void 0 ? false : _ref$isFold,
|
|
18
|
+
_ref$noBorder = _ref.noBorder,
|
|
19
|
+
noBorder = _ref$noBorder === void 0 ? false : _ref$noBorder,
|
|
20
|
+
onFold = _ref.onFold,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
22
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
25
23
|
className: variables('title')
|
|
26
24
|
}, props), /*#__PURE__*/React.createElement("span", {
|
|
@@ -32,5 +30,4 @@ function Title(_ref) {
|
|
|
32
30
|
type: isFold ? 'down' : 'up'
|
|
33
31
|
}) : null), isFold ? null : children);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
export default Title;
|