dtable-ui-component 5.3.6 → 5.3.8
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/lib/ButtonFormatter/index.js +8 -2
- package/lib/CheckboxEditor/index.css +8 -20
- package/lib/CheckboxEditor/index.js +98 -35
- package/lib/CheckboxFormatter/index.css +5 -0
- package/lib/CheckboxFormatter/index.js +9 -15
- package/lib/CollaboratorEditor/index.css +12 -35
- package/lib/CollaboratorEditor/index.js +18 -212
- package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
- package/lib/CollaboratorItem/index.css +7 -1
- package/lib/CollaboratorItem/index.js +6 -2
- package/lib/Comment/body/comment.js +190 -0
- package/lib/Comment/body/index.css +95 -0
- package/lib/Comment/body/index.js +32 -0
- package/lib/Comment/footer/btns/index.css +40 -0
- package/lib/Comment/footer/btns/index.js +113 -0
- package/lib/Comment/footer/index.css +157 -0
- package/lib/Comment/footer/index.js +169 -0
- package/lib/Comment/footer/input/index.css +52 -0
- package/lib/Comment/footer/input/index.js +448 -0
- package/lib/Comment/footer/input/participant/index.css +0 -0
- package/lib/Comment/footer/input/participant/index.js +53 -0
- package/lib/Comment/footer/participants/index.css +22 -0
- package/lib/Comment/footer/participants/index.js +68 -0
- package/lib/Comment/footer/participants/participant/index.css +5 -0
- package/lib/Comment/footer/participants/participant/index.js +32 -0
- package/lib/Comment/footer/participants/participant-select/index.css +104 -0
- package/lib/Comment/footer/participants/participant-select/index.js +182 -0
- package/lib/Comment/index.css +19 -0
- package/lib/Comment/index.js +304 -0
- package/lib/Comment/model.js +25 -0
- package/lib/Comment/utils/common.js +62 -0
- package/lib/Comment/utils/index.js +27 -0
- package/lib/Comment/utils/utilities.js +176 -0
- package/lib/DTableCustomizeSelect/index.js +2 -2
- package/lib/DTableFiltersPopover/utils/index.js +1 -7
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableGroupSelect/index.js +3 -3
- package/lib/DTableSelect/index.js +3 -1
- package/lib/DateEditor/index.js +14 -51
- package/lib/DateEditor/pc-date-editor-popover.js +149 -12
- package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +3 -4
- package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
- package/lib/DigitalSignEditor/constants.js +7 -0
- package/lib/DigitalSignEditor/index.css +69 -0
- package/lib/DigitalSignEditor/index.js +182 -0
- package/lib/DigitalSignEditor/service.js +39 -0
- package/lib/DigitalSignEditor/signature-board/index.css +35 -0
- package/lib/DigitalSignEditor/signature-board/index.js +135 -0
- package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
- package/lib/DigitalSignEditor/utils.js +29 -0
- package/lib/DurationEditor/index.js +110 -0
- package/lib/EmailEditor/index.js +58 -0
- package/lib/FileEditor/addition-previewer/index.css +1 -0
- package/lib/FileEditor/addition-previewer/index.js +52 -0
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
- package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
- package/lib/FileEditor/constants.js +7 -0
- package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
- package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
- package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
- package/lib/FileEditor/files-previewer/index.css +56 -0
- package/lib/FileEditor/files-previewer/index.js +277 -0
- package/lib/FileEditor/index.css +6 -0
- package/lib/FileEditor/index.js +258 -11
- package/lib/FileEditor/utils.js +22 -0
- package/lib/FileItemFormatter/index.js +19 -20
- package/lib/FileUploader/index.css +9 -0
- package/lib/FileUploader/index.js +268 -14
- package/lib/FormulaFormatter/cell-value-validator.js +17 -17
- package/lib/FormulaFormatter/index.js +2 -1
- package/lib/FormulaFormatter/utils.js +0 -31
- package/lib/GeolocationEditor/country-editor.js +319 -0
- package/lib/GeolocationEditor/index.css +641 -0
- package/lib/GeolocationEditor/index.js +240 -0
- package/lib/GeolocationEditor/location-editor.js +368 -0
- package/lib/GeolocationEditor/map-editor/index.js +456 -0
- package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
- package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
- package/lib/GeolocationEditor/map-editor-utils.js +153 -0
- package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
- package/lib/GeolocationEditor/parse-geolocation.js +282 -0
- package/lib/GeolocationEditor/province-city-editor.js +292 -0
- package/lib/GeolocationEditor/province-editor.js +226 -0
- package/lib/GeolocationEditor/selector-header-item.js +28 -0
- package/lib/GeolocationEditor/selector-list.js +33 -0
- package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
- package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
- package/lib/ImageEditor/addition-previewer/index.css +106 -0
- package/lib/ImageEditor/addition-previewer/index.js +63 -0
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
- package/lib/ImageEditor/constants.js +7 -0
- package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
- package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
- package/lib/ImageEditor/images-previewer/index.css +18 -0
- package/lib/ImageEditor/images-previewer/index.js +140 -0
- package/lib/ImageEditor/index.css +24 -0
- package/lib/ImageEditor/index.js +194 -0
- package/lib/ImageThumbnail/index.css +20 -0
- package/lib/ImageThumbnail/index.js +136 -0
- package/lib/LinkEditor/index.js +2 -3
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.js +16 -177
- package/lib/NumberEditor/index.js +63 -77
- package/lib/RowExpandDialog/body/index.css +21 -0
- package/lib/RowExpandDialog/body/index.js +262 -0
- package/lib/RowExpandDialog/column-content/index.css +48 -0
- package/lib/RowExpandDialog/column-content/index.js +50 -0
- package/lib/RowExpandDialog/header/index.css +31 -0
- package/lib/RowExpandDialog/header/index.js +55 -0
- package/lib/RowExpandDialog/index.css +28 -0
- package/lib/RowExpandDialog/index.js +237 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
- package/lib/RowExpandEditor/constants.js +44 -0
- package/lib/RowExpandEditor/index.css +0 -0
- package/lib/RowExpandEditor/index.js +32 -0
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
- package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
- package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
- package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
- package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
- package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
- package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
- package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
- package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
- package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
- package/lib/RowExpandFormatter/constants.js +61 -0
- package/lib/RowExpandFormatter/index.css +28 -3
- package/lib/RowExpandFormatter/index.js +113 -131
- package/lib/SingleSelectEditor/index.js +16 -156
- package/lib/SvgIcon/index.css +11 -0
- package/lib/SvgIcon/index.js +29 -0
- package/lib/TextEditor/index.js +112 -42
- package/lib/UploadProgress/index.js +38 -0
- package/lib/UrlEditor/index.js +61 -0
- package/lib/common/editor-base.js +52 -0
- package/lib/constants/file.js +96 -0
- package/lib/constants/index.js +27 -15
- package/lib/constants/key-codes.js +109 -0
- package/lib/css/cell-editor.css +18 -2
- package/lib/formatterConfig/base-formatter-config.js +23 -23
- package/lib/formatterConfig/index.js +3 -3
- package/lib/hooks/index.js +16 -0
- package/lib/index.js +81 -46
- package/lib/lang/index.js +19 -16
- package/lib/locales/de.json +167 -0
- package/lib/locales/en.json +167 -0
- package/lib/locales/es.json +167 -0
- package/lib/locales/fr.json +167 -0
- package/lib/locales/pt.json +167 -0
- package/lib/locales/ru.json +167 -0
- package/lib/locales/zh-CN.json +167 -0
- package/lib/select-editor/index.js +6 -6
- package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
- package/lib/select-editor/pc-select-editor/index.css +85 -0
- package/lib/select-editor/pc-select-editor/index.js +290 -0
- package/lib/utils/cell-comparer.js +35 -0
- package/lib/utils/cell.js +55 -0
- package/lib/utils/column-utils.js +25 -0
- package/lib/utils/editor-utils.js +1 -6
- package/lib/utils/get-event-transfer.js +75 -0
- package/lib/utils/hotkey.js +37 -0
- package/lib/utils/object-utils.js +61 -0
- package/lib/utils/url.js +121 -8
- package/lib/utils/utils.js +119 -2
- package/package.json +3 -2
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
- package/lib/FileEditor/pc-files-addition/index.js +0 -1
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/FileEditor/pc-files-preview/index.js +0 -1
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
- package/lib/FileItemFormatter/utils.js +0 -99
- package/lib/MultipleSelectEditor/index.css +0 -9
- package/lib/RowExpandLinkFormatter/utils.js +0 -71
- package/lib/RowExpandUrlFormatter/index.css +0 -1
- package/lib/SingleSelectEditor/index.css +0 -14
- package/lib/common/modal-portal.js +0 -26
- package/lib/locals/de.js +0 -103
- package/lib/locals/en.js +0 -104
- package/lib/locals/es.js +0 -103
- package/lib/locals/fr.js +0 -103
- package/lib/locals/pt.js +0 -103
- package/lib/locals/ru.js +0 -103
- package/lib/locals/zh-CN.js +0 -104
- package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
- package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
- /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
- /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
- /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
- /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
- /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
- /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _reactstrap = require("reactstrap");
|
|
12
|
+
var _UploadProgress = _interopRequireDefault(require("../../../UploadProgress"));
|
|
13
|
+
var _url = require("../../../utils/url");
|
|
14
|
+
var _FileUploader = _interopRequireDefault(require("../../../FileUploader"));
|
|
15
|
+
var _lang = require("../../../lang");
|
|
16
|
+
require("./index.css");
|
|
17
|
+
class LocalFileAddition extends _react.default.Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.setFileTipShow = isFileTipShow => {
|
|
21
|
+
this.setState({
|
|
22
|
+
isFileTipShow: isFileTipShow
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
this.updateUploadFileList = fileListInfo => {
|
|
26
|
+
if (!fileListInfo) {
|
|
27
|
+
this.setState({
|
|
28
|
+
thumbnailSrcList: []
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.setState({
|
|
33
|
+
thumbnailSrcList: fileListInfo
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.onFileUploadSuccess = fileMessage => {
|
|
37
|
+
this.hideDeleteIcon();
|
|
38
|
+
let {
|
|
39
|
+
thumbnailSrcList
|
|
40
|
+
} = this.state;
|
|
41
|
+
const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
|
|
42
|
+
thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
|
|
43
|
+
if (thumbnailSrcList.every(fileItem => !fileItem.isUploading)) {
|
|
44
|
+
this.setState({
|
|
45
|
+
thumbnailSrcList: []
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
this.props.fileUploadCompleted(fileMessage);
|
|
49
|
+
};
|
|
50
|
+
this.onFileUploadProgress = fileMessage => {
|
|
51
|
+
let {
|
|
52
|
+
thumbnailSrcList
|
|
53
|
+
} = this.state;
|
|
54
|
+
const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
|
|
55
|
+
thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
|
|
56
|
+
this.setState({
|
|
57
|
+
thumbnailSrcList
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
this.onFileUploadFailed = fileMessage => {
|
|
61
|
+
let {
|
|
62
|
+
thumbnailSrcList
|
|
63
|
+
} = this.state;
|
|
64
|
+
const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
|
|
65
|
+
thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
|
|
66
|
+
this.setState({
|
|
67
|
+
thumbnailSrcList
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
this.findUploadFileIndex = uploadFileMessage => {
|
|
71
|
+
let {
|
|
72
|
+
thumbnailSrcList
|
|
73
|
+
} = this.state;
|
|
74
|
+
let uploadFileIndex = thumbnailSrcList.findIndex(item => item.name === uploadFileMessage.file.name);
|
|
75
|
+
return uploadFileIndex;
|
|
76
|
+
};
|
|
77
|
+
this.deleteFile = (event, index) => {
|
|
78
|
+
this.props.deleteFile(index, 'localFile');
|
|
79
|
+
};
|
|
80
|
+
this.showDeleteIcon = (event, index) => {
|
|
81
|
+
this.setState({
|
|
82
|
+
isShowDeleteIcon: true,
|
|
83
|
+
enterFileIndex: index
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
this.hideDeleteIcon = () => {
|
|
87
|
+
this.setState({
|
|
88
|
+
isShowDeleteIcon: false,
|
|
89
|
+
enterFileIndex: -1
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this.fileUploadAgain = (event, fileMessage) => {
|
|
93
|
+
this.uploaderFileRef.reuploadFile(fileMessage);
|
|
94
|
+
};
|
|
95
|
+
this.tooltipToggle = () => {
|
|
96
|
+
if (this.state.tooltipOpen) {
|
|
97
|
+
this.setState({
|
|
98
|
+
isShowDeleteIcon: false,
|
|
99
|
+
enterFileIndex: -1
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
this.setState({
|
|
103
|
+
tooltipOpen: !this.state.tooltipOpen
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
this.renderMultipleFilesArr = () => {
|
|
107
|
+
let {
|
|
108
|
+
thumbnailSrcList
|
|
109
|
+
} = this.state;
|
|
110
|
+
let fileArr = [];
|
|
111
|
+
if (Array.isArray(this.props.uploadLocalFileValue)) {
|
|
112
|
+
let uploadedFileList = this.renderUploadedFile();
|
|
113
|
+
if (uploadedFileList) {
|
|
114
|
+
fileArr.push(...uploadedFileList);
|
|
115
|
+
}
|
|
116
|
+
if (Array.isArray(thumbnailSrcList) && thumbnailSrcList.length > 0) {
|
|
117
|
+
let thumbnailList = thumbnailSrcList.map((fileThumbnailItem, index) => {
|
|
118
|
+
let uploadFile = fileThumbnailItem.percent === 100 && !fileThumbnailItem.isErrorTip;
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
120
|
+
key: "dtable-ui-image-wrapper-circle".concat(index)
|
|
121
|
+
}, fileThumbnailItem.isUploading && /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
+
className: "dtable-ui-image-wrapper"
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "dtable-ui-image-upload-percent"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
126
|
+
src: fileThumbnailItem.fileIconUrl,
|
|
127
|
+
style: {
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
zIndex: "".concat(uploadFile ? 3 : 1),
|
|
130
|
+
maxHeight: '100%'
|
|
131
|
+
},
|
|
132
|
+
alt: ""
|
|
133
|
+
}), fileThumbnailItem.percent < 100 && /*#__PURE__*/_react.default.createElement(_UploadProgress.default, {
|
|
134
|
+
uploadPercent: fileThumbnailItem.percent || 0
|
|
135
|
+
}), uploadFile && /*#__PURE__*/_react.default.createElement("div", {
|
|
136
|
+
className: "dtable-ui-image-upload-success"
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
138
|
+
className: "dtable-ui-image-upload-success-scale"
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
140
|
+
className: "dtable-ui-image-upload-success-tip"
|
|
141
|
+
}, (0, _lang.getLocale)('Indexing')))), /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
+
className: "dtable-ui-image-upload-mask"
|
|
143
|
+
}), fileThumbnailItem.isErrorTip && /*#__PURE__*/_react.default.createElement("div", {
|
|
144
|
+
className: "dtable-ui-image-upload-error-tip"
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Network_Error')), /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
className: "dtable-ui-image-upload-again",
|
|
147
|
+
onClick: event => this.fileUploadAgain(event, fileThumbnailItem)
|
|
148
|
+
}, (0, _lang.getLocale)('Re_upload'))))));
|
|
149
|
+
});
|
|
150
|
+
fileArr.push(...thumbnailList);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return fileArr;
|
|
154
|
+
};
|
|
155
|
+
this.renderUploadedFile = () => {
|
|
156
|
+
const {
|
|
157
|
+
config,
|
|
158
|
+
uploadLocalFileValue
|
|
159
|
+
} = this.props;
|
|
160
|
+
let uploadedFileList = [];
|
|
161
|
+
uploadedFileList = uploadLocalFileValue.length > 0 && uploadLocalFileValue.map((fileItem, index) => {
|
|
162
|
+
let {
|
|
163
|
+
fileIconUrl
|
|
164
|
+
} = (0, _url.getFileThumbnailInfo)(fileItem, config);
|
|
165
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
key: 'dtable-ui-image-wrapper-' + index,
|
|
167
|
+
className: "dtable-ui-image-wrapper",
|
|
168
|
+
id: "file-content-tip-".concat(index),
|
|
169
|
+
onMouseEnter: event => this.showDeleteIcon(event, index),
|
|
170
|
+
onMouseLeave: this.hideDeleteIcon
|
|
171
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
172
|
+
className: "dtable-ui-image-content"
|
|
173
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
174
|
+
src: fileIconUrl,
|
|
175
|
+
alt: "",
|
|
176
|
+
style: {
|
|
177
|
+
maxHeight: '100%'
|
|
178
|
+
}
|
|
179
|
+
})), this.state.isShowDeleteIcon && this.state.enterFileIndex === index && /*#__PURE__*/_react.default.createElement("div", {
|
|
180
|
+
className: "dtable-delete-image-icon",
|
|
181
|
+
onClick: event => this.deleteFile(event, index)
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
183
|
+
className: "image-delete-span"
|
|
184
|
+
}, "x")), this.state.isShowDeleteIcon && this.state.enterFileIndex === index && /*#__PURE__*/_react.default.createElement(_reactstrap.Tooltip, {
|
|
185
|
+
toggle: this.tooltipToggle,
|
|
186
|
+
delay: {
|
|
187
|
+
show: 0,
|
|
188
|
+
hide: 0
|
|
189
|
+
},
|
|
190
|
+
target: "file-content-tip-".concat(index),
|
|
191
|
+
placement: "bottom",
|
|
192
|
+
isOpen: this.state.tooltipOpen
|
|
193
|
+
}, fileItem.name));
|
|
194
|
+
});
|
|
195
|
+
return uploadedFileList;
|
|
196
|
+
};
|
|
197
|
+
this.renderUploadFileWrapper = fileArr => {
|
|
198
|
+
let {
|
|
199
|
+
isFileTipShow
|
|
200
|
+
} = this.state;
|
|
201
|
+
let editorContent = fileArr.length === 0 ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
202
|
+
className: "dtable-ui-image-tip-addition ".concat(isFileTipShow ? 'dtable-ui-image-drop-active' : '')
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
204
|
+
className: "dtable-ui-dtable-ui-image-add-icon"
|
|
205
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
206
|
+
"aria-hidden": "true",
|
|
207
|
+
className: "dtable-font dtable-icon-add-files"
|
|
208
|
+
})), isFileTipShow ? /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
className: "dtable-ui-image-add-span"
|
|
210
|
+
}, (0, _lang.getLocale)('Drag_and_drop_to_add_a_file')) : /*#__PURE__*/_react.default.createElement("div", {
|
|
211
|
+
className: "dtable-ui-image-add-span"
|
|
212
|
+
}, (0, _lang.getLocale)('Drag_and_drop_files_or_click_here_to_add')))) : /*#__PURE__*/_react.default.createElement("div", {
|
|
213
|
+
className: "dtable-ui-image-add-box"
|
|
214
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
215
|
+
className: "dtable-ui-image-add-button ".concat(isFileTipShow ? 'dtable-ui-image-wrapper-drop-active' : '')
|
|
216
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
217
|
+
"aria-hidden": "true",
|
|
218
|
+
className: "dtable-font dtable-icon-add-table"
|
|
219
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
220
|
+
className: "dtable-ui-image-add-span"
|
|
221
|
+
}, (0, _lang.getLocale)('Upload'))));
|
|
222
|
+
return /*#__PURE__*/_react.default.createElement(_FileUploader.default, {
|
|
223
|
+
uploadType: "file",
|
|
224
|
+
isSupportDragDrop: true,
|
|
225
|
+
className: fileArr.length === 0 ? (0, _classnames.default)('dtable-ui-image-upload-container', {
|
|
226
|
+
'dtable-ui-image-upload-container-active': isFileTipShow
|
|
227
|
+
}) : 'dtable-ui-image-wrapper',
|
|
228
|
+
updateParentTips: this.setFileTipShow,
|
|
229
|
+
onFileUploadSuccess: this.onFileUploadSuccess,
|
|
230
|
+
onFileUploadProgress: this.onFileUploadProgress,
|
|
231
|
+
updateUploadFileList: this.updateUploadFileList,
|
|
232
|
+
onFileUploadFailed: this.onFileUploadFailed,
|
|
233
|
+
ref: ref => this.uploaderFileRef = ref,
|
|
234
|
+
uploadFile: this.props.uploadFile
|
|
235
|
+
}, editorContent);
|
|
236
|
+
};
|
|
237
|
+
this.state = {
|
|
238
|
+
isFileTipShow: false,
|
|
239
|
+
isShowDeleteIcon: false,
|
|
240
|
+
enterFileIndex: -1,
|
|
241
|
+
tooltipOpen: false,
|
|
242
|
+
uploadMessageList: [],
|
|
243
|
+
thumbnailSrcList: [],
|
|
244
|
+
reUploadFile: null
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
render() {
|
|
248
|
+
let fileArr = this.renderMultipleFilesArr();
|
|
249
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, fileArr, this.renderUploadFileWrapper(fileArr));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
var _default = exports.default = LocalFileAddition;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _lang = require("../../../lang");
|
|
11
|
+
class FileDropdownMenu extends _react.default.Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.onDropdownToggleClick = e => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
this.setState({
|
|
18
|
+
isItemMenuShow: !this.state.isItemMenuShow
|
|
19
|
+
}, () => {
|
|
20
|
+
if (this.state.isItemMenuShow) {
|
|
21
|
+
this.props.freezeItem();
|
|
22
|
+
} else {
|
|
23
|
+
this.props.unFreezeItem();
|
|
24
|
+
this.props.resetState();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
this.onDeleteFile = event => {
|
|
29
|
+
this.props.resetState();
|
|
30
|
+
this.props.onDeleteFile(this.props.itemIndex);
|
|
31
|
+
};
|
|
32
|
+
this.onRenameFile = event => {
|
|
33
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
34
|
+
this.props.onRenameFile();
|
|
35
|
+
};
|
|
36
|
+
this.state = {
|
|
37
|
+
isItemMenuShow: false,
|
|
38
|
+
isRenameDialogShow: false
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const {
|
|
43
|
+
onRenameFile,
|
|
44
|
+
onDeleteFile
|
|
45
|
+
} = this.props;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
|
|
47
|
+
isOpen: this.state.isItemMenuShow,
|
|
48
|
+
toggle: this.onDropdownToggleClick,
|
|
49
|
+
className: "file-dropdown-menu"
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
|
|
51
|
+
tag: "span",
|
|
52
|
+
role: "button",
|
|
53
|
+
"data-toggle": "dropdown",
|
|
54
|
+
"aria-expanded": this.state.isItemMenuShow,
|
|
55
|
+
className: "file-dropdown-icon",
|
|
56
|
+
title: (0, _lang.getLocale)('More_operations'),
|
|
57
|
+
"aria-label": (0, _lang.getLocale)('More_operations')
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
className: "dtable-font dtable-icon-more-vertical file-dropdown-more"
|
|
61
|
+
})), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
|
|
62
|
+
className: "dtable-dropdown-menu dropdown-menu"
|
|
63
|
+
}, onRenameFile && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
64
|
+
onClick: this.onRenameFile
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
66
|
+
className: "item-icon dtable-font dtable-icon-rename"
|
|
67
|
+
}), (0, _lang.getLocale)('Rename')), onDeleteFile && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
68
|
+
onClick: this.onDeleteFile
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
70
|
+
className: "item-icon dtable-font dtable-icon-delete"
|
|
71
|
+
}), (0, _lang.getLocale)('Delete'))));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
var _default = exports.default = FileDropdownMenu;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _constants = require("../../../../constants");
|
|
11
|
+
require("./index.css");
|
|
12
|
+
class FileNameEditor extends _react.Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.onMouseDown = e => {
|
|
16
|
+
if (this.fileNameRef && !this.fileNameRef.contains(e.target)) {
|
|
17
|
+
this.onSave();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.onChange = e => {
|
|
21
|
+
this.setState({
|
|
22
|
+
fileName: e.target.value
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
this.onKeyDown = e => {
|
|
26
|
+
e.stopPropagation();
|
|
27
|
+
if (e.keyCode === _constants.KeyCodes.Enter) {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
this.onSave();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
this.onSave = () => {
|
|
33
|
+
const {
|
|
34
|
+
renameFile,
|
|
35
|
+
name,
|
|
36
|
+
closeRenameFile,
|
|
37
|
+
itemIndex
|
|
38
|
+
} = this.props;
|
|
39
|
+
let newName = this.state.fileName.trim();
|
|
40
|
+
if (newName === name || newName === '') {
|
|
41
|
+
closeRenameFile();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.unSaved = false;
|
|
45
|
+
renameFile(itemIndex, newName);
|
|
46
|
+
closeRenameFile();
|
|
47
|
+
};
|
|
48
|
+
this.state = {
|
|
49
|
+
fileName: props.name || ''
|
|
50
|
+
};
|
|
51
|
+
this.unSaved = true;
|
|
52
|
+
}
|
|
53
|
+
componentDidMount() {
|
|
54
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
55
|
+
}
|
|
56
|
+
componentWillUnmount() {
|
|
57
|
+
if (this.unSaved) {
|
|
58
|
+
this.onSave();
|
|
59
|
+
}
|
|
60
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "pt-1",
|
|
65
|
+
ref: ref => this.fileNameRef = ref
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
67
|
+
className: "dtable-ui-file-name-input",
|
|
68
|
+
type: "text",
|
|
69
|
+
value: this.state.fileName,
|
|
70
|
+
onChange: this.onChange,
|
|
71
|
+
onKeyDown: this.onKeyDown,
|
|
72
|
+
onBlur: this.onSave,
|
|
73
|
+
autoFocus: true
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
var _default = exports.default = FileNameEditor;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.dtable-ui-file-editor-previewer-box {
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 48px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
padding: 0px 16px;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-ui-file-editor-previewer-box.dtable-ui-file-editor-previewer-box-highlight {
|
|
10
|
+
background-color: #f5f5f5;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
width: calc(100% - 56px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-icon {
|
|
20
|
+
height: 100%;
|
|
21
|
+
line-height: 48px;
|
|
22
|
+
margin-right: 5px;
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-icon img {
|
|
27
|
+
width: 36px;
|
|
28
|
+
height: 36px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-info {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-previewer-item-name {
|
|
37
|
+
max-width: 480px;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-previewer-item .dtable-ui-file-editor-preview-item-detail {
|
|
44
|
+
color: #c0c0c0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dtable-ui-file-editor-previewer-box .dtable-ui-file-editor-preview-item-detail .file-upload-time {
|
|
48
|
+
white-space: pre-wrap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dtable-ui-file-editor-previewer-operation {
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dtable-ui-file-editor-previewer-operation .file-dropdown-menu .file-dropdown-icon {
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
align-items: center;
|
|
61
|
+
height: 24px;
|
|
62
|
+
width: 24px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.file-dropdown-menu .file-dropdown-icon .dtable-icon-more-vertical {
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
color: #999;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dtable-ui-file-editor-previewer-operation .file-download-icon,
|
|
71
|
+
.file-dropdown-menu .file-dropdown-icon .file-dropdown-more {
|
|
72
|
+
width: 24px;
|
|
73
|
+
height: 24px;
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
color: #999;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.file-dropdown-menu .file-dropdown-icon:hover .file-dropdown-more,
|
|
83
|
+
.dtable-ui-file-editor-previewer-operation .file-download-icon:hover {
|
|
84
|
+
color: #000;
|
|
85
|
+
opacity: 0.75;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _dropdownMenu = _interopRequireDefault(require("./dropdown-menu"));
|
|
11
|
+
var _fileNameEditor = _interopRequireDefault(require("./file-name-editor"));
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _url = require("../../../utils/url");
|
|
14
|
+
require("./index.css");
|
|
15
|
+
class FilePreviewer extends _react.default.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.fileItemMouseEnter = () => {
|
|
19
|
+
if (!this.props.isItemFreezed) {
|
|
20
|
+
this.setState({
|
|
21
|
+
isShowOperation: true,
|
|
22
|
+
highlight: true
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.fileItemMouseLeave = () => {
|
|
27
|
+
if (!this.props.isItemFreezed) {
|
|
28
|
+
this.setState({
|
|
29
|
+
isShowOperation: false,
|
|
30
|
+
highlight: false
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
this.handleFileClick = () => {
|
|
35
|
+
let {
|
|
36
|
+
fileItem
|
|
37
|
+
} = this.props;
|
|
38
|
+
let openFileUrl = fileItem.url;
|
|
39
|
+
let assetFileIndex = openFileUrl.indexOf('/asset');
|
|
40
|
+
if (assetFileIndex > -1 && (0, _url.imageCheck)(fileItem.name)) {
|
|
41
|
+
this.props.showLargeImage(fileItem.url);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
this.downloadFile = e => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
let downloadUrl = this.props.fileItem.url;
|
|
48
|
+
this.props.downloadFile(downloadUrl);
|
|
49
|
+
};
|
|
50
|
+
this.onSelectFile = () => {
|
|
51
|
+
const {
|
|
52
|
+
fileItem
|
|
53
|
+
} = this.props;
|
|
54
|
+
this.props.onSelectFiles(fileItem.name);
|
|
55
|
+
};
|
|
56
|
+
this.closeRenameFile = () => {
|
|
57
|
+
if (this.state.isShowRename) {
|
|
58
|
+
this.setState({
|
|
59
|
+
isShowRename: false
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.openRenameFile = () => {
|
|
64
|
+
this.setState({
|
|
65
|
+
isShowRename: true
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
this.resetState = () => {
|
|
69
|
+
this.setState({
|
|
70
|
+
isShowOperation: false,
|
|
71
|
+
highlight: false
|
|
72
|
+
});
|
|
73
|
+
this.props.unFreezeItem();
|
|
74
|
+
};
|
|
75
|
+
this.state = {
|
|
76
|
+
isShowRename: false,
|
|
77
|
+
isShowOperation: false,
|
|
78
|
+
highlight: false,
|
|
79
|
+
errorMessage: ''
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
const {
|
|
84
|
+
fileItem,
|
|
85
|
+
isItemFreezed,
|
|
86
|
+
isSelectMultipleFiles,
|
|
87
|
+
isSelected,
|
|
88
|
+
config
|
|
89
|
+
} = this.props;
|
|
90
|
+
const {
|
|
91
|
+
isShowRename,
|
|
92
|
+
isShowOperation,
|
|
93
|
+
highlight
|
|
94
|
+
} = this.state;
|
|
95
|
+
const {
|
|
96
|
+
fileIconUrl
|
|
97
|
+
} = (0, _url.getFileThumbnailInfo)(fileItem, config);
|
|
98
|
+
const errorMessage = '';
|
|
99
|
+
const uploadTime = (0, _utils.getFileUploadTime)(fileItem);
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: "dtable-ui-file-editor-previewer-box ".concat(highlight ? 'dtable-ui-file-editor-previewer-box-highlight' : ''),
|
|
102
|
+
onMouseEnter: this.fileItemMouseEnter,
|
|
103
|
+
onMouseLeave: this.fileItemMouseLeave
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: "dtable-ui-file-editor-previewer-item"
|
|
106
|
+
}, isSelectMultipleFiles && /*#__PURE__*/_react.default.createElement("input", {
|
|
107
|
+
onChange: this.onSelectFile,
|
|
108
|
+
checked: isSelected,
|
|
109
|
+
className: "mr-2",
|
|
110
|
+
type: "checkbox"
|
|
111
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "dtable-ui-file-editor-previewer-icon"
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
114
|
+
alt: "",
|
|
115
|
+
src: fileIconUrl
|
|
116
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
117
|
+
className: "dtable-ui-file-editor-previewer-info"
|
|
118
|
+
}, isShowRename ? /*#__PURE__*/_react.default.createElement(_fileNameEditor.default, {
|
|
119
|
+
itemIndex: this.props.itemIndex,
|
|
120
|
+
name: fileItem.name,
|
|
121
|
+
renameFile: this.props.renameFile,
|
|
122
|
+
closeRenameFile: this.closeRenameFile
|
|
123
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "dtable-ui-file-editor-previewer-item-name ".concat(fileItem.type === 'dir' ? 'dtable-ui-file-editor-previewer-item-name-height' : ''),
|
|
125
|
+
ref: ref => this.renameRef = ref
|
|
126
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
127
|
+
onClick: this.props.renameFile ? this.handleFileClick : () => {}
|
|
128
|
+
}, fileItem.name)), /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
+
className: "dtable-ui-file-editor-preview-item-detail d-flex"
|
|
130
|
+
}, uploadTime && /*#__PURE__*/_react.default.createElement("span", {
|
|
131
|
+
className: "file-upload-time"
|
|
132
|
+
}, "".concat(uploadTime, ", ")), fileItem.size > -1 && /*#__PURE__*/_react.default.createElement("span", null, (0, _utils.bytesToSize)(fileItem.size))))), !isShowRename && isItemFreezed && /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
|
|
133
|
+
delay: {
|
|
134
|
+
show: 0,
|
|
135
|
+
hide: 0
|
|
136
|
+
},
|
|
137
|
+
placement: "bottom",
|
|
138
|
+
target: this.renameRef
|
|
139
|
+
}, fileItem.name), isShowOperation && /*#__PURE__*/_react.default.createElement("div", {
|
|
140
|
+
className: "dtable-ui-file-editor-previewer-operation"
|
|
141
|
+
}, this.props.downloadFile && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, fileItem.type === 'file' && !errorMessage && /*#__PURE__*/_react.default.createElement("span", {
|
|
142
|
+
"aria-hidden": "true",
|
|
143
|
+
className: "dtable-font dtable-icon-download file-download-icon",
|
|
144
|
+
onClick: this.downloadFile
|
|
145
|
+
}), fileItem.type === 'file' && errorMessage && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
className: "dtable-font dtable-icon-download disable file-download-icon",
|
|
148
|
+
ref: ref => this.disabledDownloadRef = ref
|
|
149
|
+
}), /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
|
|
150
|
+
delay: {
|
|
151
|
+
show: 0,
|
|
152
|
+
hide: 0
|
|
153
|
+
},
|
|
154
|
+
placement: "bottom",
|
|
155
|
+
target: this.disabledDownloadRef
|
|
156
|
+
}, errorMessage))), (this.props.deleteFile || this.props.renameFile) && /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
|
|
157
|
+
fileItem: fileItem,
|
|
158
|
+
freezeItem: this.props.freezeItem,
|
|
159
|
+
unFreezeItem: this.props.unFreezeItem,
|
|
160
|
+
resetState: this.resetState,
|
|
161
|
+
itemIndex: this.props.itemIndex,
|
|
162
|
+
onDeleteFile: this.props.deleteFile ? this.props.deleteFile : null,
|
|
163
|
+
onRenameFile: this.props.renameFile ? this.openRenameFile : null
|
|
164
|
+
})));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
var _default = exports.default = FilePreviewer;
|