@reltio/components 1.4.1989 → 1.4.1991
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/cjs/ActionsPanel/ActionsPanel.test.js +1 -1
- package/cjs/ActionsPanel/types.d.ts +2 -1
- package/cjs/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.js +1 -1
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.js +3 -3
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +2 -2
- package/cjs/AutoSizeList/AutoSizeList.js +6 -6
- package/cjs/BooleanRadioEditor/BooleanRadioEditor.test.js +2 -2
- package/cjs/DependentLookupEditor/DependentLookupEditor.d.ts +1 -3
- package/cjs/DependentLookupEditor/DependentLookupEditor.js +4 -2
- package/cjs/DependentLookupEditor/DependentLookupEditor.test.js +1 -1
- package/cjs/DependentLookupEditor/IntegrationDependentLookupEditor.test.d.ts +1 -0
- package/cjs/DependentLookupEditor/IntegrationDependentLookupEditor.test.js +142 -0
- package/cjs/DropDownMenuButton/DropDownMenuButton.d.ts +1 -1
- package/cjs/DropDownMenuButton/DropDownMenuButton.js +6 -1
- package/cjs/DropDownSelector/DropDownSelector.test.js +0 -5
- package/cjs/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +1 -1
- package/cjs/EditModeAttributesList/EditModeAttributesList.test.js +1 -6
- package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.js +2 -0
- package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.test.js +2 -6
- package/cjs/EmptyState/EmptyState.test.js +1 -1
- package/cjs/EntitySelector/EntitySelector.test.js +237 -113
- package/cjs/ErrorBoundary/ErrorBoundary.test.js +2 -2
- package/cjs/HOCs/withFilter/components/ColumnFilter/ColumnFilter.js +6 -1
- package/cjs/ImageAttributesLine/types.d.ts +2 -1
- package/cjs/ImageDetailsView/helpers.test.js +0 -5
- package/cjs/ImportButton/ImportButton.test.js +1 -1
- package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +1 -1
- package/cjs/MapChart/MapChart.js +1 -0
- package/cjs/Marginator/Marginator.d.ts +1 -1
- package/cjs/MultiSelect/MultiSelect.js +1 -1
- package/cjs/MultipliableSelect/MultipliableSelect.js +1 -3
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +1 -1
- package/cjs/ProfileBand/ProfileBand.js +1 -1
- package/cjs/ProfilesList/ProfilesList.spec.js +1 -2
- package/cjs/RCTree/RCTree.d.ts +2 -2
- package/cjs/RCTree/RCTree.js +0 -3
- package/cjs/ReactSortableTree/ReactSortableTree.js +2 -2
- package/cjs/ReactSortableTree/components/NodeRendererDefault/NodeRendererDefault.js +1 -3
- package/cjs/ReactSortableTree/components/TreeNode/TreeNode.js +1 -3
- package/cjs/ReactSortableTree/components/TreePlaceholder/TreePlaceholder.js +0 -1
- package/cjs/ReactSortableTree/helpers/generic.js +0 -1
- package/cjs/ReactSortableTree/helpers/tree.js +1 -1
- package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +2 -2
- package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +2 -2
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +1 -6
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +3 -3
- package/cjs/RelationEditor/IntegrationRelationEditor.test.js +1 -1
- package/cjs/ReltioMap/ReltioMap.d.ts +1 -1
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.test.js +0 -1
- package/cjs/TableSkeleton/TableSkeleton.d.ts +1 -1
- package/cjs/TenantLabel/TenantLabel.spec.js +3 -3
- package/cjs/VirtualGroupedList/VirtualGroupedList.js +14 -5
- package/cjs/VirtualGroupedList/VirtualGroupedList.spec.js +2 -2
- package/cjs/VirtualGroupedList/useScrollToFocusItem.test.js +2 -2
- package/cjs/features/activity-log/utils/filters.test.js +1 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +8 -2
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +2 -2
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.js +6 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +0 -3
- package/cjs/features/crosswalks/AttributesTable/types.d.ts +2 -1
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +1 -1
- package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +1 -1
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +4 -5
- package/cjs/features/history/HistoryFilterButton/HistoryFilterButton.js +6 -3
- package/cjs/features/history/hooks/useHistoryTree.js +6 -3
- package/cjs/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +2 -2
- package/cjs/features/workflow/AssigneeSelector/AssigneeSelector.spec.js +1 -1
- package/cjs/features/workflow/WorkflowTaskCard/WorkflowTaskCard.test.js +8 -8
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +0 -1
- package/cjs/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +2 -2
- package/cjs/features/workflow/hooks/useWorkflowAssignee.js +2 -1
- package/cjs/helpers/customScript.test.js +8 -8
- package/cjs/hooks/useKeyboardNavigation/useKeyboardNavigation.js +5 -3
- package/cjs/hooks/useMarkAsNotMatchRequest/useMarkAsNotMatchRequest.js +2 -1
- package/cjs/hooks/useMatchesColumnsData/helpers.js +3 -4
- package/cjs/hooks/useMergeAllRequest/useMergeAllRequest.js +2 -1
- package/cjs/hooks/usePagingSimulator/helpers.js +0 -1
- package/cjs/hooks/useSavedSearchesRequest/useSavedSearchesRequest.js +7 -2
- package/cjs/icons/AIPowered.d.ts +1 -2
- package/cjs/test-utils/TestStylesProvider.js +1 -2
- package/cjs/types/basicTable.d.ts +2 -2
- package/cjs/types/index.d.ts +1 -1
- package/esm/ActionsPanel/ActionsPanel.test.js +1 -1
- package/esm/ActionsPanel/types.d.ts +2 -1
- package/esm/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.js +1 -1
- package/esm/AttributesFiltersButton/AttributesFiltersButton.js +3 -3
- package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +2 -2
- package/esm/AutoSizeList/AutoSizeList.js +6 -6
- package/esm/BooleanRadioEditor/BooleanRadioEditor.test.js +2 -2
- package/esm/DependentLookupEditor/DependentLookupEditor.d.ts +1 -3
- package/esm/DependentLookupEditor/DependentLookupEditor.js +4 -2
- package/esm/DependentLookupEditor/DependentLookupEditor.test.js +1 -1
- package/esm/DependentLookupEditor/IntegrationDependentLookupEditor.test.d.ts +1 -0
- package/esm/DependentLookupEditor/IntegrationDependentLookupEditor.test.js +137 -0
- package/esm/DropDownMenuButton/DropDownMenuButton.d.ts +1 -1
- package/esm/DropDownMenuButton/DropDownMenuButton.js +6 -1
- package/esm/DropDownSelector/DropDownSelector.test.js +0 -5
- package/esm/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +1 -1
- package/esm/EditModeAttributesList/EditModeAttributesList.test.js +1 -6
- package/esm/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.js +2 -0
- package/esm/EditModeComplexAttribute/EditModeComplexAttribute.test.js +2 -6
- package/esm/EmptyState/EmptyState.test.js +1 -1
- package/esm/EntitySelector/EntitySelector.test.js +237 -113
- package/esm/ErrorBoundary/ErrorBoundary.test.js +2 -2
- package/esm/HOCs/withFilter/components/ColumnFilter/ColumnFilter.js +6 -1
- package/esm/ImageAttributesLine/types.d.ts +2 -1
- package/esm/ImageDetailsView/helpers.test.js +0 -5
- package/esm/ImportButton/ImportButton.test.js +1 -1
- package/esm/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +1 -1
- package/esm/MapChart/MapChart.js +1 -0
- package/esm/Marginator/Marginator.d.ts +1 -1
- package/esm/MultiSelect/MultiSelect.js +1 -1
- package/esm/MultipliableSelect/MultipliableSelect.js +1 -3
- package/esm/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +1 -1
- package/esm/ProfileBand/ProfileBand.js +1 -1
- package/esm/ProfilesList/ProfilesList.spec.js +1 -2
- package/esm/RCTree/RCTree.d.ts +2 -2
- package/esm/RCTree/RCTree.js +0 -3
- package/esm/ReactSortableTree/ReactSortableTree.js +2 -2
- package/esm/ReactSortableTree/components/NodeRendererDefault/NodeRendererDefault.js +1 -3
- package/esm/ReactSortableTree/components/TreeNode/TreeNode.js +1 -3
- package/esm/ReactSortableTree/components/TreePlaceholder/TreePlaceholder.js +0 -1
- package/esm/ReactSortableTree/helpers/generic.js +0 -1
- package/esm/ReactSortableTree/helpers/tree.js +1 -1
- package/esm/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +2 -2
- package/esm/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +2 -2
- package/esm/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +1 -6
- package/esm/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +3 -3
- package/esm/RelationEditor/IntegrationRelationEditor.test.js +1 -1
- package/esm/ReltioMap/ReltioMap.d.ts +1 -1
- package/esm/SimpleAttributeEditor/SimpleAttributeEditor.test.js +0 -1
- package/esm/TableSkeleton/TableSkeleton.d.ts +1 -1
- package/esm/TenantLabel/TenantLabel.spec.js +3 -3
- package/esm/VirtualGroupedList/VirtualGroupedList.js +14 -5
- package/esm/VirtualGroupedList/VirtualGroupedList.spec.js +2 -2
- package/esm/VirtualGroupedList/useScrollToFocusItem.test.js +2 -2
- package/esm/features/activity-log/utils/filters.test.js +1 -1
- package/esm/features/crosswalks/AttributesTable/AttributesTable.js +8 -2
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test.js +2 -2
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +1 -1
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.js +6 -1
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +0 -3
- package/esm/features/crosswalks/AttributesTable/types.d.ts +2 -1
- package/esm/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +1 -1
- package/esm/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +1 -1
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +2 -3
- package/esm/features/history/HistoryFilterButton/HistoryFilterButton.js +6 -3
- package/esm/features/history/hooks/useHistoryTree.js +6 -3
- package/esm/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +2 -2
- package/esm/features/workflow/AssigneeSelector/AssigneeSelector.spec.js +1 -1
- package/esm/features/workflow/WorkflowTaskCard/WorkflowTaskCard.test.js +8 -8
- package/esm/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +0 -1
- package/esm/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +2 -2
- package/esm/features/workflow/hooks/useWorkflowAssignee.js +2 -1
- package/esm/helpers/customScript.test.js +8 -8
- package/esm/hooks/useKeyboardNavigation/useKeyboardNavigation.js +5 -3
- package/esm/hooks/useMarkAsNotMatchRequest/useMarkAsNotMatchRequest.js +2 -1
- package/esm/hooks/useMatchesColumnsData/helpers.js +1 -2
- package/esm/hooks/useMergeAllRequest/useMergeAllRequest.js +2 -1
- package/esm/hooks/usePagingSimulator/helpers.js +0 -1
- package/esm/hooks/useSavedSearchesRequest/useSavedSearchesRequest.js +7 -2
- package/esm/icons/AIPowered.d.ts +1 -2
- package/esm/test-utils/TestStylesProvider.js +1 -2
- package/esm/types/basicTable.d.ts +2 -2
- package/esm/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -90,7 +90,7 @@ describe('ActionsPanel tests', function () {
|
|
|
90
90
|
expect(react_2.screen.queryByTestId('testButton')).toBeInTheDocument();
|
|
91
91
|
expect(react_2.screen.queryByLabelText('More actions')).toBeInTheDocument();
|
|
92
92
|
});
|
|
93
|
-
it('should call onActionsMenuOpen, onActionsMenuClose
|
|
93
|
+
it('should call onActionsMenuOpen, onActionsMenuClose', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
94
|
var onActionsMenuOpenSpy, onActionsMenuCloseSpy, user;
|
|
95
95
|
return __generator(this, function (_a) {
|
|
96
96
|
switch (_a.label) {
|
|
@@ -49,7 +49,7 @@ var AttributeSelector = function (_a) {
|
|
|
49
49
|
values: []
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
onFilterAttributeChange
|
|
52
|
+
onFilterAttributeChange === null || onFilterAttributeChange === void 0 ? void 0 : onFilterAttributeChange(selectInfo);
|
|
53
53
|
}, [rowData, onFilterAttributeChange, filter, operator, changeFilter, id, addNewFilter]);
|
|
54
54
|
return (react_1.default.createElement(BasicAttributeSelector_1.BasicAttributeSelector, { itemsGroups: attributeSelectorItemsGroups, ungroup: attributeSelectorItemsGroups.length < 2, single: true, value: attribute, getLabel: getSelectedAttributeLabel, onSelect: changeAttribute, onOpenPopup: attributeSelectorProps.onOpen }));
|
|
55
55
|
};
|
|
@@ -60,15 +60,15 @@ var AttributesFiltersButton = function (_a) {
|
|
|
60
60
|
}, [filtersProp, isOpen]);
|
|
61
61
|
var applyButtonHandler = (0, react_1.useCallback)(function () {
|
|
62
62
|
onChange(filters);
|
|
63
|
-
onApply
|
|
63
|
+
onApply === null || onApply === void 0 ? void 0 : onApply();
|
|
64
64
|
togglePopup();
|
|
65
65
|
}, [filters, onChange, onApply]);
|
|
66
66
|
var cancelButtonHandler = (0, react_1.useCallback)(function () {
|
|
67
|
-
onCancel
|
|
67
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
68
68
|
togglePopup();
|
|
69
69
|
}, [onCancel]);
|
|
70
70
|
var clearAllButtonHandler = (0, react_1.useCallback)(function () {
|
|
71
|
-
onClear
|
|
71
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
72
72
|
setFilters([]);
|
|
73
73
|
}, [onClear]);
|
|
74
74
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -122,7 +122,7 @@ describe('AttributesFiltersButton tests', function () {
|
|
|
122
122
|
expect(react_2.screen.getByRole('button')).toHaveClass('MuiButton-colorInherit');
|
|
123
123
|
expect((0, test_utils_1.getMuiIconByName)('FilterList')).not.toHaveClass('MuiSvgIcon-colorPrimary');
|
|
124
124
|
});
|
|
125
|
-
it('should close Popover after cancel
|
|
125
|
+
it('should close Popover after cancel backdrop clicking', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
126
|
var user, button;
|
|
127
127
|
return __generator(this, function (_a) {
|
|
128
128
|
switch (_a.label) {
|
|
@@ -213,7 +213,7 @@ describe('AttributesFiltersButton tests', function () {
|
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
}); });
|
|
216
|
-
it('should render children
|
|
216
|
+
it('should render children', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
217
|
var user;
|
|
218
218
|
return __generator(this, function (_a) {
|
|
219
219
|
switch (_a.label) {
|
|
@@ -43,14 +43,15 @@ var react_resize_detector_1 = __importDefault(require("react-resize-detector"));
|
|
|
43
43
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
44
44
|
var styles_1 = require("./styles");
|
|
45
45
|
var AutoSizeList = function (_a) {
|
|
46
|
-
var _b
|
|
46
|
+
var _b;
|
|
47
|
+
var _c = _a.width, width = _c === void 0 ? 0 : _c, _d = _a.height, height = _d === void 0 ? 0 : _d, defaultItemSize = _a.defaultItemSize, data = _a.data, children = _a.children, itemKey = _a.itemKey, showNotMeasuredItems = _a.showNotMeasuredItems, listRefProp = _a.listRef;
|
|
47
48
|
var styles = (0, styles_1.useStyles)();
|
|
48
49
|
var rowHeightsCache = (0, react_1.useRef)({});
|
|
49
50
|
var cacheRowHeight = function (key, height) {
|
|
50
51
|
var _a;
|
|
51
52
|
rowHeightsCache.current = __assign(__assign({}, rowHeightsCache.current), (_a = {}, _a[key] = height, _a));
|
|
52
53
|
};
|
|
53
|
-
var
|
|
54
|
+
var _e = (0, react_1.useState)({}), rowHeights = _e[0], setRowHeights = _e[1];
|
|
54
55
|
var applyRowHeights = (0, react_1.useCallback)((0, mdm_sdk_1.debounce)(function () {
|
|
55
56
|
setRowHeights(__assign({}, rowHeightsCache.current));
|
|
56
57
|
}), []);
|
|
@@ -59,10 +60,9 @@ var AutoSizeList = function (_a) {
|
|
|
59
60
|
var getItemSize = function (index) { return rowHeights[getItemKey(index)] || defaultItemSize; };
|
|
60
61
|
var localListRef = (0, react_1.useRef)();
|
|
61
62
|
var listRef = listRefProp || localListRef;
|
|
62
|
-
listRef.current
|
|
63
|
-
var Row = (0, react_1.useMemo)(
|
|
64
|
-
|
|
65
|
-
function () {
|
|
63
|
+
(_b = listRef.current) === null || _b === void 0 ? void 0 : _b.resetAfterIndex(0, false);
|
|
64
|
+
var Row = (0, react_1.useMemo)(function () {
|
|
65
|
+
//eslint-disable-next-line
|
|
66
66
|
return function (_a) {
|
|
67
67
|
var data = _a.data, index = _a.index, style = _a.style;
|
|
68
68
|
var key = getItemKeyFromData(data, index);
|
|
@@ -64,8 +64,8 @@ describe('BooleanRadioEditor', function () {
|
|
|
64
64
|
it('should render two boolean editors with "Yes" and "No" labels', function () {
|
|
65
65
|
setUp();
|
|
66
66
|
expect(react_2.screen.getAllByRole('checkbox')).toHaveLength(2);
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
react_2.screen.getByLabelText('Yes');
|
|
68
|
+
react_2.screen.getByLabelText('No');
|
|
69
69
|
});
|
|
70
70
|
it('should have radio buttons behaviour', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
71
|
var checkboxes;
|
|
@@ -16,9 +16,7 @@ type Props = {
|
|
|
16
16
|
max: number;
|
|
17
17
|
offset: number;
|
|
18
18
|
}) => Promise<Lookups>;
|
|
19
|
-
lookups:
|
|
20
|
-
[key: string]: LookupValue[];
|
|
21
|
-
};
|
|
19
|
+
lookups: Lookups;
|
|
22
20
|
resolveLookups: (lookupType: string, codeValues: LookupValue[]) => void;
|
|
23
21
|
fullWidth?: boolean;
|
|
24
22
|
disabled?: boolean;
|
|
@@ -117,7 +117,8 @@ var DependentLookupEditor = function (_a) {
|
|
|
117
117
|
};
|
|
118
118
|
var handleFocus = function () {
|
|
119
119
|
var _a, _b, _c;
|
|
120
|
-
|
|
120
|
+
if (value)
|
|
121
|
+
(_c = (_b = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.select) === null || _b === void 0 ? void 0 : _b.inputRef) === null || _c === void 0 ? void 0 : _c.select();
|
|
121
122
|
};
|
|
122
123
|
var resetOptions = function () {
|
|
123
124
|
setPageNumber(1);
|
|
@@ -202,7 +203,8 @@ var DependentLookupEditor = function (_a) {
|
|
|
202
203
|
}).markAsTouched;
|
|
203
204
|
return (react_1.default.createElement(ReactSelect_1.ReactSelect, __assign({}, otherProps, { isMulti: multiple, classes: styles, menuPortalTarget: document.body, menuPlacement: "auto", TextFieldProps: __assign(__assign({}, TextFieldProps), { ref: inputRef, disabled: (TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.disabled) || disabled }), inputRef: inputRef, innerRef: selectRef, styles: {
|
|
204
205
|
menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 1300 })); },
|
|
205
|
-
container: function (base) { return (__assign(__assign({}, base), (fullWidth ? { width: '100%' } : {}))); }
|
|
206
|
+
container: function (base) { return (__assign(__assign({}, base), (fullWidth ? { width: '100%' } : {}))); },
|
|
207
|
+
input: function (base) { return (__assign(__assign({}, base), { visibility: 'visible' })); }
|
|
206
208
|
}, noOptionsMessage: function () {
|
|
207
209
|
return optionsAreLoading && !showMoreButton ? ui_i18n_1.default.text('Loading...') : ui_i18n_1.default.text('No results found');
|
|
208
210
|
}, components: SelectComponents, isClearable: true, isSearchable: true, controlShouldRenderValue: multiple, inputValue: inputValue, filterOption: multiple ? undefined : ramda_1.T, onInputChange: handleInputChange, loadingMessage: function () { return ui_i18n_1.default.text('Loading...'); }, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: (0, ramda_1.either)((0, ramda_1.prop)('value'), (0, ramda_1.prop)('lookupCode')), getOptionLabel: helpers_1.getOptionLabel, onChange: handleChange, onFocus: multiple ? undefined : handleFocus, value: (0, ramda_1.defaultTo)(multiple ? [] : null, value), menuListFooter: showMoreButton && react_1.default.createElement(ReactSelectLoadMoreButton_1.ReactSelectLoadMoreButton, { loading: optionsAreLoading, onClick: loadMoreOptions }) })));
|
|
@@ -668,7 +668,7 @@ describe('DependentLookupEditor', function () {
|
|
|
668
668
|
}
|
|
669
669
|
});
|
|
670
670
|
}); });
|
|
671
|
-
|
|
671
|
+
it.skip('should call props.getLookups with default offset = 0 after LookupCode updated', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
672
672
|
var getLookups, wrapper, newLookupCode;
|
|
673
673
|
return __generator(this, function (_a) {
|
|
674
674
|
switch (_a.label) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
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);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var react_1 = __importDefault(require("react"));
|
|
54
|
+
var DependentLookupEditor_1 = require("./DependentLookupEditor");
|
|
55
|
+
var react_2 = require("@testing-library/react");
|
|
56
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
57
|
+
var onChange = jest.fn();
|
|
58
|
+
var getLookups = jest.fn().mockResolvedValue({
|
|
59
|
+
AR: {
|
|
60
|
+
displayName: 'Argentina'
|
|
61
|
+
},
|
|
62
|
+
BG: {
|
|
63
|
+
displayName: 'Bulgaria'
|
|
64
|
+
},
|
|
65
|
+
CN: {
|
|
66
|
+
displayName: 'China'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var resolveLookups = jest.fn();
|
|
70
|
+
var defaultProps = {
|
|
71
|
+
value: {
|
|
72
|
+
value: 'Portugal',
|
|
73
|
+
lookupCode: 'PT'
|
|
74
|
+
},
|
|
75
|
+
lookups: {
|
|
76
|
+
COUNTRY_CD: {
|
|
77
|
+
PT: {
|
|
78
|
+
displayName: 'Portugal'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
lookupCode: 'COUNTRY_CD',
|
|
83
|
+
error: false,
|
|
84
|
+
parents: [],
|
|
85
|
+
disabled: false,
|
|
86
|
+
placeholder: '',
|
|
87
|
+
TextFieldProps: {},
|
|
88
|
+
onChange: onChange,
|
|
89
|
+
getLookups: getLookups,
|
|
90
|
+
resolveLookups: resolveLookups
|
|
91
|
+
};
|
|
92
|
+
var setUp = function (props) {
|
|
93
|
+
if (props === void 0) { props = defaultProps; }
|
|
94
|
+
var user = user_event_1.default.setup();
|
|
95
|
+
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(DependentLookupEditor_1.DependentLookupEditor, __assign({}, props))));
|
|
96
|
+
};
|
|
97
|
+
describe('DependentLookupEditor tests', function () {
|
|
98
|
+
afterEach(function () {
|
|
99
|
+
jest.clearAllMocks();
|
|
100
|
+
});
|
|
101
|
+
it('should render components correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
var user;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
user = setUp().user;
|
|
107
|
+
expect(react_2.screen.getByRole('combobox')).toHaveValue('Portugal (PT)');
|
|
108
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('combobox'))];
|
|
109
|
+
case 1:
|
|
110
|
+
_a.sent();
|
|
111
|
+
expect(react_2.screen.getByText('Argentina (AR)')).toBeInTheDocument();
|
|
112
|
+
expect(react_2.screen.getByText('China (CN)')).toBeInTheDocument();
|
|
113
|
+
expect(react_2.screen.getByText('Bulgaria (BG)')).toBeInTheDocument();
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}); });
|
|
118
|
+
it('should show input value when select is disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
setUp(__assign(__assign({}, defaultProps), { disabled: true }));
|
|
123
|
+
return [4 /*yield*/, (0, react_2.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
switch (_a.label) {
|
|
126
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
127
|
+
case 1:
|
|
128
|
+
_a.sent();
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); })];
|
|
133
|
+
case 1:
|
|
134
|
+
_a.sent();
|
|
135
|
+
expect(react_2.screen.getByRole('combobox')).toHaveValue('Portugal (PT)');
|
|
136
|
+
expect(react_2.screen.getByRole('combobox')).toHaveAttribute('disabled');
|
|
137
|
+
expect(react_2.screen.getByRole('combobox')).toBeVisible();
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}); });
|
|
142
|
+
});
|
|
@@ -11,7 +11,7 @@ type Props<T> = {
|
|
|
11
11
|
menuId: string;
|
|
12
12
|
onMenuOpen?: () => void;
|
|
13
13
|
onMenuClose?: () => void;
|
|
14
|
-
MenuItemRenderer?: (props: any) =>
|
|
14
|
+
MenuItemRenderer?: (props: any) => React.ReactElement;
|
|
15
15
|
};
|
|
16
16
|
export declare function DropDownMenuButton<T = DropDownMenuItem>({ className, menuId, buttonComponent, buttonContent, menuItems, buttonProps, popoverProps, onMenuOpen, onMenuClose, MenuItemRenderer }: Props<T>): React.JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -54,7 +54,12 @@ function DropDownMenuButton(_a) {
|
|
|
54
54
|
var buttonRef = (0, react_1.useRef)();
|
|
55
55
|
var _k = (0, react_1.useState)(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
56
56
|
(0, useDidUpdateEffect_1.useDidUpdateEffect)(function () {
|
|
57
|
-
|
|
57
|
+
if (isOpen) {
|
|
58
|
+
onMenuOpen();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
onMenuClose();
|
|
62
|
+
}
|
|
58
63
|
}, [isOpen]);
|
|
59
64
|
var handleToggle = (0, react_1.useCallback)(function (e) {
|
|
60
65
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
@@ -18,11 +18,6 @@ describe('DropDownSelector', function () {
|
|
|
18
18
|
expect(wrapper.prop('components').IndicatorSeparator.name).toEqual('EmptyStub');
|
|
19
19
|
expect(wrapper.prop('components').ClearIndicator.name).toEqual('EmptyStub');
|
|
20
20
|
});
|
|
21
|
-
it('should render Select if "getOptions" prop is not provided', function () {
|
|
22
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(DropDownSelector_1.DropDownSelector, { label: 'label' }));
|
|
23
|
-
expect(wrapper.find(ReactSelect_1.ReactSelect).length).toBe(1);
|
|
24
|
-
expect(wrapper.find(AsyncReactSelect_1.AsyncReactSelect).length).toBe(0);
|
|
25
|
-
});
|
|
26
21
|
it('should render AsyncSelect if "getOptions" prop is provided', function () {
|
|
27
22
|
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(DropDownSelector_1.DropDownSelector, { getOptions: function () { }, label: 'label' }));
|
|
28
23
|
expect(wrapper.find(ReactSelect_1.ReactSelect).length).toBe(0);
|
package/cjs/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js
CHANGED
|
@@ -104,7 +104,7 @@ describe('EditModeAttribute', function () {
|
|
|
104
104
|
expect(component.find(NestedAttributeEditor_1.NestedAttributeEditor).length).toBe(0);
|
|
105
105
|
expect(component.find(ReferenceAttributeEditor_1.ReferenceAttributeEditor).length).toBe(0);
|
|
106
106
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
|
-
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, crosswalks = props.crosswalks, errors = props.errors, filteredProps = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "crosswalks", "errors"]);
|
|
107
|
+
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, crosswalks = props.crosswalks, errors = props.errors, filteredProps = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "crosswalks", "errors"]);
|
|
108
108
|
expect(component.find(SimpleAttributeEditor_1.SimpleAttributeEditor).props()).toEqual(__assign(__assign({}, filteredProps), { isReltioCrosswalk: true }));
|
|
109
109
|
expect(mdm_sdk_1.isReltioCrosswalk).toHaveBeenCalledWith(props.crosswalks, props.attributeValue);
|
|
110
110
|
});
|
|
@@ -110,12 +110,7 @@ describe('EditModeAttributesList tests', function () {
|
|
|
110
110
|
pagers.forEach(function (pager) {
|
|
111
111
|
expect(pager.prop('attributeType').hidden).toBeFalsy();
|
|
112
112
|
var shouldHasPaging = pager.prop('attributeType').uri === 'configuration/relationTypes/knowledge/attributes/Role';
|
|
113
|
-
|
|
114
|
-
expect(pager.prop('paging')).toBe(attributes.paging['configuration/relationTypes/knowledge/attributes/Role']);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
expect(pager.prop('paging')).toBeUndefined();
|
|
118
|
-
}
|
|
113
|
+
expect(pager.prop('paging')).toBe(shouldHasPaging ? attributes.paging['configuration/relationTypes/knowledge/attributes/Role'] : undefined);
|
|
119
114
|
});
|
|
120
115
|
});
|
|
121
116
|
it('should not add to more attr types single value types with non-empty attr value', function () {
|
|
@@ -165,6 +165,7 @@ describe('AttributeRenderer', function () {
|
|
|
165
165
|
expect(attribute.prop('crosswalks')).toBe(props.crosswalks);
|
|
166
166
|
expect(attribute.prop('errors')).toBe(props.errors);
|
|
167
167
|
expect(attribute.prop('ownError')).toBe(i === 0 ? props.errors[0] : undefined);
|
|
168
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
168
169
|
expect(attribute.prop('onAddOneMore')).toEqual(isLast ? expect.any(Function) : null);
|
|
169
170
|
expect(attribute.prop('onDeleteAttribute')).toEqual(expect.any(Function));
|
|
170
171
|
expect(attribute.prop('onAddAttributes')).toBe(props.onAddAttributes);
|
|
@@ -176,6 +177,7 @@ describe('AttributeRenderer', function () {
|
|
|
176
177
|
var onAddOneMore = attribute.prop('onAddOneMore');
|
|
177
178
|
onAddOneMore();
|
|
178
179
|
});
|
|
180
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
179
181
|
expect(props.onAddAttributes).toHaveBeenCalledWith([
|
|
180
182
|
{
|
|
181
183
|
parentUri: props.parentUri,
|
|
@@ -120,9 +120,7 @@ describe('EditModeComplexAttribute', function () {
|
|
|
120
120
|
});
|
|
121
121
|
it('should render additional controls if additionalControlsRenderer prop is specified', function () {
|
|
122
122
|
var AdditionalControls = function () { return react_1.default.createElement("div", null); };
|
|
123
|
-
var props = __assign(__assign({}, defaultProps), {
|
|
124
|
-
//eslint-disable-next-line
|
|
125
|
-
additionalControlsRenderer: function (_a) {
|
|
123
|
+
var props = __assign(__assign({}, defaultProps), { additionalControlsRenderer: function (_a) {
|
|
126
124
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
127
125
|
return (react_1.default.createElement(AdditionalControls, { attributeValue: attributeValue, attributeType: attributeType }));
|
|
128
126
|
} });
|
|
@@ -225,9 +223,7 @@ describe('EditModeComplexAttribute', function () {
|
|
|
225
223
|
};
|
|
226
224
|
it('should render deep nested attributes', function () {
|
|
227
225
|
var AdditionalControls = function () { return react_1.default.createElement("div", null); };
|
|
228
|
-
var props = __assign(__assign({}, defaultProps), { onAddAttributes: jest.fn(), onDeleteAttribute: jest.fn(), onChangeAttribute: jest.fn(),
|
|
229
|
-
//eslint-disable-next-line
|
|
230
|
-
additionalControlsRenderer: function (_a) {
|
|
226
|
+
var props = __assign(__assign({}, defaultProps), { onAddAttributes: jest.fn(), onDeleteAttribute: jest.fn(), onChangeAttribute: jest.fn(), additionalControlsRenderer: function (_a) {
|
|
231
227
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
232
228
|
return (react_1.default.createElement(AdditionalControls, { attributeValue: attributeValue, attributeType: attributeType }));
|
|
233
229
|
}, crosswalks: [], mode: mdm_sdk_1.Mode.Editing, showEmptyEditors: true });
|
|
@@ -9,7 +9,7 @@ var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
|
9
9
|
var EmptyState_1 = require("./EmptyState");
|
|
10
10
|
var Logo = function () { return react_1.default.createElement("div", null); };
|
|
11
11
|
describe('EmptyState tests', function () {
|
|
12
|
-
it('should render main parts
|
|
12
|
+
it('should render main parts', function () {
|
|
13
13
|
var text = 'Header';
|
|
14
14
|
var component = (0, enzyme_1.mount)(react_1.default.createElement(EmptyState_1.EmptyState, { access: false, LogoRenderer: Logo, text: text }));
|
|
15
15
|
expect(component.find(Logo)).toHaveLength(1);
|