@reltio/components 1.4.2231 → 1.4.2233
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/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +24 -12
- package/SimpleAttribute/SimpleAttribute.js +3 -2
- package/SyncedValueHeight/ValueHeightConsumer.js +12 -0
- package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +12 -6
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +23 -11
- package/cjs/SimpleAttribute/SimpleAttribute.js +3 -2
- package/cjs/SyncedValueHeight/ValueHeightConsumer.js +39 -0
- package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +11 -5
- package/cjs/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
- package/cjs/contexts/{ExpandedAttributesContext → AutoExpandedAttributesContext}/index.js +8 -8
- package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +3 -3
- package/cjs/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
- package/cjs/contexts/SyncedExpandedAttributesContext/index.js +56 -0
- package/{features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → cjs/contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
- package/cjs/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +10 -15
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +93 -34
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +290 -56
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +32 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +60 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +5 -64
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +94 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
- package/cjs/features/crosswalks/AttributesTable/helpers.js +82 -56
- package/cjs/features/crosswalks/AttributesTable/helpers.test.js +539 -360
- package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -10
- package/cjs/features/crosswalks/AttributesTable/types.js +6 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +4 -4
- package/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
- package/contexts/AutoExpandedAttributesContext/index.js +11 -0
- package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +4 -4
- package/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
- package/contexts/SyncedExpandedAttributesContext/index.js +28 -0
- package/{cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
- package/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +9 -13
- package/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +91 -32
- package/features/crosswalks/AttributesTable/AttributesTable.test.js +291 -57
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +25 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +30 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +6 -65
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +64 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
- package/features/crosswalks/AttributesTable/helpers.js +82 -55
- package/features/crosswalks/AttributesTable/helpers.test.js +540 -361
- package/features/crosswalks/AttributesTable/types.d.ts +17 -10
- package/features/crosswalks/AttributesTable/types.js +5 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/cjs/contexts/ExpandedAttributesContext/index.d.ts +0 -8
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -15
- package/contexts/ExpandedAttributesContext/index.d.ts +0 -8
- package/contexts/ExpandedAttributesContext/index.js +0 -11
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -8
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightConsumer.d.ts +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.d.ts +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightConsumer.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightReporter.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/index.d.ts +0 -0
- /package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
- /package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
- /package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
|
@@ -10,7 +10,7 @@ import { IgnoreButton } from '../IgnoreButton';
|
|
|
10
10
|
import { DeleteButton } from '../DeleteButton';
|
|
11
11
|
import { useDidUpdateEffect } from '../hooks/useDidUpdateEffect';
|
|
12
12
|
import { useAttributeState } from '../hooks/useAttributeState';
|
|
13
|
-
import {
|
|
13
|
+
import { useAttributeAutoExpanded } from '../contexts/AutoExpandedAttributesContext';
|
|
14
14
|
import { useStyles } from './styles';
|
|
15
15
|
export var InlineComplexAttribute = function (_a) {
|
|
16
16
|
var attributeType = _a.attributeType, attributeValue = _a.attributeValue, attributeTypesList = _a.attributeTypesList, label = _a.label, crosswalksMap = _a.crosswalksMap, disableEdit = _a.disableEdit, disableDelete = _a.disableDelete, onPin = _a.onPin, onIgnore = _a.onIgnore, onDelete = _a.onDelete, onEdit = _a.onEdit, onAdd = _a.onAdd, emptyTempAttributeUris = _a.emptyTempAttributeUris;
|
|
@@ -22,7 +22,7 @@ export var InlineComplexAttribute = function (_a) {
|
|
|
22
22
|
var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
|
|
23
23
|
var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
|
|
24
24
|
var showDelete = !isReadingMode && canDelete;
|
|
25
|
-
var expandedFromContext =
|
|
25
|
+
var expandedFromContext = useAttributeAutoExpanded(attributeValue.uri);
|
|
26
26
|
var _c = useState(expandedFromContext || isTemporary), expanded = _c[0], setExpanded = _c[1];
|
|
27
27
|
useDidUpdateEffect(function () {
|
|
28
28
|
if (expandedFromContext)
|
|
@@ -51,12 +51,12 @@ import userEvent from '@testing-library/user-event';
|
|
|
51
51
|
import { DndContext } from '@dnd-kit/core';
|
|
52
52
|
import { createNewAttribute } from '@reltio/mdm-sdk';
|
|
53
53
|
import { ComplexAttributeLabel } from '../ComplexAttributeLabel';
|
|
54
|
-
import {
|
|
54
|
+
import { useAttributeAutoExpanded } from '../contexts/AutoExpandedAttributesContext';
|
|
55
55
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
56
56
|
import { getMuiIconByName } from '../test-utils';
|
|
57
57
|
import { InlineComplexAttribute } from './InlineComplexAttribute';
|
|
58
|
-
jest.mock('../contexts/
|
|
59
|
-
|
|
58
|
+
jest.mock('../contexts/AutoExpandedAttributesContext', function () { return ({
|
|
59
|
+
useAttributeAutoExpanded: jest.fn()
|
|
60
60
|
}); });
|
|
61
61
|
var attributeType = {
|
|
62
62
|
uri: 'configuration/entityTypes/HCP/attributes/Nested',
|
|
@@ -142,7 +142,7 @@ var setUp = function (props) {
|
|
|
142
142
|
describe('InlineComplexAttribute tests', function () {
|
|
143
143
|
beforeEach(function () {
|
|
144
144
|
jest.clearAllMocks();
|
|
145
|
-
|
|
145
|
+
useAttributeAutoExpanded.mockReturnValue(false);
|
|
146
146
|
});
|
|
147
147
|
it('should render correctly', function () {
|
|
148
148
|
setUp();
|
|
@@ -400,7 +400,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
400
400
|
});
|
|
401
401
|
}); });
|
|
402
402
|
it('should render temporary attribute expanded by default', function () {
|
|
403
|
-
|
|
403
|
+
useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
404
404
|
setUp();
|
|
405
405
|
expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
|
|
406
406
|
expect(screen.getByTestId('branch-decorator')).toBeInTheDocument();
|
|
@@ -412,7 +412,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
412
412
|
return __generator(this, function (_a) {
|
|
413
413
|
switch (_a.label) {
|
|
414
414
|
case 0:
|
|
415
|
-
|
|
415
|
+
useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
416
416
|
user = setUp({ attributeValue: createNewAttribute({ attributeType: attributeType, parentUri: 'entities/1' }) }).user;
|
|
417
417
|
return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
|
|
418
418
|
case 1:
|
|
@@ -427,7 +427,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
427
427
|
});
|
|
428
428
|
}); });
|
|
429
429
|
it('should render attribute expanded by default if it is expanded via context', function () {
|
|
430
|
-
|
|
430
|
+
useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
431
431
|
setUp();
|
|
432
432
|
expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
|
|
433
433
|
expect(screen.getByTestId('branch-decorator')).toBeInTheDocument();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, Entity, Relation } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, Entity, Relation, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
entity: Partial<Entity> | Partial<Relation>;
|
|
@@ -12,9 +12,12 @@ type Props = {
|
|
|
12
12
|
fixedTypeUris?: string[];
|
|
13
13
|
showNonOv?: boolean;
|
|
14
14
|
classes?: ReadOnlyAttributeClasses;
|
|
15
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
16
|
+
ovDetails: OvDetails;
|
|
17
|
+
}) => React.ReactElement;
|
|
15
18
|
};
|
|
16
19
|
declare const _default: React.MemoExoticComponent<{
|
|
17
|
-
({ attrTypes, entity, parentUri, drawLines, children, className, max, fixedTypeUris, showNonOv, classes }: Props): React.JSX.Element;
|
|
20
|
+
({ attrTypes, entity, parentUri, drawLines, children, className, max, fixedTypeUris, showNonOv, classes, FallbackSlot }: Props): React.JSX.Element;
|
|
18
21
|
displayName: string;
|
|
19
22
|
}>;
|
|
20
23
|
export default _default;
|
|
@@ -21,7 +21,7 @@ import { splitPagersData } from '../helpers/attributesView';
|
|
|
21
21
|
import { HiddenAttributesContext } from '../contexts/HiddenAttributesContext';
|
|
22
22
|
import { AlwaysVisibleAttributesContext } from '../contexts/AlwaysVisibleAttributesContext';
|
|
23
23
|
var ReadOnlyAttributesList = function (_a) {
|
|
24
|
-
var _b = _a.attrTypes, attrTypes = _b === void 0 ? [] : _b, entity = _a.entity, parentUri = _a.parentUri, drawLines = _a.drawLines, children = _a.children, className = _a.className, max = _a.max, _c = _a.fixedTypeUris, fixedTypeUris = _c === void 0 ? FIXED_TYPE_URIS : _c, showNonOv = _a.showNonOv, classes = _a.classes;
|
|
24
|
+
var _b = _a.attrTypes, attrTypes = _b === void 0 ? [] : _b, entity = _a.entity, parentUri = _a.parentUri, drawLines = _a.drawLines, children = _a.children, className = _a.className, max = _a.max, _c = _a.fixedTypeUris, fixedTypeUris = _c === void 0 ? FIXED_TYPE_URIS : _c, showNonOv = _a.showNonOv, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
25
25
|
var hiddenAttributes = useContext(HiddenAttributesContext);
|
|
26
26
|
var alwaysVisibleAttributes = useContext(AlwaysVisibleAttributesContext);
|
|
27
27
|
var entityUri = parentUri && getBaseUri(parentUri);
|
|
@@ -46,7 +46,7 @@ var ReadOnlyAttributesList = function (_a) {
|
|
|
46
46
|
children && React.createElement(BranchDecorator, __assign({}, decoratorProps), children),
|
|
47
47
|
visibleAttributePagersData.concat(fixedPagersData).map(function (_a) {
|
|
48
48
|
var attrType = _a.attrType, values = _a.values;
|
|
49
|
-
return (React.createElement(ReadOnlyAttributesPager, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: path(['paging', attrType.uri], entity.attributes), parentUri: parentUri, showNonOv: showNonOv, classes: classes }));
|
|
49
|
+
return (React.createElement(ReadOnlyAttributesPager, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: path(['paging', attrType.uri], entity.attributes), parentUri: parentUri, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
50
50
|
}),
|
|
51
51
|
showMore && React.createElement(ShowMore, { onClick: onShowMore }),
|
|
52
52
|
showLess && React.createElement(ShowLess, { onClick: onShowLess })));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, ImageAttributeValue, AttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, ImageAttributeValue, AttributeValue, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
values: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue | string | number | ImageAttributeValue | AttributeValue)[];
|
|
@@ -10,6 +10,9 @@ type Props = {
|
|
|
10
10
|
max?: number;
|
|
11
11
|
showNonOv?: boolean;
|
|
12
12
|
classes?: ReadOnlyAttributeClasses;
|
|
13
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
14
|
+
ovDetails: OvDetails;
|
|
15
|
+
}) => React.ReactElement;
|
|
13
16
|
};
|
|
14
|
-
declare const _default: React.MemoExoticComponent<({ values, attributeType, drawLines, paging, parentUri, max: maxProp, showNonOv, classes }: Props) => React.JSX.Element>;
|
|
17
|
+
declare const _default: React.MemoExoticComponent<({ values, attributeType, drawLines, paging, parentUri, max: maxProp, showNonOv, classes, FallbackSlot }: Props) => React.JSX.Element>;
|
|
15
18
|
export default _default;
|
|
@@ -32,7 +32,7 @@ var RENDERER_TYPES = {
|
|
|
32
32
|
var ReadOnlyAttributesPager = function (_a) {
|
|
33
33
|
var _b, _c, _d, _e;
|
|
34
34
|
var _f;
|
|
35
|
-
var values = _a.values, attributeType = _a.attributeType, drawLines = _a.drawLines, _g = _a.paging, paging = _g === void 0 ? {} : _g, parentUri = _a.parentUri, maxProp = _a.max, showNonOv = _a.showNonOv, classes = _a.classes;
|
|
35
|
+
var values = _a.values, attributeType = _a.attributeType, drawLines = _a.drawLines, _g = _a.paging, paging = _g === void 0 ? {} : _g, parentUri = _a.parentUri, maxProp = _a.max, showNonOv = _a.showNonOv, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
36
36
|
var styles = useStyles();
|
|
37
37
|
var requestNextPageOfAttributeValues = useMdmAction('requestNextPageOfAttributeValues');
|
|
38
38
|
var maxValuesInResponse = useMdmMaxValuesInResponse();
|
|
@@ -63,9 +63,9 @@ var ReadOnlyAttributesPager = function (_a) {
|
|
|
63
63
|
])(attributeType);
|
|
64
64
|
switch (type) {
|
|
65
65
|
case RENDERER_TYPES.oneLine:
|
|
66
|
-
return (React.createElement(OneLineRenderer, { value: visibleValues[0], nonVisibleValues: nonVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, showNonOv: showNonOv, classes: classes }));
|
|
66
|
+
return (React.createElement(OneLineRenderer, { value: visibleValues[0], nonVisibleValues: nonVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
67
67
|
case RENDERER_TYPES.multiLine:
|
|
68
|
-
return (React.createElement(MultiLineRenderer, { values: visibleValues, nonVisibleValues: nonVisibleValues, totalVisibleValues: totalVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, parentUri: parentUri, max: max, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, classes: classes }));
|
|
68
|
+
return (React.createElement(MultiLineRenderer, { values: visibleValues, nonVisibleValues: nonVisibleValues, totalVisibleValues: totalVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, parentUri: parentUri, max: max, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
69
69
|
case RENDERER_TYPES.imageLine:
|
|
70
70
|
return (React.createElement(ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, parentUri: parentUri, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }));
|
|
71
71
|
case RENDERER_TYPES.special:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue, RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue, RequestNextPageOfAttributeValuesPayload, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
max: number;
|
|
@@ -12,6 +12,9 @@ type Props = {
|
|
|
12
12
|
requestNextPageOfAttributeValues: (payload: RequestNextPageOfAttributeValuesPayload) => void;
|
|
13
13
|
showNonOv: boolean;
|
|
14
14
|
classes?: ReadOnlyAttributeClasses;
|
|
15
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
16
|
+
ovDetails: OvDetails;
|
|
17
|
+
}) => React.ReactElement;
|
|
15
18
|
};
|
|
16
|
-
export declare const MultiLineRenderer: ({ max, values, nonVisibleValues, totalVisibleValues, attributeType, parentUri, requestNextPageOfAttributeValues, showNonOv, totalNonVisibleValues, classes }: Props) => React.JSX.Element;
|
|
19
|
+
export declare const MultiLineRenderer: ({ max, values, nonVisibleValues, totalVisibleValues, attributeType, parentUri, requestNextPageOfAttributeValues, showNonOv, totalNonVisibleValues, classes, FallbackSlot }: Props) => React.JSX.Element;
|
|
17
20
|
export {};
|
|
@@ -13,9 +13,10 @@ import { ControlAttributeIcon } from '../../../ControlAttributeIcon';
|
|
|
13
13
|
import { useMdmControlAttributes, useMdmMetadata, useMdmShowMasking } from '../../../contexts/MdmModuleContext';
|
|
14
14
|
import { AttributesVerificationContext } from '../../../contexts/AttributesVerificationContext';
|
|
15
15
|
import { VerificationButton } from '../../../VerificationButton/VerificationButton';
|
|
16
|
+
import { ValueHeightReporter } from '../../../SyncedValueHeight';
|
|
16
17
|
import { useMultiLineStyles } from '../../styles';
|
|
17
18
|
export var MultiLineRenderer = function (_a) {
|
|
18
|
-
var max = _a.max, values = _a.values, nonVisibleValues = _a.nonVisibleValues, totalVisibleValues = _a.totalVisibleValues, attributeType = _a.attributeType, parentUri = _a.parentUri, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes;
|
|
19
|
+
var max = _a.max, values = _a.values, nonVisibleValues = _a.nonVisibleValues, totalVisibleValues = _a.totalVisibleValues, attributeType = _a.attributeType, parentUri = _a.parentUri, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
19
20
|
var styles = useMultiLineStyles();
|
|
20
21
|
var _b = useState(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
|
|
21
22
|
var isVerificationAttribute = useContextSelector(AttributesVerificationContext, function (context) { return (context === null || context === void 0 ? void 0 : context.isVerificationAttribute) || F; });
|
|
@@ -50,14 +51,17 @@ export var MultiLineRenderer = function (_a) {
|
|
|
50
51
|
var shownValues = values.slice(0, visibleValuesCount);
|
|
51
52
|
var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
|
|
52
53
|
var showVerificationButton = isVerificationAttribute(attributeType);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
React.createElement(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
var blockUri = parentUri ? "".concat(parentUri, "/").concat(attributeType.uri) : attributeType.uri;
|
|
55
|
+
return (React.createElement(ValueHeightReporter, { uri: blockUri },
|
|
56
|
+
React.createElement("div", { "data-reltio-id": "multi-line-renderer", className: styles.wrapper },
|
|
57
|
+
React.createElement("div", { className: styles.titleRow },
|
|
58
|
+
React.createElement(AttributeTitle, { label: label, className: classnames(styles.title, classes === null || classes === void 0 ? void 0 : classes.title), "data-reltio-id": "reltio-attribute-label" }),
|
|
59
|
+
React.createElement(DescriptionIcon, { description: description }),
|
|
60
|
+
isControlAttribute && React.createElement(ControlAttributeIcon, null),
|
|
61
|
+
React.createElement(OvIcon, { nonOvValues: nonVisibleValues, attributeType: attributeType, className: styles.ovIcon, nonOvTotal: totalNonVisibleValues }),
|
|
62
|
+
showVerificationButton && React.createElement(VerificationButton, { attributeType: attributeType })),
|
|
63
|
+
React.createElement("div", { className: styles.attributes }, shownValues.map(function (value) { return (React.createElement(ValueHeightReporter, { key: value.uri, uri: value.uri },
|
|
64
|
+
React.createElement(ReadOnlyAttribute, { className: classnames(styles.attribute, classes === null || classes === void 0 ? void 0 : classes.content), attributeValue: value, attributeType: attributeType, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }))); })),
|
|
65
|
+
showMore && (React.createElement(ShowMore, { moreNumber: min(max, hiddenValuesCount), valueNumber: hiddenValuesCount, onClick: onShowMore })),
|
|
66
|
+
showLess && React.createElement(ShowLess, { onClick: onShowLess }))));
|
|
63
67
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, AttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, AttributeValue, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../../..';
|
|
4
4
|
type Props = {
|
|
5
5
|
value: AttributeValue;
|
|
@@ -8,6 +8,9 @@ type Props = {
|
|
|
8
8
|
showNonOv?: boolean;
|
|
9
9
|
totalNonVisibleValues: number;
|
|
10
10
|
classes?: ReadOnlyAttributeClasses;
|
|
11
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
12
|
+
ovDetails: OvDetails;
|
|
13
|
+
}) => React.ReactElement;
|
|
11
14
|
};
|
|
12
|
-
export declare const OneLineRenderer: ({ value, nonVisibleValues, attributeType, showNonOv, totalNonVisibleValues, classes }: Props) => React.JSX.Element;
|
|
15
|
+
export declare const OneLineRenderer: ({ value, nonVisibleValues, attributeType, showNonOv, totalNonVisibleValues, classes, FallbackSlot }: Props) => React.JSX.Element;
|
|
13
16
|
export {};
|
|
@@ -9,22 +9,24 @@ import { DescriptionIcon } from '../../../DescriptionIcon';
|
|
|
9
9
|
import { ReadOnlyAttribute } from '../../../ReadOnlyAttributesFactory';
|
|
10
10
|
import { ControlAttributeIcon } from '../../../ControlAttributeIcon';
|
|
11
11
|
import { useMdmControlAttributes } from '../../../contexts/MdmModuleContext';
|
|
12
|
+
import { ValueHeightReporter } from '../../../SyncedValueHeight';
|
|
12
13
|
import { useOneLineStyles } from '../../styles';
|
|
13
14
|
export var OneLineRenderer = function (_a) {
|
|
14
|
-
var value = _a.value, nonVisibleValues = _a.nonVisibleValues, attributeType = _a.attributeType, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes;
|
|
15
|
+
var value = _a.value, nonVisibleValues = _a.nonVisibleValues, attributeType = _a.attributeType, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
15
16
|
var styles = useOneLineStyles();
|
|
16
17
|
var label = attributeType.label, description = attributeType.description;
|
|
17
18
|
var controlAttributes = useMdmControlAttributes();
|
|
18
19
|
var isControlAttribute = useMemo(function () { return controlAttributes.includes(attributeType.uri); }, [controlAttributes, attributeType.uri]);
|
|
19
20
|
var objectType = getObjectTypeByAttributeUri(value.uri);
|
|
20
|
-
return (React.createElement(
|
|
21
|
-
React.createElement("div", { className: classnames(styles.
|
|
22
|
-
React.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
return (React.createElement(ValueHeightReporter, { uri: value.uri },
|
|
22
|
+
React.createElement("div", { "data-reltio-id": "one-line-renderer", className: classnames(styles.collaborationWrapper, COMMENTS_CONTAINER_VISIBILITY_AREA) },
|
|
23
|
+
React.createElement("div", { className: classnames(styles.titleRow, styles.wrapper) },
|
|
24
|
+
React.createElement(AttributeTitle, { label: label, className: classnames(styles.title, classes === null || classes === void 0 ? void 0 : classes.title), "data-reltio-id": "reltio-attribute-label" }),
|
|
25
|
+
React.createElement(DescriptionIcon, { description: description, className: styles.descriptionIcon }),
|
|
26
|
+
isControlAttribute && React.createElement(ControlAttributeIcon, null),
|
|
27
|
+
React.createElement(OvIcon, { nonOvValues: nonVisibleValues, attributeType: attributeType, className: styles.ovIcon, nonOvTotal: totalNonVisibleValues }),
|
|
28
|
+
React.createElement(ReadOnlyAttribute, { className: classnames(styles.attribute, classes === null || classes === void 0 ? void 0 : classes.content), attributeValue: value, attributeType: attributeType, showNonOv: showNonOv, inlined: true, classes: classes, FallbackSlot: FallbackSlot })),
|
|
29
|
+
React.createElement(CommentsContainer, { uri: value.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
|
|
30
|
+
uri: value.uri
|
|
31
|
+
}), objectType: objectType }))));
|
|
30
32
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { AttributeType, ComplexAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, ComplexAttributeValue, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { AdditionalControlsRenderer, ReadOnlyAttributeClasses } from '../types';
|
|
4
4
|
export type ReadOnlyComplexAttributeProps<T> = {
|
|
5
5
|
attributeTypesList?: AttributeType[];
|
|
@@ -12,5 +12,8 @@ export type ReadOnlyComplexAttributeProps<T> = {
|
|
|
12
12
|
classes?: ReadOnlyAttributeClasses;
|
|
13
13
|
LabelRenderer?: (props: AdditionalControlsRenderer<ComplexAttributeValue>) => ReactElement;
|
|
14
14
|
RightSlot?: (props: AdditionalControlsRenderer<ComplexAttributeValue>) => ReactElement;
|
|
15
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
16
|
+
ovDetails: OvDetails;
|
|
17
|
+
}) => ReactElement;
|
|
15
18
|
};
|
|
16
|
-
export declare const ReadOnlyComplexAttribute: <T extends ComplexAttributeValue>({ attributeTypesList, attributeValue, label, expanded: expandedProp, children, showNonOv, attributeType, classes, LabelRenderer, RightSlot }: ReadOnlyComplexAttributeProps<T>) => React.JSX.Element;
|
|
19
|
+
export declare const ReadOnlyComplexAttribute: <T extends ComplexAttributeValue>({ attributeTypesList, attributeValue, label, expanded: expandedProp, children, showNonOv, attributeType, classes, LabelRenderer, RightSlot, FallbackSlot }: ReadOnlyComplexAttributeProps<T>) => React.JSX.Element;
|
|
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import React, { useContext, useEffect, useMemo, useState, useCallback } from 'react';
|
|
13
13
|
import { F } from 'ramda';
|
|
14
14
|
import classnames from 'classnames';
|
|
15
15
|
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
@@ -22,35 +22,47 @@ import { HighlightedValuesContext } from '../contexts/HighlightedValuesContext';
|
|
|
22
22
|
import { AttributesVerificationContext } from '../contexts/AttributesVerificationContext';
|
|
23
23
|
import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../constants/classnames';
|
|
24
24
|
import { AttributeVerificationStatus } from '../AttributeVerificationStatus/AttributeVerificationStatus';
|
|
25
|
+
import { useSyncedExpandedAttributes } from '../contexts/SyncedExpandedAttributesContext';
|
|
25
26
|
import styles from './ReadOnlyComplexAttribute.module.css';
|
|
26
27
|
export var ReadOnlyComplexAttribute = function (_a) {
|
|
27
28
|
var _b;
|
|
28
|
-
var attributeTypesList = _a.attributeTypesList, attributeValue = _a.attributeValue, label = _a.label, _c = _a.expanded, expandedProp = _c === void 0 ? false : _c, children = _a.children, showNonOv = _a.showNonOv, attributeType = _a.attributeType, classes = _a.classes, LabelRenderer = _a.LabelRenderer, RightSlot = _a.RightSlot;
|
|
29
|
+
var attributeTypesList = _a.attributeTypesList, attributeValue = _a.attributeValue, label = _a.label, _c = _a.expanded, expandedProp = _c === void 0 ? false : _c, children = _a.children, showNonOv = _a.showNonOv, attributeType = _a.attributeType, classes = _a.classes, LabelRenderer = _a.LabelRenderer, RightSlot = _a.RightSlot, FallbackSlot = _a.FallbackSlot;
|
|
29
30
|
var uri = attributeValue.uri;
|
|
30
31
|
var _d = useState(false), expanded = _d[0], setExpanded = _d[1];
|
|
31
32
|
var _e = useContext(HighlightedValuesContext), _f = _e.highlightedValuesUris, highlightedValuesUris = _f === void 0 ? [] : _f, highlightedClassName = _e.highlightedClassName;
|
|
33
|
+
var expandedContext = useSyncedExpandedAttributes();
|
|
32
34
|
useEffect(function () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
if (!expandedContext) {
|
|
36
|
+
setExpanded(expandedProp);
|
|
37
|
+
}
|
|
38
|
+
}, [expandedProp, expandedContext]);
|
|
35
39
|
var hasAnalyticValue = (attributeTypesList || []).some(function (attributeType) { return isAnalyticAttribute(attributeType); });
|
|
36
40
|
var attributeListEntity = useMemo(function () { return (__assign({ attributes: hasAnalyticValue ? null : attributeValue.value, analyticsAttributes: hasAnalyticValue ? attributeValue.value : null }, (isSpecialAttribute(attributeType) ? attributeValue.value : {}))); }, [attributeValue, hasAnalyticValue, attributeType]);
|
|
37
41
|
var isVerificationAttribute = useContextSelector(AttributesVerificationContext, function (context) { return (context === null || context === void 0 ? void 0 : context.isVerificationAttribute) || F; });
|
|
38
|
-
var objectType = getObjectTypeByAttributeUri(
|
|
42
|
+
var objectType = getObjectTypeByAttributeUri(uri);
|
|
39
43
|
var showVerificationStatus = isVerificationAttribute(attributeType);
|
|
44
|
+
var actualExpanded = expandedContext ? expandedContext.isExpanded(uri) : expanded;
|
|
45
|
+
var handleToggle = useCallback(function () {
|
|
46
|
+
if (expandedContext) {
|
|
47
|
+
expandedContext.toggle(uri);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setExpanded(function (value) { return !value; });
|
|
51
|
+
}
|
|
52
|
+
}, [expandedContext, uri]);
|
|
40
53
|
return (React.createElement("div", { className: styles.complexContainer },
|
|
41
54
|
React.createElement("div", { className: classnames(styles.labelContainer, COMMENTS_CONTAINER_VISIBILITY_AREA) },
|
|
42
|
-
React.createElement(ArrowExpandButton, { onClick:
|
|
55
|
+
React.createElement(ArrowExpandButton, { onClick: handleToggle, expanded: actualExpanded }),
|
|
43
56
|
LabelRenderer ? (React.createElement(LabelRenderer, { attributeType: attributeType, attributeValue: attributeValue })) : (React.createElement(React.Fragment, null,
|
|
44
57
|
React.createElement(Typography, { component: "span", variant: "body2", classes: { body2: styles.label }, className: classnames((_b = {},
|
|
45
|
-
_b[highlightedClassName] = highlightedValuesUris.includes(
|
|
58
|
+
_b[highlightedClassName] = highlightedValuesUris.includes(uri),
|
|
46
59
|
_b[styles.ovFalse] = !isOv(attributeValue),
|
|
47
60
|
_b)), "data-reltio-id": "reltio-attribute-complex-label" },
|
|
48
61
|
label,
|
|
49
|
-
showVerificationStatus && (React.createElement(AttributeVerificationStatus, { attributeType: attributeType, attributeValue: attributeValue }))
|
|
62
|
+
showVerificationStatus && (React.createElement(AttributeVerificationStatus, { attributeType: attributeType, attributeValue: attributeValue })),
|
|
63
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && (React.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))),
|
|
50
64
|
React.createElement("div", { className: styles.spacer }),
|
|
51
65
|
RightSlot && React.createElement(RightSlot, { attributeType: attributeType, attributeValue: attributeValue }),
|
|
52
|
-
React.createElement(CommentsContainer, { uri:
|
|
53
|
-
|
|
54
|
-
}), objectType: objectType })))),
|
|
55
|
-
expanded && (React.createElement(ReadOnlyAttributesList, { attrTypes: attributeTypesList, entity: attributeListEntity, drawLines: true, parentUri: uri, showNonOv: showNonOv, classes: classes }, children))));
|
|
66
|
+
React.createElement(CommentsContainer, { uri: uri, relatedObjectUris: createRelatedObjectUris(objectType, { uri: uri }), objectType: objectType })))),
|
|
67
|
+
actualExpanded && (React.createElement(ReadOnlyAttributesList, { attrTypes: attributeTypesList, entity: attributeListEntity, drawLines: true, parentUri: uri, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }, children))));
|
|
56
68
|
};
|
|
@@ -40,14 +40,15 @@ export var SimpleAttribute = function (_a) {
|
|
|
40
40
|
_d[styles.ovFalse] = !isOv(attributeValue),
|
|
41
41
|
_d)), "data-reltio-id": "reltio-attribute-value" },
|
|
42
42
|
dataTypeValue,
|
|
43
|
-
unmaskingControl
|
|
43
|
+
unmaskingControl,
|
|
44
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && React.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))))) : (React.createElement("div", { "data-reltio-id": "comments-container-visibility-area", style: variableStyles, className: classnames(className, styles.root, COMMENTS_CONTAINER_VISIBILITY_AREA, (_e = {},
|
|
44
45
|
_e[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
|
|
45
46
|
_e)) },
|
|
46
47
|
React.createElement(PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri },
|
|
47
48
|
React.createElement("span", { className: classnames(styles.attributeValue, (_f = {}, _f[styles.ovFalse] = !isOv(attributeValue), _f)), "data-reltio-id": "reltio-attribute-value" },
|
|
48
49
|
dataTypeValue,
|
|
49
50
|
unmaskingControl,
|
|
50
|
-
FallbackSlot &&
|
|
51
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && React.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))),
|
|
51
52
|
React.createElement(CommentsContainer, { className: styles.commentsContainer, uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
|
|
52
53
|
uri: attributeValue.uri
|
|
53
54
|
}), objectType: objectType })));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { SyncedValueHeightsContext } from '../contexts/SyncedValueHeightsContext';
|
|
3
|
+
export var ValueHeightConsumer = function (_a) {
|
|
4
|
+
var uri = _a.uri, children = _a.children;
|
|
5
|
+
var context = useContext(SyncedValueHeightsContext);
|
|
6
|
+
if (!context) {
|
|
7
|
+
return React.createElement(React.Fragment, null, children);
|
|
8
|
+
}
|
|
9
|
+
var getHeight = context.getHeight;
|
|
10
|
+
var height = getHeight(uri);
|
|
11
|
+
return React.createElement("div", { style: height !== undefined ? { height: height } : undefined }, children);
|
|
12
|
+
};
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import React, { useCallback, useLayoutEffect, useRef } from 'react';
|
|
1
|
+
import React, { useCallback, useContext, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import ReactResizeDetector from 'react-resize-detector';
|
|
3
|
-
import {
|
|
3
|
+
import { SyncedValueHeightsContext } from '../contexts/SyncedValueHeightsContext';
|
|
4
4
|
export var ValueHeightReporter = function (_a) {
|
|
5
5
|
var uri = _a.uri, children = _a.children;
|
|
6
|
-
var
|
|
6
|
+
var context = useContext(SyncedValueHeightsContext);
|
|
7
|
+
var reportHeight = context === null || context === void 0 ? void 0 : context.reportHeight;
|
|
7
8
|
var contentRef = useRef(null);
|
|
8
9
|
var lastHeightRef = useRef();
|
|
9
10
|
var report = useCallback(function () {
|
|
10
11
|
var _a;
|
|
12
|
+
if (!reportHeight)
|
|
13
|
+
return;
|
|
11
14
|
var height = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
12
|
-
if (
|
|
15
|
+
if (height === undefined || height === lastHeightRef.current)
|
|
13
16
|
return;
|
|
14
17
|
lastHeightRef.current = height;
|
|
15
18
|
reportHeight(uri, height);
|
|
16
|
-
}, [reportHeight, uri
|
|
19
|
+
}, [reportHeight, uri]);
|
|
17
20
|
useLayoutEffect(function () {
|
|
18
21
|
report();
|
|
19
22
|
}, [report]);
|
|
23
|
+
if (!context) {
|
|
24
|
+
return React.createElement(React.Fragment, null, children);
|
|
25
|
+
}
|
|
20
26
|
return (React.createElement("div", { ref: contentRef },
|
|
21
|
-
React.createElement(ReactResizeDetector, { handleHeight: true, onResize: report }),
|
|
27
|
+
React.createElement(ReactResizeDetector, { handleHeight: true, targetRef: contentRef, onResize: report }),
|
|
22
28
|
children));
|
|
23
29
|
};
|
|
@@ -36,7 +36,7 @@ var IgnoreButton_1 = require("../IgnoreButton");
|
|
|
36
36
|
var DeleteButton_1 = require("../DeleteButton");
|
|
37
37
|
var useDidUpdateEffect_1 = require("../hooks/useDidUpdateEffect");
|
|
38
38
|
var useAttributeState_1 = require("../hooks/useAttributeState");
|
|
39
|
-
var
|
|
39
|
+
var AutoExpandedAttributesContext_1 = require("../contexts/AutoExpandedAttributesContext");
|
|
40
40
|
var styles_1 = require("./styles");
|
|
41
41
|
var InlineComplexAttribute = function (_a) {
|
|
42
42
|
var attributeType = _a.attributeType, attributeValue = _a.attributeValue, attributeTypesList = _a.attributeTypesList, label = _a.label, crosswalksMap = _a.crosswalksMap, disableEdit = _a.disableEdit, disableDelete = _a.disableDelete, onPin = _a.onPin, onIgnore = _a.onIgnore, onDelete = _a.onDelete, onEdit = _a.onEdit, onAdd = _a.onAdd, emptyTempAttributeUris = _a.emptyTempAttributeUris;
|
|
@@ -48,7 +48,7 @@ var InlineComplexAttribute = function (_a) {
|
|
|
48
48
|
var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
|
|
49
49
|
var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
|
|
50
50
|
var showDelete = !isReadingMode && canDelete;
|
|
51
|
-
var expandedFromContext = (0,
|
|
51
|
+
var expandedFromContext = (0, AutoExpandedAttributesContext_1.useAttributeAutoExpanded)(attributeValue.uri);
|
|
52
52
|
var _c = (0, react_1.useState)(expandedFromContext || isTemporary), expanded = _c[0], setExpanded = _c[1];
|
|
53
53
|
(0, useDidUpdateEffect_1.useDidUpdateEffect)(function () {
|
|
54
54
|
if (expandedFromContext)
|
|
@@ -56,12 +56,12 @@ var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
|
56
56
|
var core_1 = require("@dnd-kit/core");
|
|
57
57
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
58
58
|
var ComplexAttributeLabel_1 = require("../ComplexAttributeLabel");
|
|
59
|
-
var
|
|
59
|
+
var AutoExpandedAttributesContext_1 = require("../contexts/AutoExpandedAttributesContext");
|
|
60
60
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
61
61
|
var test_utils_1 = require("../test-utils");
|
|
62
62
|
var InlineComplexAttribute_1 = require("./InlineComplexAttribute");
|
|
63
|
-
jest.mock('../contexts/
|
|
64
|
-
|
|
63
|
+
jest.mock('../contexts/AutoExpandedAttributesContext', function () { return ({
|
|
64
|
+
useAttributeAutoExpanded: jest.fn()
|
|
65
65
|
}); });
|
|
66
66
|
var attributeType = {
|
|
67
67
|
uri: 'configuration/entityTypes/HCP/attributes/Nested',
|
|
@@ -147,7 +147,7 @@ var setUp = function (props) {
|
|
|
147
147
|
describe('InlineComplexAttribute tests', function () {
|
|
148
148
|
beforeEach(function () {
|
|
149
149
|
jest.clearAllMocks();
|
|
150
|
-
|
|
150
|
+
AutoExpandedAttributesContext_1.useAttributeAutoExpanded.mockReturnValue(false);
|
|
151
151
|
});
|
|
152
152
|
it('should render correctly', function () {
|
|
153
153
|
setUp();
|
|
@@ -405,7 +405,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
405
405
|
});
|
|
406
406
|
}); });
|
|
407
407
|
it('should render temporary attribute expanded by default', function () {
|
|
408
|
-
|
|
408
|
+
AutoExpandedAttributesContext_1.useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
409
409
|
setUp();
|
|
410
410
|
expect(react_2.screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
|
|
411
411
|
expect(react_2.screen.getByTestId('branch-decorator')).toBeInTheDocument();
|
|
@@ -417,7 +417,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
417
417
|
return __generator(this, function (_a) {
|
|
418
418
|
switch (_a.label) {
|
|
419
419
|
case 0:
|
|
420
|
-
|
|
420
|
+
AutoExpandedAttributesContext_1.useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
421
421
|
user = setUp({ attributeValue: (0, mdm_sdk_1.createNewAttribute)({ attributeType: attributeType, parentUri: 'entities/1' }) }).user;
|
|
422
422
|
return [4 /*yield*/, user.hover(react_2.screen.getByTestId('inline-complex-attribute'))];
|
|
423
423
|
case 1:
|
|
@@ -432,7 +432,7 @@ describe('InlineComplexAttribute tests', function () {
|
|
|
432
432
|
});
|
|
433
433
|
}); });
|
|
434
434
|
it('should render attribute expanded by default if it is expanded via context', function () {
|
|
435
|
-
|
|
435
|
+
AutoExpandedAttributesContext_1.useAttributeAutoExpanded.mockReturnValueOnce(true);
|
|
436
436
|
setUp();
|
|
437
437
|
expect(react_2.screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
|
|
438
438
|
expect(react_2.screen.getByTestId('branch-decorator')).toBeInTheDocument();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, Entity, Relation } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, Entity, Relation, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
entity: Partial<Entity> | Partial<Relation>;
|
|
@@ -12,9 +12,12 @@ type Props = {
|
|
|
12
12
|
fixedTypeUris?: string[];
|
|
13
13
|
showNonOv?: boolean;
|
|
14
14
|
classes?: ReadOnlyAttributeClasses;
|
|
15
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
16
|
+
ovDetails: OvDetails;
|
|
17
|
+
}) => React.ReactElement;
|
|
15
18
|
};
|
|
16
19
|
declare const _default: React.MemoExoticComponent<{
|
|
17
|
-
({ attrTypes, entity, parentUri, drawLines, children, className, max, fixedTypeUris, showNonOv, classes }: Props): React.JSX.Element;
|
|
20
|
+
({ attrTypes, entity, parentUri, drawLines, children, className, max, fixedTypeUris, showNonOv, classes, FallbackSlot }: Props): React.JSX.Element;
|
|
18
21
|
displayName: string;
|
|
19
22
|
}>;
|
|
20
23
|
export default _default;
|
|
@@ -46,7 +46,7 @@ var attributesView_1 = require("../helpers/attributesView");
|
|
|
46
46
|
var HiddenAttributesContext_1 = require("../contexts/HiddenAttributesContext");
|
|
47
47
|
var AlwaysVisibleAttributesContext_1 = require("../contexts/AlwaysVisibleAttributesContext");
|
|
48
48
|
var ReadOnlyAttributesList = function (_a) {
|
|
49
|
-
var _b = _a.attrTypes, attrTypes = _b === void 0 ? [] : _b, entity = _a.entity, parentUri = _a.parentUri, drawLines = _a.drawLines, children = _a.children, className = _a.className, max = _a.max, _c = _a.fixedTypeUris, fixedTypeUris = _c === void 0 ? constants_1.FIXED_TYPE_URIS : _c, showNonOv = _a.showNonOv, classes = _a.classes;
|
|
49
|
+
var _b = _a.attrTypes, attrTypes = _b === void 0 ? [] : _b, entity = _a.entity, parentUri = _a.parentUri, drawLines = _a.drawLines, children = _a.children, className = _a.className, max = _a.max, _c = _a.fixedTypeUris, fixedTypeUris = _c === void 0 ? constants_1.FIXED_TYPE_URIS : _c, showNonOv = _a.showNonOv, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
50
50
|
var hiddenAttributes = (0, react_1.useContext)(HiddenAttributesContext_1.HiddenAttributesContext);
|
|
51
51
|
var alwaysVisibleAttributes = (0, react_1.useContext)(AlwaysVisibleAttributesContext_1.AlwaysVisibleAttributesContext);
|
|
52
52
|
var entityUri = parentUri && (0, mdm_sdk_1.getBaseUri)(parentUri);
|
|
@@ -71,7 +71,7 @@ var ReadOnlyAttributesList = function (_a) {
|
|
|
71
71
|
children && react_1.default.createElement(BranchDecorator_1.BranchDecorator, __assign({}, decoratorProps), children),
|
|
72
72
|
visibleAttributePagersData.concat(fixedPagersData).map(function (_a) {
|
|
73
73
|
var attrType = _a.attrType, values = _a.values;
|
|
74
|
-
return (react_1.default.createElement(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: (0, ramda_1.path)(['paging', attrType.uri], entity.attributes), parentUri: parentUri, showNonOv: showNonOv, classes: classes }));
|
|
74
|
+
return (react_1.default.createElement(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: (0, ramda_1.path)(['paging', attrType.uri], entity.attributes), parentUri: parentUri, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
75
75
|
}),
|
|
76
76
|
showMore && react_1.default.createElement(ShowMore_1.ShowMore, { onClick: onShowMore }),
|
|
77
77
|
showLess && react_1.default.createElement(ShowLess_1.ShowLess, { onClick: onShowLess })));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, ImageAttributeValue, AttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, ImageAttributeValue, AttributeValue, OvDetails } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ReadOnlyAttributeClasses } from '../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
values: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue | string | number | ImageAttributeValue | AttributeValue)[];
|
|
@@ -10,6 +10,9 @@ type Props = {
|
|
|
10
10
|
max?: number;
|
|
11
11
|
showNonOv?: boolean;
|
|
12
12
|
classes?: ReadOnlyAttributeClasses;
|
|
13
|
+
FallbackSlot?: ({ ovDetails }: {
|
|
14
|
+
ovDetails: OvDetails;
|
|
15
|
+
}) => React.ReactElement;
|
|
13
16
|
};
|
|
14
|
-
declare const _default: React.MemoExoticComponent<({ values, attributeType, drawLines, paging, parentUri, max: maxProp, showNonOv, classes }: Props) => React.JSX.Element>;
|
|
17
|
+
declare const _default: React.MemoExoticComponent<({ values, attributeType, drawLines, paging, parentUri, max: maxProp, showNonOv, classes, FallbackSlot }: Props) => React.JSX.Element>;
|
|
15
18
|
export default _default;
|
|
@@ -60,7 +60,7 @@ var RENDERER_TYPES = {
|
|
|
60
60
|
var ReadOnlyAttributesPager = function (_a) {
|
|
61
61
|
var _b, _c, _d, _e;
|
|
62
62
|
var _f;
|
|
63
|
-
var values = _a.values, attributeType = _a.attributeType, drawLines = _a.drawLines, _g = _a.paging, paging = _g === void 0 ? {} : _g, parentUri = _a.parentUri, maxProp = _a.max, showNonOv = _a.showNonOv, classes = _a.classes;
|
|
63
|
+
var values = _a.values, attributeType = _a.attributeType, drawLines = _a.drawLines, _g = _a.paging, paging = _g === void 0 ? {} : _g, parentUri = _a.parentUri, maxProp = _a.max, showNonOv = _a.showNonOv, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
64
64
|
var styles = (0, styles_1.useStyles)();
|
|
65
65
|
var requestNextPageOfAttributeValues = (0, MdmModuleContext_1.useMdmAction)('requestNextPageOfAttributeValues');
|
|
66
66
|
var maxValuesInResponse = (0, MdmModuleContext_1.useMdmMaxValuesInResponse)();
|
|
@@ -91,9 +91,9 @@ var ReadOnlyAttributesPager = function (_a) {
|
|
|
91
91
|
])(attributeType);
|
|
92
92
|
switch (type) {
|
|
93
93
|
case RENDERER_TYPES.oneLine:
|
|
94
|
-
return (react_1.default.createElement(OneLineRenderer_1.OneLineRenderer, { value: visibleValues[0], nonVisibleValues: nonVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, showNonOv: showNonOv, classes: classes }));
|
|
94
|
+
return (react_1.default.createElement(OneLineRenderer_1.OneLineRenderer, { value: visibleValues[0], nonVisibleValues: nonVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
95
95
|
case RENDERER_TYPES.multiLine:
|
|
96
|
-
return (react_1.default.createElement(MultiLineRenderer_1.MultiLineRenderer, { values: visibleValues, nonVisibleValues: nonVisibleValues, totalVisibleValues: totalVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, parentUri: parentUri, max: max, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, classes: classes }));
|
|
96
|
+
return (react_1.default.createElement(MultiLineRenderer_1.MultiLineRenderer, { values: visibleValues, nonVisibleValues: nonVisibleValues, totalVisibleValues: totalVisibleValues, totalNonVisibleValues: totalNonVisibleValues, attributeType: attributeType, parentUri: parentUri, max: max, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }));
|
|
97
97
|
case RENDERER_TYPES.imageLine:
|
|
98
98
|
return (react_1.default.createElement(ImageLineRenderer_1.ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, parentUri: parentUri, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }));
|
|
99
99
|
case RENDERER_TYPES.special:
|