fuse-importer 0.0.1-testing → 0.0.2-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.
@@ -16,7 +16,6 @@ var __assign = (this && this.__assign) || function () {
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { useDropzone } from "react-dropzone";
18
18
  import styled, { css } from "styled-components";
19
- import * as XLSX from "xlsx";
20
19
  import { useUploaderContext } from "../UploaderContextProvider";
21
20
  import { useImporterContext } from "../../contexts/ImporterContextProvider";
22
21
  import { Div } from "../../../styled/utils";
@@ -25,6 +24,7 @@ import { addToast } from "../../../common/Toast";
25
24
  import { Button } from "../../../common/buttons";
26
25
  import { DragAndDropSvg, UploadIndicatorSvg } from "./backgrounds";
27
26
  import { useTranslation } from "react-i18next";
27
+ import Papa from "papaparse";
28
28
  var DragAndDropCard = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 8px;\n margin-right: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n background: ", ";\n border: 1px dashed ", ";\n\n @media (max-width: 1050px) {\n padding: 24px;\n width: auto;\n }\n\n ", "\n"], ["\n border-radius: 8px;\n margin-right: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n background: ", ";\n border: 1px dashed ", ";\n\n @media (max-width: 1050px) {\n padding: 24px;\n width: auto;\n }\n\n ", "\n"])), function (props) { return (props.isDragActive ? "-10px" : "revert"); }, theme.colors.white, theme.colors.red50, function (props) {
29
29
  return props.isDragActive && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n justify-content: center;\n "], ["\n background: ", ";\n border: 1px solid ", ";\n justify-content: center;\n "])), function (p) { return p.theme.colors.blue100; }, function (p) { return p.theme.colors.blue500; });
30
30
  });
@@ -63,14 +63,11 @@ var ImporterDropzone = function () {
63
63
  var _a;
64
64
  var results = event.target.result;
65
65
  var getDataFromFile = function (fileResults) {
66
- var workBook = XLSX.read(fileResults, {
67
- type: "array",
68
- codepage: 65001,
69
- raw: true,
70
- });
71
- var workBookName = workBook.SheetNames[0];
72
- var sheet = workBook.Sheets[workBookName];
73
- return XLSX.utils.sheet_to_json(sheet, { header: 1, raw: false });
66
+ var csvString = new TextDecoder().decode(fileResults instanceof ArrayBuffer
67
+ ? fileResults
68
+ : new TextEncoder().encode(fileResults));
69
+ var data = Papa.parse(csvString).data;
70
+ return data;
74
71
  };
75
72
  var fileData = getDataFromFile(results);
76
73
  var headersCount = (_a = fileData[0]) === null || _a === void 0 ? void 0 : _a.length;
@@ -85,7 +82,7 @@ var ImporterDropzone = function () {
85
82
  var onDropRejected = function (rejectedFiles) {
86
83
  var errorMessages = rejectedFiles.map(function (file) {
87
84
  if (file.errors[0].code === "file-too-large") {
88
- return "Maximum file size is 10MB";
85
+ return "Maximum file size is 40MB";
89
86
  }
90
87
  else {
91
88
  return file.errors[0].message;
@@ -103,7 +100,7 @@ var ImporterDropzone = function () {
103
100
  noKeyboard: true,
104
101
  accept: ".csv, .tsv, .xls, .xlsx",
105
102
  maxFiles: 1,
106
- maxSize: 10000000,
103
+ maxSize: 41943040, // 40MB
107
104
  }), getRootProps = _b.getRootProps, getInputProps = _b.getInputProps, open = _b.open, isDragActive = _b.isDragActive;
108
105
  return (_jsxs(DragAndDropCard, __assign({ isDragActive: isDragActive, centered: true, pRelative: true }, getRootProps(), { children: [_jsx("input", __assign({}, getInputProps())), isDragActive && dropzoneUploadingUI, _jsx(DragAndDropComponent, { openUploadFileDialog: open })] })));
109
106
  };
@@ -32,7 +32,6 @@ type State = {
32
32
  filterRecordsByFieldErrors: (filterByColumn: string) => void;
33
33
  resetSpreadsheetFilter: () => void;
34
34
  recordsWithValuesCount: number;
35
- loadNextPage: () => void;
36
35
  filteredDataCount: number;
37
36
  checkboxColumnWidth: number;
38
37
  isFiltering: boolean;
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { get } from "lodash";
25
25
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
26
- import { getRowId } from "../../../data";
26
+ import { addMeta } from "../../../data";
27
27
  import { useValidationState } from "../hooks";
28
28
  import { useSpreadsheetFilter, } from "./useSpreadsheetFilter";
29
29
  import { filterRecordsByType, filterRecordsByError, filterRecordsBySearchValue, } from "./filterMethods";
@@ -65,18 +65,19 @@ export var SpreadsheetContextProvider = function (_a) {
65
65
  onValidateRecord: onValidateRecord,
66
66
  }), updateRecordAndRevalidate = _k.updateRecordAndRevalidate, deleteRecords = _k.deleteRecords, warnings = _k.warnings, errors = _k.errors, validationState = __rest(_k, ["updateRecordAndRevalidate", "deleteRecords", "warnings", "errors"]);
67
67
  var addNewRowsToSpreadsheet = function () {
68
- // addRowTimeoutRef.current = setTimeout(() => {
69
- // let highestRowIndex = -1;
70
- // for (const key in dataSet)
71
- // if (dataSet[key]?._meta?.rowIndex > highestRowIndex)
72
- // highestRowIndex = dataSet[key]._meta.rowIndex;
73
- // const newRow = addMeta({}, highestRowIndex + 1);
74
- // setDataSet((oldValues) => ({
75
- // ...oldValues,
76
- // [newRow._meta.id]: newRow,
77
- // }));
78
- // addRowTimeoutRef.current = null;
79
- // }, 300);
68
+ addRowTimeoutRef.current = setTimeout(function () {
69
+ var _a, _b;
70
+ var highestRowIndex = -1;
71
+ for (var key in dataSet)
72
+ if (((_b = (_a = dataSet[key]) === null || _a === void 0 ? void 0 : _a._meta) === null || _b === void 0 ? void 0 : _b.rowIndex) > highestRowIndex)
73
+ highestRowIndex = dataSet[key]._meta.rowIndex;
74
+ var newRow = addMeta({}, highestRowIndex + 1);
75
+ setDataSet(function (oldValues) {
76
+ var _a;
77
+ return (__assign(__assign({}, oldValues), (_a = {}, _a[newRow._meta.id] = newRow, _a)));
78
+ });
79
+ addRowTimeoutRef.current = null;
80
+ }, 300);
80
81
  };
81
82
  var handleDeleteErrors = function (selectedRows) {
82
83
  deleteRecords(selectedRows, errors, warnings);
@@ -131,40 +132,14 @@ export var SpreadsheetContextProvider = function (_a) {
131
132
  return value !== null && value !== undefined && typeof value !== "object";
132
133
  })
133
134
  .some(function (value) { return value !== "null" && value !== "undefined"; });
134
- // if (hasValueInTheLastObject) {
135
- // addNewRowsToSpreadsheet();
136
- // }
135
+ if (hasValueInTheLastObject) {
136
+ addNewRowsToSpreadsheet();
137
+ }
137
138
  }, [dataSet]);
138
139
  useEffect(function () {
139
140
  onValidationStateChanged &&
140
141
  onValidationStateChanged(__assign(__assign({}, validationState), { errors: errors, warnings: warnings }));
141
142
  }, [validationState, onValidationStateChanged]);
142
- var loadNextPage = function () {
143
- var recordBase = {
144
- date: "12/17/1992",
145
- email: "pbonass0@jigsy2.com",
146
- name: "testing Bonass",
147
- };
148
- // lastRowIndex in dataset values
149
- var lastRowIndex = Object.values(dataSet).reduce(function (acc, curr) {
150
- if (curr._meta.rowIndex > acc) {
151
- return curr._meta.rowIndex;
152
- }
153
- return acc;
154
- }, 0);
155
- var newObject = {};
156
- // add 10 records to dataSEt based on recordBase (missing _meta)
157
- for (var i = 0; i < 500000; i++) {
158
- var id = getRowId(lastRowIndex + i + 1);
159
- newObject[id] = __assign(__assign({}, recordBase), { _meta: {
160
- id: id,
161
- rowIndex: i,
162
- touched: false,
163
- uploadedRow: ["12/17/1992", "pbonass0@jigsy2.com", "testing Bonass"],
164
- } });
165
- }
166
- setDataSet(function (oldValues) { return (__assign(__assign({}, oldValues), newObject)); });
167
- };
168
143
  var handleSortByFieldErrors = useCallback(function (field) {
169
144
  setSortByFieldErrors(field === sortByFieldErrors ? null : field);
170
145
  setSortByFieldWarnings(null);
@@ -190,7 +165,7 @@ export var SpreadsheetContextProvider = function (_a) {
190
165
  return updatedData;
191
166
  });
192
167
  }, [dataSet, dataSnapshot]);
193
- var value = __assign(__assign({ data: updatedDataSnapshot, fields: fields, isLoading: isLoading }, validationState), { isReadOnly: isReadOnly, sortByFieldErrors: sortByFieldErrors, sortByFieldWarnings: sortByFieldWarnings, options: options, recordsWithValuesCount: recordsWithValuesCount, filteredDataCount: filteredDataCount, sortBy: sortBy, warnings: warnings, errors: errors, setIsLoading: setIsLoading, loadNextPage: loadNextPage, setSortByFieldErrors: handleSortByFieldErrors, setSortByFieldWarnings: handleSortByFieldWarnings, onValidateRecord: onValidateRecord, updateRecord: updateRecordAndRevalidate, selectedRows: selectedRows, setSelectedRows: setSelectedRows, deleteRecords: handleDeleteErrors, filteredInputValue: filteredInputValue, setFilteredInputValue: setFilteredInputValue, lastClickedIndexRef: lastClickedIndexRef, addNewRowsToSpreadsheet: addNewRowsToSpreadsheet, spreadsheetFilter: spreadsheetFilter, resetSpreadsheetFilter: resetSpreadsheetFilter, filterRecordsByRowType: filterRecordsByRowType, filterRecordsByFieldErrors: filterRecordsByFieldErrors, checkboxColumnWidth: checkboxColumnWidth, setSortBy: setSortBy, isFiltering: isFiltering });
168
+ var value = __assign(__assign({ data: updatedDataSnapshot, fields: fields, isLoading: isLoading }, validationState), { isReadOnly: isReadOnly, sortByFieldErrors: sortByFieldErrors, sortByFieldWarnings: sortByFieldWarnings, options: options, recordsWithValuesCount: recordsWithValuesCount, filteredDataCount: filteredDataCount, sortBy: sortBy, warnings: warnings, errors: errors, setIsLoading: setIsLoading, setSortByFieldErrors: handleSortByFieldErrors, setSortByFieldWarnings: handleSortByFieldWarnings, onValidateRecord: onValidateRecord, updateRecord: updateRecordAndRevalidate, selectedRows: selectedRows, setSelectedRows: setSelectedRows, deleteRecords: handleDeleteErrors, filteredInputValue: filteredInputValue, setFilteredInputValue: setFilteredInputValue, lastClickedIndexRef: lastClickedIndexRef, addNewRowsToSpreadsheet: addNewRowsToSpreadsheet, spreadsheetFilter: spreadsheetFilter, resetSpreadsheetFilter: resetSpreadsheetFilter, filterRecordsByRowType: filterRecordsByRowType, filterRecordsByFieldErrors: filterRecordsByFieldErrors, checkboxColumnWidth: checkboxColumnWidth, setSortBy: setSortBy, isFiltering: isFiltering });
194
169
  return (_jsx(SpreadsheetContext.Provider, __assign({ value: value }, { children: children })));
195
170
  };
196
171
  export var useSpreadsheetContext = function () { return useContext(SpreadsheetContext); };
@@ -41,13 +41,9 @@ var SpreadsheetData = function (props) {
41
41
  var _a = useSpreadsheetContext(), fields = _a.fields, data = _a.data, isLoading = _a.isLoading, isReadOnly = _a.isReadOnly, totalErrors = _a.totalErrors, validationPercentage = _a.validationPercentage, setSortByFieldErrors = _a.setSortByFieldErrors, options = _a.options, setSortByFieldWarnings = _a.setSortByFieldWarnings, selectedRows = _a.selectedRows, setSelectedRows = _a.setSelectedRows, checkboxColumnWidth = _a.checkboxColumnWidth, isFiltering = _a.isFiltering;
42
42
  var currentStepIndex = useImporterContext().currentStepIndex;
43
43
  var isOnSmallScreens = useWindowDimensions().isOnSmallScreens;
44
- var loadNextPage = useSpreadsheetContext().loadNextPage;
45
44
  var canShowCheckboxOnCheckboxRowHover = currentStepIndex === 2;
46
45
  var rowNumbersGridRef = useRef();
47
46
  var rowCheckboxesGridRef = useRef();
48
- var onScrollToBottom = function () {
49
- loadNextPage();
50
- };
51
47
  useEffect(function () {
52
48
  if (data.length > 0 && options.withSingleRowSelect)
53
49
  setSelectedRows([data === null || data === void 0 ? void 0 : data[0]._meta.id]);
@@ -109,6 +105,6 @@ var SpreadsheetData = function (props) {
109
105
  var showValidationProgress = !isReadOnly && validationPercentage < 100;
110
106
  var isReviewStep = currentStepIndex === 2;
111
107
  return (_jsxs(S.SpreadSheetData, __assign({ h100: true, flexColumn: true, className: props.className }, { children: [_jsx(GlobalStyle, {}), showValidationProgress && (_jsx(Div, __assign({ h: 32 }, { children: _jsx(ValidationProgress, { totalErrors: totalErrors, validationPercentage: validationPercentage }) }))), _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) ||
112
- 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, onScrollToBottom: onScrollToBottom, rowWidthScalingFactor: rowWidthScalingFactor, data: data, columns: columns, isLoading: isLoading, onTableScroll: onTableScroll, getItemKey: getItemKey, checkboxColumnWidth: checkboxColumnWidth, isFiltering: isFiltering })] }))] }))] })));
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, data: data, columns: columns, isLoading: isLoading, onTableScroll: onTableScroll, getItemKey: getItemKey, checkboxColumnWidth: checkboxColumnWidth, isFiltering: isFiltering })] }))] }))] })));
113
109
  };
114
110
  export default React.memo(SpreadsheetData, areEqual);
@@ -6,5 +6,5 @@ interface SpreadSheetWrapperProps {
6
6
  export declare const SpreadSheetData: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps, never>;
7
7
  export declare const SpreadSheetWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps & SpreadSheetWrapperProps, never>;
8
8
  export declare const SpreadSheetContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps, never>;
9
- export declare const TableView: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ data, columns, pageSize, onRowClick, sortBy, isLoading, setSortBy, rowWidthScalingFactor, onSectionRendered, tableHeadersHeight, rowHeight, h, onScrollToBottom, onTableScroll, getItemKey, isDraggable, checkboxColumnWidth, isFiltering, ...props }: import("../../../common/Table/TableView/types").TableViewProps) => JSX.Element>, import("styled-components").DefaultTheme, {}, never>;
9
+ export declare const TableView: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ data, columns, pageSize, onRowClick, sortBy, isLoading, setSortBy, rowWidthScalingFactor, onSectionRendered, tableHeadersHeight, rowHeight, h, onTableScroll, getItemKey, isDraggable, checkboxColumnWidth, isFiltering, ...props }: import("../../../common/Table/TableView/types").TableViewProps) => JSX.Element>, import("styled-components").DefaultTheme, {}, never>;
10
10
  export {};
@@ -104,7 +104,6 @@ export var ImporterContextProvider = function (_a) {
104
104
  return typeof ud === "number" ? ud.toString() : ud;
105
105
  });
106
106
  }, [uploadedData, headerRowIndex]);
107
- useEffect(function () { }, []);
108
107
  useEffect(function () {
109
108
  var setHeadersFromDataset = function () {
110
109
  var _templateHeaderMatchings = {};
@@ -1,6 +1,5 @@
1
1
  import { Field, FieldTypes, FormatRecord, Record, RecordDataSet, TemplateHeader } from "../../types";
2
2
  import { EnumFieldValueMatchings, HeaderMatchings } from "../contexts/ImporterContextProvider";
3
- export declare const getRowId: (index: number) => string;
4
3
  export declare const addEmptyRows: (data: Record[], fields: Field[]) => (Record | {
5
4
  _meta: {
6
5
  id: string;
@@ -22,7 +22,7 @@ import { transformRecord } from "../../Importer/common/Spreadsheet/transformatio
22
22
  import { FieldTypes, } from "../../types";
23
23
  import { parseValue } from "../common/Spreadsheet/common";
24
24
  var MINIMUM_ROW_COUNT = 20;
25
- export var getRowId = function (index) {
25
+ var getRowId = function (index) {
26
26
  var uniqueTimestamp = new Date().getTime();
27
27
  return "r".concat(index, "-").concat(uniqueTimestamp);
28
28
  };
@@ -8,4 +8,4 @@ type TableViewWrapperProps = {
8
8
  checkboxColumnWidth?: number;
9
9
  };
10
10
  export declare const TableViewWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps & TableViewWrapperProps, never>;
11
- export declare const TableView: React.MemoExoticComponent<({ data, columns, pageSize, onRowClick, sortBy, isLoading, setSortBy, rowWidthScalingFactor, onSectionRendered, tableHeadersHeight, rowHeight, h, onScrollToBottom, onTableScroll, getItemKey, isDraggable, checkboxColumnWidth, isFiltering, ...props }: TableViewProps) => JSX.Element>;
11
+ export declare const TableView: React.MemoExoticComponent<({ data, columns, pageSize, onRowClick, sortBy, isLoading, setSortBy, rowWidthScalingFactor, onSectionRendered, tableHeadersHeight, rowHeight, h, onTableScroll, getItemKey, isDraggable, checkboxColumnWidth, isFiltering, ...props }: TableViewProps) => JSX.Element>;
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  };
27
27
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
28
28
  import { SortableContext, verticalListSortingStrategy, } from "@dnd-kit/sortable";
29
- import React, { Fragment, useCallback, useRef, } from "react";
29
+ import React, { Fragment, useCallback, useRef } from "react";
30
30
  import AutoSizer from "react-virtualized-auto-sizer";
31
31
  import { FixedSizeGrid as Grid, areEqual } from "react-window";
32
32
  import styled, { css } from "styled-components";
@@ -66,8 +66,7 @@ var buildGridStyles = function (rowWidthScalingFactor) {
66
66
  return gridStyles;
67
67
  };
68
68
  export var TableView = React.memo(function (_a) {
69
- var _b;
70
- var data = _a.data, columns = _a.columns, pageSize = _a.pageSize, _c = _a.onRowClick, onRowClick = _c === void 0 ? null : _c, _d = _a.sortBy, sortBy = _d === void 0 ? { field: null, direction: null } : _d, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, _f = _a.setSortBy, setSortBy = _f === void 0 ? null : _f, _g = _a.rowWidthScalingFactor, rowWidthScalingFactor = _g === void 0 ? 1 : _g, onSectionRendered = _a.onSectionRendered, _h = _a.tableHeadersHeight, tableHeadersHeight = _h === void 0 ? defaultTableHeaderHeightPx : _h, _j = _a.rowHeight, rowHeight = _j === void 0 ? defaultTableRowHeightPx : _j, _k = _a.h, h = _k === void 0 ? 500 : _k, _l = _a.onScrollToBottom, onScrollToBottom = _l === void 0 ? null : _l, _m = _a.onTableScroll, onTableScroll = _m === void 0 ? null : _m, _o = _a.getItemKey, getItemKey = _o === void 0 ? null : _o, _p = _a.isDraggable, isDraggable = _p === void 0 ? false : _p, checkboxColumnWidth = _a.checkboxColumnWidth, _q = _a.isFiltering, isFiltering = _q === void 0 ? false : _q, props = __rest(_a, ["data", "columns", "pageSize", "onRowClick", "sortBy", "isLoading", "setSortBy", "rowWidthScalingFactor", "onSectionRendered", "tableHeadersHeight", "rowHeight", "h", "onScrollToBottom", "onTableScroll", "getItemKey", "isDraggable", "checkboxColumnWidth", "isFiltering"]);
69
+ var data = _a.data, columns = _a.columns, pageSize = _a.pageSize, _b = _a.onRowClick, onRowClick = _b === void 0 ? null : _b, _c = _a.sortBy, sortBy = _c === void 0 ? { field: null, direction: null } : _c, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.setSortBy, setSortBy = _e === void 0 ? null : _e, _f = _a.rowWidthScalingFactor, rowWidthScalingFactor = _f === void 0 ? 1 : _f, onSectionRendered = _a.onSectionRendered, _g = _a.tableHeadersHeight, tableHeadersHeight = _g === void 0 ? defaultTableHeaderHeightPx : _g, _h = _a.rowHeight, rowHeight = _h === void 0 ? defaultTableRowHeightPx : _h, _j = _a.h, h = _j === void 0 ? 500 : _j, _k = _a.onTableScroll, onTableScroll = _k === void 0 ? null : _k, _l = _a.getItemKey, getItemKey = _l === void 0 ? null : _l, _m = _a.isDraggable, isDraggable = _m === void 0 ? false : _m, checkboxColumnWidth = _a.checkboxColumnWidth, _o = _a.isFiltering, isFiltering = _o === void 0 ? false : _o, props = __rest(_a, ["data", "columns", "pageSize", "onRowClick", "sortBy", "isLoading", "setSortBy", "rowWidthScalingFactor", "onSectionRendered", "tableHeadersHeight", "rowHeight", "h", "onTableScroll", "getItemKey", "isDraggable", "checkboxColumnWidth", "isFiltering"]);
71
70
  var headerContainerRef = useRef();
72
71
  var onScroll = function (_a) {
73
72
  var scrollTop = _a.scrollTop, scrollLeft = _a.scrollLeft;
@@ -85,10 +84,6 @@ export var TableView = React.memo(function (_a) {
85
84
  };
86
85
  var onItemsRendered = useCallback(function (_a) {
87
86
  var rowStartIndex = _a.overscanRowStartIndex, rowStopIndex = _a.overscanRowStopIndex;
88
- if (rowStopIndex >= data.length - 10) {
89
- if (onScrollToBottom)
90
- onScrollToBottom();
91
- }
92
87
  if (onSectionRendered) {
93
88
  onSectionRendered({
94
89
  rowStartIndex: rowStartIndex,
@@ -100,12 +95,9 @@ export var TableView = React.memo(function (_a) {
100
95
  var tableHeight = pageSize
101
96
  ? pageSize * rowHeight + tableHeadersHeight
102
97
  : h;
103
- var virtualizedGridRef = useRef(null);
104
- console.log({ gridHeight: (_b = virtualizedGridRef === null || virtualizedGridRef === void 0 ? void 0 : virtualizedGridRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight });
105
98
  var canRenderTableHeaders = isFiltering ? true : data.length > 0;
106
- return (_jsxs(TableViewWrapper, __assign({ ref: virtualizedGridRef, "data-test-id": "table-view-wrapper", isLoading: isLoading, checkboxColumnWidth: checkboxColumnWidth, h: tableHeight }, props, { children: [isLoading && loadingUI, _jsx(AutoSizer, { children: function (_a) {
99
+ return (_jsxs(TableViewWrapper, __assign({ "data-test-id": "table-view-wrapper", isLoading: isLoading, checkboxColumnWidth: checkboxColumnWidth, h: tableHeight }, props, { children: [isLoading && loadingUI, _jsx(AutoSizer, { children: function (_a) {
107
100
  var autosizerWidth = _a.width, autosizerHeight = _a.height;
108
- console.log({ autosizerHeight: autosizerHeight });
109
101
  // using Math.floor to avoid floating point errors with the grid and table cell widths
110
102
  var rowWidth = Math.floor(autosizerWidth * rowWidthScalingFactor);
111
103
  var gridProps = {
@@ -27,7 +27,6 @@ export type TableViewProps = {
27
27
  tableHeadersHeight?: number;
28
28
  onSectionRendered?: (section: TableSection) => void;
29
29
  onTableScroll?: (scrollTop: number) => void;
30
- onScrollToBottom?: () => void;
31
30
  onRowClick?: (row: any) => void;
32
31
  getItemKey?: (row: any) => string;
33
32
  isDraggable?: boolean;
package/lib/esm/index.js CHANGED
@@ -64,7 +64,6 @@ import * as locales from "./locales";
64
64
  import { StyleSheetManager } from "styled-components";
65
65
  import { fontsURL } from "./styled/fontsURL";
66
66
  import { addLinkToHead, getDefaultValidations } from "./utils";
67
- import Localbase from "localbase";
68
67
  var FuseImporter = /** @class */ (function () {
69
68
  function FuseImporter(apiToken, templateSlug, options) {
70
69
  if (options === void 0) { options = {}; }
@@ -74,28 +73,6 @@ var FuseImporter = /** @class */ (function () {
74
73
  x: 0,
75
74
  y: 0,
76
75
  };
77
- var db = new Localbase("myDatabase");
78
- var item = {
79
- id: 1,
80
- name: "My item",
81
- description: "This is my item",
82
- };
83
- db.collection("items")
84
- .add(item, "id")
85
- .then(function () {
86
- console.log("Item added");
87
- })
88
- .catch(function (err) {
89
- console.error("Failed to add item: ", err);
90
- });
91
- db.collection("items")
92
- .get()
93
- .then(function (items) {
94
- console.log(items);
95
- })
96
- .catch(function (err) {
97
- console.error("Failed to get items: ", err);
98
- });
99
76
  this.apiToken = apiToken;
100
77
  this.templateSlug = templateSlug;
101
78
  this.options = __assign({ env: "production", zIndex: 1000, batchValidationDelayMs: 500 }, options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fuse-importer",
3
3
  "private": false,
4
- "version": "0.0.1-testing",
4
+ "version": "0.0.2-testing",
5
5
  "description": "Flatirons Fuse is a customizable and powerful CSV Importer that works with all front-end languages",
6
6
  "browserslist": {
7
7
  "production": [
@@ -45,9 +45,9 @@
45
45
  "color": "^4.2.3",
46
46
  "fuse.js": "^6.5.3",
47
47
  "i18next": "^22.4.13",
48
- "localbase": "^0.7.5",
49
48
  "luxon": "^2.2.0",
50
49
  "openai": "^3.2.1",
50
+ "papaparse": "^5.4.1",
51
51
  "qs": "^6.10.1",
52
52
  "react-custom-scrollbars": "^4.2.1",
53
53
  "react-dropzone": "^11.3.2",
@@ -71,6 +71,8 @@
71
71
  "@types/testing-library__jest-dom": "^5.14.5",
72
72
  "@types/testing-library__react": "^10.2.0",
73
73
  "dotenv": "^16.0.3",
74
+ "react": "^17.x",
75
+ "react-dom": "^17.x",
74
76
  "html-webpack-plugin": "^5.5.0",
75
77
  "jest": "^28.1.3",
76
78
  "terser-webpack-plugin": "^5.1.2",