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.
Files changed (28) hide show
  1. package/lib/esm/Importer/ImporterWithContext.js +2 -1
  2. package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +1 -0
  3. package/lib/esm/Importer/Review/ReviewContextProvider.js +59 -27
  4. package/lib/esm/Importer/Review/ReviewWithContext.js +2 -2
  5. package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +9 -12
  6. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/filterMethods.js +9 -20
  7. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.js +9 -1
  8. package/lib/esm/Importer/common/Spreadsheet/common/types.d.ts +1 -0
  9. package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +1 -1
  10. package/lib/esm/Importer/common/Spreadsheet/hooks.js +29 -9
  11. package/lib/esm/Importer/common/Spreadsheet/index.d.ts +1 -1
  12. package/lib/esm/Importer/common/Spreadsheet/index.js +4 -10
  13. package/lib/esm/Importer/common/Spreadsheet/validation/index.js +8 -2
  14. package/lib/esm/Importer/data/index.js +3 -1
  15. package/lib/esm/common/AppLoadingContextProvider/AppLoadingUI.d.ts +1 -0
  16. package/lib/esm/common/AppLoadingContextProvider/AppLoadingUI.js +26 -0
  17. package/lib/esm/common/AppLoadingContextProvider/index.d.ts +10 -0
  18. package/lib/esm/common/AppLoadingContextProvider/index.js +25 -0
  19. package/lib/esm/index.d.ts +1 -1
  20. package/lib/esm/index.js +15 -27
  21. package/lib/esm/locales/de.js +1 -1
  22. package/lib/esm/locales/en.js +1 -1
  23. package/lib/esm/locales/es.js +1 -1
  24. package/lib/esm/locales/fr.js +1 -1
  25. package/lib/esm/types.d.ts +4 -7
  26. package/lib/main.js +24 -24
  27. package/lib/main.js.LICENSE.txt +6 -1
  28. 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 (_a) {
135
- var _b;
136
- var options = _a.options, requiredProps = __rest(_a, ["options"]);
137
- validateColumn(__assign(__assign({}, options), requiredProps));
138
- var validations = __spreadArray(__spreadArray([], getDefaultValidations(requiredProps.column_type), true), ((options === null || options === void 0 ? void 0 : options.validations) || []), true);
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: requiredProps.column_type,
142
- internal_key: requiredProps.internal_key,
143
- label: requiredProps.label,
144
- required: requiredProps.required,
145
- pattern: (options === null || options === void 0 ? void 0 : options.pattern) || null,
146
- position: (options === null || options === void 0 ? void 0 : options.position) || null,
147
- unique: (options === null || options === void 0 ? void 0 : options.unique) || false,
148
- values: requiredProps.column_type === "enum" ? (options === null || options === void 0 ? void 0 : options.values) || [] : [],
149
- validations: validations,
150
- transformations: 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
  };
@@ -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, .tsv, .xls, .xlsx-Tabellenkalkulationsdatei mit einem beliebigen Satz von\n Spalten hoch, solange es einen Datensatz pro Zeile enth\u00E4lt.\n ",
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
  },
@@ -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, .tsv, .xls, .xlsx spreadsheet file with any set of\n columns as long as it has one record per row.\n ",
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
  },
@@ -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 de hoja de c\u00E1lculo .csv, .tsv, .xls, .xlsx con cualquier conjunto de\n columnas siempre y cuando tenga un registro por fila.\n ",
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
  },
@@ -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 tout fichier de tableur .csv, .tsv, .xls, .xlsx avec n'importe quel ensemble de\n colonnes tant qu'il a une seule ligne par ligne.\n ",
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
  },
@@ -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
- options?: ColumnOptions<T>;
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";