fuse-importer 0.25.9 → 0.26.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.
Files changed (80) hide show
  1. package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +11 -1
  2. package/lib/esm/Importer/Review/ReviewWithContext.js +4 -8
  3. package/lib/esm/Importer/Uploader/HeadersPreview.js +5 -9
  4. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +3 -3
  5. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +35 -12
  6. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +28 -2
  7. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.d.ts +1 -2
  8. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +21 -10
  9. package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +4 -2
  10. package/lib/esm/Importer/common/Spreadsheet/hooks.js +5 -68
  11. package/lib/esm/Importer/common/Spreadsheet/index.d.ts +1 -2
  12. package/lib/esm/Importer/common/Spreadsheet/index.js +2 -2
  13. package/lib/esm/Importer/common/Spreadsheet/styles.d.ts +1 -1
  14. package/lib/esm/Importer/common/Spreadsheet/styles.js +2 -2
  15. package/lib/esm/Importer/common/index.js +1 -1
  16. package/lib/esm/Importer/common/utils.d.ts +4 -1
  17. package/lib/esm/Importer/common/utils.js +15 -4
  18. package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +2 -1
  19. package/lib/esm/Importer/contexts/ImporterContextProvider.js +27 -7
  20. package/lib/esm/Importer/data/index.d.ts +7 -2
  21. package/lib/esm/Importer/data/index.js +18 -10
  22. package/lib/esm/Importer/index.d.ts +3 -2
  23. package/lib/esm/Importer/index.js +2 -4
  24. package/lib/esm/common/Table/TableActions/DeleteSelectedRows.js +10 -25
  25. package/lib/esm/common/Table/TableActions/ExportData.js +3 -1
  26. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.d.ts +1 -0
  27. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.js +37 -0
  28. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.styles.d.ts +6 -0
  29. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.styles.js +24 -0
  30. package/lib/esm/common/Table/TableActions/FilterByErrors/functions.d.ts +11 -0
  31. package/lib/esm/common/Table/TableActions/FilterByErrors/functions.js +35 -0
  32. package/lib/esm/common/Table/TableActions/FilterByErrors/index.d.ts +1 -0
  33. package/lib/esm/common/Table/TableActions/FilterByErrors/index.js +1 -0
  34. package/lib/esm/common/Table/TableActions/SearchRows.js +3 -1
  35. package/lib/esm/common/Table/TableActions/TableActions.js +2 -1
  36. package/lib/esm/common/Table/TableActions/TableActions.styles.js +1 -1
  37. package/lib/esm/common/Table/TableActions/hooks.d.ts +20 -0
  38. package/lib/esm/common/Table/TableActions/hooks.js +96 -0
  39. package/lib/esm/common/Table/TableView/TableHeaders.d.ts +6 -8
  40. package/lib/esm/common/Table/TableView/TableHeaders.js +15 -14
  41. package/lib/esm/common/Table/TableView/{TableRow.d.ts → TableRows/TableRow.d.ts} +5 -5
  42. package/lib/esm/common/Table/TableView/{TableRow.js → TableRows/TableRow.js} +9 -6
  43. package/lib/esm/common/Table/TableView/TableRows/index.d.ts +4 -0
  44. package/lib/esm/common/Table/TableView/{TableCells.js → TableRows/index.js} +13 -11
  45. package/lib/esm/common/Table/TableView/common/index.d.ts +5 -0
  46. package/lib/esm/common/Table/TableView/{common.js → common/index.js} +18 -5
  47. package/lib/esm/common/Table/TableView/index.d.ts +4 -39
  48. package/lib/esm/common/Table/TableView/index.js +48 -65
  49. package/lib/esm/common/Table/TableView/types.d.ts +37 -0
  50. package/lib/esm/common/Table/TableView/types.js +1 -0
  51. package/lib/esm/common/Table/index.d.ts +2 -2
  52. package/lib/esm/common/Table/index.js +20 -16
  53. package/lib/esm/common/columnsValidations.d.ts +45 -0
  54. package/lib/esm/common/columnsValidations.js +351 -0
  55. package/lib/esm/common/index.d.ts +1 -0
  56. package/lib/esm/common/index.js +1 -0
  57. package/lib/esm/common/inputs/Autocomplete.d.ts +2 -1
  58. package/lib/esm/common/inputs/Autocomplete.js +2 -2
  59. package/lib/esm/common/inputs/SelectMenu.d.ts +1 -1
  60. package/lib/esm/common/inputs/SelectMenu.js +17 -9
  61. package/lib/esm/index.d.ts +4 -1
  62. package/lib/esm/index.js +56 -10
  63. package/lib/esm/locales/de.d.ts +20 -0
  64. package/lib/esm/locales/de.js +20 -0
  65. package/lib/esm/locales/en.d.ts +20 -0
  66. package/lib/esm/locales/en.js +20 -0
  67. package/lib/esm/locales/es.d.ts +20 -0
  68. package/lib/esm/locales/es.js +20 -0
  69. package/lib/esm/locales/fr.d.ts +20 -0
  70. package/lib/esm/locales/fr.js +20 -0
  71. package/lib/esm/types.d.ts +53 -1
  72. package/lib/esm/types.js +31 -0
  73. package/lib/esm/utils/index.d.ts +10 -0
  74. package/lib/esm/utils/index.js +31 -0
  75. package/lib/main.js +23 -23
  76. package/package.json +3 -2
  77. package/lib/esm/Importer/useFullscreenOverlay.d.ts +0 -1
  78. package/lib/esm/Importer/useFullscreenOverlay.js +0 -14
  79. package/lib/esm/common/Table/TableView/TableCells.d.ts +0 -4
  80. package/lib/esm/common/Table/TableView/common.d.ts +0 -9
@@ -54,6 +54,26 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ confirmation_modal: string;
68
+ modal_title: string;
69
+ yes_delete: string;
70
+ select_rows: string;
71
+ delete_row: string;
72
+ };
73
+ export_your_data: {
74
+ tooltip: string;
75
+ };
76
+ };
57
77
  };
58
78
  general: {
59
79
  autocomplete: {
@@ -55,6 +55,26 @@ export default {
55
55
  manual_importer_title: "Enter Data & Submit",
56
56
  export: "Export",
57
57
  description: "Some cells in the document might have errors in format or missing information. Please review these to continue.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Search something",
61
+ placeholder: "Search something...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Search or select",
65
+ filter_by_errors: "Filter by errors",
66
+ },
67
+ delete_rows: {
68
+ confirmation_modal: "Are you sure you want to delete {{length}} row",
69
+ modal_title: "Delete Selected Row",
70
+ yes_delete: "Yes, delete",
71
+ select_rows: "Select rows to delete",
72
+ delete_row: "Delete Row",
73
+ },
74
+ export_your_data: {
75
+ tooltip: "Export your data",
76
+ },
77
+ },
58
78
  },
59
79
  general: {
60
80
  autocomplete: {
@@ -54,6 +54,26 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ confirmation_modal: string;
68
+ modal_title: string;
69
+ yes_delete: string;
70
+ select_rows: string;
71
+ delete_row: string;
72
+ };
73
+ export_your_data: {
74
+ tooltip: string;
75
+ };
76
+ };
57
77
  };
58
78
  general: {
59
79
  autocomplete: {
@@ -55,6 +55,26 @@ export default {
55
55
  manual_importer_title: "Ingresar Datos y Enviar",
56
56
  export: "Exportar",
57
57
  description: "Algunas celdas en el documento pueden tener errores en el formato o información faltante. Por favor revise esto para continuar.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Buscar algo",
61
+ placeholder: "Buscar algo...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Buscar o seleccionar",
65
+ filter_by_errors: "Filtrar por errores",
66
+ },
67
+ delete_rows: {
68
+ confirmation_modal: "¿Seguro que quieres eliminar {{length}} fila",
69
+ modal_title: "Eliminar la fila seleccionada",
70
+ yes_delete: "Sí, eliminar",
71
+ select_rows: "Seleccione las filas a eliminar",
72
+ delete_row: "Eliminar fila",
73
+ },
74
+ export_your_data: {
75
+ tooltip: "Exporta tus datos",
76
+ },
77
+ },
58
78
  },
59
79
  general: {
60
80
  autocomplete: {
@@ -54,6 +54,26 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ confirmation_modal: string;
68
+ modal_title: string;
69
+ yes_delete: string;
70
+ select_rows: string;
71
+ delete_row: string;
72
+ };
73
+ export_your_data: {
74
+ tooltip: string;
75
+ };
76
+ };
57
77
  };
58
78
  general: {
59
79
  autocomplete: {
@@ -55,6 +55,26 @@ export default {
55
55
  manual_importer_title: "Saisir Des Données et Envoyer",
56
56
  export: "Exporter",
57
57
  description: "Certaines cellules du document peuvent avoir des erreurs de format ou des informations manquantes. Veuillez les examiner pour continuer.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Rechercher quelque chose",
61
+ placeholder: "Rechercher quelque chose...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Rechercher ou sélectionner",
65
+ filter_by_errors: "Filtrer par erreurs",
66
+ },
67
+ delete_rows: {
68
+ confirmation_modal: "Voulez-vous vraiment supprimer {{length}} ligne",
69
+ modal_title: "Supprimer la ligne sélectionnée",
70
+ yes_delete: "Oui, supprimer",
71
+ select_rows: "Sélectionnez les lignes à supprimer",
72
+ delete_row: "Supprimer la ligne",
73
+ },
74
+ export_your_data: {
75
+ tooltip: "Exporter vos données",
76
+ },
77
+ },
58
78
  },
59
79
  general: {
60
80
  autocomplete: {
@@ -27,6 +27,7 @@ export declare enum FieldTypes {
27
27
  datetime = "datetime",
28
28
  time = "time"
29
29
  }
30
+ export type FieldTypesAsUnion = keyof typeof FieldTypes;
30
31
  export type SpreadsheetValidationErrors = {
31
32
  [rowId: string]: ValidationErrors;
32
33
  };
@@ -36,6 +37,7 @@ export type Meta = {
36
37
  isInvalid?: boolean;
37
38
  hasWarning?: boolean;
38
39
  touched?: boolean;
40
+ uploadedRow?: any;
39
41
  backendErrors?: ValidationErrors;
40
42
  };
41
43
  export type Record = {
@@ -67,7 +69,9 @@ export type AppResponse = {
67
69
  };
68
70
  export type OnSubmit = (reviewedData: Record[]) => Promise<AppResponse>;
69
71
  export type ValidationOptionKeys = "pattern" | "max_length" | "min_length" | "length" | "max" | "min";
70
- export type ValidationTypes = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex" | "integer" | "less_than" | "greater_than" | "even" | "odd" | "float" | "email" | "url" | "boolean" | "before_date" | "after_date";
72
+ export declare const validationTypesBase: readonly ["cannot_contain", "contain", "max_length", "min_length", "length_exactly", "unique_case_sensitive", "unique_case_insensitive", "regex", "integer", "less_than", "greater_than", "even", "odd", "float", "email", "url", "boolean", "before_date", "after_date"];
73
+ export declare const mutableValidationTypes: ("boolean" | "max_length" | "min_length" | "cannot_contain" | "contain" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex" | "integer" | "less_than" | "greater_than" | "even" | "odd" | "float" | "email" | "url" | "before_date" | "after_date")[];
74
+ export type ValidationTypes = typeof validationTypesBase[number];
71
75
  export interface FieldValidation {
72
76
  id?: number;
73
77
  validation_type?: ValidationTypes;
@@ -122,4 +126,52 @@ export type Field = {
122
126
  pattern?: string;
123
127
  validations?: FieldValidation[];
124
128
  };
129
+ export type ColumnRequiredProps<T extends FieldTypesAsUnion> = {
130
+ internal_key: string;
131
+ label: string;
132
+ column_type: T;
133
+ required: boolean;
134
+ options?: ColumnOptions<T>;
135
+ };
136
+ 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;
137
+ export type ValidationTypeOptions<T extends ValidationTypesRules<FieldTypesAsUnion>> = T extends "cannot_contain" | "contain" | "regex" ? {
138
+ pattern: string;
139
+ } : T extends "max_length" ? {
140
+ max_length: number;
141
+ } : T extends "min_length" ? {
142
+ min_length: number;
143
+ } : T extends "length_exactly" ? {
144
+ length: number;
145
+ } : T extends "less_than" | "before_date" ? {
146
+ max: string | number;
147
+ } : T extends "greater_than" | "after_date" ? {
148
+ min: string | number;
149
+ } : never;
150
+ export interface ColumnValidations<T extends FieldTypesAsUnion> {
151
+ validation_type: ValidationTypesRules<T>;
152
+ message: string;
153
+ options?: ValidationTypeOptions<ValidationTypesRules<T>>;
154
+ }
155
+ type EnumOptions = {
156
+ values: string[];
157
+ };
158
+ type TimeOptions = {
159
+ values?: never;
160
+ };
161
+ type OtherOptions = {
162
+ values?: never;
163
+ };
164
+ export type ColumnOptions<T extends FieldTypesAsUnion> = Partial<Pick<TemplateHeader, "unique" | "position" | "pattern">> & {
165
+ validations?: ColumnValidations<T>[];
166
+ } & (T extends "enum" ? EnumOptions : T extends "time" ? TimeOptions : OtherOptions);
167
+ type StringValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
168
+ type IntegerValidationRule = "less_than" | "greater_than" | "even" | "odd" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
169
+ type FloatValidationRule = "less_than" | "greater_than" | "even" | "odd" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
170
+ type EmailValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
171
+ type EnumValidationRule = "unique_case_sensitive" | "unique_case_insensitive";
172
+ type UrlValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
173
+ type BooleanValidationRule = "boolean";
174
+ type DateValidationRule = "unique_case_sensitive" | "unique_case_insensitive" | "before_date" | "after_date";
175
+ type DateTimeValidationRule = "unique_case_sensitive" | "unique_case_insensitive" | "before_date" | "after_date";
176
+ type TimeValidationRule = "unique_case_sensitive" | "unique_case_insensitive";
125
177
  export {};
package/lib/esm/types.js CHANGED
@@ -1,3 +1,12 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
1
10
  var EnvironmentTypes = [
2
11
  "local",
3
12
  "development",
@@ -17,3 +26,25 @@ export var FieldTypes;
17
26
  FieldTypes["datetime"] = "datetime";
18
27
  FieldTypes["time"] = "time";
19
28
  })(FieldTypes || (FieldTypes = {}));
29
+ export var validationTypesBase = [
30
+ "cannot_contain",
31
+ "contain",
32
+ "max_length",
33
+ "min_length",
34
+ "length_exactly",
35
+ "unique_case_sensitive",
36
+ "unique_case_insensitive",
37
+ "regex",
38
+ "integer",
39
+ "less_than",
40
+ "greater_than",
41
+ "even",
42
+ "odd",
43
+ "float",
44
+ "email",
45
+ "url",
46
+ "boolean",
47
+ "before_date",
48
+ "after_date",
49
+ ];
50
+ export var mutableValidationTypes = __spreadArray([], validationTypesBase, true);
@@ -1,2 +1,12 @@
1
+ import { ValidationTypes } from "../types";
1
2
  export declare const isString: (variable: any) => boolean;
2
3
  export declare const sleep: (n: number) => Promise<unknown>;
4
+ export declare const addLinkToHead: (document: Document, head: HTMLHeadElement, href: string, rel: string, crossOrigin?: string) => void;
5
+ export declare const addValidation: (value: ValidationTypes, label: string) => {
6
+ validation_type: any;
7
+ message: string;
8
+ };
9
+ export declare const getDefaultValidations: (columnType: string) => {
10
+ validation_type: any;
11
+ message: string;
12
+ }[];
@@ -4,3 +4,34 @@ export var isString = function (variable) {
4
4
  export var sleep = function (n) {
5
5
  return new Promise(function (resolve) { return setTimeout(resolve, n); });
6
6
  };
7
+ export var addLinkToHead = function (document, head, href, rel, crossOrigin) {
8
+ if (crossOrigin === void 0) { crossOrigin = ""; }
9
+ var link = document.createElement("link");
10
+ link.href = href;
11
+ link.rel = rel;
12
+ link.crossOrigin = crossOrigin;
13
+ head.appendChild(link);
14
+ };
15
+ // Add dynamic columns
16
+ export var addValidation = function (value, label) {
17
+ return {
18
+ validation_type: value,
19
+ message: label,
20
+ };
21
+ };
22
+ export var getDefaultValidations = function (columnType) {
23
+ switch (columnType) {
24
+ case "email":
25
+ return [addValidation("email", "Must be an email")];
26
+ case "url":
27
+ return [addValidation("url", "Must be a URL")];
28
+ case "boolean":
29
+ return [addValidation("boolean", "Must be True or False")];
30
+ case "integer":
31
+ return [addValidation("integer", "Must be an integer")];
32
+ case "float":
33
+ return [addValidation("float", "Must be a float")];
34
+ default:
35
+ return [];
36
+ }
37
+ };