@pointcloud/pcloud-components 0.1.3 → 0.1.5
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/README.md +301 -23
- package/dist/esm/AdvancedFilter/FormFilter.d.ts +2 -2
- package/dist/esm/AdvancedFilter/FormFilter.js +43 -45
- package/dist/esm/AdvancedFilter/index.js +66 -75
- package/dist/esm/AdvancedFilter/interface.d.ts +1 -1
- package/dist/esm/AdvancedFilter/styles/index.less +146 -116
- package/dist/esm/ConfigProvider/index.d.ts +1 -1
- package/dist/esm/ConfigProvider/index.js +5 -3
- package/dist/esm/DCascader/index.d.ts +4 -8
- package/dist/esm/DCascader/index.js +59 -56
- package/dist/esm/DCascader/index.less +5 -1
- package/dist/esm/DForm/DItem/index.d.ts +5 -0
- package/dist/esm/DForm/DItem/index.js +33 -0
- package/dist/esm/DForm/DItem/itemType.d.ts +106 -0
- package/dist/esm/DForm/DItem/itemType.js +1 -0
- package/dist/esm/DForm/DItem/itemsRender.d.ts +39 -0
- package/dist/esm/DForm/DItem/itemsRender.js +193 -0
- package/dist/esm/DForm/helper.js +7 -7
- package/dist/esm/DForm/index.d.ts +1 -1
- package/dist/esm/DForm/index.js +18 -18
- package/dist/esm/DForm/index.less +32 -31
- package/dist/esm/DInput/index.js +6 -11
- package/dist/esm/DSelect/index.js +7 -18
- package/dist/esm/DTable/index.js +58 -64
- package/dist/esm/DTable/index.less +8 -0
- package/dist/esm/DTreeSelect/index.js +74 -67
- package/dist/esm/DTreeSelect/index.less +2 -0
- package/dist/esm/DUpload/helper.d.ts +105 -0
- package/dist/esm/DUpload/helper.js +261 -0
- package/dist/esm/DUpload/index.d.ts +55 -0
- package/dist/esm/DUpload/index.js +372 -0
- package/dist/esm/DUpload/index.less +19 -0
- package/dist/esm/ErrorBoundary/index.d.ts +2 -2
- package/dist/esm/ErrorBoundary/index.js +16 -12
- package/dist/esm/ErrorBoundary/index.less +1 -0
- package/dist/esm/LModal/index.d.ts +2 -2
- package/dist/esm/LModal/index.js +11 -13
- package/dist/esm/LModal/interface.d.ts +1 -1
- package/dist/esm/LModal/styles/index.less +27 -25
- package/dist/esm/LabelValue/index.d.ts +1 -1
- package/dist/esm/LabelValue/index.js +14 -12
- package/dist/esm/LabelValue/styles/index.less +4 -0
- package/dist/esm/Loading/interface.d.ts +4 -4
- package/dist/esm/Loading/loading.d.ts +2 -2
- package/dist/esm/Loading/loading.js +18 -16
- package/dist/esm/Loading/styles/index.less +3 -1
- package/dist/esm/NoData/index.d.ts +2 -2
- package/dist/esm/NoData/index.js +14 -13
- package/dist/esm/NoData/styles/index.less +4 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/umd/images/favicon.png +0 -0
- package/dist/umd/mock/dcascader/china_region_city.json +2962 -0
- package/dist/umd/mock/dcascader/china_region_county.json +9991 -0
- package/dist/umd/mock/dcascader/china_region_province.json +36 -0
- package/dist/umd/mock/dupload/other/ZJ-TZ-001_/346/212/244/345/233/275/345/272/231/346/210/217/345/217/260/345/216/206/345/217/262/345/273/272/347/255/221/346/241/243/346/241/210/350/241/250.pdf +0 -0
- package/dist/umd/mock/dupload/other//346/234/210/347/211/231/346/271/276 - /351/243/236/345/204/277/344/271/220/345/233/242.mp3 +0 -0
- package/dist/umd/mock/dupload/picture/110500-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110500.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110504.png +0 -0
- package/dist/umd/mock/dupload/picture/default.png +0 -0
- package/dist/umd/mock/dupload/picture//346/255/243/351/227/250/345/205/250/346/231/257.jpg +0 -0
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +91 -73
- package/dist/esm/DForm/DItem.d.ts +0 -26
- package/dist/esm/DForm/DItem.js +0 -31
- package/dist/esm/DForm/DItemsMap.d.ts +0 -32
- package/dist/esm/DForm/DItemsMap.js +0 -144
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
8
|
+
var _excluded = ["value", "thumbOption", "uploadButton", "itemClassName", "enablePreview", "className", "maxCount", "children", "itemRender", "customRequest", "onRemove", "onDownload", "onPreview", "onChange", "defaultFileList", "showUploadList", "fileList"];
|
|
9
|
+
/*
|
|
10
|
+
* @Author : wangfeihu
|
|
11
|
+
* @Date : 2023-06-16 09:37:07
|
|
12
|
+
* @LastEditors : wangfeihu
|
|
13
|
+
* @LastEditTime : 2023-06-30 16:32:19
|
|
14
|
+
* @Description : 基于antd的Upload组件
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { forwardRef, useEffect, useMemo, useRef, useState, useContext } from 'react';
|
|
18
|
+
import { Upload } from 'antd';
|
|
19
|
+
import helper from "./helper";
|
|
20
|
+
import { ConfigContext } from "../ConfigProvider";
|
|
21
|
+
import "./index.less";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
var defaultUploadButton = /*#__PURE__*/_jsxs("div", {
|
|
25
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
26
|
+
style: {
|
|
27
|
+
fontSize: 18
|
|
28
|
+
},
|
|
29
|
+
children: "+"
|
|
30
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
31
|
+
style: {
|
|
32
|
+
marginTop: 8
|
|
33
|
+
},
|
|
34
|
+
children: "\u4E0A\u4F20"
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
function downloadFn(file) {
|
|
38
|
+
if (file instanceof Blob) {
|
|
39
|
+
helper.downloadFile(file);
|
|
40
|
+
} else if (file !== null && file !== void 0 && file.url) {
|
|
41
|
+
var fileName = (file === null || file === void 0 ? void 0 : file.fileName) || (file === null || file === void 0 ? void 0 : file.name) || (file === null || file === void 0 ? void 0 : file.id) || (file === null || file === void 0 ? void 0 : file.uid);
|
|
42
|
+
helper.downloadFile(file.url, typeof fileName === 'number' ? String(fileName) : fileName);
|
|
43
|
+
} else {
|
|
44
|
+
if (file) throw new TypeError("\u8FD4\u56DE\u503C\u5FC5\u987B\u662FBlob\u6216Dupload\u5BF9\u8C61,\u4F46\u5374\u5F97\u5230\u4E00\u4E2A: ".concat(_typeof(file)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function previewFn(file) {
|
|
48
|
+
if (file instanceof Blob) {
|
|
49
|
+
helper.previewFile(file);
|
|
50
|
+
} else if (file !== null && file !== void 0 && file.url) {
|
|
51
|
+
helper.previewFile(file.url);
|
|
52
|
+
} else {
|
|
53
|
+
if (file) throw new TypeError("\u8FD4\u56DE\u503C\u5FC5\u987B\u662FBlob\u6216Dupload\u5BF9\u8C61,\u4F46\u5374\u5F97\u5230\u4E00\u4E2A: ".concat(_typeof(file)));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function downloadOrPreview(file, fn, execFn) {
|
|
57
|
+
if (typeof fn === 'function') {
|
|
58
|
+
var resultFile = fn(file);
|
|
59
|
+
if (resultFile && 'then' in resultFile && typeof resultFile.then === 'function') {
|
|
60
|
+
resultFile.then(function (_file) {
|
|
61
|
+
return execFn(_file);
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
execFn(resultFile);
|
|
65
|
+
}
|
|
66
|
+
// 默认的预览逻辑
|
|
67
|
+
} else {
|
|
68
|
+
execFn(file);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function InternalUpload(props, ref) {
|
|
72
|
+
var value = props.value,
|
|
73
|
+
thumbOption = props.thumbOption,
|
|
74
|
+
uploadButton = props.uploadButton,
|
|
75
|
+
_props$itemClassName = props.itemClassName,
|
|
76
|
+
itemClassName = _props$itemClassName === void 0 ? '' : _props$itemClassName,
|
|
77
|
+
enablePreview = props.enablePreview,
|
|
78
|
+
_props$className = props.className,
|
|
79
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
80
|
+
_props$maxCount = props.maxCount,
|
|
81
|
+
maxCount = _props$maxCount === void 0 ? 10 : _props$maxCount,
|
|
82
|
+
children = props.children,
|
|
83
|
+
itemRender = props.itemRender,
|
|
84
|
+
customRequest = props.customRequest,
|
|
85
|
+
onRemove = props.onRemove,
|
|
86
|
+
onDownload = props.onDownload,
|
|
87
|
+
onPreview = props.onPreview,
|
|
88
|
+
onChange = props.onChange,
|
|
89
|
+
defaultFileList = props.defaultFileList,
|
|
90
|
+
showUploadList = props.showUploadList,
|
|
91
|
+
_fileList = props.fileList,
|
|
92
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
93
|
+
var _useContext = useContext(ConfigContext),
|
|
94
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
95
|
+
var _useState = useState([]),
|
|
96
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
97
|
+
fileList = _useState2[0],
|
|
98
|
+
setFileList = _useState2[1];
|
|
99
|
+
|
|
100
|
+
// 缓存的文件列表
|
|
101
|
+
var listRef = useRef({
|
|
102
|
+
timer: null,
|
|
103
|
+
list: []
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// 缩略图相关选项
|
|
107
|
+
var _thumbOption = useMemo(function () {
|
|
108
|
+
return thumbOption === null ? thumbOption : helper.getThumbOption(thumbOption);
|
|
109
|
+
}, [thumbOption]);
|
|
110
|
+
function updateFileList(file, status) {
|
|
111
|
+
var needChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
112
|
+
var thumbUrl = arguments.length > 3 ? arguments[3] : undefined;
|
|
113
|
+
file.status = status;
|
|
114
|
+
file.thumbUrl = thumbUrl;
|
|
115
|
+
file.id = file.uid;
|
|
116
|
+
var list = _toConsumableArray(listRef.current.list);
|
|
117
|
+
setFileList(list);
|
|
118
|
+
if (onChange && needChange) {
|
|
119
|
+
onChange(list, {
|
|
120
|
+
file: file,
|
|
121
|
+
fileList: list
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var customRequestFun = /*#__PURE__*/function () {
|
|
126
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestOption) {
|
|
127
|
+
var file, _list, _thumbOption$filter, base64Url, _thumbOption$onError, _compress, _base64Url, _thumbOption$onError2;
|
|
128
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
129
|
+
while (1) switch (_context.prev = _context.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
file = requestOption.file; // 若超出最大限制则不上传
|
|
132
|
+
if (!(listRef.current.list.filter(function (item) {
|
|
133
|
+
return (item === null || item === void 0 ? void 0 : item.status) !== 'removed';
|
|
134
|
+
}).length >= maxCount)) {
|
|
135
|
+
_context.next = 3;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
return _context.abrupt("return");
|
|
139
|
+
case 3:
|
|
140
|
+
// 标记当前文件为新上传的
|
|
141
|
+
file.source = 'upload';
|
|
142
|
+
|
|
143
|
+
// 用户自定义的上传逻辑
|
|
144
|
+
if (!(typeof customRequest === 'function')) {
|
|
145
|
+
_context.next = 9;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
_list = customRequest(file, listRef.current.list, requestOption);
|
|
149
|
+
if (_list && 'then' in _list && typeof _list.then === 'function') {
|
|
150
|
+
_list.then(function (list) {
|
|
151
|
+
if (list) {
|
|
152
|
+
setFileList(_toConsumableArray(list));
|
|
153
|
+
listRef.current.list = _toConsumableArray(list);
|
|
154
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(list, {
|
|
155
|
+
file: file,
|
|
156
|
+
fileList: list
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
} else if (_list instanceof Array) {
|
|
161
|
+
if (_list) {
|
|
162
|
+
setFileList(_toConsumableArray(_list));
|
|
163
|
+
listRef.current.list = _toConsumableArray(_list);
|
|
164
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_list, {
|
|
165
|
+
file: file,
|
|
166
|
+
fileList: _list
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
_context.next = 42;
|
|
171
|
+
break;
|
|
172
|
+
case 9:
|
|
173
|
+
// 默认的上传逻辑
|
|
174
|
+
listRef.current.list.push(file);
|
|
175
|
+
if (!(_thumbOption && typeof _thumbOption.getThumbUrl === 'function')) {
|
|
176
|
+
_context.next = 25;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
updateFileList(file, 'uploading');
|
|
180
|
+
_context.prev = 12;
|
|
181
|
+
_context.next = 15;
|
|
182
|
+
return _thumbOption.getThumbUrl(file, _thumbOption);
|
|
183
|
+
case 15:
|
|
184
|
+
base64Url = _context.sent;
|
|
185
|
+
updateFileList(file, 'done', false, base64Url);
|
|
186
|
+
_context.next = 23;
|
|
187
|
+
break;
|
|
188
|
+
case 19:
|
|
189
|
+
_context.prev = 19;
|
|
190
|
+
_context.t0 = _context["catch"](12);
|
|
191
|
+
(_thumbOption$onError = _thumbOption.onError) === null || _thumbOption$onError === void 0 ? void 0 : _thumbOption$onError.call(_thumbOption, _context.t0);
|
|
192
|
+
updateFileList(file, 'done', false);
|
|
193
|
+
case 23:
|
|
194
|
+
_context.next = 42;
|
|
195
|
+
break;
|
|
196
|
+
case 25:
|
|
197
|
+
if (!(_thumbOption && (_thumbOption$filter = _thumbOption.filter) !== null && _thumbOption$filter !== void 0 && _thumbOption$filter.call(_thumbOption, file))) {
|
|
198
|
+
_context.next = 41;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
_compress = file.size > _thumbOption.size ? _thumbOption.compress : null;
|
|
202
|
+
updateFileList(file, 'uploading');
|
|
203
|
+
_context.prev = 28;
|
|
204
|
+
_context.next = 31;
|
|
205
|
+
return helper.imageToBase64(file, _compress);
|
|
206
|
+
case 31:
|
|
207
|
+
_base64Url = _context.sent;
|
|
208
|
+
updateFileList(file, 'done', false, _base64Url);
|
|
209
|
+
_context.next = 39;
|
|
210
|
+
break;
|
|
211
|
+
case 35:
|
|
212
|
+
_context.prev = 35;
|
|
213
|
+
_context.t1 = _context["catch"](28);
|
|
214
|
+
(_thumbOption$onError2 = _thumbOption.onError) === null || _thumbOption$onError2 === void 0 ? void 0 : _thumbOption$onError2.call(_thumbOption, _context.t1);
|
|
215
|
+
updateFileList(file, 'done', false);
|
|
216
|
+
case 39:
|
|
217
|
+
_context.next = 42;
|
|
218
|
+
break;
|
|
219
|
+
case 41:
|
|
220
|
+
updateFileList(file, 'done');
|
|
221
|
+
case 42:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context.stop();
|
|
224
|
+
}
|
|
225
|
+
}, _callee, null, [[12, 19], [28, 35]]);
|
|
226
|
+
}));
|
|
227
|
+
return function customRequestFun(_x) {
|
|
228
|
+
return _ref.apply(this, arguments);
|
|
229
|
+
};
|
|
230
|
+
}();
|
|
231
|
+
var onRemoveFun = function onRemoveFun(file) {
|
|
232
|
+
// 用户自定义的删除逻辑
|
|
233
|
+
if (typeof onRemove === 'function') {
|
|
234
|
+
var _list2 = onRemove(file, listRef.current.list);
|
|
235
|
+
if (_list2 && 'then' in _list2 && typeof _list2.then === 'function') {
|
|
236
|
+
_list2.then(function (list) {
|
|
237
|
+
if (list) {
|
|
238
|
+
setFileList(_toConsumableArray(list));
|
|
239
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(list, {
|
|
240
|
+
file: file,
|
|
241
|
+
fileList: list
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
} else if (_list2 instanceof Array) {
|
|
246
|
+
if (_list2) {
|
|
247
|
+
setFileList(_toConsumableArray(_list2));
|
|
248
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_list2, {
|
|
249
|
+
file: file,
|
|
250
|
+
fileList: _list2
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
// 默认的删除逻辑
|
|
256
|
+
if (file.source === 'upload') {
|
|
257
|
+
var index = listRef.current.list.findIndex(function (item) {
|
|
258
|
+
return item.uid === file.uid;
|
|
259
|
+
});
|
|
260
|
+
if (index >= 0) listRef.current.list.splice(index, 1);
|
|
261
|
+
} else {
|
|
262
|
+
file.status = 'removed';
|
|
263
|
+
}
|
|
264
|
+
var _list3 = _toConsumableArray(listRef.current.list);
|
|
265
|
+
setFileList(_list3);
|
|
266
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_list3, {
|
|
267
|
+
file: file,
|
|
268
|
+
fileList: _list3
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var _onDownload = function _onDownload(file) {
|
|
273
|
+
return downloadOrPreview(file, onDownload, downloadFn);
|
|
274
|
+
};
|
|
275
|
+
var _onPreview = function _onPreview(file) {
|
|
276
|
+
return downloadOrPreview(file, onPreview, previewFn);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// 拦截listItem的渲染,添加类名,强制修改预览图标的样式
|
|
280
|
+
var _itemRender = function _itemRender(originNode, file) {
|
|
281
|
+
// 给列表项添加类名,用以修改预览图标样式
|
|
282
|
+
var _enablePreview = typeof enablePreview === 'function' ? enablePreview(file) : enablePreview;
|
|
283
|
+
var _itemClassName = _enablePreview ? "".concat(originNode.props.className, " ").concat(itemClassName, " preview") : "".concat(originNode.props.className, " ").concat(itemClassName);
|
|
284
|
+
var _originNode = _objectSpread(_objectSpread({}, originNode), {}, {
|
|
285
|
+
props: _objectSpread(_objectSpread({}, originNode.props), {}, {
|
|
286
|
+
title: (file === null || file === void 0 ? void 0 : file.fileName) || (file === null || file === void 0 ? void 0 : file.name) || '',
|
|
287
|
+
className: _itemClassName
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// 解决下载、删除按钮在Form组件 disable状态下被禁用的问题
|
|
292
|
+
var action = helper.deepFindJsx(_originNode, function (item) {
|
|
293
|
+
var _item$props;
|
|
294
|
+
return ((_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.className) === 'ant-upload-list-item-actions' && item.type === 'span';
|
|
295
|
+
});
|
|
296
|
+
if (action) {
|
|
297
|
+
// 查找下载、删除图标,将其外层包裹的的Button组件删除掉
|
|
298
|
+
var actionChildren = action.props.children.map(function (item, index) {
|
|
299
|
+
if (index > 0) {
|
|
300
|
+
var _item$props2, _item$props3, _children2;
|
|
301
|
+
var _children = (item === null || item === void 0 ? void 0 : (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.children) || (item === null || item === void 0 ? void 0 : (_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.icon);
|
|
302
|
+
if ((_children2 = _children) !== null && _children2 !== void 0 && _children2.props) {
|
|
303
|
+
_children = _objectSpread(_objectSpread({}, _children), {}, {
|
|
304
|
+
key: index,
|
|
305
|
+
props: _objectSpread(_objectSpread({
|
|
306
|
+
title: item.props.title
|
|
307
|
+
}, _children.props), {}, {
|
|
308
|
+
onClick: function onClick(e) {
|
|
309
|
+
var _item$props$onClick, _item$props4;
|
|
310
|
+
return (_item$props$onClick = (_item$props4 = item.props).onClick) === null || _item$props$onClick === void 0 ? void 0 : _item$props$onClick.call(_item$props4, e);
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
return _children || item;
|
|
316
|
+
}
|
|
317
|
+
return item;
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// 替换修改后的action
|
|
321
|
+
var _children3 = _toConsumableArray(_originNode.props.children);
|
|
322
|
+
_children3[1] = _objectSpread(_objectSpread({}, _children3[1]), {}, {
|
|
323
|
+
props: _objectSpread(_objectSpread({}, _children3[1].props), {}, {
|
|
324
|
+
children: actionChildren
|
|
325
|
+
})
|
|
326
|
+
});
|
|
327
|
+
var _originNodeClone = _objectSpread(_objectSpread({}, _originNode), {}, {
|
|
328
|
+
props: _objectSpread(_objectSpread({}, _originNode.props), {}, {
|
|
329
|
+
children: _children3
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
return _originNodeClone;
|
|
333
|
+
}
|
|
334
|
+
return _originNode;
|
|
335
|
+
};
|
|
336
|
+
var _showUploadList = typeof showUploadList === 'boolean' ? showUploadList : _objectSpread(_objectSpread({}, showUploadList), {}, {
|
|
337
|
+
showPreviewIcon: true,
|
|
338
|
+
showDownloadIcon: true
|
|
339
|
+
});
|
|
340
|
+
var _finalFileList = listRef.current.list.filter(function (item) {
|
|
341
|
+
return item.status !== 'removed';
|
|
342
|
+
});
|
|
343
|
+
var _props = _objectSpread({
|
|
344
|
+
maxCount: maxCount,
|
|
345
|
+
action: undefined,
|
|
346
|
+
className: "".concat(getPrefixCls('upload'), " ").concat(className),
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
fileList: fileList,
|
|
349
|
+
itemRender: itemRender || _itemRender,
|
|
350
|
+
customRequest: customRequestFun,
|
|
351
|
+
onRemove: onRemoveFun,
|
|
352
|
+
onDownload: _onDownload,
|
|
353
|
+
onPreview: _onPreview,
|
|
354
|
+
showUploadList: _showUploadList
|
|
355
|
+
}, otherProps);
|
|
356
|
+
var _uploadButton = uploadButton === null ? null : uploadButton || children || defaultUploadButton;
|
|
357
|
+
useEffect(function () {
|
|
358
|
+
var list = helper.getUploadFile(_fileList || value || defaultFileList, maxCount);
|
|
359
|
+
listRef.current.list = list;
|
|
360
|
+
setFileList(list);
|
|
361
|
+
}, [_fileList, value, defaultFileList]);
|
|
362
|
+
return /*#__PURE__*/_jsx(Upload, _objectSpread(_objectSpread({
|
|
363
|
+
listType: "picture-card"
|
|
364
|
+
}, _props), {}, {
|
|
365
|
+
fileList: _finalFileList,
|
|
366
|
+
ref: ref,
|
|
367
|
+
children: _finalFileList.length >= maxCount ? null : _uploadButton
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
var DUpload = /*#__PURE__*/forwardRef(InternalUpload);
|
|
371
|
+
DUpload.imageToBase64 = helper.imageToBase64;
|
|
372
|
+
export default DUpload;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-upload {
|
|
4
|
+
.preview .ant-upload-list-item-actions a[target='_blank'][rel='noopener noreferrer'] {
|
|
5
|
+
opacity: initial !important;
|
|
6
|
+
pointer-events: initial !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ant-upload-list.ant-upload-list-picture-card .ant-upload-span {
|
|
10
|
+
.ant-upload-list-item-thumbnail {
|
|
11
|
+
height: 46px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ant-upload-list-item-name {
|
|
15
|
+
position: absolute;
|
|
16
|
+
display: initial;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
2
|
import * as React from 'react';
|
|
6
3
|
import classNames from 'classnames';
|
|
7
4
|
import "./index.less";
|
|
8
5
|
import { ConfigContext } from "../ConfigProvider";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
function ErrorBoundary(_ref) {
|
|
10
9
|
var err = _ref.err;
|
|
11
10
|
var _React$useContext = React.useContext(ConfigContext),
|
|
@@ -16,13 +15,18 @@ function ErrorBoundary(_ref) {
|
|
|
16
15
|
function refreshPage() {
|
|
17
16
|
window.location.reload();
|
|
18
17
|
}
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
className: wrapperClass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
19
|
+
className: wrapperClass,
|
|
20
|
+
children: [/*#__PURE__*/_jsx("h2", {
|
|
21
|
+
children: "\u62B1\u6B49,\u7CFB\u7EDF\u51FA\u73B0\u95EE\u9898."
|
|
22
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
23
|
+
className: "error-text",
|
|
24
|
+
children: err && JSON.stringify(err)
|
|
25
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
26
|
+
className: "error-refresh",
|
|
27
|
+
onClick: refreshPage,
|
|
28
|
+
children: "\u91CD\u65B0\u5237\u65B0\u6D4F\u89C8\u5668"
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
export default ErrorBoundary;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { LModalProps } from './interface';
|
|
3
3
|
import './styles/index.less';
|
|
4
|
-
declare function LModal(props: LModalProps):
|
|
4
|
+
declare function LModal(props: LModalProps): JSX.Element;
|
|
5
5
|
export default LModal;
|
package/dist/esm/LModal/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
var _excluded = ["children", "mode"];
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
4
|
import { ConfigContext } from "../ConfigProvider";
|
|
11
5
|
import { Modal } from 'antd';
|
|
12
6
|
import React, { useContext, useEffect, useMemo, useRef } from 'react';
|
|
13
7
|
import "./styles/index.less";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
9
|
function LModal(props) {
|
|
15
10
|
var children = props.children,
|
|
16
11
|
_props$mode = props.mode,
|
|
@@ -28,7 +23,7 @@ function LModal(props) {
|
|
|
28
23
|
}, otherProps);
|
|
29
24
|
}, [otherProps]);
|
|
30
25
|
useEffect(function () {
|
|
31
|
-
if (otherProps.
|
|
26
|
+
if (otherProps.open) {
|
|
32
27
|
document.body.style.overflow = 'hidden';
|
|
33
28
|
} else {
|
|
34
29
|
document.body.style.overflow = '';
|
|
@@ -36,7 +31,7 @@ function LModal(props) {
|
|
|
36
31
|
return function () {
|
|
37
32
|
document.body.style.overflow = '';
|
|
38
33
|
};
|
|
39
|
-
}, [otherProps.
|
|
34
|
+
}, [otherProps.open]);
|
|
40
35
|
useEffect(function () {
|
|
41
36
|
if (containerRef.current) {
|
|
42
37
|
if (mode === 'absolute') {
|
|
@@ -46,9 +41,12 @@ function LModal(props) {
|
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
43
|
}, [mode, containerRef.current]);
|
|
49
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/_jsx("div", {
|
|
50
45
|
ref: containerRef,
|
|
51
|
-
className: "".concat(getPrefixCls('modal-container'), " ").concat(getPrefixCls(mode === 'absolute' ? 'absolute-modal-container' : 'relative-modal-container'))
|
|
52
|
-
|
|
46
|
+
className: "".concat(getPrefixCls('modal-container'), " ").concat(getPrefixCls(mode === 'absolute' || mode === 'panel' ? 'absolute-modal-container' : 'relative-modal-container')),
|
|
47
|
+
children: /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({}, style), {}, {
|
|
48
|
+
children: children
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
52
|
export default LModal;
|
|
@@ -3,6 +3,6 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
declare type IModalProps = Omit<ModalProps, 'width' | 'className'>;
|
|
4
4
|
export interface LModalProps extends IModalProps {
|
|
5
5
|
children?: ReactNode | undefined;
|
|
6
|
-
mode?: 'absolute' | 'relative';
|
|
6
|
+
mode?: 'absolute' | 'relative' | 'panel';
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
@import '../../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
@import '../../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-modal-container {
|
|
4
|
+
.ant-modal-wrap {
|
|
5
|
+
.ant-modal {
|
|
6
|
+
max-width: unset;
|
|
7
|
+
height: 100%;
|
|
8
|
+
|
|
9
|
+
.ant-modal-content {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.@{prefix}-absolute-modal-container {
|
|
18
|
+
.ant-modal-wrap {
|
|
19
|
+
position: fixed;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.@{prefix}-relative-modal-container {
|
|
24
|
+
.ant-modal-wrap {
|
|
25
|
+
position: absolute;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LabelValueProps } from './interface';
|
|
3
3
|
import './styles/index.less';
|
|
4
|
-
declare function LabelValue({ label, value, emptyValue, className, noWrap, noColon }: LabelValueProps):
|
|
4
|
+
declare function LabelValue({ label, value, emptyValue, className, noWrap, noColon }: LabelValueProps): JSX.Element;
|
|
5
5
|
declare namespace LabelValue {
|
|
6
6
|
var defaultProps: {
|
|
7
7
|
className: string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
2
|
import React, { useContext } from 'react';
|
|
6
3
|
import classNames from 'classnames';
|
|
7
4
|
import { ConfigContext, defaultPrefixCls } from "../ConfigProvider";
|
|
8
5
|
import "./styles/index.less";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
function LabelValue(_ref) {
|
|
10
9
|
var label = _ref.label,
|
|
11
10
|
value = _ref.value,
|
|
@@ -18,14 +17,17 @@ function LabelValue(_ref) {
|
|
|
18
17
|
getPrefixCls = _useContext.getPrefixCls;
|
|
19
18
|
var classname = getPrefixCls('label-value');
|
|
20
19
|
var wrapperClass = classNames(_defineProperty({}, "".concat(prefixCls, "-label-value"), !!prefixCls), classname, className);
|
|
21
|
-
return /*#__PURE__*/
|
|
22
|
-
className: wrapperClass
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
21
|
+
className: wrapperClass,
|
|
22
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
23
|
+
className: "".concat(defaultPrefixCls, "-label"),
|
|
24
|
+
children: [label, noColon ? '' : ':']
|
|
25
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
26
|
+
title: value,
|
|
27
|
+
className: "".concat(noWrap ? "".concat(defaultPrefixCls, "-value no-wrap") : "".concat(defaultPrefixCls, "-value")),
|
|
28
|
+
children: value || emptyValue || '暂无'
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
29
31
|
}
|
|
30
32
|
LabelValue.defaultProps = {
|
|
31
33
|
className: '',
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
@import '../../commonStyle/index.less';
|
|
2
|
+
|
|
2
3
|
.@{prefix}-label-value {
|
|
3
4
|
display: inline-flex;
|
|
5
|
+
|
|
4
6
|
span {
|
|
5
7
|
&:first-child {
|
|
6
8
|
max-width: 120px;
|
|
7
9
|
padding-right: 4px;
|
|
8
10
|
white-space: nowrap;
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
&:last-child {
|
|
11
14
|
flex: 1;
|
|
15
|
+
|
|
12
16
|
&.no-wrap {
|
|
13
17
|
overflow: hidden;
|
|
14
18
|
white-space: nowrap;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { SpinProps } from 'antd';
|
|
1
2
|
import React, { ReactInstance } from 'react';
|
|
2
|
-
export interface LoadingInstanceProps {
|
|
3
|
+
export interface LoadingInstanceProps extends SpinProps {
|
|
3
4
|
/**
|
|
4
|
-
* @description
|
|
5
|
-
* @default
|
|
5
|
+
* @description 加载框容器
|
|
6
|
+
* @default body
|
|
6
7
|
*/
|
|
7
|
-
tip?: string;
|
|
8
8
|
container?: ReactInstance | undefined;
|
|
9
9
|
}
|
|
10
10
|
export interface LoadingProps {
|