fuse-importer 0.25.5 → 0.25.6
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/Review/ReviewWithContext.js +2 -2
- package/lib/esm/Importer/Stepper/index.js +4 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +2 -1
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +1 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +21 -1
- package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +3 -0
- package/lib/esm/Importer/contexts/ImporterContextProvider.js +29 -5
- package/lib/esm/Importer/data/index.d.ts +3 -1
- package/lib/esm/Importer/data/index.js +5 -1
- package/lib/esm/common/Table/TableActions/DeleteSelectedRows.js +5 -3
- package/lib/esm/common/Table/TableView/index.js +1 -1
- package/lib/esm/common/buttons.d.ts +1 -1
- package/lib/esm/common/buttons.js +10 -7
- package/lib/esm/locales/de.d.ts +2 -0
- package/lib/esm/locales/de.js +3 -1
- package/lib/esm/locales/en.d.ts +2 -0
- package/lib/esm/locales/en.js +3 -1
- package/lib/esm/locales/es.d.ts +2 -0
- package/lib/esm/locales/es.js +3 -1
- package/lib/esm/locales/fr.d.ts +2 -0
- package/lib/esm/locales/fr.js +3 -1
- package/lib/main.js +2 -2
- package/package.json +1 -1
|
@@ -29,10 +29,10 @@ var TitleContainer = styled(Div)(templateObject_1 || (templateObject_1 = __makeT
|
|
|
29
29
|
var ExportButtonContainer = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n right: 32px;\n"], ["\n position: absolute;\n right: 32px;\n"])));
|
|
30
30
|
var ReviewWithContext = function () {
|
|
31
31
|
var _a = useReviewContext(), fields = _a.reviewFields, initialDataSet = _a.reviewInitialDataSet, options = _a.options, onValidateRecord = _a.onValidateRecord, onDataSetChanged = _a.onDataSetChanged, onValidationStateChanged = _a.onValidationStateChanged, onExport = _a.onExport;
|
|
32
|
-
var _b = useImporterContext(), selectedRows = _b.selectedRows, setSelectedRows = _b.setSelectedRows;
|
|
32
|
+
var _b = useImporterContext(), selectedRows = _b.selectedRows, setSelectedRows = _b.setSelectedRows, isUsingManualImport = _b.isUsingManualImport;
|
|
33
33
|
var t = useTranslation("review").t;
|
|
34
34
|
var spreadsheetUI = initialDataSet && (_jsx(Spreadsheet, { options: __assign(__assign({}, options), { showCheckboxColumn: true }), selectedRows: selectedRows, setSelectedRows: setSelectedRows, initialDataSet: initialDataSet, fields: fields, rowWidth: getSpreadsheetRowWidth(fields, 6), onDataSetChanged: onDataSetChanged, onValidateRecord: onValidateRecord, onValidationStateChanged: onValidationStateChanged }));
|
|
35
|
-
return (_jsxs(Div, __assign({ centered: true, flexColumn: true, h100: true }, { children: [_jsx(AppResponseModal, {}), _jsxs(Div, __assign({ w100: true, h100: true }, { children: [_jsxs(TitleContainer, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: [_jsx(Div, __assign({ h2: true, mt: 40 }, { children: t("title") })), _jsx(ExportButtonContainer, __assign({ mb: 16, mt: 64 }, { children: _jsxs(Button, __assign({ w: 120, br: 8, variant: "secondary", svgNormalFillColorOverride: "transparent", svgActiveFillColorOverride: "transparent", svgActiveStrokeColorOverride: "white", onClick: onExport }, { children: [downloadIcon, " ", _jsxs(Span, __assign({ ml: 6 }, { children: [" ", t("export")] }))] })) }))] })), _jsx(Div, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: _jsx(Div, __assign({ body1: true, mt: 20, w: 540, mb: 15 }, { children: t("description") })) })), spreadsheetUI] }))] })));
|
|
35
|
+
return (_jsxs(Div, __assign({ centered: true, flexColumn: true, h100: true }, { children: [_jsx(AppResponseModal, {}), _jsxs(Div, __assign({ w100: true, h100: true }, { children: [_jsxs(TitleContainer, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: [_jsx(Div, __assign({ h2: true, mt: 40 }, { children: t(isUsingManualImport.current ? "manual_importer_title" : "title") })), _jsx(ExportButtonContainer, __assign({ mb: 16, mt: 64 }, { children: _jsxs(Button, __assign({ w: 120, br: 8, variant: "secondary", svgNormalFillColorOverride: "transparent", svgActiveFillColorOverride: "transparent", svgActiveStrokeColorOverride: "white", onClick: onExport }, { children: [downloadIcon, " ", _jsxs(Span, __assign({ ml: 6 }, { children: [" ", t("export")] }))] })) }))] })), _jsx(Div, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: _jsx(Div, __assign({ body1: true, mt: 20, w: 540, mb: 15 }, { children: t("description") })) })), spreadsheetUI] }))] })));
|
|
36
36
|
};
|
|
37
37
|
export default ReviewWithContext;
|
|
38
38
|
var templateObject_1, templateObject_2;
|
|
@@ -38,7 +38,7 @@ export var Stepper = function (_a) {
|
|
|
38
38
|
var _c = useState(false), isSubmitModalOpen = _c[0], setIsSubmitModalOpen = _c[1];
|
|
39
39
|
var _d = useState(false), isConfirmCloseModalOpen = _d[0], setIsConfirmCloseModalOpen = _d[1];
|
|
40
40
|
var _e = useReviewContext(), appResponse = _e.appResponse, isSubmitDisabled = _e.isSubmitDisabled, onSubmit = _e.onSubmit;
|
|
41
|
-
var _f = useImporterContext(), currentStepIndex = _f.currentStepIndex, templateHeaderMatchings = _f.templateHeaderMatchings, matcherSubstep = _f.matcherSubstep, templateHeaders = _f.templateHeaders, uploadedDataEnumFieldValues = _f.uploadedDataEnumFieldValues, setEnumFieldValueMatchings = _f.setEnumFieldValueMatchings, setMatcherSubstep = _f.setMatcherSubstep, setCurrentStepIndex = _f.setCurrentStepIndex, onClose = _f.onClose;
|
|
41
|
+
var _f = useImporterContext(), currentStepIndex = _f.currentStepIndex, templateHeaderMatchings = _f.templateHeaderMatchings, matcherSubstep = _f.matcherSubstep, templateHeaders = _f.templateHeaders, uploadedDataEnumFieldValues = _f.uploadedDataEnumFieldValues, setEnumFieldValueMatchings = _f.setEnumFieldValueMatchings, setMatcherSubstep = _f.setMatcherSubstep, setCurrentStepIndex = _f.setCurrentStepIndex, onClose = _f.onClose, isUsingManualImport = _f.isUsingManualImport, resetImporterWhenUsingManualImport = _f.resetImporterWhenUsingManualImport;
|
|
42
42
|
var templateHeaderLabels = Object.keys(templateHeaderMatchings || []);
|
|
43
43
|
var unmatchedHeadersCount = templateHeaderLabels.filter(function (templateHeaderLabel) { return !templateHeaderMatchings[templateHeaderLabel]; }).length;
|
|
44
44
|
var isLastSubMatchStep = matcherSubstep === 1;
|
|
@@ -75,6 +75,9 @@ export var Stepper = function (_a) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
var goBack = function () {
|
|
78
|
+
if (isUsingManualImport.current) {
|
|
79
|
+
return resetImporterWhenUsingManualImport();
|
|
80
|
+
}
|
|
78
81
|
var isMatchingColumnValues = matcherSubstep === 1;
|
|
79
82
|
var isInMachStep = currentStepIndex === 1;
|
|
80
83
|
var shouldBackOnlyMatcherSubStep = isMatchingColumnValues && isInMachStep;
|
|
@@ -36,7 +36,8 @@ var dropzoneUploadingUI = (_jsx(DropzoneUploadingContainer, __assign({ centered:
|
|
|
36
36
|
var DragAndDropComponent = function (_a) {
|
|
37
37
|
var openUploadFileDialog = _a.openUploadFileDialog;
|
|
38
38
|
var t = useTranslation("upload").t;
|
|
39
|
-
|
|
39
|
+
var manualDataImportSelected = useImporterContext().manualDataImportSelected;
|
|
40
|
+
return (_jsxs(Div, __assign({ centered: true, flexColumn: true }, { children: [_jsx(Div, __assign({ mb: 12 }, { children: DragAndDropSvg })), _jsx(Div, __assign({ h4: true }, { children: t("dropzone.title") })), _jsx(Button, __assign({ mt: 20, variant: "secondary", w: "fit-content", p: 12, isSmall: true, onClick: openUploadFileDialog }, { children: t("dropzone.button") })), _jsx(Div, __assign({ body1: true, textAlignCenter: true, m: 4 }, { children: t("dropzone.description") })), _jsx(Div, { children: _jsx(Button, __assign({ variant: "link", w: "fit-content", p: 12, isSmall: true, onClick: manualDataImportSelected }, { children: t("dropzone.enter_data_manually") })) })] })));
|
|
40
41
|
};
|
|
41
42
|
var ImporterDropzone = function () {
|
|
42
43
|
var _a = useUploaderContext(), setIsUploading = _a.setIsUploading, setFileName = _a.setFileName;
|
|
@@ -24,6 +24,7 @@ type State = {
|
|
|
24
24
|
lastClickedIndexRef: React.MutableRefObject<number | null>;
|
|
25
25
|
filteredInputValue: string;
|
|
26
26
|
setFilteredInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
27
|
+
addNewRowsToSpreadsheet: () => void;
|
|
27
28
|
} & ValidationState;
|
|
28
29
|
type Props = {
|
|
29
30
|
initialDataSet: RecordDataSet;
|
|
@@ -25,6 +25,7 @@ import { get } from "lodash";
|
|
|
25
25
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
26
26
|
import { useValidationState } from "./hooks";
|
|
27
27
|
import { addEmptyRows } from "../../../Importer/data";
|
|
28
|
+
import { addMeta } from "../../../Importer/data";
|
|
28
29
|
var SpreadsheetContext = createContext({});
|
|
29
30
|
export var SpreadsheetContextProvider = function (_a) {
|
|
30
31
|
var initialDataSet = _a.initialDataSet, _b = _a.rowWidth, rowWidth = _b === void 0 ? 1 : _b, fields = _a.fields, options = _a.options, isReadOnly = _a.isReadOnly, highlightFirstRow = _a.highlightFirstRow, children = _a.children, onValidateRecord = _a.onValidateRecord, onDataSetChanged = _a.onDataSetChanged, onValidationStateChanged = _a.onValidationStateChanged, selectedRows = _a.selectedRows, setSelectedRows = _a.setSelectedRows;
|
|
@@ -45,6 +46,14 @@ export var SpreadsheetContextProvider = function (_a) {
|
|
|
45
46
|
setIsLoading: setIsLoading,
|
|
46
47
|
onValidateRecord: onValidateRecord,
|
|
47
48
|
}), errorsRef = _h.errorsRef, warningsRef = _h.warningsRef, updateRecordAndRevalidate = _h.updateRecordAndRevalidate, deleteRecords = _h.deleteRecords, filterRecordsBySearchValue = _h.filterRecordsBySearchValue, validationState = __rest(_h, ["errorsRef", "warningsRef", "updateRecordAndRevalidate", "deleteRecords", "filterRecordsBySearchValue"]);
|
|
49
|
+
var addNewRowsToSpreadsheet = function () {
|
|
50
|
+
var highestRowIndex = Math.max.apply(Math, Object.values(dataSet).map(function (obj) { return obj._meta.rowIndex; }));
|
|
51
|
+
var newRow = addMeta({}, highestRowIndex + 1);
|
|
52
|
+
setDataSet(function (oldValues) {
|
|
53
|
+
var _a;
|
|
54
|
+
return (__assign(__assign({}, oldValues), (_a = {}, _a[newRow._meta.id] = newRow, _a)));
|
|
55
|
+
});
|
|
56
|
+
};
|
|
48
57
|
// sort data based on errors (errors group on top and not errors group at bottom)
|
|
49
58
|
var data = useMemo(function () {
|
|
50
59
|
var filteredObj = filterRecordsBySearchValue(dataSet, filteredInputValue);
|
|
@@ -65,6 +74,17 @@ export var SpreadsheetContextProvider = function (_a) {
|
|
|
65
74
|
addEmptyRows(data, fields);
|
|
66
75
|
useEffect(function () {
|
|
67
76
|
onDataSetChanged && onDataSetChanged(dataSet);
|
|
77
|
+
var dataSetKeys = Object.keys(dataSet);
|
|
78
|
+
var latestDataSet = dataSet[dataSetKeys[dataSetKeys.length - 1]];
|
|
79
|
+
var latestDataSetValuesWithoutMeta = Object.values(latestDataSet).filter(function (key) { return key !== "_meta"; });
|
|
80
|
+
var hasValueInTheLastObject = latestDataSetValuesWithoutMeta
|
|
81
|
+
.filter(function (value) {
|
|
82
|
+
return value !== null && value !== undefined && typeof value !== "object";
|
|
83
|
+
})
|
|
84
|
+
.some(function (value) { return value !== "null" && value !== "undefined"; });
|
|
85
|
+
if (hasValueInTheLastObject) {
|
|
86
|
+
addNewRowsToSpreadsheet();
|
|
87
|
+
}
|
|
68
88
|
}, [dataSet]);
|
|
69
89
|
useEffect(function () {
|
|
70
90
|
setDataSet(initialDataSet);
|
|
@@ -85,7 +105,7 @@ export var SpreadsheetContextProvider = function (_a) {
|
|
|
85
105
|
setSortByFieldErrors(null);
|
|
86
106
|
}, []);
|
|
87
107
|
var lastClickedIndexRef = useRef(null);
|
|
88
|
-
var value = __assign(__assign({ data: data, fields: fields, isLoading: isLoading }, validationState), { isReadOnly: isReadOnly, rowWidth: rowWidth, sortByFieldErrors: sortByFieldErrors, sortByFieldWarnings: sortByFieldWarnings, highlightFirstRow: highlightFirstRow, options: options, setIsLoading: setIsLoading, setSortByFieldErrors: handleSortByFieldErrors, setSortByFieldWarnings: handleSortByFieldWarnings, onValidateRecord: onValidateRecord, updateRecord: updateRecordAndRevalidate, selectedRows: selectedRows, setSelectedRows: setSelectedRows, deleteRecords: deleteRecords, filteredInputValue: filteredInputValue, setFilteredInputValue: setFilteredInputValue, lastClickedIndexRef: lastClickedIndexRef });
|
|
108
|
+
var value = __assign(__assign({ data: data, fields: fields, isLoading: isLoading }, validationState), { isReadOnly: isReadOnly, rowWidth: rowWidth, sortByFieldErrors: sortByFieldErrors, sortByFieldWarnings: sortByFieldWarnings, highlightFirstRow: highlightFirstRow, options: options, setIsLoading: setIsLoading, setSortByFieldErrors: handleSortByFieldErrors, setSortByFieldWarnings: handleSortByFieldWarnings, onValidateRecord: onValidateRecord, updateRecord: updateRecordAndRevalidate, selectedRows: selectedRows, setSelectedRows: setSelectedRows, deleteRecords: deleteRecords, filteredInputValue: filteredInputValue, setFilteredInputValue: setFilteredInputValue, lastClickedIndexRef: lastClickedIndexRef, addNewRowsToSpreadsheet: addNewRowsToSpreadsheet });
|
|
89
109
|
return (_jsx(SpreadsheetContext.Provider, __assign({ value: value }, { children: children })));
|
|
90
110
|
};
|
|
91
111
|
export var useSpreadsheetContext = function () { return useContext(SpreadsheetContext); };
|
|
@@ -50,6 +50,9 @@ export type State = {
|
|
|
50
50
|
setMatcherSubstep: React.Dispatch<number>;
|
|
51
51
|
selectedRows: string[];
|
|
52
52
|
setSelectedRows: React.Dispatch<React.SetStateAction<string[]>>;
|
|
53
|
+
isUsingManualImport: React.MutableRefObject<boolean>;
|
|
54
|
+
resetImporterWhenUsingManualImport: () => void;
|
|
55
|
+
manualDataImportSelected: () => void;
|
|
53
56
|
};
|
|
54
57
|
export type Props = {
|
|
55
58
|
templateSlug: string;
|
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
49
|
import Fuse from "fuse.js";
|
|
50
|
-
import { createContext, useContext, useEffect, useMemo, useState, } from "react";
|
|
50
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
51
51
|
import { FieldTypes, } from "../../types";
|
|
52
52
|
import { FuseApi } from "../common/FuseApi";
|
|
53
53
|
import { getCustomTheme, theme } from "../common/theme";
|
|
@@ -75,16 +75,24 @@ export var ImporterContextProvider = function (_a) {
|
|
|
75
75
|
var _m = useState(null), enumFieldValueMatchings = _m[0], setEnumFieldValueMatchings = _m[1];
|
|
76
76
|
var _o = useState(null), uploadedDataEnumFieldValues = _o[0], setUploadedDataEnumFieldValues = _o[1];
|
|
77
77
|
var _p = useState([]), selectedRows = _p[0], setSelectedRows = _p[1];
|
|
78
|
+
var isUsingManualImport = useRef(false);
|
|
78
79
|
var fuseApi = useMemo(function () { return new FuseApi(options.env, apiToken); }, [
|
|
79
80
|
options.env,
|
|
80
81
|
apiToken,
|
|
81
82
|
]);
|
|
82
83
|
var uploadedDataHeaders = useMemo(function () {
|
|
83
84
|
var _a;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (!uploadedData)
|
|
86
|
+
return null;
|
|
87
|
+
if (isUsingManualImport.current) {
|
|
88
|
+
return templateHeaders.reduce(function (acc, curr) {
|
|
89
|
+
acc.push(curr.internal_key);
|
|
90
|
+
return acc;
|
|
91
|
+
}, []);
|
|
92
|
+
}
|
|
93
|
+
return (_a = uploadedData[0]) === null || _a === void 0 ? void 0 : _a.map(function (ud) {
|
|
94
|
+
return typeof ud === "number" ? ud.toString() : ud;
|
|
95
|
+
});
|
|
88
96
|
}, [uploadedData]);
|
|
89
97
|
useEffect(function () {
|
|
90
98
|
if (!templateHeaderMatchings)
|
|
@@ -150,6 +158,19 @@ export var ImporterContextProvider = function (_a) {
|
|
|
150
158
|
setUploadedData(null);
|
|
151
159
|
setTemplateHeaderMatchings(null);
|
|
152
160
|
};
|
|
161
|
+
var resetImporterWhenUsingManualImport = function () {
|
|
162
|
+
setCurrentStepIndex(0);
|
|
163
|
+
isUsingManualImport.current = false;
|
|
164
|
+
resetImport();
|
|
165
|
+
};
|
|
166
|
+
var manualDataImportSelected = function () {
|
|
167
|
+
if (templateHeaders) {
|
|
168
|
+
isUsingManualImport.current = true;
|
|
169
|
+
setUploadedData([]);
|
|
170
|
+
setTemplateHeaderMatchings({});
|
|
171
|
+
setCurrentStepIndex(2);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
153
174
|
var setHeadersFromDataset = function () {
|
|
154
175
|
var _templateHeaderMatchings = {};
|
|
155
176
|
var fuse = new Fuse(uploadedDataHeaders, fusejsOptions);
|
|
@@ -193,6 +214,9 @@ export var ImporterContextProvider = function (_a) {
|
|
|
193
214
|
onSubmit: onSubmit,
|
|
194
215
|
selectedRows: selectedRows,
|
|
195
216
|
setSelectedRows: setSelectedRows,
|
|
217
|
+
isUsingManualImport: isUsingManualImport,
|
|
218
|
+
resetImporterWhenUsingManualImport: resetImporterWhenUsingManualImport,
|
|
219
|
+
manualDataImportSelected: manualDataImportSelected,
|
|
196
220
|
};
|
|
197
221
|
return (_jsx(ImporterContext.Provider, __assign({ value: value }, { children: children })));
|
|
198
222
|
};
|
|
@@ -24,6 +24,8 @@ export declare const getPreviewDataSet: ({ uploadedData, }: {
|
|
|
24
24
|
};
|
|
25
25
|
export declare const getReviewDataSet: ({ templateHeaderMatchings, enumFieldValueMatchings, templateHeaders, uploadedDataHeaders, uploadedData, formatRecord, }: transformToRecordsArgs) => {
|
|
26
26
|
fields: Field[];
|
|
27
|
-
initialDataSet:
|
|
27
|
+
initialDataSet: {
|
|
28
|
+
[x: string]: Record;
|
|
29
|
+
};
|
|
28
30
|
};
|
|
29
31
|
export {};
|
|
@@ -110,6 +110,7 @@ export var getPreviewDataSet = function (_a) {
|
|
|
110
110
|
return { fields: fields, initialDataSet: getInitialDataSet() };
|
|
111
111
|
};
|
|
112
112
|
export var getReviewDataSet = function (_a) {
|
|
113
|
+
var _b;
|
|
113
114
|
var templateHeaderMatchings = _a.templateHeaderMatchings, enumFieldValueMatchings = _a.enumFieldValueMatchings, templateHeaders = _a.templateHeaders, uploadedDataHeaders = _a.uploadedDataHeaders, uploadedData = _a.uploadedData, formatRecord = _a.formatRecord;
|
|
114
115
|
var fields = templateHeaders.map(function (templateHeader) { return ({
|
|
115
116
|
label: templateHeader.label,
|
|
@@ -128,6 +129,9 @@ export var getReviewDataSet = function (_a) {
|
|
|
128
129
|
uploadedData: uploadedData,
|
|
129
130
|
formatRecord: formatRecord,
|
|
130
131
|
});
|
|
131
|
-
var
|
|
132
|
+
var baseInitialDataSet = recordListToDataSet(addEmptyRows(records, fields), fields);
|
|
133
|
+
var highestRowIndex = Math.max.apply(Math, Object.values(records).map(function (obj) { return obj._meta.rowIndex; }));
|
|
134
|
+
var emptyRowAtBottom = addMeta({}, highestRowIndex + 1);
|
|
135
|
+
var initialDataSet = __assign(__assign({}, baseInitialDataSet), (_b = {}, _b[emptyRowAtBottom._meta.id] = emptyRowAtBottom, _b));
|
|
132
136
|
return { fields: fields, initialDataSet: initialDataSet };
|
|
133
137
|
};
|
|
@@ -39,7 +39,7 @@ export var DeleteSelectedRows = function (_a) {
|
|
|
39
39
|
var _b = _a.testId, testId = _b === void 0 ? "ta-delete-rows" : _b;
|
|
40
40
|
var _c = useState(false), isConfirmationModalOpen = _c[0], setIsConfirmationModalOpen = _c[1];
|
|
41
41
|
var _d = useSpreadsheetContext(), data = _d.data, filteredInputValue = _d.filteredInputValue, deleteRecords = _d.deleteRecords, selectedRows = _d.selectedRows, setSelectedRows = _d.setSelectedRows, setFilteredInputValue = _d.setFilteredInputValue;
|
|
42
|
-
var
|
|
42
|
+
var _e = useImporterContext(), setCurrentStepIndex = _e.setCurrentStepIndex, isUsingManualImport = _e.isUsingManualImport;
|
|
43
43
|
var toggleModalVisibility = function () {
|
|
44
44
|
setIsConfirmationModalOpen(function (oldValue) { return !oldValue; });
|
|
45
45
|
};
|
|
@@ -48,8 +48,10 @@ export var DeleteSelectedRows = function (_a) {
|
|
|
48
48
|
toggleModalVisibility();
|
|
49
49
|
setFilteredInputValue("");
|
|
50
50
|
var validData = filterByRecordsThatContainsValues(data);
|
|
51
|
-
// If user is deleting every row
|
|
52
|
-
if (!
|
|
51
|
+
// If user is deleting every row, but not using the manual import option
|
|
52
|
+
if (!isUsingManualImport.current &&
|
|
53
|
+
!filteredInputValue &&
|
|
54
|
+
selectedRows.length === validData.length) {
|
|
53
55
|
setCurrentStepIndex(0);
|
|
54
56
|
return addToast("You have deleted all the rows. You will be redirect to the upload step.", "success");
|
|
55
57
|
}
|
|
@@ -38,7 +38,7 @@ import { Cell, DraggableCell } from "./TableCells";
|
|
|
38
38
|
export * from "./common";
|
|
39
39
|
export * from "./TableHeaders";
|
|
40
40
|
export * from "./TableRow";
|
|
41
|
-
export var TableViewWrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n border-radius: 8px;\n border: solid 1px ", ";\n overflow: hidden;\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"], ["\n ", "\n border-radius: 8px;\n border: solid 1px ", ";\n overflow: hidden;\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"])), function (p) {
|
|
41
|
+
export var TableViewWrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n border-radius: 8px;\n border: solid 1px ", ";\n max-width: calc(100vw - 50px);\n overflow: hidden;\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"], ["\n ", "\n border-radius: 8px;\n border: solid 1px ", ";\n max-width: calc(100vw - 50px);\n overflow: hidden;\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"])), function (p) {
|
|
42
42
|
return p.isLoading && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: 0.5;\n "], ["\n opacity: 0.5;\n "])));
|
|
43
43
|
}, function (p) { return p.theme.colors.gray300; }, function (p) { return p.theme.css.scrollbarDark; });
|
|
44
44
|
var SpinnerWrapper = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n pointer-events: none;\n z-index: 100;\n"], ["\n pointer-events: none;\n z-index: 100;\n"])));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProps } from "../styled/utils";
|
|
2
|
-
declare const types: readonly ["primary", "secondary", "tertiary"];
|
|
2
|
+
declare const types: readonly ["primary", "secondary", "tertiary", "link"];
|
|
3
3
|
export type ButtonTypes = typeof types[number];
|
|
4
4
|
export type BtnProps = {
|
|
5
5
|
onClick?: () => void;
|
|
@@ -28,7 +28,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
28
28
|
import { get } from "lodash";
|
|
29
29
|
import styled, { css } from "styled-components";
|
|
30
30
|
import { Div, HTMLButton } from "../styled/utils";
|
|
31
|
-
var types = ["primary", "secondary", "tertiary"];
|
|
31
|
+
var types = ["primary", "secondary", "tertiary", "link"];
|
|
32
32
|
var getBgColor = function (props) {
|
|
33
33
|
return get(props, "backgroundColor", get(props.theme, "colors.pink500"));
|
|
34
34
|
};
|
|
@@ -63,17 +63,20 @@ var styles = {
|
|
|
63
63
|
tertiary: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: transparent;\n border: solid 1px transparent;\n color: ", ";\n :hover {\n background: ", ";\n }\n :active {\n background: ", ";\n color: ", ";\n }\n ", "\n "], ["\n background: transparent;\n border: solid 1px transparent;\n color: ", ";\n :hover {\n background: ", ";\n }\n :active {\n background: ", ";\n color: ", ";\n }\n ", "\n "])), function (props) { return props.theme.colors.text; }, function (props) { return props.theme.colors.white50; }, function (props) { return props.theme.colors.black; }, function (props) { return props.theme.colors.white; }, function (props) {
|
|
64
64
|
return props.isDisabled && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (props) { return props.theme.colors.gray300; });
|
|
65
65
|
}),
|
|
66
|
+
link: css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n background: transparent;\n border: solid 1px transparent;\n color: ", ";\n text-decoration: underline;\n :hover {\n background: ", ";\n }\n :active {\n background: ", ";\n color: ", ";\n }\n ", "\n "], ["\n background: transparent;\n border: solid 1px transparent;\n color: ", ";\n text-decoration: underline;\n :hover {\n background: ", ";\n }\n :active {\n background: ", ";\n color: ", ";\n }\n ", "\n "])), function (props) { return props.theme.colors.text; }, function (props) { return props.theme.colors.white50; }, function (props) { return props.theme.colors.black; }, function (props) { return props.theme.colors.white; }, function (props) {
|
|
67
|
+
return props.isDisabled && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (props) { return props.theme.colors.gray300; });
|
|
68
|
+
}),
|
|
66
69
|
};
|
|
67
|
-
var commonButtonStyle = css(
|
|
68
|
-
return props.isSmall && css(
|
|
70
|
+
var commonButtonStyle = css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n padding: 12px 24px;\n height: 48px;\n width: fit-content;\n\n ", "\n\n border: solid 1px black;\n border-radius: 24px;\n\n font-family: DM Sans;\n\n :focus {\n outline: none;\n }\n :hover {\n cursor: pointer;\n }\n\n ", "\n ", ";\n\n ", ";\n"], ["\n padding: 12px 24px;\n height: 48px;\n width: fit-content;\n\n ", "\n\n border: solid 1px black;\n border-radius: 24px;\n\n font-family: DM Sans;\n\n :focus {\n outline: none;\n }\n :hover {\n cursor: pointer;\n }\n\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
71
|
+
return props.isSmall && css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n height: 36px;\n padding: 6px 20px;\n "], ["\n height: 36px;\n padding: 6px 20px;\n "])));
|
|
69
72
|
}, function (props) {
|
|
70
|
-
return props.isDisabled && css(
|
|
73
|
+
return props.isDisabled && css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
71
74
|
}, function (props) {
|
|
72
75
|
var c = props.theme.css;
|
|
73
76
|
return [c.centered, c.buttonText];
|
|
74
77
|
}, function (props) { return styles[props.variant || "primary"]; });
|
|
75
|
-
export var ButtonWrapper = styled(Div)(
|
|
76
|
-
export var ButtonElementWrapper = styled(HTMLButton)(
|
|
78
|
+
export var ButtonWrapper = styled(Div)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), commonButtonStyle);
|
|
79
|
+
export var ButtonElementWrapper = styled(HTMLButton)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), commonButtonStyle);
|
|
77
80
|
export var Button = function (_a) {
|
|
78
81
|
var _b = _a.onClick, onClick = _b === void 0 ? null : _b, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.variant, variant = _d === void 0 ? "primary" : _d, _e = _a.isSmall, isSmall = _e === void 0 ? false : _e, children = _a.children, _f = _a.isButtonElement, isButtonElement = _f === void 0 ? false : _f, props = __rest(_a, ["onClick", "isDisabled", "variant", "isSmall", "children", "isButtonElement"]);
|
|
79
82
|
return (_jsx(_Fragment, { children: isButtonElement ? (_jsx(ButtonElementWrapper, __assign({ isSmall: isSmall, isDisabled: isDisabled, disabled: isDisabled, variant: variant, type: "submit" }, props, { children: children }))) : (_jsx(ButtonWrapper, __assign({ role: "button", w: "fit-content", p: 12, isSmall: isSmall, onClick: isDisabled ? null : onClick, onKeyDown: function (_a) {
|
|
@@ -84,4 +87,4 @@ export var Button = function (_a) {
|
|
|
84
87
|
}
|
|
85
88
|
}, tabIndex: 0 }, __assign({ variant: variant, isDisabled: isDisabled, onClick: onClick, disabled: isDisabled }, props), { children: _jsx(_Fragment, { children: children }) }))) }));
|
|
86
89
|
};
|
|
87
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
90
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|
package/lib/esm/locales/de.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
title: string;
|
|
33
33
|
description: string;
|
|
34
34
|
button: string;
|
|
35
|
+
enter_data_manually: string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
match: {
|
|
@@ -50,6 +51,7 @@ declare const _default: {
|
|
|
50
51
|
};
|
|
51
52
|
review: {
|
|
52
53
|
title: string;
|
|
54
|
+
manual_importer_title: string;
|
|
53
55
|
export: string;
|
|
54
56
|
description: string;
|
|
55
57
|
};
|
package/lib/esm/locales/de.js
CHANGED
|
@@ -33,6 +33,7 @@ export default {
|
|
|
33
33
|
title: "Ziehen & lassen Sie Ihre Datei hier",
|
|
34
34
|
description: "oder",
|
|
35
35
|
button: "Dateien durchsuchen",
|
|
36
|
+
enter_data_manually: "Daten manuell eingeben",
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
match: {
|
|
@@ -50,7 +51,8 @@ export default {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
review: {
|
|
53
|
-
title: "Überprüfen
|
|
54
|
+
title: "Überprüfen und Senden",
|
|
55
|
+
manual_importer_title: "Daten Eingeben und Senden",
|
|
54
56
|
export: "Exportieren",
|
|
55
57
|
description: "Einige Zellen im Dokument können Fehler im Format oder fehlende Informationen aufweisen. Bitte überprüfen Sie diese, um fortzufahren.",
|
|
56
58
|
},
|
package/lib/esm/locales/en.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
title: string;
|
|
33
33
|
description: string;
|
|
34
34
|
button: string;
|
|
35
|
+
enter_data_manually: string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
match: {
|
|
@@ -50,6 +51,7 @@ declare const _default: {
|
|
|
50
51
|
};
|
|
51
52
|
review: {
|
|
52
53
|
title: string;
|
|
54
|
+
manual_importer_title: string;
|
|
53
55
|
export: string;
|
|
54
56
|
description: string;
|
|
55
57
|
};
|
package/lib/esm/locales/en.js
CHANGED
|
@@ -33,6 +33,7 @@ export default {
|
|
|
33
33
|
title: "Drag & drop your file here",
|
|
34
34
|
description: "or",
|
|
35
35
|
button: "Browse Files",
|
|
36
|
+
enter_data_manually: "Enter data manually",
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
match: {
|
|
@@ -50,7 +51,8 @@ export default {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
review: {
|
|
53
|
-
title: "Review
|
|
54
|
+
title: "Review & Submit",
|
|
55
|
+
manual_importer_title: "Enter Data & Submit",
|
|
54
56
|
export: "Export",
|
|
55
57
|
description: "Some cells in the document might have errors in format or missing information. Please review these to continue.",
|
|
56
58
|
},
|
package/lib/esm/locales/es.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
title: string;
|
|
33
33
|
description: string;
|
|
34
34
|
button: string;
|
|
35
|
+
enter_data_manually: string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
match: {
|
|
@@ -50,6 +51,7 @@ declare const _default: {
|
|
|
50
51
|
};
|
|
51
52
|
review: {
|
|
52
53
|
title: string;
|
|
54
|
+
manual_importer_title: string;
|
|
53
55
|
export: string;
|
|
54
56
|
description: string;
|
|
55
57
|
};
|
package/lib/esm/locales/es.js
CHANGED
|
@@ -33,6 +33,7 @@ export default {
|
|
|
33
33
|
title: "Arrastra y suelta tu archivo aquí",
|
|
34
34
|
description: "o",
|
|
35
35
|
button: "Examinar archivos",
|
|
36
|
+
enter_data_manually: "Ingresar datos manualmente",
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
match: {
|
|
@@ -50,7 +51,8 @@ export default {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
review: {
|
|
53
|
-
title: "
|
|
54
|
+
title: "Revisar y Enviar",
|
|
55
|
+
manual_importer_title: "Ingresar Datos y Enviar",
|
|
54
56
|
export: "Exportar",
|
|
55
57
|
description: "Algunas celdas en el documento pueden tener errores en el formato o información faltante. Por favor revise esto para continuar.",
|
|
56
58
|
},
|
package/lib/esm/locales/fr.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
title: string;
|
|
33
33
|
description: string;
|
|
34
34
|
button: string;
|
|
35
|
+
enter_data_manually: string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
match: {
|
|
@@ -50,6 +51,7 @@ declare const _default: {
|
|
|
50
51
|
};
|
|
51
52
|
review: {
|
|
52
53
|
title: string;
|
|
54
|
+
manual_importer_title: string;
|
|
53
55
|
export: string;
|
|
54
56
|
description: string;
|
|
55
57
|
};
|
package/lib/esm/locales/fr.js
CHANGED
|
@@ -33,6 +33,7 @@ export default {
|
|
|
33
33
|
title: "Glissez et déposez votre fichier ici",
|
|
34
34
|
description: "ou",
|
|
35
35
|
button: "Parcourir les fichiers",
|
|
36
|
+
enter_data_manually: "Entrer les données manuellement",
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
match: {
|
|
@@ -50,7 +51,8 @@ export default {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
review: {
|
|
53
|
-
title: "
|
|
54
|
+
title: "Revoir et Envoyer",
|
|
55
|
+
manual_importer_title: "Saisir Des Données et Envoyer",
|
|
54
56
|
export: "Exporter",
|
|
55
57
|
description: "Certaines cellules du document peuvent avoir des erreurs de format ou des informations manquantes. Veuillez les examiner pour continuer.",
|
|
56
58
|
},
|