tenjin-ui-kit 0.2.170 → 0.2.171
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.
|
@@ -55,7 +55,7 @@ var FileUploader = function FileUploader(props) {
|
|
|
55
55
|
var selectedFile = e.target.files[0];
|
|
56
56
|
if (selectedFile) {
|
|
57
57
|
var _selectedFile$name, _selectedFile$name$sp, _selectedFile$name$sp2;
|
|
58
|
-
var excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg"];
|
|
58
|
+
var excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
59
59
|
var fileExtension = selectedFile === null || selectedFile === void 0 ? void 0 : (_selectedFile$name = selectedFile.name) === null || _selectedFile$name === void 0 ? void 0 : (_selectedFile$name$sp = _selectedFile$name.split(".")) === null || _selectedFile$name$sp === void 0 ? void 0 : (_selectedFile$name$sp2 = _selectedFile$name$sp.pop()) === null || _selectedFile$name$sp2 === void 0 ? void 0 : _selectedFile$name$sp2.toLowerCase();
|
|
60
60
|
if (excludedExtensions.some(function (ext) {
|
|
61
61
|
return selectedFile.name.endsWith(ext);
|
|
@@ -70,7 +70,21 @@ var FileUploader = function FileUploader(props) {
|
|
|
70
70
|
var handleDrop = function handleDrop(e) {
|
|
71
71
|
e.preventDefault();
|
|
72
72
|
e.stopPropagation();
|
|
73
|
-
setSelectedFile(e.dataTransfer.files);
|
|
73
|
+
// setSelectedFile(e.dataTransfer.files);
|
|
74
|
+
var droppedFiles = e.dataTransfer.files;
|
|
75
|
+
if (droppedFiles.length > 0) {
|
|
76
|
+
var _droppedFiles$, _droppedFiles$$name, _droppedFiles$$name$s, _droppedFiles$$name$s2;
|
|
77
|
+
var excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
78
|
+
var fileExtension = (_droppedFiles$ = droppedFiles[0]) === null || _droppedFiles$ === void 0 ? void 0 : (_droppedFiles$$name = _droppedFiles$.name) === null || _droppedFiles$$name === void 0 ? void 0 : (_droppedFiles$$name$s = _droppedFiles$$name.split(".")) === null || _droppedFiles$$name$s === void 0 ? void 0 : (_droppedFiles$$name$s2 = _droppedFiles$$name$s.pop()) === null || _droppedFiles$$name$s2 === void 0 ? void 0 : _droppedFiles$$name$s2.toLowerCase();
|
|
79
|
+
if (excludedExtensions !== null && excludedExtensions !== void 0 && excludedExtensions.some(function (ext) {
|
|
80
|
+
var _droppedFiles$2, _droppedFiles$2$name;
|
|
81
|
+
return (_droppedFiles$2 = droppedFiles[0]) === null || _droppedFiles$2 === void 0 ? void 0 : (_droppedFiles$2$name = _droppedFiles$2.name) === null || _droppedFiles$2$name === void 0 ? void 0 : _droppedFiles$2$name.endsWith(ext);
|
|
82
|
+
})) {
|
|
83
|
+
alert("Selected file type .".concat(fileExtension, " is not allowed."));
|
|
84
|
+
} else {
|
|
85
|
+
setSelectedFile(droppedFiles);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
74
88
|
};
|
|
75
89
|
var handleDragOver = function handleDragOver(e) {
|
|
76
90
|
e.preventDefault();
|