@reltio/components 1.4.2071 → 1.4.2073
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/AttributesView/AttributesView.js +1 -1
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -3
- package/ColumnsSettings/helpers.d.ts +3 -1
- package/ColumnsSettings/types.d.ts +8 -0
- package/CommentsContainer/CommentsContainer.js +1 -1
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +23 -40
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.js +6 -26
- package/EditModeAttributesList/EditModeAttributesList.js +1 -1
- package/EditModeAttributesPager/EditModeAttributesPager.test.js +1 -1
- package/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +1 -1
- package/MetadataTypesSelector/MetadataTypesSelector.d.ts +2 -1
- package/MetadataTypesSelector/components/SelectMetadataTypesList/SelectMetadataTypesList.d.ts +5 -6
- package/MoreAttributesButton/useMoreAttributesItems.d.ts +1 -1
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +1 -1
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +1 -1
- package/ReadOnlyAttributesView/ReadOnlyAttributesView.js +1 -1
- package/ScrollableTabs/ScrollableTabs.test.js +69 -19
- package/SearchHighlighter/SearchHighlighter.test.js +18 -7
- package/SelectAttributesList/SelectAttributesList.d.ts +11 -6
- package/SelectAttributesList/SelectAttributesList.js +5 -2
- package/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +109 -60
- package/SidePanelContentHeader/SidePanelContentHeader.js +2 -2
- package/SidePanelContentHeader/SidePanelContentHeader.test.js +104 -0
- package/SidePanelEmptyState/SidePanelEmptyState.js +1 -1
- package/SidePanelEmptyState/SidePanelEmptyState.test.js +24 -0
- package/SimpleAttribute/SimpleAttribute.js +1 -1
- package/SimpleAttribute/SimpleAttribute.test.js +155 -80
- package/SimpleAttributeEditor/SimpleAttributeEditor.test.js +339 -330
- package/SimpleAttributeEditor/useAttributeValuePermissions.js +1 -1
- package/SimpleDropDownSelector/SimpleDropDownSelector.test.js +86 -10
- package/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.js +1 -1
- package/SimpleDropDownSelector/components/DropDownValue/DropDownValue.js +1 -1
- package/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +128 -32
- package/SmallIconButton/SmallIconButton.test.js +98 -25
- package/TableWithBars/TableWithBars.test.js +98 -60
- package/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.js +1 -1
- package/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.js +1 -1
- package/Tags/Tags.d.ts +0 -1
- package/Tags/Tags.test.js +8 -7
- package/TransitiveMatchBlock/TransitiveMatchBlock.test.js +78 -22
- package/TransitiveMatchRule/TransitiveMatchRule.test.js +78 -37
- package/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.js +1 -1
- package/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.test.js +12 -18
- package/UploadFileButton/UploadFileButton.d.ts +2 -2
- package/UploadFileButton/UploadFileButton.test.js +199 -0
- package/UploadImageDialog/UploadImageDialog.test.js +1 -0
- package/UploadImageDialog/components/DividerWithText/DividerWithText.js +1 -1
- package/UploadImageDialog/components/ErrorSnackbar/ErrorSnackbar.test.js +80 -22
- package/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.js +1 -1
- package/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.test.js +162 -49
- package/ValueChip/ValueChip.test.js +7 -23
- package/VirtualGroupedList/VirtualGroupedList.d.ts +19 -31
- package/VirtualGroupedList/VirtualGroupedList.js +11 -36
- package/VirtualGroupedList/VirtualGroupedList.test.js +224 -0
- package/VirtualGroupedList/helpers.d.ts +7 -2
- package/VirtualGroupedList/helpers.js +3 -1
- package/VirtualGroupedList/index.d.ts +1 -1
- package/VirtualGroupedList/types.d.ts +10 -6
- package/VirtualGroupedList/useScrollToFocusItem.d.ts +8 -5
- package/WhiteSearchInput/{WhiteSearchInput.spec.js → WhiteSearchInput.test.js} +3 -8
- package/cjs/AttributesView/AttributesView.js +2 -2
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -3
- package/cjs/ColumnsSettings/helpers.d.ts +3 -1
- package/cjs/ColumnsSettings/types.d.ts +8 -0
- package/cjs/ColumnsSettings/types.js +2 -0
- package/cjs/CommentsContainer/CommentsContainer.js +1 -1
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +23 -40
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.js +6 -26
- package/cjs/EditModeAttributesList/EditModeAttributesList.js +2 -2
- package/cjs/EditModeAttributesPager/EditModeAttributesPager.test.js +2 -2
- package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +2 -2
- package/cjs/MetadataTypesSelector/MetadataTypesSelector.d.ts +2 -1
- package/cjs/MetadataTypesSelector/components/SelectMetadataTypesList/SelectMetadataTypesList.d.ts +5 -6
- package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +1 -1
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +2 -2
- package/cjs/ReadOnlyAttributesView/ReadOnlyAttributesView.js +2 -2
- package/cjs/ScrollableTabs/ScrollableTabs.test.js +69 -19
- package/cjs/SearchHighlighter/SearchHighlighter.test.js +18 -7
- package/cjs/SelectAttributesList/SelectAttributesList.d.ts +11 -6
- package/cjs/SelectAttributesList/SelectAttributesList.js +5 -2
- package/cjs/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +109 -60
- package/cjs/SidePanelContentHeader/SidePanelContentHeader.js +2 -2
- package/cjs/SidePanelContentHeader/SidePanelContentHeader.test.js +109 -0
- package/cjs/SidePanelEmptyState/SidePanelEmptyState.js +1 -1
- package/cjs/SidePanelEmptyState/SidePanelEmptyState.test.js +29 -0
- package/cjs/SimpleAttribute/SimpleAttribute.js +1 -1
- package/cjs/SimpleAttribute/SimpleAttribute.test.js +155 -80
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.test.js +338 -352
- package/cjs/SimpleAttributeEditor/useAttributeValuePermissions.js +2 -2
- package/cjs/SimpleDropDownSelector/SimpleDropDownSelector.test.js +86 -10
- package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.js +1 -1
- package/cjs/SimpleDropDownSelector/components/DropDownValue/DropDownValue.js +1 -1
- package/cjs/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +127 -31
- package/cjs/SmallIconButton/SmallIconButton.test.js +98 -25
- package/cjs/TableWithBars/TableWithBars.test.js +98 -60
- package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.js +1 -1
- package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.js +1 -1
- package/cjs/Tags/Tags.d.ts +0 -1
- package/cjs/Tags/Tags.test.js +8 -7
- package/cjs/TransitiveMatchBlock/TransitiveMatchBlock.test.js +77 -21
- package/cjs/TransitiveMatchRule/TransitiveMatchRule.test.js +78 -37
- package/cjs/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.js +1 -1
- package/cjs/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.test.js +12 -18
- package/cjs/UploadFileButton/UploadFileButton.d.ts +2 -2
- package/cjs/UploadFileButton/UploadFileButton.test.js +204 -0
- package/cjs/UploadImageDialog/UploadImageDialog.test.js +1 -0
- package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.js +1 -1
- package/cjs/UploadImageDialog/components/ErrorSnackbar/ErrorSnackbar.test.js +80 -22
- package/cjs/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.js +1 -1
- package/cjs/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.test.js +162 -49
- package/cjs/ValueChip/ValueChip.test.js +7 -23
- package/cjs/VirtualGroupedList/VirtualGroupedList.d.ts +19 -31
- package/cjs/VirtualGroupedList/VirtualGroupedList.js +11 -36
- package/cjs/VirtualGroupedList/VirtualGroupedList.test.js +252 -0
- package/cjs/VirtualGroupedList/helpers.d.ts +7 -2
- package/cjs/VirtualGroupedList/helpers.js +3 -1
- package/cjs/VirtualGroupedList/index.d.ts +1 -1
- package/cjs/VirtualGroupedList/types.d.ts +10 -6
- package/cjs/VirtualGroupedList/useScrollToFocusItem.d.ts +8 -5
- package/cjs/WhiteSearchInput/{WhiteSearchInput.spec.js → WhiteSearchInput.test.js} +3 -8
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -0
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +5 -0
- package/cjs/features/activity-log/ActivityFilterEditor/helpers.js +2 -1
- package/cjs/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -1
- package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +16 -15
- package/cjs/features/activity-log/types.d.ts +1 -0
- package/cjs/features/activity-log/types.js +1 -0
- package/cjs/features/activity-log/utils/activities.js +1 -0
- package/cjs/features/activity-log/utils/filters.js +5 -1
- package/cjs/features/activity-log/utils/filters.test.js +4 -2
- package/cjs/features/crosswalks/hooks/useAttributeActions.test.js +24 -25
- package/cjs/features/crosswalks/hooks/useCrosswalkActions.test.js +10 -11
- package/cjs/features/history/types.d.ts +1 -0
- package/cjs/features/workflow/hooks/useChangeRequest.test.js +5 -6
- package/cjs/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.test.js +8 -9
- package/cjs/hooks/useKeyboardNavigation/useKeyboardNavigation.d.ts +9 -13
- package/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -0
- package/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +5 -0
- package/features/activity-log/ActivityFilterEditor/helpers.js +2 -1
- package/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -1
- package/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +16 -15
- package/features/activity-log/types.d.ts +1 -0
- package/features/activity-log/types.js +1 -0
- package/features/activity-log/utils/activities.js +1 -0
- package/features/activity-log/utils/filters.js +5 -1
- package/features/activity-log/utils/filters.test.js +4 -2
- package/features/crosswalks/hooks/useAttributeActions.test.js +1 -2
- package/features/crosswalks/hooks/useCrosswalkActions.test.js +1 -2
- package/features/history/types.d.ts +1 -0
- package/features/workflow/hooks/useChangeRequest.test.js +1 -2
- package/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.test.js +1 -2
- package/hooks/useKeyboardNavigation/useKeyboardNavigation.d.ts +9 -13
- package/package.json +1 -1
- package/SidePanelContentHeader/SidePanelContentHeader.spec.js +0 -49
- package/SidePanelEmptyState/SidePanelEmptyState.spec.js +0 -24
- package/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.js +0 -103
- package/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.js +0 -13
- package/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.js +0 -21
- package/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.js +0 -20
- package/UploadFileButton/UploadFileButton.spec.js +0 -219
- package/UploadImageDialog/components/DividerWithText/DividerWithText.test.js +0 -9
- package/VirtualGroupedList/VirtualGroupedList.spec.js +0 -282
- package/cjs/SidePanelContentHeader/SidePanelContentHeader.spec.js +0 -54
- package/cjs/SidePanelEmptyState/SidePanelEmptyState.spec.d.ts +0 -1
- package/cjs/SidePanelEmptyState/SidePanelEmptyState.spec.js +0 -29
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.d.ts +0 -1
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.js +0 -108
- package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.d.ts +0 -1
- package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.js +0 -18
- package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.d.ts +0 -1
- package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.js +0 -26
- package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.d.ts +0 -1
- package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.js +0 -25
- package/cjs/UploadFileButton/UploadFileButton.spec.d.ts +0 -1
- package/cjs/UploadFileButton/UploadFileButton.spec.js +0 -224
- package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.test.d.ts +0 -1
- package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.test.js +0 -14
- package/cjs/VirtualGroupedList/VirtualGroupedList.spec.d.ts +0 -1
- package/cjs/VirtualGroupedList/VirtualGroupedList.spec.js +0 -287
- package/cjs/WhiteSearchInput/WhiteSearchInput.spec.d.ts +0 -1
- /package/{SidePanelContentHeader/SidePanelContentHeader.spec.d.ts → ColumnsSettings/types.js} +0 -0
- /package/{SidePanelEmptyState/SidePanelEmptyState.spec.d.ts → SidePanelContentHeader/SidePanelContentHeader.test.d.ts} +0 -0
- /package/{SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.d.ts → SidePanelEmptyState/SidePanelEmptyState.test.d.ts} +0 -0
- /package/{SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.d.ts → UploadFileButton/UploadFileButton.test.d.ts} +0 -0
- /package/{TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.d.ts → VirtualGroupedList/VirtualGroupedList.test.d.ts} +0 -0
- /package/{TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.d.ts → WhiteSearchInput/WhiteSearchInput.test.d.ts} +0 -0
- /package/{UploadFileButton/UploadFileButton.spec.d.ts → cjs/SidePanelContentHeader/SidePanelContentHeader.test.d.ts} +0 -0
- /package/{UploadImageDialog/components/DividerWithText/DividerWithText.test.d.ts → cjs/SidePanelEmptyState/SidePanelEmptyState.test.d.ts} +0 -0
- /package/{VirtualGroupedList/VirtualGroupedList.spec.d.ts → cjs/UploadFileButton/UploadFileButton.test.d.ts} +0 -0
- /package/{WhiteSearchInput/WhiteSearchInput.spec.d.ts → cjs/VirtualGroupedList/VirtualGroupedList.test.d.ts} +0 -0
- /package/cjs/{SidePanelContentHeader/SidePanelContentHeader.spec.d.ts → WhiteSearchInput/WhiteSearchInput.test.d.ts} +0 -0
- /package/cjs/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.d.ts +0 -0
- /package/cjs/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.js +0 -0
- /package/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.d.ts +0 -0
- /package/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.js +0 -0
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
export function VirtualGroupedList({ items, getItemSize, renderItem, renderGroupTitle, width, height, fixedTitle, itemKey, disableHorizontalScrollbar, hideSubtitles, focusIndex, onInnerContainerResize }: {
|
|
2
|
-
items: any;
|
|
3
|
-
getItemSize: any;
|
|
4
|
-
renderItem: any;
|
|
5
|
-
renderGroupTitle: any;
|
|
6
|
-
width?: string;
|
|
7
|
-
height: any;
|
|
8
|
-
fixedTitle?: boolean;
|
|
9
|
-
itemKey?: (i: any) => any;
|
|
10
|
-
disableHorizontalScrollbar: any;
|
|
11
|
-
hideSubtitles: any;
|
|
12
|
-
focusIndex?: any;
|
|
13
|
-
onInnerContainerResize: any;
|
|
14
|
-
}): React.JSX.Element;
|
|
15
|
-
export namespace VirtualGroupedList {
|
|
16
|
-
namespace propTypes {
|
|
17
|
-
let items: PropTypes.Validator<object[]>;
|
|
18
|
-
let getItemSize: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
let renderItem: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
let width: PropTypes.Requireable<NonNullable<string | number>>;
|
|
21
|
-
let height: PropTypes.Validator<number>;
|
|
22
|
-
let renderGroupTitle: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
-
let fixedTitle: PropTypes.Requireable<boolean>;
|
|
24
|
-
let hideSubtitles: PropTypes.Requireable<boolean>;
|
|
25
|
-
let itemKey: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
-
let disableHorizontalScrollbar: PropTypes.Requireable<boolean>;
|
|
27
|
-
let focusIndex: PropTypes.Requireable<number>;
|
|
28
|
-
let onInnerContainerResize: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
1
|
import React from 'react';
|
|
32
|
-
import
|
|
2
|
+
import { VariableSizeList as List } from 'react-window';
|
|
3
|
+
import { OnResizeCallback } from 'react-resize-detector/build/types/types';
|
|
4
|
+
import { VirtualGroupedListItem, VirtualGroupedListMainItem, VirtualGroupedListRenderGroupTitle, VirtualGroupedListRenderItem } from './types';
|
|
5
|
+
type Props<T> = {
|
|
6
|
+
items: VirtualGroupedListMainItem<T>[];
|
|
7
|
+
getItemSize: (index: number, item: VirtualGroupedListItem<T>) => number;
|
|
8
|
+
renderItem: VirtualGroupedListRenderItem<T>;
|
|
9
|
+
renderGroupTitle?: VirtualGroupedListRenderGroupTitle<T>;
|
|
10
|
+
width?: string | number;
|
|
11
|
+
height: number;
|
|
12
|
+
fixedTitle?: boolean;
|
|
13
|
+
itemKey?: React.ComponentProps<typeof List>['itemKey'];
|
|
14
|
+
disableHorizontalScrollbar?: boolean;
|
|
15
|
+
hideSubtitles?: boolean;
|
|
16
|
+
focusIndex?: number;
|
|
17
|
+
onInnerContainerResize?: OnResizeCallback;
|
|
18
|
+
};
|
|
19
|
+
export declare const VirtualGroupedList: <Data>({ items, getItemSize, renderItem, renderGroupTitle, width, height, fixedTitle, itemKey, disableHorizontalScrollbar, hideSubtitles, focusIndex, onInnerContainerResize }: Props<Data>) => React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -37,27 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.VirtualGroupedList = void 0;
|
|
39
39
|
var react_1 = __importStar(require("react"));
|
|
40
|
-
var prop_types_1 = __importDefault(require("prop-types"));
|
|
41
40
|
var react_window_1 = require("react-window");
|
|
42
41
|
var react_resize_detector_1 = __importDefault(require("react-resize-detector"));
|
|
43
42
|
var useScrollToFocusItem_1 = require("./useScrollToFocusItem");
|
|
44
43
|
var helpers_1 = require("./helpers");
|
|
45
44
|
var styles_1 = require("./styles");
|
|
46
|
-
/*
|
|
47
|
-
items = [
|
|
48
|
-
{
|
|
49
|
-
item: {
|
|
50
|
-
item: {},
|
|
51
|
-
level: number
|
|
52
|
-
},
|
|
53
|
-
titleItemIndex: number,
|
|
54
|
-
index: number,
|
|
55
|
-
moveTo: true|false,
|
|
56
|
-
items: [...]
|
|
57
|
-
...
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
*/
|
|
61
45
|
var OVERSCAN_COUNT = 5;
|
|
62
46
|
var VirtualGroupedList = function (_a) {
|
|
63
47
|
var items = _a.items, getItemSize = _a.getItemSize, renderItem = _a.renderItem, renderGroupTitle = _a.renderGroupTitle, _b = _a.width, width = _b === void 0 ? '100%' : _b, height = _a.height, _c = _a.fixedTitle, fixedTitle = _c === void 0 ? true : _c, _d = _a.itemKey, itemKey = _d === void 0 ? function (i) { return i; } : _d, disableHorizontalScrollbar = _a.disableHorizontalScrollbar, hideSubtitles = _a.hideSubtitles, _e = _a.focusIndex, focusIndex = _e === void 0 ? null : _e, onInnerContainerResize = _a.onInnerContainerResize;
|
|
@@ -69,9 +53,12 @@ var VirtualGroupedList = function (_a) {
|
|
|
69
53
|
var stepCalcOffset = 10;
|
|
70
54
|
var stickyItemClass = 'stickyTitleItem';
|
|
71
55
|
var currentTitleParams = {
|
|
72
|
-
topMargin: 0
|
|
56
|
+
topMargin: 0,
|
|
57
|
+
index: undefined
|
|
58
|
+
};
|
|
59
|
+
var isGroupHasSubTitles = function (groupedItems) {
|
|
60
|
+
return (groupedItems || []).some(function (item) { return item.titleItemIndex !== null; });
|
|
73
61
|
};
|
|
74
|
-
var isGroupHasSubTitles = function (groupedItems) { return (groupedItems || []).some(function (item) { return item.titleItemIndex !== null; }); };
|
|
75
62
|
var hasSubTitles = (0, react_1.useMemo)(function () { return !hideSubtitles || isGroupHasSubTitles(items); }, [items, hideSubtitles]);
|
|
76
63
|
var calcOffsetsToIndex = (0, react_1.useCallback)(function (index) {
|
|
77
64
|
var curItemsLength = itemOffsets.current.length;
|
|
@@ -205,9 +192,11 @@ var VirtualGroupedList = function (_a) {
|
|
|
205
192
|
var render = (0, react_1.useCallback)(function (_a) {
|
|
206
193
|
var index = _a.index, style = _a.style, data = _a.data;
|
|
207
194
|
var listItem = getItemByIndex(index);
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
if (!listItem.item)
|
|
196
|
+
return null;
|
|
197
|
+
return (0, helpers_1.isTitleListItem)(listItem)
|
|
198
|
+
? renderGroupTitle(style, listItem.item)
|
|
199
|
+
: renderItem(style, listItem.item, index, data);
|
|
211
200
|
}, [getItemByIndex, renderGroupTitle, renderItem]);
|
|
212
201
|
var handleOnItemsRendered = (0, useScrollToFocusItem_1.useScrollToFocusItem)({ items: items, focusIndex: focusIndex, listRef: listRef }).handleOnItemsRendered;
|
|
213
202
|
var renderTitles = (0, react_1.useCallback)(function () {
|
|
@@ -215,22 +204,8 @@ var VirtualGroupedList = function (_a) {
|
|
|
215
204
|
return items.filter(function (listItem) { return (0, helpers_1.isTitleListItem)(listItem); }).map(function (listItem) { return renderTitle(listItem); });
|
|
216
205
|
}, [getItemSize, items, renderGroupTitle]);
|
|
217
206
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
218
|
-
react_1.default.createElement("div", { ref: titlesRef, className: styles.stickyTitlesWrapper }, fixedTitle && renderTitles()),
|
|
207
|
+
react_1.default.createElement("div", { ref: titlesRef, "data-reltio-id": "grouped-list-sticky-titles", className: styles.stickyTitlesWrapper }, fixedTitle && renderTitles()),
|
|
219
208
|
onInnerContainerResize && itemsRef.current && (react_1.default.createElement(react_resize_detector_1.default, { handleHeight: true, onResize: onInnerContainerResize, targetRef: itemsRef })),
|
|
220
209
|
react_1.default.createElement(react_window_1.VariableSizeList, { ref: listRef, itemCount: items.length, itemSize: _getItemSize, width: width, height: height, itemKey: itemKey, innerRef: itemsRef, onScroll: onScroll, style: disableHorizontalScrollbar ? { overflowX: 'hidden' } : undefined, overscanCount: OVERSCAN_COUNT, onItemsRendered: handleOnItemsRendered }, render)));
|
|
221
210
|
};
|
|
222
211
|
exports.VirtualGroupedList = VirtualGroupedList;
|
|
223
|
-
exports.VirtualGroupedList.propTypes = {
|
|
224
|
-
items: prop_types_1.default.arrayOf(prop_types_1.default.object).isRequired,
|
|
225
|
-
getItemSize: prop_types_1.default.func.isRequired,
|
|
226
|
-
renderItem: prop_types_1.default.func.isRequired,
|
|
227
|
-
width: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
|
|
228
|
-
height: prop_types_1.default.number.isRequired,
|
|
229
|
-
renderGroupTitle: prop_types_1.default.func,
|
|
230
|
-
fixedTitle: prop_types_1.default.bool,
|
|
231
|
-
hideSubtitles: prop_types_1.default.bool,
|
|
232
|
-
itemKey: prop_types_1.default.func,
|
|
233
|
-
disableHorizontalScrollbar: prop_types_1.default.bool,
|
|
234
|
-
focusIndex: prop_types_1.default.number,
|
|
235
|
-
onInnerContainerResize: prop_types_1.default.func
|
|
236
|
-
};
|
|
@@ -0,0 +1,252 @@
|
|
|
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
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var react_1 = __importDefault(require("react"));
|
|
41
|
+
var react_2 = require("@testing-library/react");
|
|
42
|
+
var react_window_1 = require("react-window");
|
|
43
|
+
var useScrollToFocusItemImport = __importStar(require("./useScrollToFocusItem"));
|
|
44
|
+
var helpers_1 = require("./helpers");
|
|
45
|
+
var VirtualGroupedList_1 = require("./VirtualGroupedList");
|
|
46
|
+
describe('VirtualGroupedList tests', function () {
|
|
47
|
+
var getItems = function (type) {
|
|
48
|
+
var simpleItems = [
|
|
49
|
+
{ item: { label: 'Label 1', id: 'some_id1' } },
|
|
50
|
+
{ item: { label: 'Label 2', id: 'some_id2' } },
|
|
51
|
+
{ item: { label: 'Label 3', id: 'some_id3' } }
|
|
52
|
+
];
|
|
53
|
+
var newSimpleItems = [{ item: { label: 'Label 1', id: 'some_id1' } }, { item: { label: 'Label 2', id: 'some_id2' } }];
|
|
54
|
+
var groupedItems = [
|
|
55
|
+
{
|
|
56
|
+
item: { label: 'Label 1', id: 'some_id1' },
|
|
57
|
+
items: [
|
|
58
|
+
{ item: { label: 'Label 1.1', id: 'some_id1.1' } },
|
|
59
|
+
{ item: { label: 'Label 1.2', id: 'some_id1.2' } },
|
|
60
|
+
{ item: { label: 'Label 1.3', id: 'some_id1.3' } }
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
item: { label: 'Label 2', id: 'some_id2' },
|
|
65
|
+
items: [
|
|
66
|
+
{ item: { label: 'Label 2.1', id: 'some_id2.1' } },
|
|
67
|
+
{ item: { label: 'Label 2.2', id: 'some_id2.2' }, moveTo: false }
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
switch (type) {
|
|
72
|
+
case 'grouped':
|
|
73
|
+
return (0, helpers_1.flattenGroupedItemsData)(groupedItems);
|
|
74
|
+
case 'groupedWithMove': {
|
|
75
|
+
groupedItems[1].items[1].moveTo = true;
|
|
76
|
+
return (0, helpers_1.flattenGroupedItemsData)(groupedItems);
|
|
77
|
+
}
|
|
78
|
+
case 'newSimpleItems': {
|
|
79
|
+
return (0, helpers_1.flattenGroupedItemsData)(newSimpleItems);
|
|
80
|
+
}
|
|
81
|
+
case 'simple':
|
|
82
|
+
default:
|
|
83
|
+
return (0, helpers_1.flattenGroupedItemsData)(simpleItems);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var renderItem = function (style, _a) {
|
|
87
|
+
var item = _a.item;
|
|
88
|
+
return (react_1.default.createElement("div", { style: style, "data-reltio-id": "grouped-list-item" }, item.label));
|
|
89
|
+
};
|
|
90
|
+
var defaultProps = {
|
|
91
|
+
getItemSize: function () { return 50; },
|
|
92
|
+
renderItem: renderItem,
|
|
93
|
+
renderGroupTitle: renderItem,
|
|
94
|
+
items: getItems('simple'),
|
|
95
|
+
height: 500
|
|
96
|
+
};
|
|
97
|
+
var setUp = function (props) {
|
|
98
|
+
if (props === void 0) { props = {}; }
|
|
99
|
+
return (0, react_2.render)(react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, __assign({}, defaultProps, props)));
|
|
100
|
+
};
|
|
101
|
+
afterEach(function () {
|
|
102
|
+
jest.restoreAllMocks();
|
|
103
|
+
});
|
|
104
|
+
it('should correct render simple items', function () {
|
|
105
|
+
setUp({ items: getItems('simple') });
|
|
106
|
+
expect(react_2.screen.getByText('Label 1')).toBeInTheDocument();
|
|
107
|
+
expect(react_2.screen.getByText('Label 2')).toBeInTheDocument();
|
|
108
|
+
expect(react_2.screen.getByText('Label 3')).toBeInTheDocument();
|
|
109
|
+
});
|
|
110
|
+
it('should correct render grouped items', function () {
|
|
111
|
+
setUp({ items: getItems('grouped') });
|
|
112
|
+
var stickyTitles = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
113
|
+
expect(stickyTitles.childNodes).toHaveLength(2);
|
|
114
|
+
expect((0, react_2.within)(stickyTitles).getByText('Label 1')).toHaveStyle('visibility: visible');
|
|
115
|
+
expect((0, react_2.within)(stickyTitles).getByText('Label 2')).toHaveStyle('visibility: hidden');
|
|
116
|
+
var items = react_2.screen.getAllByTestId('grouped-list-item');
|
|
117
|
+
expect(items).toHaveLength(9);
|
|
118
|
+
expect(items.map(function (item) { return item.textContent; })).toEqual([
|
|
119
|
+
'Label 1',
|
|
120
|
+
'Label 2',
|
|
121
|
+
'Label 1',
|
|
122
|
+
'Label 1.1',
|
|
123
|
+
'Label 1.2',
|
|
124
|
+
'Label 1.3',
|
|
125
|
+
'Label 2',
|
|
126
|
+
'Label 2.1',
|
|
127
|
+
'Label 2.2'
|
|
128
|
+
]);
|
|
129
|
+
});
|
|
130
|
+
it('should set sticky titles width if items width changed', function () {
|
|
131
|
+
var _a = setUp({ items: getItems('grouped') }), container = _a.container, rerender = _a.rerender;
|
|
132
|
+
var stickyTitles = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
133
|
+
Object.defineProperties(container.childNodes[1].firstChild, {
|
|
134
|
+
offsetWidth: {
|
|
135
|
+
get: function () {
|
|
136
|
+
return 200;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
rerender(react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, __assign({}, defaultProps, { items: getItems('grouped'), height: 100 })));
|
|
141
|
+
expect(stickyTitles).toHaveStyle('width: 200px');
|
|
142
|
+
});
|
|
143
|
+
it('should not render fixed group title when fixedTitle is false', function () {
|
|
144
|
+
setUp({ items: getItems('grouped'), fixedTitle: false });
|
|
145
|
+
var stickyTitles = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
146
|
+
expect(stickyTitles.childNodes).toHaveLength(0);
|
|
147
|
+
});
|
|
148
|
+
it('should clear index when items is updated', function () {
|
|
149
|
+
var useScrollToFocusItemSpy = jest.spyOn(useScrollToFocusItemImport, 'useScrollToFocusItem');
|
|
150
|
+
var rerender = setUp({ items: getItems('simple') }).rerender;
|
|
151
|
+
var listRef = useScrollToFocusItemSpy.mock.calls[0][0].listRef;
|
|
152
|
+
var resetAfterIndexSpy = jest.spyOn(listRef.current, 'resetAfterIndex');
|
|
153
|
+
rerender(react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, __assign({}, defaultProps, { items: getItems('simple') })));
|
|
154
|
+
expect(resetAfterIndexSpy).toHaveBeenCalledWith(0);
|
|
155
|
+
});
|
|
156
|
+
describe('Scroll behavior', function () {
|
|
157
|
+
var setHeightForNode = function (node, height, scrollHeight) {
|
|
158
|
+
Object.defineProperties(node, {
|
|
159
|
+
clientHeight: {
|
|
160
|
+
get: function () { return height; },
|
|
161
|
+
configurable: true
|
|
162
|
+
},
|
|
163
|
+
scrollHeight: {
|
|
164
|
+
get: function () { return scrollHeight; },
|
|
165
|
+
configurable: true
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
/*
|
|
170
|
+
Some scroll offsets for grouped items(getItems('grouped')):
|
|
171
|
+
First title offset: 0
|
|
172
|
+
First title will be showing in offset range: 0-199
|
|
173
|
+
Second title offset: 200
|
|
174
|
+
Second title will be showing in offset range: 200+
|
|
175
|
+
Offset range when titles is touching each other: 150-200
|
|
176
|
+
*/
|
|
177
|
+
it('should scroll to moveTo item', function () {
|
|
178
|
+
var requestAnimationFrameMock = jest
|
|
179
|
+
.spyOn(window, 'requestAnimationFrame')
|
|
180
|
+
.mockImplementation(function (callback) {
|
|
181
|
+
callback(0);
|
|
182
|
+
return 0;
|
|
183
|
+
});
|
|
184
|
+
var scrollToSpy = jest.spyOn(react_window_1.VariableSizeList.prototype, 'scrollTo').mockImplementation(function () { return null; });
|
|
185
|
+
var rerender = setUp({ items: getItems('grouped'), height: 150 }).rerender;
|
|
186
|
+
rerender(react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, __assign({}, defaultProps, { items: getItems('groupedWithMove'), height: 150 })));
|
|
187
|
+
expect(scrollToSpy).toHaveBeenCalledTimes(2);
|
|
188
|
+
expect(scrollToSpy).toHaveBeenCalledWith(200);
|
|
189
|
+
requestAnimationFrameMock.mockRestore();
|
|
190
|
+
});
|
|
191
|
+
it('should scroll to top of item', function () {
|
|
192
|
+
var scrollToSpy = jest.spyOn(react_window_1.VariableSizeList.prototype, 'scrollTo').mockImplementation(function () { return null; });
|
|
193
|
+
var rerender = setUp({ items: getItems('grouped'), height: 150 }).rerender;
|
|
194
|
+
var requestAnimationFrameMock = jest
|
|
195
|
+
.spyOn(window, 'requestAnimationFrame')
|
|
196
|
+
.mockImplementation(function (callback) {
|
|
197
|
+
callback(0);
|
|
198
|
+
return 0;
|
|
199
|
+
});
|
|
200
|
+
rerender(react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, __assign({}, defaultProps, { items: getItems('newSimpleItems'), height: 150 })));
|
|
201
|
+
expect(scrollToSpy).toHaveBeenCalledTimes(1);
|
|
202
|
+
expect(scrollToSpy).toHaveBeenCalledWith(0);
|
|
203
|
+
requestAnimationFrameMock.mockRestore();
|
|
204
|
+
});
|
|
205
|
+
it('should change fixed title on forward scroll', function () {
|
|
206
|
+
var container = setUp({ items: getItems('grouped'), height: 150 }).container;
|
|
207
|
+
var titlesContainer = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
208
|
+
var titles = (0, react_2.within)(titlesContainer).getAllByTestId('grouped-list-item');
|
|
209
|
+
setHeightForNode(container.childNodes[1], 150, 400);
|
|
210
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 210 } });
|
|
211
|
+
expect(titles).toHaveLength(2);
|
|
212
|
+
expect(titlesContainer).toHaveStyle('top: 0px');
|
|
213
|
+
expect(titles[0]).toHaveStyle('visibility: hidden');
|
|
214
|
+
expect(titles[1]).toHaveStyle('visibility: visible');
|
|
215
|
+
});
|
|
216
|
+
it('should move current fixed title on forward scroll when next title start touching the current title', function () {
|
|
217
|
+
var container = setUp({ items: getItems('grouped'), height: 150 }).container;
|
|
218
|
+
var titlesContainer = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
219
|
+
var titles = (0, react_2.within)(titlesContainer).getAllByTestId('grouped-list-item');
|
|
220
|
+
setHeightForNode(container.childNodes[1], 150, 400);
|
|
221
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 151 } });
|
|
222
|
+
expect(titles).toHaveLength(2);
|
|
223
|
+
expect(titlesContainer).toHaveStyle('top: -1px');
|
|
224
|
+
expect(titles[0]).toHaveStyle('visibility: visible');
|
|
225
|
+
expect(titles[1]).toHaveStyle('visibility: hidden');
|
|
226
|
+
});
|
|
227
|
+
it('should change fixed title on backward scroll', function () {
|
|
228
|
+
var container = setUp({ items: getItems('grouped'), height: 150 }).container;
|
|
229
|
+
var titlesContainer = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
230
|
+
var titles = (0, react_2.within)(titlesContainer).getAllByTestId('grouped-list-item');
|
|
231
|
+
setHeightForNode(container.childNodes[1], 150, 400);
|
|
232
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 210 } });
|
|
233
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 140 } });
|
|
234
|
+
expect(titles).toHaveLength(2);
|
|
235
|
+
expect(titlesContainer).toHaveStyle('top: 0px');
|
|
236
|
+
expect(titles[0]).toHaveStyle('visibility: visible');
|
|
237
|
+
expect(titles[1]).toHaveStyle('visibility: hidden');
|
|
238
|
+
});
|
|
239
|
+
it('should move current fixed title on backward scroll when previous title start touching the current title', function () {
|
|
240
|
+
var container = setUp({ items: getItems('grouped'), height: 150 }).container;
|
|
241
|
+
var titlesContainer = react_2.screen.getByTestId('grouped-list-sticky-titles');
|
|
242
|
+
var titles = (0, react_2.within)(titlesContainer).getAllByTestId('grouped-list-item');
|
|
243
|
+
setHeightForNode(container.childNodes[1], 150, 400);
|
|
244
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 210 } });
|
|
245
|
+
react_2.fireEvent.scroll(container.childNodes[1], { target: { scrollTop: 199 } });
|
|
246
|
+
expect(titles).toHaveLength(2);
|
|
247
|
+
expect(titlesContainer).toHaveStyle('top: -49px');
|
|
248
|
+
expect(titles[0]).toHaveStyle('visibility: visible');
|
|
249
|
+
expect(titles[1]).toHaveStyle('visibility: hidden');
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
});
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { VirtualGroupedListItem, VirtualGroupedListMainItem } from './types';
|
|
2
|
+
export type GroupedItem<T> = {
|
|
3
|
+
item: T;
|
|
4
|
+
items?: GroupedItem<T>[];
|
|
5
|
+
};
|
|
6
|
+
export declare const flattenGroupedItemsData: <T>(groupedItems: VirtualGroupedListItem<T>[]) => VirtualGroupedListMainItem<T>[];
|
|
7
|
+
export declare const isTitleListItem: <T>(listItem: VirtualGroupedListMainItem<T>) => boolean;
|
|
@@ -16,5 +16,7 @@ var flattenGroupedItemsData = function (groupedItems) {
|
|
|
16
16
|
return items;
|
|
17
17
|
};
|
|
18
18
|
exports.flattenGroupedItemsData = flattenGroupedItemsData;
|
|
19
|
-
var isTitleListItem = function (listItem) {
|
|
19
|
+
var isTitleListItem = function (listItem) {
|
|
20
|
+
return listItem.titleItemIndex === listItem.index;
|
|
21
|
+
};
|
|
20
22
|
exports.isTitleListItem = isTitleListItem;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { VirtualGroupedList } from './VirtualGroupedList';
|
|
2
|
-
export type {
|
|
2
|
+
export type { VirtualGroupedListItem, VirtualGroupedListMainItem, VirtualGroupedListRenderGroupTitle, VirtualGroupedListRenderItem } from './types';
|
|
3
3
|
export { isTitleListItem, flattenGroupedItemsData } from './helpers';
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export type
|
|
2
|
-
item:
|
|
3
|
-
|
|
1
|
+
export type VirtualGroupedListItem<T, E = Record<string, unknown>> = E & {
|
|
2
|
+
item: T;
|
|
3
|
+
level?: number;
|
|
4
|
+
moveTo?: boolean;
|
|
5
|
+
items?: VirtualGroupedListItem<T, E>[];
|
|
4
6
|
};
|
|
5
|
-
export type
|
|
6
|
-
item:
|
|
7
|
+
export type VirtualGroupedListMainItem<T, E = Record<string, unknown>> = E & {
|
|
8
|
+
item: VirtualGroupedListItem<T, E>;
|
|
7
9
|
titleItemIndex?: number;
|
|
8
10
|
index: number;
|
|
9
|
-
|
|
11
|
+
moveTo?: boolean;
|
|
10
12
|
};
|
|
13
|
+
export type VirtualGroupedListRenderItem<T, E = Record<string, unknown>> = (style: React.CSSProperties, item: VirtualGroupedListItem<T, E>, index: number, data: VirtualGroupedListMainItem<T, E>) => React.ReactElement;
|
|
14
|
+
export type VirtualGroupedListRenderGroupTitle<T, E = Record<string, unknown>> = (style: React.CSSProperties, item: VirtualGroupedListItem<T, E>) => React.ReactElement;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { VariableSizeList } from 'react-window';
|
|
2
|
+
type Props<T> = {
|
|
3
|
+
focusIndex: number;
|
|
4
|
+
listRef: React.MutableRefObject<VariableSizeList>;
|
|
5
|
+
items: T[];
|
|
6
|
+
};
|
|
7
|
+
export declare const useScrollToFocusItem: <T>({ focusIndex, listRef, items }: Props<T>) => {
|
|
6
8
|
handleOnItemsRendered: ({ visibleStartIndex, visibleStopIndex }: any) => void;
|
|
7
9
|
};
|
|
10
|
+
export {};
|
|
@@ -15,8 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var
|
|
19
|
-
var SearchInput_1 = require("../SearchInput");
|
|
18
|
+
var react_2 = require("@testing-library/react");
|
|
20
19
|
var WhiteSearchInput_1 = require("./WhiteSearchInput");
|
|
21
20
|
describe('WhiteSearchInput tests', function () {
|
|
22
21
|
var defaultProps = {
|
|
@@ -26,11 +25,7 @@ describe('WhiteSearchInput tests', function () {
|
|
|
26
25
|
height: 40
|
|
27
26
|
};
|
|
28
27
|
it('should render SearchInput with specified focused class', function () {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
expect(searchInput).toHaveLength(1);
|
|
32
|
-
expect(searchInput.prop('classes')).toMatchObject({
|
|
33
|
-
focused: 'white'
|
|
34
|
-
});
|
|
28
|
+
(0, react_2.render)(react_1.default.createElement(WhiteSearchInput_1.WhiteSearchInput, __assign({}, defaultProps)));
|
|
29
|
+
expect(react_2.screen.getByRole('textbox').parentElement).toHaveClass('white');
|
|
35
30
|
});
|
|
36
31
|
});
|
|
@@ -69,6 +69,7 @@ var ActivitiesFactory = /** @class */ (function () {
|
|
|
69
69
|
case types_1.ActivityTypes.MODEL_UPDATED:
|
|
70
70
|
case types_1.ActivityTypes.PERIODIC_TASK_SCHEDULED:
|
|
71
71
|
case types_1.ActivityTypes.USER_PROFILE_VIEW:
|
|
72
|
+
case types_1.ActivityTypes.ATTRIBUTE_UNMASKED:
|
|
72
73
|
return react_1.default.createElement(SimpleActivity_1.SimpleActivity, { data: data, type: type });
|
|
73
74
|
case types_1.ActivityTypes.SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE:
|
|
74
75
|
return react_1.default.createElement(SynchronizationIssuesActivity_1.SynchronizationIssuesActivity, { data: data, type: type });
|
|
@@ -231,6 +231,11 @@ describe('Activities factory tests', function () {
|
|
|
231
231
|
setUp({ props: props });
|
|
232
232
|
react_2.screen.getByTestId('simple-activity');
|
|
233
233
|
});
|
|
234
|
+
it('should render simple activity for ATTRIBUTE_UNMASKED activity type', function () {
|
|
235
|
+
var props = { data: defaultData, type: types_1.ActivityTypes.ATTRIBUTE_UNMASKED };
|
|
236
|
+
setUp({ props: props });
|
|
237
|
+
react_2.screen.getByTestId('simple-activity');
|
|
238
|
+
});
|
|
234
239
|
});
|
|
235
240
|
describe('synchronization issues activity', function () {
|
|
236
241
|
it('should render synchronization issues activity for SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE activity type', function () {
|
|
@@ -17,7 +17,8 @@ var profileRelatedActivityTypes = [
|
|
|
17
17
|
types_1.ActivityTypes.NOT_MATCHES_SET,
|
|
18
18
|
types_1.ActivityTypes.NOT_MATCHES_RESET,
|
|
19
19
|
types_1.ActivityTypes.ENTITIES_MERGED_MANUALLY,
|
|
20
|
-
types_1.ActivityTypes.ENTITIES_MERGED_ON_THE_FLY
|
|
20
|
+
types_1.ActivityTypes.ENTITIES_MERGED_ON_THE_FLY,
|
|
21
|
+
types_1.ActivityTypes.ATTRIBUTE_UNMASKED
|
|
21
22
|
];
|
|
22
23
|
var groupRelatedActivityTypes = [
|
|
23
24
|
types_1.ActivityTypes.GROUP_CREATED,
|
|
@@ -37,6 +37,7 @@ var otherTypes = [
|
|
|
37
37
|
'COMMENT_UPDATED',
|
|
38
38
|
'COMMENT_DELETED',
|
|
39
39
|
'ANALYTICS_ATTRIBUTES_CHANGED',
|
|
40
|
+
'ATTRIBUTE_UNMASKED',
|
|
40
41
|
'SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE'
|
|
41
42
|
];
|
|
42
43
|
var profileTypes = [
|
|
@@ -53,7 +54,8 @@ var profileTypes = [
|
|
|
53
54
|
'NOT_MATCHES_SET',
|
|
54
55
|
'NOT_MATCHES_RESET',
|
|
55
56
|
'ENTITIES_MERGED_MANUALLY',
|
|
56
|
-
'ENTITIES_MERGED_ON_THE_FLY'
|
|
57
|
+
'ENTITIES_MERGED_ON_THE_FLY',
|
|
58
|
+
'ATTRIBUTE_UNMASKED'
|
|
57
59
|
];
|
|
58
60
|
describe('helpers tests', function () {
|
|
59
61
|
describe('getSelectorActivityTypes tests', function () {
|
|
@@ -364,21 +364,22 @@ describe('Activity log filter tests', function () {
|
|
|
364
364
|
case 2:
|
|
365
365
|
_a.sent();
|
|
366
366
|
options = react_2.screen.getAllByRole('option');
|
|
367
|
-
expect(options).toHaveLength(
|
|
368
|
-
expect(options[0]).toHaveTextContent('
|
|
369
|
-
expect(options[1]).toHaveTextContent('Not matches
|
|
370
|
-
expect(options[2]).toHaveTextContent('
|
|
371
|
-
expect(options[3]).toHaveTextContent('Potential matches
|
|
372
|
-
expect(options[4]).toHaveTextContent('
|
|
373
|
-
expect(options[5]).toHaveTextContent('Profile
|
|
374
|
-
expect(options[6]).toHaveTextContent('Profile
|
|
375
|
-
expect(options[7]).toHaveTextContent('Profile merged
|
|
376
|
-
expect(options[8]).toHaveTextContent('Profile merged
|
|
377
|
-
expect(options[9]).toHaveTextContent('Profile
|
|
378
|
-
expect(options[10]).toHaveTextContent('Profile
|
|
379
|
-
expect(options[11]).toHaveTextContent('
|
|
380
|
-
expect(options[12]).toHaveTextContent('Relationship
|
|
381
|
-
expect(options[13]).toHaveTextContent('Relationship
|
|
367
|
+
expect(options).toHaveLength(15);
|
|
368
|
+
expect(options[0]).toHaveTextContent('Attribute unmasked');
|
|
369
|
+
expect(options[1]).toHaveTextContent('Not matches reset');
|
|
370
|
+
expect(options[2]).toHaveTextContent('Not matches set');
|
|
371
|
+
expect(options[3]).toHaveTextContent('Potential matches found');
|
|
372
|
+
expect(options[4]).toHaveTextContent('Potential matches removed');
|
|
373
|
+
expect(options[5]).toHaveTextContent('Profile created');
|
|
374
|
+
expect(options[6]).toHaveTextContent('Profile lost merge');
|
|
375
|
+
expect(options[7]).toHaveTextContent('Profile merged');
|
|
376
|
+
expect(options[8]).toHaveTextContent('Profile merged manually');
|
|
377
|
+
expect(options[9]).toHaveTextContent('Profile merged on the fly');
|
|
378
|
+
expect(options[10]).toHaveTextContent('Profile un-merged');
|
|
379
|
+
expect(options[11]).toHaveTextContent('Profile updated');
|
|
380
|
+
expect(options[12]).toHaveTextContent('Relationship created');
|
|
381
|
+
expect(options[13]).toHaveTextContent('Relationship removed');
|
|
382
|
+
expect(options[14]).toHaveTextContent('Relationship updated');
|
|
382
383
|
return [4 /*yield*/, user.click(react_2.screen.getByText('Potential matches found'))];
|
|
383
384
|
case 3:
|
|
384
385
|
_a.sent();
|
|
@@ -26,6 +26,7 @@ export declare enum ActivityTypes {
|
|
|
26
26
|
COMMENT_UPDATED = "COMMENT_UPDATED",
|
|
27
27
|
COMMENT_DELETED = "COMMENT_DELETED",
|
|
28
28
|
ANALYTICS_ATTRIBUTES_CHANGED = "ANALYTICS_ATTRIBUTES_CHANGED",
|
|
29
|
+
ATTRIBUTE_UNMASKED = "ATTRIBUTE_UNMASKED",
|
|
29
30
|
SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE = "SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE",
|
|
30
31
|
GROUP_CREATED = "GROUP_CREATED",
|
|
31
32
|
GROUP_REMOVED = "GROUP_REMOVED",
|
|
@@ -28,6 +28,7 @@ var ActivityTypes;
|
|
|
28
28
|
ActivityTypes["COMMENT_UPDATED"] = "COMMENT_UPDATED";
|
|
29
29
|
ActivityTypes["COMMENT_DELETED"] = "COMMENT_DELETED";
|
|
30
30
|
ActivityTypes["ANALYTICS_ATTRIBUTES_CHANGED"] = "ANALYTICS_ATTRIBUTES_CHANGED";
|
|
31
|
+
ActivityTypes["ATTRIBUTE_UNMASKED"] = "ATTRIBUTE_UNMASKED";
|
|
31
32
|
ActivityTypes["SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE"] = "SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE";
|
|
32
33
|
ActivityTypes["GROUP_CREATED"] = "GROUP_CREATED";
|
|
33
34
|
ActivityTypes["GROUP_REMOVED"] = "GROUP_REMOVED";
|
|
@@ -94,6 +94,7 @@ var getActivityLabel = function (type) {
|
|
|
94
94
|
_a[types_1.ActivityTypes.USER_LOGIN] = ui_i18n_1.default.text('Logged in'),
|
|
95
95
|
_a[types_1.ActivityTypes.USER_LOGOUT] = ui_i18n_1.default.text('Logged out'),
|
|
96
96
|
_a[types_1.ActivityTypes.USER_PROFILE_VIEW] = ui_i18n_1.default.text('Profile viewed'),
|
|
97
|
+
_a[types_1.ActivityTypes.ATTRIBUTE_UNMASKED] = ui_i18n_1.default.text('Attribute unmasked'),
|
|
97
98
|
_a[types_1.ActivityTypes.USER_SEARCH] = ui_i18n_1.default.text('Searched'),
|
|
98
99
|
_a[types_1.ActivityTypes.ANALYTICS_ATTRIBUTES_CHANGED] = ui_i18n_1.default.text('Analytics attribute changed'),
|
|
99
100
|
_a[types_1.ActivityTypes.SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE] = ui_i18n_1.default.text('SFDC connector synchronization issue'),
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildActivitiesFilterString = void 0;
|
|
4
4
|
var ramda_1 = require("ramda");
|
|
5
|
+
var types_1 = require("../types");
|
|
5
6
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
6
7
|
var buildActivityFilterClause = function (activityType) {
|
|
7
|
-
if (activityType.startsWith('USER_') ||
|
|
8
|
+
if (activityType.startsWith('USER_') ||
|
|
9
|
+
activityType.startsWith('COMMENT_') ||
|
|
10
|
+
activityType.startsWith('SFDC_') ||
|
|
11
|
+
activityType === types_1.ActivityTypes.ATTRIBUTE_UNMASKED) {
|
|
8
12
|
return "startsWith(label, '".concat(activityType, "')");
|
|
9
13
|
}
|
|
10
14
|
else {
|
|
@@ -33,13 +33,15 @@ describe('filter utils tests', function () {
|
|
|
33
33
|
types_1.ActivityTypes.USER_SEARCH,
|
|
34
34
|
types_1.ActivityTypes.COMMENT_ADDED,
|
|
35
35
|
types_1.ActivityTypes.SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE,
|
|
36
|
-
types_1.ActivityTypes.ENTITY_CHANGED
|
|
36
|
+
types_1.ActivityTypes.ENTITY_CHANGED,
|
|
37
|
+
types_1.ActivityTypes.ATTRIBUTE_UNMASKED
|
|
37
38
|
]
|
|
38
39
|
};
|
|
39
40
|
var expectedResult = "(startsWith(label, 'USER_SEARCH')" +
|
|
40
41
|
" or startsWith(label, 'COMMENT_ADDED')" +
|
|
41
42
|
" or startsWith(label, 'SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE')" +
|
|
42
|
-
' or equals(items.data.type, ENTITY_CHANGED)
|
|
43
|
+
' or equals(items.data.type, ENTITY_CHANGED)' +
|
|
44
|
+
" or startsWith(label, 'ATTRIBUTE_UNMASKED'))" +
|
|
43
45
|
" and (not equals(user, 'collaboration-service'))";
|
|
44
46
|
expect((0, filters_1.buildActivitiesFilterString)(filter)).toEqual(expectedResult);
|
|
45
47
|
});
|