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
|
@@ -6,26 +6,280 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
11
|
+
var _getEventTransfer = _interopRequireDefault(require("../utils/get-event-transfer"));
|
|
12
|
+
var _url = require("../utils/url");
|
|
13
|
+
require("./index.css");
|
|
14
|
+
_dayjs.default.extend(_utc.default);
|
|
15
|
+
const MAX_UPLOAD_FILES = 10;
|
|
9
16
|
class FileUploader extends _react.default.Component {
|
|
10
17
|
constructor(props) {
|
|
18
|
+
var _this2;
|
|
11
19
|
super(props);
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
_this2 = this;
|
|
21
|
+
this.onInputFile = e => {
|
|
22
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
};
|
|
25
|
+
this.uploadFileClick = () => {
|
|
26
|
+
this.uploadFileRef.click();
|
|
27
|
+
};
|
|
28
|
+
this.onDragEnter = e => {
|
|
29
|
+
const {
|
|
30
|
+
isSupportDragDrop,
|
|
31
|
+
updateParentTips
|
|
32
|
+
} = this.props;
|
|
33
|
+
if (isSupportDragDrop) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
this.enteredCounter++;
|
|
36
|
+
if (this.enteredCounter !== 0) {
|
|
37
|
+
updateParentTips(true);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.onDragOver = e => {
|
|
42
|
+
const {
|
|
43
|
+
isSupportDragDrop
|
|
44
|
+
} = this.props;
|
|
45
|
+
if (isSupportDragDrop) {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.onDragLeave = e => {
|
|
51
|
+
const {
|
|
52
|
+
isSupportDragDrop,
|
|
53
|
+
updateParentTips
|
|
54
|
+
} = this.props;
|
|
55
|
+
if (isSupportDragDrop) {
|
|
56
|
+
this.enteredCounter--;
|
|
57
|
+
if (this.enteredCounter === 0) {
|
|
58
|
+
updateParentTips(false);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.onDrop = event => {
|
|
63
|
+
const {
|
|
64
|
+
isSupportDragDrop,
|
|
65
|
+
updateParentTips,
|
|
66
|
+
onCellTipShow
|
|
67
|
+
} = this.props;
|
|
68
|
+
if (isSupportDragDrop) {
|
|
69
|
+
this.enteredCounter = 0;
|
|
70
|
+
updateParentTips(false);
|
|
71
|
+
let files = event.dataTransfer.files;
|
|
72
|
+
if (files.length === 0) {
|
|
73
|
+
if (onCellTipShow) onCellTipShow(-1);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.handleFilesChange(files);
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
this.onPaste = event => {
|
|
81
|
+
const {
|
|
82
|
+
isSupportPaste
|
|
83
|
+
} = this.props;
|
|
84
|
+
if (isSupportPaste) {
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
let cliperData = (0, _getEventTransfer.default)(event);
|
|
87
|
+
if (cliperData.files) {
|
|
88
|
+
let files = cliperData.files;
|
|
89
|
+
this.handleFilesChange(files, true);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
this.onMouseEnter = () => {
|
|
94
|
+
const {
|
|
95
|
+
updateParentTips,
|
|
96
|
+
uploadType
|
|
97
|
+
} = this.props;
|
|
98
|
+
if (uploadType === 'image') {
|
|
99
|
+
if (updateParentTips) updateParentTips(true, uploadType);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
this.onMouseLeave = () => {
|
|
103
|
+
const {
|
|
104
|
+
updateParentTips,
|
|
105
|
+
uploadType
|
|
106
|
+
} = this.props;
|
|
107
|
+
if (uploadType === 'image') {
|
|
108
|
+
if (updateParentTips) updateParentTips(false, uploadType);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
this.uploadFilesChange = event => {
|
|
112
|
+
this.handleFilesChange(event.target.files);
|
|
113
|
+
};
|
|
114
|
+
this.handleFilesChange = function (files) {
|
|
115
|
+
let isPasteUpload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
116
|
+
const _this = _this2;
|
|
117
|
+
const {
|
|
118
|
+
uploadType,
|
|
119
|
+
updateUploadFileList,
|
|
120
|
+
onCellTipShow
|
|
121
|
+
} = _this2.props;
|
|
122
|
+
let uploadFileList = [];
|
|
123
|
+
let dealFileCnt = 0;
|
|
124
|
+
let allFileLen = files.length;
|
|
125
|
+
function checkLoadFinish() {
|
|
126
|
+
if (dealFileCnt === allFileLen - 1) {
|
|
127
|
+
if (uploadFileList.length === 0) {
|
|
128
|
+
if (onCellTipShow) onCellTipShow(uploadFileList.length);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (updateUploadFileList) updateUploadFileList(uploadFileList);
|
|
132
|
+
_this.uploadFilesInBatch(uploadFileList);
|
|
133
|
+
}
|
|
134
|
+
dealFileCnt++;
|
|
135
|
+
}
|
|
136
|
+
for (let i = 0; i < allFileLen; i++) {
|
|
137
|
+
let file = files[i];
|
|
138
|
+
if (isPasteUpload && file.name === 'image.png') {
|
|
139
|
+
let newName = "image-".concat((0, _dayjs.default)().format('YYYY-MM-DD-HH-mm'), ".png");
|
|
140
|
+
file = new File([file], newName, {
|
|
141
|
+
type: file.type
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
let fileReader = new FileReader();
|
|
146
|
+
fileReader.readAsDataURL(file);
|
|
147
|
+
fileReader.addEventListener('load', function (event) {
|
|
148
|
+
let isImage = /image/i.test(file.type);
|
|
149
|
+
if (uploadType === 'file' || isImage) {
|
|
150
|
+
let uploadFileItem = {
|
|
151
|
+
name: file.name,
|
|
152
|
+
fileIconUrl: isImage ? event.target.result : (0, _url.getFileIconUrl)(file.name, file.type),
|
|
153
|
+
isUploading: true,
|
|
154
|
+
isErrorTip: false,
|
|
155
|
+
file: file,
|
|
156
|
+
size: file.size,
|
|
157
|
+
url: '',
|
|
158
|
+
type: uploadType === 'file' ? 'file' : '',
|
|
159
|
+
percent: 0
|
|
160
|
+
};
|
|
161
|
+
uploadFileList.push(uploadFileItem);
|
|
162
|
+
}
|
|
163
|
+
checkLoadFinish();
|
|
164
|
+
}, false);
|
|
165
|
+
fileReader.addEventListener('error', function (e) {
|
|
166
|
+
checkLoadFinish();
|
|
167
|
+
}, false);
|
|
168
|
+
} catch (event) {
|
|
169
|
+
checkLoadFinish();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
this.uploadFilesInBatch = files => {
|
|
174
|
+
const fileUploadPromises = [];
|
|
175
|
+
const length = MAX_UPLOAD_FILES + this.start > files.length ? files.length : MAX_UPLOAD_FILES + this.start;
|
|
176
|
+
for (let i = this.start; i < length; i++) {
|
|
177
|
+
let file = files[i];
|
|
178
|
+
fileUploadPromises.push(this.createPromise(file));
|
|
179
|
+
}
|
|
180
|
+
this.uploadFilesPromise(fileUploadPromises, files);
|
|
181
|
+
};
|
|
182
|
+
this.uploadFilesPromise = (fileUploadPromises, files) => {
|
|
183
|
+
Promise.all(fileUploadPromises).then(res => {
|
|
184
|
+
this.start += MAX_UPLOAD_FILES;
|
|
185
|
+
if (this.start + MAX_UPLOAD_FILES - files.length >= 10) {
|
|
186
|
+
this.start = 0;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.uploadFilesInBatch(files);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
this.handleFileChange = (fileMessage, callback) => {
|
|
193
|
+
const {
|
|
194
|
+
onFileUploadFailed
|
|
195
|
+
} = this.props;
|
|
196
|
+
this.uploadFile(fileMessage).then(res => {
|
|
197
|
+
const data = res;
|
|
198
|
+
this.uploadFileMessage({
|
|
199
|
+
data,
|
|
200
|
+
fileMessage
|
|
201
|
+
});
|
|
202
|
+
callback && callback();
|
|
203
|
+
}).catch(error => {
|
|
204
|
+
fileMessage.isErrorTip = true;
|
|
205
|
+
fileMessage.error = error;
|
|
206
|
+
if (onFileUploadFailed) onFileUploadFailed(fileMessage);
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
this.createPromise = fileMessage => {
|
|
210
|
+
const _this = this;
|
|
211
|
+
return new Promise(function (resolve, reject) {
|
|
212
|
+
_this.handleFileChange(fileMessage, resolve);
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
this.uploadFileMessage = _ref => {
|
|
216
|
+
let {
|
|
217
|
+
data = {},
|
|
218
|
+
fileMessage
|
|
219
|
+
} = _ref;
|
|
220
|
+
fileMessage.name = data.name;
|
|
221
|
+
fileMessage.isUploading = false;
|
|
222
|
+
fileMessage.size = data.size;
|
|
223
|
+
fileMessage.url = data.url;
|
|
224
|
+
fileMessage.upload_time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
|
225
|
+
this.props.onFileUploadSuccess(fileMessage);
|
|
226
|
+
};
|
|
227
|
+
this.uploadFile = fileMessage => {
|
|
228
|
+
return this.props.uploadFile(fileMessage.file, event => this.onUploadProgress(event, fileMessage));
|
|
229
|
+
};
|
|
230
|
+
this.reuploadFile = fileMessage => {
|
|
231
|
+
fileMessage.isErrorTip = false;
|
|
232
|
+
this.handleFileChange(fileMessage);
|
|
233
|
+
};
|
|
234
|
+
this.onUploadProgress = (event, fileMessage) => {
|
|
235
|
+
const {
|
|
236
|
+
onFileUploadProgress
|
|
237
|
+
} = this.props;
|
|
238
|
+
let uploadPercent = Math.floor(event.loaded / event.total * 100);
|
|
239
|
+
fileMessage.percent = uploadPercent;
|
|
240
|
+
if (onFileUploadProgress) onFileUploadProgress(fileMessage);
|
|
241
|
+
};
|
|
242
|
+
this.enteredCounter = 0; // Determine whether to enter the child element to avoid dragging bubbling bugs。
|
|
243
|
+
this.start = 0;
|
|
244
|
+
}
|
|
245
|
+
componentWillUnmount() {
|
|
246
|
+
// prevent async operation
|
|
247
|
+
this.setState = (state, callback) => {
|
|
248
|
+
return;
|
|
249
|
+
};
|
|
23
250
|
}
|
|
24
251
|
render() {
|
|
25
|
-
|
|
252
|
+
const {
|
|
253
|
+
uploadType
|
|
254
|
+
} = this.props;
|
|
255
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
256
|
+
onDragEnter: this.onDragEnter,
|
|
257
|
+
onDragOver: this.onDragOver,
|
|
258
|
+
onDragLeave: this.onDragLeave,
|
|
259
|
+
onDrop: this.onDrop,
|
|
260
|
+
onPaste: this.onPaste,
|
|
261
|
+
onMouseEnter: this.onMouseEnter,
|
|
262
|
+
onMouseLeave: this.onMouseLeave,
|
|
263
|
+
onClick: this.uploadFileClick,
|
|
264
|
+
className: this.props.className
|
|
265
|
+
}, this.props.children, uploadType === 'file' && /*#__PURE__*/_react.default.createElement("input", {
|
|
266
|
+
type: "file",
|
|
267
|
+
className: "dtable-ui-upload-image",
|
|
268
|
+
ref: ref => this.uploadFileRef = ref,
|
|
269
|
+
onClick: this.onInputFile,
|
|
270
|
+
onChange: this.uploadFilesChange,
|
|
271
|
+
value: "",
|
|
272
|
+
multiple: true
|
|
273
|
+
}), uploadType === 'image' && /*#__PURE__*/_react.default.createElement("input", {
|
|
26
274
|
type: "file",
|
|
27
|
-
|
|
28
|
-
|
|
275
|
+
className: "dtable-ui-upload-image",
|
|
276
|
+
accept: "image/*",
|
|
277
|
+
ref: ref => this.uploadFileRef = ref,
|
|
278
|
+
onClick: this.onInputFile,
|
|
279
|
+
onChange: this.uploadFilesChange,
|
|
280
|
+
value: "",
|
|
281
|
+
multiple: true
|
|
282
|
+
}));
|
|
29
283
|
}
|
|
30
284
|
}
|
|
31
285
|
var _default = exports.default = FileUploader;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _dtableUtils = require("dtable-utils");
|
|
8
8
|
const numberValidator = value => {
|
|
9
9
|
return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
|
|
10
10
|
};
|
|
@@ -15,22 +15,22 @@ const checkboxValidator = value => {
|
|
|
15
15
|
return typeof value === 'boolean';
|
|
16
16
|
};
|
|
17
17
|
const validators = {
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
18
|
+
[_dtableUtils.CellType.NUMBER]: numberValidator,
|
|
19
|
+
[_dtableUtils.CellType.RATE]: numberValidator,
|
|
20
|
+
[_dtableUtils.CellType.DURATION]: numberValidator,
|
|
21
|
+
[_dtableUtils.CellType.CHECKBOX]: checkboxValidator,
|
|
22
|
+
[_dtableUtils.CellType.TEXT]: textValidator,
|
|
23
|
+
[_dtableUtils.CellType.DATE]: textValidator,
|
|
24
|
+
[_dtableUtils.CellType.CTIME]: textValidator,
|
|
25
|
+
[_dtableUtils.CellType.MTIME]: textValidator,
|
|
26
|
+
[_dtableUtils.CellType.GEOLOCATION]: textValidator,
|
|
27
|
+
[_dtableUtils.CellType.AUTO_NUMBER]: textValidator,
|
|
28
|
+
[_dtableUtils.CellType.URL]: textValidator,
|
|
29
|
+
[_dtableUtils.CellType.EMAIL]: textValidator,
|
|
30
|
+
[_dtableUtils.FORMULA_RESULT_TYPE.DATE]: textValidator,
|
|
31
|
+
[_dtableUtils.FORMULA_RESULT_TYPE.STRING]: textValidator,
|
|
32
|
+
[_dtableUtils.FORMULA_RESULT_TYPE.NUMBER]: numberValidator,
|
|
33
|
+
[_dtableUtils.FORMULA_RESULT_TYPE.BOOL]: checkboxValidator
|
|
34
34
|
};
|
|
35
35
|
const cellValueValidator = (cellValue, type) => {
|
|
36
36
|
const validator = validators[type];
|
|
@@ -10,6 +10,7 @@ var _dtableUtils = require("dtable-utils");
|
|
|
10
10
|
var _baseFormatterConfig = _interopRequireDefault(require("../formatterConfig/base-formatter-config"));
|
|
11
11
|
var _TextFormatter = _interopRequireDefault(require("../TextFormatter"));
|
|
12
12
|
var _utils = require("./utils");
|
|
13
|
+
var _utils2 = require("../utils/utils");
|
|
13
14
|
var _cellValueValidator = _interopRequireDefault(require("./cell-value-validator"));
|
|
14
15
|
require("./index.css");
|
|
15
16
|
class FormulaFormatter extends _react.default.Component {
|
|
@@ -114,7 +115,7 @@ class FormulaFormatter extends _react.default.Component {
|
|
|
114
115
|
return /*#__PURE__*/_react.default.cloneElement(Formatter, {
|
|
115
116
|
...formatterProps
|
|
116
117
|
});
|
|
117
|
-
} else if ((0,
|
|
118
|
+
} else if ((0, _utils2.isFunction)(Formatter)) {
|
|
118
119
|
return /*#__PURE__*/_react.default.createElement(Formatter, formatterProps);
|
|
119
120
|
}
|
|
120
121
|
return /*#__PURE__*/_react.default.createElement(_TextFormatter.default, formatterProps);
|
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.convertValueToDtableLongTextValue = void 0;
|
|
8
8
|
exports.isArrayFormatColumn = isArrayFormatColumn;
|
|
9
|
-
exports.isFunction = void 0;
|
|
10
9
|
exports.isSimpleCellFormatter = isSimpleCellFormatter;
|
|
11
|
-
exports.openUrlLink = exports.isValidUrl = exports.isValidCellValue = void 0;
|
|
12
10
|
var _constants = require("../constants");
|
|
13
11
|
var _normalizeLongTextValue = _interopRequireDefault(require("../SimpleLongTextFormatter/normalize-long-text-value"));
|
|
14
12
|
function isSimpleCellFormatter(type) {
|
|
@@ -17,35 +15,6 @@ function isSimpleCellFormatter(type) {
|
|
|
17
15
|
function isArrayFormatColumn(columnType) {
|
|
18
16
|
return _constants.ARRAY_FORMAT_COLUMNS.includes(columnType);
|
|
19
17
|
}
|
|
20
|
-
const isFunction = functionToCheck => {
|
|
21
|
-
const getType = {};
|
|
22
|
-
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
23
|
-
};
|
|
24
|
-
exports.isFunction = isFunction;
|
|
25
|
-
const isValidCellValue = value => {
|
|
26
|
-
if (value === undefined) return false;
|
|
27
|
-
if (value === null) return false;
|
|
28
|
-
if (value === '') return false;
|
|
29
|
-
if (JSON.stringify(value) === '{}') return false;
|
|
30
|
-
if (JSON.stringify(value) === '[]') return false;
|
|
31
|
-
return true;
|
|
32
|
-
};
|
|
33
|
-
exports.isValidCellValue = isValidCellValue;
|
|
34
|
-
const isValidUrl = url => {
|
|
35
|
-
const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
|
|
36
|
-
return reg.test(url);
|
|
37
|
-
};
|
|
38
|
-
exports.isValidUrl = isValidUrl;
|
|
39
|
-
const openUrlLink = url => {
|
|
40
|
-
let a = document.createElement('a');
|
|
41
|
-
document.body.appendChild(a);
|
|
42
|
-
a.href = url;
|
|
43
|
-
a.target = '_blank';
|
|
44
|
-
a.rel = 'noopener noreferrer';
|
|
45
|
-
a.click();
|
|
46
|
-
document.body.removeChild(a);
|
|
47
|
-
};
|
|
48
|
-
exports.openUrlLink = openUrlLink;
|
|
49
18
|
const convertValueToDtableLongTextValue = value => {
|
|
50
19
|
const valueType = Object.prototype.toString.call(value);
|
|
51
20
|
if (value && valueType === '[object String]') {
|