@vtx/components 3.1.154 → 3.1.156
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 +19 -19
- package/lib/_util/filterSpecialCharacters.js +66 -55
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +1 -4
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getToken.js +8 -16
- package/lib/_util/getToken.js.map +1 -1
- package/lib/_util/getUrlParam.js +2 -9
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/isFunction.js +0 -1
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js +0 -1
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/useColSize.js +3 -13
- package/lib/_util/useColSize.js.map +1 -1
- package/lib/_util/useInterval.js +0 -3
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +26 -42
- package/lib/_util/useSet.js.map +1 -1
- package/lib/config.js +1 -2
- package/lib/config.js.map +1 -1
- package/lib/index.js +1 -30
- package/lib/index.js.map +1 -1
- package/lib/style/index.less +2 -2
- package/lib/style/themes/compact.less +1 -1
- package/lib/style/themes/dark.less +9 -9
- package/lib/style/themes/default.less +7 -7
- package/lib/style/themes/index.less +1 -1
- package/lib/style/themes/variable.less +5 -5
- package/lib/vtx-color-picker/index.js +13 -33
- package/lib/vtx-color-picker/index.js.map +1 -1
- package/lib/vtx-color-picker/style/css.js +0 -2
- package/lib/vtx-color-picker/style/css.js.map +1 -1
- package/lib/vtx-color-picker/style/index.js +0 -2
- package/lib/vtx-color-picker/style/index.js.map +1 -1
- package/lib/vtx-color-picker/style/index.less +12 -12
- package/lib/vtx-combogrid/Combogrid.js +54 -96
- package/lib/vtx-combogrid/Combogrid.js.map +1 -1
- package/lib/vtx-combogrid/index.js +40 -66
- package/lib/vtx-combogrid/index.js.map +1 -1
- package/lib/vtx-combogrid/style/css.js +0 -7
- package/lib/vtx-combogrid/style/css.js.map +1 -1
- package/lib/vtx-combogrid/style/index.js +0 -7
- package/lib/vtx-combogrid/style/index.js.map +1 -1
- package/lib/vtx-datagrid/Alert.js +6 -15
- package/lib/vtx-datagrid/Alert.js.map +1 -1
- package/lib/vtx-datagrid/CheckboxList.js +34 -71
- package/lib/vtx-datagrid/CheckboxList.js.map +1 -1
- package/lib/vtx-datagrid/ColumnSetting.js +57 -105
- package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
- package/lib/vtx-datagrid/ResizeableTitle.js +6 -18
- package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
- package/lib/vtx-datagrid/index.js +137 -217
- package/lib/vtx-datagrid/index.js.map +1 -1
- package/lib/vtx-datagrid/renderColumnButtons.js +15 -46
- package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
- package/lib/vtx-datagrid/style/css.js +0 -10
- package/lib/vtx-datagrid/style/css.js.map +1 -1
- package/lib/vtx-datagrid/style/index.js +0 -10
- package/lib/vtx-datagrid/style/index.js.map +1 -1
- package/lib/vtx-date-picker/QdatePicker.js +27 -58
- package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
- package/lib/vtx-date-picker/generatePicker.js +35 -77
- package/lib/vtx-date-picker/generatePicker.js.map +1 -1
- package/lib/vtx-date-picker/index.js +2 -8
- package/lib/vtx-date-picker/index.js.map +1 -1
- package/lib/vtx-date-picker/style/css.js +0 -1
- package/lib/vtx-date-picker/style/css.js.map +1 -1
- package/lib/vtx-date-picker/style/index.js +0 -1
- package/lib/vtx-date-picker/style/index.js.map +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-editor/index.js +12 -32
- package/lib/vtx-editor/index.js.map +1 -1
- package/lib/vtx-editor/style/css.js +0 -1
- package/lib/vtx-editor/style/css.js.map +1 -1
- package/lib/vtx-editor/style/index.js +0 -1
- package/lib/vtx-editor/style/index.js.map +1 -1
- package/lib/vtx-editor/style/index.less +8 -8
- package/lib/vtx-ellipsis-text/index.js +16 -29
- package/lib/vtx-ellipsis-text/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/css.js +0 -1
- package/lib/vtx-ellipsis-text/style/css.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.js +0 -1
- package/lib/vtx-ellipsis-text/style/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.less +13 -13
- package/lib/vtx-export/index.js +38 -73
- package/lib/vtx-export/index.js.map +1 -1
- package/lib/vtx-export/style/css.js +0 -5
- package/lib/vtx-export/style/css.js.map +1 -1
- package/lib/vtx-export/style/index.js +0 -5
- package/lib/vtx-export/style/index.js.map +1 -1
- package/lib/vtx-export/style/index.less +6 -6
- package/lib/vtx-export-async/ColumnsSelect.js +11 -23
- package/lib/vtx-export-async/ColumnsSelect.js.map +1 -1
- package/lib/vtx-export-async/History.js +73 -118
- package/lib/vtx-export-async/History.js.map +1 -1
- package/lib/vtx-export-async/index.js +71 -116
- package/lib/vtx-export-async/index.js.map +1 -1
- package/lib/vtx-export-async/style/css.js.map +1 -1
- package/lib/vtx-export-async/style/index.js.map +1 -1
- package/lib/vtx-export-async/util.js +9 -21
- package/lib/vtx-export-async/util.js.map +1 -1
- package/lib/vtx-form-layout/Card.js +16 -39
- package/lib/vtx-form-layout/Card.js.map +1 -1
- package/lib/vtx-form-layout/Divider.js +6 -12
- package/lib/vtx-form-layout/Divider.js.map +1 -1
- package/lib/vtx-form-layout/FormItem.js +19 -43
- package/lib/vtx-form-layout/FormItem.js.map +1 -1
- package/lib/vtx-form-layout/Pane.js +4 -10
- package/lib/vtx-form-layout/Pane.js.map +1 -1
- package/lib/vtx-form-layout/Row.js +2 -9
- package/lib/vtx-form-layout/Row.js.map +1 -1
- package/lib/vtx-form-layout/context.js +1 -4
- package/lib/vtx-form-layout/context.js.map +1 -1
- package/lib/vtx-form-layout/demo/Modal.less +43 -43
- package/lib/vtx-form-layout/index.js +10 -25
- package/lib/vtx-form-layout/index.js.map +1 -1
- package/lib/vtx-form-layout/style/css.js +0 -7
- package/lib/vtx-form-layout/style/css.js.map +1 -1
- package/lib/vtx-form-layout/style/index.js +0 -7
- package/lib/vtx-form-layout/style/index.js.map +1 -1
- package/lib/vtx-form-layout/style/index.less +220 -220
- package/lib/vtx-image/Image.js +76 -117
- package/lib/vtx-image/Image.js.map +1 -1
- package/lib/vtx-image/Preview.js +33 -63
- package/lib/vtx-image/Preview.js.map +1 -1
- package/lib/vtx-image/PreviewGroup.js +23 -54
- package/lib/vtx-image/PreviewGroup.js.map +1 -1
- package/lib/vtx-image/index.js +3 -11
- package/lib/vtx-image/index.js.map +1 -1
- package/lib/vtx-image/style/css.js +0 -1
- package/lib/vtx-image/style/css.js.map +1 -1
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-image/style/index.js.map +1 -1
- package/lib/vtx-import/index.js +90 -143
- package/lib/vtx-import/index.js.map +1 -1
- package/lib/vtx-import/result.js +15 -33
- package/lib/vtx-import/result.js.map +1 -1
- package/lib/vtx-import/style/css.js +0 -3
- package/lib/vtx-import/style/css.js.map +1 -1
- package/lib/vtx-import/style/index.js +0 -3
- package/lib/vtx-import/style/index.js.map +1 -1
- package/lib/vtx-import/style/index.less +8 -8
- package/lib/vtx-import2/CheckResult.js +2 -9
- package/lib/vtx-import2/CheckResult.js.map +1 -1
- package/lib/vtx-import2/Content.js +20 -40
- package/lib/vtx-import2/Content.js.map +1 -1
- package/lib/vtx-import2/DownloadSvg.js +2 -7
- package/lib/vtx-import2/DownloadSvg.js.map +1 -1
- package/lib/vtx-import2/ImportResult.js +8 -15
- package/lib/vtx-import2/ImportResult.js.map +1 -1
- package/lib/vtx-import2/UploadSvg.js +2 -7
- package/lib/vtx-import2/UploadSvg.js.map +1 -1
- package/lib/vtx-import2/index.js +98 -181
- package/lib/vtx-import2/index.js.map +1 -1
- package/lib/vtx-import2/style/css.js +0 -3
- package/lib/vtx-import2/style/css.js.map +1 -1
- package/lib/vtx-import2/style/index.js +0 -3
- package/lib/vtx-import2/style/index.js.map +1 -1
- package/lib/vtx-import2/style/index.less +102 -102
- package/lib/vtx-input/TextArea.js +13 -31
- package/lib/vtx-input/TextArea.js.map +1 -1
- package/lib/vtx-input/index.js +23 -49
- package/lib/vtx-input/index.js.map +1 -1
- package/lib/vtx-input/style/css.js +0 -1
- package/lib/vtx-input/style/css.js.map +1 -1
- package/lib/vtx-input/style/index.js +0 -1
- package/lib/vtx-input/style/index.js.map +1 -1
- package/lib/vtx-input/style/index.less +24 -24
- package/lib/vtx-input/useLength.js +10 -23
- package/lib/vtx-input/useLength.js.map +1 -1
- package/lib/vtx-modal/Title.js +3 -9
- package/lib/vtx-modal/Title.js.map +1 -1
- package/lib/vtx-modal/index.js +51 -85
- package/lib/vtx-modal/index.js.map +1 -1
- package/lib/vtx-modal/style/css.js +0 -1
- package/lib/vtx-modal/style/css.js.map +1 -1
- package/lib/vtx-modal/style/index.js +0 -1
- package/lib/vtx-modal/style/index.js.map +1 -1
- package/lib/vtx-page-layout/Basic.js +6 -11
- package/lib/vtx-page-layout/Basic.js.map +1 -1
- package/lib/vtx-page-layout/Content.js +16 -27
- package/lib/vtx-page-layout/Content.js.map +1 -1
- package/lib/vtx-page-layout/Pane.js +4 -13
- package/lib/vtx-page-layout/Pane.js.map +1 -1
- package/lib/vtx-page-layout/TableLayout.js +33 -64
- package/lib/vtx-page-layout/TableLayout.js.map +1 -1
- package/lib/vtx-page-layout/TableWrap.js +12 -23
- package/lib/vtx-page-layout/TableWrap.js.map +1 -1
- package/lib/vtx-page-layout/container.js +32 -61
- package/lib/vtx-page-layout/container.js.map +1 -1
- package/lib/vtx-page-layout/index.js +2 -11
- package/lib/vtx-page-layout/index.js.map +1 -1
- package/lib/vtx-page-layout/style/css.js.map +1 -1
- package/lib/vtx-page-layout/style/index.js.map +1 -1
- package/lib/vtx-page-layout/style/index.less +138 -138
- package/lib/vtx-rps-frame/index.js +37 -58
- package/lib/vtx-rps-frame/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/css.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.less +8 -8
- package/lib/vtx-scrollable-row/index.js +33 -68
- package/lib/vtx-scrollable-row/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/css.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.less +113 -113
- package/lib/vtx-search/VtxCol.js +8 -27
- package/lib/vtx-search/VtxCol.js.map +1 -1
- package/lib/vtx-search/VtxRow.js +8 -15
- package/lib/vtx-search/VtxRow.js.map +1 -1
- package/lib/vtx-search/index.js +66 -112
- package/lib/vtx-search/index.js.map +1 -1
- package/lib/vtx-search/style/css.js +0 -4
- package/lib/vtx-search/style/css.js.map +1 -1
- package/lib/vtx-search/style/index.js +0 -4
- package/lib/vtx-search/style/index.js.map +1 -1
- package/lib/vtx-search-map-input/index.js +62 -98
- package/lib/vtx-search-map-input/index.js.map +1 -1
- package/lib/vtx-search-map-input/style/css.js +0 -2
- package/lib/vtx-search-map-input/style/css.js.map +1 -1
- package/lib/vtx-search-map-input/style/index.js +0 -2
- package/lib/vtx-search-map-input/style/index.js.map +1 -1
- package/lib/vtx-select/index.js +46 -99
- package/lib/vtx-select/index.js.map +1 -1
- package/lib/vtx-select/style/css.js +0 -8
- package/lib/vtx-select/style/css.js.map +1 -1
- package/lib/vtx-select/style/index.js +0 -8
- package/lib/vtx-select/style/index.js.map +1 -1
- package/lib/vtx-select/style/index.less +68 -68
- package/lib/vtx-signature/index.js +18 -34
- package/lib/vtx-signature/index.js.map +1 -1
- package/lib/vtx-signature/style/css.js +0 -2
- package/lib/vtx-signature/style/css.js.map +1 -1
- package/lib/vtx-signature/style/index.js +0 -2
- package/lib/vtx-signature/style/index.js.map +1 -1
- package/lib/vtx-signature/style/index.less +33 -33
- package/lib/vtx-split-pane/Pane.js +11 -23
- package/lib/vtx-split-pane/Pane.js.map +1 -1
- package/lib/vtx-split-pane/Resizer.js +20 -41
- package/lib/vtx-split-pane/Resizer.js.map +1 -1
- package/lib/vtx-split-pane/SplitPane.js +54 -111
- package/lib/vtx-split-pane/SplitPane.js.map +1 -1
- package/lib/vtx-split-pane/index.js +2 -7
- package/lib/vtx-split-pane/index.js.map +1 -1
- package/lib/vtx-split-pane/style/css.js +0 -3
- package/lib/vtx-split-pane/style/css.js.map +1 -1
- package/lib/vtx-split-pane/style/index.js +0 -3
- package/lib/vtx-split-pane/style/index.js.map +1 -1
- package/lib/vtx-split-pane/style/index.less +76 -76
- package/lib/vtx-statistics-column/Back.js +4 -11
- package/lib/vtx-statistics-column/Back.js.map +1 -1
- package/lib/vtx-statistics-column/Item.js +15 -32
- package/lib/vtx-statistics-column/Item.js.map +1 -1
- package/lib/vtx-statistics-column/Total.js +14 -31
- package/lib/vtx-statistics-column/Total.js.map +1 -1
- package/lib/vtx-statistics-column/context.js +1 -4
- package/lib/vtx-statistics-column/context.js.map +1 -1
- package/lib/vtx-statistics-column/index.js +2 -19
- package/lib/vtx-statistics-column/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/css.js +0 -1
- package/lib/vtx-statistics-column/style/css.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.js +0 -1
- package/lib/vtx-statistics-column/style/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.less +59 -59
- package/lib/vtx-time-picker/index.js +8 -22
- package/lib/vtx-time-picker/index.js.map +1 -1
- package/lib/vtx-time-picker/style/css.js.map +1 -1
- package/lib/vtx-time-picker/style/index.js.map +1 -1
- package/lib/vtx-tree/index.js +88 -156
- package/lib/vtx-tree/index.js.map +1 -1
- package/lib/vtx-tree/style/css.js +0 -2
- package/lib/vtx-tree/style/css.js.map +1 -1
- package/lib/vtx-tree/style/index.js +0 -2
- package/lib/vtx-tree/style/index.js.map +1 -1
- package/lib/vtx-tree/utils.js +10 -31
- package/lib/vtx-tree/utils.js.map +1 -1
- package/lib/vtx-tree-select/index.js +36 -81
- package/lib/vtx-tree-select/index.js.map +1 -1
- package/lib/vtx-tree-select/style/css.js +0 -4
- package/lib/vtx-tree-select/style/css.js.map +1 -1
- package/lib/vtx-tree-select/style/index.js +0 -4
- package/lib/vtx-tree-select/style/index.js.map +1 -1
- package/lib/vtx-upload/FilePreview.js +17 -35
- package/lib/vtx-upload/FilePreview.js.map +1 -1
- package/lib/vtx-upload/index.js +89 -167
- package/lib/vtx-upload/index.js.map +1 -1
- package/lib/vtx-upload/style/css.js +0 -6
- package/lib/vtx-upload/style/css.js.map +1 -1
- package/lib/vtx-upload/style/index.js +0 -6
- package/lib/vtx-upload/style/index.js.map +1 -1
- package/lib/vtx-upload/style/index.less +61 -61
- package/lib/vtx-wang-editor/index.js +84 -127
- package/lib/vtx-wang-editor/index.js.map +1 -1
- package/lib/vtx-wang-editor/style/css.js +0 -1
- package/lib/vtx-wang-editor/style/css.js.map +1 -1
- package/lib/vtx-wang-editor/style/index.js +0 -1
- package/lib/vtx-wang-editor/style/index.js.map +1 -1
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +78 -142
- package/lib/vtx-wang-editor/wangEditorUtil.js.map +1 -1
- package/lib/vtx-ztree/index.js +77 -138
- package/lib/vtx-ztree/index.js.map +1 -1
- package/lib/vtx-ztree/style/css.js +0 -1
- package/lib/vtx-ztree/style/css.js.map +1 -1
- package/lib/vtx-ztree/style/index.js +0 -1
- package/lib/vtx-ztree/style/index.js.map +1 -1
- package/lib/vtx-ztree/style/index.less +45 -45
- package/lib/vtx-ztree-select/index.js +91 -159
- package/lib/vtx-ztree-select/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/css.js +0 -3
- package/lib/vtx-ztree-select/style/css.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.js +0 -3
- package/lib/vtx-ztree-select/style/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.less +109 -109
- package/package.json +1 -1
package/lib/vtx-upload/index.js
CHANGED
|
@@ -1,86 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _useSetState3 = _interopRequireDefault(require("ahooks/es/useSetState"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _viewerjs = _interopRequireDefault(require("viewerjs"));
|
|
17
|
-
|
|
18
12
|
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
19
|
-
|
|
20
13
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
21
|
-
|
|
22
14
|
var _InboxOutlined = _interopRequireDefault(require("@ant-design/icons/InboxOutlined"));
|
|
23
|
-
|
|
24
15
|
var _PlusOutlined = _interopRequireDefault(require("@ant-design/icons/PlusOutlined"));
|
|
25
|
-
|
|
26
16
|
var _UploadOutlined = _interopRequireDefault(require("@ant-design/icons/UploadOutlined"));
|
|
27
|
-
|
|
28
17
|
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
29
|
-
|
|
30
18
|
var _downloadFile = _interopRequireDefault(require("@vtx/utils/lib/downloadFile"));
|
|
31
|
-
|
|
32
19
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
33
|
-
|
|
34
20
|
var _FilePreview = _interopRequireDefault(require("./FilePreview"));
|
|
35
|
-
|
|
36
21
|
var _getToken = _interopRequireDefault(require("../_util/getToken"));
|
|
37
|
-
|
|
38
22
|
var _antdImgCrop = _interopRequireDefault(require("antd-img-crop"));
|
|
39
|
-
|
|
40
23
|
var _excluded = ["isDragger", "draggerConfig", "accept", "mode", "viewMode", "showUploadList", "customizedButton", "listType", "onSuccess", "onError", "onRemove", "maxFileSize", "beforeUpload", "maxNum", "flag", "crop", "customDownload"];
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
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; }
|
|
47
|
-
|
|
48
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
49
|
-
|
|
50
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
51
|
-
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
27
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
52
28
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
63
|
-
|
|
64
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
65
|
-
|
|
29
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
30
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
31
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
32
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
33
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
34
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
35
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
36
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
66
37
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
75
|
-
|
|
76
|
-
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; }
|
|
77
|
-
|
|
78
|
-
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; }
|
|
79
|
-
|
|
38
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
39
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
40
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
41
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
42
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
43
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
80
44
|
var debouncedMessage = (0, _lodash["default"])(function (msg) {
|
|
81
45
|
_message["default"].error(msg);
|
|
82
|
-
}, 500);
|
|
46
|
+
}, 500);
|
|
83
47
|
|
|
48
|
+
//文件预览
|
|
84
49
|
var initVPrev = {
|
|
85
50
|
type: '',
|
|
86
51
|
//video or file
|
|
@@ -92,101 +57,88 @@ var initVPrev = {
|
|
|
92
57
|
var initUrl = {
|
|
93
58
|
action: '/cloudFile/common/uploadFile',
|
|
94
59
|
downloadUrl: '/cloudFile/common/downloadFile?id=',
|
|
95
|
-
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id='
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
|
|
60
|
+
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id='
|
|
61
|
+
//previewUrl: '/onlinePreview',
|
|
62
|
+
};
|
|
63
|
+
//禁止上传的文件类型
|
|
99
64
|
var rejectTypes = ['.asp', '.aspx', '.jsp', '.exe', '.cgi', '.asa', '.cer', '.cdx', '.hta'];
|
|
100
65
|
var Dragger = _upload["default"].Dragger;
|
|
101
66
|
var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
102
67
|
var _window;
|
|
103
|
-
|
|
104
68
|
var _props$isDragger = props.isDragger,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
69
|
+
isDragger = _props$isDragger === void 0 ? false : _props$isDragger,
|
|
70
|
+
_props$draggerConfig = props.draggerConfig,
|
|
71
|
+
draggerConfig = _props$draggerConfig === void 0 ? {} : _props$draggerConfig,
|
|
72
|
+
accept = props.accept,
|
|
73
|
+
_props$mode = props.mode,
|
|
74
|
+
mode = _props$mode === void 0 ? 'multiple' : _props$mode,
|
|
75
|
+
viewMode = props.viewMode,
|
|
76
|
+
showUploadList = props.showUploadList,
|
|
77
|
+
customizedButton = props.customizedButton,
|
|
78
|
+
_props$listType = props.listType,
|
|
79
|
+
listType = _props$listType === void 0 ? 'text' : _props$listType,
|
|
80
|
+
onSuccess = props.onSuccess,
|
|
81
|
+
onError = props.onError,
|
|
82
|
+
_onRemove = props.onRemove,
|
|
83
|
+
_props$maxFileSize = props.maxFileSize,
|
|
84
|
+
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
85
|
+
_beforeUpload = props.beforeUpload,
|
|
86
|
+
maxNum = props.maxNum,
|
|
87
|
+
flag = props.flag,
|
|
88
|
+
crop = props.crop,
|
|
89
|
+
customDownload = props.customDownload,
|
|
90
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
91
|
+
// 是否使用缩略图
|
|
129
92
|
var useThumbnail = (props.useThumbnail === undefined ? true : props.useThumbnail) && (listType == 'picture' || listType == 'picture-card');
|
|
130
|
-
|
|
131
93
|
var _useState = (0, _react.useState)([]),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
94
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
95
|
+
fileList = _useState2[0],
|
|
96
|
+
setFileList = _useState2[1]; //初始化文件列表
|
|
137
97
|
var _useState3 = (0, _react.useState)(null),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
98
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
99
|
+
imageViewer = _useState4[0],
|
|
100
|
+
setImageViewer = _useState4[1]; //图片预览
|
|
143
101
|
var _useState5 = (0, _react.useState)([]),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
102
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
103
|
+
imageList = _useState6[0],
|
|
104
|
+
setImageList = _useState6[1];
|
|
148
105
|
var _useState7 = (0, _react.useState)(null),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
106
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
107
|
+
imageCt = _useState8[0],
|
|
108
|
+
setImageCt = _useState8[1];
|
|
153
109
|
var _useSetState = (0, _useSetState3["default"])(initVPrev),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// 参数中拼接token
|
|
158
|
-
|
|
110
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
111
|
+
vPrev = _useSetState2[0],
|
|
112
|
+
setVPrev = _useSetState2[1]; //文件预览相关
|
|
159
113
|
|
|
114
|
+
// 参数中拼接token
|
|
160
115
|
function joinToken(str) {
|
|
161
116
|
if (str.indexOf('token=') === -1 && str.indexOf('?') > -1) {
|
|
162
117
|
return str.replace('?', "?token=".concat((0, _getToken["default"])() || '', "&"));
|
|
163
118
|
} else if (str.indexOf('?') === -1) {
|
|
164
119
|
return str + "?token=".concat((0, _getToken["default"])() || '');
|
|
165
120
|
}
|
|
166
|
-
|
|
167
121
|
return str;
|
|
168
122
|
}
|
|
169
|
-
|
|
170
123
|
var url = {
|
|
171
124
|
action: props.action || initUrl.action,
|
|
172
125
|
downloadUrl: joinToken(props.downloadUrl || initUrl.downloadUrl),
|
|
173
|
-
thumbnailUrl: joinToken((_window = window) !== null && _window !== void 0 && _window.flsPrefix ? "".concat(window.flsPrefix).concat(initUrl.thumbnailUrl) : "".concat(props.thumbnailUrl || initUrl.thumbnailUrl))
|
|
174
|
-
|
|
126
|
+
thumbnailUrl: joinToken((_window = window) !== null && _window !== void 0 && _window.flsPrefix ? "".concat(window.flsPrefix).concat(initUrl.thumbnailUrl) : "".concat(props.thumbnailUrl || initUrl.thumbnailUrl))
|
|
127
|
+
//previewUrl: props.previewUrl || initUrl.previewUrl,
|
|
175
128
|
};
|
|
176
129
|
var action = url.action,
|
|
177
|
-
|
|
178
|
-
|
|
130
|
+
downloadUrl = url.downloadUrl,
|
|
131
|
+
thumbnailUrl = url.thumbnailUrl;
|
|
179
132
|
(0, _react.useEffect)(function () {
|
|
180
133
|
setFileList(getSynFileList(props) || []);
|
|
181
134
|
}, [flag]);
|
|
182
135
|
(0, _react.useEffect)(function () {
|
|
183
136
|
if (Array.isArray(fileList)) {
|
|
184
137
|
// 只有图片的才可以预览,这边需要判断是否是图片
|
|
185
|
-
var imagelist = [];
|
|
186
|
-
|
|
138
|
+
var imagelist = [];
|
|
139
|
+
// 只能通过后缀来判断
|
|
187
140
|
fileList.map(function (file) {
|
|
188
141
|
var _file$type;
|
|
189
|
-
|
|
190
142
|
if (((_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf('image')) > -1) {
|
|
191
143
|
imagelist.push(file);
|
|
192
144
|
}
|
|
@@ -199,10 +151,8 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
199
151
|
setImageViewer(new _viewerjs["default"](imageCt, {}));
|
|
200
152
|
}
|
|
201
153
|
}, [imageCt]);
|
|
202
|
-
|
|
203
154
|
var getConfig = function getConfig() {
|
|
204
155
|
var token = (0, _getToken["default"])() || '';
|
|
205
|
-
|
|
206
156
|
var config = _objectSpread(_objectSpread({}, rest), {}, {
|
|
207
157
|
accept: accept,
|
|
208
158
|
action: action,
|
|
@@ -214,18 +164,14 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
214
164
|
}, rest.headers),
|
|
215
165
|
onChange: function onChange(info) {
|
|
216
166
|
setFileList(info.fileList);
|
|
217
|
-
|
|
218
167
|
if (info.file.response && info.file.response.result === 1) {
|
|
219
168
|
_message["default"].error(info.file.response.errMsg || '上传失败!');
|
|
220
|
-
|
|
221
169
|
var flt = _toConsumableArray(fileList);
|
|
222
|
-
|
|
223
170
|
flt.pop();
|
|
224
171
|
setFileList(flt);
|
|
225
172
|
return;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
173
|
+
}
|
|
174
|
+
// 此处根据后台返回的数据结构取得文件ID
|
|
229
175
|
if (info.file.status !== 'uploading' && info.file.status !== 'removed') {
|
|
230
176
|
var vtxId = info.file.response && Array.isArray(info.file.response.data) && info.file.response.data.length > 0 ? info.file.response.data[0].id : undefined;
|
|
231
177
|
var newFileList = info.fileList;
|
|
@@ -246,23 +192,21 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
246
192
|
thumbUrl: useThumbnail ? thumbnailUrl + vtxId : undefined
|
|
247
193
|
});
|
|
248
194
|
}
|
|
249
|
-
|
|
250
195
|
return item;
|
|
251
196
|
});
|
|
252
|
-
|
|
253
197
|
if (mode == 'single') {
|
|
254
198
|
setFileList([newFile]);
|
|
255
199
|
} else {
|
|
256
200
|
setFileList(newFileList);
|
|
257
|
-
}
|
|
201
|
+
}
|
|
202
|
+
// 更新组件状态
|
|
258
203
|
// if (mode == 'single' && info.file.status === 'done') {
|
|
259
204
|
// setFileList([newFile]);
|
|
260
205
|
// } else {
|
|
261
206
|
// setFileList(newFileList);
|
|
262
207
|
// }
|
|
263
|
-
// 触发外部方法
|
|
264
|
-
|
|
265
208
|
|
|
209
|
+
// 触发外部方法
|
|
266
210
|
if (info.file.status === 'done') {
|
|
267
211
|
if (typeof onSuccess == 'function') {
|
|
268
212
|
onSuccess(newFile);
|
|
@@ -283,38 +227,29 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
283
227
|
//限制文件大小
|
|
284
228
|
if (maxFileSize && typeof maxFileSize === 'number') {
|
|
285
229
|
var limit = file.size < maxFileSize;
|
|
286
|
-
|
|
287
230
|
if (!limit) {
|
|
288
231
|
_message["default"].error("\u8BF7\u4E0A\u4F20".concat(maxFileSize / 1024 / 1024, "M\u4EE5\u5185\u7684\u6587\u4EF6"));
|
|
289
|
-
|
|
290
232
|
return false;
|
|
291
233
|
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
234
|
+
}
|
|
235
|
+
//限制不允许上传的文件类型(通过文件名后缀)
|
|
295
236
|
var pointIndex = file.name ? file.name.lastIndexOf('.') : -1;
|
|
296
|
-
|
|
297
237
|
if (pointIndex > -1) {
|
|
298
238
|
var fileType = file.name.substring(pointIndex);
|
|
299
|
-
|
|
300
239
|
if (rejectTypes.includes(fileType)) {
|
|
301
240
|
_message["default"].error('不支持该文件类型');
|
|
302
|
-
|
|
303
241
|
return false;
|
|
304
242
|
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
243
|
+
}
|
|
244
|
+
// 多选限制文件数量
|
|
308
245
|
if (typeof maxNum === 'number' && afterFileList.length + fileList.length > maxNum) {
|
|
309
246
|
// 减少提示错误次数, 思路,防抖 这边有个问题 就是防抖的这个方法 return fasle 不上传
|
|
310
247
|
debouncedMessage("\u6700\u591A\u4E0A\u4F20".concat(maxNum, "\u4E2A"));
|
|
311
248
|
return false;
|
|
312
249
|
}
|
|
313
|
-
|
|
314
250
|
if (typeof _beforeUpload === 'function') {
|
|
315
251
|
return _beforeUpload(file, afterFileList);
|
|
316
252
|
}
|
|
317
|
-
|
|
318
253
|
return true;
|
|
319
254
|
},
|
|
320
255
|
onDownload: function onDownload(file) {
|
|
@@ -323,13 +258,11 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
323
258
|
}, 'blob');
|
|
324
259
|
}
|
|
325
260
|
});
|
|
326
|
-
|
|
327
261
|
if (props.onPreview && typeof props.onPreview === 'function') {
|
|
328
262
|
config.onPreview = props.onPreview;
|
|
329
263
|
} else {
|
|
330
264
|
config.onPreview = function (file) {
|
|
331
265
|
var _file$type2, _file$type3;
|
|
332
|
-
|
|
333
266
|
if (!file.type) {
|
|
334
267
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
335
268
|
fileName: file.name
|
|
@@ -350,7 +283,9 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
350
283
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
351
284
|
fileName: file.name
|
|
352
285
|
}, 'blob');
|
|
353
|
-
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// TODO 暂无好的文件预览服务,等后续完善,只提供下载
|
|
354
289
|
// else if (
|
|
355
290
|
// file.type == 'application/PDF' ||
|
|
356
291
|
// file.type == 'application/vnd.ms-excel' ||
|
|
@@ -368,6 +303,7 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
368
303
|
// '?id=' + file.id + '&fullfilename=' + file.name.replace(/\s*/g, ''),
|
|
369
304
|
// )}`;
|
|
370
305
|
// }
|
|
306
|
+
|
|
371
307
|
// setVPrev({
|
|
372
308
|
// type: 'file',
|
|
373
309
|
// name: file.name || '文件预览',
|
|
@@ -376,21 +312,18 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
376
312
|
// visible: true,
|
|
377
313
|
// });
|
|
378
314
|
// }
|
|
379
|
-
|
|
380
315
|
};
|
|
381
|
-
}
|
|
382
|
-
|
|
316
|
+
}
|
|
383
317
|
|
|
318
|
+
// viewMode
|
|
384
319
|
if (viewMode) {
|
|
385
320
|
config.showUploadList = {
|
|
386
321
|
showRemoveIcon: false,
|
|
387
322
|
showDownloadIcon: true
|
|
388
323
|
};
|
|
389
324
|
}
|
|
390
|
-
|
|
391
325
|
return config;
|
|
392
326
|
};
|
|
393
|
-
|
|
394
327
|
var handlePreview = function handlePreview(file) {
|
|
395
328
|
var imageIndex = imageList.map(function (item) {
|
|
396
329
|
return item.id;
|
|
@@ -399,28 +332,23 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
399
332
|
imageViewer.update();
|
|
400
333
|
imageViewer.view(imageIndex);
|
|
401
334
|
};
|
|
402
|
-
|
|
403
335
|
var getSynFileList = function getSynFileList(props) {
|
|
404
|
-
var processedFileList = props.fileList || [];
|
|
405
|
-
|
|
336
|
+
var processedFileList = props.fileList || [];
|
|
337
|
+
// 单文件模式只取第一个
|
|
406
338
|
if (props.mode == 'single' && processedFileList.length > 1) {
|
|
407
339
|
processedFileList = [processedFileList[0]];
|
|
408
340
|
}
|
|
409
|
-
|
|
410
341
|
processedFileList = processedFileList.map(function (item, index) {
|
|
411
342
|
// 将外部传入的简易文件数组处理成为组件需要的数组结构
|
|
412
343
|
if (item.name === undefined || item.id === undefined) {
|
|
413
344
|
// eslint-disable-next-line no-console
|
|
414
345
|
console.error('文件列表的name和id属性不能为空');
|
|
415
346
|
}
|
|
416
|
-
|
|
417
347
|
var url = item.url || downloadUrl + item.id,
|
|
418
|
-
|
|
419
|
-
|
|
348
|
+
thumbUrl = useThumbnail ? item.thumbUrl || thumbnailUrl + item.id : undefined;
|
|
420
349
|
if (!isSupportThumbnail(item.type)) {
|
|
421
350
|
thumbUrl = url;
|
|
422
351
|
}
|
|
423
|
-
|
|
424
352
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
425
353
|
uid: -1 - index,
|
|
426
354
|
status: 'done',
|
|
@@ -430,7 +358,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
430
358
|
});
|
|
431
359
|
return processedFileList;
|
|
432
360
|
};
|
|
433
|
-
|
|
434
361
|
var upload = /*#__PURE__*/_react["default"].createElement(_upload["default"], _extends({}, getConfig(), {
|
|
435
362
|
ref: ref
|
|
436
363
|
}), viewMode || fileList.length >= maxNum ? null : customizedButton || (listType == 'picture-card' ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_PlusOutlined["default"], {
|
|
@@ -441,7 +368,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
441
368
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
442
369
|
className: "ant-upload-text"
|
|
443
370
|
}, "\u4E0A\u4F20")) : /*#__PURE__*/_react["default"].createElement(_button["default"], null, /*#__PURE__*/_react["default"].createElement(_UploadOutlined["default"], null), "\u4E0A\u4F20")));
|
|
444
|
-
|
|
445
371
|
var comp = listType == 'picture-card' && !!crop ? /*#__PURE__*/_react["default"].createElement(_antdImgCrop["default"], {
|
|
446
372
|
rotationSlider: true
|
|
447
373
|
}, upload) : upload;
|
|
@@ -472,7 +398,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
472
398
|
}
|
|
473
399
|
}, imageList.filter(function (item) {
|
|
474
400
|
var _item$type;
|
|
475
|
-
|
|
476
401
|
return item.type && ((_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.indexOf('image')) > -1;
|
|
477
402
|
}).map(function (item, index) {
|
|
478
403
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
@@ -513,14 +438,11 @@ VtxUpload.propTypes = {
|
|
|
513
438
|
useThumbnail: _propTypes["default"].bool,
|
|
514
439
|
crop: _propTypes["default"].bool
|
|
515
440
|
};
|
|
516
|
-
var _default = VtxUpload;
|
|
517
|
-
exports["default"] = _default;
|
|
518
|
-
|
|
441
|
+
var _default = exports["default"] = VtxUpload;
|
|
519
442
|
function isSupportThumbnail(type) {
|
|
520
443
|
if (['image/webp'].includes(type)) {
|
|
521
444
|
return false;
|
|
522
445
|
}
|
|
523
|
-
|
|
524
446
|
return true;
|
|
525
447
|
}
|
|
526
448
|
//# sourceMappingURL=index.js.map
|