fuse-importer 0.1.4-testing → 0.1.6-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 +38 -7
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +1 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/index.js +4 -3
- package/lib/esm/Importer/Matcher/HeaderMatcher/index.js +14 -9
- package/lib/esm/Importer/PreviewFirstTime.js +1 -1
- package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +6 -6
- package/lib/esm/Importer/Review/ReviewContextProvider.js +51 -223
- package/lib/esm/Importer/Review/ReviewWithContext.js +2 -2
- package/lib/esm/Importer/Stepper/StepperSubmitModal.d.ts +2 -1
- package/lib/esm/Importer/Stepper/StepperSubmitModal.js +4 -2
- package/lib/esm/Importer/Stepper/UnmatchedHeadersModal.js +1 -1
- package/lib/esm/Importer/Stepper/index.js +20 -69
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.d.ts +2 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +14 -86
- package/lib/esm/Importer/Uploader/DragAndDropImporter/index.js +11 -3
- package/lib/esm/Importer/Uploader/HeadersPreview.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/DataSetContextProvider/index.d.ts +16 -0
- package/lib/esm/Importer/common/Spreadsheet/DataSetContextProvider/index.js +63 -0
- package/lib/esm/Importer/common/Spreadsheet/DuplicateDataContextProvider/index.d.ts +18 -0
- package/lib/esm/Importer/common/Spreadsheet/DuplicateDataContextProvider/index.js +101 -0
- package/lib/esm/Importer/common/Spreadsheet/FilteredDataContextProvider/index.d.ts +29 -0
- package/lib/esm/Importer/common/Spreadsheet/FilteredDataContextProvider/index.js +150 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/filterMethods.d.ts +6 -4
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/filterMethods.js +37 -37
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/hashCalculators.d.ts +6 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/hashCalculators.js +138 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.d.ts +7 -29
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.js +11 -193
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useBatchProcessing.d.ts +5 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useBatchProcessing.js +72 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useDataSetManipulation.d.ts +4 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useDataSetManipulation.js +46 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/utils.js +2 -1
- package/lib/esm/Importer/common/Spreadsheet/ValidationContextProvider/index.d.ts +31 -0
- package/lib/esm/Importer/common/Spreadsheet/ValidationContextProvider/index.js +304 -0
- package/lib/esm/Importer/common/Spreadsheet/common/index.js +5 -4
- package/lib/esm/Importer/common/Spreadsheet/common/types.d.ts +2 -3
- package/lib/esm/Importer/common/Spreadsheet/components/FieldHeader.d.ts +0 -2
- package/lib/esm/Importer/common/Spreadsheet/components/FieldHeader.js +26 -11
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +21 -13
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +35 -36
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowNumbers.js +3 -3
- package/lib/esm/Importer/common/Spreadsheet/components/fields/SpreadsheetInput.js +5 -1
- package/lib/esm/Importer/common/Spreadsheet/components/fields/index.js +44 -18
- package/lib/esm/Importer/common/Spreadsheet/components/inputs/index.js +1 -2
- package/lib/esm/Importer/common/Spreadsheet/index.d.ts +0 -1
- package/lib/esm/Importer/common/Spreadsheet/index.js +1 -84
- package/lib/esm/Importer/common/Spreadsheet/styles.d.ts +1 -2
- package/lib/esm/Importer/common/Spreadsheet/styles.js +13 -1
- package/lib/esm/Importer/common/Spreadsheet/transformation/index.d.ts +2 -1
- package/lib/esm/Importer/common/Spreadsheet/transformation/index.js +9 -5
- package/lib/esm/Importer/common/Spreadsheet/transformation/transformators.d.ts +8 -2
- package/lib/esm/Importer/common/Spreadsheet/transformation/transformators.js +4 -16
- package/lib/esm/Importer/common/Spreadsheet/useFieldSorting.d.ts +5 -0
- package/lib/esm/Importer/common/Spreadsheet/useFieldSorting.js +81 -0
- package/lib/esm/Importer/common/Spreadsheet/validation/index.d.ts +5 -3
- package/lib/esm/Importer/common/Spreadsheet/validation/index.js +13 -17
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.d.ts +3 -2
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.js +16 -7
- package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +4 -2
- package/lib/esm/Importer/contexts/ImporterContextProvider.js +121 -13
- package/lib/esm/Importer/data/index.d.ts +1 -0
- package/lib/esm/Importer/data/index.js +44 -5
- package/lib/esm/Importer/hooks/useExportDataToFile.d.ts +5 -0
- package/lib/esm/Importer/hooks/useExportDataToFile.js +54 -0
- package/lib/esm/Importer/hooks/useSubmitToServer.d.ts +7 -0
- package/lib/esm/Importer/hooks/useSubmitToServer.js +192 -0
- package/lib/esm/common/EventManagerContextProvider/index.d.ts +22 -0
- package/lib/esm/common/EventManagerContextProvider/index.js +38 -0
- package/lib/esm/common/FileUploadDropzone/ImporterDropzone.d.ts +16 -0
- package/lib/esm/common/FileUploadDropzone/ImporterDropzone.js +108 -0
- package/lib/esm/common/FileUploadDropzone/index.d.ts +1 -0
- package/lib/esm/common/FileUploadDropzone/index.js +1 -0
- package/lib/esm/common/Table/TableActions/CustomActions/CustomActions.js +55 -41
- package/lib/esm/common/Table/TableActions/DeleteSelectedRows.js +25 -16
- package/lib/esm/common/Table/TableActions/ExportData.js +5 -3
- package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.js +38 -9
- package/lib/esm/common/Table/TableActions/RowFilters.js +53 -5
- package/lib/esm/common/Table/TableActions/SearchRows.js +3 -1
- package/lib/esm/common/Table/TableActions/TableActions.js +2 -1
- package/lib/esm/common/Table/TableActions/TableActions.styles.js +1 -1
- package/lib/esm/common/Table/TableActions/TransformedRecordsCount.d.ts +1 -0
- package/lib/esm/common/Table/TableActions/TransformedRecordsCount.js +25 -17
- package/lib/esm/common/Table/TableActions/ValidationProgress.d.ts +2 -0
- package/lib/esm/common/Table/TableActions/ValidationProgress.js +22 -0
- package/lib/esm/common/Table/TableView/TableRows/TableRow.d.ts +1 -1
- package/lib/esm/common/Table/TableView/TableRows/TableRow.js +2 -2
- package/lib/esm/common/Table/TableView/TableRows/index.js +21 -6
- package/lib/esm/common/Table/TableView/index.d.ts +1 -1
- package/lib/esm/common/Table/TableView/index.js +6 -15
- package/lib/esm/common/Table/TableView/types.d.ts +8 -9
- package/lib/esm/common/Table/index.d.ts +2 -1
- package/lib/esm/common/Table/index.js +2 -2
- package/lib/esm/common/Toast.js +3 -2
- package/lib/esm/common/TooltipProvider.d.ts +2 -0
- package/lib/esm/common/TooltipProvider.js +12 -9
- package/lib/esm/common/buttons.d.ts +5 -1
- package/lib/esm/common/buttons.js +13 -7
- package/lib/esm/common/columnsTransformations.js +1 -1
- package/lib/esm/common/datePatterns.d.ts +1 -0
- package/lib/esm/common/datePatterns.js +10 -0
- package/lib/esm/common/icons/index.d.ts +1 -0
- package/lib/esm/common/icons/index.js +1 -0
- package/lib/esm/common/index.d.ts +1 -0
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/inputs/Autocomplete.js +1 -1
- package/lib/esm/locales/de.d.ts +1 -1
- package/lib/esm/locales/de.js +1 -1
- package/lib/esm/locales/en.d.ts +1 -1
- package/lib/esm/locales/en.js +4 -4
- package/lib/esm/locales/es.d.ts +1 -1
- package/lib/esm/locales/es.js +1 -1
- package/lib/esm/locales/fr.d.ts +1 -1
- package/lib/esm/locales/fr.js +1 -1
- package/lib/esm/types.d.ts +20 -5
- package/lib/main.js +2 -2
- package/package.json +6 -4
- package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.d.ts +0 -8
- package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.js +0 -36
- package/lib/esm/Importer/common/Spreadsheet/components/ValidationProgress.d.ts +0 -5
- package/lib/esm/Importer/common/Spreadsheet/components/ValidationProgress.js +0 -19
- package/lib/esm/Importer/common/Spreadsheet/components/inputs/EmailInput.d.ts +0 -3
- package/lib/esm/Importer/common/Spreadsheet/components/inputs/EmailInput.js +0 -14
- package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +0 -33
- package/lib/esm/Importer/common/Spreadsheet/hooks.js +0 -256
- package/lib/esm/common/Table/TableActions/FilterByErrors/functions.d.ts +0 -11
- package/lib/esm/common/Table/TableActions/FilterByErrors/functions.js +0 -35
- package/lib/esm/common/Table/TableActions/hooks.d.ts +0 -18
- package/lib/esm/common/Table/TableActions/hooks.js +0 -41
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
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
|
+
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
57
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
58
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
59
|
+
import { useAppLoadingContext } from "../../../../common/AppLoadingContextProvider";
|
|
60
|
+
import { useEventManagerContext } from "../../../../common/EventManagerContextProvider";
|
|
61
|
+
import { useDataSetContext } from "../DataSetContextProvider";
|
|
62
|
+
import { useDuplicateDataContext } from "../DuplicateDataContextProvider";
|
|
63
|
+
import { useBatchProcessing } from "../SpreadsheetContextProvider/useBatchProcessing";
|
|
64
|
+
import { selectValidatorsFor, validateRecord } from "../validation";
|
|
65
|
+
// this is the fastest check for empty object as per
|
|
66
|
+
// https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object/785768#785768
|
|
67
|
+
var isObjectEmpty = function (obj) {
|
|
68
|
+
for (var i in obj) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
};
|
|
73
|
+
var checkIfHasErrors = function (_errors) {
|
|
74
|
+
return _errors && !isObjectEmpty(_errors);
|
|
75
|
+
};
|
|
76
|
+
var calculateFieldCountChangeInRecord = function (prevCountsInRecord, currCountsInRecord, globalFieldCounts, totalGlobalFieldCount) {
|
|
77
|
+
if (prevCountsInRecord === void 0) { prevCountsInRecord = {}; }
|
|
78
|
+
if (currCountsInRecord === void 0) { currCountsInRecord = {}; }
|
|
79
|
+
if (totalGlobalFieldCount === void 0) { totalGlobalFieldCount = null; }
|
|
80
|
+
var allFieldsInRecord = new Set(__spreadArray(__spreadArray([], Object.keys(prevCountsInRecord), true), Object.keys(currCountsInRecord), true));
|
|
81
|
+
allFieldsInRecord.forEach(function (fieldName) {
|
|
82
|
+
var _a;
|
|
83
|
+
var countChangeInRecord = (currCountsInRecord[fieldName] ? 1 : 0) -
|
|
84
|
+
(prevCountsInRecord[fieldName] ? 1 : 0);
|
|
85
|
+
if (!countChangeInRecord)
|
|
86
|
+
return;
|
|
87
|
+
globalFieldCounts.current = __assign(__assign({}, globalFieldCounts.current), (_a = {}, _a[fieldName] = (globalFieldCounts.current[fieldName] || 0) + countChangeInRecord, _a));
|
|
88
|
+
if (totalGlobalFieldCount)
|
|
89
|
+
totalGlobalFieldCount.current += countChangeInRecord;
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
export var ValidationContext = createContext({});
|
|
93
|
+
export var ValidationContextProvider = function (_a) {
|
|
94
|
+
var fields = _a.fields, isReadOnly = _a.isReadOnly, onValidateRecord = _a.onValidateRecord, children = _a.children;
|
|
95
|
+
var errors = useRef({});
|
|
96
|
+
var warnings = useRef({});
|
|
97
|
+
var _b = useState(0), validationPercentage = _b[0], setValidationPercentage = _b[1];
|
|
98
|
+
var validatorsCache = useMemo(function () { return selectValidatorsFor(fields); }, [fields]);
|
|
99
|
+
var setIsLoadingApp = useAppLoadingContext().setIsLoadingApp;
|
|
100
|
+
var columnsWithErrorCounts = useRef({});
|
|
101
|
+
var columnsWithWarningCounts = useRef({});
|
|
102
|
+
var totalErrorCount = useRef(0);
|
|
103
|
+
var invalidRowsCountRef = useRef(0);
|
|
104
|
+
var _c = useState(false), spreadsheetInitialized = _c[0], setSpreadsheetInitialized = _c[1];
|
|
105
|
+
var _d = useEventManagerContext(), emit = _d.emit, EVENTS = _d.EVENTS;
|
|
106
|
+
var _e = useDataSetContext(), getRecord = _e.getRecord, setRecord = _e.setRecord, dataSet = _e.dataSet;
|
|
107
|
+
var _f = useDuplicateDataContext(), duplicateValues = _f.duplicateValues, updateDuplicateValues = _f.updateDuplicateValues;
|
|
108
|
+
var processRecordsInBatches = useBatchProcessing(10000).processRecordsInBatches;
|
|
109
|
+
var reset = function () {
|
|
110
|
+
columnsWithErrorCounts.current = {};
|
|
111
|
+
columnsWithWarningCounts.current = {};
|
|
112
|
+
totalErrorCount.current = 0;
|
|
113
|
+
invalidRowsCountRef.current = 0;
|
|
114
|
+
};
|
|
115
|
+
var calculateColumnErrorCounts = function (oldErrors, newErrors) {
|
|
116
|
+
if (oldErrors === void 0) { oldErrors = {}; }
|
|
117
|
+
if (newErrors === void 0) { newErrors = {}; }
|
|
118
|
+
if (Object.keys(oldErrors).length === 0 &&
|
|
119
|
+
Object.keys(newErrors).length > 0)
|
|
120
|
+
invalidRowsCountRef.current += 1;
|
|
121
|
+
if (Object.keys(oldErrors).length > 0 &&
|
|
122
|
+
Object.keys(newErrors).length === 0)
|
|
123
|
+
invalidRowsCountRef.current -= 1;
|
|
124
|
+
calculateFieldCountChangeInRecord(oldErrors, newErrors, columnsWithErrorCounts, totalErrorCount);
|
|
125
|
+
};
|
|
126
|
+
var calculateColumnWarningCounts = function (oldWarnings, newWarnings) {
|
|
127
|
+
if (oldWarnings === void 0) { oldWarnings = {}; }
|
|
128
|
+
if (newWarnings === void 0) { newWarnings = {}; }
|
|
129
|
+
calculateFieldCountChangeInRecord(oldWarnings, newWarnings, columnsWithWarningCounts);
|
|
130
|
+
};
|
|
131
|
+
var batchValidationDelayMs = 100;
|
|
132
|
+
var sleep = function (n) { return new Promise(function (resolve) { return setTimeout(resolve, n); }); };
|
|
133
|
+
var getBackendErrors = function (record) {
|
|
134
|
+
var _a;
|
|
135
|
+
var recordBackendErrors = (_a = record === null || record === void 0 ? void 0 : record._meta) === null || _a === void 0 ? void 0 : _a.backendErrors;
|
|
136
|
+
return recordBackendErrors || null;
|
|
137
|
+
};
|
|
138
|
+
var _validateRecord = function (record, initialValidation) {
|
|
139
|
+
if (initialValidation === void 0) { initialValidation = false; }
|
|
140
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
+
var recordId, oldRecord, newRecord, backendErrors, _a, recordErrors, recordWarnings, hasError, hasWarning;
|
|
142
|
+
return __generator(this, function (_b) {
|
|
143
|
+
switch (_b.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
if (!record)
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
recordId = record._meta.id;
|
|
148
|
+
oldRecord = getRecord(recordId);
|
|
149
|
+
updateDuplicateValues(oldRecord, record, initialValidation, updateRecordAndRevalidate);
|
|
150
|
+
newRecord = setRecord(recordId, __assign({}, record));
|
|
151
|
+
backendErrors = getBackendErrors(record);
|
|
152
|
+
return [4 /*yield*/, validateRecord({
|
|
153
|
+
validatorsCache: validatorsCache,
|
|
154
|
+
onValidateRecord: onValidateRecord,
|
|
155
|
+
fields: fields,
|
|
156
|
+
record: newRecord,
|
|
157
|
+
duplicateValues: duplicateValues,
|
|
158
|
+
backendErrors: backendErrors,
|
|
159
|
+
})];
|
|
160
|
+
case 1:
|
|
161
|
+
_a = _b.sent(), recordErrors = _a.errors, recordWarnings = _a.warnings;
|
|
162
|
+
calculateColumnErrorCounts(errors.current[recordId], recordErrors);
|
|
163
|
+
calculateColumnWarningCounts(warnings.current[recordId], recordWarnings);
|
|
164
|
+
hasError = checkIfHasErrors(recordErrors);
|
|
165
|
+
hasWarning = checkIfHasErrors(recordWarnings);
|
|
166
|
+
newRecord._meta.isInvalid = hasError;
|
|
167
|
+
newRecord._meta.hasWarning = hasWarning;
|
|
168
|
+
if (hasError) {
|
|
169
|
+
errors.current[recordId] = recordErrors;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
delete errors.current[recordId];
|
|
173
|
+
}
|
|
174
|
+
if (hasWarning) {
|
|
175
|
+
warnings.current[recordId] = recordWarnings;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
delete warnings.current[recordId];
|
|
179
|
+
}
|
|
180
|
+
if (backendErrors) {
|
|
181
|
+
record._meta.backendErrors = {};
|
|
182
|
+
}
|
|
183
|
+
emit(recordId, newRecord);
|
|
184
|
+
return [2 /*return*/];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var updateValidationPercentage = function (recordsValidated, totalRecords) {
|
|
190
|
+
var validationPercentage = (Math.min(recordsValidated, totalRecords) / totalRecords) * 100;
|
|
191
|
+
setValidationPercentage(Math.round((validationPercentage + Number.EPSILON) * 10) / 10);
|
|
192
|
+
};
|
|
193
|
+
// Validate record and update dataSet
|
|
194
|
+
var updateRecordAndRevalidate = function (records, initialValidation) {
|
|
195
|
+
if (initialValidation === void 0) { initialValidation = false; }
|
|
196
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var recordsArray, length, recordsProcessed;
|
|
198
|
+
return __generator(this, function (_a) {
|
|
199
|
+
switch (_a.label) {
|
|
200
|
+
case 0:
|
|
201
|
+
recordsArray = Array.isArray(records) ? records : [records];
|
|
202
|
+
length = recordsArray.length;
|
|
203
|
+
if (!(length > 10000)) return [3 /*break*/, 2];
|
|
204
|
+
setIsLoadingApp(true);
|
|
205
|
+
// wait for the first render to complete
|
|
206
|
+
// before blocking main thread with review step logic
|
|
207
|
+
return [4 /*yield*/, sleep(200)];
|
|
208
|
+
case 1:
|
|
209
|
+
// wait for the first render to complete
|
|
210
|
+
// before blocking main thread with review step logic
|
|
211
|
+
_a.sent();
|
|
212
|
+
_a.label = 2;
|
|
213
|
+
case 2:
|
|
214
|
+
recordsProcessed = 0;
|
|
215
|
+
return [4 /*yield*/, processRecordsInBatches(recordsArray, function (batch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
216
|
+
var i, record;
|
|
217
|
+
return __generator(this, function (_a) {
|
|
218
|
+
switch (_a.label) {
|
|
219
|
+
case 0:
|
|
220
|
+
i = 0;
|
|
221
|
+
_a.label = 1;
|
|
222
|
+
case 1:
|
|
223
|
+
if (!(i < batch.length)) return [3 /*break*/, 4];
|
|
224
|
+
record = batch[i];
|
|
225
|
+
return [4 /*yield*/, _validateRecord(record, initialValidation)];
|
|
226
|
+
case 2:
|
|
227
|
+
_a.sent();
|
|
228
|
+
recordsProcessed += 1;
|
|
229
|
+
_a.label = 3;
|
|
230
|
+
case 3:
|
|
231
|
+
i++;
|
|
232
|
+
return [3 /*break*/, 1];
|
|
233
|
+
case 4:
|
|
234
|
+
updateValidationPercentage(recordsProcessed, length);
|
|
235
|
+
emit(EVENTS.UPDATE_COLUMN_ERROR_COUNT);
|
|
236
|
+
emit(EVENTS.UPDATE_TOTAL_ERROR_COUNT);
|
|
237
|
+
emit(EVENTS.UPDATE_TOTAL_ROW_COUNT);
|
|
238
|
+
return [4 /*yield*/, sleep(batchValidationDelayMs)];
|
|
239
|
+
case 5:
|
|
240
|
+
_a.sent();
|
|
241
|
+
return [2 /*return*/];
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}); })];
|
|
245
|
+
case 3:
|
|
246
|
+
_a.sent();
|
|
247
|
+
setIsLoadingApp(false);
|
|
248
|
+
return [2 /*return*/];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
// Initial data validation and update dataSet
|
|
254
|
+
useEffect(function () {
|
|
255
|
+
reset();
|
|
256
|
+
if (!dataSet.current || isReadOnly)
|
|
257
|
+
return;
|
|
258
|
+
setIsLoadingApp(true);
|
|
259
|
+
var initialValidation = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
260
|
+
var initialData;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
switch (_a.label) {
|
|
263
|
+
case 0:
|
|
264
|
+
initialData = Object.values(dataSet.current);
|
|
265
|
+
return [4 /*yield*/, updateRecordAndRevalidate(initialData, true)];
|
|
266
|
+
case 1:
|
|
267
|
+
_a.sent();
|
|
268
|
+
setSpreadsheetInitialized(true);
|
|
269
|
+
return [2 /*return*/];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}); };
|
|
273
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
+
return __generator(this, function (_a) {
|
|
275
|
+
switch (_a.label) {
|
|
276
|
+
case 0: return [4 /*yield*/, initialValidation()];
|
|
277
|
+
case 1:
|
|
278
|
+
_a.sent();
|
|
279
|
+
setIsLoadingApp(false);
|
|
280
|
+
return [2 /*return*/];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}); })();
|
|
284
|
+
}, [dataSet.current]);
|
|
285
|
+
var isValidationCompleted = validationPercentage === 100;
|
|
286
|
+
var isValid = isValidationCompleted && totalErrorCount.current === 0;
|
|
287
|
+
var value = {
|
|
288
|
+
errors: errors,
|
|
289
|
+
warnings: warnings,
|
|
290
|
+
totalErrorCount: totalErrorCount,
|
|
291
|
+
invalidRowsCountRef: invalidRowsCountRef,
|
|
292
|
+
columnsWithErrorCounts: columnsWithErrorCounts,
|
|
293
|
+
columnsWithWarningCounts: columnsWithWarningCounts,
|
|
294
|
+
calculateColumnErrorCounts: calculateColumnErrorCounts,
|
|
295
|
+
calculateColumnWarningCounts: calculateColumnWarningCounts,
|
|
296
|
+
validationPercentage: validationPercentage,
|
|
297
|
+
isValidationCompleted: isValidationCompleted,
|
|
298
|
+
isValid: isValid,
|
|
299
|
+
updateRecordAndRevalidate: updateRecordAndRevalidate,
|
|
300
|
+
spreadsheetInitialized: spreadsheetInitialized,
|
|
301
|
+
};
|
|
302
|
+
return (_jsx(ValidationContext.Provider, __assign({ value: value }, { children: children })));
|
|
303
|
+
};
|
|
304
|
+
export var useValidationContext = function () { return useContext(ValidationContext); };
|
|
@@ -5,10 +5,10 @@ export var isNullOrUndefined = function (value) {
|
|
|
5
5
|
return value === null || value === undefined;
|
|
6
6
|
};
|
|
7
7
|
export var isEmpty = function (value) {
|
|
8
|
-
return (value
|
|
9
|
-
value === null ||
|
|
8
|
+
return (isNullOrUndefined(value) ||
|
|
10
9
|
(typeof value === "object" && Object.keys(value).length === 0) ||
|
|
11
|
-
(typeof value === "string" &&
|
|
10
|
+
(typeof value === "string" &&
|
|
11
|
+
(value.length === 0 || value.trim().length === 0)));
|
|
12
12
|
};
|
|
13
13
|
export var isEmail = function (value) {
|
|
14
14
|
var emailRegex = /^[\w+.-]+@([\w-]+\.)+[\w-]{2,4}$/;
|
|
@@ -46,7 +46,8 @@ export var ignoreNullOrUndefinedKeyValues = function (obj) {
|
|
|
46
46
|
return result;
|
|
47
47
|
};
|
|
48
48
|
export var isRecordEmpty = function (record, fields) {
|
|
49
|
-
|
|
49
|
+
var hasValue = fields.some(function (f) { return !isEmpty(record[f.name]); });
|
|
50
|
+
return !hasValue;
|
|
50
51
|
};
|
|
51
52
|
export var parseValue = function (fieldType, value, enumSet) {
|
|
52
53
|
if (isEmpty(value))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DivCSSProps } from "../../../../styled";
|
|
3
|
-
import {
|
|
4
|
-
import { OnDataSetChanged
|
|
3
|
+
import { Field, OnValidateRecord, Record, RecordDataSet, SpreadsheetOptions } from "../../../../types";
|
|
4
|
+
import { OnDataSetChanged } from "../SpreadsheetContextProvider";
|
|
5
5
|
export declare enum SortOrder {
|
|
6
6
|
ASC = "asc",
|
|
7
7
|
DESC = "desc"
|
|
@@ -18,7 +18,6 @@ export type SpreadsheetProps = {
|
|
|
18
18
|
options?: SpreadsheetOptions;
|
|
19
19
|
onValidateRecord?: OnValidateRecord;
|
|
20
20
|
onDataSetChanged?: OnDataSetChanged;
|
|
21
|
-
onValidationStateChanged?: OnValidationStateChanged;
|
|
22
21
|
selectedRows?: string[];
|
|
23
22
|
setSelectedRows?: React.Dispatch<React.SetStateAction<string[]>>;
|
|
24
23
|
getSortCompareFn?: (sortBy: SortBy) => (a: Record, b: Record) => number;
|
|
@@ -7,8 +7,6 @@ type SortIndicatorProps = {
|
|
|
7
7
|
export declare const SortIndicator: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../../styled/utils").CSSProps & SortIndicatorProps, never>;
|
|
8
8
|
export type FieldHeaderProps = {
|
|
9
9
|
field: Field;
|
|
10
|
-
sortByFieldErrors: (name: string) => void;
|
|
11
|
-
sortByFieldWarnings: (name: string) => void;
|
|
12
10
|
};
|
|
13
11
|
export declare const FieldHeader: React.FC<FieldHeaderProps>;
|
|
14
12
|
export declare const chevronDown: JSX.Element;
|
|
@@ -14,11 +14,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
16
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import {
|
|
17
|
+
import { useEffect, useState } from "react";
|
|
18
18
|
import styled, { css } from "styled-components";
|
|
19
19
|
import { TooltipProvider } from "../../../../common";
|
|
20
|
+
import { useEventManagerContext } from "../../../../common/EventManagerContextProvider";
|
|
21
|
+
import { colors } from "../../../../styled/theme/colorPalette";
|
|
20
22
|
import { Div } from "../../../../styled/utils";
|
|
21
|
-
import {
|
|
23
|
+
import { useFilteredDataContext } from "../FilteredDataContextProvider";
|
|
24
|
+
import { useValidationContext } from "../ValidationContextProvider";
|
|
22
25
|
import { SortOrder } from "../common/types";
|
|
23
26
|
var ErrorCount = styled(Div)(function (_a) {
|
|
24
27
|
var _b = _a.theme, colors = _b.colors, c = _b.css;
|
|
@@ -28,11 +31,23 @@ export var SortIndicator = styled(Div)(templateObject_3 || (templateObject_3 = _
|
|
|
28
31
|
return p.direction === SortOrder.ASC && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform: rotate(180deg);\n "], ["\n transform: rotate(180deg);\n "])));
|
|
29
32
|
}, function (p) { return p.theme.colors.gray300; });
|
|
30
33
|
export var FieldHeader = function (_a) {
|
|
31
|
-
var field = _a.field
|
|
32
|
-
var _b =
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
34
|
+
var field = _a.field;
|
|
35
|
+
var _b = useValidationContext(), columnsWithErrorCounts = _b.columnsWithErrorCounts, columnsWithWarningCounts = _b.columnsWithWarningCounts;
|
|
36
|
+
var _c = useFilteredDataContext(), handleSortByFieldErrors = _c.handleSortByFieldErrors, handleSortByFieldWarnings = _c.handleSortByFieldWarnings, sortBy = _c.sortBy, setSortBy = _c.setSortBy, spreadsheetFilter = _c.spreadsheetFilter, filteredInputValue = _c.filteredInputValue;
|
|
37
|
+
var _d = useEventManagerContext(), on = _d.on, off = _d.off, EVENTS = _d.EVENTS;
|
|
38
|
+
var _e = useState(columnsWithErrorCounts.current[field.name] || null), fieldErrorCount = _e[0], setFieldErrorCount = _e[1];
|
|
39
|
+
var _f = useState(columnsWithWarningCounts.current[field.name] || null), fieldWarningCount = _f[0], setFieldWarningCount = _f[1];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var listener = function () {
|
|
42
|
+
setFieldErrorCount(columnsWithErrorCounts.current[field.name] || null);
|
|
43
|
+
};
|
|
44
|
+
on(EVENTS.UPDATE_COLUMN_ERROR_COUNT, listener);
|
|
45
|
+
return function () {
|
|
46
|
+
off(EVENTS.UPDATE_COLUMN_ERROR_COUNT, listener);
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
var shouldRenderErrorCount = fieldErrorCount !== null &&
|
|
50
|
+
fieldErrorCount > 0 &&
|
|
36
51
|
filteredInputValue === "" &&
|
|
37
52
|
spreadsheetFilter.type === "rowBased" &&
|
|
38
53
|
spreadsheetFilter.byRow === "all";
|
|
@@ -50,16 +65,16 @@ export var FieldHeader = function (_a) {
|
|
|
50
65
|
});
|
|
51
66
|
}
|
|
52
67
|
};
|
|
53
|
-
return (_jsxs(Div, __assign({ "data-test-id": "column-header-".concat(field.name), p: "0 16px", spaceBetween: true, w100: true, alignCenter: true, onClick: onHeaderClick }, { children: [_jsxs(Div, __assign({ dflex: true }, { children: [_jsxs(Div, __assign({ truncateText: true, selectNone: true }, { children: [field.label, field.isRequired && "*"] })), _jsx(Div, __assign({ ml: 8, centered: true }, { children: (sortBy === null || sortBy === void 0 ? void 0 : sortBy.field) === field.name && (_jsx(SortIndicator, __assign({ direction: sortBy === null || sortBy === void 0 ? void 0 : sortBy.direction }, { children: chevronDown }))) }))] })), shouldRenderErrorCount && (_jsx(TooltipProvider, __assign({ mr: 3, w: 35, tooltip: "Sort by ".concat(field.label, " errors") }, { children: _jsx(ErrorCount, __assign({ "data-test-id": "column-errors-count-".concat(field.name), onClick: function (ev) {
|
|
68
|
+
return (_jsxs(Div, __assign({ "data-cy": "column-header", "data-test-id": "column-header-".concat(field.name), p: "0 16px", spaceBetween: true, w100: true, alignCenter: true, onClick: onHeaderClick }, { children: [_jsxs(Div, __assign({ dflex: true }, { children: [_jsxs(Div, __assign({ truncateText: true, selectNone: true }, { children: [field.label, field.isRequired && "*"] })), _jsx(Div, __assign({ ml: 8, centered: true }, { children: (sortBy === null || sortBy === void 0 ? void 0 : sortBy.field) === field.name && (_jsx(SortIndicator, __assign({ direction: sortBy === null || sortBy === void 0 ? void 0 : sortBy.direction }, { children: chevronDown }))) }))] })), shouldRenderErrorCount && (_jsx(TooltipProvider, __assign({ mr: 3, w: 35, "data-cy": "tool-tip-message", tooltip: "Sort by ".concat(field.label, " errors") }, { children: _jsx(ErrorCount, __assign({ "data-cy": "column-error", "data-test-id": "column-errors-count-".concat(field.name), onClick: function (ev) {
|
|
54
69
|
ev.stopPropagation();
|
|
55
|
-
|
|
56
|
-
} }, { children: _jsx(Div, __assign({ centered: true }, { children: _jsx(Div, __assign({ w: 35, textAlignCenter: true, label3: true, truncateText: true }, { children: fieldErrorCount })) })) })) }))), !fieldErrorCount && fieldWarningCount && (_jsx(TooltipProvider, __assign({ mr: 3, w: 35, tooltip: "Sort by ".concat(field.label, " errors") }, { children: _jsx(ErrorCount, __assign({ style: {
|
|
70
|
+
handleSortByFieldErrors(field.name);
|
|
71
|
+
} }, { children: _jsx(Div, __assign({ centered: true }, { children: _jsx(Div, __assign({ w: 35, textAlignCenter: true, label3: true, truncateText: true }, { children: fieldErrorCount })) })) })) }))), !fieldErrorCount && fieldWarningCount !== null && fieldWarningCount > 0 && (_jsx(TooltipProvider, __assign({ mr: 3, w: 35, tooltip: "Sort by ".concat(field.label, " errors") }, { children: _jsx(ErrorCount, __assign({ style: {
|
|
57
72
|
color: colors.orange1200,
|
|
58
73
|
background: colors.orange1100,
|
|
59
74
|
boxShadow: "0px 0px 0px 1px ".concat(colors.orange500, " inset"),
|
|
60
75
|
}, "data-test-id": "column-errors-count-".concat(field.name), onClick: function (ev) {
|
|
61
76
|
ev.stopPropagation();
|
|
62
|
-
|
|
77
|
+
handleSortByFieldWarnings(field.name);
|
|
63
78
|
} }, { children: _jsx(Div, __assign({ centered: true }, { children: _jsx(Div, __assign({ w: 35, textAlignCenter: true, label3: true, truncateText: true }, { children: fieldWarningCount })) })) })) })))] })));
|
|
64
79
|
};
|
|
65
80
|
export var chevronDown = (_jsx("svg", __assign({ width: "9", height: "5", viewBox: "0 0 9 5", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M4.31848 4.93945L0.421366 0.439453L8.2156 0.439454L4.31848 4.93945Z", fill: "#102622" }) })));
|
|
@@ -23,7 +23,10 @@ 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
|
+
import { useImporterContext } from "../../../../Importer/contexts/ImporterContextProvider";
|
|
26
28
|
import { Div } from "../../../../styled/utils";
|
|
29
|
+
import useWindowDimensions from "../../../../utils/hooks/useWindowSize";
|
|
27
30
|
import { getTableHeight } from "../../../common";
|
|
28
31
|
import { spreadsheetHeaderHeightPx, spreadsheetRowHeightPx } from "../common";
|
|
29
32
|
import { useSpreadsheetContext } from "../SpreadsheetContextProvider";
|
|
@@ -32,22 +35,24 @@ import { FieldHeader } from "./FieldHeader";
|
|
|
32
35
|
import GlobalStyle from "./GlobalStyle";
|
|
33
36
|
import { inputTypes } from "./inputs";
|
|
34
37
|
import { SpreadsheetRowCheckboxes } from "./SpreadsheetRowCheckboxes";
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import useWindowDimensions from "../../../../utils/hooks/useWindowSize";
|
|
38
|
+
import { useDataSetContext } from "../DataSetContextProvider";
|
|
39
|
+
import { useFilteredDataContext } from "../FilteredDataContextProvider";
|
|
40
|
+
import { useValidationContext } from "../ValidationContextProvider";
|
|
39
41
|
var getItemKey = function (record) { return record._meta.id; };
|
|
40
42
|
var SpreadsheetData = function (props) {
|
|
41
|
-
var _a = useSpreadsheetContext(), fields = _a.fields,
|
|
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;
|
|
44
|
+
var _b = useFilteredDataContext(), isFiltering = _b.isFiltering, handleSortByFieldErrors = _b.handleSortByFieldErrors;
|
|
45
|
+
var validationPercentage = useValidationContext().validationPercentage;
|
|
46
|
+
var dataSet = useDataSetContext().dataSet;
|
|
42
47
|
var currentStepIndex = useImporterContext().currentStepIndex;
|
|
43
48
|
var isOnSmallScreens = useWindowDimensions().isOnSmallScreens;
|
|
44
49
|
var canShowCheckboxOnCheckboxRowHover = currentStepIndex === 2;
|
|
45
50
|
var rowNumbersGridRef = useRef();
|
|
46
51
|
var rowCheckboxesGridRef = useRef();
|
|
47
52
|
useEffect(function () {
|
|
48
|
-
if (
|
|
49
|
-
setSelectedRows([
|
|
50
|
-
}, [options.withSingleRowSelect]);
|
|
53
|
+
if (filteredDataIds.length > 0 && options.withSingleRowSelect)
|
|
54
|
+
setSelectedRows([filteredDataIds === null || filteredDataIds === void 0 ? void 0 : filteredDataIds[0]]);
|
|
55
|
+
}, [options.withSingleRowSelect, filteredDataIds]);
|
|
51
56
|
var rowWidthScalingFactor = (function () {
|
|
52
57
|
// Spreadsheet will display 6 columns on the viewport and a small portion of the
|
|
53
58
|
// 7th column in the right side to let the user know they can scroll horizontally
|
|
@@ -74,14 +79,14 @@ var SpreadsheetData = function (props) {
|
|
|
74
79
|
})();
|
|
75
80
|
var columns = useMemo(function () {
|
|
76
81
|
return fields.map(function (field) { return ({
|
|
77
|
-
Header: function () { return
|
|
82
|
+
Header: function () { return _jsx(FieldHeader, { field: field }); },
|
|
78
83
|
Content: function (record) {
|
|
79
84
|
var Input = inputTypes[field.type];
|
|
80
85
|
var rowIndex = record.rowIndex, columnWidth = record.columnWidth, recordProp = __rest(record, ["rowIndex", "columnWidth"]);
|
|
81
86
|
return (_jsx(Input, { id: "".concat(field.name, "-").concat(rowIndex), fieldType: field.type, name: field.name, options: field.options, record: recordProp, columnWidth: columnWidth }));
|
|
82
87
|
},
|
|
83
88
|
}); });
|
|
84
|
-
}, [fields,
|
|
89
|
+
}, [fields, handleSortByFieldErrors, dataSet.current]);
|
|
85
90
|
var onTableScroll = useCallback(function (scrollTop) {
|
|
86
91
|
if (rowNumbersGridRef.current) {
|
|
87
92
|
var grid = rowNumbersGridRef.current;
|
|
@@ -92,7 +97,7 @@ var SpreadsheetData = function (props) {
|
|
|
92
97
|
grid.scrollTo({ scrollTop: scrollTop });
|
|
93
98
|
}
|
|
94
99
|
}, []);
|
|
95
|
-
var dataLength =
|
|
100
|
+
var dataLength = filteredDataIds.length;
|
|
96
101
|
var spreadsheetHeight = useMemo(function () {
|
|
97
102
|
return getTableHeight({
|
|
98
103
|
headerHeight: spreadsheetHeaderHeightPx,
|
|
@@ -104,7 +109,10 @@ var SpreadsheetData = function (props) {
|
|
|
104
109
|
}, [dataLength]);
|
|
105
110
|
var showValidationProgress = !isReadOnly && validationPercentage < 100;
|
|
106
111
|
var isReviewStep = currentStepIndex === 2;
|
|
107
|
-
return (_jsxs(S.SpreadSheetData, __assign({ h100: true, flexColumn: true, className: props.className }, { children: [_jsx(GlobalStyle, {}),
|
|
108
|
-
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, { tableHeadersHeight: spreadsheetHeaderHeightPx, rowHeight: spreadsheetRowHeightPx, h: null, rowWidthScalingFactor: rowWidthScalingFactor,
|
|
112
|
+
return (_jsxs(S.SpreadSheetData, __assign({ h100: true, flexColumn: true, className: props.className }, { children: [_jsx(GlobalStyle, {}), _jsxs(S.SpreadSheetContainer, __assign({ flexColumn: true, w100: true, h100: true }, { children: [_jsx(Div, __assign({ w100: true, justifyCenter: true }, { children: isReviewStep && _jsx(TableActions, {}) })), _jsxs(S.SpreadSheetWrapper, __assign({ canShowCheckboxOnHover: !showValidationProgress && canShowCheckboxOnCheckboxRowHover, shouldShowOnlyCheckbox: (!showValidationProgress && selectedRows.length > 0) ||
|
|
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
|
+
ref: dataSet,
|
|
115
|
+
ids: filteredDataIds,
|
|
116
|
+
}, columns: columns, onTableScroll: onTableScroll, getItemKey: getItemKey, checkboxColumnWidth: checkboxColumnWidth, isFiltering: isFiltering })] }))] }))] })));
|
|
109
117
|
};
|
|
110
118
|
export default React.memo(SpreadsheetData, areEqual);
|