fuse-importer 0.26.8 → 0.27.0
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/ImporterWithContext.js +2 -1
- package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +1 -0
- package/lib/esm/Importer/Review/ReviewContextProvider.js +59 -27
- package/lib/esm/Importer/Review/ReviewWithContext.js +2 -2
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +9 -12
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/filterMethods.js +9 -20
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.js +9 -1
- package/lib/esm/Importer/common/Spreadsheet/common/types.d.ts +1 -0
- package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/hooks.js +29 -9
- package/lib/esm/Importer/common/Spreadsheet/index.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/index.js +4 -10
- package/lib/esm/Importer/common/Spreadsheet/validation/index.js +8 -2
- package/lib/esm/Importer/data/index.js +3 -1
- package/lib/esm/common/AppLoadingContextProvider/AppLoadingUI.d.ts +1 -0
- package/lib/esm/common/AppLoadingContextProvider/AppLoadingUI.js +26 -0
- package/lib/esm/common/AppLoadingContextProvider/index.d.ts +10 -0
- package/lib/esm/common/AppLoadingContextProvider/index.js +25 -0
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +15 -27
- 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/esm/types.d.ts +4 -7
- package/lib/main.js +24 -24
- package/lib/main.js.LICENSE.txt +6 -1
- package/package.json +5 -5
package/lib/esm/index.js
CHANGED
|
@@ -45,17 +45,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
48
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
49
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
50
|
if (ar || !(i in from)) {
|
|
@@ -131,23 +120,22 @@ var FuseImporter = /** @class */ (function () {
|
|
|
131
120
|
});
|
|
132
121
|
});
|
|
133
122
|
};
|
|
134
|
-
FuseImporter.prototype.addColumn = function (
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
var transformations = (_b = options === null || options === void 0 ? void 0 : options.transformations) !== null && _b !== void 0 ? _b : [];
|
|
123
|
+
FuseImporter.prototype.addColumn = function (columnData) {
|
|
124
|
+
var column_type = columnData.column_type, internal_key = columnData.internal_key, label = columnData.label, required = columnData.required, pattern = columnData.pattern, position = columnData.position, transformations = columnData.transformations, unique = columnData.unique, validations = columnData.validations, values = columnData.values;
|
|
125
|
+
validateColumn(columnData);
|
|
126
|
+
var treatedValidations = __spreadArray(__spreadArray([], getDefaultValidations(column_type), true), (validations || []), true);
|
|
127
|
+
var treatedTransformations = transformations !== null && transformations !== void 0 ? transformations : [];
|
|
140
128
|
var column = {
|
|
141
|
-
column_type:
|
|
142
|
-
internal_key:
|
|
143
|
-
label:
|
|
144
|
-
required:
|
|
145
|
-
pattern:
|
|
146
|
-
position:
|
|
147
|
-
unique:
|
|
148
|
-
values:
|
|
149
|
-
validations:
|
|
150
|
-
transformations:
|
|
129
|
+
column_type: column_type,
|
|
130
|
+
internal_key: internal_key,
|
|
131
|
+
label: label,
|
|
132
|
+
required: required,
|
|
133
|
+
pattern: pattern || null,
|
|
134
|
+
position: position || null,
|
|
135
|
+
unique: unique || false,
|
|
136
|
+
values: column_type === "enum" ? values || [] : [],
|
|
137
|
+
validations: treatedValidations,
|
|
138
|
+
transformations: treatedTransformations,
|
|
151
139
|
};
|
|
152
140
|
this.dynamicColumns.push(column);
|
|
153
141
|
};
|
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 .csv
|
|
28
|
+
description: "\n Laden Sie eine beliebige beliebige .csv-Datei mit einem beliebigen Satz von\n 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
|
|
28
|
+
description: "\n Upload any .csv 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
|
|
28
|
+
description: "\n Cargue cualquier archivo .csv 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 n'importe quel fichier .csv 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
|
},
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -141,13 +141,14 @@ export type Field = {
|
|
|
141
141
|
validations?: FieldValidation[];
|
|
142
142
|
transformations?: FieldTransformation[];
|
|
143
143
|
};
|
|
144
|
-
export type ColumnRequiredProps<T extends FieldTypesAsUnion> = {
|
|
144
|
+
export type ColumnRequiredProps<T extends FieldTypesAsUnion> = Partial<Pick<TemplateHeader, "unique" | "position" | "pattern">> & {
|
|
145
145
|
internal_key: string;
|
|
146
146
|
label: string;
|
|
147
147
|
column_type: T;
|
|
148
148
|
required: boolean;
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
validations?: ColumnValidations<T>[];
|
|
150
|
+
transformations?: ColumnTransformations<T>[];
|
|
151
|
+
} & (T extends "enum" ? EnumOptions : T extends "time" ? TimeOptions : OtherOptions);
|
|
151
152
|
export type ValidationTypesRules<T extends FieldTypesAsUnion> = T extends "integer" ? IntegerValidationRule : T extends "float" ? FloatValidationRule : T extends "string" ? StringValidationRule : T extends "email" ? EmailValidationRule : T extends "enum" ? EnumValidationRule : T extends "url" ? UrlValidationRule : T extends "boolean" ? BooleanValidationRule : T extends "date" ? DateValidationRule : T extends "datetime" ? DateTimeValidationRule : T extends "time" ? TimeValidationRule : never;
|
|
152
153
|
export type TransformationTypesRules<T extends FieldTypesAsUnion> = T extends "integer" ? IntegerTransformationRule : T extends "float" ? FloatTransformationRule : T extends "string" ? StringTransformationRule : T extends "enum" ? EnumTransformationRule : T extends "url" ? UrlTransformationRule : T extends "date" | "datetime" | "time" ? DateDateTimesAndTimesTransformationRule : never;
|
|
153
154
|
export type ValidationTypeOptions<T extends ValidationTypesRules<FieldTypesAsUnion>> = T extends "cannot_contain" | "contain" | "regex" ? {
|
|
@@ -186,10 +187,6 @@ type TimeOptions = {
|
|
|
186
187
|
type OtherOptions = {
|
|
187
188
|
values?: never;
|
|
188
189
|
};
|
|
189
|
-
export type ColumnOptions<T extends FieldTypesAsUnion> = Partial<Pick<TemplateHeader, "unique" | "position" | "pattern">> & {
|
|
190
|
-
validations?: ColumnValidations<T>[];
|
|
191
|
-
transformations?: ColumnTransformations<T>[];
|
|
192
|
-
} & (T extends "enum" ? EnumOptions : T extends "time" ? TimeOptions : OtherOptions);
|
|
193
190
|
type StringValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
|
|
194
191
|
type StringTransformationRule = "sentence_case" | "capitalize" | "uppercase" | "lowercase" | "trim_whitespace";
|
|
195
192
|
type IntegerValidationRule = "less_than" | "greater_than" | "even" | "odd" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
|