fuse-importer 0.1.8-testing → 0.2.1-testing
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 +4 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +1 -1
- package/lib/esm/Importer/PreviewFirstTime.js +1 -1
- package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +2 -2
- package/lib/esm/Importer/Review/ReviewContextProvider.js +6 -6
- package/lib/esm/Importer/Stepper/index.js +5 -5
- package/lib/esm/Importer/common/Spreadsheet/DuplicateDataContextProvider/index.d.ts +5 -4
- package/lib/esm/Importer/common/Spreadsheet/DuplicateDataContextProvider/index.js +104 -50
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/hashCalculators.d.ts +3 -2
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/hashCalculators.js +40 -26
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useBatchProcessing.d.ts +2 -2
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useBatchProcessing.js +13 -4
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useDataSetManipulation.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useDataSetManipulation.js +55 -11
- package/lib/esm/Importer/common/Spreadsheet/ValidationContextProvider/index.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/ValidationContextProvider/index.js +21 -10
- package/lib/esm/Importer/common/Spreadsheet/common/index.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/common/index.js +13 -5
- package/lib/esm/Importer/common/Spreadsheet/components/FindAndReplace/index.js +57 -13
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +7 -7
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +8 -8
- package/lib/esm/Importer/common/Spreadsheet/components/fields/SpeadsheetAutocomplete.js +3 -4
- package/lib/esm/Importer/common/Spreadsheet/components/fields/SpreadsheetInput.js +6 -7
- package/lib/esm/Importer/common/Spreadsheet/components/fields/index.js +20 -15
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.js +2 -0
- package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +5 -0
- package/lib/esm/Importer/contexts/ImporterContextProvider.js +14 -5
- package/lib/esm/Importer/hooks/useSubmitToServer.d.ts +1 -1
- package/lib/esm/Importer/hooks/useSubmitToServer.js +30 -9
- package/lib/esm/common/CircleSpinner.d.ts +1 -0
- package/lib/esm/common/CircleSpinner.js +13 -0
- package/lib/esm/common/FileUploadDropzone/ImporterDropzone.js +56 -21
- package/lib/esm/common/Table/TableActions/CustomActions/CustomActions.js +28 -23
- package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.js +3 -3
- package/lib/esm/common/Table/TableActions/RowFilters.js +2 -2
- package/lib/esm/common/Table/TableActions/SearchRows.js +9 -9
- package/lib/esm/common/Table/TableActions/TableActions.js +7 -4
- package/lib/esm/common/Table/TableActions/TableActions.styles.js +1 -1
- package/lib/esm/common/Table/TableActions/TransformedRecordsCount.js +3 -3
- package/lib/esm/common/Table/TableView/index.d.ts +1 -1
- package/lib/esm/common/Table/TableView/index.js +2 -2
- package/lib/esm/common/Table/TableView/types.d.ts +1 -0
- package/lib/esm/common/Toast.d.ts +9 -1
- package/lib/esm/common/Toast.js +29 -8
- package/lib/esm/common/icons/index.js +3 -3
- package/lib/esm/common/inputs/Autocomplete.js +1 -1
- package/lib/main.js +4 -4
- package/package.json +1 -1
|
@@ -103,8 +103,8 @@ export var ValidationContextProvider = function (_a) {
|
|
|
103
103
|
var totalErrorCount = useRef(0);
|
|
104
104
|
var invalidRowsCountRef = useRef(0);
|
|
105
105
|
var _c = useEventManagerContext(), emit = _c.emit, EVENTS = _c.EVENTS;
|
|
106
|
-
var _d = useDataSetContext(), getRecord = _d.getRecord, setRecord = _d.setRecord, dataSet = _d.dataSet;
|
|
107
|
-
var _e = useDuplicateDataContext(), duplicateValues = _e.duplicateValues, updateDuplicateValues = _e.updateDuplicateValues;
|
|
106
|
+
var _d = useDataSetContext(), getRecord = _d.getRecord, setRecord = _d.setRecord, dataSet = _d.dataSet, dataSetLength = _d.dataSetLength;
|
|
107
|
+
var _e = useDuplicateDataContext(), duplicateValues = _e.duplicateValues, updateDuplicateValues = _e.updateDuplicateValues, resetDuplicateProvider = _e.resetDuplicateProvider;
|
|
108
108
|
var processRecordsInBatches = useBatchProcessing(10000).processRecordsInBatches;
|
|
109
109
|
var _f = useState(false), spreadsheetInitialized = _f[0], setSpreadsheetInitialized = _f[1];
|
|
110
110
|
var currentStepIndex = useImporterContext().currentStepIndex;
|
|
@@ -198,8 +198,9 @@ export var ValidationContextProvider = function (_a) {
|
|
|
198
198
|
setValidationPercentage(Math.round((validationPercentage + Number.EPSILON) * 10) / 10);
|
|
199
199
|
};
|
|
200
200
|
// Validate record and update dataSet
|
|
201
|
-
var updateRecordAndRevalidate = function (records, initialValidation) {
|
|
201
|
+
var updateRecordAndRevalidate = function (records, initialValidation, loadingIndicator) {
|
|
202
202
|
if (initialValidation === void 0) { initialValidation = false; }
|
|
203
|
+
if (loadingIndicator === void 0) { loadingIndicator = true; }
|
|
203
204
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
204
205
|
var recordsArray, length, recordsProcessed;
|
|
205
206
|
return __generator(this, function (_a) {
|
|
@@ -207,7 +208,7 @@ export var ValidationContextProvider = function (_a) {
|
|
|
207
208
|
case 0:
|
|
208
209
|
recordsArray = Array.isArray(records) ? records : [records];
|
|
209
210
|
length = recordsArray.length;
|
|
210
|
-
if (!(length > 10000)) return [3 /*break*/, 2];
|
|
211
|
+
if (!(loadingIndicator && length > 10000)) return [3 /*break*/, 2];
|
|
211
212
|
setIsLoadingApp(true);
|
|
212
213
|
// wait for the first render to complete
|
|
213
214
|
// before blocking main thread with review step logic
|
|
@@ -251,7 +252,9 @@ export var ValidationContextProvider = function (_a) {
|
|
|
251
252
|
}); })];
|
|
252
253
|
case 3:
|
|
253
254
|
_a.sent();
|
|
254
|
-
|
|
255
|
+
if (loadingIndicator) {
|
|
256
|
+
setIsLoadingApp(false);
|
|
257
|
+
}
|
|
255
258
|
return [2 /*return*/];
|
|
256
259
|
}
|
|
257
260
|
});
|
|
@@ -259,22 +262,31 @@ export var ValidationContextProvider = function (_a) {
|
|
|
259
262
|
};
|
|
260
263
|
// Initial data validation and update dataSet
|
|
261
264
|
useEffect(function () {
|
|
265
|
+
if (dataSet.current && !isReadOnly) {
|
|
266
|
+
resetDuplicateProvider();
|
|
267
|
+
}
|
|
262
268
|
reset();
|
|
263
269
|
}, [dataSet.current]);
|
|
264
270
|
useEffect(function () {
|
|
265
|
-
|
|
271
|
+
var isDataSetInvalid = !dataSet.current || dataSetLength.current === 0;
|
|
272
|
+
if (isDataSetInvalid ||
|
|
273
|
+
isReadOnly ||
|
|
274
|
+
currentStepIndex !== 2 ||
|
|
275
|
+
(fields === null || fields === void 0 ? void 0 : fields.length) === 0)
|
|
266
276
|
return;
|
|
267
|
-
setIsLoadingApp(true);
|
|
268
277
|
var initialValidation = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
278
|
var initialData;
|
|
270
279
|
return __generator(this, function (_a) {
|
|
271
280
|
switch (_a.label) {
|
|
272
281
|
case 0:
|
|
273
282
|
initialData = Object.values(dataSet.current);
|
|
283
|
+
if (!(initialData.length > 0)) return [3 /*break*/, 2];
|
|
284
|
+
setIsLoadingApp(true);
|
|
274
285
|
return [4 /*yield*/, updateRecordAndRevalidate(initialData, true)];
|
|
275
286
|
case 1:
|
|
276
287
|
_a.sent();
|
|
277
|
-
|
|
288
|
+
_a.label = 2;
|
|
289
|
+
case 2: return [2 /*return*/];
|
|
278
290
|
}
|
|
279
291
|
});
|
|
280
292
|
}); };
|
|
@@ -284,13 +296,12 @@ export var ValidationContextProvider = function (_a) {
|
|
|
284
296
|
case 0: return [4 /*yield*/, initialValidation()];
|
|
285
297
|
case 1:
|
|
286
298
|
_a.sent();
|
|
287
|
-
setIsLoadingApp(false);
|
|
288
299
|
setSpreadsheetInitialized(true);
|
|
289
300
|
return [2 /*return*/];
|
|
290
301
|
}
|
|
291
302
|
});
|
|
292
303
|
}); })();
|
|
293
|
-
}, [
|
|
304
|
+
}, [currentStepIndex, dataSetChanged]);
|
|
294
305
|
var isValidationCompleted = validationPercentage === 100;
|
|
295
306
|
var isValid = isValidationCompleted && totalErrorCount.current === 0;
|
|
296
307
|
var value = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Field, FieldTypes, Record } from "../../../../types";
|
|
2
2
|
export declare const spreadsheetRowHeightPx = 40;
|
|
3
3
|
export declare const spreadsheetHeaderHeightPx = 40;
|
|
4
4
|
export declare const isNullOrUndefined: (value: any) => boolean;
|
|
@@ -11,7 +11,7 @@ export var isEmpty = function (value) {
|
|
|
11
11
|
(value.length === 0 || value.trim().length === 0)));
|
|
12
12
|
};
|
|
13
13
|
export var isEmail = function (value) {
|
|
14
|
-
var emailRegex = /^[\w+.-]+@([\w-]+\.)+[\w-]
|
|
14
|
+
var emailRegex = /^[\w+.-]+@([\w-]+\.)+[\w-]+$/;
|
|
15
15
|
return emailRegex.test(value);
|
|
16
16
|
};
|
|
17
17
|
export var isUrl = function (value) {
|
|
@@ -52,10 +52,18 @@ export var isRecordEmpty = function (record, fields) {
|
|
|
52
52
|
export var parseValue = function (fieldType, value, enumSet) {
|
|
53
53
|
if (isEmpty(value))
|
|
54
54
|
return value;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
var cleanNumber = function (val) {
|
|
56
|
+
// Remove all non-numeric characters except the decimal point.
|
|
57
|
+
return typeof val === "string" ? val.replace(/[^\d.]/g, "") : val;
|
|
58
|
+
};
|
|
59
|
+
if (fieldType === FieldTypes.float) {
|
|
60
|
+
var cleanedValue = cleanNumber(value);
|
|
61
|
+
return isFloat(cleanedValue) ? parseFloat(cleanedValue) : value;
|
|
62
|
+
}
|
|
63
|
+
if (fieldType === FieldTypes.integer) {
|
|
64
|
+
var cleanedValue = cleanNumber(value);
|
|
65
|
+
return isInteger(cleanedValue) ? parseInt(cleanedValue, 10) : value;
|
|
66
|
+
}
|
|
59
67
|
if (fieldType === FieldTypes.boolean)
|
|
60
68
|
return isTrue(value) ? true : false;
|
|
61
69
|
if (fieldType === FieldTypes.enum && enumSet)
|
|
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
49
|
import { Div } from "../../../../../styled";
|
|
14
50
|
import { Button, Modal, addToast } from "../../../../../common";
|
|
@@ -27,18 +63,26 @@ export var FindAndReplaceModal = function (_a) {
|
|
|
27
63
|
var _d = useState(false), useRegex = _d[0], setUseRegex = _d[1];
|
|
28
64
|
var _e = useState(true), matchCase = _e[0], setMatchCase = _e[1];
|
|
29
65
|
var setFilteredInputValue = useFilteredDataContext().setFilteredInputValue;
|
|
30
|
-
var findAndReplace = function () {
|
|
31
|
-
var records
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
66
|
+
var findAndReplace = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var records;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0: return [4 /*yield*/, findAndReplaceInSpreadsheet(searchText, replaceText, matchCase, useRegex)];
|
|
71
|
+
case 1:
|
|
72
|
+
records = _a.sent();
|
|
73
|
+
if (records.length > 0) {
|
|
74
|
+
addToast(t("find_and_replace_modal.records_replaced", {
|
|
75
|
+
length: records.length,
|
|
76
|
+
}), "success");
|
|
77
|
+
onClose();
|
|
78
|
+
setFilteredInputValue("");
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
addToast(t("find_and_replace_modal.no_records_found"), "error");
|
|
82
|
+
}
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); };
|
|
43
87
|
return (_jsx(Modal, __assign({ isOpen: true, onClose: function () { return onClose(); } }, { children: _jsxs(Div, __assign({ p: "17px 20px", w: 500 }, { children: [_jsx(Div, __assign({ textAlignCenter: true, h5: true }, { children: t("find_and_replace_modal.title") })), _jsx(Div, __assign({ mt: 20, mb: 20, textAlignCenter: true, body1: true }, { children: t("find_and_replace_modal.description") })), _jsxs(Div, __assign({ mb: 20, w: 500, textAlignCenter: true, body1: true }, { children: [_jsx(TextInput, { "data-cy": "find-input", mb: 20, name: t("find_and_replace_modal.find"), label: t("find_and_replace_modal.find"), value: searchText, onChange: function (value) { return setSearchText(value); } }), _jsx(TextInput, { "data-cy": "replace-input", label: t("find_and_replace_modal.replace_with"), value: replaceText, onChange: function (value) { return setReplaceText(value); } })] })), _jsx(Div, __assign({ mb: 12 }, { children: _jsx(Checkbox, { "data-cy": "use-regex", label: t("find_and_replace_modal.use_regex"), isChecked: useRegex, onChange: function (v) { return setUseRegex(v); } }) })), _jsx(Div, __assign({ mb: 12 }, { children: _jsx(Checkbox, { "data-cy": "case-sensitive", label: t("find_and_replace_modal.use_case_sensitive"), isChecked: matchCase, onChange: function (v) { return setMatchCase(v); } }) })), _jsxs(Div, __assign({ dflex: true, centered: true, mt: 40 }, { children: [_jsx(Button, __assign({ variant: "secondary", onClick: function () { return onClose(); }, w: 160, mr: 16 }, { children: t("find_and_replace_modal.cancel") })), _jsx(Button, __assign({ "data-cy": "find-replace-submit", variant: "primary", onClick: function () { return findAndReplace(); } }, { children: t("find_and_replace_modal.submit") }))] }))] })) })));
|
|
44
88
|
};
|
|
@@ -23,21 +23,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
25
25
|
import { areEqual } from "react-window";
|
|
26
|
-
import { TableActions } from "../../../../common/Table/TableActions";
|
|
27
26
|
import { useImporterContext } from "../../../../Importer/contexts/ImporterContextProvider";
|
|
27
|
+
import { TableActions } from "../../../../common/Table/TableActions";
|
|
28
28
|
import { Div } from "../../../../styled/utils";
|
|
29
29
|
import useWindowDimensions from "../../../../utils/hooks/useWindowSize";
|
|
30
30
|
import { getTableHeight } from "../../../common";
|
|
31
|
-
import {
|
|
31
|
+
import { useDataSetContext } from "../DataSetContextProvider";
|
|
32
|
+
import { useFilteredDataContext } from "../FilteredDataContextProvider";
|
|
32
33
|
import { useSpreadsheetContext } from "../SpreadsheetContextProvider";
|
|
34
|
+
import { useValidationContext } from "../ValidationContextProvider";
|
|
35
|
+
import { spreadsheetHeaderHeightPx, spreadsheetRowHeightPx } from "../common";
|
|
33
36
|
import * as S from "../styles";
|
|
34
37
|
import { FieldHeader } from "./FieldHeader";
|
|
35
38
|
import GlobalStyle from "./GlobalStyle";
|
|
36
|
-
import { inputTypes } from "./inputs";
|
|
37
39
|
import { SpreadsheetRowCheckboxes } from "./SpreadsheetRowCheckboxes";
|
|
38
|
-
import {
|
|
39
|
-
import { useFilteredDataContext } from "../FilteredDataContextProvider";
|
|
40
|
-
import { useValidationContext } from "../ValidationContextProvider";
|
|
40
|
+
import { inputTypes } from "./inputs";
|
|
41
41
|
var getItemKey = function (record) { return record._meta.id; };
|
|
42
42
|
var SpreadsheetData = function (props) {
|
|
43
43
|
var _a = useSpreadsheetContext(), fields = _a.fields, filteredDataIds = _a.filteredDataIds, isReadOnly = _a.isReadOnly, options = _a.options, selectedRows = _a.selectedRows, setSelectedRows = _a.setSelectedRows, checkboxColumnWidth = _a.checkboxColumnWidth;
|
|
@@ -113,6 +113,6 @@ var SpreadsheetData = function (props) {
|
|
|
113
113
|
currentStepIndex === 0, dflex: true, h100: true }, { children: [(options === null || options === void 0 ? void 0 : options.showCheckboxColumn) && (_jsx(SpreadsheetRowCheckboxes, { gridRef: rowCheckboxesGridRef, height: spreadsheetHeight, isLoadingData: showValidationProgress })), _jsx(S.TableView, { rowCount: filteredDataIds.length, tableHeadersHeight: spreadsheetHeaderHeightPx, rowHeight: spreadsheetRowHeightPx, h: null, rowWidthScalingFactor: rowWidthScalingFactor, dataRefIds: {
|
|
114
114
|
ref: dataSet,
|
|
115
115
|
ids: filteredDataIds,
|
|
116
|
-
}, columns: columns, onTableScroll: onTableScroll, getItemKey: getItemKey, checkboxColumnWidth: checkboxColumnWidth, isFiltering: isFiltering })] }))] }))] })));
|
|
116
|
+
}, columns: columns, onTableScroll: onTableScroll, getItemKey: getItemKey, checkboxColumnWidth: checkboxColumnWidth, isFiltering: isFiltering, shouldHideTable: dataLength === 0 })] }))] }))] })));
|
|
117
117
|
};
|
|
118
118
|
export default React.memo(SpreadsheetData, areEqual);
|
|
@@ -40,13 +40,13 @@ import { FixedSizeGrid as Grid } from "react-window";
|
|
|
40
40
|
import styled, { css } from "styled-components";
|
|
41
41
|
import { Checkbox } from "../../../../common/inputs/Checkbox";
|
|
42
42
|
import { Div } from "../../../../styled/utils";
|
|
43
|
-
import { useImporterContext } from "../../../contexts/ImporterContextProvider";
|
|
44
43
|
import { useReviewContext } from "../../../Review/ReviewContextProvider";
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
44
|
+
import { useImporterContext } from "../../../contexts/ImporterContextProvider";
|
|
45
|
+
import { useDataSetContext } from "../DataSetContextProvider";
|
|
47
46
|
import { useSpreadsheetContext } from "../SpreadsheetContextProvider";
|
|
48
47
|
import { rowIsEmpty } from "../SpreadsheetContextProvider/utils";
|
|
49
|
-
import {
|
|
48
|
+
import { spreadsheetRowHeightPx } from "../common";
|
|
49
|
+
import { spreadsheetHeaderHeightPx } from "../common/index";
|
|
50
50
|
var StyledGrid = styled(Grid)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n overflow-y: scroll;\n"], ["\n background: ", ";\n overflow-y: scroll;\n"])), function (_a) {
|
|
51
51
|
var theme = _a.theme;
|
|
52
52
|
return theme.colors.white50;
|
|
@@ -60,14 +60,14 @@ var gridStyles = {
|
|
|
60
60
|
export var SpreadsheetRowCheckboxes = function (_a) {
|
|
61
61
|
var height = _a.height, gridRef = _a.gridRef, isLoadingData = _a.isLoadingData, props = __rest(_a, ["height", "gridRef", "isLoadingData"]);
|
|
62
62
|
var _b = useSpreadsheetContext(), selectedRows = _b.selectedRows, options = _b.options, filteredDataIds = _b.filteredDataIds, lastClickedIndexRef = _b.lastClickedIndexRef, setSelectedRows = _b.setSelectedRows, checkboxColumnWidth = _b.checkboxColumnWidth;
|
|
63
|
-
var
|
|
63
|
+
var hasTransformedRecords = useReviewContext().hasTransformedRecords;
|
|
64
64
|
var getRecord = useDataSetContext().getRecord;
|
|
65
65
|
var currentStepIndex = useImporterContext().currentStepIndex;
|
|
66
66
|
var nonEmptyRows = useMemo(function () { return filteredDataIds.filter(function (rowId) { return !rowIsEmpty(getRecord(rowId)); }); }, [filteredDataIds]);
|
|
67
67
|
var isIndeterminate = selectedRows.length > 0 && selectedRows.length < nonEmptyRows.length;
|
|
68
68
|
var handleRowSelect = function (checked, rowIndex, rowMetaId) {
|
|
69
69
|
var _a;
|
|
70
|
-
if (
|
|
70
|
+
if (hasTransformedRecords)
|
|
71
71
|
return;
|
|
72
72
|
var recordId = filteredDataIds[rowIndex];
|
|
73
73
|
var record = getRecord(recordId);
|
|
@@ -93,7 +93,7 @@ export var SpreadsheetRowCheckboxes = function (_a) {
|
|
|
93
93
|
};
|
|
94
94
|
var handleSelectMultipleRows = function (rowIndex) {
|
|
95
95
|
var _a;
|
|
96
|
-
if (
|
|
96
|
+
if (hasTransformedRecords)
|
|
97
97
|
return;
|
|
98
98
|
var rowId = filteredDataIds[rowIndex];
|
|
99
99
|
var record = getRecord(rowId);
|
|
@@ -133,7 +133,7 @@ export var SpreadsheetRowCheckboxes = function (_a) {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
var handleSelectAllRows = function (checked) {
|
|
136
|
-
if (
|
|
136
|
+
if (hasTransformedRecords)
|
|
137
137
|
return;
|
|
138
138
|
if (checked) {
|
|
139
139
|
var allRows = filteredDataIds.filter(function (recordId) {
|
|
@@ -34,10 +34,9 @@ export var SpreadsheetAutocomplete = function (props) {
|
|
|
34
34
|
var _a, _b, _c;
|
|
35
35
|
var name = props.name, record = props.record, options = props.options, fieldType = props.fieldType, _d = props.isInputDisabled, isInputDisabled = _d === void 0 ? false : _d, id = props.id;
|
|
36
36
|
var _e = useSpreadsheetField(name, record, fieldType), value = _e.value, setValue = _e.setValue, validationError = _e.validationError, validationWarning = _e.validationWarning;
|
|
37
|
-
var
|
|
38
|
-
var isHighlighted =
|
|
39
|
-
|
|
40
|
-
return (_jsx(SpreadsheetField, __assign({ validationError: validationError, validationWarning: validationWarning, isHighlighted: isHighlighted }, { children: _jsx(Autocomplete, { placement: "bottom", isInputDisabled: isInputDisabled, hasError: !!validationError, hasWarning: !!validationWarning, options: options, value: value, icon: chevronDownIcon, onChange: function (v) { return !isTransformTooltipOpened && setValue(v); }, disabledWhen: isTransformTooltipOpened, id: id }) })));
|
|
37
|
+
var hasTransformedRecords = useReviewContext().hasTransformedRecords;
|
|
38
|
+
var isHighlighted = hasTransformedRecords && ((_c = (_b = (_a = record._meta) === null || _a === void 0 ? void 0 : _a.transformedRow) === null || _b === void 0 ? void 0 : _b[name]) === null || _c === void 0 ? void 0 : _c.transformed);
|
|
39
|
+
return (_jsx(SpreadsheetField, __assign({ validationError: validationError, validationWarning: validationWarning, isHighlighted: isHighlighted }, { children: _jsx(Autocomplete, { placement: "bottom", isInputDisabled: isInputDisabled, hasError: !!validationError, hasWarning: !!validationWarning, options: options, value: value, icon: chevronDownIcon, onChange: function (v) { return !hasTransformedRecords && setValue(v); }, disabledWhen: hasTransformedRecords, id: id }) })));
|
|
41
40
|
};
|
|
42
41
|
var chevronDownIcon = (_jsx("svg", __assign({ width: "10", height: "6", viewBox: "0 0 10 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M8.46289 1L4.98131 4.48159L1.49972 1", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })));
|
|
43
42
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -39,16 +39,15 @@ export var SpreadsheetInput = function (_a) {
|
|
|
39
39
|
var _b, _c, _d, _e, _f, _g;
|
|
40
40
|
var name = _a.name, record = _a.record, fieldType = _a.fieldType, columnWidth = _a.columnWidth, props = __rest(_a, ["name", "record", "fieldType", "columnWidth"]);
|
|
41
41
|
var _h = useSpreadsheetField(name, record, fieldType), value = _h.value, setValue = _h.setValue, validationError = _h.validationError, validationWarning = _h.validationWarning;
|
|
42
|
-
var
|
|
42
|
+
var hasTransformedRecords = useReviewContext().hasTransformedRecords;
|
|
43
43
|
var defaultWidthAsNumber = Number.parseInt(columnWidth.replace("px", ""));
|
|
44
44
|
var _fieldContentWidth = getFieldContentWidth({
|
|
45
45
|
record: record,
|
|
46
46
|
fieldType: fieldType,
|
|
47
|
-
isTooltipOpened:
|
|
47
|
+
isTooltipOpened: hasTransformedRecords,
|
|
48
48
|
name: name,
|
|
49
49
|
});
|
|
50
|
-
var isHighlighted =
|
|
51
|
-
((_d = (_c = (_b = record._meta) === null || _b === void 0 ? void 0 : _b.transformedRow) === null || _c === void 0 ? void 0 : _c[name]) === null || _d === void 0 ? void 0 : _d.transformed);
|
|
50
|
+
var isHighlighted = hasTransformedRecords && ((_d = (_c = (_b = record._meta) === null || _b === void 0 ? void 0 : _b.transformedRow) === null || _c === void 0 ? void 0 : _c[name]) === null || _d === void 0 ? void 0 : _d.transformed);
|
|
52
51
|
var expandedFieldWidth = useMemo(function () {
|
|
53
52
|
// if the value is falsy, returns the default width
|
|
54
53
|
if (!value)
|
|
@@ -62,9 +61,9 @@ export var SpreadsheetInput = function (_a) {
|
|
|
62
61
|
}, [value, record, columnWidth]);
|
|
63
62
|
return (_jsxs(SpreadsheetField, __assign({ validationError: validationError, validationWarning: validationWarning, isHighlighted: isHighlighted, defaultFieldWidth: defaultWidthAsNumber, expandedFieldWidth: expandedFieldWidth, shouldExpandInput: true }, { children: [_jsx(Input, __assign({ autoComplete: "off", hasError: !!validationError, hasWarning: !!validationWarning, value: parseValue(value), onChange: function (_a) {
|
|
64
63
|
var value = _a.target.value;
|
|
65
|
-
return !
|
|
66
|
-
}, disabledWhen:
|
|
67
|
-
|
|
64
|
+
return !hasTransformedRecords && setValue(value);
|
|
65
|
+
}, disabledWhen: hasTransformedRecords }, props)), ((_g = (_f = (_e = record === null || record === void 0 ? void 0 : record._meta) === null || _e === void 0 ? void 0 : _e.transformedRow) === null || _f === void 0 ? void 0 : _f[name]) === null || _g === void 0 ? void 0 : _g.original) &&
|
|
66
|
+
hasTransformedRecords && (_jsx(SuffixText, __assign({ className: "suffix", fieldWidth: _fieldContentWidth }, { children: record._meta.transformedRow[name].original })))] })));
|
|
68
67
|
};
|
|
69
68
|
var SuffixText = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: #1c1c1c;\n font-family: DM Sans;\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n position: absolute;\n left: ", "px;\n text-decoration: line-through;\n white-space: nowrap;\n"], ["\n color: #1c1c1c;\n font-family: DM Sans;\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n position: absolute;\n left: ", "px;\n text-decoration: line-through;\n white-space: nowrap;\n"])), function (_a) {
|
|
70
69
|
var fieldWidth = _a.fieldWidth;
|
|
@@ -64,14 +64,14 @@ import { useValidationContext } from "../../ValidationContextProvider";
|
|
|
64
64
|
import { parseValue } from "../../common";
|
|
65
65
|
export var useSpreadsheetField = function (name, record, fieldType) {
|
|
66
66
|
var appendNewRecordToSpreadsheet = useDataSetManipulation().appendNewRecordToSpreadsheet;
|
|
67
|
-
var
|
|
68
|
-
var
|
|
67
|
+
var _a = useFilteredDataContext(), lastFilteredRecordId = _a.lastFilteredRecordId, spreadsheetFilter = _a.spreadsheetFilter;
|
|
68
|
+
var _b = useValidationContext(), updateRecordAndRevalidate = _b.updateRecordAndRevalidate, warnings = _b.warnings, errors = _b.errors;
|
|
69
69
|
var getRecord = useDataSetContext().getRecord;
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
70
|
+
var _c = useState(record), recordState = _c[0], setRecordState = _c[1];
|
|
71
|
+
var _d = useState(record[name]), value = _d[0], setValue = _d[1];
|
|
72
|
+
var _e = useEventManagerContext(), on = _e.on, off = _e.off;
|
|
73
|
+
var _f = useState(get(errors.current, "".concat(record._meta.id, ".").concat(name), null)), validationError = _f[0], setValidationError = _f[1];
|
|
74
|
+
var _g = useState(get(warnings.current, "".concat(record._meta.id, ".").concat(name), null)), validationWarning = _g[0], setValidationWarning = _g[1];
|
|
75
75
|
useEffect(function () {
|
|
76
76
|
var listener = function (newRecord) {
|
|
77
77
|
var _record = getRecord(record._meta.id);
|
|
@@ -91,7 +91,8 @@ export var useSpreadsheetField = function (name, record, fieldType) {
|
|
|
91
91
|
_record[name] = parseValue(fieldType, value);
|
|
92
92
|
updateRecordAndRevalidate(_record);
|
|
93
93
|
setRecordState(_record);
|
|
94
|
-
if (record._meta.id === lastFilteredRecordId.current
|
|
94
|
+
if (record._meta.id === lastFilteredRecordId.current &&
|
|
95
|
+
spreadsheetFilter.byRow === "all") {
|
|
95
96
|
appendNewRecordToSpreadsheet();
|
|
96
97
|
}
|
|
97
98
|
return [2 /*return*/];
|
|
@@ -113,7 +114,7 @@ export var useSpreadsheetField = function (name, record, fieldType) {
|
|
|
113
114
|
validationWarning: validationWarning,
|
|
114
115
|
};
|
|
115
116
|
};
|
|
116
|
-
var ContentContainer = styled(Div)(
|
|
117
|
+
var ContentContainer = styled(Div)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n height: calc(100% - 1px);\n width: ", ";\n overflow: hidden;\n\n ", "\n\n &:focus-within, \n &:hover {\n ", "\n }\n\n &:focus-within, \n &:hover {\n ", "\n }\n\n ", ";\n ", "\n ", "\n ", "\n\n ", "\n\n ", "\n"], ["\n height: calc(100% - 1px);\n width: ", ";\n overflow: hidden;\n\n ", "\n\n &:focus-within, \n &:hover {\n ", "\n }\n\n &:focus-within, \n &:hover {\n ", "\n }\n\n ", ";\n ", "\n ", "\n ", "\n\n ", "\n\n ", "\n"])), function (_a) {
|
|
117
118
|
var defaultFieldWidth = _a.defaultFieldWidth;
|
|
118
119
|
return defaultFieldWidth ? "".concat(defaultFieldWidth, "px") : "100%";
|
|
119
120
|
}, function (_a) {
|
|
@@ -128,19 +129,23 @@ var ContentContainer = styled(Div)(templateObject_8 || (templateObject_8 = __mak
|
|
|
128
129
|
: theme.colors.blue100, function (p) { return p.theme.colors.blue500; });
|
|
129
130
|
}, function (_a) {
|
|
130
131
|
var expandedFieldWidth = _a.expandedFieldWidth, shouldExpandInput = _a.shouldExpandInput;
|
|
131
|
-
return shouldExpandInput && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n
|
|
132
|
+
return shouldExpandInput && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n\n .suffix {\n right: 12px;\n }\n "], ["\n width: ", ";\n\n .suffix {\n right: 12px;\n }\n "])), expandedFieldWidth || "auto");
|
|
132
133
|
}, function (p) { return p.theme.css.alignCenter; }, function (p) {
|
|
133
|
-
return p.
|
|
134
|
+
return p.hasWarning && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 1px ", " inset;\n "], ["\n color: ", ";\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 1px ", " inset;\n "])), function (p) { return p.theme.colors.orange1200; }, function (p) { return p.theme.colors.orange1100; }, function (p) { return p.theme.colors.orange500; });
|
|
134
135
|
}, function (p) {
|
|
135
|
-
return p.
|
|
136
|
+
return p.hasError && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 1px ", " inset;\n "], ["\n color: ", ";\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 1px ", " inset;\n "])), function (p) { return p.theme.colors.error; }, function (p) { return p.theme.colors.red100; }, function (p) { return p.theme.colors.error; });
|
|
136
137
|
}, function (p) {
|
|
137
|
-
return p.
|
|
138
|
+
return p.isHighlighted && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 2px ", " inset;\n z-index: 99;\n color: ", ";\n\n &:hover {\n z-index: 100;\n }\n\n input {\n color: ", ";\n }\n "], ["\n background: ", ";\n /* internal border */\n box-shadow: 0px 0px 0px 2px ", " inset;\n z-index: 99;\n color: ", ";\n\n &:hover {\n z-index: 100;\n }\n\n input {\n color: ", ";\n }\n "])), function (p) { return p.theme.colors.blue100; }, function (p) { return p.theme.colors.blue500; }, function (p) { return p.theme.colors.gray1000; }, function (p) { return p.theme.colors.gray1000; });
|
|
139
|
+
}, function (_a) {
|
|
140
|
+
var shouldExpandInput = _a.shouldExpandInput, isHighlighted = _a.isHighlighted;
|
|
141
|
+
return shouldExpandInput &&
|
|
142
|
+
!isHighlighted && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n z-index: 1;\n "], ["\n z-index: 1;\n "])));
|
|
138
143
|
}, function (p) {
|
|
139
|
-
return p.isReadOnly && css(
|
|
144
|
+
return p.isReadOnly && css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
140
145
|
});
|
|
141
146
|
export var SpreadsheetField = function (_a) {
|
|
142
147
|
var validationError = _a.validationError, validationWarning = _a.validationWarning, children = _a.children, isHighlighted = _a.isHighlighted, expandedFieldWidth = _a.expandedFieldWidth, shouldExpandInput = _a.shouldExpandInput, defaultFieldWidth = _a.defaultFieldWidth;
|
|
143
148
|
var isReadOnly = useSpreadsheetContext().isReadOnly;
|
|
144
149
|
return (_jsx(Div, __assign({ dim: "100%" }, { children: _jsx(TooltipProvider, __assign({ tooltip: validationError || validationWarning }, { children: _jsx(Div, __assign({ dim: "100%" }, { children: _jsx(ContentContainer, __assign({ hasError: validationError !== null, hasWarning: validationWarning !== null, isHighlighted: isHighlighted, expandedFieldWidth: expandedFieldWidth, defaultFieldWidth: defaultFieldWidth, shouldExpandInput: shouldExpandInput, isReadOnly: isReadOnly, className: "input-content" }, { children: children })) })) })) })));
|
|
145
150
|
};
|
|
146
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
151
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DuplicateValuesCollection, Field, FieldValidation } from "../../../../types";
|
|
2
1
|
import { MutableRefObject } from "react";
|
|
2
|
+
import { DuplicateValuesCollection, Field, FieldValidation } from "../../../../types";
|
|
3
3
|
export type FieldValidator = (field: Field, fieldValue: any, validation?: FieldValidation, duplicateValues?: MutableRefObject<DuplicateValuesCollection>, customErrorMessage?: string) => null | string;
|
|
4
4
|
export type FieldValidations = Partial<{
|
|
5
5
|
[key: string]: FieldValidator;
|
|
@@ -99,6 +99,7 @@ export var fieldValidations = {
|
|
|
99
99
|
var _a;
|
|
100
100
|
if (!isNullOrUndefined(fieldValue) &&
|
|
101
101
|
!isNullOrUndefined(duplicateValues.current)) {
|
|
102
|
+
fieldValue = String(fieldValue);
|
|
102
103
|
var isDuplicated = duplicateValues.current[field.name] &&
|
|
103
104
|
duplicateValues.current[field.name][fieldValue] &&
|
|
104
105
|
duplicateValues.current[field.name][fieldValue].length > 1;
|
|
@@ -110,6 +111,7 @@ export var fieldValidations = {
|
|
|
110
111
|
var _a;
|
|
111
112
|
if (!isNullOrUndefined(fieldValue) &&
|
|
112
113
|
!isNullOrUndefined(duplicateValues.current)) {
|
|
114
|
+
fieldValue = String(fieldValue);
|
|
113
115
|
var isDuplicated = duplicateValues.current[field.name] &&
|
|
114
116
|
duplicateValues.current[field.name][fieldValue.toLowerCase()] &&
|
|
115
117
|
duplicateValues.current[field.name][fieldValue.toLowerCase()].length >
|
|
@@ -59,6 +59,7 @@ export type State = {
|
|
|
59
59
|
customActions: CustomAction[];
|
|
60
60
|
headerMappingsLoaded: boolean;
|
|
61
61
|
valueMappingsLoaded: boolean;
|
|
62
|
+
headersMappings: HeaderMappings[];
|
|
62
63
|
};
|
|
63
64
|
export type Props = {
|
|
64
65
|
templateSlug: string;
|
|
@@ -73,5 +74,9 @@ export type Props = {
|
|
|
73
74
|
dynamicColumns: TemplateHeader[] | null;
|
|
74
75
|
customActions: CustomAction[];
|
|
75
76
|
};
|
|
77
|
+
type HeaderMappings = {
|
|
78
|
+
[key: string]: string;
|
|
79
|
+
};
|
|
76
80
|
export declare const ImporterContextProvider: ({ templateSlug, initialRecords, apiToken, children, options, onSubmit, onClose, formatRecord, onValidateRecord, dynamicColumns, customActions, }: Props) => JSX.Element;
|
|
77
81
|
export declare const useImporterContext: () => State;
|
|
82
|
+
export {};
|
|
@@ -77,7 +77,7 @@ export var ImporterContextProvider = function (_a) {
|
|
|
77
77
|
logoURL: null,
|
|
78
78
|
}), style = _l[0], setStyle = _l[1];
|
|
79
79
|
var _m = useState(null), templateHeaderMatchings = _m[0], setTemplateHeaderMatchings = _m[1];
|
|
80
|
-
var _o = useState(
|
|
80
|
+
var _o = useState({}), enumFieldValueMatchings = _o[0], setEnumFieldValueMatchings = _o[1];
|
|
81
81
|
var _p = useState(null), uploadedDataEnumFieldValues = _p[0], setUploadedDataEnumFieldValues = _p[1];
|
|
82
82
|
var _q = useState([]), selectedRows = _q[0], setSelectedRows = _q[1];
|
|
83
83
|
var isUsingManualImport = useRef(false);
|
|
@@ -230,7 +230,9 @@ export var ImporterContextProvider = function (_a) {
|
|
|
230
230
|
}
|
|
231
231
|
}, [uploadedDataHeaders, headersMappings]);
|
|
232
232
|
useEffect(function () {
|
|
233
|
-
if (!templateHeaderMatchings ||
|
|
233
|
+
if (!templateHeaderMatchings ||
|
|
234
|
+
!uploadedDataHeaders ||
|
|
235
|
+
!headerMappingsLoaded)
|
|
234
236
|
return;
|
|
235
237
|
var _uploadedDataEnumFieldValues = {};
|
|
236
238
|
var templateLabels = Object.keys(templateHeaderMatchings);
|
|
@@ -252,8 +254,13 @@ export var ImporterContextProvider = function (_a) {
|
|
|
252
254
|
});
|
|
253
255
|
});
|
|
254
256
|
setUploadedDataEnumFieldValues(_uploadedDataEnumFieldValues);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
var valueLimitPerEnumField = Math.ceil(40 / enumFieldsLabels.length);
|
|
258
|
+
var enumFieldsLabelsLimited = {};
|
|
259
|
+
Object.keys(_uploadedDataEnumFieldValues).forEach(function (key) {
|
|
260
|
+
enumFieldsLabelsLimited[key] = _uploadedDataEnumFieldValues[key].slice(0, valueLimitPerEnumField);
|
|
261
|
+
});
|
|
262
|
+
loadValueMappings(enumFieldsLabelsLimited);
|
|
263
|
+
}, [headerMappingsLoaded, matcherSubstep]);
|
|
257
264
|
useEffect(function () {
|
|
258
265
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
266
|
var _a, organization_1, columns_1, importer_style_preferences, integrations_1, preview_first_time, error_1, errorMsg;
|
|
@@ -300,7 +307,8 @@ export var ImporterContextProvider = function (_a) {
|
|
|
300
307
|
setUploadedData(null);
|
|
301
308
|
setTemplateHeaderMatchings(null);
|
|
302
309
|
setHeadersMappings(null);
|
|
303
|
-
setEnumFieldValueMatchings(
|
|
310
|
+
setEnumFieldValueMatchings({});
|
|
311
|
+
setUploadedDataEnumFieldValues(null);
|
|
304
312
|
setSelectedRows([]);
|
|
305
313
|
setHeaderRowIndex(0);
|
|
306
314
|
};
|
|
@@ -361,6 +369,7 @@ export var ImporterContextProvider = function (_a) {
|
|
|
361
369
|
customActions: customActions,
|
|
362
370
|
headerMappingsLoaded: headerMappingsLoaded,
|
|
363
371
|
valueMappingsLoaded: valueMappingsLoaded,
|
|
372
|
+
headersMappings: headersMappings,
|
|
364
373
|
};
|
|
365
374
|
return (_jsx(ImporterContext.Provider, __assign({ value: value }, { children: children })));
|
|
366
375
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppResponse, RecordDataSet } from "../../types";
|
|
2
|
-
export declare const useSubmitToServer: (
|
|
2
|
+
export declare const useSubmitToServer: (setHasTransformedRecords: any) => {
|
|
3
3
|
appResponse: AppResponse;
|
|
4
4
|
isSubmitting: boolean;
|
|
5
5
|
onSubmitToServer: (dataSet: RecordDataSet, afterSubmitCallback: (dataSet: RecordDataSet) => void) => Promise<void>;
|