@reltio/components 1.4.2253 → 1.4.2255
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/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
- package/ActivenessDateControl/ActivenessDateControl.js +2 -2
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
- package/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
- package/SelectionPopup/SelectionPopup.d.ts +4 -4
- package/SelectionPopup/SelectionPopup.js +4 -3
- package/SelectionPopup/SelectionPopup.spec.js +2 -2
- package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
- package/cjs/ActivenessDateControl/ActivenessDateControl.js +2 -2
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
- package/cjs/SelectionPopup/SelectionPopup.d.ts +4 -4
- package/cjs/SelectionPopup/SelectionPopup.js +4 -3
- package/cjs/SelectionPopup/SelectionPopup.spec.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +22 -6
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +161 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +2 -4
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +37 -3
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
- package/cjs/features/workflow/helpers/attributes.js +5 -4
- package/cjs/features/workflow/helpers/attributes.test.js +55 -0
- package/cjs/features/workflow/helpers/common.d.ts +2 -1
- package/cjs/features/workflow/helpers/common.js +5 -1
- package/cjs/features/workflow/helpers/dcr.js +2 -1
- package/cjs/features/workflow/helpers/dcr.test.js +47 -0
- package/cjs/features/workflow/helpers/merge.js +1 -1
- package/cjs/features/workflow/helpers/merge.test.js +34 -0
- package/cjs/features/workflow/helpers/metadata.test-data.js +9 -0
- package/cjs/features/workflow/helpers/validation.js +3 -2
- package/cjs/features/workflow/helpers/validation.test-data.d.ts +1 -0
- package/cjs/features/workflow/helpers/validation.test-data.js +34 -1
- package/cjs/features/workflow/helpers/validation.test.js +10 -0
- package/cjs/features/workflow/hooks/useChangeRequest.d.ts +1 -0
- package/cjs/features/workflow/hooks/useChangeRequest.js +8 -5
- package/cjs/features/workflow/hooks/useChangeRequest.test.js +11 -5
- package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
- package/cjs/features/workflow/hooks/useWorkflowActions.js +8 -3
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +23 -7
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
- package/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +153 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +1 -3
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +14 -3
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
- package/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
- package/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
- package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
- package/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
- package/features/workflow/helpers/attributes.js +5 -4
- package/features/workflow/helpers/attributes.test.js +55 -0
- package/features/workflow/helpers/common.d.ts +2 -1
- package/features/workflow/helpers/common.js +3 -0
- package/features/workflow/helpers/dcr.js +2 -1
- package/features/workflow/helpers/dcr.test.js +47 -0
- package/features/workflow/helpers/merge.js +2 -2
- package/features/workflow/helpers/merge.test.js +34 -0
- package/features/workflow/helpers/metadata.test-data.js +9 -0
- package/features/workflow/helpers/validation.js +3 -2
- package/features/workflow/helpers/validation.test-data.d.ts +1 -0
- package/features/workflow/helpers/validation.test-data.js +32 -0
- package/features/workflow/helpers/validation.test.js +11 -1
- package/features/workflow/hooks/useChangeRequest.d.ts +1 -0
- package/features/workflow/hooks/useChangeRequest.js +8 -5
- package/features/workflow/hooks/useChangeRequest.test.js +11 -5
- package/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
- package/features/workflow/hooks/useWorkflowActions.js +8 -3
- package/package.json +2 -2
|
@@ -4,6 +4,8 @@ type Props = {
|
|
|
4
4
|
onChange: (value: number) => void;
|
|
5
5
|
className?: string;
|
|
6
6
|
fullWidth?: boolean;
|
|
7
|
+
minDate?: number;
|
|
8
|
+
maxDate?: number;
|
|
7
9
|
};
|
|
8
|
-
export declare const ActivenessDateControl: ({ value, onChange, className, fullWidth }: Props) => React.JSX.Element;
|
|
10
|
+
export declare const ActivenessDateControl: ({ value, onChange, className, fullWidth, minDate, maxDate }: Props) => React.JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -3,9 +3,9 @@ import i18n from 'ui-i18n';
|
|
|
3
3
|
import { pipe } from 'ramda';
|
|
4
4
|
import { DateEditor } from '../DateEditor/DateEditor';
|
|
5
5
|
export var ActivenessDateControl = function (_a) {
|
|
6
|
-
var value = _a.value, onChange = _a.onChange, className = _a.className, fullWidth = _a.fullWidth;
|
|
6
|
+
var value = _a.value, onChange = _a.onChange, className = _a.className, fullWidth = _a.fullWidth, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
7
7
|
var handleChange = pipe(function (date) { return date && date.getTime(); }, onChange);
|
|
8
|
-
return (React.createElement(DateEditor, { value: value, label: i18n.text('Effective date'), onChange: handleChange, slotProps: {
|
|
8
|
+
return (React.createElement(DateEditor, { value: value, label: i18n.text('Effective date'), onChange: handleChange, minDate: minDate, maxDate: maxDate, slotProps: {
|
|
9
9
|
textField: { size: 'small', className: className, fullWidth: fullWidth }
|
|
10
10
|
} }));
|
|
11
11
|
};
|
|
@@ -11,14 +11,14 @@ type Item = AttributeOption & {
|
|
|
11
11
|
children?: Item[];
|
|
12
12
|
attributes?: Item[];
|
|
13
13
|
};
|
|
14
|
-
type Props = Omit<React.ComponentProps<typeof SelectionPopup>, 'title'> & {
|
|
15
|
-
hideCheckBox
|
|
14
|
+
type Props = Omit<React.ComponentProps<typeof SelectionPopup>, 'title' | 'children' | 'containerWidth' | 'searchInputOnKeyDown'> & {
|
|
15
|
+
hideCheckBox?: boolean;
|
|
16
16
|
titleText?: string;
|
|
17
17
|
filterText?: string;
|
|
18
18
|
selected: Item[];
|
|
19
19
|
data: Item[];
|
|
20
20
|
onListItemClick: (item: Item, checked: boolean) => void;
|
|
21
|
-
renderGroupTitle
|
|
21
|
+
renderGroupTitle?: VirtualGroupedListRenderGroupTitle<Item>;
|
|
22
22
|
};
|
|
23
23
|
export declare const ConfigureColumnsPopup: ({ open, anchorEl, data, onSearch, onClose, titleText, filterText, onListItemClick, selected, hideCheckBox, renderGroupTitle, ...otherProps }: Props) => React.JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -42,9 +42,9 @@ import { useKeyboardNavigation } from '../hooks/useKeyboardNavigation';
|
|
|
42
42
|
import { useStyles } from './styles';
|
|
43
43
|
var ITEM_HEIGHT = 32;
|
|
44
44
|
var LIST_CONTAINER_HEIGHT = 300;
|
|
45
|
-
var DEFAULT_MIN_CONTAINER_WIDTH =
|
|
45
|
+
var DEFAULT_MIN_CONTAINER_WIDTH = 318;
|
|
46
46
|
export var ConfigureColumnsPopup = function (_a) {
|
|
47
|
-
var open = _a.open, anchorEl = _a.anchorEl, _b = _a.data, data = _b === void 0 ? [] : _b, onSearch = _a.onSearch, onClose = _a.onClose, _c = _a.titleText, titleText = _c === void 0 ? i18n.text('Show/hide columns') : _c, _d = _a.filterText, filterText = _d === void 0 ? '' : _d, onListItemClick = _a.onListItemClick, _e = _a.selected, selected = _e === void 0 ? [] : _e,
|
|
47
|
+
var open = _a.open, anchorEl = _a.anchorEl, _b = _a.data, data = _b === void 0 ? [] : _b, onSearch = _a.onSearch, onClose = _a.onClose, _c = _a.titleText, titleText = _c === void 0 ? i18n.text('Show/hide columns') : _c, _d = _a.filterText, filterText = _d === void 0 ? '' : _d, onListItemClick = _a.onListItemClick, _e = _a.selected, selected = _e === void 0 ? [] : _e, _f = _a.hideCheckBox, hideCheckBox = _f === void 0 ? false : _f, renderGroupTitle = _a.renderGroupTitle, otherProps = __rest(_a, ["open", "anchorEl", "data", "onSearch", "onClose", "titleText", "filterText", "onListItemClick", "selected", "hideCheckBox", "renderGroupTitle"]);
|
|
48
48
|
var filterItem = useCallback(function (item) {
|
|
49
49
|
return item.label.toLowerCase().includes(filterText.toLowerCase());
|
|
50
50
|
}, [filterText]);
|
|
@@ -81,12 +81,12 @@ export var ConfigureColumnsPopup = function (_a) {
|
|
|
81
81
|
}, [onListItemClick, selected]);
|
|
82
82
|
var groupedItems = useMemo(function () { return (renderGroupTitle ? getGroupsData : getAttributesData)(data); }, [data, renderGroupTitle, getGroupsData, getAttributesData]);
|
|
83
83
|
var items = useMemo(function () { return flattenGroupedItemsData(groupedItems); }, [groupedItems]);
|
|
84
|
-
var
|
|
84
|
+
var _g = useKeyboardNavigation({
|
|
85
85
|
items: items,
|
|
86
86
|
open: open,
|
|
87
87
|
onSelectFocusedItem: handleSearchOnEnter,
|
|
88
88
|
selectedItems: selected
|
|
89
|
-
}), focusIndex =
|
|
89
|
+
}), focusIndex = _g.focusIndex, handleKeyDown = _g.handleKeyDown;
|
|
90
90
|
var focusIndexRef = useRef(null);
|
|
91
91
|
focusIndexRef.current = focusIndex;
|
|
92
92
|
var renderListItem = useCallback(function (style, _a, index) {
|
|
@@ -95,7 +95,7 @@ export var ConfigureColumnsPopup = function (_a) {
|
|
|
95
95
|
var isFocused = focusIndexRef.current === index;
|
|
96
96
|
return (React.createElement(AttributeListItem, { key: item.id, onClick: onListItemClick, checked: checked, level: level, data: item, label: React.createElement(Highlighter, { text: item.label, highlight: item.filterText }), labelInText: item.label, style: style, hideCheckBox: hideCheckBox, isFocused: isFocused, notSelectable: item.notSelectable, LogoIcon: item.LogoIcon }));
|
|
97
97
|
}, [hideCheckBox, onListItemClick, selected]);
|
|
98
|
-
var containerWidth = getMaxItemWidth('label')(groupedItems)
|
|
98
|
+
var containerWidth = Math.max(getMaxItemWidth('label')(groupedItems), DEFAULT_MIN_CONTAINER_WIDTH);
|
|
99
99
|
var classes = useStyles();
|
|
100
100
|
return (React.createElement(SelectionPopup, __assign({ open: open, className: classnames(classes.container, classes.popupContainer), anchorEl: anchorEl, onClose: onClose, onSearch: onSearch, title: titleText, containerWidth: containerWidth, searchInputOnKeyDown: handleKeyDown }, otherProps),
|
|
101
101
|
React.createElement(VirtualGroupedList, { height: LIST_CONTAINER_HEIGHT, renderItem: renderListItem, items: items, hideSubtitles: true, getItemSize: getItemSize, focusIndex: focusIndex, renderGroupTitle: renderGroupTitle })));
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopoverProps } from '@mui/material/Popover';
|
|
3
3
|
type Props = {
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
additionalInfo?: string;
|
|
6
6
|
containerWidth: number;
|
|
7
|
-
containerHeight
|
|
7
|
+
containerHeight?: number;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
PaperProps?: Record<string, unknown>;
|
|
10
10
|
searchInputOnKeyDown: (event: React.KeyboardEvent) => void;
|
|
11
11
|
onSearch?: (value?: string) => void;
|
|
12
12
|
className?: string;
|
|
13
|
-
hideTitle?: boolean;
|
|
14
13
|
hideSearchInput?: boolean;
|
|
15
14
|
inputPlaceholder?: string;
|
|
16
15
|
headerPlacement?: 'top' | 'bottom';
|
|
17
16
|
searchInputRef?: React.Ref<unknown>;
|
|
17
|
+
toolbar?: React.ReactNode;
|
|
18
18
|
} & PopoverProps;
|
|
19
|
-
export declare const SelectionPopup: ({ title, className, onSearch,
|
|
19
|
+
export declare const SelectionPopup: ({ title, className, onSearch, hideSearchInput, inputPlaceholder, headerPlacement, containerWidth, containerHeight, searchInputOnKeyDown, children, searchInputRef, anchorOrigin, transformOrigin, additionalInfo, toolbar, ...otherProps }: Props) => React.JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -31,19 +31,20 @@ import { useTheme } from '@mui/styles';
|
|
|
31
31
|
import styles from './SelectionPopup.module.css';
|
|
32
32
|
export var SelectionPopup = function (_a) {
|
|
33
33
|
var _b;
|
|
34
|
-
var title = _a.title, className = _a.className, onSearch = _a.onSearch,
|
|
34
|
+
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideSearchInput = _a.hideSearchInput, inputPlaceholder = _a.inputPlaceholder, _c = _a.headerPlacement, headerPlacement = _c === void 0 ? 'top' : _c, containerWidth = _a.containerWidth, _d = _a.containerHeight, containerHeight = _d === void 0 ? 553 : _d, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef, _e = _a.anchorOrigin, anchorOrigin = _e === void 0 ? {
|
|
35
35
|
vertical: 'top',
|
|
36
36
|
horizontal: 'right'
|
|
37
37
|
} : _e, _f = _a.transformOrigin, transformOrigin = _f === void 0 ? {
|
|
38
38
|
vertical: 'top',
|
|
39
39
|
horizontal: 'right'
|
|
40
|
-
} : _f, additionalInfo = _a.additionalInfo, otherProps = __rest(_a, ["title", "className", "onSearch", "
|
|
40
|
+
} : _f, additionalInfo = _a.additionalInfo, toolbar = _a.toolbar, otherProps = __rest(_a, ["title", "className", "onSearch", "hideSearchInput", "inputPlaceholder", "headerPlacement", "containerWidth", "containerHeight", "searchInputOnKeyDown", "children", "searchInputRef", "anchorOrigin", "transformOrigin", "additionalInfo", "toolbar"]);
|
|
41
41
|
var currentTheme = useTheme();
|
|
42
42
|
var variableStyles = useCssVariableStyles({
|
|
43
43
|
'--container-height': "".concat(containerHeight, "px")
|
|
44
44
|
});
|
|
45
45
|
var header = (React.createElement(React.Fragment, null,
|
|
46
|
-
|
|
46
|
+
toolbar,
|
|
47
|
+
title && !toolbar && (React.createElement("div", { className: styles.header },
|
|
47
48
|
title,
|
|
48
49
|
additionalInfo && React.createElement(InfoIcon, { className: styles.infoIcon, tooltipTitle: additionalInfo }))),
|
|
49
50
|
!hideSearchInput && (React.createElement(SearchInput, { onSearch: onSearch, autofocus: true, onKeyDown: searchInputOnKeyDown, inputRef: searchInputRef, classes: { root: styles.searchInputContainer }, placeholder: inputPlaceholder || i18n.text('Search & add attributes'), height: 40 }))));
|
|
@@ -90,8 +90,8 @@ describe('SelectionPopup tests', function () {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}); });
|
|
93
|
-
it('should hide title
|
|
94
|
-
setUp({
|
|
93
|
+
it('should hide title when title is not provided', function () {
|
|
94
|
+
setUp({ title: undefined });
|
|
95
95
|
expect(screen.queryByText('Title')).not.toBeInTheDocument();
|
|
96
96
|
});
|
|
97
97
|
it('should hide search input if props.hideSearchInput is true', function () {
|
|
@@ -4,6 +4,8 @@ type Props = {
|
|
|
4
4
|
onChange: (value: number) => void;
|
|
5
5
|
className?: string;
|
|
6
6
|
fullWidth?: boolean;
|
|
7
|
+
minDate?: number;
|
|
8
|
+
maxDate?: number;
|
|
7
9
|
};
|
|
8
|
-
export declare const ActivenessDateControl: ({ value, onChange, className, fullWidth }: Props) => React.JSX.Element;
|
|
10
|
+
export declare const ActivenessDateControl: ({ value, onChange, className, fullWidth, minDate, maxDate }: Props) => React.JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -9,9 +9,9 @@ var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
|
9
9
|
var ramda_1 = require("ramda");
|
|
10
10
|
var DateEditor_1 = require("../DateEditor/DateEditor");
|
|
11
11
|
var ActivenessDateControl = function (_a) {
|
|
12
|
-
var value = _a.value, onChange = _a.onChange, className = _a.className, fullWidth = _a.fullWidth;
|
|
12
|
+
var value = _a.value, onChange = _a.onChange, className = _a.className, fullWidth = _a.fullWidth, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
13
13
|
var handleChange = (0, ramda_1.pipe)(function (date) { return date && date.getTime(); }, onChange);
|
|
14
|
-
return (react_1.default.createElement(DateEditor_1.DateEditor, { value: value, label: ui_i18n_1.default.text('Effective date'), onChange: handleChange, slotProps: {
|
|
14
|
+
return (react_1.default.createElement(DateEditor_1.DateEditor, { value: value, label: ui_i18n_1.default.text('Effective date'), onChange: handleChange, minDate: minDate, maxDate: maxDate, slotProps: {
|
|
15
15
|
textField: { size: 'small', className: className, fullWidth: fullWidth }
|
|
16
16
|
} }));
|
|
17
17
|
};
|
|
@@ -11,14 +11,14 @@ type Item = AttributeOption & {
|
|
|
11
11
|
children?: Item[];
|
|
12
12
|
attributes?: Item[];
|
|
13
13
|
};
|
|
14
|
-
type Props = Omit<React.ComponentProps<typeof SelectionPopup>, 'title'> & {
|
|
15
|
-
hideCheckBox
|
|
14
|
+
type Props = Omit<React.ComponentProps<typeof SelectionPopup>, 'title' | 'children' | 'containerWidth' | 'searchInputOnKeyDown'> & {
|
|
15
|
+
hideCheckBox?: boolean;
|
|
16
16
|
titleText?: string;
|
|
17
17
|
filterText?: string;
|
|
18
18
|
selected: Item[];
|
|
19
19
|
data: Item[];
|
|
20
20
|
onListItemClick: (item: Item, checked: boolean) => void;
|
|
21
|
-
renderGroupTitle
|
|
21
|
+
renderGroupTitle?: VirtualGroupedListRenderGroupTitle<Item>;
|
|
22
22
|
};
|
|
23
23
|
export declare const ConfigureColumnsPopup: ({ open, anchorEl, data, onSearch, onClose, titleText, filterText, onListItemClick, selected, hideCheckBox, renderGroupTitle, ...otherProps }: Props) => React.JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -71,9 +71,9 @@ var useKeyboardNavigation_1 = require("../hooks/useKeyboardNavigation");
|
|
|
71
71
|
var styles_1 = require("./styles");
|
|
72
72
|
var ITEM_HEIGHT = 32;
|
|
73
73
|
var LIST_CONTAINER_HEIGHT = 300;
|
|
74
|
-
var DEFAULT_MIN_CONTAINER_WIDTH =
|
|
74
|
+
var DEFAULT_MIN_CONTAINER_WIDTH = 318;
|
|
75
75
|
var ConfigureColumnsPopup = function (_a) {
|
|
76
|
-
var open = _a.open, anchorEl = _a.anchorEl, _b = _a.data, data = _b === void 0 ? [] : _b, onSearch = _a.onSearch, onClose = _a.onClose, _c = _a.titleText, titleText = _c === void 0 ? ui_i18n_1.default.text('Show/hide columns') : _c, _d = _a.filterText, filterText = _d === void 0 ? '' : _d, onListItemClick = _a.onListItemClick, _e = _a.selected, selected = _e === void 0 ? [] : _e,
|
|
76
|
+
var open = _a.open, anchorEl = _a.anchorEl, _b = _a.data, data = _b === void 0 ? [] : _b, onSearch = _a.onSearch, onClose = _a.onClose, _c = _a.titleText, titleText = _c === void 0 ? ui_i18n_1.default.text('Show/hide columns') : _c, _d = _a.filterText, filterText = _d === void 0 ? '' : _d, onListItemClick = _a.onListItemClick, _e = _a.selected, selected = _e === void 0 ? [] : _e, _f = _a.hideCheckBox, hideCheckBox = _f === void 0 ? false : _f, renderGroupTitle = _a.renderGroupTitle, otherProps = __rest(_a, ["open", "anchorEl", "data", "onSearch", "onClose", "titleText", "filterText", "onListItemClick", "selected", "hideCheckBox", "renderGroupTitle"]);
|
|
77
77
|
var filterItem = (0, react_1.useCallback)(function (item) {
|
|
78
78
|
return item.label.toLowerCase().includes(filterText.toLowerCase());
|
|
79
79
|
}, [filterText]);
|
|
@@ -110,12 +110,12 @@ var ConfigureColumnsPopup = function (_a) {
|
|
|
110
110
|
}, [onListItemClick, selected]);
|
|
111
111
|
var groupedItems = (0, react_1.useMemo)(function () { return (renderGroupTitle ? getGroupsData : getAttributesData)(data); }, [data, renderGroupTitle, getGroupsData, getAttributesData]);
|
|
112
112
|
var items = (0, react_1.useMemo)(function () { return (0, VirtualGroupedList_1.flattenGroupedItemsData)(groupedItems); }, [groupedItems]);
|
|
113
|
-
var
|
|
113
|
+
var _g = (0, useKeyboardNavigation_1.useKeyboardNavigation)({
|
|
114
114
|
items: items,
|
|
115
115
|
open: open,
|
|
116
116
|
onSelectFocusedItem: handleSearchOnEnter,
|
|
117
117
|
selectedItems: selected
|
|
118
|
-
}), focusIndex =
|
|
118
|
+
}), focusIndex = _g.focusIndex, handleKeyDown = _g.handleKeyDown;
|
|
119
119
|
var focusIndexRef = (0, react_1.useRef)(null);
|
|
120
120
|
focusIndexRef.current = focusIndex;
|
|
121
121
|
var renderListItem = (0, react_1.useCallback)(function (style, _a, index) {
|
|
@@ -124,7 +124,7 @@ var ConfigureColumnsPopup = function (_a) {
|
|
|
124
124
|
var isFocused = focusIndexRef.current === index;
|
|
125
125
|
return (react_1.default.createElement(AttributeListItem_1.AttributeListItem, { key: item.id, onClick: onListItemClick, 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, hideCheckBox: hideCheckBox, isFocused: isFocused, notSelectable: item.notSelectable, LogoIcon: item.LogoIcon }));
|
|
126
126
|
}, [hideCheckBox, onListItemClick, selected]);
|
|
127
|
-
var containerWidth = (0, mdm_sdk_1.getMaxItemWidth)('label')(groupedItems)
|
|
127
|
+
var containerWidth = Math.max((0, mdm_sdk_1.getMaxItemWidth)('label')(groupedItems), DEFAULT_MIN_CONTAINER_WIDTH);
|
|
128
128
|
var classes = (0, styles_1.useStyles)();
|
|
129
129
|
return (react_1.default.createElement(SelectionPopup_1.SelectionPopup, __assign({ open: open, className: (0, classnames_1.default)(classes.container, classes.popupContainer), anchorEl: anchorEl, onClose: onClose, onSearch: onSearch, title: titleText, containerWidth: containerWidth, searchInputOnKeyDown: handleKeyDown }, otherProps),
|
|
130
130
|
react_1.default.createElement(VirtualGroupedList_1.VirtualGroupedList, { height: LIST_CONTAINER_HEIGHT, renderItem: renderListItem, items: items, hideSubtitles: true, getItemSize: getItemSize, focusIndex: focusIndex, renderGroupTitle: renderGroupTitle })));
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopoverProps } from '@mui/material/Popover';
|
|
3
3
|
type Props = {
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
additionalInfo?: string;
|
|
6
6
|
containerWidth: number;
|
|
7
|
-
containerHeight
|
|
7
|
+
containerHeight?: number;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
PaperProps?: Record<string, unknown>;
|
|
10
10
|
searchInputOnKeyDown: (event: React.KeyboardEvent) => void;
|
|
11
11
|
onSearch?: (value?: string) => void;
|
|
12
12
|
className?: string;
|
|
13
|
-
hideTitle?: boolean;
|
|
14
13
|
hideSearchInput?: boolean;
|
|
15
14
|
inputPlaceholder?: string;
|
|
16
15
|
headerPlacement?: 'top' | 'bottom';
|
|
17
16
|
searchInputRef?: React.Ref<unknown>;
|
|
17
|
+
toolbar?: React.ReactNode;
|
|
18
18
|
} & PopoverProps;
|
|
19
|
-
export declare const SelectionPopup: ({ title, className, onSearch,
|
|
19
|
+
export declare const SelectionPopup: ({ title, className, onSearch, hideSearchInput, inputPlaceholder, headerPlacement, containerWidth, containerHeight, searchInputOnKeyDown, children, searchInputRef, anchorOrigin, transformOrigin, additionalInfo, toolbar, ...otherProps }: Props) => React.JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -37,19 +37,20 @@ var styles_1 = require("@mui/styles");
|
|
|
37
37
|
var SelectionPopup_module_css_1 = __importDefault(require("./SelectionPopup.module.css"));
|
|
38
38
|
var SelectionPopup = function (_a) {
|
|
39
39
|
var _b;
|
|
40
|
-
var title = _a.title, className = _a.className, onSearch = _a.onSearch,
|
|
40
|
+
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideSearchInput = _a.hideSearchInput, inputPlaceholder = _a.inputPlaceholder, _c = _a.headerPlacement, headerPlacement = _c === void 0 ? 'top' : _c, containerWidth = _a.containerWidth, _d = _a.containerHeight, containerHeight = _d === void 0 ? 553 : _d, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef, _e = _a.anchorOrigin, anchorOrigin = _e === void 0 ? {
|
|
41
41
|
vertical: 'top',
|
|
42
42
|
horizontal: 'right'
|
|
43
43
|
} : _e, _f = _a.transformOrigin, transformOrigin = _f === void 0 ? {
|
|
44
44
|
vertical: 'top',
|
|
45
45
|
horizontal: 'right'
|
|
46
|
-
} : _f, additionalInfo = _a.additionalInfo, otherProps = __rest(_a, ["title", "className", "onSearch", "
|
|
46
|
+
} : _f, additionalInfo = _a.additionalInfo, toolbar = _a.toolbar, otherProps = __rest(_a, ["title", "className", "onSearch", "hideSearchInput", "inputPlaceholder", "headerPlacement", "containerWidth", "containerHeight", "searchInputOnKeyDown", "children", "searchInputRef", "anchorOrigin", "transformOrigin", "additionalInfo", "toolbar"]);
|
|
47
47
|
var currentTheme = (0, styles_1.useTheme)();
|
|
48
48
|
var variableStyles = (0, useCssVariableStyles_1.useCssVariableStyles)({
|
|
49
49
|
'--container-height': "".concat(containerHeight, "px")
|
|
50
50
|
});
|
|
51
51
|
var header = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
-
|
|
52
|
+
toolbar,
|
|
53
|
+
title && !toolbar && (react_1.default.createElement("div", { className: SelectionPopup_module_css_1.default.header },
|
|
53
54
|
title,
|
|
54
55
|
additionalInfo && react_1.default.createElement(InfoIcon_1.InfoIcon, { className: SelectionPopup_module_css_1.default.infoIcon, tooltipTitle: additionalInfo }))),
|
|
55
56
|
!hideSearchInput && (react_1.default.createElement(SearchInput_1.SearchInput, { onSearch: onSearch, autofocus: true, onKeyDown: searchInputOnKeyDown, inputRef: searchInputRef, classes: { root: SelectionPopup_module_css_1.default.searchInputContainer }, placeholder: inputPlaceholder || ui_i18n_1.default.text('Search & add attributes'), height: 40 }))));
|
|
@@ -95,8 +95,8 @@ describe('SelectionPopup tests', function () {
|
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}); });
|
|
98
|
-
it('should hide title
|
|
99
|
-
setUp({
|
|
98
|
+
it('should hide title when title is not provided', function () {
|
|
99
|
+
setUp({ title: undefined });
|
|
100
100
|
expect(react_2.screen.queryByText('Title')).not.toBeInTheDocument();
|
|
101
101
|
});
|
|
102
102
|
it('should hide search input if props.hideSearchInput is true', function () {
|
|
@@ -64,6 +64,22 @@ var EntityChangesGroup = function (_a) {
|
|
|
64
64
|
relationsInfo: relationsInfo
|
|
65
65
|
});
|
|
66
66
|
var changesList = (0, react_1.useMemo)(function () { return (0, changesList_1.prepareChangesList)(rawChangesList); }, [rawChangesList]);
|
|
67
|
+
var objectUriByChangeIndex = (0, react_1.useMemo)(function () {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
var result = [];
|
|
70
|
+
var currentObjectUri = entityInfo.uri;
|
|
71
|
+
for (var _i = 0, changesList_2 = changesList; _i < changesList_2.length; _i++) {
|
|
72
|
+
var item = changesList_2[_i];
|
|
73
|
+
if (!(0, helpers_1.isDiffChange)(item)) {
|
|
74
|
+
currentObjectUri = entityInfo.uri;
|
|
75
|
+
}
|
|
76
|
+
else if ((0, helpers_1.isRelationRow)(item)) {
|
|
77
|
+
currentObjectUri = (_b = (_a = item.attributeValue) === null || _a === void 0 ? void 0 : _a.uri) !== null && _b !== void 0 ? _b : entityInfo.uri;
|
|
78
|
+
}
|
|
79
|
+
result.push(currentObjectUri);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}, [changesList, entityInfo.uri]);
|
|
67
83
|
var entityAttributeTypes = (0, react_1.useMemo)(function () {
|
|
68
84
|
if (!(0, ramda_1.isNil)(entityInfo.isExist)) {
|
|
69
85
|
return (0, moreAttributesScope_1.getAvailableAttributeTypesForEntity)(metadata, entityInfo.type);
|
|
@@ -93,7 +109,7 @@ var EntityChangesGroup = function (_a) {
|
|
|
93
109
|
highlight(addedIds);
|
|
94
110
|
};
|
|
95
111
|
}, [addAddedAttributes, highlight]);
|
|
96
|
-
var handleAddNestedAttributes = (0, react_1.useCallback)(function (change) { return function (attributeTypes) {
|
|
112
|
+
var handleAddNestedAttributes = (0, react_1.useCallback)(function (change, objectUri) { return function (attributeTypes) {
|
|
97
113
|
var _a, _b, _c, _d, _e;
|
|
98
114
|
var parentUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
|
|
99
115
|
var parentAttrs = attributeTypes.filter(function (attr) { return attr.uri === parentUri; });
|
|
@@ -105,7 +121,7 @@ var EntityChangesGroup = function (_a) {
|
|
|
105
121
|
var addedId = (0, addedAttributes_1.getAddedId)(change);
|
|
106
122
|
if (lineId && (0, addedAttributes_1.isRootAddedAttribute)(lineId)) {
|
|
107
123
|
handleAddAttributes({
|
|
108
|
-
objectUri:
|
|
124
|
+
objectUri: objectUri,
|
|
109
125
|
changeOverrides: siblingOverrides
|
|
110
126
|
})(parentAttrs);
|
|
111
127
|
}
|
|
@@ -118,7 +134,7 @@ var EntityChangesGroup = function (_a) {
|
|
|
118
134
|
}
|
|
119
135
|
else {
|
|
120
136
|
handleAddAttributes({
|
|
121
|
-
objectUri:
|
|
137
|
+
objectUri: objectUri,
|
|
122
138
|
changeOverrides: siblingOverrides
|
|
123
139
|
})(parentAttrs);
|
|
124
140
|
}
|
|
@@ -131,12 +147,12 @@ var EntityChangesGroup = function (_a) {
|
|
|
131
147
|
}
|
|
132
148
|
else {
|
|
133
149
|
handleAddAttributes({
|
|
134
|
-
objectUri:
|
|
150
|
+
objectUri: objectUri,
|
|
135
151
|
changeOverrides: childOverrides
|
|
136
152
|
})(subAttrs);
|
|
137
153
|
}
|
|
138
154
|
}
|
|
139
|
-
}; }, [handleAddAttributes
|
|
155
|
+
}; }, [handleAddAttributes]);
|
|
140
156
|
return (react_1.default.createElement(AttributesChangesContext_1.AttributesChangesContext.Provider, { value: objectsInfo },
|
|
141
157
|
react_1.default.createElement(Accordion_1.default, { className: EntityChangesGroup_module_css_1.default.entityGroup, defaultExpanded: true, "data-reltio-id": "entity-changes-group" },
|
|
142
158
|
react_1.default.createElement(AccordionSummary_1.default, { expandIcon: react_1.default.createElement(ExpandMore_1.default, null), className: EntityChangesGroup_module_css_1.default.entityHeader, classes: {
|
|
@@ -163,7 +179,7 @@ var EntityChangesGroup = function (_a) {
|
|
|
163
179
|
objectUri: (_e = item === null || item === void 0 ? void 0 : item.attributeValue) === null || _e === void 0 ? void 0 : _e.uri,
|
|
164
180
|
parentLineId: (_f = item.lineIds) === null || _f === void 0 ? void 0 : _f[0]
|
|
165
181
|
}) })),
|
|
166
|
-
allowAddAttributes && (0, helpers_1.isNestedOrReferenceParent)(item) && (react_1.default.createElement(editors_1.MoreAttributesEditor, { data: nestedAttrs, change: item, parent: item.attributeType, onApply: handleAddNestedAttributes(item) }))));
|
|
182
|
+
allowAddAttributes && (0, helpers_1.isNestedOrReferenceParent)(item) && (react_1.default.createElement(editors_1.MoreAttributesEditor, { data: nestedAttrs, change: item, parent: item.attributeType, onApply: handleAddNestedAttributes(item, objectUriByChangeIndex[index]) }))));
|
|
167
183
|
})))));
|
|
168
184
|
};
|
|
169
185
|
exports.EntityChangesGroup = EntityChangesGroup;
|
|
@@ -63,10 +63,13 @@ var getParentChangeOverrides = function (change) {
|
|
|
63
63
|
if (change.refAttributeType) {
|
|
64
64
|
var parts = change.refAttributeType.split('/');
|
|
65
65
|
if (parts.length > 2) {
|
|
66
|
-
|
|
66
|
+
var parentRefAttributeType = parts.slice(0, -2).join('/');
|
|
67
|
+
if (parentRefAttributeType.includes('/attributes/')) {
|
|
68
|
+
result.refAttributeType = parentRefAttributeType;
|
|
69
|
+
}
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
if (change.refObjectURI) {
|
|
72
|
+
if (result.refAttributeType && change.refObjectURI) {
|
|
70
73
|
result.refObjectURI = change.refObjectURI;
|
|
71
74
|
}
|
|
72
75
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
@@ -10,6 +10,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
23
|
exports.prepareChangesList = void 0;
|
|
15
24
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
@@ -130,23 +139,30 @@ var extractPathFromInnerChange = function (attributeValue) {
|
|
|
130
139
|
return __assign(__assign({ attributePath: inner.attributePath }, (inner.refAttributeType && { refAttributeType: inner.refAttributeType })), (inner.refObjectURI && { refObjectURI: inner.refObjectURI }));
|
|
131
140
|
};
|
|
132
141
|
var fillParentPaths = function (items) {
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
var _a, _b;
|
|
143
|
+
var result = __spreadArray([], items, true);
|
|
144
|
+
for (var index = result.length - 1; index >= 0; index--) {
|
|
145
|
+
var item = result[index];
|
|
135
146
|
if (!(0, helpers_1.isDiffChange)(item) || !(0, mdm_sdk_1.isComplexAttribute)(item.attributeType) || item.attributePath)
|
|
136
|
-
|
|
147
|
+
continue;
|
|
137
148
|
var innerPath = extractPathFromInnerChange(item.attributeValue);
|
|
138
|
-
if (innerPath)
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
if (innerPath) {
|
|
150
|
+
result[index] = __assign(__assign({}, item), innerPath);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
var name_1 = (_a = item.attributeType) === null || _a === void 0 ? void 0 : _a.name;
|
|
141
154
|
var instanceId = (_b = item.attributeValue) === null || _b === void 0 ? void 0 : _b.id;
|
|
142
|
-
if (!
|
|
143
|
-
|
|
144
|
-
var descendant = findDescendantWithPath(
|
|
155
|
+
if (!name_1 || !instanceId)
|
|
156
|
+
continue;
|
|
157
|
+
var descendant = findDescendantWithPath(result, index, item.level);
|
|
145
158
|
if (!descendant)
|
|
146
|
-
|
|
147
|
-
var parentPath = deriveParentPath(descendant,
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
continue;
|
|
160
|
+
var parentPath = deriveParentPath(descendant, name_1, instanceId);
|
|
161
|
+
if (parentPath) {
|
|
162
|
+
result[index] = __assign(__assign({}, item), parentPath);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
150
166
|
};
|
|
151
167
|
var prepareChangesList = function (rawChangesList) {
|
|
152
168
|
var withPaths = fillParentPaths(rawChangesList);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DCRTypes, type AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
+
import type { Diff } from '../../types';
|
|
3
|
+
export declare const referenceAttributeType: AttributeType;
|
|
4
|
+
export declare const referenceAttributeValue: {
|
|
5
|
+
id: string;
|
|
6
|
+
value: {
|
|
7
|
+
RefFirstLevelNested: {
|
|
8
|
+
id: string;
|
|
9
|
+
value: {
|
|
10
|
+
FirstLevelNestedSub2: {
|
|
11
|
+
id: string;
|
|
12
|
+
value: {
|
|
13
|
+
id: string;
|
|
14
|
+
refObjectURI: string;
|
|
15
|
+
type: DCRTypes;
|
|
16
|
+
objectType: string;
|
|
17
|
+
attributePath: string;
|
|
18
|
+
oldValue: {
|
|
19
|
+
value: string;
|
|
20
|
+
lineIds: string[];
|
|
21
|
+
};
|
|
22
|
+
newValue: {
|
|
23
|
+
value: string;
|
|
24
|
+
lineIds: string[];
|
|
25
|
+
};
|
|
26
|
+
attributeType: string;
|
|
27
|
+
refAttributeType: string;
|
|
28
|
+
lineIds: string[];
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
refObjectURI: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const affiliationsChangeRow: Diff;
|
|
37
|
+
export declare const deepNestedParentFromChildChanges: () => Diff[];
|
|
38
|
+
export declare const deepNestedInnerChangeRow: () => Diff[];
|
|
39
|
+
export declare const addressDeepNestedThreeLevelChanges: () => Diff[];
|
|
40
|
+
export declare const addressDeepNestedRefPropagationChanges: () => Diff[];
|
|
41
|
+
export declare const deepNestedRowWithExistingPath: () => Diff[];
|