@reltio/components 1.4.2050 → 1.4.2052
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/ChartTooltip/ChartTooltip.js +3 -3
- package/ColumnsSettings/ColumnsSettings.d.ts +2 -1
- package/ColumnsSettings/ColumnsSettings.js +2 -2
- package/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- package/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/HOCs/withAsyncMount/withAsyncMount.test.js +52 -52
- package/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/Image/Image.d.ts +1 -1
- package/Image/Image.js +8 -8
- package/Image/Image.test.js +46 -51
- package/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/ImageAttributesLine/ImageAttributesLine.test.js +187 -193
- package/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/ImageAttributesLine/imageAttributeValues.test-data.js +22 -0
- package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +315 -298
- package/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/ImageDetailsView/attributes.test-data.js +98 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/ImageDetailsView/helpers.test.js +4 -4
- package/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/ImportButton/ImportButton.test.js +94 -24
- package/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/InlineAttributesList/attributes.test-data.js +40 -1
- package/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +396 -182
- package/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/InlineReferenceAttribute/InlineReferenceAttribute.test.js +165 -107
- package/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +352 -346
- package/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +285 -194
- package/InternalLink/InternalLink.test.js +41 -11
- package/LookupEditor/LookupEditor.test.js +180 -44
- package/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/MapChart/MapChart.js +3 -8
- package/MapChart/MapChart.test.js +152 -188
- package/MapChart/components/Legend/Legend.js +3 -3
- package/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/SelectEditor/SelectEditor.d.ts +4 -10
- package/SelectEditor/SelectEditor.js +0 -4
- package/SelectEditor/SelectEditor.test.js +79 -9
- package/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/SelectionPopup/SelectionPopup.js +3 -3
- package/SelectionPopup/SelectionPopup.spec.js +90 -30
- package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/cjs/ChartTooltip/ChartTooltip.js +3 -3
- package/cjs/ColumnsSettings/ColumnsSettings.d.ts +2 -1
- package/cjs/ColumnsSettings/ColumnsSettings.js +2 -2
- package/cjs/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- package/cjs/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/cjs/HOCs/withAsyncMount/withAsyncMount.test.js +56 -56
- package/cjs/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/cjs/Image/Image.d.ts +1 -1
- package/cjs/Image/Image.js +8 -8
- package/cjs/Image/Image.test.js +46 -51
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/cjs/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/cjs/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +195 -224
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +23 -1
- package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +316 -299
- package/cjs/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/cjs/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/cjs/ImageDetailsView/attributes.test-data.js +99 -2
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/cjs/ImageDetailsView/helpers.test.js +3 -3
- package/cjs/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/cjs/ImportButton/ImportButton.test.js +94 -24
- package/cjs/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/cjs/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/cjs/InlineAttributesList/attributes.test-data.js +41 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/cjs/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +395 -204
- package/cjs/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/cjs/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/cjs/InlineReferenceAttribute/InlineReferenceAttribute.test.js +164 -106
- package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +351 -345
- package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +307 -193
- package/cjs/InternalLink/InternalLink.test.js +40 -10
- package/cjs/LookupEditor/LookupEditor.test.js +178 -65
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/cjs/MapChart/MapChart.js +3 -8
- package/cjs/MapChart/MapChart.test.js +152 -188
- package/cjs/MapChart/components/Legend/Legend.js +3 -3
- package/cjs/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/cjs/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/cjs/SelectEditor/SelectEditor.d.ts +4 -10
- package/cjs/SelectEditor/SelectEditor.js +0 -4
- package/cjs/SelectEditor/SelectEditor.test.js +79 -9
- package/cjs/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/cjs/SelectionPopup/SelectionPopup.js +3 -3
- package/cjs/SelectionPopup/SelectionPopup.spec.js +90 -30
- package/cjs/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/cjs/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/package.json +1 -1
- package/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/HOCs/withTableContext/withTableContext.test.js +0 -41
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -98
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -99
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -65
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -306
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -134
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -99
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -36
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -161
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -76
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -104
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -114
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -177
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -52
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -37
- package/cjs/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/cjs/HOCs/withTableContext/withTableContext.test.js +0 -46
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -103
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -104
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -70
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -311
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -139
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -104
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -41
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -166
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -81
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -109
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -119
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -182
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -57
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -42
|
@@ -1,13 +1,83 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
4
51
|
import { SelectEditor } from './SelectEditor';
|
|
5
52
|
describe('SelectEditor', function () {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
53
|
+
var defaultProps = {
|
|
54
|
+
value: 'String1',
|
|
55
|
+
classes: { root: 'customRoot' },
|
|
56
|
+
entries: [{ value: 'String1' }, { value: 'String2' }, { value: 'String3' }],
|
|
57
|
+
onChange: jest.fn()
|
|
58
|
+
};
|
|
59
|
+
it('should render DropDownEditor', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
var user, button;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
user = userEvent.setup();
|
|
65
|
+
render(React.createElement(SelectEditor, __assign({}, defaultProps)));
|
|
66
|
+
expect(screen.getByText('String1')).toBeInTheDocument();
|
|
67
|
+
expect(screen.queryByText('String2')).not.toBeInTheDocument();
|
|
68
|
+
button = screen.getByRole('button');
|
|
69
|
+
expect(button).toHaveClass('customRoot');
|
|
70
|
+
return [4 /*yield*/, user.click(button)];
|
|
71
|
+
case 1:
|
|
72
|
+
_a.sent();
|
|
73
|
+
expect(screen.getByText('String2')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByText('String3')).toBeInTheDocument();
|
|
75
|
+
return [4 /*yield*/, user.click(screen.getByText('String3'))];
|
|
76
|
+
case 2:
|
|
77
|
+
_a.sent();
|
|
78
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith('String3');
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); });
|
|
13
83
|
});
|
|
@@ -11,8 +11,9 @@ type Props = {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
hideTitle?: boolean;
|
|
13
13
|
hideSearchInput?: boolean;
|
|
14
|
+
inputPlaceholder?: string;
|
|
14
15
|
headerPlacement?: 'top' | 'bottom';
|
|
15
16
|
searchInputRef?: React.Ref<unknown>;
|
|
16
17
|
} & PopoverProps;
|
|
17
|
-
export declare const SelectionPopup: ({ title, className, onSearch, hideTitle, hideSearchInput, headerPlacement, containerWidth, containerHeight, searchInputOnKeyDown, children, searchInputRef, anchorOrigin, transformOrigin, ...otherProps }: Props) => React.JSX.Element;
|
|
18
|
+
export declare const SelectionPopup: ({ title, className, onSearch, hideTitle, hideSearchInput, inputPlaceholder, headerPlacement, containerWidth, containerHeight, searchInputOnKeyDown, children, searchInputRef, anchorOrigin, transformOrigin, ...otherProps }: Props) => React.JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -29,18 +29,18 @@ import { useStyles } from './styles';
|
|
|
29
29
|
import { useTheme } from '@mui/styles';
|
|
30
30
|
export var SelectionPopup = function (_a) {
|
|
31
31
|
var _b;
|
|
32
|
-
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideTitle = _a.hideTitle, hideSearchInput = _a.hideSearchInput, _c = _a.headerPlacement, headerPlacement = _c === void 0 ? 'top' : _c, containerWidth = _a.containerWidth, containerHeight = _a.containerHeight, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef, _d = _a.anchorOrigin, anchorOrigin = _d === void 0 ? {
|
|
32
|
+
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideTitle = _a.hideTitle, hideSearchInput = _a.hideSearchInput, inputPlaceholder = _a.inputPlaceholder, _c = _a.headerPlacement, headerPlacement = _c === void 0 ? 'top' : _c, containerWidth = _a.containerWidth, containerHeight = _a.containerHeight, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef, _d = _a.anchorOrigin, anchorOrigin = _d === void 0 ? {
|
|
33
33
|
vertical: 'top',
|
|
34
34
|
horizontal: 'right'
|
|
35
35
|
} : _d, _e = _a.transformOrigin, transformOrigin = _e === void 0 ? {
|
|
36
36
|
vertical: 'top',
|
|
37
37
|
horizontal: 'right'
|
|
38
|
-
} : _e, otherProps = __rest(_a, ["title", "className", "onSearch", "hideTitle", "hideSearchInput", "headerPlacement", "containerWidth", "containerHeight", "searchInputOnKeyDown", "children", "searchInputRef", "anchorOrigin", "transformOrigin"]);
|
|
38
|
+
} : _e, otherProps = __rest(_a, ["title", "className", "onSearch", "hideTitle", "hideSearchInput", "inputPlaceholder", "headerPlacement", "containerWidth", "containerHeight", "searchInputOnKeyDown", "children", "searchInputRef", "anchorOrigin", "transformOrigin"]);
|
|
39
39
|
var classes = useStyles({ containerWidth: containerWidth, containerHeight: containerHeight });
|
|
40
40
|
var currentTheme = useTheme();
|
|
41
41
|
var header = (React.createElement(React.Fragment, null,
|
|
42
42
|
!hideTitle && React.createElement("div", { className: classes.header }, title),
|
|
43
|
-
!hideSearchInput && (React.createElement(SearchInput, { onSearch: onSearch, autofocus: true, onKeyDown: searchInputOnKeyDown, inputRef: searchInputRef, classes: { root: classes.searchInputContainer }, placeholder: i18n.text('Search & add attributes'), height: 40 }))));
|
|
43
|
+
!hideSearchInput && (React.createElement(SearchInput, { onSearch: onSearch, autofocus: true, onKeyDown: searchInputOnKeyDown, inputRef: searchInputRef, classes: { root: classes.searchInputContainer }, placeholder: inputPlaceholder || i18n.text('Search & add attributes'), height: 40 }))));
|
|
44
44
|
return (React.createElement(Popover, __assign({ anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, "data-mui-color-scheme": (_b = currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.palette) === null || _b === void 0 ? void 0 : _b.mode }, otherProps),
|
|
45
45
|
React.createElement("div", { className: classnames(classes.container, className), style: { width: containerWidth } },
|
|
46
46
|
headerPlacement === 'top' && header,
|
|
@@ -9,49 +9,109 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
15
51
|
import { SelectionPopup } from './SelectionPopup';
|
|
16
|
-
import { SearchInput } from '../SearchInput';
|
|
17
52
|
describe('SelectionPopup tests', function () {
|
|
18
53
|
var defaultProps = {
|
|
54
|
+
title: 'Title',
|
|
19
55
|
anchorEl: document.createElement('div'),
|
|
20
|
-
open: true
|
|
56
|
+
open: true,
|
|
57
|
+
containerWidth: 100,
|
|
58
|
+
containerHeight: 100,
|
|
59
|
+
children: React.createElement("div", { "data-reltio-id": "children" }),
|
|
60
|
+
onClose: jest.fn(),
|
|
61
|
+
onSearch: jest.fn(),
|
|
62
|
+
searchInputOnKeyDown: jest.fn()
|
|
21
63
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
64
|
+
var setUp = function (props) {
|
|
65
|
+
if (props === void 0) { props = {}; }
|
|
66
|
+
var user = userEvent.setup();
|
|
67
|
+
return __assign({ user: user }, render(React.createElement(SelectionPopup, __assign({}, defaultProps, props))));
|
|
68
|
+
};
|
|
69
|
+
it('should render main components correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var user, textbox, backdrop;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
user = setUp().user;
|
|
75
|
+
textbox = screen.getByRole('textbox');
|
|
76
|
+
expect(textbox).toHaveAttribute('placeholder', 'Search & add attributes');
|
|
77
|
+
expect(screen.getByText('Title')).toBeInTheDocument();
|
|
78
|
+
expect(screen.getByTestId('children')).toBeInTheDocument();
|
|
79
|
+
return [4 /*yield*/, user.type(textbox, 'test')];
|
|
80
|
+
case 1:
|
|
81
|
+
_a.sent();
|
|
82
|
+
expect(defaultProps.onSearch).toHaveBeenCalledWith('test');
|
|
83
|
+
expect(defaultProps.searchInputOnKeyDown).toHaveBeenCalledTimes(4);
|
|
84
|
+
backdrop = screen.getByRole('presentation').firstChild;
|
|
85
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
86
|
+
case 2:
|
|
87
|
+
_a.sent();
|
|
88
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
}
|
|
34
91
|
});
|
|
35
|
-
|
|
36
|
-
});
|
|
92
|
+
}); });
|
|
37
93
|
it('should hide title if props.hideTitle is true', function () {
|
|
38
|
-
|
|
39
|
-
expect(
|
|
94
|
+
setUp({ hideTitle: true });
|
|
95
|
+
expect(screen.queryByText('Title')).not.toBeInTheDocument();
|
|
40
96
|
});
|
|
41
97
|
it('should hide search input if props.hideSearchInput is true', function () {
|
|
42
|
-
|
|
43
|
-
expect(
|
|
98
|
+
setUp({ hideSearchInput: true });
|
|
99
|
+
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
it('should use placeholder from props.inputPlaceholder', function () {
|
|
102
|
+
setUp({ inputPlaceholder: 'test placeholder' });
|
|
103
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'test placeholder');
|
|
44
104
|
});
|
|
45
105
|
it('should render header at the top if props.headerPlacement is "top"', function () {
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
expect(
|
|
49
|
-
expect(
|
|
106
|
+
setUp({ headerPlacement: 'top' });
|
|
107
|
+
var container = screen.getByRole('presentation').querySelector('.container');
|
|
108
|
+
expect(container.firstChild).toHaveClass('header');
|
|
109
|
+
expect(container.lastChild).toHaveClass('list');
|
|
50
110
|
});
|
|
51
111
|
it('should render header at the bottom if props.headerPlacement is "bottom"', function () {
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
expect(
|
|
55
|
-
expect(
|
|
112
|
+
setUp({ headerPlacement: 'bottom' });
|
|
113
|
+
var container = screen.getByRole('presentation').querySelector('.container');
|
|
114
|
+
expect(container.firstChild).toHaveClass('list');
|
|
115
|
+
expect(container.lastChild).toHaveClass('searchInputContainer');
|
|
56
116
|
});
|
|
57
117
|
});
|
|
@@ -6,7 +6,7 @@ export declare const RecommendedIconWithTooltip: React.ForwardRefExoticComponent
|
|
|
6
6
|
tooltipPlacement?: import("@mui/material").TooltipProps["placement"];
|
|
7
7
|
showForDisabled?: boolean;
|
|
8
8
|
} & React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
9
|
-
type Data = {
|
|
9
|
+
type Data = Record<string, unknown> & {
|
|
10
10
|
attrType?: AttributeType;
|
|
11
11
|
};
|
|
12
12
|
type Props = {
|
|
@@ -15,11 +15,11 @@ var ChartTooltip = function (_a) {
|
|
|
15
15
|
var localizedValue = (tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.localizedValue) || (tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.value);
|
|
16
16
|
var tooltipLabel = tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.label;
|
|
17
17
|
var percent = tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.percent;
|
|
18
|
-
return (active && (react_1.default.createElement("div", { className: styles.tooltipWrapper },
|
|
18
|
+
return (active && (react_1.default.createElement("div", { "data-reltio-id": "chart-tooltip", className: styles.tooltipWrapper },
|
|
19
19
|
react_1.default.createElement("p", { className: styles.tooltipTitle }, tooltipLabel),
|
|
20
|
-
(0, ramda_1.isNil)(percent) ? (react_1.default.createElement("p", { className: styles.tooltipValue },
|
|
20
|
+
(0, ramda_1.isNil)(percent) ? (react_1.default.createElement("p", { "data-reltio-id": "chart-tooltip-value", className: styles.tooltipValue },
|
|
21
21
|
"Value: ",
|
|
22
|
-
localizedValue)) : (react_1.default.createElement("p", { className: styles.tooltipValueBold },
|
|
22
|
+
localizedValue)) : (react_1.default.createElement("p", { "data-reltio-id": "chart-tooltip-value", className: styles.tooltipValueBold },
|
|
23
23
|
localizedValue,
|
|
24
24
|
react_1.default.createElement("span", { className: styles.tooltipPercent },
|
|
25
25
|
" (",
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
onChangeColumns: (columns: string[]) => void;
|
|
7
7
|
title?: string;
|
|
8
8
|
tooltipTitle?: string;
|
|
9
|
+
inputPlaceholder?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare const ColumnsSettings: ({ columnsData, selectedColumns, onChangeColumns, title, tooltipTitle }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const ColumnsSettings: ({ columnsData, selectedColumns, onChangeColumns, title, tooltipTitle, inputPlaceholder }: Props) => React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -35,7 +35,7 @@ var SmallIconButton_1 = require("../SmallIconButton");
|
|
|
35
35
|
var ColumnsSettingsPopup_1 = require("./components/ColumnsSettingsPopup");
|
|
36
36
|
var helpers_1 = require("./helpers");
|
|
37
37
|
var ColumnsSettings = function (_a) {
|
|
38
|
-
var columnsData = _a.columnsData, selectedColumns = _a.selectedColumns, onChangeColumns = _a.onChangeColumns, title = _a.title, tooltipTitle = _a.tooltipTitle;
|
|
38
|
+
var columnsData = _a.columnsData, selectedColumns = _a.selectedColumns, onChangeColumns = _a.onChangeColumns, title = _a.title, tooltipTitle = _a.tooltipTitle, inputPlaceholder = _a.inputPlaceholder;
|
|
39
39
|
var _b = (0, react_1.useState)(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
40
40
|
var openPopup = function (event) { return setAnchorEl(event.currentTarget); };
|
|
41
41
|
var closePopup = function () { return setAnchorEl(null); };
|
|
@@ -48,6 +48,6 @@ var ColumnsSettings = function (_a) {
|
|
|
48
48
|
}, [selectedColumns, onChangeColumns]);
|
|
49
49
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
50
50
|
react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { "data-reltio-id": "reltio-columns-settings-button", tooltipTitle: tooltipTitle || ui_i18n_1.default.text('Show/hide columns'), size: "L", icon: Table_1.default, onClick: openPopup }),
|
|
51
|
-
react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, { onColumnClick: handleColumnClick, anchorEl: anchorEl, columnsData: columnsData, onClose: closePopup, title: title, selectedColumns: selectedColumns })));
|
|
51
|
+
react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, { onColumnClick: handleColumnClick, anchorEl: anchorEl, columnsData: columnsData, onClose: closePopup, title: title, inputPlaceholder: inputPlaceholder, selectedColumns: selectedColumns })));
|
|
52
52
|
};
|
|
53
53
|
exports.ColumnsSettings = ColumnsSettings;
|
|
@@ -110,6 +110,20 @@ describe('ColumnsSettings', function () {
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}); });
|
|
113
|
+
it('should use custom placeholder', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
114
|
+
var user;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
user = setUp({ props: { inputPlaceholder: 'test placeholder' } }).user;
|
|
119
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('reltio-columns-settings-button'))];
|
|
120
|
+
case 1:
|
|
121
|
+
_a.sent();
|
|
122
|
+
expect(react_2.screen.getByRole('textbox')).toHaveAttribute('placeholder', 'test placeholder');
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}); });
|
|
113
127
|
});
|
|
114
128
|
describe('plain columns data behavior', function () {
|
|
115
129
|
var columnsData = [
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
export function ColumnListItem({ item, onClick, checked, level, style, isFocused, isGroupItem, hideCheckBox }: {
|
|
2
|
-
item: any;
|
|
3
|
-
onClick: any;
|
|
4
|
-
checked: any;
|
|
5
|
-
level: any;
|
|
6
|
-
style: any;
|
|
7
|
-
isFocused: any;
|
|
8
|
-
isGroupItem: any;
|
|
9
|
-
hideCheckBox: any;
|
|
10
|
-
}): React.JSX.Element;
|
|
11
|
-
export namespace ColumnListItem {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
let item: PropTypes.Requireable<PropTypes.InferProps<{
|
|
14
|
-
label: PropTypes.Requireable<string>;
|
|
15
|
-
filterText: PropTypes.Requireable<string>;
|
|
16
|
-
}>>;
|
|
17
|
-
let level: PropTypes.Requireable<number>;
|
|
18
|
-
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
let checked: PropTypes.Requireable<boolean>;
|
|
20
|
-
let style: PropTypes.Requireable<object>;
|
|
21
|
-
let isGroupItem: PropTypes.Requireable<boolean>;
|
|
22
|
-
let isFocused: PropTypes.Requireable<boolean>;
|
|
23
|
-
let hideCheckBox: PropTypes.Requireable<boolean>;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
1
|
import React from 'react';
|
|
27
|
-
import
|
|
2
|
+
import { AttributeListItem } from '../../../AttributeListItem';
|
|
3
|
+
type Props = Pick<React.ComponentProps<typeof AttributeListItem>, 'hideCheckBox' | 'onClick' | 'checked' | 'level' | 'style' | 'isFocused'> & {
|
|
4
|
+
item: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
filterText?: string;
|
|
8
|
+
};
|
|
9
|
+
isGroupItem?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const ColumnListItem: ({ item, onClick, checked, level, style, isFocused, isGroupItem, hideCheckBox }: Props) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ColumnListItem = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var prop_types_1 = __importDefault(require("prop-types"));
|
|
9
8
|
var classnames_1 = __importDefault(require("classnames"));
|
|
10
9
|
var AttributeListItem_1 = require("../../../AttributeListItem");
|
|
11
10
|
var Highlighter_1 = require("../../../Highlighter");
|
|
@@ -17,16 +16,3 @@ var ColumnListItem = function (_a) {
|
|
|
17
16
|
return (react_1.default.createElement(AttributeListItem_1.AttributeListItem, { hideCheckBox: hideCheckBox, key: item.id, onClick: onClick, checked: checked, level: level, data: item, label: react_1.default.createElement(Highlighter_1.Highlighter, { text: item.label, highlight: item.filterText }), labelInText: item.label, style: style, isFocused: isFocused, hideIcon: isGroupItem, className: (0, classnames_1.default)((_b = {}, _b[styles.groupItem] = isGroupItem, _b)) }));
|
|
18
17
|
};
|
|
19
18
|
exports.ColumnListItem = ColumnListItem;
|
|
20
|
-
exports.ColumnListItem.propTypes = {
|
|
21
|
-
item: prop_types_1.default.shape({
|
|
22
|
-
label: prop_types_1.default.string,
|
|
23
|
-
filterText: prop_types_1.default.string
|
|
24
|
-
}),
|
|
25
|
-
level: prop_types_1.default.number,
|
|
26
|
-
onClick: prop_types_1.default.func,
|
|
27
|
-
checked: prop_types_1.default.bool,
|
|
28
|
-
style: prop_types_1.default.object,
|
|
29
|
-
isGroupItem: prop_types_1.default.bool,
|
|
30
|
-
isFocused: prop_types_1.default.bool,
|
|
31
|
-
hideCheckBox: prop_types_1.default.bool
|
|
32
|
-
};
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
anchorEl: HTMLElement;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
title?: string;
|
|
7
|
+
inputPlaceholder?: string;
|
|
7
8
|
columnsData: GroupedColumnsData[];
|
|
8
9
|
onColumnClick: (column: {
|
|
9
10
|
id: string;
|
|
@@ -11,5 +12,5 @@ type Props = {
|
|
|
11
12
|
selectedColumns: string[];
|
|
12
13
|
hideCheckBox?: boolean;
|
|
13
14
|
};
|
|
14
|
-
export declare const ColumnsSettingsPopup: ({ anchorEl, onClose, title, columnsData, onColumnClick, selectedColumns, hideCheckBox }: Props) => React.JSX.Element;
|
|
15
|
+
export declare const ColumnsSettingsPopup: ({ anchorEl, onClose, title, inputPlaceholder, columnsData, onColumnClick, selectedColumns, hideCheckBox }: Props) => React.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -43,7 +43,7 @@ var DEFAULT_MIN_CONTAINER_WIDTH = 308;
|
|
|
43
43
|
var CONTAINER_HEADER_HEIGHT = 108;
|
|
44
44
|
var MIN_CONTAINER_HEIGHT = 140;
|
|
45
45
|
var ColumnsSettingsPopup = function (_a) {
|
|
46
|
-
var anchorEl = _a.anchorEl, onClose = _a.onClose, title = _a.title, columnsData = _a.columnsData, onColumnClick = _a.onColumnClick, selectedColumns = _a.selectedColumns, hideCheckBox = _a.hideCheckBox;
|
|
46
|
+
var anchorEl = _a.anchorEl, onClose = _a.onClose, title = _a.title, inputPlaceholder = _a.inputPlaceholder, columnsData = _a.columnsData, onColumnClick = _a.onColumnClick, selectedColumns = _a.selectedColumns, hideCheckBox = _a.hideCheckBox;
|
|
47
47
|
var styles = (0, styles_1.useStyles)();
|
|
48
48
|
var _b = (0, react_1.useState)(''), filterText = _b[0], setFilterText = _b[1];
|
|
49
49
|
var clearFilter = function () { return setFilterText(''); };
|
|
@@ -68,7 +68,7 @@ var ColumnsSettingsPopup = function (_a) {
|
|
|
68
68
|
};
|
|
69
69
|
var listHeight = Math.min(MAX_LIST_CONTAINER_HEIGHT, ITEM_HEIGHT * items.length);
|
|
70
70
|
var containerHeight = Math.max(MIN_CONTAINER_HEIGHT, listHeight + CONTAINER_HEADER_HEIGHT);
|
|
71
|
-
return (react_1.default.createElement(SelectionPopup_1.SelectionPopup, { className: styles.popup, open: !!anchorEl, anchorEl: anchorEl, onClose: handleClose, onSearch: setFilterText, title: title || ui_i18n_1.default.text('Show/hide columns'), containerWidth: containerWidth, containerHeight: containerHeight, searchInputOnKeyDown: handleKeyDown },
|
|
71
|
+
return (react_1.default.createElement(SelectionPopup_1.SelectionPopup, { className: styles.popup, open: !!anchorEl, anchorEl: anchorEl, onClose: handleClose, onSearch: setFilterText, inputPlaceholder: inputPlaceholder, title: title || ui_i18n_1.default.text('Show/hide columns'), containerWidth: containerWidth, containerHeight: containerHeight, searchInputOnKeyDown: handleKeyDown },
|
|
72
72
|
react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, { fixedTitle: false, height: listHeight, renderItem: renderColumnItem, items: items, getItemSize: function () { return ITEM_HEIGHT; }, focusIndex: focusIndex })));
|
|
73
73
|
};
|
|
74
74
|
exports.ColumnsSettingsPopup = ColumnsSettingsPopup;
|
|
@@ -69,7 +69,7 @@ function DropDownMenuButton(_a) {
|
|
|
69
69
|
return react_1.default.createElement(MenuItemRenderer, { item: item, key: index, onMenuClose: handleToggle });
|
|
70
70
|
};
|
|
71
71
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
-
react_1.default.createElement(ButtonComponent, __assign({ "data-reltio-id":
|
|
72
|
+
react_1.default.createElement(ButtonComponent, __assign({ "data-reltio-id": "drop-down-menu-button", ref: buttonRef, className: (0, classnames_1.default)(styles.buttonRoot, (_b = {},
|
|
73
73
|
_b[styles.selected] = isOpen,
|
|
74
74
|
_b), className), onClick: handleToggle, "aria-pressed": isOpen, "aria-controls": isOpen ? menuId : undefined, "aria-haspopup": "true" }, buttonProps), buttonContent),
|
|
75
75
|
react_1.default.createElement(Menu_1.default, __assign({ id: menuId, variant: "menu", open: isOpen, autoFocus: false, classes: { paper: styles.paper }, anchorEl: buttonRef.current, onClose: handleToggle, anchorOrigin: {
|
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
17
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var
|
|
8
|
-
var test_utils_1 = require("react-dom/test-utils");
|
|
18
|
+
var react_2 = require("@testing-library/react");
|
|
9
19
|
var AsyncMountContext_1 = require("../../contexts/AsyncMountContext");
|
|
10
20
|
var withAsyncMount_1 = require("./withAsyncMount");
|
|
11
21
|
describe('withAsyncMount tests', function () {
|
|
12
22
|
beforeAll(function () {
|
|
13
23
|
jest.useFakeTimers();
|
|
14
24
|
});
|
|
25
|
+
var defaultContextValue = { enabled: true, queueSizeThreshold: 0 };
|
|
15
26
|
var Component = function (_a) {
|
|
16
27
|
var value = _a.value;
|
|
17
|
-
return react_1.default.createElement("div", { "data-id": value });
|
|
18
|
-
};
|
|
28
|
+
return react_1.default.createElement("div", { "data-reltio-id": value });
|
|
29
|
+
};
|
|
30
|
+
var Placeholder = function () { return react_1.default.createElement("span", { "data-reltio-id": "placeholder" }); };
|
|
31
|
+
var setUp = function (_a) {
|
|
32
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.contextValue, contextValue = _c === void 0 ? {} : _c, _d = _b.withProvider, withProvider = _d === void 0 ? true : _d, _e = _b.withPlaceholder, withPlaceholder = _e === void 0 ? false : _e;
|
|
33
|
+
var Providers = function (_a) {
|
|
34
|
+
var children = _a.children;
|
|
35
|
+
return (react_1.default.createElement(AsyncMountContext_1.AsyncMountContext.Provider, { value: __assign(__assign({}, defaultContextValue), contextValue) }, children));
|
|
36
|
+
};
|
|
37
|
+
var AsyncMountedComponent = (0, withAsyncMount_1.withAsyncMount)(Component, withPlaceholder ? Placeholder : undefined);
|
|
38
|
+
return (0, react_2.render)(react_1.default.createElement(AsyncMountedComponent, { value: "test-value" }), { wrapper: withProvider ? Providers : undefined });
|
|
39
|
+
};
|
|
19
40
|
it('should mount wrapped component in sync way without AsyncMountContext.Provider', function () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
41
|
+
setUp({ withProvider: false });
|
|
42
|
+
expect(react_2.screen.getByTestId('test-value')).toBeInTheDocument();
|
|
23
43
|
});
|
|
24
44
|
it('should mount wrapped component in sync way with AsyncMountContext.Provider if value.enabled = false', function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "123" })));
|
|
28
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
45
|
+
setUp({ contextValue: { enabled: false } });
|
|
46
|
+
expect(react_2.screen.getByTestId('test-value')).toBeInTheDocument();
|
|
29
47
|
});
|
|
30
48
|
it('should mount wrapped component in async way with AsyncMountContext.Provider if value.enabled = true', function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
expect(component.find(Component).exists()).toBe(false);
|
|
35
|
-
expect(component.isEmptyRender()).toBe(true);
|
|
36
|
-
(0, test_utils_1.act)(function () {
|
|
49
|
+
setUp({ contextValue: { enabled: true } });
|
|
50
|
+
expect(react_2.screen.queryByTestId('test-value')).not.toBeInTheDocument();
|
|
51
|
+
(0, react_2.act)(function () {
|
|
37
52
|
jest.runOnlyPendingTimers();
|
|
38
53
|
});
|
|
39
|
-
|
|
40
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
41
|
-
expect(component.find(Component).prop('value')).toBe('123');
|
|
42
|
-
expect(component.isEmptyRender()).toBe(false);
|
|
54
|
+
expect(react_2.screen.getByTestId('test-value')).toBeInTheDocument();
|
|
43
55
|
});
|
|
44
56
|
it('should render PlaceholderComponent instead of Component before mounting if its passed as second argument', function () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expect(component.find(Component).exists()).toBe(false);
|
|
50
|
-
expect(component.find(Placeholder).exists()).toBe(true);
|
|
51
|
-
(0, test_utils_1.act)(function () {
|
|
57
|
+
setUp({ withPlaceholder: true });
|
|
58
|
+
expect(react_2.screen.queryByTestId('test-value')).not.toBeInTheDocument();
|
|
59
|
+
expect(react_2.screen.getByTestId('placeholder')).toBeInTheDocument();
|
|
60
|
+
(0, react_2.act)(function () {
|
|
52
61
|
jest.runOnlyPendingTimers();
|
|
53
62
|
});
|
|
54
|
-
|
|
55
|
-
expect(
|
|
56
|
-
expect(component.find(Component).prop('value')).toBe('123');
|
|
57
|
-
expect(component.find(Placeholder).exists()).toBe(false);
|
|
63
|
+
expect(react_2.screen.getByTestId('test-value')).toBeInTheDocument();
|
|
64
|
+
expect(react_2.screen.queryByTestId('placeholder')).not.toBeInTheDocument();
|
|
58
65
|
});
|
|
59
66
|
describe('queueSizeThreshold behavior', function () {
|
|
60
67
|
it('should not use context value.queueSizeThreshold by default', function () {
|
|
61
68
|
var AsyncMountedComponent = (0, withAsyncMount_1.withAsyncMount)(Component);
|
|
62
|
-
|
|
63
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "
|
|
64
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "
|
|
65
|
-
expect(
|
|
66
|
-
(0,
|
|
69
|
+
(0, react_2.render)(react_1.default.createElement(AsyncMountContext_1.AsyncMountContext.Provider, { value: { enabled: true, queueSizeThreshold: 0 } },
|
|
70
|
+
react_1.default.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
71
|
+
react_1.default.createElement(AsyncMountedComponent, { value: "test-value" })));
|
|
72
|
+
expect(react_2.screen.queryAllByTestId('test-value').length).toBe(0);
|
|
73
|
+
(0, react_2.act)(function () {
|
|
67
74
|
jest.runOnlyPendingTimers();
|
|
68
75
|
});
|
|
69
|
-
|
|
70
|
-
expect(component.find(Component).length).toBe(2);
|
|
76
|
+
expect(react_2.screen.queryAllByTestId('test-value').length).toBe(2);
|
|
71
77
|
});
|
|
72
78
|
it('should use async mount only after exceeding of "value.queueSizeThreshold" number of component mounts', function () {
|
|
73
79
|
var AsyncMountedComponent = (0, withAsyncMount_1.withAsyncMount)(Component);
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
react_1.default.createElement(
|
|
77
|
-
|
|
78
|
-
(0,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
expect(
|
|
83
|
-
|
|
84
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "123" }),
|
|
85
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "123" }),
|
|
86
|
-
react_1.default.createElement(AsyncMountedComponent, { value: "123" })));
|
|
87
|
-
expect(component.find(Component).length).toBe(2);
|
|
88
|
-
(0, test_utils_1.act)(function () {
|
|
80
|
+
var Providers = function (_a) {
|
|
81
|
+
var children = _a.children;
|
|
82
|
+
return (react_1.default.createElement(AsyncMountContext_1.AsyncMountContext.Provider, { value: { enabled: true, queueSizeThreshold: 2 } }, children));
|
|
83
|
+
};
|
|
84
|
+
(0, react_2.render)(react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
|
+
react_1.default.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
86
|
+
react_1.default.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
87
|
+
react_1.default.createElement(AsyncMountedComponent, { value: "test-value" })), { wrapper: Providers });
|
|
88
|
+
expect(react_2.screen.queryAllByTestId('test-value').length).toBe(2);
|
|
89
|
+
(0, react_2.act)(function () {
|
|
89
90
|
jest.runOnlyPendingTimers();
|
|
90
91
|
});
|
|
91
|
-
|
|
92
|
-
expect(component.find(Component).length).toBe(3);
|
|
92
|
+
expect(react_2.screen.queryAllByTestId('test-value').length).toBe(3);
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
});
|