@reltio/interactions 1.4.1585 → 1.4.1586-mui5
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/index.ts +1 -0
- package/package.json +38 -21
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +79 -0
- package/public/package.json +22 -0
- package/scripts/build/index.js +20 -0
- package/src/InteractionsTableView/InteractionsTable/InteractionsTable.tsx +87 -0
- package/src/InteractionsTableView/InteractionsTable/__tests__/InteractionsTable.test.js +146 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/ActorsRenderer.js +57 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/AttributesRenderer.js +50 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/BlobRenderer.js +14 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/DefaultCellValueRenderer.js +22 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/HeadCellRenderer.js +16 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/LinkRenderer.js +22 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/RowCellRenderer.js +31 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/ActorsRenderer.test.js +87 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/AttributesRenderer.test.js +118 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/DefaultCellValueRenderer.test.js +23 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/LinkRenderer.test.js +20 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/RowCellRenderer.test.js +53 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/styles.js +67 -0
- package/src/InteractionsTableView/InteractionsTable/helpers/__tests__/dataHelpers.spec.js +286 -0
- package/src/InteractionsTableView/InteractionsTable/helpers/dataHelpers.ts +120 -0
- package/src/InteractionsTableView/InteractionsTable/styles.ts +29 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/InteractionTypeSelector.tsx +26 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/__tests__/InteractionTypeSelector.test.js +34 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionsTableHeader.js +76 -0
- package/src/InteractionsTableView/InteractionsTableHeader/__tests__/InteractionsTableHeader.test.js +106 -0
- package/src/InteractionsTableView/InteractionsTableHeader/styles.js +21 -0
- package/src/InteractionsTableView/__tests__/InteractionsTableView.test.js +570 -0
- package/src/InteractionsTableView/__tests__/stateReducer.test.js +260 -0
- package/src/InteractionsTableView/helpers/__tests__/filtersHelper.test.js +221 -0
- package/src/InteractionsTableView/helpers/__tests__/tableHelper.test.js +300 -0
- package/src/InteractionsTableView/helpers/filtersHelpers.ts +18 -0
- package/src/InteractionsTableView/helpers/tableHelpers.ts +157 -0
- package/src/InteractionsTableView/hooks/useInteractions.ts +45 -0
- package/src/InteractionsTableView/index.tsx +200 -0
- package/src/InteractionsTableView/stateReducer.ts +132 -0
- package/src/InteractionsTableView/styles.ts +18 -0
- package/src/InteractionsTableView/types/index.ts +8 -0
- package/src/index.tsx +59 -0
- package/stories/Interactions.stories.js +31 -0
- package/stories/utils/entity.js +11 -0
- package/stories/utils/interactions.js +837 -0
- package/stories/utils/interactionsViewConfig.js +6 -0
- package/stories/utils/mdmStore.js +28 -0
- package/stories/utils/metadata.js +7221 -0
- package/tsconfig.json +4 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -36
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles({
|
|
4
|
+
tableContainer: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
display: 'flex',
|
|
7
|
+
fontFamily: 'Roboto',
|
|
8
|
+
color: 'rgba(0,0,0,0.54)'
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
'@global div[role=tooltip]': {
|
|
12
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif'
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
'@global div[role=presentation]': {
|
|
16
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif'
|
|
17
|
+
},
|
|
18
|
+
'row-cell__buttons-container': {
|
|
19
|
+
position: 'absolute'
|
|
20
|
+
},
|
|
21
|
+
'row-cell__buttons-wrapper': {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
paddingLeft: '10px',
|
|
24
|
+
'& > button': {
|
|
25
|
+
marginLeft: '-10px',
|
|
26
|
+
transform: 'scale(0.9)'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {InteractionType} from '@reltio/mdm-sdk';
|
|
3
|
+
import i18n from 'ui-i18n';
|
|
4
|
+
import {SelectorWithOnlyOptionAutoSelect} from '@reltio/components';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
interactionTypes: InteractionType[];
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
const InteractionTypeSelector = ({value, onChange, interactionTypes, className}: Props) => {
|
|
13
|
+
return (
|
|
14
|
+
<SelectorWithOnlyOptionAutoSelect
|
|
15
|
+
classes={{
|
|
16
|
+
root: className
|
|
17
|
+
}}
|
|
18
|
+
value={value}
|
|
19
|
+
onChange={onChange}
|
|
20
|
+
options={interactionTypes.map(({label, uri}) => ({label, value: uri}))}
|
|
21
|
+
emptyLabel={i18n.text('All interaction types')}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default InteractionTypeSelector;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import InteractionTypeSelector from '../InteractionTypeSelector';
|
|
5
|
+
|
|
6
|
+
describe('InteractionTypeSelector tests', () => {
|
|
7
|
+
it('should render SelectorWithOnlyOptionAutoSelect with correct props', () => {
|
|
8
|
+
const props = {
|
|
9
|
+
value: 'configuration/interactionTypes/1',
|
|
10
|
+
onChange: jest.fn(),
|
|
11
|
+
className: 'className',
|
|
12
|
+
interactionTypes: [
|
|
13
|
+
{
|
|
14
|
+
uri: 'configuration/interactionTypes/1',
|
|
15
|
+
label: 'First'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
uri: 'configuration/interactionTypes/2',
|
|
19
|
+
label: 'Second'
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
const wrapper = shallow(<InteractionTypeSelector {...props} />);
|
|
24
|
+
expect(wrapper.find('SelectorWithOnlyOptionAutoSelect').props()).toMatchObject({
|
|
25
|
+
value: props.value,
|
|
26
|
+
onChange: props.onChange,
|
|
27
|
+
classes: expect.objectContaining({
|
|
28
|
+
root: props.className
|
|
29
|
+
}),
|
|
30
|
+
options: props.interactionTypes.map(({uri, label}) => ({value: uri, label})),
|
|
31
|
+
emptyLabel: 'All interaction types'
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import i18n from 'ui-i18n';
|
|
6
|
+
import {
|
|
7
|
+
BasicViewHeader,
|
|
8
|
+
ColumnsDataType,
|
|
9
|
+
ColumnsSettings,
|
|
10
|
+
FilterButton,
|
|
11
|
+
HideOnShrink,
|
|
12
|
+
Spacer,
|
|
13
|
+
VerticalDivider
|
|
14
|
+
} from '@reltio/components';
|
|
15
|
+
import {useStyles} from './styles';
|
|
16
|
+
import InteractionTypeSelector from './InteractionTypeSelector/InteractionTypeSelector';
|
|
17
|
+
import {InteractionTypeType} from '@reltio/mdm-sdk';
|
|
18
|
+
|
|
19
|
+
const InteractionsTableHeader = ({
|
|
20
|
+
title,
|
|
21
|
+
total,
|
|
22
|
+
filtersEnabled,
|
|
23
|
+
onToggleFilters,
|
|
24
|
+
columnsData,
|
|
25
|
+
selectedColumns,
|
|
26
|
+
onChangeColumns,
|
|
27
|
+
interactionTypes,
|
|
28
|
+
currentInteractionType,
|
|
29
|
+
onInteractionTypeChange
|
|
30
|
+
}) => {
|
|
31
|
+
const styles = useStyles();
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<BasicViewHeader title={title} classes={{root: styles.header, title: styles.title}}>
|
|
35
|
+
{interactionTypes.length > 0 && (
|
|
36
|
+
<InteractionTypeSelector
|
|
37
|
+
className={styles.interactionTypeSelector}
|
|
38
|
+
value={currentInteractionType}
|
|
39
|
+
onChange={onInteractionTypeChange}
|
|
40
|
+
interactionTypes={interactionTypes}
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
<HideOnShrink widthToHide={500}>
|
|
44
|
+
<VerticalDivider height={28} margin={20} />
|
|
45
|
+
<Typography className={styles.totalCaption} variant="caption">
|
|
46
|
+
{total > 1
|
|
47
|
+
? i18n.text('${count} interactions', {count: total})
|
|
48
|
+
: i18n.text('${count} interaction', {count: total})}
|
|
49
|
+
</Typography>
|
|
50
|
+
</HideOnShrink>
|
|
51
|
+
<Spacer />
|
|
52
|
+
<FilterButton enabled={filtersEnabled} onClick={onToggleFilters} />
|
|
53
|
+
<VerticalDivider height={28} margin={4} />
|
|
54
|
+
<ColumnsSettings
|
|
55
|
+
columnsData={columnsData}
|
|
56
|
+
selectedColumns={selectedColumns}
|
|
57
|
+
onChangeColumns={onChangeColumns}
|
|
58
|
+
/>
|
|
59
|
+
</BasicViewHeader>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
InteractionsTableHeader.propTypes = {
|
|
64
|
+
title: PropTypes.string,
|
|
65
|
+
total: PropTypes.number,
|
|
66
|
+
columnsData: ColumnsDataType,
|
|
67
|
+
selectedColumns: PropTypes.arrayOf(PropTypes.string),
|
|
68
|
+
onChangeColumns: PropTypes.func,
|
|
69
|
+
filtersEnabled: PropTypes.bool,
|
|
70
|
+
onToggleFilters: PropTypes.func,
|
|
71
|
+
interactionTypes: PropTypes.arrayOf(InteractionTypeType),
|
|
72
|
+
currentInteractionType: PropTypes.string,
|
|
73
|
+
onInteractionTypeChange: PropTypes.func
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default InteractionsTableHeader;
|
package/src/InteractionsTableView/InteractionsTableHeader/__tests__/InteractionsTableHeader.test.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow} from 'enzyme';
|
|
3
|
+
import InteractionsTableHeader from '../InteractionsTableHeader';
|
|
4
|
+
import {BasicViewHeader} from '@reltio/components';
|
|
5
|
+
|
|
6
|
+
describe(' interaction table scenario', () => {
|
|
7
|
+
const title = 'Interactions';
|
|
8
|
+
const total = 10;
|
|
9
|
+
const columnsData = [
|
|
10
|
+
{
|
|
11
|
+
id: 'members',
|
|
12
|
+
label: 'Actors',
|
|
13
|
+
sortable: false,
|
|
14
|
+
filterable: false,
|
|
15
|
+
dataTypeDefinition: {
|
|
16
|
+
type: 'String'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'attributes.string',
|
|
21
|
+
label: 'String',
|
|
22
|
+
sortable: false,
|
|
23
|
+
filterable: false,
|
|
24
|
+
dataTypeDefinition: {
|
|
25
|
+
type: 'String',
|
|
26
|
+
uri: 'configuration/interactionTypes/Interacion/attributes/String'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
const selectedColumns = ['members'];
|
|
31
|
+
let interactionTypes, currentInteractionType;
|
|
32
|
+
|
|
33
|
+
it('should show correct header', () => {
|
|
34
|
+
interactionTypes = [
|
|
35
|
+
{
|
|
36
|
+
uri: 'configuration/interactionTypes/Interacion',
|
|
37
|
+
label: 'Interaction',
|
|
38
|
+
memberTypes: [],
|
|
39
|
+
hasMembers: false,
|
|
40
|
+
attributes: []
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
currentInteractionType = 'configuration/interactionTypes/Interacion';
|
|
44
|
+
const onInteractionTypeChange = jest.fn();
|
|
45
|
+
const wrapper = shallow(
|
|
46
|
+
<InteractionsTableHeader
|
|
47
|
+
title={title}
|
|
48
|
+
total={total}
|
|
49
|
+
filtersEnabled={false}
|
|
50
|
+
columnsData={columnsData}
|
|
51
|
+
selectedColumns={selectedColumns}
|
|
52
|
+
interactionTypes={interactionTypes}
|
|
53
|
+
currentInteractionType={currentInteractionType}
|
|
54
|
+
onInteractionTypeChange={onInteractionTypeChange}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
expect(wrapper.find(BasicViewHeader).prop('title')).toBe(title);
|
|
58
|
+
expect(wrapper.find('InteractionTypeSelector').props()).toMatchObject({
|
|
59
|
+
value: currentInteractionType,
|
|
60
|
+
interactionTypes,
|
|
61
|
+
onChange: onInteractionTypeChange
|
|
62
|
+
});
|
|
63
|
+
expect(wrapper.find('.totalCaption').text()).toBe('10 interactions');
|
|
64
|
+
expect(wrapper.find('FilterButton').prop('enabled')).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should show filters and correct string for 1 interaction', () => {
|
|
68
|
+
interactionTypes = [
|
|
69
|
+
{
|
|
70
|
+
uri: 'configuration/interactionTypes/Interacion',
|
|
71
|
+
label: 'Interaction',
|
|
72
|
+
memberTypes: [],
|
|
73
|
+
hasMembers: false,
|
|
74
|
+
attributes: []
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
currentInteractionType = 'configuration/interactionTypes/Interacion';
|
|
78
|
+
const wrapper = shallow(
|
|
79
|
+
<InteractionsTableHeader
|
|
80
|
+
title={title}
|
|
81
|
+
total={1}
|
|
82
|
+
filtersEnabled={true}
|
|
83
|
+
columnsData={columnsData}
|
|
84
|
+
selectedColumns={selectedColumns}
|
|
85
|
+
interactionTypes={interactionTypes}
|
|
86
|
+
currentInteractionType={currentInteractionType}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
expect(wrapper.find('FilterButton').prop('enabled')).toBe(true);
|
|
90
|
+
expect(wrapper.find('.totalCaption').text()).toBe('1 interaction');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should hide interaction type selector if interaction types are empty', () => {
|
|
94
|
+
const wrapper = shallow(
|
|
95
|
+
<InteractionsTableHeader
|
|
96
|
+
title={title}
|
|
97
|
+
total={1}
|
|
98
|
+
filtersEnabled={true}
|
|
99
|
+
columnsData={columnsData}
|
|
100
|
+
selectedColumns={selectedColumns}
|
|
101
|
+
interactionTypes={[]}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
expect(wrapper.find('InteractionTypeSelector').length).toBe(0);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {makeStyles} from '@mui/styles';
|
|
2
|
+
|
|
3
|
+
export const useStyles = makeStyles({
|
|
4
|
+
header: {
|
|
5
|
+
'& > button': {
|
|
6
|
+
margin: '0 -2px'
|
|
7
|
+
},
|
|
8
|
+
paddingRight: '15px'
|
|
9
|
+
},
|
|
10
|
+
totalCaption: {
|
|
11
|
+
lineHeight: 'inherit',
|
|
12
|
+
fontSize: '14px',
|
|
13
|
+
color: 'rgba(0,0,0,0.6)',
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
marginRight: '5px'
|
|
16
|
+
},
|
|
17
|
+
interactionTypeSelector: {
|
|
18
|
+
margin: '3px 10px 0 30px',
|
|
19
|
+
overflow: 'hidden'
|
|
20
|
+
}
|
|
21
|
+
});
|