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,254 @@
|
|
|
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 _reactstrap = require("reactstrap");
|
|
11
|
+
var _UploadProgress = _interopRequireDefault(require("../../../UploadProgress"));
|
|
12
|
+
var _url = require("../../../utils/url");
|
|
13
|
+
var _FileUploader = _interopRequireDefault(require("../../../FileUploader"));
|
|
14
|
+
var _lang = require("../../../lang");
|
|
15
|
+
require("./index.css");
|
|
16
|
+
class LocalImageAddition extends _react.default.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.setFileTipShow = (isImageTipShow, uploadType) => {
|
|
20
|
+
if (uploadType && uploadType === 'image') {
|
|
21
|
+
this.setState({
|
|
22
|
+
isImagePasteTipShow: isImageTipShow
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.setState({
|
|
27
|
+
isImageTipShow: isImageTipShow
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
this.updateUploadFileList = fileListInfo => {
|
|
31
|
+
if (!fileListInfo) {
|
|
32
|
+
this.setState({
|
|
33
|
+
thumbnailSrcList: []
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.setState({
|
|
38
|
+
thumbnailSrcList: fileListInfo
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
this.onFileUploadSuccess = fileMessage => {
|
|
42
|
+
this.hideDeleteIcon();
|
|
43
|
+
let {
|
|
44
|
+
thumbnailSrcList
|
|
45
|
+
} = this.state;
|
|
46
|
+
const findUploadFileIndex = this.findUploadFileIndex(fileMessage);
|
|
47
|
+
thumbnailSrcList.splice(findUploadFileIndex, 1, fileMessage);
|
|
48
|
+
if (thumbnailSrcList.every(fileItem => !fileItem.isUploading)) {
|
|
49
|
+
this.setState({
|
|
50
|
+
thumbnailSrcList: []
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.props.fileUploadCompleted(fileMessage);
|
|
54
|
+
};
|
|
55
|
+
this.onFileUploadFailed = uploadedFileInfo => {
|
|
56
|
+
let {
|
|
57
|
+
thumbnailSrcList
|
|
58
|
+
} = this.state;
|
|
59
|
+
const findUploadFileIndex = this.findUploadFileIndex(uploadedFileInfo);
|
|
60
|
+
thumbnailSrcList.splice(findUploadFileIndex, 1, uploadedFileInfo);
|
|
61
|
+
this.setState({
|
|
62
|
+
thumbnailSrcList
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
this.findUploadFileIndex = fileMessage => {
|
|
66
|
+
let {
|
|
67
|
+
thumbnailSrcList
|
|
68
|
+
} = this.state;
|
|
69
|
+
let uploadFileIndex = thumbnailSrcList.findIndex(item => item.name === fileMessage.file.name);
|
|
70
|
+
return uploadFileIndex;
|
|
71
|
+
};
|
|
72
|
+
this.onFileUploadProgress = uploadMessage => {
|
|
73
|
+
if (!uploadMessage) {
|
|
74
|
+
this.setState({
|
|
75
|
+
uploadMessageList: []
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let {
|
|
80
|
+
uploadMessageList
|
|
81
|
+
} = this.state;
|
|
82
|
+
let newUploadMessageList = uploadMessageList.slice(0);
|
|
83
|
+
let uploadFile = uploadMessageList.find(item => item.uploadName === uploadMessage.uploadName);
|
|
84
|
+
if (uploadFile) {
|
|
85
|
+
uploadFile.uploadPercent = uploadMessage.uploadPercent;
|
|
86
|
+
} else {
|
|
87
|
+
newUploadMessageList.push(uploadMessage);
|
|
88
|
+
}
|
|
89
|
+
this.setState({
|
|
90
|
+
uploadMessageList: newUploadMessageList
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
this.deleteImage = (event, index) => {
|
|
94
|
+
this.props.deleteImage(index, 'localPicture');
|
|
95
|
+
};
|
|
96
|
+
this.fileUploadAgain = (event, uploadFileInfo) => {
|
|
97
|
+
this.uploaderFileRef.uploadFileAgain(uploadFileInfo);
|
|
98
|
+
};
|
|
99
|
+
this.onCellTipShow = code => {
|
|
100
|
+
//
|
|
101
|
+
};
|
|
102
|
+
this.showDeleteIcon = (event, index) => {
|
|
103
|
+
this.setState({
|
|
104
|
+
isShowDeleteIcon: true,
|
|
105
|
+
enterImageIndex: index
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
this.hideDeleteIcon = () => {
|
|
109
|
+
this.setState({
|
|
110
|
+
isShowDeleteIcon: false,
|
|
111
|
+
enterImageIndex: -1
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
this.renderMultipleFilesArr = () => {
|
|
115
|
+
let {
|
|
116
|
+
thumbnailSrcList
|
|
117
|
+
} = this.state;
|
|
118
|
+
let imageArr = [];
|
|
119
|
+
if (Array.isArray(this.props.uploadLocalImageValue)) {
|
|
120
|
+
let uploadedFileList = this.renderUploadedFile();
|
|
121
|
+
if (uploadedFileList) {
|
|
122
|
+
imageArr.push(...uploadedFileList);
|
|
123
|
+
}
|
|
124
|
+
if (Array.isArray(thumbnailSrcList) && thumbnailSrcList.length > 0) {
|
|
125
|
+
let thumbnailList = thumbnailSrcList.map((fileThumbnailItem, index) => {
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
127
|
+
key: "dtable-ui-image-wrapper-circle".concat(index)
|
|
128
|
+
}, fileThumbnailItem.isUploading && /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
+
className: "dtable-ui-image-wrapper"
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: "dtable-ui-image-upload-percent"
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
133
|
+
src: fileThumbnailItem.fileIconUrl,
|
|
134
|
+
style: {
|
|
135
|
+
position: 'absolute',
|
|
136
|
+
zIndex: "".concat(fileThumbnailItem.percent === 100 ? 3 : 1),
|
|
137
|
+
maxHeight: '100%'
|
|
138
|
+
},
|
|
139
|
+
alt: ""
|
|
140
|
+
}), fileThumbnailItem.percent < 100 && /*#__PURE__*/_react.default.createElement(_UploadProgress.default, {
|
|
141
|
+
uploadPercent: fileThumbnailItem.percent || 0
|
|
142
|
+
}), fileThumbnailItem.percent === 100 && /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
+
className: "dtable-ui-image-upload-success"
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
className: "dtable-ui-image-upload-success-scale"
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
147
|
+
className: "dtable-ui-image-upload-success-tip"
|
|
148
|
+
}, (0, _lang.getLocale)('Indexing')))), /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
className: "dtable-ui-image-upload-mask"
|
|
150
|
+
}), fileThumbnailItem.isErrorTip && /*#__PURE__*/_react.default.createElement("div", {
|
|
151
|
+
className: "dtable-ui-image-upload-error-tip"
|
|
152
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Network_Error')), /*#__PURE__*/_react.default.createElement("span", {
|
|
153
|
+
className: "dtable-ui-image-upload-again",
|
|
154
|
+
onClick: event => this.fileUploadAgain(event, fileThumbnailItem)
|
|
155
|
+
}, (0, _lang.getLocale)('Re_upload'))))));
|
|
156
|
+
});
|
|
157
|
+
imageArr.push(...thumbnailList);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return imageArr;
|
|
161
|
+
};
|
|
162
|
+
this.renderUploadedFile = () => {
|
|
163
|
+
const {
|
|
164
|
+
uploadLocalImageValue
|
|
165
|
+
} = this.props;
|
|
166
|
+
let uploadedFileList = [];
|
|
167
|
+
uploadedFileList = uploadLocalImageValue.length > 0 && uploadLocalImageValue.map((imgSrc, index) => {
|
|
168
|
+
let imageThumbnailUrl = (0, _url.getImageThumbnailUrl)(imgSrc);
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
170
|
+
key: 'dtable-ui-image-wrapper-' + index,
|
|
171
|
+
className: "dtable-ui-image-wrapper",
|
|
172
|
+
onMouseEnter: event => this.showDeleteIcon(event, index),
|
|
173
|
+
onMouseLeave: this.hideDeleteIcon
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
className: "dtable-ui-image-content"
|
|
176
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
177
|
+
src: imageThumbnailUrl,
|
|
178
|
+
alt: "",
|
|
179
|
+
style: {
|
|
180
|
+
maxHeight: '100%'
|
|
181
|
+
}
|
|
182
|
+
})), this.state.isShowDeleteIcon && this.state.enterImageIndex === index && /*#__PURE__*/_react.default.createElement("div", {
|
|
183
|
+
className: "dtable-delete-image-icon",
|
|
184
|
+
onClick: event => this.deleteImage(event, index)
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
186
|
+
className: "image-delete-span"
|
|
187
|
+
}, "x")));
|
|
188
|
+
});
|
|
189
|
+
return uploadedFileList;
|
|
190
|
+
};
|
|
191
|
+
this.renderUploadFileWrapper = imageArr => {
|
|
192
|
+
let {
|
|
193
|
+
isImageTipShow
|
|
194
|
+
} = this.state;
|
|
195
|
+
let editorContent;
|
|
196
|
+
let className = imageArr.length === 0 ? "dtable-ui-image-upload-container ".concat(isImageTipShow ? 'dtable-ui-image-upload-container-active' : '') : 'dtable-ui-image-wrapper';
|
|
197
|
+
if (imageArr.length === 0) {
|
|
198
|
+
editorContent = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
199
|
+
className: "dtable-ui-image-tip-addition ".concat(isImageTipShow ? 'dtable-ui-image-drop-active' : '')
|
|
200
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
201
|
+
className: "dtable-ui-dtable-ui-image-add-icon"
|
|
202
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
203
|
+
"aria-hidden": "true",
|
|
204
|
+
className: "dtable-font dtable-icon-add-files"
|
|
205
|
+
})), isImageTipShow ? /*#__PURE__*/_react.default.createElement("div", {
|
|
206
|
+
className: "dtable-ui-image-add-span"
|
|
207
|
+
}, (0, _lang.getLocale)('Drag_and_drop_to_add_an_image')) : /*#__PURE__*/_react.default.createElement("div", {
|
|
208
|
+
className: "dtable-ui-image-add-span"
|
|
209
|
+
}, (0, _lang.getLocale)('Drag_and_drop_images_or_click_or_paste_here_to_add'))), this.state.isImagePasteTipShow && /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
210
|
+
className: "image-addition-paste",
|
|
211
|
+
autoFocus: true
|
|
212
|
+
}));
|
|
213
|
+
} else {
|
|
214
|
+
editorContent = /*#__PURE__*/_react.default.createElement("div", {
|
|
215
|
+
className: "dtable-ui-image-add-box"
|
|
216
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
217
|
+
className: "dtable-ui-image-add-button ".concat(isImageTipShow ? 'dtable-ui-image-wrapper-drop-active' : '')
|
|
218
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
className: "dtable-font dtable-icon-add-table"
|
|
221
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
222
|
+
className: "dtable-ui-image-add-span"
|
|
223
|
+
}, (0, _lang.getLocale)('Upload'))));
|
|
224
|
+
}
|
|
225
|
+
return /*#__PURE__*/_react.default.createElement(_FileUploader.default, {
|
|
226
|
+
uploadType: "image",
|
|
227
|
+
isSupportDragDrop: true,
|
|
228
|
+
isSupportPaste: true,
|
|
229
|
+
className: className,
|
|
230
|
+
updateParentTips: this.setFileTipShow,
|
|
231
|
+
onFileUploadSuccess: this.onFileUploadSuccess,
|
|
232
|
+
onFileUploadProgress: this.onFileUploadProgress,
|
|
233
|
+
updateUploadFileList: this.updateUploadFileList,
|
|
234
|
+
onFileUploadFailed: this.onFileUploadFailed,
|
|
235
|
+
ref: ref => this.uploaderFileRef = ref,
|
|
236
|
+
onCellTipShow: this.onCellTipShow,
|
|
237
|
+
uploadFile: this.props.uploadFile
|
|
238
|
+
}, editorContent);
|
|
239
|
+
};
|
|
240
|
+
this.state = {
|
|
241
|
+
isImageTipShow: false,
|
|
242
|
+
isShowDeleteIcon: false,
|
|
243
|
+
enterImageIndex: -1,
|
|
244
|
+
thumbnailSrcList: [],
|
|
245
|
+
uploadMessageList: [],
|
|
246
|
+
isImagePasteTipShow: false
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
render() {
|
|
250
|
+
const imageArr = this.renderMultipleFilesArr();
|
|
251
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, imageArr, this.renderUploadFileWrapper(imageArr));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
var _default = exports.default = LocalImageAddition;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.dtable-ui-image-previewer-box:nth-child(5n) {
|
|
2
|
+
margin-right: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dtable-ui-image-previewer-box {
|
|
6
|
+
margin-right: 19px;
|
|
7
|
+
width: 100px;
|
|
8
|
+
height: 100px;
|
|
9
|
+
margin-top: 15px;
|
|
10
|
+
border: 2px solid #ededed;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
position: relative;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-image-previewer-box:hover {
|
|
20
|
+
border-color: #c9c9c9;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dtable-ui-image-previewer-box img {
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dtable-ui-image-icons-choice {
|
|
29
|
+
height: 20px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
top: 0;
|
|
32
|
+
position: absolute;
|
|
33
|
+
color: #fff;
|
|
34
|
+
display: flex;
|
|
35
|
+
padding: 0 3px;
|
|
36
|
+
justify-content: flex-end;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dtable-ui-image-icons-choice .image-icon {
|
|
41
|
+
height: 16px;
|
|
42
|
+
width: 16px;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
background: rgba(0, 0, 0, 0.5);
|
|
45
|
+
color: #fff;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dtable-ui-image-icons-choice .image-icon:nth-child(2) {
|
|
53
|
+
margin-left: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dtable-ui-image-icons-choice .image-icon .dtable-font {
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
transform: scale(0.7);
|
|
59
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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 _reactstrap = require("reactstrap");
|
|
11
|
+
var _DeleteTip = _interopRequireDefault(require("../../../DeleteTip"));
|
|
12
|
+
var _url = require("../../../utils/url");
|
|
13
|
+
var _constants = require("../../../constants");
|
|
14
|
+
var _lang = require("../../../lang");
|
|
15
|
+
require("./index.css");
|
|
16
|
+
class ImagePreviewer extends _react.default.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.showLargeImage = () => {
|
|
20
|
+
let {
|
|
21
|
+
imageItemUrl
|
|
22
|
+
} = this.props;
|
|
23
|
+
this.props.showLargeImage(imageItemUrl);
|
|
24
|
+
};
|
|
25
|
+
this.showImageToolbar = () => {
|
|
26
|
+
let {
|
|
27
|
+
itemIndex
|
|
28
|
+
} = this.props;
|
|
29
|
+
this.props.setImageItemIndex(itemIndex);
|
|
30
|
+
};
|
|
31
|
+
this.hideImageToolbar = () => {
|
|
32
|
+
this.props.setImageItemIndex(-1);
|
|
33
|
+
};
|
|
34
|
+
this.downloadImage = e => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
this.props.downloadImage(this.props.imageItemUrl);
|
|
37
|
+
};
|
|
38
|
+
this.deleteImage = e => {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
let {
|
|
41
|
+
itemIndex
|
|
42
|
+
} = this.props;
|
|
43
|
+
this.props.deleteImage(itemIndex, _constants.FILE_EDITOR_STATUS.PREVIEWER);
|
|
44
|
+
};
|
|
45
|
+
this.onClickDelete = e => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
this.position = {
|
|
48
|
+
top: e.clientY,
|
|
49
|
+
left: e.clientX
|
|
50
|
+
};
|
|
51
|
+
this.setState({
|
|
52
|
+
showTip: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
this.closeTip = () => {
|
|
56
|
+
this.setState({
|
|
57
|
+
showTip: false
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
this.toggle = () => {
|
|
61
|
+
this.setState({
|
|
62
|
+
isTooltipOpen: !this.state.isTooltipOpen
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
this.renderImageIcons = () => {
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "dtable-ui-image-icons-choice"
|
|
68
|
+
}, this.props.downloadImage && this.canDownLoad && /*#__PURE__*/_react.default.createElement("span", {
|
|
69
|
+
className: "image-icon",
|
|
70
|
+
onClick: this.downloadImage
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
className: "dtable-font dtable-icon-download"
|
|
74
|
+
})), this.props.deleteImage && /*#__PURE__*/_react.default.createElement("span", {
|
|
75
|
+
className: "image-icon",
|
|
76
|
+
onClick: this.onClickDelete
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
80
|
+
})));
|
|
81
|
+
};
|
|
82
|
+
this.state = {
|
|
83
|
+
isTooltipOpen: false,
|
|
84
|
+
imageThumbnailUrl: ''
|
|
85
|
+
};
|
|
86
|
+
this.canDownLoad = props.canDownLoad;
|
|
87
|
+
const offsetWidth = document.body.offsetWidth;
|
|
88
|
+
this.containerSize = offsetWidth < 767.8 ? (offsetWidth - 55) / 2 + 'px' : (offsetWidth - 80) / 3 + 'px';
|
|
89
|
+
this.position = {};
|
|
90
|
+
const {
|
|
91
|
+
mediaUrl
|
|
92
|
+
} = props.config || {};
|
|
93
|
+
this.imageLoadingFailedUrl = "".concat(mediaUrl, "img/image-loading-failed.png");
|
|
94
|
+
this.ref = null;
|
|
95
|
+
}
|
|
96
|
+
componentDidMount() {
|
|
97
|
+
let {
|
|
98
|
+
imageItemUrl,
|
|
99
|
+
config
|
|
100
|
+
} = this.props;
|
|
101
|
+
if ((0, _url.checkSVGImage)(imageItemUrl)) {
|
|
102
|
+
this.setState({
|
|
103
|
+
imageThumbnailUrl: imageItemUrl
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let imageThumbnailUrl = (0, _url.getImageThumbnailUrl)(imageItemUrl, config);
|
|
108
|
+
(0, _url.checkImgExists)(imageThumbnailUrl).then(() => {
|
|
109
|
+
this.setState({
|
|
110
|
+
imageThumbnailUrl: imageThumbnailUrl
|
|
111
|
+
});
|
|
112
|
+
}).catch(() => {
|
|
113
|
+
this.setState({
|
|
114
|
+
imageThumbnailUrl: this.imageLoadingFailedUrl
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
const {
|
|
120
|
+
enterImageItemIndex,
|
|
121
|
+
itemIndex,
|
|
122
|
+
imageItemUrl
|
|
123
|
+
} = this.props;
|
|
124
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
125
|
+
style: window.isMobile ? {
|
|
126
|
+
width: this.containerSize,
|
|
127
|
+
height: this.containerSize
|
|
128
|
+
} : {},
|
|
129
|
+
onClick: this.showLargeImage,
|
|
130
|
+
className: "dtable-ui-image-previewer-box",
|
|
131
|
+
onMouseEnter: this.showImageToolbar,
|
|
132
|
+
onMouseLeave: this.hideImageToolbar,
|
|
133
|
+
ref: ref => this.ref = ref
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
135
|
+
src: this.state.imageThumbnailUrl,
|
|
136
|
+
alt: ""
|
|
137
|
+
}), enterImageItemIndex === itemIndex && this.renderImageIcons()), enterImageItemIndex === itemIndex && /*#__PURE__*/_react.default.createElement(_reactstrap.Tooltip, {
|
|
138
|
+
placement: "bottom",
|
|
139
|
+
isOpen: this.state.isTooltipOpen,
|
|
140
|
+
toggle: this.toggle,
|
|
141
|
+
target: this.ref,
|
|
142
|
+
delay: {
|
|
143
|
+
show: 0,
|
|
144
|
+
hide: 0
|
|
145
|
+
},
|
|
146
|
+
fade: false
|
|
147
|
+
}, (0, _url.getFileName)(imageItemUrl)), this.state.showTip && /*#__PURE__*/_react.default.createElement(_DeleteTip.default, {
|
|
148
|
+
position: this.position,
|
|
149
|
+
toggle: this.closeTip,
|
|
150
|
+
handleDelete: this.deleteImage,
|
|
151
|
+
deleteTip: (0, _lang.getLocale)('Are_you_sure_you_want_to_delete_this_image')
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var _default = exports.default = ImagePreviewer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.dtable-ui-image-editor-container .dtable-ui-image-previewer-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-height: 30px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dtable-ui-image-previewer-wrapper {
|
|
8
|
+
padding: 0 20px 20px;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
height: 350px;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
overflow-x: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dtable-ui-image-previewer-content {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
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 _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
|
|
10
|
+
var _imagePreview = _interopRequireDefault(require("./image-preview"));
|
|
11
|
+
var _DTableCommonAddTool = _interopRequireDefault(require("../../DTableCommonAddTool"));
|
|
12
|
+
var _utils = require("../../utils/utils");
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
var _lang = require("../../lang");
|
|
15
|
+
require("./index.css");
|
|
16
|
+
class ImagesPreviewer extends _react.default.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.handleHistoryBack = e => {
|
|
20
|
+
if (this.state.isShowLargeImage) {
|
|
21
|
+
this.hideLargeImage();
|
|
22
|
+
} else if (this.props.closeEditor) {
|
|
23
|
+
this.props.closeEditor();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.showLargeImage = itemUrl => {
|
|
27
|
+
let {
|
|
28
|
+
value
|
|
29
|
+
} = this.props;
|
|
30
|
+
this.setState({
|
|
31
|
+
isShowLargeImage: true,
|
|
32
|
+
largeImageIndex: value.indexOf(itemUrl)
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
this.hideLargeImage = () => {
|
|
36
|
+
this.setState({
|
|
37
|
+
isShowLargeImage: false,
|
|
38
|
+
largeImageIndex: ''
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
this.moveNext = () => {
|
|
42
|
+
let images = this.props.value;
|
|
43
|
+
this.setState(prevState => ({
|
|
44
|
+
largeImageIndex: (prevState.largeImageIndex + 1) % images.length
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
this.movePrev = () => {
|
|
48
|
+
let images = this.props.value;
|
|
49
|
+
this.setState(prevState => ({
|
|
50
|
+
largeImageIndex: (prevState.largeImageIndex + images.length - 1) % images.length
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
this.togglePreviewer = () => {
|
|
54
|
+
this.props.togglePreviewer(_constants.FILE_EDITOR_STATUS.ADDITION);
|
|
55
|
+
this.props.resetAdditionImage();
|
|
56
|
+
};
|
|
57
|
+
this.deleteImage = (index, type) => {
|
|
58
|
+
this.props.deleteImage(index, type);
|
|
59
|
+
const {
|
|
60
|
+
value
|
|
61
|
+
} = this.props;
|
|
62
|
+
if (index > value.length - 2) {
|
|
63
|
+
if (value.length - 2 < 0) {
|
|
64
|
+
this.hideLargeImage();
|
|
65
|
+
} else {
|
|
66
|
+
this.setState({
|
|
67
|
+
largeImageIndex: 0
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.downloadImage = imageItemUrl => {
|
|
73
|
+
let rotateIndex = imageItemUrl.indexOf('?a=');
|
|
74
|
+
if (rotateIndex > -1) {
|
|
75
|
+
imageItemUrl = imageItemUrl.slice(0, rotateIndex);
|
|
76
|
+
}
|
|
77
|
+
let imageUrlSuffix = imageItemUrl.indexOf('?dl=1');
|
|
78
|
+
let downloadUrl = imageUrlSuffix !== -1 ? imageItemUrl : imageItemUrl + '?dl=1';
|
|
79
|
+
(0, _utils.downloadFile)(downloadUrl);
|
|
80
|
+
};
|
|
81
|
+
this.setImageItemIndex = index => {
|
|
82
|
+
this.setState({
|
|
83
|
+
enterImageItemIndex: index
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
this.state = {
|
|
87
|
+
isShowLargeImage: false,
|
|
88
|
+
largeImageIndex: '',
|
|
89
|
+
enterImageItemIndex: -1
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
componentDidMount() {
|
|
93
|
+
if (window.isMobile) {
|
|
94
|
+
window.history.pushState(null, null, '#');
|
|
95
|
+
window.addEventListener('popstate', this.handleHistoryBack, false);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
componentWillUnmount() {
|
|
99
|
+
if (window.isMobile) {
|
|
100
|
+
window.removeEventListener('popstate', this.handleHistoryBack, false);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
let {
|
|
105
|
+
value
|
|
106
|
+
} = this.props;
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: "dtable-ui-image-previewer-container"
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
+
className: "dtable-ui-image-previewer-wrapper ".concat(value.length === 0 && window.isMobile ? 'd-none' : '')
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "dtable-ui-image-previewer-content"
|
|
113
|
+
}, value.length > 0 && value.map((imageItemUrl, index) => {
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement(_imagePreview.default, {
|
|
115
|
+
key: imageItemUrl + index,
|
|
116
|
+
imageItemUrl: imageItemUrl,
|
|
117
|
+
value: value,
|
|
118
|
+
itemIndex: index,
|
|
119
|
+
deleteImage: this.props.deleteImage,
|
|
120
|
+
showLargeImage: this.showLargeImage,
|
|
121
|
+
downloadImage: this.downloadImage,
|
|
122
|
+
enterImageItemIndex: this.state.enterImageItemIndex,
|
|
123
|
+
setImageItemIndex: this.setImageItemIndex
|
|
124
|
+
});
|
|
125
|
+
}))), this.state.isShowLargeImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
|
|
126
|
+
imageItems: value,
|
|
127
|
+
imageIndex: this.state.largeImageIndex,
|
|
128
|
+
closeImagePopup: this.hideLargeImage,
|
|
129
|
+
moveToPrevImage: this.movePrev,
|
|
130
|
+
moveToNextImage: this.moveNext,
|
|
131
|
+
deleteImage: this.props.deleteImage ? this.deleteImage : null,
|
|
132
|
+
downloadImage: this.downloadImage,
|
|
133
|
+
onRotateImage: this.props.onRotateImage
|
|
134
|
+
}), /*#__PURE__*/_react.default.createElement(_DTableCommonAddTool.default, {
|
|
135
|
+
callBack: this.togglePreviewer,
|
|
136
|
+
footerName: (0, _lang.getLocale)('Add_images')
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
var _default = exports.default = ImagesPreviewer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.dtable-ui-image-editor-dialog {
|
|
2
|
+
max-width: 620px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dtable-ui-image-editor-modal {
|
|
6
|
+
width: 620px;
|
|
7
|
+
max-height: 620px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dtable-ui-image-editor-container {
|
|
12
|
+
width: 100%;
|
|
13
|
+
background-color: #fff;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dtable-ui-image-addition-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dtable-ui-image-editor-dialog .dtable-icon-return {
|
|
22
|
+
color: #666666;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
}
|