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.
- package/es/Area/Area.js +166 -0
- package/es/Area/package.json +6 -0
- package/es/Card/Card.js +20 -0
- package/es/Card/package.json +6 -0
- package/es/Control/Control.js +428 -0
- package/es/Control/event.js +57 -0
- package/es/Control/package.json +6 -0
- package/es/Enhance/Dialogs.js +67 -0
- package/es/Enhance/Loading.js +151 -0
- package/es/Enhance/index.js +8 -0
- package/es/Enhance/package.json +6 -0
- package/es/Header/Header.js +194 -0
- package/es/Header/Header.less +95 -0
- package/es/Header/Vertical.js +129 -0
- package/es/Header/Vertical.less +60 -0
- package/es/Header/package.json +6 -0
- package/es/HomeHeader/Header.js +75 -0
- package/es/HomeHeader/Header.less +73 -0
- package/es/HomeHeader/package.json +6 -0
- package/es/ImageView/ImageView.js +117 -0
- package/es/ImageView/ImageView.less +14 -0
- package/es/ImageView/package.json +6 -0
- package/es/InpurCascader/InputCascader.js +135 -0
- package/es/InpurCascader/package.json +6 -0
- package/es/InputEditor/InputEditor.js +118 -0
- package/es/InputEditor/inputEditor.less +8 -0
- package/es/InputEditor/package.json +6 -0
- package/es/InputSearch/InputSearch.js +306 -0
- package/es/InputSearch/package.json +6 -0
- package/es/InputSelect/InputSelect.js +185 -0
- package/es/InputSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +107 -0
- package/es/InputWriting/package.json +6 -0
- package/es/Layout/Layout.js +232 -0
- package/es/Layout/Layout.less +28 -0
- package/es/Layout/package.json +6 -0
- package/es/LayoutLink/LayoutLink.js +82 -0
- package/es/LayoutLink/LayoutLink.less +53 -0
- package/es/LayoutLink/package.json +6 -0
- package/es/Link/Link.js +108 -0
- package/es/Link/package.json +6 -0
- package/es/Loading/Loading.js +15 -0
- package/es/Loading/Loading.less +13 -0
- package/es/Loading/package.json +6 -0
- package/es/Loading2/Loading2.js +11 -0
- package/es/Loading2/Loading2.less +19 -0
- package/es/Loading2/package.json +6 -0
- package/es/ModalWithDrag/ModalWithDrag.js +34 -0
- package/es/ModalWithDrag/ModalWithDrag.less +6 -0
- package/es/ModalWithDrag/drag.js +133 -0
- package/es/ModalWithDrag/package.json +6 -0
- package/es/NumberInput/NumberInput.js +237 -0
- package/es/NumberInput/package.json +6 -0
- package/es/Search/Search.js +581 -0
- package/es/Search/Search.less +63 -0
- package/es/Search/package.json +6 -0
- package/es/Sidebar/Sidebar.js +165 -0
- package/es/Sidebar/Sidebar.less +78 -0
- package/es/Sidebar/package.json +6 -0
- package/es/Sidebar2/Sidebar.js +192 -0
- package/es/Sidebar2/Sidebar.less +153 -0
- package/es/Sidebar2/package.json +6 -0
- package/es/SuperForm/SuperForm.js +688 -0
- package/es/SuperForm/SuperForm.less +52 -0
- package/es/SuperForm/package.json +6 -0
- package/es/SuperIcon/SuperIcon.js +30 -0
- package/es/SuperIcon/package.json +6 -0
- package/es/SuperPagination/SuperPagination.js +126 -0
- package/es/SuperPagination/package.json +6 -0
- package/es/SuperTable/DragSortRow.js +125 -0
- package/es/SuperTable/DragSortRow.less +17 -0
- package/es/SuperTable/FilterDropDown.js +188 -0
- package/es/SuperTable/FilterDropDown.less +30 -0
- package/es/SuperTable/SuperTable.js +933 -0
- package/es/SuperTable/SuperTable.less +135 -0
- package/es/SuperTable/fixed.js +42 -0
- package/es/SuperTable/package.json +6 -0
- package/es/SuperTable2/SuperTable2.js +700 -0
- package/es/SuperTable2/SuperTable2.less +100 -0
- package/es/SuperTable2/SuperTableCell.js +215 -0
- package/es/SuperTable2/package.json +6 -0
- package/es/SuperToolbar/SuperToolbar.js +223 -0
- package/es/SuperToolbar/SuperToolbar.less +17 -0
- package/es/SuperToolbar/package.json +6 -0
- package/es/SuperUpload/SuperUpload.js +282 -0
- package/es/SuperUpload/SuperUpload.less +27 -0
- package/es/SuperUpload/package.json +6 -0
- package/es/Title/Title.less +35 -35
- package/es/Title/package.json +6 -6
- package/es/Viewer/ImageViews.js +311 -0
- package/es/Viewer/Viewer.js +149 -0
- package/es/Viewer/Viewer.less +67 -0
- package/es/Viewer/imgView.less +59 -0
- package/es/Viewer/package.json +7 -0
- package/es/WingBlank/WingBlank.js +20 -0
- package/es/WingBlank/WingBlank.less +12 -0
- package/es/WingBlank/package.json +6 -0
- package/es/adjust.less +89 -0
- package/es/helper.js +118 -0
- package/es/history.js +5 -0
- package/es/index.js +27 -1
- package/es/style.less +20 -1
- package/es/variables.less +73 -73
- package/lib/Area/Area.js +194 -0
- package/lib/Area/package.json +6 -0
- package/lib/Card/Card.js +38 -0
- package/lib/Card/package.json +6 -0
- package/lib/Control/Control.js +477 -0
- package/lib/Control/event.js +68 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +87 -0
- package/lib/Enhance/Loading.js +175 -0
- package/lib/Enhance/index.js +35 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +215 -0
- package/lib/Header/Header.less +95 -0
- package/lib/Header/Vertical.js +150 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/HomeHeader/Header.js +95 -0
- package/lib/HomeHeader/Header.less +73 -0
- package/lib/HomeHeader/package.json +6 -0
- package/lib/ImageView/ImageView.js +134 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +156 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +136 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +322 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +208 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +123 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +258 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +114 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +130 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +30 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +26 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +147 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +259 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +603 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +186 -0
- package/lib/Sidebar/Sidebar.less +78 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +213 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +702 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +47 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +145 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperTable/DragSortRow.js +142 -0
- package/lib/SuperTable/DragSortRow.less +17 -0
- package/lib/SuperTable/FilterDropDown.js +205 -0
- package/lib/SuperTable/FilterDropDown.less +30 -0
- package/lib/SuperTable/SuperTable.js +937 -0
- package/lib/SuperTable/SuperTable.less +135 -0
- package/lib/SuperTable/fixed.js +55 -0
- package/lib/SuperTable/package.json +6 -0
- package/lib/SuperTable2/SuperTable2.js +725 -0
- package/lib/SuperTable2/SuperTable2.less +100 -0
- package/lib/SuperTable2/SuperTableCell.js +231 -0
- package/lib/SuperTable2/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +248 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +324 -0
- package/lib/SuperUpload/SuperUpload.less +27 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Title/Title.less +35 -35
- package/lib/Title/package.json +6 -6
- package/lib/Viewer/ImageViews.js +323 -0
- package/lib/Viewer/Viewer.js +167 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +37 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/adjust.less +89 -0
- package/lib/helper.js +147 -0
- package/lib/history.js +18 -0
- package/lib/index.js +235 -1
- package/lib/index.less +25 -1
- package/lib/style.less +20 -1
- package/lib/variables.less +73 -73
- package/package.json +3 -2
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
|
|
5
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
6
|
+
|
|
7
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
8
|
+
|
|
9
|
+
var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
10
|
+
|
|
11
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
12
|
+
|
|
13
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
14
|
+
|
|
15
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
16
|
+
|
|
17
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
18
|
+
|
|
19
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
20
|
+
|
|
21
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
22
|
+
|
|
23
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
24
|
+
|
|
25
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
exports["default"] = void 0;
|
|
30
|
+
|
|
31
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
32
|
+
|
|
33
|
+
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
34
|
+
|
|
35
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
36
|
+
|
|
37
|
+
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
38
|
+
|
|
39
|
+
var _icon = _interopRequireDefault(require("antd/lib/icon"));
|
|
40
|
+
|
|
41
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
42
|
+
|
|
43
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
44
|
+
|
|
45
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
46
|
+
|
|
47
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
48
|
+
|
|
49
|
+
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
50
|
+
|
|
51
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
52
|
+
|
|
53
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
54
|
+
|
|
55
|
+
var _helper = _interopRequireDefault(require("../helper"));
|
|
56
|
+
|
|
57
|
+
var _Title = _interopRequireDefault(require("../Title"));
|
|
58
|
+
|
|
59
|
+
var _variables = _interopRequireDefault(require("../variables"));
|
|
60
|
+
|
|
61
|
+
var _this = void 0;
|
|
62
|
+
|
|
63
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
64
|
+
|
|
65
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
66
|
+
|
|
67
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
68
|
+
|
|
69
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
70
|
+
|
|
71
|
+
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'];
|
|
72
|
+
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
|
|
73
|
+
|
|
74
|
+
var propTypes = {
|
|
75
|
+
fileList: _propTypes["default"].array,
|
|
76
|
+
//文件列表
|
|
77
|
+
fileDeleteList: _propTypes["default"].array,
|
|
78
|
+
//需要在页面关闭时删除的服务端文件
|
|
79
|
+
title: _propTypes["default"].string,
|
|
80
|
+
//附件组的标题
|
|
81
|
+
required: _propTypes["default"].bool,
|
|
82
|
+
//是否必须上传,默认false
|
|
83
|
+
listType: _propTypes["default"].oneOf[('text', 'picture', 'picture-card')],
|
|
84
|
+
//上传列表的内建样式,支持三种,默认text
|
|
85
|
+
readonly: _propTypes["default"].bool,
|
|
86
|
+
//所在页面是否只读,默认false
|
|
87
|
+
multiple: _propTypes["default"].bool,
|
|
88
|
+
//可否多选文件上传,默认true
|
|
89
|
+
limitNumber: _propTypes["default"].number,
|
|
90
|
+
//附件限制个数,默认10
|
|
91
|
+
limitText: _propTypes["default"].any,
|
|
92
|
+
//附件个数达到时的文本,或者设置为false则不显示,为true时显示默认文本,默认值true
|
|
93
|
+
limitSize: _propTypes["default"].number,
|
|
94
|
+
//单个附件限制大小,单位M,默认5
|
|
95
|
+
buttonTitle: _propTypes["default"].string,
|
|
96
|
+
//上传按钮的标题,默认‘上传’
|
|
97
|
+
onFileChange: _propTypes["default"].func //文件变更的回掉函数,func({fileList, fileDeleteList})
|
|
98
|
+
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
var convertFileList = function convertFileList(fileList) {
|
|
102
|
+
return (0, _map["default"])(fileList).call(fileList, function (item) {
|
|
103
|
+
return {
|
|
104
|
+
fileFormat: item.fileFormat || 'id',
|
|
105
|
+
fileName: item.name,
|
|
106
|
+
fileUrl: item.response ? item.response.result : ''
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var getUploadProps = function getUploadProps(props, onPreview, fileList, setFileList) {
|
|
112
|
+
var _props$readonly = props.readonly,
|
|
113
|
+
readonly = _props$readonly === void 0 ? false : _props$readonly,
|
|
114
|
+
_props$multiple = props.multiple,
|
|
115
|
+
multiple = _props$multiple === void 0 ? true : _props$multiple,
|
|
116
|
+
_props$limitSize = props.limitSize,
|
|
117
|
+
limitSize = _props$limitSize === void 0 ? 5 : _props$limitSize,
|
|
118
|
+
_props$listType = props.listType,
|
|
119
|
+
listType = _props$listType === void 0 ? 'picture-card' : _props$listType,
|
|
120
|
+
_props$fileDeleteList = props.fileDeleteList,
|
|
121
|
+
fileDeleteList = _props$fileDeleteList === void 0 ? [] : _props$fileDeleteList,
|
|
122
|
+
onFileChange = props.onFileChange;
|
|
123
|
+
|
|
124
|
+
var onChange = function onChange(_ref) {
|
|
125
|
+
var file = _ref.file,
|
|
126
|
+
fileList = _ref.fileList;
|
|
127
|
+
if (!file) return; //过滤掉不符合条件的响应
|
|
128
|
+
|
|
129
|
+
var newList = [];
|
|
130
|
+
|
|
131
|
+
if (file.response && file.response.returnCode !== 0) {
|
|
132
|
+
//检查是否上传到文件服务器成功
|
|
133
|
+
_helper["default"].showError("\u4E0A\u4F20\u5931\u8D25\uFF0C".concat(file.response.returnMsg || ''));
|
|
134
|
+
|
|
135
|
+
newList = (0, _filter["default"])(fileList).call(fileList, function (item) {
|
|
136
|
+
return item.uid !== file.uid;
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
var _context;
|
|
140
|
+
|
|
141
|
+
newList = (0, _map["default"])(_context = (0, _filter["default"])(fileList).call(fileList, function (item) {
|
|
142
|
+
return item.status;
|
|
143
|
+
})).call(_context, function (item) {
|
|
144
|
+
return (0, _indexOf["default"])(FORMATS).call(FORMATS, item.type) === -1 ? _objectSpread(_objectSpread({}, item), {}, {
|
|
145
|
+
thumbUrl: '/default.png'
|
|
146
|
+
}) : item;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
file.response && onFileChange && onFileChange({
|
|
151
|
+
fileList: convertFileList(newList),
|
|
152
|
+
fileDeleteList: fileDeleteList
|
|
153
|
+
});
|
|
154
|
+
setFileList(newList);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var onRemove = /*#__PURE__*/function () {
|
|
158
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(fileRemove) {
|
|
159
|
+
return _regenerator["default"].wrap(function _callee$(_context2) {
|
|
160
|
+
while (1) {
|
|
161
|
+
switch (_context2.prev = _context2.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context2.stop();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, _callee);
|
|
168
|
+
}));
|
|
169
|
+
|
|
170
|
+
return function onRemove(_x) {
|
|
171
|
+
return _ref2.apply(this, arguments);
|
|
172
|
+
};
|
|
173
|
+
}();
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
action: _this.props.action || '/api/proxy/zuul/ict-service/file/upload/document',
|
|
177
|
+
fileList: fileList,
|
|
178
|
+
listType: listType,
|
|
179
|
+
multiple: multiple,
|
|
180
|
+
onChange: onChange,
|
|
181
|
+
onRemove: onRemove,
|
|
182
|
+
onPreview: listType === 'text' ? undefined : onPreview,
|
|
183
|
+
beforeUpload: function beforeUpload(currentFile) {
|
|
184
|
+
var isLt = currentFile.size / 1024 / 1024 < limitSize; // 附件大小限制,单位M
|
|
185
|
+
|
|
186
|
+
if (!isLt) {
|
|
187
|
+
_helper["default"].showError("\u9644\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(limitSize, "M"));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return isLt;
|
|
191
|
+
},
|
|
192
|
+
showUploadList: {
|
|
193
|
+
showPreviewIcon: listType !== 'text',
|
|
194
|
+
showRemoveIcon: !readonly,
|
|
195
|
+
showDownloadIcon: true
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
function UploadButton(_ref3) {
|
|
201
|
+
var _ref3$buttonLabel = _ref3.buttonLabel,
|
|
202
|
+
buttonLabel = _ref3$buttonLabel === void 0 ? '上传' : _ref3$buttonLabel,
|
|
203
|
+
_ref3$title = _ref3.title,
|
|
204
|
+
title = _ref3$title === void 0 ? '附件' : _ref3$title,
|
|
205
|
+
_ref3$required = _ref3.required,
|
|
206
|
+
required = _ref3$required === void 0 ? false : _ref3$required,
|
|
207
|
+
_ref3$fileList = _ref3.fileList,
|
|
208
|
+
fileList = _ref3$fileList === void 0 ? [] : _ref3$fileList,
|
|
209
|
+
_ref3$limitText = _ref3.limitText,
|
|
210
|
+
limitText = _ref3$limitText === void 0 ? true : _ref3$limitText,
|
|
211
|
+
_ref3$limitNumber = _ref3.limitNumber,
|
|
212
|
+
limitNumber = _ref3$limitNumber === void 0 ? 10 : _ref3$limitNumber,
|
|
213
|
+
_ref3$listType = _ref3.listType,
|
|
214
|
+
listType = _ref3$listType === void 0 ? 'picture-card' : _ref3$listType;
|
|
215
|
+
var canUpload = fileList.length < limitNumber;
|
|
216
|
+
return canUpload ? listType === 'picture-card' ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
217
|
+
type: "plus"
|
|
218
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
219
|
+
className: "ant-upload-text"
|
|
220
|
+
}, "Upload")) : /*#__PURE__*/_react["default"].createElement(_Title["default"], {
|
|
221
|
+
title: title,
|
|
222
|
+
required: required
|
|
223
|
+
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
224
|
+
size: "small",
|
|
225
|
+
style: {
|
|
226
|
+
display: 'block',
|
|
227
|
+
margin: '8px'
|
|
228
|
+
}
|
|
229
|
+
}, buttonLabel)) : listType === 'picture-card' ? null : /*#__PURE__*/_react["default"].createElement(_Title["default"], {
|
|
230
|
+
title: title,
|
|
231
|
+
required: required
|
|
232
|
+
}, !limitText ? null : /*#__PURE__*/_react["default"].createElement("span", null, limitText === true ? "\u9644\u4EF6\u4E2A\u6570\u82E5\u5927\u4E8E".concat(limitNumber, "\u4E2A\u8BF7\u538B\u7F29\u540E\u4E0A\u4F20") : limitText));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function SuperUpload(props) {
|
|
236
|
+
var _this2 = this;
|
|
237
|
+
|
|
238
|
+
var _useState = (0, _react.useState)(true),
|
|
239
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
240
|
+
loading = _useState2[0],
|
|
241
|
+
setLoading = _useState2[1];
|
|
242
|
+
|
|
243
|
+
var _useState3 = (0, _react.useState)([]),
|
|
244
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
245
|
+
fileList = _useState4[0],
|
|
246
|
+
setFileList = _useState4[1];
|
|
247
|
+
|
|
248
|
+
var getFileList = this.props.getFileList;
|
|
249
|
+
(0, _react.useEffect)(function () {
|
|
250
|
+
function fetchImgData() {
|
|
251
|
+
return _fetchImgData.apply(this, arguments);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function _fetchImgData() {
|
|
255
|
+
_fetchImgData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
256
|
+
var initFileList;
|
|
257
|
+
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
258
|
+
while (1) {
|
|
259
|
+
switch (_context3.prev = _context3.next) {
|
|
260
|
+
case 0:
|
|
261
|
+
_context3.next = 2;
|
|
262
|
+
return getFileList(props.fileList);
|
|
263
|
+
|
|
264
|
+
case 2:
|
|
265
|
+
initFileList = _context3.sent;
|
|
266
|
+
setFileList(initFileList);
|
|
267
|
+
setLoading(false);
|
|
268
|
+
|
|
269
|
+
case 5:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context3.stop();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, _callee2);
|
|
275
|
+
}));
|
|
276
|
+
return _fetchImgData.apply(this, arguments);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
fetchImgData();
|
|
280
|
+
}, []);
|
|
281
|
+
|
|
282
|
+
var onPreview = /*#__PURE__*/function () {
|
|
283
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(file) {
|
|
284
|
+
var onPreview;
|
|
285
|
+
return _regenerator["default"].wrap(function _callee3$(_context4) {
|
|
286
|
+
while (1) {
|
|
287
|
+
switch (_context4.prev = _context4.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
onPreview = _this2.props.onPreview;
|
|
290
|
+
onPreview && onPreview(file);
|
|
291
|
+
|
|
292
|
+
case 2:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context4.stop();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, _callee3);
|
|
298
|
+
}));
|
|
299
|
+
|
|
300
|
+
return function onPreview(_x2) {
|
|
301
|
+
return _ref4.apply(this, arguments);
|
|
302
|
+
};
|
|
303
|
+
}();
|
|
304
|
+
|
|
305
|
+
var uploadProps = getUploadProps(props, onPreview, fileList, setFileList);
|
|
306
|
+
var _props$listType2 = props.listType,
|
|
307
|
+
listType = _props$listType2 === void 0 ? 'picture-card' : _props$listType2,
|
|
308
|
+
_props$limitNumber = props.limitNumber,
|
|
309
|
+
limitNumber = _props$limitNumber === void 0 ? 10 : _props$limitNumber,
|
|
310
|
+
readonly = props.readonly,
|
|
311
|
+
title = props.title;
|
|
312
|
+
var className = listType === 'picture-card' && fileList.length < limitNumber ? (0, _variables["default"])('SuperUpload') : (0, _variables["default"])('SuperUpload2');
|
|
313
|
+
return loading ? /*#__PURE__*/_react["default"].createElement("div", null, "loading...") : /*#__PURE__*/_react["default"].createElement("div", {
|
|
314
|
+
className: className
|
|
315
|
+
}, (listType === 'picture-card' || readonly) && title ? /*#__PURE__*/_react["default"].createElement(_Title["default"], {
|
|
316
|
+
title: props.title || '附件',
|
|
317
|
+
required: props.required
|
|
318
|
+
}) : null, /*#__PURE__*/_react["default"].createElement(_upload["default"], uploadProps, readonly ? null : /*#__PURE__*/_react["default"].createElement(UploadButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
319
|
+
fileList: fileList
|
|
320
|
+
}))));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var _default = SuperUpload;
|
|
324
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../variables.less';
|
|
2
|
+
|
|
3
|
+
.@{cloudlink-prefix}-SuperUpload{
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
|
|
6
|
+
:global(.ant-upload-list-item) {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
margin: 10px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:global(.ant-upload-select-picture-card) {
|
|
12
|
+
margin: 10px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.@{cloudlink-prefix}-SuperUpload2 {
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
|
|
19
|
+
:global(.ant-upload-list-item) {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
margin: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:global(.ant-upload-select-picture-card) {
|
|
25
|
+
display: block !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/lib/Title/Title.less
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
@import '../variables';
|
|
2
|
-
|
|
3
|
-
.@{cloudlink-prefix}-title {
|
|
4
|
-
> *:first-child {
|
|
5
|
-
display: inline-block;
|
|
6
|
-
color: @brand-primary;
|
|
7
|
-
line-height: 1.2;
|
|
8
|
-
|
|
9
|
-
&[data-border='true'] {
|
|
10
|
-
padding: 0 5px;
|
|
11
|
-
border-left: @brand-primary solid 3px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&[data-fold='true'] {
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
margin: 8px 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&[data-required='true'] {
|
|
20
|
-
&::after {
|
|
21
|
-
display: inline-block;
|
|
22
|
-
margin-left: 4px;
|
|
23
|
-
color: #f5222d;
|
|
24
|
-
font-size: 12px;
|
|
25
|
-
font-family: SimSun, sans-serif;
|
|
26
|
-
line-height: 1;
|
|
27
|
-
content: '*';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
> [role = 'toolbar'] {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
@import '../variables';
|
|
2
|
+
|
|
3
|
+
.@{cloudlink-prefix}-title {
|
|
4
|
+
> *:first-child {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
color: @brand-primary;
|
|
7
|
+
line-height: 1.2;
|
|
8
|
+
|
|
9
|
+
&[data-border='true'] {
|
|
10
|
+
padding: 0 5px;
|
|
11
|
+
border-left: @brand-primary solid 3px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&[data-fold='true'] {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
margin: 8px 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&[data-required='true'] {
|
|
20
|
+
&::after {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
margin-left: 4px;
|
|
23
|
+
color: #f5222d;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
font-family: SimSun, sans-serif;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
content: '*';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> [role = 'toolbar'] {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/lib/Title/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Title",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"main": "./Title.js"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "Title",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "./Title.js"
|
|
6
|
+
}
|