fuse-importer 0.0.9-testing → 0.1.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.
Files changed (50) hide show
  1. package/lib/esm/Importer/ImporterWithContext.js +1 -1
  2. package/lib/esm/Importer/Review/ReviewContextProvider.js +8 -5
  3. package/lib/esm/Importer/common/Spreadsheet/common/index.js +1 -1
  4. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +7 -1
  5. package/lib/esm/Importer/common/Spreadsheet/components/fields/SpreadsheetInput.js +16 -12
  6. package/lib/esm/Importer/common/Spreadsheet/components/fields/index.d.ts +2 -1
  7. package/lib/esm/Importer/common/Spreadsheet/components/fields/index.js +24 -13
  8. package/lib/esm/Importer/common/Spreadsheet/components/fields/utils.d.ts +11 -0
  9. package/lib/esm/Importer/common/Spreadsheet/components/fields/utils.js +29 -0
  10. package/lib/esm/Importer/common/Spreadsheet/hooks.js +47 -18
  11. package/lib/esm/Importer/common/Spreadsheet/transformation/transformators.js +39 -7
  12. package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +4 -2
  13. package/lib/esm/Importer/contexts/ImporterContextProvider.js +2 -1
  14. package/lib/esm/Importer/data/index.js +22 -2
  15. package/lib/esm/Importer/index.d.ts +4 -3
  16. package/lib/esm/Importer/index.js +2 -2
  17. package/lib/esm/common/Table/TableActions/CustomActions/CustomActions.d.ts +1 -0
  18. package/lib/esm/common/Table/TableActions/CustomActions/CustomActions.js +81 -0
  19. package/lib/esm/common/Table/TableActions/CustomActions/index.d.ts +1 -0
  20. package/lib/esm/common/Table/TableActions/CustomActions/index.js +1 -0
  21. package/lib/esm/common/Table/TableActions/FilterByErrors/FilterByErrors.js +2 -2
  22. package/lib/esm/common/Table/TableActions/RowFilters.js +4 -4
  23. package/lib/esm/common/Table/TableActions/SearchRows.js +6 -5
  24. package/lib/esm/common/Table/TableActions/TableActions.js +2 -1
  25. package/lib/esm/common/Table/TableActions/TransformedRecordsCount.js +15 -3
  26. package/lib/esm/common/Table/TableActions/icons.d.ts +1 -0
  27. package/lib/esm/common/Table/TableActions/icons.js +1 -0
  28. package/lib/esm/common/columnsValidations.d.ts +0 -26
  29. package/lib/esm/common/columnsValidations.js +1 -287
  30. package/lib/esm/common/datePatterns.d.ts +26 -0
  31. package/lib/esm/common/datePatterns.js +327 -0
  32. package/lib/esm/common/index.d.ts +1 -0
  33. package/lib/esm/common/index.js +1 -0
  34. package/lib/esm/common/inputs/SelectMenu.d.ts +2 -1
  35. package/lib/esm/common/inputs/SelectMenu.js +9 -2
  36. package/lib/esm/index.d.ts +3 -1
  37. package/lib/esm/index.js +9 -2
  38. package/lib/esm/locales/de.d.ts +6 -0
  39. package/lib/esm/locales/de.js +7 -1
  40. package/lib/esm/locales/en.d.ts +6 -0
  41. package/lib/esm/locales/en.js +7 -1
  42. package/lib/esm/locales/es.d.ts +6 -0
  43. package/lib/esm/locales/es.js +7 -1
  44. package/lib/esm/locales/fr.d.ts +6 -0
  45. package/lib/esm/locales/fr.js +7 -1
  46. package/lib/esm/types.d.ts +13 -4
  47. package/lib/esm/utils/index.d.ts +1 -0
  48. package/lib/esm/utils/index.js +4 -0
  49. package/lib/main.js +10 -10
  50. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
+ import { useMemo, useState } from "react";
18
+ import { ActionPlus } from "../icons";
19
+ import { Div } from "../../../../styled";
20
+ import styled from "styled-components";
21
+ import { SelectMenu } from "../../../../common/inputs";
22
+ import { MenuItem, addToast } from "../../../index";
23
+ import { useSpreadsheetContext } from "../../../../index";
24
+ import { useImporterContext } from "../../../../Importer/contexts/ImporterContextProvider";
25
+ import { useTranslation } from "react-i18next";
26
+ var Container = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n"], ["\n cursor: pointer;\n"])));
27
+ var StyledSelectMenu = styled(SelectMenu)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n .selectMenu[data-popper-placement^=\"bottom\"] {\n width: 320px !important;\n transform: translate(-199px, 21px);\n }\n"], ["\n .selectMenu[data-popper-placement^=\"bottom\"] {\n width: 320px !important;\n transform: translate(-199px, 21px);\n }\n"])));
28
+ export var CustomActions = function () {
29
+ var customActions = useImporterContext().customActions;
30
+ var _a = useSpreadsheetContext(), selectedRows = _a.selectedRows, data = _a.data, updateRecord = _a.updateRecord;
31
+ var _b = useState(null), referenceElement = _b[0], setReferenceElement = _b[1];
32
+ var _c = useState(false), isMenuOpen = _c[0], setIsMenuOpen = _c[1];
33
+ var t = useTranslation("review").t;
34
+ var filteredOptions = useMemo(function () {
35
+ return customActions.map(function (action) { return action.name; });
36
+ }, [customActions]);
37
+ var handleCustomAction = function (actionKey) {
38
+ var recordsToRunAction = data.filter(function (row) {
39
+ return selectedRows.includes(row._meta.id);
40
+ });
41
+ var recordsAfterActions = [];
42
+ var action = customActions.find(function (action) { return action.name === actionKey; });
43
+ if (!action || Object.keys(action).length === 0) {
44
+ addToast(t("table_actions.custom_actions.general_error_toast"), "error");
45
+ return;
46
+ }
47
+ for (var i = 0; i < recordsToRunAction.length; i++) {
48
+ var currentRecord = recordsToRunAction[i];
49
+ try {
50
+ if (action.actionType === "record") {
51
+ var newRecord = action.handler(currentRecord);
52
+ recordsAfterActions.push(newRecord);
53
+ continue;
54
+ }
55
+ }
56
+ catch (error) {
57
+ addToast(t("table_actions.custom_actions.error_toast", {
58
+ actionName: action.name,
59
+ }), "error");
60
+ break;
61
+ }
62
+ }
63
+ if (recordsAfterActions.length) {
64
+ addToast(t("table_actions.custom_actions.success_toast", {
65
+ actionName: action.name,
66
+ }), "success");
67
+ }
68
+ updateRecord(recordsAfterActions);
69
+ };
70
+ var onSelect = function (value) {
71
+ setIsMenuOpen(false);
72
+ handleCustomAction(value);
73
+ };
74
+ var handleMenuVisibility = function () {
75
+ setIsMenuOpen(function (oldValue) { return !oldValue; });
76
+ };
77
+ if (!filteredOptions.length || !selectedRows.length)
78
+ return null;
79
+ return (_jsxs(_Fragment, { children: [_jsxs(Container, __assign({ onClick: handleMenuVisibility, dflex: true, alignCenter: true, minw: 152, w100: true, pl: 20, pr: 20, pt: 6, pb: 6, ref: setReferenceElement, "data-testid": "ta-custom-actions" }, { children: [_jsx(ActionPlus, {}), _jsx(Div, __assign({ pl: 4, buttonTextSmall: true }, { children: t("table_actions.custom_actions.label") }))] })), isMenuOpen && (_jsx(StyledSelectMenu, __assign({ referenceElement: referenceElement, placement: "bottom", isOpen: isMenuOpen, onClose: function () { return setIsMenuOpen(false); }, selectMenuClassName: "selectMenu" }, { children: filteredOptions.map(function (option, index) { return (_jsx(Div, __assign({ "data-test-id": "autocomplete-menu-item" }, { children: _jsx(MenuItem, __assign({ id: "custom-action-option-".concat(option), onClick: function () { return onSelect(option); } }, { children: option })) }), index)); }) })))] }));
80
+ };
81
+ var templateObject_1, templateObject_2;
@@ -0,0 +1 @@
1
+ export * from "./CustomActions";
@@ -0,0 +1 @@
1
+ export * from "./CustomActions";
@@ -7,7 +7,7 @@ import { addToast } from "../../../../common/Toast";
7
7
  import { useState } from "react";
8
8
  export var FilterByErrors = function () {
9
9
  var _a, _b;
10
- var _c = useSpreadsheetContext(), errors = _c.errors, fields = _c.fields, spreadsheetFilter = _c.spreadsheetFilter, resetSpreadsheetFilter = _c.resetSpreadsheetFilter, filterRecordsByFieldErrors = _c.filterRecordsByFieldErrors;
10
+ var _c = useSpreadsheetContext(), errors = _c.errors, fields = _c.fields, spreadsheetFilter = _c.spreadsheetFilter, resetSpreadsheetFilter = _c.resetSpreadsheetFilter, filterRecordsByFieldErrors = _c.filterRecordsByFieldErrors, isTransformTooltipOpened = _c.isTransformTooltipOpened;
11
11
  var t = useTranslation("review").t;
12
12
  var _d = useState(false), isMenuOpened = _d[0], setIsMenuOpened = _d[1];
13
13
  var prefix = t("table_actions.filter_by_errors.filter_by_errors");
@@ -42,6 +42,6 @@ export var FilterByErrors = function () {
42
42
  : isMenuOpened
43
43
  ? search_or_select
44
44
  : prefix;
45
- var isDisabled = errorArray.length === 0;
45
+ var isDisabled = errorArray.length === 0 || isTransformTooltipOpened;
46
46
  return (_jsx(S.StyledAutocomplete, { placement: "bottom", placeholder: inputText, onToggle: function (v) { return !isDisabled && setIsMenuOpened(v); }, onChange: onChange, value: selectedErrorToFilter, options: errorArray, isDisabled: isDisabled, isInputDisabled: isDisabled, inputWidth: inputWidth, "data-testid": "ta-filter-by-errors", prefix: inputText }));
47
47
  };
@@ -24,19 +24,19 @@ var FilterContainer = styled(Div)(templateObject_2 || (templateObject_2 = __make
24
24
  var Container = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n border-radius: 4px;\n background-color: ", ";\n"], ["\n display: flex;\n border-radius: 4px;\n background-color: ", ";\n"])), function (p) { return p.theme.colors.backgroundInterface; });
25
25
  var FilteredDataCount = styled(Div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: ", ";\n color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n margin-left: -3px;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n"], ["\n background: ", ";\n color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n margin-left: -3px;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n"])), function (p) { return p.theme.colors.highlight01; }, function (p) { return p.theme.colors.black; });
26
26
  var Filter = function (_a) {
27
- var label = _a.label, count = _a.count, isSelected = _a.isSelected, onClick = _a.onClick;
27
+ var label = _a.label, count = _a.count, isSelected = _a.isSelected, onClick = _a.onClick, isDisabled = _a.isDisabled;
28
28
  var _b = useSpreadsheetContext(), filteredInputValue = _b.filteredInputValue, filteredDataCount = _b.filteredDataCount;
29
29
  var labelToId = function (label) {
30
30
  return label.toLowerCase().replace(/\s/g, "_") + "_filter";
31
31
  };
32
- return (_jsxs(Div, __assign({ dflex: true, clickable: true, onClick: onClick, "data-test-id": labelToId(label) }, { children: [_jsxs(FilterContainer, __assign({ isSelected: isSelected }, { children: [label, count >= 0 && _jsxs(_Fragment, { children: ["\u00A0(", count, ")"] })] })), isSelected && filteredInputValue !== "" && (_jsx(FilteredDataCount, { children: _jsx(Div, __assign({ minw: 14, centered: true }, { children: filteredDataCount })) }))] })));
32
+ return (_jsxs(Div, __assign({ disabledWhen: isDisabled, dflex: true, clickable: true, onClick: function () { return !isDisabled && onClick(); }, "data-test-id": labelToId(label) }, { children: [_jsxs(FilterContainer, __assign({ isSelected: isSelected }, { children: [label, count >= 0 && _jsxs(_Fragment, { children: ["\u00A0(", count, ")"] })] })), isSelected && filteredInputValue !== "" && (_jsx(FilteredDataCount, { children: _jsx(Div, __assign({ minw: 14, centered: true }, { children: filteredDataCount })) }))] })));
33
33
  };
34
34
  export var RowFilters = function () {
35
- var _a = useSpreadsheetContext(), spreadsheetFilter = _a.spreadsheetFilter, errors = _a.errors, filterRecordsByRowType = _a.filterRecordsByRowType, recordsWithValuesCount = _a.recordsWithValuesCount;
35
+ var _a = useSpreadsheetContext(), spreadsheetFilter = _a.spreadsheetFilter, errors = _a.errors, filterRecordsByRowType = _a.filterRecordsByRowType, recordsWithValuesCount = _a.recordsWithValuesCount, isTransformTooltipOpened = _a.isTransformTooltipOpened;
36
36
  var t = useTranslation("review").t;
37
37
  var all_rows = t("table_actions.filters_by_rows.all_rows");
38
38
  var valid_rows = t("table_actions.filters_by_rows.valid_rows");
39
39
  var invalid_rows = t("table_actions.filters_by_rows.invalid_rows");
40
- return (_jsxs(Container, { children: [_jsx(Filter, { isSelected: spreadsheetFilter.byRow === "all", label: all_rows, count: recordsWithValuesCount, onClick: function () { return filterRecordsByRowType("all"); } }), _jsx(Filter, { isSelected: spreadsheetFilter.byRow === "valid", label: valid_rows, onClick: function () { return filterRecordsByRowType("valid"); } }), _jsx(Filter, { isSelected: spreadsheetFilter.byRow === "invalid", label: invalid_rows, count: Object.values(errors).length, onClick: function () { return filterRecordsByRowType("invalid"); } })] }));
40
+ return (_jsxs(Container, { children: [_jsx(Filter, { isSelected: spreadsheetFilter.byRow === "all", label: all_rows, count: recordsWithValuesCount, onClick: function () { return filterRecordsByRowType("all"); }, isDisabled: isTransformTooltipOpened }), _jsx(Filter, { isSelected: spreadsheetFilter.byRow === "valid", label: valid_rows, onClick: function () { return filterRecordsByRowType("valid"); }, isDisabled: isTransformTooltipOpened }), _jsx(Filter, { isSelected: spreadsheetFilter.byRow === "invalid", label: invalid_rows, count: Object.values(errors).length, onClick: function () { return filterRecordsByRowType("invalid"); }, isDisabled: isTransformTooltipOpened })] }));
41
41
  };
42
42
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -23,7 +23,8 @@ import { colors } from "../../../styled/theme/colorPalette";
23
23
  import { textStyles } from "../../../styled/theme/textStyles";
24
24
  import { TooltipProvider } from "../../../common/TooltipProvider";
25
25
  import { useTranslation } from "react-i18next";
26
- var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n gap: 8px;\n height: 24px;\n overflow: hidden;\n padding: 8px;\n position: relative;\n transition: width 0.25s ease-in-out;\n width: ", ";\n"], ["\n background: ", ";\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n gap: 8px;\n height: 24px;\n overflow: hidden;\n padding: 8px;\n position: relative;\n transition: width 0.25s ease-in-out;\n width: ", ";\n"])), function (_a) {
26
+ import { Div } from "../../../styled";
27
+ var Wrapper = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n gap: 8px;\n height: 24px;\n overflow: hidden;\n padding: 8px;\n position: relative;\n transition: width 0.25s ease-in-out;\n width: ", ";\n"], ["\n background: ", ";\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n gap: 8px;\n height: 24px;\n overflow: hidden;\n padding: 8px;\n position: relative;\n transition: width 0.25s ease-in-out;\n width: ", ";\n"])), function (_a) {
27
28
  var isOpen = _a.isOpen;
28
29
  return (isOpen ? colors.orange50 : "none");
29
30
  }, function (_a) {
@@ -36,7 +37,7 @@ var Input = styled.input(templateObject_4 || (templateObject_4 = __makeTemplateO
36
37
  return !isOpen && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: -9999px;\n "], ["\n position: absolute;\n top: -9999px;\n "])));
37
38
  });
38
39
  var SearchInput = function (_a) {
39
- var testId = _a.testId, value = _a.value, onChange = _a.onChange;
40
+ var testId = _a.testId, value = _a.value, onChange = _a.onChange, isDisabled = _a.isDisabled;
40
41
  var _b = useDebounce(value, onChange, 300), _value = _b._value, set_Value = _b.set_Value;
41
42
  var inputRef = useRef(null);
42
43
  var _c = useState(false), isOpen = _c[0], setIsOpen = _c[1];
@@ -59,14 +60,14 @@ var SearchInput = function (_a) {
59
60
  }
60
61
  }
61
62
  };
62
- return (_jsx(TooltipProvider, __assign({ tooltip: !isOpen ? t("table_actions.search_rows.tooltip") : "", placement: "right", flip: false, centered: true, w: "auto", "data-testid": testId }, { children: _jsxs(Wrapper, __assign({ isOpen: isOpen, onClick: handleWrapperClick }, { children: [_jsx(IconWrapper, { children: _jsx(SearchIcon, {}) }), _jsx(Input, { isOpen: isOpen, ref: inputRef, value: _value, onChange: handleInputChange, onBlur: handleInputOnBlur, type: "text", placeholder: t("table_actions.search_rows.placeholder") })] })) })));
63
+ return (_jsx(TooltipProvider, __assign({ tooltip: !isOpen && !isDisabled ? t("table_actions.search_rows.tooltip") : "", placement: "right", flip: false, centered: true, w: "auto", "data-testid": testId }, { children: _jsxs(Wrapper, __assign({ isOpen: isOpen, onClick: function () { return !isDisabled && handleWrapperClick(); }, disabledWhen: isDisabled }, { children: [_jsx(IconWrapper, { children: _jsx(SearchIcon, {}) }), _jsx(Input, { isOpen: isOpen, ref: inputRef, value: _value, onChange: handleInputChange, onBlur: handleInputOnBlur, type: "text", placeholder: t("table_actions.search_rows.placeholder") })] })) })));
63
64
  };
64
65
  export var SearchRows = function (_a) {
65
66
  var _b = _a.testId, testId = _b === void 0 ? "ta-search-rows" : _b;
66
- var _c = useSpreadsheetContext(), filteredInputValue = _c.filteredInputValue, setFilteredInputValue = _c.setFilteredInputValue;
67
+ var _c = useSpreadsheetContext(), filteredInputValue = _c.filteredInputValue, setFilteredInputValue = _c.setFilteredInputValue, isTransformTooltipOpened = _c.isTransformTooltipOpened;
67
68
  var handleChangeInputValue = function (value) {
68
69
  setFilteredInputValue(value);
69
70
  };
70
- return (_jsx(SearchInput, { testId: testId, value: filteredInputValue, onChange: handleChangeInputValue }));
71
+ return (_jsx(SearchInput, { testId: testId, value: filteredInputValue, onChange: handleChangeInputValue, isDisabled: isTransformTooltipOpened }));
71
72
  };
72
73
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -29,7 +29,8 @@ import * as S from "./TableActions.styles";
29
29
  import { FilterByErrors } from "./FilterByErrors/FilterByErrors";
30
30
  import { RowFilters } from "./RowFilters";
31
31
  import { TransformedRecordsCount } from "./TransformedRecordsCount";
32
+ import { CustomActions } from "./CustomActions";
32
33
  export var TableActions = function (_a) {
33
34
  var _b = _a.tableActionsHeight, tableActionsHeight = _b === void 0 ? defaultTableActionsHeightPx : _b, props = __rest(_a, ["tableActionsHeight"]);
34
- return (_jsxs(S.TableActionsContainer, __assign({ height: tableActionsHeight }, props, { children: [_jsxs(S.TableActionsContent, { children: [_jsx(SearchRows, {}), _jsx(RowFilters, {}), _jsx(FilterByErrors, {}), _jsxs(S.ButtonActionsContainer, { children: [_jsx(DeleteSelectedRows, {}), _jsx(ExportData, {})] })] }), _jsx(S.TableActionsInformations, { children: _jsx(TransformedRecordsCount, {}) })] })));
35
+ return (_jsxs(S.TableActionsContainer, __assign({ height: tableActionsHeight }, props, { children: [_jsxs(S.TableActionsContent, { children: [_jsx(SearchRows, {}), _jsx(RowFilters, {}), _jsx(FilterByErrors, {}), _jsxs(S.ButtonActionsContainer, { children: [_jsx(DeleteSelectedRows, {}), _jsx(ExportData, {}), _jsx(CustomActions, {})] })] }), _jsx(S.TableActionsInformations, { children: _jsx(TransformedRecordsCount, {}) })] })));
35
36
  };
@@ -21,6 +21,7 @@ import { useSpreadsheetContext } from "../../../Importer";
21
21
  import { Div, colors } from "../../../styled";
22
22
  import { CheckIcon } from "./icons";
23
23
  import { Button } from "../../../common/buttons";
24
+ import { truncateString } from "../../../utils";
24
25
  var formatToLocaleString = function (number) {
25
26
  return number.toLocaleString(undefined, {
26
27
  minimumFractionDigits: 0,
@@ -33,11 +34,11 @@ var TooltipContainer = styled(Div)(templateObject_3 || (templateObject_3 = __mak
33
34
  var ExampleCode = styled(Div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n background: ", ";\n border-radius: 4px;\n display: flex;\n justify-content: space-between;\n padding: 4px;\n"], ["\n align-items: center;\n background: ", ";\n border-radius: 4px;\n display: flex;\n justify-content: space-between;\n padding: 4px;\n"])), colors.blue100);
34
35
  var StyledButton = styled(Button)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-self: flex-end;\n height: 36px;\n padding: 0px;\n width: 61px;\n"], ["\n align-self: flex-end;\n height: 36px;\n padding: 0px;\n width: 61px;\n"])));
35
36
  var Tooltip = function (_a) {
36
- var recordsCount = _a.recordsCount, onClose = _a.onClose;
37
+ var recordsCount = _a.recordsCount, onClose = _a.onClose, transformedRowData = _a.transformedRowData;
37
38
  var t = useTranslation("review").t;
38
39
  return (_jsxs(TooltipContainer, __assign({ "data-cy": "transformations-tooltip" }, { children: [_jsx(Div, { children: _jsx(CheckIcon, {}) }), _jsx(Div, __assign({ subtitle: true }, { children: t("table_actions.transformed_records.auto_corrections_amount", {
39
40
  amount: formatToLocaleString(recordsCount),
40
- }) })), _jsxs(Div, { children: [_jsx(Div, __assign({ mb: 5, label1: true, style: { color: colors.gray700 } }, { children: t("table_actions.transformed_records.example") })), _jsxs(ExampleCode, { children: [_jsx(Div, __assign({ body1: true }, { children: "$37.00" })), _jsx(Div, __assign({ body1: true, style: { textDecoration: "line-through" } }, { children: "$36.8" }))] })] }), _jsx(StyledButton, __assign({ buttonTextSmall: true, uppercase: true, onClick: onClose }, { children: "OK" }))] })));
41
+ }) })), transformedRowData && (_jsxs(Div, { children: [_jsx(Div, __assign({ mb: 5, label1: true, style: { color: colors.gray700 } }, { children: t("table_actions.transformed_records.example") })), _jsxs(ExampleCode, { children: [_jsx(Div, __assign({ body1: true }, { children: truncateString(transformedRowData === null || transformedRowData === void 0 ? void 0 : transformedRowData.transformed, 15) })), _jsx(Div, __assign({ body1: true, style: { textDecoration: "line-through" } }, { children: truncateString(transformedRowData === null || transformedRowData === void 0 ? void 0 : transformedRowData.original, 15) }))] })] })), _jsx(StyledButton, __assign({ buttonTextSmall: true, uppercase: true, onClick: onClose }, { children: "OK" }))] })));
41
42
  };
42
43
  export var TransformedRecordsCount = function () {
43
44
  var _a = useSpreadsheetContext(), data = _a.data, isTransformTooltipOpened = _a.isTransformTooltipOpened, setIsTransformTooltipOpened = _a.setIsTransformTooltipOpened;
@@ -66,6 +67,17 @@ export var TransformedRecordsCount = function () {
66
67
  var handleCloseTooltip = function () {
67
68
  setIsTransformTooltipOpened(false);
68
69
  };
69
- return (_jsx(_Fragment, { children: isTransformTooltipOpened && transformedRecordsCount ? (_jsxs(RecordsCountContainer, { children: [_jsxs(Counter, __assign({ body1: true }, { children: [_jsxs(Div, __assign({ bold: true, mr: 4, "data-cy": "transformations-counter" }, { children: [formatToLocaleString(transformedRecordsCount), " "] })), t("table_actions.transformed_records.auto_corrections_done")] })), isTransformTooltipOpened && (_jsx(Tooltip, { recordsCount: transformedRecordsCount, onClose: handleCloseTooltip }))] })) : null }));
70
+ var firstTransformedRow = useMemo(function () {
71
+ var _a;
72
+ for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
73
+ var obj = data_1[_i];
74
+ var transformedRow = (_a = obj === null || obj === void 0 ? void 0 : obj._meta) === null || _a === void 0 ? void 0 : _a.transformedRow;
75
+ if (transformedRow && Object.keys(transformedRow).length > 0) {
76
+ return Object.values(transformedRow)[0];
77
+ }
78
+ }
79
+ return null;
80
+ }, []);
81
+ return (_jsx(_Fragment, { children: isTransformTooltipOpened && transformedRecordsCount ? (_jsxs(RecordsCountContainer, { children: [_jsxs(Counter, __assign({ body1: true }, { children: [_jsxs(Div, __assign({ bold: true, mr: 4, "data-cy": "transformations-counter" }, { children: [formatToLocaleString(transformedRecordsCount), " "] })), t("table_actions.transformed_records.auto_corrections_done")] })), isTransformTooltipOpened && (_jsx(Tooltip, { transformedRowData: firstTransformedRow, recordsCount: transformedRecordsCount, onClose: handleCloseTooltip }))] })) : null }));
70
82
  };
71
83
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -3,3 +3,4 @@ export declare const ConfirmationDeleteIcon: JSX.Element;
3
3
  export declare const SearchIcon: () => JSX.Element;
4
4
  export declare const DownloadIcon: () => JSX.Element;
5
5
  export declare const CheckIcon: () => JSX.Element;
6
+ export declare const ActionPlus: () => JSX.Element;
@@ -15,3 +15,4 @@ export var ConfirmationDeleteIcon = (_jsxs("svg", __assign({ width: "68", height
15
15
  export var SearchIcon = function () { return (_jsxs("svg", __assign({ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M11 20C15.9706 20 20 15.9706 20 11C20 6.02944 15.9706 2 11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20Z", stroke: "#262626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M21 21L18 18", stroke: "#262626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }))); };
16
16
  export var DownloadIcon = function () { return (_jsxs("svg", __assign({ width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M10.0834 18C9.66675 16.75 9.66675 15.5 9.66675 14.6303C9.66675 11.7319 12.2621 8.83337 15.4637 8.83337C17.6094 8.83337 19.4828 9.99914 20.4852 11.7319H21.2607C23.6619 11.7319 25.9167 13.4167 25.9167 15.5C25.9167 16.3334 25.9167 17.1667 25.5001 18", stroke: "#262626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M14.1807 23.2764L17.5834 26.5416L20.9862 23.2764", stroke: "#262626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M17.5833 25.6827L17.5833 16.4375", stroke: "#262626", strokeWidth: "2", strokeLinecap: "round" })] }))); };
17
17
  export var CheckIcon = function () { return (_jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "53", height: "53", viewBox: "0 0 53 53", fill: "none" }, { children: [_jsx("rect", { width: "53", height: "53", fill: "white" }), _jsx("g", __assign({ style: { mixBlendMode: "multiply" } }, { children: _jsx("path", { d: "M40.6023 5.38665C41.3381 4.56281 42.6024 4.49142 43.4263 5.22719L51.5083 12.4453C52.3321 13.181 52.4035 14.4454 51.6677 15.2692L23.539 46.7647C22.8032 47.5885 21.5389 47.6599 20.7151 46.9242L12.6331 39.7061C11.8092 38.9703 11.7378 37.706 12.4736 36.8822L40.6023 5.38665Z", fill: "url(#paint0_linear_643_341)" }) })), _jsx("g", __assign({ style: { mixBlendMode: "darken" } }, { children: _jsx("rect", { x: "32.0707", y: "37.1587", width: "14.836", height: "29.7113", rx: "2", transform: "rotate(131.582 32.0707 37.1587)", fill: "url(#paint1_linear_643_341)" }) })), _jsxs("defs", { children: [_jsxs("linearGradient", __assign({ id: "paint0_linear_643_341", x1: "15.4625", y1: "39.0861", x2: "31.139", y2: "48.4231", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#D0A617" }), _jsx("stop", { offset: "1", stopColor: "#FEE18F" })] })), _jsxs("linearGradient", __assign({ id: "paint1_linear_643_341", x1: "39.4887", y1: "37.1587", x2: "29.9147", y2: "74.1394", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#6BEEFF" }), _jsx("stop", { offset: "1", stopColor: "#08CABE" })] }))] })] }))); };
18
+ export var ActionPlus = function () { return (_jsx("svg", __assign({ width: "16", height: "17", viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsxs("g", __assign({ id: "Actions Plus" }, { children: [_jsx("path", { id: "Vector 4", d: "M8 2.91602V14.916", stroke: "#909090", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { id: "Vector 5", d: "M2 8.91602L14 8.91602", stroke: "#909090", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })) }))); };
@@ -15,31 +15,5 @@ export declare const validationsByColumnType: {
15
15
  };
16
16
  export declare const validationsByType: {};
17
17
  export declare const availableColumnTypes: string[];
18
- export declare const datePatterns: {
19
- value: string;
20
- label: string;
21
- }[];
22
- export declare const dateTimePatterns: {
23
- value: string;
24
- label: string;
25
- }[];
26
- export declare const timePatterns: {
27
- value: string;
28
- label: string;
29
- }[];
30
- export declare const allowedPatterns: {
31
- date: {
32
- value: string;
33
- label: string;
34
- }[];
35
- datetime: {
36
- value: string;
37
- label: string;
38
- }[];
39
- time: {
40
- value: string;
41
- label: string;
42
- }[];
43
- };
44
18
  export declare const patternsColumnTypes: string[];
45
19
  export declare const validateColumn: <T extends "string" | "boolean" | "time" | "integer" | "float" | "email" | "url" | "enum" | "date" | "datetime">(columnData: ColumnRequiredProps<T>) => Promise<void>;
@@ -45,6 +45,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
45
  };
46
46
  import * as yup from "yup";
47
47
  import { FieldTypes, mutableValidationTypes, mutableTransformationTypes, } from "../types";
48
+ import { allowedPatterns, datePatterns, dateTimePatterns, timePatterns, } from "./datePatterns";
48
49
  var commonValidations = [
49
50
  {
50
51
  value: "regex",
@@ -219,293 +220,6 @@ export var validationsByType = Object.values(validationsByColumnType)
219
220
  return result;
220
221
  }, {});
221
222
  export var availableColumnTypes = Object.keys(validationsByColumnType);
222
- export var datePatterns = [
223
- {
224
- value: "MM/dd/yyyy",
225
- label: "MM/dd/yyyy (e.g. 08/31/2023)",
226
- },
227
- {
228
- value: "yyyy-MM-dd",
229
- label: "yyyy-MM-dd (e.g. 2023-08-31",
230
- },
231
- {
232
- value: "dd/MM/yyyy",
233
- label: "dd/MM/yyyy (e.g. 31/08/2023",
234
- },
235
- {
236
- value: "MM-dd-yyyy",
237
- label: "MM-dd-yyyy (e.g. 08-31-2023)",
238
- },
239
- {
240
- value: "yyyy/MM/dd",
241
- label: "yyyy/MM/dd (e.g. 2023/08/31)",
242
- },
243
- {
244
- value: "dd-MMMM-yyyy",
245
- label: "dd-MMMM-yyyy (e.g. 31-August-2023)",
246
- },
247
- {
248
- value: "MMMM dd, yyyy",
249
- label: "MMMM dd, yyyy (e.g. August 31, 2023)",
250
- },
251
- {
252
- value: "dd/MM/yy",
253
- label: "dd/MM/yy (e.g. 31/08/23)",
254
- },
255
- {
256
- value: "MMMM dd, yy",
257
- label: "MMMM dd, yy (e.g. August 31, 23)",
258
- },
259
- {
260
- value: "yy/MM/dd",
261
- label: "yy/MM/dd (e.g. 23/08/31)",
262
- },
263
- {
264
- value: "EEEE MMMM yyyy",
265
- label: "Day MMMM Year (e.g. Tuesday August 2023)",
266
- },
267
- {
268
- value: "EEEE dd MMMM yyyy",
269
- label: "Day Day-of-Month Month Year (e.g. Tuesday 08 August 2023)",
270
- },
271
- {
272
- value: "MM-dd-yy",
273
- label: "MM-dd-yy (e.g. 01-15-90)",
274
- },
275
- {
276
- value: "M-dd-yy",
277
- label: "M-dd-yy (e.g. 1-15-90)",
278
- },
279
- {
280
- value: "dd-MM-yy",
281
- label: "dd-MM-yy (e.g. 15-01-90)",
282
- },
283
- {
284
- value: "dd-MM-yyyy",
285
- label: "dd-MM-yyyy (e.g. 15-01-1990)",
286
- },
287
- {
288
- value: "dd-M-yy",
289
- label: "dd-M-yy (e.g. 15-1-90)",
290
- },
291
- {
292
- value: "MM/dd/yy",
293
- label: "MM/dd/yy (e.g. 01/15/90)",
294
- },
295
- {
296
- value: "M/dd/yy",
297
- label: "M/dd/yy (e.g. 1/15/90)",
298
- },
299
- {
300
- value: "MM.dd.yy",
301
- label: "MM.dd.yy (e.g. 01.15.90)",
302
- },
303
- {
304
- value: "M.dd.yy",
305
- label: "M.dd.yy (e.g. 1.15.90)",
306
- },
307
- {
308
- value: "MMM-dd-yy",
309
- label: "MMM-dd-yy (e.g. Jan-15-90)",
310
- },
311
- {
312
- value: "MMMM-dd-yy",
313
- label: "MMMM-dd-yy (e.g. January-15-90)",
314
- },
315
- {
316
- value: "dd-MMM-yy",
317
- label: "dd-MMM-yy (e.g. 15-Jan-90)",
318
- },
319
- {
320
- value: "yyyy-M-dd",
321
- label: "yyyy-M-dd (e.g. 1990-1-15)",
322
- },
323
- {
324
- value: "M-dd-yyyy",
325
- label: "M-dd-yyyy (e.g. 1-15-1990)",
326
- },
327
- {
328
- value: "M/dd/yyyy",
329
- label: "M/dd/yyyy (e.g. 1/15/1990)",
330
- },
331
- {
332
- value: "dd/M/yyyy",
333
- label: "dd/M/yyyy (e.g. 15/1/1990)",
334
- },
335
- {
336
- value: "yyyy/M/dd",
337
- label: "yyyy/M/dd (e.g. 1990/1/15)",
338
- },
339
- {
340
- value: "dd.MM.yyyy",
341
- label: "dd.MM.yyyy (e.g. 15.01.1990)",
342
- },
343
- {
344
- value: "dd.M.yyyy",
345
- label: "dd.M.yyyy (e.g. 15.1.1990)",
346
- },
347
- {
348
- value: "yyyy.MM.dd",
349
- label: "yyyy.MM.dd (e.g. 1990.01.15)",
350
- },
351
- {
352
- value: "yyyy.M.dd",
353
- label: "yyyy.M.dd (e.g. 1990.1.15)",
354
- },
355
- {
356
- value: "MMM. dd, yyyy",
357
- label: "MMM. dd, yyyy (e.g. Jan. 15, 1990)",
358
- },
359
- {
360
- value: "dd MMM. yyyy",
361
- label: "dd MMM. yyyy(e.g. 15 Jan. 1990)",
362
- },
363
- {
364
- value: "dd. MMM. yyyy",
365
- label: "dd. MMM. yyyy (e.g. 15. Jan. 1990)",
366
- },
367
- {
368
- value: "EEE, MMM dd, yyyy",
369
- label: "EEE, MMM dd, yyyy (e.g. Mon, Jan 15, 1990)",
370
- },
371
- ];
372
- export var dateTimePatterns = [
373
- {
374
- value: "MM/dd/yyyy HH:mm",
375
- label: "MM/dd/yyyy HH:mm (e.g. 08/31/2023 12:30)",
376
- },
377
- {
378
- value: "MM/dd/yyyy HH:mm:ss",
379
- label: "MM/dd/yyyy HH:mm:ss (e.g. 08/31/2023 12:30:45)",
380
- },
381
- {
382
- value: "MM/dd/yyyy HH:mm:ss.SSS",
383
- label: "MM/dd/yyyy HH:mm:ss.SSS (e.g. 08/31/2023 12:30:45.500)",
384
- },
385
- {
386
- value: "MM/dd/yyyy h:mm a",
387
- label: "MM/dd/yyyy h:mm a (e.g. 08/31/2023 1:30 PM)",
388
- },
389
- {
390
- value: "MM/dd/yyyy h:mm:ss a",
391
- label: "MM/dd/yyyy h:mm:ss a (e.g. 08/31/2023 1:30:45 PM)",
392
- },
393
- {
394
- value: "MMM dd HH:mm:ss yyyy",
395
- label: "MMM dd HH:mm:ss yyyy (e.g. Jan 15 00:34:59 1990)",
396
- },
397
- {
398
- value: "dd MMM HH:mm:ss yyyy",
399
- label: "dd MMM HH:mm:ss yyyy (e.g. 15 Jan 00:34:59 1990)",
400
- },
401
- {
402
- value: "MM/dd/yyyy h:mm:ss.SSS a",
403
- label: "MM/dd/yyyy h:mm:ss.SSS a (e.g. 08/31/2023 1:30:45.500 PM)",
404
- },
405
- {
406
- value: "MMMM dd, yyyy HH:mm",
407
- label: "MMMM dd, yyyy HH:mm (e.g. August 31, 2023 12:30)",
408
- },
409
- {
410
- value: "MMMM dd, yyyy HH:mm:ss",
411
- label: "MMMM dd, yyyy HH:mm:ss (e.g. August 31, 2023 12:30:45)",
412
- },
413
- {
414
- value: "MMMM dd, yyyy h:mm a",
415
- label: "MMMM dd, yyyy h:mm a (e.g. August 31, 2023 1:30 PM)",
416
- },
417
- {
418
- value: "MMMM dd, yyyy h:mm:ss a",
419
- label: "MMMM dd, yyyy h:mm:ss a (e.g. August 31, 2023 1:30:45 PM)",
420
- },
421
- {
422
- value: "MMMM dd, yyyy h:mm:ss.SSS a",
423
- label: "MMMM dd, yyyy h:mm:ss.SSS a (e.g. August 31, 2023 1:30:45.500 PM)",
424
- },
425
- {
426
- value: "MM-dd-yy HH:mm",
427
- label: "MM-dd-yy HH:mm (e.g. 01-15-90 10:10)",
428
- },
429
- {
430
- value: "dd-MM-yyyy HH:mm",
431
- label: "dd-MM-yyyy HH:mm (e.g. 15-01-1990 10:10)",
432
- },
433
- {
434
- value: "dd/MM/yyyy HH:mm",
435
- label: "dd/MM/yyyy HH:mm (e.g. 15/01/1990 10:10)",
436
- },
437
- {
438
- value: "dd-MM-yyyy h:mm a",
439
- label: "dd-MM-yyyy h:mm a (e.g. 15-01-1990 10:10 AM)",
440
- },
441
- {
442
- value: "dd/MM/yyyy h:mm a",
443
- label: "dd/MM/yyyy h:mm a (e.g. 15/01/1990 10:10 AM)",
444
- },
445
- {
446
- value: "MM/dd/yy HH:mm",
447
- label: "MM/dd/yy HH:mm (e.g. 01/15/90 10:10)",
448
- },
449
- {
450
- value: "MM/dd/yy HH:mm:ss",
451
- label: "MM/dd/yy HH:mm:ss (e.g. 01/15/90 10:10:14)",
452
- },
453
- {
454
- value: "MM/dd/yy h:mm:ss a",
455
- label: "MM/dd/yy h:mm:ss a (e.g. 01/15/90 5:10:14 AM)",
456
- },
457
- {
458
- value: "yyyy/MM/dd HH:mm",
459
- label: "yyyy/MM/dd HH:mm (e.g. 1990/01/15 10:10)",
460
- },
461
- {
462
- value: "MM-dd-yyyy HH:mm",
463
- label: "MM-dd-yyyy HH:mm (e.g. 01-15-1990 10:10)",
464
- },
465
- {
466
- value: "yyyy-MM-dd HH:mm",
467
- label: "yyyy-MM-dd HH:mm (e.g. 1990-01-15 10:10)",
468
- },
469
- {
470
- value: "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
471
- label: "ISO 8601 (e.g. 1990-01-15T00:34:55.020+09:30)",
472
- },
473
- {
474
- value: "yyyy-MM-dd'T'HH:mm:ss.SSS",
475
- label: "ISO 8601 without timezone offset (e.g. 1990-01-15T00:34:55.020)",
476
- },
477
- {
478
- value: "yyyy-MM-dd'T'HH:mmZ",
479
- label: "yyyy-MM-dd'T'HH:mm+offset (e.g. 1990-01-15T10:10+09:30)",
480
- },
481
- {
482
- value: "yyyy-MM-dd'T'HH:mm",
483
- label: "yyyy-MM-dd'T'HH:mm (e.g. 1990-01-15T10:10)",
484
- },
485
- ];
486
- export var timePatterns = [
487
- {
488
- value: "HH:mm",
489
- label: "HH:mm (e.g. 12:30)",
490
- },
491
- {
492
- value: "HH:mm:ss",
493
- label: "HH:mm:ss (e.g. 12:30:45)",
494
- },
495
- {
496
- value: "hh:mm a",
497
- label: "hh:mm a (e.g. 01:30 PM)",
498
- },
499
- {
500
- value: "hh:mm:ss a",
501
- label: "hh:mm:ss a (e.g. 01:30:45 PM)",
502
- },
503
- ];
504
- export var allowedPatterns = {
505
- date: datePatterns,
506
- datetime: dateTimePatterns,
507
- time: timePatterns,
508
- };
509
223
  export var patternsColumnTypes = Object.keys(allowedPatterns);
510
224
  var iso8601Regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
511
225
  var validationsSchema = yup
@@ -0,0 +1,26 @@
1
+ export declare const datePatterns: {
2
+ value: string;
3
+ label: string;
4
+ }[];
5
+ export declare const dateTimePatterns: {
6
+ value: string;
7
+ label: string;
8
+ }[];
9
+ export declare const timePatterns: {
10
+ value: string;
11
+ label: string;
12
+ }[];
13
+ export declare const allowedPatterns: {
14
+ date: {
15
+ value: string;
16
+ label: string;
17
+ }[];
18
+ datetime: {
19
+ value: string;
20
+ label: string;
21
+ }[];
22
+ time: {
23
+ value: string;
24
+ label: string;
25
+ }[];
26
+ };