fuse-importer 0.25.9 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +11 -1
  2. package/lib/esm/Importer/Review/ReviewWithContext.js +4 -8
  3. package/lib/esm/Importer/Uploader/HeadersPreview.js +5 -9
  4. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +3 -3
  5. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +30 -12
  6. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +28 -2
  7. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.d.ts +1 -2
  8. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +1 -1
  9. package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +4 -2
  10. package/lib/esm/Importer/common/Spreadsheet/hooks.js +3 -66
  11. package/lib/esm/Importer/common/Spreadsheet/index.d.ts +1 -2
  12. package/lib/esm/Importer/common/Spreadsheet/index.js +2 -2
  13. package/lib/esm/Importer/common/Spreadsheet/styles.d.ts +1 -1
  14. package/lib/esm/Importer/common/Spreadsheet/styles.js +2 -2
  15. package/lib/esm/Importer/common/utils.d.ts +0 -1
  16. package/lib/esm/Importer/common/utils.js +0 -4
  17. package/lib/esm/Importer/data/index.d.ts +7 -2
  18. package/lib/esm/Importer/data/index.js +18 -10
  19. package/lib/esm/Importer/index.js +0 -2
  20. package/lib/esm/common/Table/TableActions/DeleteSelectedRows.js +10 -4
  21. package/lib/esm/common/Table/TableActions/ExportData.js +3 -1
  22. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.d.ts +1 -0
  23. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.js +35 -0
  24. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.styles.d.ts +6 -0
  25. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.styles.js +24 -0
  26. package/lib/esm/common/Table/TableActions/FilterByErrors/functions.d.ts +11 -0
  27. package/lib/esm/common/Table/TableActions/FilterByErrors/functions.js +35 -0
  28. package/lib/esm/common/Table/TableActions/FilterByErrors/index.d.ts +1 -0
  29. package/lib/esm/common/Table/TableActions/FilterByErrors/index.js +1 -0
  30. package/lib/esm/common/Table/TableActions/SearchRows.js +3 -1
  31. package/lib/esm/common/Table/TableActions/TableActions.js +2 -1
  32. package/lib/esm/common/Table/TableActions/TableActions.styles.js +1 -1
  33. package/lib/esm/common/Table/TableActions/hooks.d.ts +21 -0
  34. package/lib/esm/common/Table/TableActions/hooks.js +84 -0
  35. package/lib/esm/common/Table/TableView/TableHeaders.d.ts +6 -8
  36. package/lib/esm/common/Table/TableView/TableHeaders.js +15 -14
  37. package/lib/esm/common/Table/TableView/{TableRow.d.ts → TableRows/TableRow.d.ts} +5 -5
  38. package/lib/esm/common/Table/TableView/{TableRow.js → TableRows/TableRow.js} +9 -6
  39. package/lib/esm/common/Table/TableView/TableRows/index.d.ts +4 -0
  40. package/lib/esm/common/Table/TableView/{TableCells.js → TableRows/index.js} +13 -11
  41. package/lib/esm/common/Table/TableView/common/index.d.ts +5 -0
  42. package/lib/esm/common/Table/TableView/{common.js → common/index.js} +18 -5
  43. package/lib/esm/common/Table/TableView/index.d.ts +4 -39
  44. package/lib/esm/common/Table/TableView/index.js +48 -65
  45. package/lib/esm/common/Table/TableView/types.d.ts +37 -0
  46. package/lib/esm/common/Table/TableView/types.js +1 -0
  47. package/lib/esm/common/Table/index.d.ts +2 -2
  48. package/lib/esm/common/Table/index.js +6 -6
  49. package/lib/esm/common/inputs/Autocomplete.d.ts +2 -1
  50. package/lib/esm/common/inputs/Autocomplete.js +2 -2
  51. package/lib/esm/index.d.ts +1 -0
  52. package/lib/esm/index.js +15 -0
  53. package/lib/esm/locales/de.d.ts +21 -0
  54. package/lib/esm/locales/de.js +21 -0
  55. package/lib/esm/locales/en.d.ts +21 -0
  56. package/lib/esm/locales/en.js +21 -0
  57. package/lib/esm/locales/es.d.ts +21 -0
  58. package/lib/esm/locales/es.js +21 -0
  59. package/lib/esm/locales/fr.d.ts +21 -0
  60. package/lib/esm/locales/fr.js +21 -0
  61. package/lib/esm/types.d.ts +1 -0
  62. package/lib/main.js +12 -12
  63. package/package.json +1 -1
  64. package/lib/esm/Importer/useFullscreenOverlay.d.ts +0 -1
  65. package/lib/esm/Importer/useFullscreenOverlay.js +0 -14
  66. package/lib/esm/common/Table/TableView/TableCells.d.ts +0 -4
  67. package/lib/esm/common/Table/TableView/common.d.ts +0 -9
@@ -25,58 +25,55 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  return t;
26
26
  };
27
27
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
28
- import React, { useRef, useMemo, useCallback } from "react";
29
- import { FixedSizeGrid as Grid, areEqual } from "react-window";
28
+ import { SortableContext, verticalListSortingStrategy, } from "@dnd-kit/sortable";
29
+ import React, { Fragment, useCallback, useRef } from "react";
30
30
  import AutoSizer from "react-virtualized-auto-sizer";
31
+ import { FixedSizeGrid as Grid, areEqual } from "react-window";
31
32
  import styled, { css } from "styled-components";
32
- import { SortableContext, verticalListSortingStrategy, } from "@dnd-kit/sortable";
33
33
  import { Div } from "../../../styled/utils";
34
34
  import { Spinner } from "../../Spinner";
35
- import { defaultTableRowHeightPx, defaultTableHeaderHeightPx } from "./common";
36
35
  import { TableHeaders } from "./TableHeaders";
37
- import { Cell, DraggableCell } from "./TableCells";
38
- import { CustomScrollbarsVirtualList } from "./CustomScrollbar";
39
- export * from "./common";
36
+ import { Row } from "./TableRows";
37
+ import { defaultTableHeaderHeightPx, defaultTableRowHeightPx } from "./common";
40
38
  export * from "./TableHeaders";
41
- export * from "./TableRow";
42
- export var TableViewWrapper = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n box-shadow: 0 0 0 1px ", ";\n overflow: hidden;\n\n ", "\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"], ["\n ", "\n box-shadow: 0 0 0 1px ", ";\n overflow: hidden;\n\n ", "\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n // fix scrollbar layout issues on windows/macos\n .ReactVirtualized__Grid {\n ", ";\n }\n"])), function (p) {
39
+ export * from "./TableRows/TableRow";
40
+ export * from "./common";
41
+ export var TableViewWrapper = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n box-shadow: 0 0 0 1px ", ";\n overflow: hidden;\n\n ", "\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n"], ["\n ", "\n box-shadow: 0 0 0 1px ", ";\n overflow: hidden;\n\n ", "\n\n // prevents clipped dropdowns\n .ReactVirtualized__Grid__innerScrollContainer {\n overflow: visible !important;\n }\n .ReactVirtualized__Table__row {\n overflow: visible !important;\n }\n\n"])), function (p) {
43
42
  return p.isLoading && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: 0.5;\n "], ["\n opacity: 0.5;\n "])));
44
43
  }, function (p) { return p.theme.colors.gray300; }, function (_a) {
45
44
  var checkboxColumnWidth = _a.checkboxColumnWidth;
46
45
  return checkboxColumnWidth && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n max-width: calc(100vw - ", "px);\n "], ["\n max-width: calc(100vw - ", "px);\n "])), checkboxColumnWidth);
47
- }, function (p) { return p.theme.css.scrollbarDark; });
46
+ });
48
47
  var SpinnerWrapper = styled(Div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n pointer-events: none;\n z-index: 100;\n"], ["\n pointer-events: none;\n z-index: 100;\n"])));
49
48
  var tableHeaderId = "tableHeaderId";
50
- var StyledGrid = styled(Grid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n scrollbar-width: thin;\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background-color: #b1b1b2;\n border-radius: 3px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n"], ["\n scrollbar-width: thin;\n\n /* width */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background-color: #b1b1b2;\n border-radius: 3px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n"])));
51
- var buildGridStyles = function (rowWidth) {
49
+ var VirtualizedGrid = styled(Grid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (p) { return p.theme.css.scrollbarDark; });
50
+ var loadingUI = (_jsx(SpinnerWrapper, __assign({ pRelative: true }, { children: _jsx(Div, __assign({ w100: true, h100: true, centered: true, h: 400, pAbsolute: true }, { children: _jsx(Spinner, {}) })) })));
51
+ var buildGridStyles = function (rowWidthScalingFactor) {
52
52
  /* using style={{ willChange: "unset" }} is important for having items
53
53
  like backdrops with position fixed inside of the table working as
54
54
  expected. Required for dropdowns in cells */
55
55
  var gridStyles = {
56
56
  outline: "none",
57
57
  willChange: "unset",
58
+ boxSizing: "border-box",
58
59
  };
59
- if (rowWidth === 1)
60
+ if (rowWidthScalingFactor === 1)
60
61
  gridStyles = __assign(__assign({}, gridStyles), { overflowX: "hidden", overflowY: "auto" });
61
- else if (rowWidth > 1)
62
- gridStyles = __assign(__assign({}, gridStyles), { overflowX: "hidden" });
62
+ else if (rowWidthScalingFactor > 1)
63
+ gridStyles = __assign(__assign({}, gridStyles), { overflowX: "auto" });
63
64
  return gridStyles;
64
65
  };
65
66
  export var TableView = React.memo(function (_a) {
66
- 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.highlightFirstRow, highlightFirstRow = _e === void 0 ? false : _e, _f = _a.setSortBy, setSortBy = _f === void 0 ? null : _f, _g = _a.rowWidth, rowWidth = _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.onTableScroll, onTableScroll = _l === void 0 ? null : _l, _m = _a.getItemKey, getItemKey = _m === void 0 ? null : _m, _o = _a.shouldBeDraggable, shouldBeDraggable = _o === void 0 ? false : _o, _p = _a.shouldHaveCustomScrollbar, shouldHaveCustomScrollbar = _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", "highlightFirstRow", "setSortBy", "rowWidth", "onSectionRendered", "tableHeadersHeight", "rowHeight", "h", "onTableScroll", "getItemKey", "shouldBeDraggable", "shouldHaveCustomScrollbar", "checkboxColumnWidth", "isFiltering"]);
67
- /*
68
- multiply the rowWidth by 0.95 to let the user know they can scroll
69
- horizontally (will display partial column on the right)
70
- */
71
- var _rowWidth = rowWidth > 1 ? rowWidth * 0.95 : rowWidth;
67
+ 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.highlightFirstRow, highlightFirstRow = _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.onTableScroll, onTableScroll = _l === void 0 ? null : _l, _m = _a.getItemKey, getItemKey = _m === void 0 ? null : _m, _o = _a.isDraggable, isDraggable = _o === void 0 ? false : _o, checkboxColumnWidth = _a.checkboxColumnWidth, _p = _a.isFiltering, isFiltering = _p === void 0 ? false : _p, props = __rest(_a, ["data", "columns", "pageSize", "onRowClick", "sortBy", "isLoading", "highlightFirstRow", "setSortBy", "rowWidthScalingFactor", "onSectionRendered", "tableHeadersHeight", "rowHeight", "h", "onTableScroll", "getItemKey", "isDraggable", "checkboxColumnWidth", "isFiltering"]);
72
68
  var headerContainerRef = useRef();
73
- var listRef = useRef();
74
- var canRenderTableHeaders = isFiltering ? true : data.length > 0;
75
- var tableHeadersUI = canRenderTableHeaders && (_jsx(TableHeaders, { id: tableHeaderId, containerRef: headerContainerRef, height: tableHeadersHeight, rowHeight: rowHeight, rowWidth: _rowWidth, scrollLeft: 0, columns: columns, sortBy: sortBy, setSortBy: setSortBy, shouldHaveCustomScrollbar: shouldHaveCustomScrollbar }));
76
69
  var onScroll = function (_a) {
77
70
  var scrollTop = _a.scrollTop, scrollLeft = _a.scrollLeft;
78
71
  if (headerContainerRef.current && headerContainerRef.current.scrollTo) {
79
- headerContainerRef.current.scrollTo({ left: scrollLeft });
72
+ requestAnimationFrame(function () {
73
+ headerContainerRef.current.scrollTo({
74
+ left: scrollLeft,
75
+ });
76
+ });
80
77
  }
81
78
  if (onTableScroll) {
82
79
  onTableScroll(scrollTop);
@@ -92,56 +89,42 @@ export var TableView = React.memo(function (_a) {
92
89
  });
93
90
  }
94
91
  }, [data, onSectionRendered]);
95
- var loadingUI = isLoading && (_jsx(SpinnerWrapper, __assign({ pRelative: true }, { children: _jsx(Div, __assign({ w100: true, h100: true, centered: true, h: 400, pAbsolute: true }, { children: _jsx(Spinner, {}) })) })));
96
92
  var tableHeight = pageSize
97
93
  ? pageSize * rowHeight + tableHeadersHeight
98
94
  : h;
99
- var itemData = useMemo(function () { return ({
100
- items: data,
101
- onRowClick: onRowClick,
102
- columns: columns,
103
- highlightFirstRow: highlightFirstRow,
104
- rowHeight: rowHeight,
105
- getItemKey: getItemKey,
106
- shouldHaveCustomScrollbar: shouldHaveCustomScrollbar,
107
- }); }, [
108
- data,
109
- onRowClick,
110
- columns,
111
- highlightFirstRow,
112
- rowHeight,
113
- shouldHaveCustomScrollbar,
114
- ]);
115
- var buildGridProps = function (width, isDraggable, columnWidth, height) { return ({
116
- style: buildGridStyles(_rowWidth),
117
- width: width,
118
- columnCount: 1,
119
- itemData: itemData,
120
- onItemsRendered: onItemsRendered,
121
- onScroll: onScroll,
122
- columnWidth: isDraggable ? Math.floor(width * _rowWidth) : columnWidth,
123
- height: height - tableHeadersHeight,
124
- rowHeight: rowHeight,
125
- rowCount: data.length,
126
- }); };
127
- return (_jsxs(TableViewWrapper, __assign({ "data-test-id": "table-view-wrapper", isLoading: isLoading, checkboxColumnWidth: checkboxColumnWidth }, (!shouldHaveCustomScrollbar ? { h: tableHeight } : {}), props, { children: [tableHeadersUI, loadingUI, _jsx(AutoSizer, { children: function (_a) {
128
- var width = _a.width, height = _a.height;
129
- var canUseCustomScrollbar = shouldHaveCustomScrollbar && !shouldBeDraggable;
95
+ var canRenderTableHeaders = isFiltering ? true : data.length > 0;
96
+ 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) {
97
+ var autosizerWidth = _a.width, autosizerHeight = _a.height;
98
+ // using Math.floor to avoid floating point errors with the grid and table cell widths
99
+ var rowWidth = Math.floor(autosizerWidth * rowWidthScalingFactor);
130
100
  var gridProps = {
131
- style: buildGridStyles(_rowWidth),
132
- width: width,
101
+ itemData: {
102
+ items: data,
103
+ isDraggable: isDraggable,
104
+ rowWidth: rowWidth,
105
+ onRowClick: onRowClick,
106
+ columns: columns,
107
+ highlightFirstRow: highlightFirstRow,
108
+ rowHeight: rowHeight,
109
+ getItemKey: getItemKey,
110
+ },
111
+ style: buildGridStyles(rowWidthScalingFactor),
112
+ width: autosizerWidth,
133
113
  columnCount: 1,
134
- itemData: itemData,
135
114
  onItemsRendered: onItemsRendered,
136
115
  onScroll: onScroll,
137
- columnWidth: Math.floor(width * _rowWidth),
138
- height: height - tableHeadersHeight,
116
+ columnWidth: rowWidth,
117
+ height: autosizerHeight - tableHeadersHeight,
139
118
  rowHeight: rowHeight,
140
119
  rowCount: data.length,
141
120
  };
142
- return (_jsx(_Fragment, { children: shouldBeDraggable ? (_jsx(SortableContext, __assign({ items: data, strategy: verticalListSortingStrategy }, { children: _jsx(StyledGrid, __assign({}, gridProps, { children: DraggableCell })) }))) : (_jsx(StyledGrid, __assign({}, gridProps, { ref: canUseCustomScrollbar ? listRef : undefined, outerElementType: canUseCustomScrollbar
143
- ? CustomScrollbarsVirtualList
144
- : undefined }, { children: Cell }))) }));
121
+ var GridContainer = isDraggable
122
+ ? SortableContext
123
+ : Fragment;
124
+ var gridContainerProps = isDraggable
125
+ ? { items: data, strategy: verticalListSortingStrategy }
126
+ : {};
127
+ return (_jsxs(_Fragment, { children: [canRenderTableHeaders && (_jsx(TableHeaders, { rowWidth: rowWidth, containerWidth: autosizerWidth, id: tableHeaderId, containerRef: headerContainerRef, height: tableHeadersHeight, rowHeight: rowHeight, scrollLeft: 0, columns: columns, sortBy: sortBy, setSortBy: setSortBy })), _jsx(GridContainer, __assign({}, gridContainerProps, { children: _jsx(VirtualizedGrid, __assign({}, gridProps, { children: Row })) }))] }));
145
128
  } })] })));
146
129
  }, areEqual);
147
130
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { DivCSSProps } from "../../../styled/utils";
3
+ import { SortBy } from "../TableDataProvider";
4
+ export type TableViewColumn = {
5
+ header?: string;
6
+ Header?: (p: any) => JSX.Element;
7
+ Content?: (p: any) => JSX.Element;
8
+ dataAccessor?: string;
9
+ preventRowClick?: boolean;
10
+ disableSort?: boolean;
11
+ width?: number;
12
+ };
13
+ type TableSection = {
14
+ rowStartIndex?: number;
15
+ rowStopIndex?: number;
16
+ data?: any[];
17
+ };
18
+ export type TableViewProps = {
19
+ data: any[];
20
+ columns: TableViewColumn[];
21
+ sortBy?: SortBy;
22
+ setSortBy?: React.Dispatch<React.SetStateAction<SortBy>>;
23
+ isLoading?: boolean;
24
+ pageSize?: number;
25
+ highlightFirstRow?: boolean;
26
+ rowWidthScalingFactor?: number;
27
+ rowHeight?: number;
28
+ tableHeadersHeight?: number;
29
+ onSectionRendered?: (section: TableSection) => void;
30
+ onTableScroll?: (scrollTop: number) => void;
31
+ onRowClick?: (row: any) => void;
32
+ getItemKey?: (row: any) => string;
33
+ isDraggable?: boolean;
34
+ checkboxColumnWidth?: number;
35
+ isFiltering?: boolean;
36
+ } & DivCSSProps;
37
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -4,8 +4,8 @@ type Props = {
4
4
  columns: any[];
5
5
  onRowClick?: (row: any) => void;
6
6
  templateSlug?: string;
7
- shouldBeDraggable?: boolean;
7
+ isDraggable?: boolean;
8
8
  } & DivCSSProps;
9
- declare const Table: ({ columns, onRowClick, blankState, templateSlug, shouldBeDraggable, ...props }: Props) => JSX.Element;
9
+ declare const Table: ({ columns, onRowClick, blankState, templateSlug, isDraggable, ...props }: Props) => JSX.Element;
10
10
  export { Table };
11
11
  export * from "./TableDataProvider";
@@ -75,7 +75,7 @@ var TableView = styled(TableViewBase)(templateObject_2 || (templateObject_2 = __
75
75
  return p.withPagination && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 0px;\n "], ["\n border-radius: 0px;\n "])));
76
76
  });
77
77
  var Table = function (_a) {
78
- var columns = _a.columns, _b = _a.onRowClick, onRowClick = _b === void 0 ? null : _b, _c = _a.blankState, blankState = _c === void 0 ? null : _c, templateSlug = _a.templateSlug, _d = _a.shouldBeDraggable, shouldBeDraggable = _d === void 0 ? false : _d, props = __rest(_a, ["columns", "onRowClick", "blankState", "templateSlug", "shouldBeDraggable"]);
78
+ var columns = _a.columns, _b = _a.onRowClick, onRowClick = _b === void 0 ? null : _b, _c = _a.blankState, blankState = _c === void 0 ? null : _c, templateSlug = _a.templateSlug, _d = _a.isDraggable, isDraggable = _d === void 0 ? false : _d, props = __rest(_a, ["columns", "onRowClick", "blankState", "templateSlug", "isDraggable"]);
79
79
  var _e = useTableContext(), data = _e.data, isLoading = _e.isLoading, sortBy = _e.sortBy, setSortBy = _e.setSortBy, totalPages = _e.totalPages;
80
80
  var reorderRows = useReorderRows(templateSlug).reorderRows;
81
81
  var withPagination = data.length > 0 && totalPages > 1;
@@ -115,14 +115,14 @@ var Table = function (_a) {
115
115
  });
116
116
  }); };
117
117
  var dndContextValues = {
118
- sensors: shouldBeDraggable ? sensors : undefined,
119
- collisionDetection: shouldBeDraggable ? closestCenter : undefined,
120
- onDragEnd: shouldBeDraggable ? handleDragEnd : undefined,
121
- modifiers: shouldBeDraggable
118
+ sensors: isDraggable ? sensors : undefined,
119
+ collisionDetection: isDraggable ? closestCenter : undefined,
120
+ onDragEnd: isDraggable ? handleDragEnd : undefined,
121
+ modifiers: isDraggable
122
122
  ? [restrictToVerticalAxis, restrictToWindowEdges]
123
123
  : undefined,
124
124
  };
125
- return (_jsxs(Div, __assign({}, props, { children: [data.length ? (_jsx(DndContext, __assign({ sensors: dndContextValues.sensors, collisionDetection: dndContextValues.collisionDetection, onDragEnd: dndContextValues.onDragEnd, modifiers: dndContextValues.modifiers }, { children: _jsx(TableView, __assign({ pageSize: data.length, withPagination: withPagination, shouldBeDraggable: shouldBeDraggable }, {
125
+ return (_jsxs(Div, __assign({}, props, { children: [data.length ? (_jsx(DndContext, __assign({ sensors: dndContextValues.sensors, collisionDetection: dndContextValues.collisionDetection, onDragEnd: dndContextValues.onDragEnd, modifiers: dndContextValues.modifiers }, { children: _jsx(TableView, __assign({ pageSize: data.length, withPagination: withPagination, isDraggable: isDraggable }, {
126
126
  isLoading: isLoading,
127
127
  data: data,
128
128
  columns: columns,
@@ -16,6 +16,7 @@ export type Props = {
16
16
  onToggle?: (isOpen: boolean) => void;
17
17
  placement?: Placement;
18
18
  icon?: JSX.Element;
19
+ prefix?: string;
19
20
  } & DivCSSProps;
20
- declare const Autocomplete: ({ label, isDisabled, isInputDisabled, placeholder, value, icon, onChange, placement, options, onToggle, id, labelTooltip, ...props }: Props) => JSX.Element;
21
+ declare const Autocomplete: ({ label, isDisabled, isInputDisabled, placeholder, value, icon, onChange, placement, options, onToggle, id, labelTooltip, prefix, ...props }: Props) => JSX.Element;
21
22
  export { Autocomplete };
@@ -47,7 +47,7 @@ var ClickableArea = styled(Div)(function (_a) {
47
47
  return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), isInputDisabled && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n :hover {\n cursor: pointer;\n opacity: 0.9;\n }\n "], ["\n :hover {\n cursor: pointer;\n opacity: 0.9;\n }\n "]))));
48
48
  });
49
49
  var Autocomplete = function (_a) {
50
- var _b = _a.label, label = _b === void 0 ? null : _b, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isInputDisabled, isInputDisabled = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "general:autocomplete.placeholder" : _e, value = _a.value, icon = _a.icon, onChange = _a.onChange, placement = _a.placement, options = _a.options, onToggle = _a.onToggle, id = _a.id, labelTooltip = _a.labelTooltip, props = __rest(_a, ["label", "isDisabled", "isInputDisabled", "placeholder", "value", "icon", "onChange", "placement", "options", "onToggle", "id", "labelTooltip"]);
50
+ var _b = _a.label, label = _b === void 0 ? null : _b, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isInputDisabled, isInputDisabled = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "general:autocomplete.placeholder" : _e, value = _a.value, icon = _a.icon, onChange = _a.onChange, placement = _a.placement, options = _a.options, onToggle = _a.onToggle, id = _a.id, labelTooltip = _a.labelTooltip, prefix = _a.prefix, props = __rest(_a, ["label", "isDisabled", "isInputDisabled", "placeholder", "value", "icon", "onChange", "placement", "options", "onToggle", "id", "labelTooltip", "prefix"]);
51
51
  var _f = useState(false), updatedText = _f[0], setUpdatedText = _f[1];
52
52
  var selectedLabel = useMemo(function () { var _a; return ((_a = options === null || options === void 0 ? void 0 : options.find(function (o) { return (o === null || o === void 0 ? void 0 : o.value) === value; })) === null || _a === void 0 ? void 0 : _a.label) || ""; }, [value]);
53
53
  var _g = useState(selectedLabel), text = _g[0], setText = _g[1];
@@ -92,7 +92,7 @@ var Autocomplete = function (_a) {
92
92
  setText(selectedLabel);
93
93
  setIsMenuOpen(false);
94
94
  }
95
- }, label: label, isDisabled: isDisabled || isInputDisabled, placeholder: t(placeholder), value: text, onChange: function (v) { return setText(v); }, icon: isDisabled ? null : inputIconUI, labelTooltip: labelTooltip }) })), !isDisabled && filteredOptions.length > 0 && (_jsx(SelectMenu, __assign({ referenceElement: referenceElement, placement: placement, isOpen: isMenuOpen, onClose: function () { return setIsMenuOpen(false); } }, { children: filteredOptions.map(function (o, index) { return (_jsx(Div, { children: _jsx(MenuItem, __assign({ id: id ? "".concat(id, "-option-").concat(o.label) : null, isSelected: value === (o === null || o === void 0 ? void 0 : o.value), onClick: function () { return onSelect(o === null || o === void 0 ? void 0 : o.value); } }, { children: o.label })) }, index)); }) })))] })));
95
+ }, label: label, isDisabled: isDisabled || isInputDisabled, placeholder: t(placeholder), value: prefix ? "".concat(prefix).concat(text) : text, onChange: function (v) { return setText(v); }, icon: isDisabled ? null : inputIconUI, labelTooltip: labelTooltip }) })), !isDisabled && filteredOptions.length > 0 && (_jsx(SelectMenu, __assign({ referenceElement: referenceElement, placement: placement, isOpen: isMenuOpen, onClose: function () { return setIsMenuOpen(false); } }, { children: filteredOptions.map(function (o, index) { return (_jsx(Div, { children: _jsx(MenuItem, __assign({ id: id ? "".concat(id, "-option-").concat(o.label) : null, isSelected: value === (o === null || o === void 0 ? void 0 : o.value), onClick: function () { return onSelect(o === null || o === void 0 ? void 0 : o.value); } }, { children: o.label })) }, index)); }) })))] })));
96
96
  };
97
97
  var chevronDownIcon = (_jsx("svg", __assign({ width: "16", height: "9", viewBox: "0 0 16 9", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M14.9263 1L7.9631 7.96317L0.999928 1", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })));
98
98
  var clearIcon = (_jsxs("svg", __assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M4 4L12.5161 12.5161", stroke: "#333333", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M4 12.5161L12.5161 3.99998", stroke: "#333333", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
@@ -11,6 +11,7 @@ declare class FuseImporter {
11
11
  onValidateRecord: OnValidateRecord;
12
12
  onSubmit: OnSubmit;
13
13
  onClose: () => void;
14
+ private windowScrollPosition;
14
15
  close(): void;
15
16
  show(): Promise<void>;
16
17
  private renderImporterComponent;
package/lib/esm/index.js CHANGED
@@ -66,6 +66,10 @@ var FuseImporter = /** @class */ (function () {
66
66
  function FuseImporter(apiToken, templateSlug, options) {
67
67
  if (options === void 0) { options = {}; }
68
68
  this.cleanupIframe = null;
69
+ this.windowScrollPosition = {
70
+ x: 0,
71
+ y: 0,
72
+ };
69
73
  this.apiToken = apiToken;
70
74
  this.templateSlug = templateSlug;
71
75
  this.options = __assign({ env: "production", zIndex: 1000, batchValidationDelayMs: 500 }, options);
@@ -79,6 +83,9 @@ var FuseImporter = /** @class */ (function () {
79
83
  }
80
84
  var iframe = document.getElementById(fuseImporterId);
81
85
  document.body.removeChild(iframe);
86
+ // allow the scroll when the importer is closed
87
+ document.body.style.overflow = "auto";
88
+ window.scrollTo(this.windowScrollPosition.x, this.windowScrollPosition.y);
82
89
  };
83
90
  FuseImporter.prototype.show = function () {
84
91
  return __awaiter(this, void 0, void 0, function () {
@@ -96,6 +103,14 @@ var FuseImporter = /** @class */ (function () {
96
103
  }
97
104
  iframe = this.createIframe();
98
105
  importerComponent = this.createImporterComponent();
106
+ // saves the position of the page before the importer was opened
107
+ this.windowScrollPosition = {
108
+ x: window.scrollX,
109
+ y: window.scrollY,
110
+ };
111
+ // block the scroll when opening the importer
112
+ window.scrollTo(0, 0);
113
+ document.body.style.overflow = "hidden";
99
114
  this.configureIframe(iframe, importerComponent);
100
115
  return [2 /*return*/];
101
116
  }
@@ -54,6 +54,27 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ delete_toast: string;
68
+ confirmation_modal: string;
69
+ modal_title: string;
70
+ yes_delete: string;
71
+ select_rows: string;
72
+ delete_row: string;
73
+ };
74
+ export_your_data: {
75
+ tooltip: string;
76
+ };
77
+ };
57
78
  };
58
79
  general: {
59
80
  autocomplete: {
@@ -55,6 +55,27 @@ export default {
55
55
  manual_importer_title: "Daten Eingeben und Senden",
56
56
  export: "Exportieren",
57
57
  description: "Einige Zellen im Dokument können Fehler im Format oder fehlende Informationen aufweisen. Bitte überprüfen Sie diese, um fortzufahren.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Etwas suchen",
61
+ placeholder: "Etwas suchen...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Suchen oder auswählen",
65
+ filter_by_errors: "Nach Fehlern filtern",
66
+ },
67
+ delete_rows: {
68
+ delete_toast: "Du hast alle Zeilen gelöscht. Du wirst zum Upload-Schritt weitergeleitet.",
69
+ confirmation_modal: "Möchtest du wirklich {{length}} Zeile löschen",
70
+ modal_title: "Ausgewählte Zeile löschen",
71
+ yes_delete: "Ja, löschen",
72
+ select_rows: "Wählen Sie Zeilen zum Löschen aus",
73
+ delete_row: "Zeile löschen",
74
+ },
75
+ export_your_data: {
76
+ tooltip: "Exportiere deine Daten",
77
+ },
78
+ },
58
79
  },
59
80
  general: {
60
81
  autocomplete: {
@@ -54,6 +54,27 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ delete_toast: string;
68
+ confirmation_modal: string;
69
+ modal_title: string;
70
+ yes_delete: string;
71
+ select_rows: string;
72
+ delete_row: string;
73
+ };
74
+ export_your_data: {
75
+ tooltip: string;
76
+ };
77
+ };
57
78
  };
58
79
  general: {
59
80
  autocomplete: {
@@ -55,6 +55,27 @@ export default {
55
55
  manual_importer_title: "Enter Data & Submit",
56
56
  export: "Export",
57
57
  description: "Some cells in the document might have errors in format or missing information. Please review these to continue.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Search something",
61
+ placeholder: "Search something...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Search or select",
65
+ filter_by_errors: "Filter by errors",
66
+ },
67
+ delete_rows: {
68
+ delete_toast: "You have deleted all the rows. You will be redirect to the upload step.",
69
+ confirmation_modal: "Are you sure you want to delete {{length}} row",
70
+ modal_title: "Delete Selected Row",
71
+ yes_delete: "Yes, delete",
72
+ select_rows: "Select rows to delete",
73
+ delete_row: "Delete Row",
74
+ },
75
+ export_your_data: {
76
+ tooltip: "Export your data",
77
+ },
78
+ },
58
79
  },
59
80
  general: {
60
81
  autocomplete: {
@@ -54,6 +54,27 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ delete_toast: string;
68
+ confirmation_modal: string;
69
+ modal_title: string;
70
+ yes_delete: string;
71
+ select_rows: string;
72
+ delete_row: string;
73
+ };
74
+ export_your_data: {
75
+ tooltip: string;
76
+ };
77
+ };
57
78
  };
58
79
  general: {
59
80
  autocomplete: {
@@ -55,6 +55,27 @@ export default {
55
55
  manual_importer_title: "Ingresar Datos y Enviar",
56
56
  export: "Exportar",
57
57
  description: "Algunas celdas en el documento pueden tener errores en el formato o información faltante. Por favor revise esto para continuar.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Buscar algo",
61
+ placeholder: "Buscar algo...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Buscar o seleccionar",
65
+ filter_by_errors: "Filtrar por errores",
66
+ },
67
+ delete_rows: {
68
+ delete_toast: "Has eliminado todas las filas. Serás redirigido al paso de carga.",
69
+ confirmation_modal: "¿Seguro que quieres eliminar {{length}} fila",
70
+ modal_title: "Eliminar la fila seleccionada",
71
+ yes_delete: "Sí, eliminar",
72
+ select_rows: "Seleccione las filas a eliminar",
73
+ delete_row: "Eliminar fila",
74
+ },
75
+ export_your_data: {
76
+ tooltip: "Exporta tus datos",
77
+ },
78
+ },
58
79
  },
59
80
  general: {
60
81
  autocomplete: {
@@ -54,6 +54,27 @@ declare const _default: {
54
54
  manual_importer_title: string;
55
55
  export: string;
56
56
  description: string;
57
+ table_actions: {
58
+ search_rows: {
59
+ tooltip: string;
60
+ placeholder: string;
61
+ };
62
+ filter_by_errors: {
63
+ search_or_select: string;
64
+ filter_by_errors: string;
65
+ };
66
+ delete_rows: {
67
+ delete_toast: string;
68
+ confirmation_modal: string;
69
+ modal_title: string;
70
+ yes_delete: string;
71
+ select_rows: string;
72
+ delete_row: string;
73
+ };
74
+ export_your_data: {
75
+ tooltip: string;
76
+ };
77
+ };
57
78
  };
58
79
  general: {
59
80
  autocomplete: {
@@ -55,6 +55,27 @@ export default {
55
55
  manual_importer_title: "Saisir Des Données et Envoyer",
56
56
  export: "Exporter",
57
57
  description: "Certaines cellules du document peuvent avoir des erreurs de format ou des informations manquantes. Veuillez les examiner pour continuer.",
58
+ table_actions: {
59
+ search_rows: {
60
+ tooltip: "Rechercher quelque chose",
61
+ placeholder: "Rechercher quelque chose...",
62
+ },
63
+ filter_by_errors: {
64
+ search_or_select: "Rechercher ou sélectionner",
65
+ filter_by_errors: "Filtrer par erreurs",
66
+ },
67
+ delete_rows: {
68
+ delete_toast: "Vous avez supprimé toutes les lignes. Vous serez redirigé vers l'étape de téléchargement.",
69
+ confirmation_modal: "Voulez-vous vraiment supprimer {{length}} ligne",
70
+ modal_title: "Supprimer la ligne sélectionnée",
71
+ yes_delete: "Oui, supprimer",
72
+ select_rows: "Sélectionnez les lignes à supprimer",
73
+ delete_row: "Supprimer la ligne",
74
+ },
75
+ export_your_data: {
76
+ tooltip: "Exporter vos données",
77
+ },
78
+ },
58
79
  },
59
80
  general: {
60
81
  autocomplete: {
@@ -36,6 +36,7 @@ export type Meta = {
36
36
  isInvalid?: boolean;
37
37
  hasWarning?: boolean;
38
38
  touched?: boolean;
39
+ uploadedRow?: any;
39
40
  backendErrors?: ValidationErrors;
40
41
  };
41
42
  export type Record = {