fuse-importer 0.27.0 → 0.27.1
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/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +21 -6
- package/lib/esm/locales/de.js +1 -1
- package/lib/esm/locales/en.js +1 -1
- package/lib/esm/locales/es.js +1 -1
- package/lib/esm/locales/fr.js +1 -1
- package/lib/main.js +24 -24
- package/lib/main.js.LICENSE.txt +2 -0
- package/package.json +2 -1
|
@@ -25,6 +25,7 @@ import { Button } from "../../../common/buttons";
|
|
|
25
25
|
import { DragAndDropSvg, UploadIndicatorSvg } from "./backgrounds";
|
|
26
26
|
import { useTranslation } from "react-i18next";
|
|
27
27
|
import Papa from "papaparse";
|
|
28
|
+
import * as XLSX from "xlsx";
|
|
28
29
|
var DragAndDropCard = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 8px;\n margin-right: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n background: ", ";\n border: 1px dashed ", ";\n\n @media (max-width: 1050px) {\n padding: 24px;\n width: auto;\n }\n\n ", "\n"], ["\n border-radius: 8px;\n margin-right: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n background: ", ";\n border: 1px dashed ", ";\n\n @media (max-width: 1050px) {\n padding: 24px;\n width: auto;\n }\n\n ", "\n"])), function (props) { return (props.isDragActive ? "-10px" : "revert"); }, theme.colors.white, theme.colors.red50, function (props) {
|
|
29
30
|
return props.isDragActive && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n justify-content: center;\n "], ["\n background: ", ";\n border: 1px solid ", ";\n justify-content: center;\n "])), function (p) { return p.theme.colors.blue100; }, function (p) { return p.theme.colors.blue500; });
|
|
30
31
|
});
|
|
@@ -62,12 +63,26 @@ var ImporterDropzone = function () {
|
|
|
62
63
|
reader.onload = function (event) {
|
|
63
64
|
var _a;
|
|
64
65
|
var results = event.target.result;
|
|
66
|
+
var isCsvFile = file.type === "text/csv";
|
|
67
|
+
// rounded value to 20MB
|
|
68
|
+
var isLargeFile = file.size > 20000000;
|
|
65
69
|
var getDataFromFile = function (fileResults) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if (isCsvFile) {
|
|
71
|
+
var csvString = new TextDecoder().decode(fileResults instanceof ArrayBuffer
|
|
72
|
+
? fileResults
|
|
73
|
+
: new TextEncoder().encode(fileResults));
|
|
74
|
+
var data = Papa.parse(csvString).data;
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
var workBook = XLSX.read(fileResults, {
|
|
78
|
+
type: "array",
|
|
79
|
+
codepage: 65001,
|
|
80
|
+
raw: true,
|
|
81
|
+
dense: isLargeFile,
|
|
82
|
+
});
|
|
83
|
+
var workBookName = workBook.SheetNames[0];
|
|
84
|
+
var sheet = workBook.Sheets[workBookName];
|
|
85
|
+
return XLSX.utils.sheet_to_json(sheet, { header: 1, raw: false });
|
|
71
86
|
};
|
|
72
87
|
var fileData = getDataFromFile(results);
|
|
73
88
|
var headersCount = (_a = fileData[0]) === null || _a === void 0 ? void 0 : _a.length;
|
|
@@ -98,7 +113,7 @@ var ImporterDropzone = function () {
|
|
|
98
113
|
onDropRejected: onDropRejected,
|
|
99
114
|
noClick: true,
|
|
100
115
|
noKeyboard: true,
|
|
101
|
-
accept: ".csv",
|
|
116
|
+
accept: ".csv, .xls, .xlsx",
|
|
102
117
|
maxFiles: 1,
|
|
103
118
|
maxSize: 200000000, // 200MB
|
|
104
119
|
}), getRootProps = _b.getRootProps, getInputProps = _b.getInputProps, open = _b.open, isDragActive = _b.isDragActive;
|
package/lib/esm/locales/de.js
CHANGED
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
optional_headers: "Optionale Überschriften",
|
|
26
26
|
},
|
|
27
27
|
title: "Laden Sie eine Datei hoch, um Ihre Daten zu importieren",
|
|
28
|
-
description: "\n Laden Sie eine beliebige
|
|
28
|
+
description: "\n Laden Sie eine beliebige .csv, .xls, .xlsx-Tabellenkalkulationsdatei\n mit einem beliebigen Satz von Spalten hoch, solange es einen Datensatz pro Zeile enth\u00E4lt.\n ",
|
|
29
29
|
loading: {
|
|
30
30
|
title: "Hochladen...",
|
|
31
31
|
},
|
package/lib/esm/locales/en.js
CHANGED
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
optional_headers: "Optional Headers",
|
|
26
26
|
},
|
|
27
27
|
title: "Upload a File to Import your Data",
|
|
28
|
-
description: "\n Upload any .csv file with any set of\n columns as long as it has one record per row.\n ",
|
|
28
|
+
description: "\n Upload any .csv, .xls, .xlsx file with any set of\n columns as long as it has one record per row.\n ",
|
|
29
29
|
loading: {
|
|
30
30
|
title: "Uploading...",
|
|
31
31
|
},
|
package/lib/esm/locales/es.js
CHANGED
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
optional_headers: "Encabezados opcionales",
|
|
26
26
|
},
|
|
27
27
|
title: "Cargue un archivo para importar sus datos",
|
|
28
|
-
description: "\n Cargue cualquier archivo .csv con cualquier conjunto de\n columnas siempre y cuando tenga un registro por fila.\n ",
|
|
28
|
+
description: "\n Cargue cualquier archivo de hoja de c\u00E1lculo .csv, .xls, .xlsx con cualquier conjunto de\n columnas siempre y cuando tenga un registro por fila.\n ",
|
|
29
29
|
loading: {
|
|
30
30
|
title: "Cargando...",
|
|
31
31
|
},
|
package/lib/esm/locales/fr.js
CHANGED
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
optional_headers: "En-têtes facultatifs",
|
|
26
26
|
},
|
|
27
27
|
title: "Téléchargez un fichier pour importer vos données",
|
|
28
|
-
description: "\n T\u00E9l\u00E9chargez
|
|
28
|
+
description: "\n T\u00E9l\u00E9chargez tout fichier de tableur .csv, .xls, .xlsx avec n'importe quel ensemble de\n colonnes tant qu'il a une seule ligne par ligne.\n ",
|
|
29
29
|
loading: {
|
|
30
30
|
title: "Téléchargement en cours...",
|
|
31
31
|
},
|