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,56 @@
|
|
|
1
|
+
.dtable-ui-file-editor-previewer {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-wrapper {
|
|
10
|
+
height: 390px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-add-btn {
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* header */
|
|
20
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-header {
|
|
21
|
+
height: 40px;
|
|
22
|
+
margin: 0 3% 0 3%;
|
|
23
|
+
position: relative;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-header .dtable-ui-file-editor-count-content {
|
|
30
|
+
font-weight: 450;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-header .dtable-ui-file-editor-operation-content {
|
|
34
|
+
color: #FF8000;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-header .dtable-ui-file-editor-operation-content:hover {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* content */
|
|
42
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-content {
|
|
43
|
+
margin-top: 10px;
|
|
44
|
+
height: 336px;
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dtable-ui-file-editor-previewer .dtable-ui-file-editor-previewer-content::after {
|
|
49
|
+
content: '';
|
|
50
|
+
width: 94%;
|
|
51
|
+
height: 1px;
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 3%;
|
|
54
|
+
top: 40px;
|
|
55
|
+
background-color: #e9ecef;
|
|
56
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
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 _url = require("../../utils/url");
|
|
10
|
+
var _utils = require("../../utils/utils");
|
|
11
|
+
var _constants = require("../../constants");
|
|
12
|
+
var _lang = require("../../lang");
|
|
13
|
+
var _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
|
|
14
|
+
var _DTableCommonAddTool = _interopRequireDefault(require("../../DTableCommonAddTool"));
|
|
15
|
+
var _filePreviewer = _interopRequireDefault(require("./file-previewer"));
|
|
16
|
+
require("./index.css");
|
|
17
|
+
class FilesPreviewer extends _react.default.Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.getFileItemImageUrlList = value => {
|
|
21
|
+
this.setState({
|
|
22
|
+
fileImageUrlList: (0, _url.getValidFileImageUrls)(value)
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
this.showLargeImage = itemUrl => {
|
|
26
|
+
let {
|
|
27
|
+
fileImageUrlList
|
|
28
|
+
} = this.state;
|
|
29
|
+
this.setState({
|
|
30
|
+
isShowLargeImage: true,
|
|
31
|
+
largeImageIndex: fileImageUrlList.indexOf(itemUrl)
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this.moveNext = () => {
|
|
35
|
+
let {
|
|
36
|
+
fileImageUrlList
|
|
37
|
+
} = this.state;
|
|
38
|
+
this.setState(prevState => ({
|
|
39
|
+
largeImageIndex: (prevState.largeImageIndex + 1) % fileImageUrlList.length
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
this.movePrev = () => {
|
|
43
|
+
let {
|
|
44
|
+
fileImageUrlList
|
|
45
|
+
} = this.state;
|
|
46
|
+
this.setState(prevState => ({
|
|
47
|
+
largeImageIndex: (prevState.largeImageIndex + fileImageUrlList.length - 1) % fileImageUrlList.length
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
this.hideLargeImage = () => {
|
|
51
|
+
this.setState({
|
|
52
|
+
isShowLargeImage: false,
|
|
53
|
+
largeImageIndex: -1
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.downloadImage = imageItemUrl => {
|
|
57
|
+
const {
|
|
58
|
+
value
|
|
59
|
+
} = this.props;
|
|
60
|
+
const file = value.find(v => v.url === imageItemUrl);
|
|
61
|
+
if (!file) return;
|
|
62
|
+
this.props.getDownLoadFiles([file], _ref => {
|
|
63
|
+
let [dFile] = _ref;
|
|
64
|
+
dFile && (0, _utils.downloadFile)(dFile);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
this.onRotateImage = (imageIndex, degree) => {
|
|
68
|
+
let {
|
|
69
|
+
fileImageUrlList
|
|
70
|
+
} = this.state;
|
|
71
|
+
const imageUrl = fileImageUrlList[imageIndex];
|
|
72
|
+
this.props.onRotateImage && this.props.onRotateImage(imageUrl, degree);
|
|
73
|
+
};
|
|
74
|
+
this.deleteImage = (index, type) => {
|
|
75
|
+
const {
|
|
76
|
+
value
|
|
77
|
+
} = this.props;
|
|
78
|
+
let {
|
|
79
|
+
fileImageUrlList
|
|
80
|
+
} = this.state;
|
|
81
|
+
const imageUrl = fileImageUrlList[index];
|
|
82
|
+
let fileItemIndex = value.findIndex(fileItem => fileItem.url === imageUrl);
|
|
83
|
+
this.props.deleteFile(fileItemIndex, type);
|
|
84
|
+
if (index > fileImageUrlList.length - 2) {
|
|
85
|
+
if (fileImageUrlList.length - 2 < 0) {
|
|
86
|
+
this.hideLargeImage();
|
|
87
|
+
} else {
|
|
88
|
+
this.setState({
|
|
89
|
+
largeImageIndex: 0
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this.togglePreviewer = () => {
|
|
95
|
+
this.props.togglePreviewer(_constants.FILE_EDITOR_STATUS.ADDITION);
|
|
96
|
+
this.props.resetFileValue();
|
|
97
|
+
};
|
|
98
|
+
this.freezeItem = () => {
|
|
99
|
+
this.setState({
|
|
100
|
+
isItemFreezed: true
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
this.unFreezeItem = () => {
|
|
104
|
+
this.setState({
|
|
105
|
+
isItemFreezed: false
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
this.onSelectFiles = name => {
|
|
109
|
+
const {
|
|
110
|
+
selectedFilesList
|
|
111
|
+
} = this.state;
|
|
112
|
+
let filesList = selectedFilesList.slice(0);
|
|
113
|
+
const selectedFileIndex = selectedFilesList.indexOf(name);
|
|
114
|
+
if (selectedFileIndex > -1) {
|
|
115
|
+
filesList.splice(selectedFileIndex, 1);
|
|
116
|
+
} else {
|
|
117
|
+
filesList.push(name);
|
|
118
|
+
}
|
|
119
|
+
this.setState({
|
|
120
|
+
selectedFilesList: filesList
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this.onSelectAllFiles = () => {
|
|
124
|
+
const {
|
|
125
|
+
value
|
|
126
|
+
} = this.props;
|
|
127
|
+
const {
|
|
128
|
+
selectedFilesList
|
|
129
|
+
} = this.state;
|
|
130
|
+
if (value.length === 0) return;
|
|
131
|
+
let allFilesList = selectedFilesList.slice(0);
|
|
132
|
+
value.map(item => {
|
|
133
|
+
if (selectedFilesList.indexOf(item.name) === -1) {
|
|
134
|
+
allFilesList.push(item.name);
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
});
|
|
138
|
+
this.setState({
|
|
139
|
+
selectedFilesList: allFilesList
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
this.onChangeSelectMultipleFiles = state => {
|
|
143
|
+
this.setState({
|
|
144
|
+
isSelectMultipleFiles: state,
|
|
145
|
+
selectedFilesList: []
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
this.onDownloadAllSelectedFiles = () => {
|
|
149
|
+
const {
|
|
150
|
+
config
|
|
151
|
+
} = this.props;
|
|
152
|
+
const {
|
|
153
|
+
selectedFilesList
|
|
154
|
+
} = this.state;
|
|
155
|
+
if (selectedFilesList.length === 0) return;
|
|
156
|
+
this.props.getDownLoadFiles(selectedFilesList, downloadFilesUrlList => {
|
|
157
|
+
if (downloadFilesUrlList.length > 0) {
|
|
158
|
+
(0, _utils.downloadFiles)(downloadFilesUrlList, config);
|
|
159
|
+
}
|
|
160
|
+
this.onChangeSelectMultipleFiles(false);
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
this.onDeleteAllSelectedFiles = () => {
|
|
164
|
+
const {
|
|
165
|
+
selectedFilesList
|
|
166
|
+
} = this.state;
|
|
167
|
+
this.props.deleteFiles(selectedFilesList);
|
|
168
|
+
this.onChangeSelectMultipleFiles(false);
|
|
169
|
+
};
|
|
170
|
+
this.renderFilesOperation = () => {
|
|
171
|
+
const {
|
|
172
|
+
value,
|
|
173
|
+
deleteFiles,
|
|
174
|
+
getDownLoadFiles
|
|
175
|
+
} = this.props;
|
|
176
|
+
const {
|
|
177
|
+
isSelectMultipleFiles,
|
|
178
|
+
selectedFilesList
|
|
179
|
+
} = this.state;
|
|
180
|
+
if (value.length === 0) return null;
|
|
181
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
182
|
+
className: "dtable-ui-file-editor-operation-content"
|
|
183
|
+
}, !isSelectMultipleFiles ? /*#__PURE__*/_react.default.createElement("span", {
|
|
184
|
+
onClick: this.onChangeSelectMultipleFiles.bind(this, true)
|
|
185
|
+
}, (0, _lang.getLocale)('Select')) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, selectedFilesList.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, deleteFiles && /*#__PURE__*/_react.default.createElement("span", {
|
|
186
|
+
onClick: this.onDeleteAllSelectedFiles
|
|
187
|
+
}, (0, _lang.getLocale)('Delete')), getDownLoadFiles && /*#__PURE__*/_react.default.createElement("span", {
|
|
188
|
+
className: "ml-2",
|
|
189
|
+
onClick: this.onDownloadAllSelectedFiles
|
|
190
|
+
}, (0, _lang.getLocale)('Download'))), /*#__PURE__*/_react.default.createElement("span", {
|
|
191
|
+
className: "ml-2",
|
|
192
|
+
onClick: this.onSelectAllFiles
|
|
193
|
+
}, (0, _lang.getLocale)('Select_all')), /*#__PURE__*/_react.default.createElement("span", {
|
|
194
|
+
className: "ml-2",
|
|
195
|
+
onClick: this.onChangeSelectMultipleFiles.bind(this, false)
|
|
196
|
+
}, (0, _lang.getLocale)('Cancel'))));
|
|
197
|
+
};
|
|
198
|
+
this.state = {
|
|
199
|
+
isShowRename: false,
|
|
200
|
+
value: props.value,
|
|
201
|
+
isItemFreezed: false,
|
|
202
|
+
isShowLargeImage: false,
|
|
203
|
+
isSelectMultipleFiles: false,
|
|
204
|
+
fileImageUrlList: [],
|
|
205
|
+
selectedFilesList: [],
|
|
206
|
+
largeImageIndex: -1
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
componentDidMount() {
|
|
210
|
+
this.getFileItemImageUrlList(this.props.value);
|
|
211
|
+
}
|
|
212
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
213
|
+
if (JSON.stringify(this.props.value) !== JSON.stringify(nextProps.value)) {
|
|
214
|
+
this.getFileItemImageUrlList(nextProps.value);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
let {
|
|
219
|
+
value,
|
|
220
|
+
getDownLoadFiles
|
|
221
|
+
} = this.props;
|
|
222
|
+
const {
|
|
223
|
+
isSelectMultipleFiles,
|
|
224
|
+
selectedFilesList
|
|
225
|
+
} = this.state;
|
|
226
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
227
|
+
className: "dtable-ui-file-editor-previewer"
|
|
228
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
229
|
+
className: "dtable-ui-file-editor-previewer-wrapper"
|
|
230
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
231
|
+
className: "dtable-ui-file-editor-previewer-header d-flex align-items-center"
|
|
232
|
+
}, selectedFilesList.length > 0 ? /*#__PURE__*/_react.default.createElement("span", {
|
|
233
|
+
className: "dtable-ui-file-editor-count-content"
|
|
234
|
+
}, selectedFilesList.length === 1 ? (0, _lang.getLocale)('1_file_selected') : (0, _lang.getLocale)('Selected_xxx_files', {
|
|
235
|
+
count: selectedFilesList.length
|
|
236
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
237
|
+
className: "dtable-ui-file-editor-count-content"
|
|
238
|
+
}, value.length <= 1 ? (0, _lang.getLocale)('xxx_existing_file', {
|
|
239
|
+
count: value.length
|
|
240
|
+
}) : (0, _lang.getLocale)('xxx_existing_files', {
|
|
241
|
+
count: value.length
|
|
242
|
+
})), this.renderFilesOperation()), /*#__PURE__*/_react.default.createElement("div", {
|
|
243
|
+
className: "dtable-ui-file-editor-previewer-content"
|
|
244
|
+
}, value.length > 0 && value.map((fileItem, index) => {
|
|
245
|
+
const isSelected = selectedFilesList.indexOf(fileItem.name) === -1 ? false : true;
|
|
246
|
+
return /*#__PURE__*/_react.default.createElement(_filePreviewer.default, {
|
|
247
|
+
key: fileItem.url,
|
|
248
|
+
fileItem: fileItem,
|
|
249
|
+
deleteFile: this.props.deleteFile,
|
|
250
|
+
renameFile: this.props.renameFile,
|
|
251
|
+
freezeItem: this.freezeItem,
|
|
252
|
+
unFreezeItem: this.unFreezeItem,
|
|
253
|
+
isItemFreezed: this.state.isItemFreezed,
|
|
254
|
+
itemIndex: index,
|
|
255
|
+
isSelected: isSelected,
|
|
256
|
+
showLargeImage: this.showLargeImage,
|
|
257
|
+
onSelectFiles: this.onSelectFiles,
|
|
258
|
+
isSelectMultipleFiles: isSelectMultipleFiles,
|
|
259
|
+
downloadFile: getDownLoadFiles ? this.downloadImage : null
|
|
260
|
+
});
|
|
261
|
+
}))), this.state.isShowLargeImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
|
|
262
|
+
imageItems: this.state.fileImageUrlList,
|
|
263
|
+
imageIndex: this.state.largeImageIndex,
|
|
264
|
+
closeImagePopup: this.hideLargeImage,
|
|
265
|
+
moveToPrevImage: this.movePrev,
|
|
266
|
+
moveToNextImage: this.moveNext,
|
|
267
|
+
deleteImage: this.deleteImage,
|
|
268
|
+
downloadImage: this.downloadImage,
|
|
269
|
+
onRotateImage: this.onRotateImage
|
|
270
|
+
}), /*#__PURE__*/_react.default.createElement(_DTableCommonAddTool.default, {
|
|
271
|
+
className: "dtable-ui-file-editor-previewer-add-btn",
|
|
272
|
+
callBack: this.togglePreviewer,
|
|
273
|
+
footerName: (0, _lang.getLocale)('Add_files')
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
var _default = exports.default = FilesPreviewer;
|
package/lib/FileEditor/index.js
CHANGED
|
@@ -7,21 +7,268 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _filesPreviewer = _interopRequireDefault(require("./files-previewer"));
|
|
11
|
+
var _additionPreviewer = _interopRequireDefault(require("./addition-previewer"));
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
var _DTableModalHeader = _interopRequireDefault(require("../DTableModalHeader"));
|
|
10
14
|
var _lang = require("../lang");
|
|
11
|
-
var
|
|
15
|
+
var _constants2 = require("./constants");
|
|
16
|
+
var _utils = require("../utils/utils");
|
|
17
|
+
var _toaster = _interopRequireDefault(require("../toaster"));
|
|
18
|
+
require("./index.css");
|
|
12
19
|
class FileEditor extends _react.default.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
var _this;
|
|
22
|
+
super(props);
|
|
23
|
+
_this = this;
|
|
24
|
+
this.getValue = () => {
|
|
25
|
+
return this.state.value;
|
|
26
|
+
};
|
|
27
|
+
this.getEditorView = () => {
|
|
28
|
+
const {
|
|
29
|
+
isInModal,
|
|
30
|
+
value
|
|
31
|
+
} = this.props;
|
|
32
|
+
return !value || value.length === 0 || isInModal ? _constants.FILE_EDITOR_STATUS.ADDITION : _constants.FILE_EDITOR_STATUS.PREVIEWER;
|
|
33
|
+
};
|
|
34
|
+
this.deleteImage = function (index) {
|
|
35
|
+
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
36
|
+
let uploadLocalFileValue = _this.state.uploadLocalFileValue.slice(0);
|
|
37
|
+
let value = _this.state.value.slice(0);
|
|
38
|
+
if (_this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
|
|
39
|
+
value.splice(index, 1);
|
|
40
|
+
} else {
|
|
41
|
+
if (type === 'localPicture') {
|
|
42
|
+
uploadLocalFileValue.splice(index, 1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_this.setState({
|
|
46
|
+
uploadLocalFileValue: uploadLocalFileValue,
|
|
47
|
+
isUpdated: true,
|
|
48
|
+
value: value
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
this.resetAdditionImage = () => {
|
|
52
|
+
this.setState({
|
|
53
|
+
uploadLocalFileValue: [],
|
|
54
|
+
imageLinkValue: []
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
this.toggle = e => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
if (this.state.isOpen && this.state.isUpdated) {
|
|
60
|
+
if (this.state.editorView === _constants.FILE_EDITOR_STATUS.ADDITION) {
|
|
61
|
+
let {
|
|
62
|
+
value,
|
|
63
|
+
uploadLocalFileValue
|
|
64
|
+
} = this.state;
|
|
65
|
+
let newValue = value.concat(uploadLocalFileValue);
|
|
66
|
+
this.setState({
|
|
67
|
+
value: newValue
|
|
68
|
+
}, () => {
|
|
69
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onCommit();
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onCommit();
|
|
74
|
+
}
|
|
75
|
+
if (this.props.isInModal) {
|
|
76
|
+
this.props.onToggle();
|
|
77
|
+
}
|
|
78
|
+
const nextIsOpen = !this.state.isOpen;
|
|
79
|
+
this.setState({
|
|
80
|
+
isOpen: nextIsOpen
|
|
81
|
+
}, () => {
|
|
82
|
+
if (!nextIsOpen) {
|
|
83
|
+
this.props.onCommitCancel && this.props.onCommitCancel();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
this.closeEditor = () => {
|
|
88
|
+
this.setState({
|
|
89
|
+
isOpen: false
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this.togglePreviewer = type => {
|
|
93
|
+
this.setState({
|
|
94
|
+
editorView: type
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
this.fileUploadCompleted = fileMessage => {
|
|
98
|
+
let uploadLocalFileValue = this.state.uploadLocalFileValue.slice(0);
|
|
99
|
+
let fileUploadMessage = {
|
|
100
|
+
name: fileMessage.name,
|
|
101
|
+
size: fileMessage.size,
|
|
102
|
+
type: fileMessage.type,
|
|
103
|
+
url: fileMessage.url,
|
|
104
|
+
upload_time: fileMessage.upload_time
|
|
105
|
+
};
|
|
106
|
+
uploadLocalFileValue.push(fileUploadMessage);
|
|
107
|
+
this.setState({
|
|
108
|
+
uploadLocalFileValue: uploadLocalFileValue,
|
|
109
|
+
isUpdated: true
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
this.addUploadedFile = fileMessageList => {
|
|
113
|
+
const uploadLocalFileValue = [...this.state.uploadLocalFileValue, ...fileMessageList.map(_ref => {
|
|
114
|
+
let {
|
|
115
|
+
name,
|
|
116
|
+
size,
|
|
117
|
+
type,
|
|
118
|
+
url,
|
|
119
|
+
mtime
|
|
120
|
+
} = _ref;
|
|
121
|
+
return {
|
|
122
|
+
name,
|
|
123
|
+
size,
|
|
124
|
+
type: type || 'file',
|
|
125
|
+
url,
|
|
126
|
+
upload_time: mtime
|
|
127
|
+
};
|
|
128
|
+
})];
|
|
129
|
+
this.setState({
|
|
130
|
+
uploadLocalFileValue,
|
|
131
|
+
isUpdated: true
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
this.renderHeader = () => {
|
|
135
|
+
let {
|
|
136
|
+
editorView
|
|
137
|
+
} = this.state;
|
|
138
|
+
// if (this.props.isInModal) {
|
|
139
|
+
// return (<span>{getLocale('Add_files')}</span>);
|
|
140
|
+
// }
|
|
141
|
+
if (editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('All_files'));
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
onClick: this.showImageListPreviewer
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
147
|
+
"aria-hidden": "true",
|
|
148
|
+
className: "dtable-font dtable-icon-return mr-2"
|
|
149
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Add_files')));
|
|
150
|
+
};
|
|
151
|
+
this.showImageListPreviewer = () => {
|
|
152
|
+
let {
|
|
153
|
+
value,
|
|
154
|
+
uploadLocalFileValue,
|
|
155
|
+
imageLinkValue
|
|
156
|
+
} = this.state;
|
|
157
|
+
let newValue = value.concat(uploadLocalFileValue, imageLinkValue);
|
|
158
|
+
this.setState({
|
|
159
|
+
value: newValue
|
|
160
|
+
});
|
|
161
|
+
this.togglePreviewer(_constants.FILE_EDITOR_STATUS.PREVIEWER);
|
|
162
|
+
};
|
|
163
|
+
this.uploadFile = (file, callback) => {
|
|
164
|
+
return this.props.uploadFile(file, _constants2.FILES_FOLDER, callback);
|
|
165
|
+
};
|
|
166
|
+
this.resetFileValue = () => {
|
|
167
|
+
this.setState({
|
|
168
|
+
uploadLocalFileValue: []
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
this.deleteFile = (index, type) => {
|
|
172
|
+
let uploadLocalFileValue = this.state.uploadLocalFileValue.slice(0);
|
|
173
|
+
let value = this.state.value.slice(0);
|
|
174
|
+
if (this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
|
|
175
|
+
value.splice(index, 1);
|
|
176
|
+
} else {
|
|
177
|
+
if (type === 'localFile') {
|
|
178
|
+
uploadLocalFileValue.splice(index, 1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
this.setState({
|
|
182
|
+
uploadLocalFileValue: uploadLocalFileValue,
|
|
183
|
+
isUpdated: true,
|
|
184
|
+
value: value
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
this.deleteFilesByPreviewer = fileList => {
|
|
188
|
+
const result = this.state.value.filter(file => !fileList.includes(file.name));
|
|
189
|
+
this.setState({
|
|
190
|
+
isUpdated: true,
|
|
191
|
+
value: result
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
this.onRenameFile = (index, newName) => {
|
|
195
|
+
let newValue = this.state.value.slice(0);
|
|
196
|
+
let fileItem = newValue[index];
|
|
197
|
+
if (!this.props.renameFile) return;
|
|
198
|
+
this.props.renameFile(fileItem, newName).then(res => {
|
|
199
|
+
const {
|
|
200
|
+
name,
|
|
201
|
+
url
|
|
202
|
+
} = res.data;
|
|
203
|
+
fileItem = {
|
|
204
|
+
...fileItem,
|
|
205
|
+
name,
|
|
206
|
+
url
|
|
207
|
+
};
|
|
208
|
+
newValue[index] = fileItem;
|
|
209
|
+
this.setState({
|
|
210
|
+
value: newValue
|
|
211
|
+
});
|
|
212
|
+
}).catch(error => {
|
|
213
|
+
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
214
|
+
if (!error.response || error.response.status !== 403) {
|
|
215
|
+
_toaster.default.danger((0, _lang.getLocale)(errorMessage));
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
this.onRotateImage = (url, degree) => {
|
|
220
|
+
this.props.rotateImage(url, degree).then(res => {
|
|
221
|
+
// todo
|
|
222
|
+
}).catch(error => {
|
|
223
|
+
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
224
|
+
if (!error.response || error.response.status !== 403) {
|
|
225
|
+
_toaster.default.danger((0, _lang.getLocale)(errorMessage));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
this.state = {
|
|
230
|
+
value: props.value || [],
|
|
231
|
+
editorView: this.getEditorView(),
|
|
232
|
+
isOpen: true,
|
|
233
|
+
isShowFileChooser: false,
|
|
234
|
+
uploadLocalFileValue: [],
|
|
235
|
+
imageLinkValue: [],
|
|
236
|
+
isUpdated: false
|
|
237
|
+
};
|
|
238
|
+
}
|
|
13
239
|
render() {
|
|
14
|
-
let {
|
|
15
|
-
closeEditor
|
|
16
|
-
} = this.props;
|
|
17
240
|
return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
toggle:
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
}))
|
|
241
|
+
className: "dtable-ui-image-editor-dialog dtable-ui-file-editor-dialog",
|
|
242
|
+
contentClassName: "dtable-ui-image-editor-modal",
|
|
243
|
+
isOpen: this.state.isOpen,
|
|
244
|
+
toggle: this.toggle
|
|
245
|
+
}, /*#__PURE__*/_react.default.createElement(_DTableModalHeader.default, {
|
|
246
|
+
toggle: this.toggle
|
|
247
|
+
}, this.renderHeader()), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
248
|
+
className: "p-0"
|
|
249
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
250
|
+
className: "dtable-ui-image-editor-container dtable-ui-file-editor-container"
|
|
251
|
+
}, this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER && /*#__PURE__*/_react.default.createElement(_filesPreviewer.default, {
|
|
252
|
+
value: this.state.value,
|
|
253
|
+
config: this.props.config,
|
|
254
|
+
togglePreviewer: this.togglePreviewer,
|
|
255
|
+
deleteFile: this.deleteFile,
|
|
256
|
+
deleteFiles: this.deleteFilesByPreviewer,
|
|
257
|
+
renameFile: this.props.renameFile ? this.onRenameFile : null,
|
|
258
|
+
resetFileValue: this.resetFileValue,
|
|
259
|
+
rotateImage: this.props.rotateImage ? this.onRotateImage : null,
|
|
260
|
+
getDownLoadFiles: this.props.getDownLoadFiles || (() => {})
|
|
261
|
+
}), this.state.editorView === _constants.FILE_EDITOR_STATUS.ADDITION && /*#__PURE__*/_react.default.createElement(_additionPreviewer.default, {
|
|
262
|
+
config: this.props.config,
|
|
263
|
+
deleteImage: this.deleteImage,
|
|
264
|
+
handleFilesChange: this.handleFilesChange,
|
|
265
|
+
uploadLocalFileValue: this.state.uploadLocalFileValue,
|
|
266
|
+
togglePreviewer: this.togglePreviewer,
|
|
267
|
+
fileUploadCompleted: this.fileUploadCompleted,
|
|
268
|
+
addUploadedFile: this.addUploadedFile,
|
|
269
|
+
showImageListPreviewer: this.showImageListPreviewer,
|
|
270
|
+
uploadFile: this.uploadFile
|
|
271
|
+
}))));
|
|
25
272
|
}
|
|
26
273
|
}
|
|
27
274
|
var _default = exports.default = FileEditor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getFileUploadTime = exports.bytesToSize = void 0;
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
const getFileUploadTime = file => {
|
|
10
|
+
return file.upload_time ? (0, _dayjs.default)(file.upload_time).format('YYYY-MM-DD HH:mm') : '';
|
|
11
|
+
};
|
|
12
|
+
exports.getFileUploadTime = getFileUploadTime;
|
|
13
|
+
const bytesToSize = bytes => {
|
|
14
|
+
if (typeof bytes == 'undefined') return ' ';
|
|
15
|
+
if (bytes < 0) return '--';
|
|
16
|
+
const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
17
|
+
if (bytes === 0) return bytes + ' ' + sizes[0];
|
|
18
|
+
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)), 10);
|
|
19
|
+
if (i === 0) return bytes + ' ' + sizes[i];
|
|
20
|
+
return (bytes / 1000 ** i).toFixed(1) + ' ' + sizes[i];
|
|
21
|
+
};
|
|
22
|
+
exports.bytesToSize = bytesToSize;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports.default = FileItemFormatter;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _url = require("../utils/url");
|
|
10
|
+
const FileItemFormatter = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
file,
|
|
13
|
+
config
|
|
14
|
+
} = _ref;
|
|
15
|
+
const {
|
|
16
|
+
fileIconUrl,
|
|
17
|
+
isImage
|
|
18
|
+
} = (0, _url.getFileThumbnailInfo)(file, config);
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("img", {
|
|
20
|
+
className: "file-item-icon ".concat(isImage ? 'img' : ''),
|
|
21
|
+
src: fileIconUrl,
|
|
22
|
+
alt: (file === null || file === void 0 ? void 0 : file.name) || ''
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = FileItemFormatter;
|