tenjin-ui-kit 0.2.189 → 0.2.191
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.
|
@@ -56,12 +56,18 @@ var FileUploader = function FileUploader(props) {
|
|
|
56
56
|
if (selectedFile) {
|
|
57
57
|
var _selectedFile$name, _selectedFile$name$sp, _selectedFile$name$sp2;
|
|
58
58
|
var excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
59
|
+
var includedExtensions = [".xlsx", ".xls", ".csv", ".png", ".jpg", ".txt", ".pdf", ".doc", ".docx", ".ppt", ".yml", ".yaml"];
|
|
59
60
|
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
61
|
if (excludedExtensions.some(function (ext) {
|
|
61
62
|
return selectedFile.name.endsWith(ext);
|
|
62
63
|
})) {
|
|
63
64
|
alert("Selected file type .".concat(fileExtension, " is not allowed."));
|
|
64
65
|
e.target.value = null;
|
|
66
|
+
} else if (!includedExtensions.some(function (ext) {
|
|
67
|
+
return selectedFile.name.endsWith(ext);
|
|
68
|
+
})) {
|
|
69
|
+
alert("Selected file type .".concat(fileExtension, " is not supported."));
|
|
70
|
+
e.target.value = null;
|
|
65
71
|
} else {
|
|
66
72
|
e.target.files[0] && setSelectedFile(e.target.files);
|
|
67
73
|
}
|
|
@@ -75,12 +81,18 @@ var FileUploader = function FileUploader(props) {
|
|
|
75
81
|
if (droppedFiles.length > 0) {
|
|
76
82
|
var _droppedFiles$, _droppedFiles$$name, _droppedFiles$$name$s, _droppedFiles$$name$s2;
|
|
77
83
|
var excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
84
|
+
var includedExtensions = [".xlsx", ".xls", ".csv", ".png", ".jpg", ".txt", ".pdf", ".doc", ".docx", ".ppt", ".yml", ".yaml"];
|
|
78
85
|
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
86
|
if (excludedExtensions !== null && excludedExtensions !== void 0 && excludedExtensions.some(function (ext) {
|
|
80
87
|
var _droppedFiles$2, _droppedFiles$2$name;
|
|
81
88
|
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
89
|
})) {
|
|
83
90
|
alert("Selected file type .".concat(fileExtension, " is not allowed."));
|
|
91
|
+
} else if (!includedExtensions.some(function (ext) {
|
|
92
|
+
var _droppedFiles$3, _droppedFiles$3$name;
|
|
93
|
+
return (_droppedFiles$3 = droppedFiles[0]) === null || _droppedFiles$3 === void 0 ? void 0 : (_droppedFiles$3$name = _droppedFiles$3.name) === null || _droppedFiles$3$name === void 0 ? void 0 : _droppedFiles$3$name.endsWith(ext);
|
|
94
|
+
})) {
|
|
95
|
+
alert("Selected file type .".concat(fileExtension, " is not supported."));
|
|
84
96
|
} else {
|
|
85
97
|
setSelectedFile(droppedFiles);
|
|
86
98
|
}
|