@reltio/components 1.4.2230 → 1.4.2232
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/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
- package/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
- package/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
- 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/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
- package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/cjs/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
- 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
|
@@ -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:
|
|
@@ -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 {};
|
|
@@ -42,9 +42,10 @@ var ControlAttributeIcon_1 = require("../../../ControlAttributeIcon");
|
|
|
42
42
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
43
43
|
var AttributesVerificationContext_1 = require("../../../contexts/AttributesVerificationContext");
|
|
44
44
|
var VerificationButton_1 = require("../../../VerificationButton/VerificationButton");
|
|
45
|
+
var SyncedValueHeight_1 = require("../../../SyncedValueHeight");
|
|
45
46
|
var styles_1 = require("../../styles");
|
|
46
47
|
var MultiLineRenderer = function (_a) {
|
|
47
|
-
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;
|
|
48
|
+
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;
|
|
48
49
|
var styles = (0, styles_1.useMultiLineStyles)();
|
|
49
50
|
var _b = (0, react_1.useState)(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
|
|
50
51
|
var isVerificationAttribute = (0, react_context_selector_1.useContextSelector)(AttributesVerificationContext_1.AttributesVerificationContext, function (context) { return (context === null || context === void 0 ? void 0 : context.isVerificationAttribute) || ramda_1.F; });
|
|
@@ -79,15 +80,18 @@ var MultiLineRenderer = function (_a) {
|
|
|
79
80
|
var shownValues = values.slice(0, visibleValuesCount);
|
|
80
81
|
var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
|
|
81
82
|
var showVerificationButton = isVerificationAttribute(attributeType);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
react_1.default.createElement(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
var blockUri = parentUri ? "".concat(parentUri, "/").concat(attributeType.uri) : attributeType.uri;
|
|
84
|
+
return (react_1.default.createElement(SyncedValueHeight_1.ValueHeightReporter, { uri: blockUri },
|
|
85
|
+
react_1.default.createElement("div", { "data-reltio-id": "multi-line-renderer", className: styles.wrapper },
|
|
86
|
+
react_1.default.createElement("div", { className: styles.titleRow },
|
|
87
|
+
react_1.default.createElement(AttributeTitle_1.AttributeTitle, { label: label, className: (0, classnames_1.default)(styles.title, classes === null || classes === void 0 ? void 0 : classes.title), "data-reltio-id": "reltio-attribute-label" }),
|
|
88
|
+
react_1.default.createElement(DescriptionIcon_1.DescriptionIcon, { description: description }),
|
|
89
|
+
isControlAttribute && react_1.default.createElement(ControlAttributeIcon_1.ControlAttributeIcon, null),
|
|
90
|
+
react_1.default.createElement(OvIcon_1.OvIcon, { nonOvValues: nonVisibleValues, attributeType: attributeType, className: styles.ovIcon, nonOvTotal: totalNonVisibleValues }),
|
|
91
|
+
showVerificationButton && react_1.default.createElement(VerificationButton_1.VerificationButton, { attributeType: attributeType })),
|
|
92
|
+
react_1.default.createElement("div", { className: styles.attributes }, shownValues.map(function (value) { return (react_1.default.createElement(SyncedValueHeight_1.ValueHeightReporter, { key: value.uri, uri: value.uri },
|
|
93
|
+
react_1.default.createElement(ReadOnlyAttributesFactory_1.ReadOnlyAttribute, { className: (0, classnames_1.default)(styles.attribute, classes === null || classes === void 0 ? void 0 : classes.content), attributeValue: value, attributeType: attributeType, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }))); })),
|
|
94
|
+
showMore && (react_1.default.createElement(ShowMore_1.ShowMore, { moreNumber: (0, ramda_1.min)(max, hiddenValuesCount), valueNumber: hiddenValuesCount, onClick: onShowMore })),
|
|
95
|
+
showLess && react_1.default.createElement(ShowLess_1.ShowLess, { onClick: onShowLess }))));
|
|
92
96
|
};
|
|
93
97
|
exports.MultiLineRenderer = MultiLineRenderer;
|
|
@@ -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 {};
|
|
@@ -38,23 +38,25 @@ var DescriptionIcon_1 = require("../../../DescriptionIcon");
|
|
|
38
38
|
var ReadOnlyAttributesFactory_1 = require("../../../ReadOnlyAttributesFactory");
|
|
39
39
|
var ControlAttributeIcon_1 = require("../../../ControlAttributeIcon");
|
|
40
40
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
41
|
+
var SyncedValueHeight_1 = require("../../../SyncedValueHeight");
|
|
41
42
|
var styles_1 = require("../../styles");
|
|
42
43
|
var OneLineRenderer = function (_a) {
|
|
43
|
-
var value = _a.value, nonVisibleValues = _a.nonVisibleValues, attributeType = _a.attributeType, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes;
|
|
44
|
+
var value = _a.value, nonVisibleValues = _a.nonVisibleValues, attributeType = _a.attributeType, showNonOv = _a.showNonOv, totalNonVisibleValues = _a.totalNonVisibleValues, classes = _a.classes, FallbackSlot = _a.FallbackSlot;
|
|
44
45
|
var styles = (0, styles_1.useOneLineStyles)();
|
|
45
46
|
var label = attributeType.label, description = attributeType.description;
|
|
46
47
|
var controlAttributes = (0, MdmModuleContext_1.useMdmControlAttributes)();
|
|
47
48
|
var isControlAttribute = (0, react_1.useMemo)(function () { return controlAttributes.includes(attributeType.uri); }, [controlAttributes, attributeType.uri]);
|
|
48
49
|
var objectType = (0, mdm_sdk_1.getObjectTypeByAttributeUri)(value.uri);
|
|
49
|
-
return (react_1.default.createElement(
|
|
50
|
-
react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.
|
|
51
|
-
react_1.default.createElement(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
return (react_1.default.createElement(SyncedValueHeight_1.ValueHeightReporter, { uri: value.uri },
|
|
51
|
+
react_1.default.createElement("div", { "data-reltio-id": "one-line-renderer", className: (0, classnames_1.default)(styles.collaborationWrapper, constants_1.COMMENTS_CONTAINER_VISIBILITY_AREA) },
|
|
52
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.titleRow, styles.wrapper) },
|
|
53
|
+
react_1.default.createElement(AttributeTitle_1.AttributeTitle, { label: label, className: (0, classnames_1.default)(styles.title, classes === null || classes === void 0 ? void 0 : classes.title), "data-reltio-id": "reltio-attribute-label" }),
|
|
54
|
+
react_1.default.createElement(DescriptionIcon_1.DescriptionIcon, { description: description, className: styles.descriptionIcon }),
|
|
55
|
+
isControlAttribute && react_1.default.createElement(ControlAttributeIcon_1.ControlAttributeIcon, null),
|
|
56
|
+
react_1.default.createElement(OvIcon_1.OvIcon, { nonOvValues: nonVisibleValues, attributeType: attributeType, className: styles.ovIcon, nonOvTotal: totalNonVisibleValues }),
|
|
57
|
+
react_1.default.createElement(ReadOnlyAttributesFactory_1.ReadOnlyAttribute, { className: (0, classnames_1.default)(styles.attribute, classes === null || classes === void 0 ? void 0 : classes.content), attributeValue: value, attributeType: attributeType, showNonOv: showNonOv, inlined: true, classes: classes, FallbackSlot: FallbackSlot })),
|
|
58
|
+
react_1.default.createElement(CommentsContainer_1.CommentsContainer, { uri: value.uri, relatedObjectUris: (0, mdm_sdk_1.createRelatedObjectUris)(objectType, {
|
|
59
|
+
uri: value.uri
|
|
60
|
+
}), objectType: objectType }))));
|
|
59
61
|
};
|
|
60
62
|
exports.OneLineRenderer = OneLineRenderer;
|
|
@@ -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;
|
|
@@ -51,36 +51,48 @@ var HighlightedValuesContext_1 = require("../contexts/HighlightedValuesContext")
|
|
|
51
51
|
var AttributesVerificationContext_1 = require("../contexts/AttributesVerificationContext");
|
|
52
52
|
var classnames_2 = require("../constants/classnames");
|
|
53
53
|
var AttributeVerificationStatus_1 = require("../AttributeVerificationStatus/AttributeVerificationStatus");
|
|
54
|
+
var SyncedExpandedAttributesContext_1 = require("../contexts/SyncedExpandedAttributesContext");
|
|
54
55
|
var ReadOnlyComplexAttribute_module_css_1 = __importDefault(require("./ReadOnlyComplexAttribute.module.css"));
|
|
55
56
|
var ReadOnlyComplexAttribute = function (_a) {
|
|
56
57
|
var _b;
|
|
57
|
-
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;
|
|
58
|
+
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;
|
|
58
59
|
var uri = attributeValue.uri;
|
|
59
60
|
var _d = (0, react_1.useState)(false), expanded = _d[0], setExpanded = _d[1];
|
|
60
61
|
var _e = (0, react_1.useContext)(HighlightedValuesContext_1.HighlightedValuesContext), _f = _e.highlightedValuesUris, highlightedValuesUris = _f === void 0 ? [] : _f, highlightedClassName = _e.highlightedClassName;
|
|
62
|
+
var expandedContext = (0, SyncedExpandedAttributesContext_1.useSyncedExpandedAttributes)();
|
|
61
63
|
(0, react_1.useEffect)(function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (!expandedContext) {
|
|
65
|
+
setExpanded(expandedProp);
|
|
66
|
+
}
|
|
67
|
+
}, [expandedProp, expandedContext]);
|
|
64
68
|
var hasAnalyticValue = (attributeTypesList || []).some(function (attributeType) { return (0, mdm_sdk_1.isAnalyticAttribute)(attributeType); });
|
|
65
69
|
var attributeListEntity = (0, react_1.useMemo)(function () { return (__assign({ attributes: hasAnalyticValue ? null : attributeValue.value, analyticsAttributes: hasAnalyticValue ? attributeValue.value : null }, ((0, mdm_sdk_1.isSpecialAttribute)(attributeType) ? attributeValue.value : {}))); }, [attributeValue, hasAnalyticValue, attributeType]);
|
|
66
70
|
var isVerificationAttribute = (0, react_context_selector_1.useContextSelector)(AttributesVerificationContext_1.AttributesVerificationContext, function (context) { return (context === null || context === void 0 ? void 0 : context.isVerificationAttribute) || ramda_1.F; });
|
|
67
|
-
var objectType = (0, mdm_sdk_1.getObjectTypeByAttributeUri)(
|
|
71
|
+
var objectType = (0, mdm_sdk_1.getObjectTypeByAttributeUri)(uri);
|
|
68
72
|
var showVerificationStatus = isVerificationAttribute(attributeType);
|
|
73
|
+
var actualExpanded = expandedContext ? expandedContext.isExpanded(uri) : expanded;
|
|
74
|
+
var handleToggle = (0, react_1.useCallback)(function () {
|
|
75
|
+
if (expandedContext) {
|
|
76
|
+
expandedContext.toggle(uri);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
setExpanded(function (value) { return !value; });
|
|
80
|
+
}
|
|
81
|
+
}, [expandedContext, uri]);
|
|
69
82
|
return (react_1.default.createElement("div", { className: ReadOnlyComplexAttribute_module_css_1.default.complexContainer },
|
|
70
83
|
react_1.default.createElement("div", { className: (0, classnames_1.default)(ReadOnlyComplexAttribute_module_css_1.default.labelContainer, classnames_2.COMMENTS_CONTAINER_VISIBILITY_AREA) },
|
|
71
|
-
react_1.default.createElement(ArrowExpandButton_1.ArrowExpandButton, { onClick:
|
|
84
|
+
react_1.default.createElement(ArrowExpandButton_1.ArrowExpandButton, { onClick: handleToggle, expanded: actualExpanded }),
|
|
72
85
|
LabelRenderer ? (react_1.default.createElement(LabelRenderer, { attributeType: attributeType, attributeValue: attributeValue })) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
73
86
|
react_1.default.createElement(Typography_1.default, { component: "span", variant: "body2", classes: { body2: ReadOnlyComplexAttribute_module_css_1.default.label }, className: (0, classnames_1.default)((_b = {},
|
|
74
|
-
_b[highlightedClassName] = highlightedValuesUris.includes(
|
|
87
|
+
_b[highlightedClassName] = highlightedValuesUris.includes(uri),
|
|
75
88
|
_b[ReadOnlyComplexAttribute_module_css_1.default.ovFalse] = !(0, mdm_sdk_1.isOv)(attributeValue),
|
|
76
89
|
_b)), "data-reltio-id": "reltio-attribute-complex-label" },
|
|
77
90
|
label,
|
|
78
|
-
showVerificationStatus && (react_1.default.createElement(AttributeVerificationStatus_1.AttributeVerificationStatus, { attributeType: attributeType, attributeValue: attributeValue }))
|
|
91
|
+
showVerificationStatus && (react_1.default.createElement(AttributeVerificationStatus_1.AttributeVerificationStatus, { attributeType: attributeType, attributeValue: attributeValue })),
|
|
92
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && (react_1.default.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))),
|
|
79
93
|
react_1.default.createElement("div", { className: ReadOnlyComplexAttribute_module_css_1.default.spacer }),
|
|
80
94
|
RightSlot && react_1.default.createElement(RightSlot, { attributeType: attributeType, attributeValue: attributeValue }),
|
|
81
|
-
react_1.default.createElement(CommentsContainer_1.CommentsContainer, { uri:
|
|
82
|
-
|
|
83
|
-
}), objectType: objectType })))),
|
|
84
|
-
expanded && (react_1.default.createElement(ReadOnlyAttributesList_1.ReadOnlyAttributesList, { attrTypes: attributeTypesList, entity: attributeListEntity, drawLines: true, parentUri: uri, showNonOv: showNonOv, classes: classes }, children))));
|
|
95
|
+
react_1.default.createElement(CommentsContainer_1.CommentsContainer, { uri: uri, relatedObjectUris: (0, mdm_sdk_1.createRelatedObjectUris)(objectType, { uri: uri }), objectType: objectType })))),
|
|
96
|
+
actualExpanded && (react_1.default.createElement(ReadOnlyAttributesList_1.ReadOnlyAttributesList, { attrTypes: attributeTypesList, entity: attributeListEntity, drawLines: true, parentUri: uri, showNonOv: showNonOv, classes: classes, FallbackSlot: FallbackSlot }, children))));
|
|
85
97
|
};
|
|
86
98
|
exports.ReadOnlyComplexAttribute = ReadOnlyComplexAttribute;
|
|
@@ -69,14 +69,15 @@ var SimpleAttribute = function (_a) {
|
|
|
69
69
|
_d[SimpleAttribute_module_css_1.default.ovFalse] = !(0, mdm_sdk_1.isOv)(attributeValue),
|
|
70
70
|
_d)), "data-reltio-id": "reltio-attribute-value" },
|
|
71
71
|
dataTypeValue,
|
|
72
|
-
unmaskingControl
|
|
72
|
+
unmaskingControl,
|
|
73
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && react_1.default.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))))) : (react_1.default.createElement("div", { "data-reltio-id": "comments-container-visibility-area", style: variableStyles, className: (0, classnames_1.default)(className, SimpleAttribute_module_css_1.default.root, classnames_2.COMMENTS_CONTAINER_VISIBILITY_AREA, (_e = {},
|
|
73
74
|
_e[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
|
|
74
75
|
_e)) },
|
|
75
76
|
react_1.default.createElement(PivotingTooltip_1.PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri },
|
|
76
77
|
react_1.default.createElement("span", { className: (0, classnames_1.default)(SimpleAttribute_module_css_1.default.attributeValue, (_f = {}, _f[SimpleAttribute_module_css_1.default.ovFalse] = !(0, mdm_sdk_1.isOv)(attributeValue), _f)), "data-reltio-id": "reltio-attribute-value" },
|
|
77
78
|
dataTypeValue,
|
|
78
79
|
unmaskingControl,
|
|
79
|
-
FallbackSlot &&
|
|
80
|
+
FallbackSlot && (attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.ovDetails) && react_1.default.createElement(FallbackSlot, { ovDetails: attributeValue.ovDetails }))),
|
|
80
81
|
react_1.default.createElement(CommentsContainer_1.CommentsContainer, { className: SimpleAttribute_module_css_1.default.commentsContainer, uri: attributeValue.uri, relatedObjectUris: (0, mdm_sdk_1.createRelatedObjectUris)(objectType, {
|
|
81
82
|
uri: attributeValue.uri
|
|
82
83
|
}), objectType: objectType })));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ValueHeightConsumer = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var SyncedValueHeightsContext_1 = require("../contexts/SyncedValueHeightsContext");
|
|
29
|
+
var ValueHeightConsumer = function (_a) {
|
|
30
|
+
var uri = _a.uri, children = _a.children;
|
|
31
|
+
var context = (0, react_1.useContext)(SyncedValueHeightsContext_1.SyncedValueHeightsContext);
|
|
32
|
+
if (!context) {
|
|
33
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
34
|
+
}
|
|
35
|
+
var getHeight = context.getHeight;
|
|
36
|
+
var height = getHeight(uri);
|
|
37
|
+
return react_1.default.createElement("div", { style: height !== undefined ? { height: height } : undefined }, children);
|
|
38
|
+
};
|
|
39
|
+
exports.ValueHeightConsumer = ValueHeightConsumer;
|
|
@@ -29,25 +29,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.ValueHeightReporter = void 0;
|
|
30
30
|
var react_1 = __importStar(require("react"));
|
|
31
31
|
var react_resize_detector_1 = __importDefault(require("react-resize-detector"));
|
|
32
|
-
var SyncedValueHeightsContext_1 = require("
|
|
32
|
+
var SyncedValueHeightsContext_1 = require("../contexts/SyncedValueHeightsContext");
|
|
33
33
|
var ValueHeightReporter = function (_a) {
|
|
34
34
|
var uri = _a.uri, children = _a.children;
|
|
35
|
-
var
|
|
35
|
+
var context = (0, react_1.useContext)(SyncedValueHeightsContext_1.SyncedValueHeightsContext);
|
|
36
|
+
var reportHeight = context === null || context === void 0 ? void 0 : context.reportHeight;
|
|
36
37
|
var contentRef = (0, react_1.useRef)(null);
|
|
37
38
|
var lastHeightRef = (0, react_1.useRef)();
|
|
38
39
|
var report = (0, react_1.useCallback)(function () {
|
|
39
40
|
var _a;
|
|
41
|
+
if (!reportHeight)
|
|
42
|
+
return;
|
|
40
43
|
var height = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
41
|
-
if (
|
|
44
|
+
if (height === undefined || height === lastHeightRef.current)
|
|
42
45
|
return;
|
|
43
46
|
lastHeightRef.current = height;
|
|
44
47
|
reportHeight(uri, height);
|
|
45
|
-
}, [reportHeight, uri
|
|
48
|
+
}, [reportHeight, uri]);
|
|
46
49
|
(0, react_1.useLayoutEffect)(function () {
|
|
47
50
|
report();
|
|
48
51
|
}, [report]);
|
|
52
|
+
if (!context) {
|
|
53
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
54
|
+
}
|
|
49
55
|
return (react_1.default.createElement("div", { ref: contentRef },
|
|
50
|
-
react_1.default.createElement(react_resize_detector_1.default, { handleHeight: true, onResize: report }),
|
|
56
|
+
react_1.default.createElement(react_resize_detector_1.default, { handleHeight: true, targetRef: contentRef, onResize: report }),
|
|
51
57
|
children));
|
|
52
58
|
};
|
|
53
59
|
exports.ValueHeightReporter = ValueHeightReporter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ProviderProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
attributeUris: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const AutoExpandedAttributesProvider: ({ children, attributeUris }: ProviderProps) => React.JSX.Element;
|
|
7
|
+
export declare const useAttributeAutoExpanded: (attributeUri: string) => any;
|
|
8
|
+
export {};
|
|
@@ -23,17 +23,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.useAttributeAutoExpanded = exports.AutoExpandedAttributesProvider = void 0;
|
|
27
27
|
var react_1 = __importStar(require("react"));
|
|
28
28
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var AutoExpandedAttributesContext = (0, react_1.createContext)(null);
|
|
30
|
+
var AutoExpandedAttributesProvider = function (_a) {
|
|
31
31
|
var children = _a.children, attributeUris = _a.attributeUris;
|
|
32
|
-
return react_1.default.createElement(
|
|
32
|
+
return (react_1.default.createElement(AutoExpandedAttributesContext.Provider, { value: attributeUris }, children));
|
|
33
33
|
};
|
|
34
|
-
exports.
|
|
35
|
-
var
|
|
36
|
-
var expandedAttributes = (0, react_1.useContext)(
|
|
34
|
+
exports.AutoExpandedAttributesProvider = AutoExpandedAttributesProvider;
|
|
35
|
+
var useAttributeAutoExpanded = function (attributeUri) {
|
|
36
|
+
var expandedAttributes = (0, react_1.useContext)(AutoExpandedAttributesContext) || [];
|
|
37
37
|
return expandedAttributes.some(function (uri) { return (0, mdm_sdk_1.areOneHierarchyUris)(uri, attributeUri); });
|
|
38
38
|
};
|
|
39
|
-
exports.
|
|
39
|
+
exports.useAttributeAutoExpanded = useAttributeAutoExpanded;
|
|
@@ -9,11 +9,11 @@ var index_1 = require("./index");
|
|
|
9
9
|
var setUp = function (attributeUri, attributeUris) {
|
|
10
10
|
var DefaultProviders = function (_a) {
|
|
11
11
|
var children = _a.children;
|
|
12
|
-
return (react_1.default.createElement(index_1.
|
|
12
|
+
return (react_1.default.createElement(index_1.AutoExpandedAttributesProvider, { attributeUris: attributeUris }, children));
|
|
13
13
|
};
|
|
14
14
|
return (0, react_hooks_1.renderHook)(function (_a) {
|
|
15
15
|
var attributeUri = _a.attributeUri;
|
|
16
|
-
return (0, index_1.
|
|
16
|
+
return (0, index_1.useAttributeAutoExpanded)(attributeUri);
|
|
17
17
|
}, {
|
|
18
18
|
initialProps: { attributeUri: attributeUri },
|
|
19
19
|
wrapper: attributeUris ? DefaultProviders : function (_a) {
|
|
@@ -22,7 +22,7 @@ var setUp = function (attributeUri, attributeUris) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
describe('
|
|
25
|
+
describe('useAttributeAutoExpanded tests', function () {
|
|
26
26
|
it('should return false if no expanded context present', function () {
|
|
27
27
|
var result = setUp('entities/1/attributes/Simple/1').result;
|
|
28
28
|
expect(result.current).toBe(false);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type SyncedExpandedAttributesContextValue = {
|
|
3
|
+
isExpanded: (attributeUri: string) => boolean;
|
|
4
|
+
toggle: (attributeUri: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const SyncedExpandedAttributesContext: React.Context<SyncedExpandedAttributesContextValue>;
|
|
7
|
+
type Props = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const SyncedExpandedAttributesProvider: ({ children }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const useSyncedExpandedAttributes: () => SyncedExpandedAttributesContextValue;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
+
if (ar || !(i in from)) {
|
|
28
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
+
ar[i] = from[i];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.useSyncedExpandedAttributes = exports.SyncedExpandedAttributesProvider = exports.SyncedExpandedAttributesContext = void 0;
|
|
36
|
+
var react_1 = __importStar(require("react"));
|
|
37
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
38
|
+
exports.SyncedExpandedAttributesContext = (0, react_1.createContext)(null);
|
|
39
|
+
var SyncedExpandedAttributesProvider = function (_a) {
|
|
40
|
+
var children = _a.children;
|
|
41
|
+
var _b = (0, react_1.useState)([]), expandedAttributes = _b[0], setExpandedAttributes = _b[1];
|
|
42
|
+
var isExpanded = (0, react_1.useCallback)(function (attributeUri) { return expandedAttributes.includes(attributeUri); }, [expandedAttributes]);
|
|
43
|
+
var toggle = (0, react_1.useCallback)(function (attributeUri) {
|
|
44
|
+
setExpandedAttributes(function (prev) {
|
|
45
|
+
if (prev.includes(attributeUri)) {
|
|
46
|
+
return prev.filter(function (uri) { return !(0, mdm_sdk_1.areOneHierarchyUris)(uri, attributeUri); });
|
|
47
|
+
}
|
|
48
|
+
return __spreadArray(__spreadArray([], prev, true), [attributeUri], false);
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
var value = (0, react_1.useMemo)(function () { return ({ isExpanded: isExpanded, toggle: toggle }); }, [isExpanded, toggle]);
|
|
52
|
+
return (react_1.default.createElement(exports.SyncedExpandedAttributesContext.Provider, { value: value }, children));
|
|
53
|
+
};
|
|
54
|
+
exports.SyncedExpandedAttributesProvider = SyncedExpandedAttributesProvider;
|
|
55
|
+
var useSyncedExpandedAttributes = function () { return (0, react_1.useContext)(exports.SyncedExpandedAttributesContext); };
|
|
56
|
+
exports.useSyncedExpandedAttributes = useSyncedExpandedAttributes;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
reportHeight: (uri: string, height: number) => void;
|
|
4
|
-
getHeight: (
|
|
4
|
+
getHeight: (uri: string) => number | undefined;
|
|
5
5
|
clear: () => void;
|
|
6
6
|
};
|
|
7
|
+
export declare const SyncedValueHeightsContext: React.Context<Props>;
|
|
7
8
|
export declare const SyncedValueHeightsProvider: ({ children }: {
|
|
8
9
|
children: React.ReactNode;
|
|
9
10
|
}) => React.JSX.Element;
|
|
10
|
-
export declare const useSyncedValueHeights: () => Props;
|
|
11
11
|
export {};
|
|
@@ -34,33 +34,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
37
|
+
exports.SyncedValueHeightsProvider = exports.SyncedValueHeightsContext = void 0;
|
|
38
38
|
var react_1 = __importStar(require("react"));
|
|
39
|
-
var
|
|
39
|
+
var ramda_1 = require("ramda");
|
|
40
|
+
exports.SyncedValueHeightsContext = (0, react_1.createContext)(null);
|
|
40
41
|
var SyncedValueHeightsProvider = function (_a) {
|
|
41
42
|
var children = _a.children;
|
|
42
43
|
var _b = (0, react_1.useState)({}), heights = _b[0], setHeights = _b[1];
|
|
43
44
|
var reportHeight = (0, react_1.useCallback)(function (uri, height) {
|
|
44
|
-
if (!uri ||
|
|
45
|
+
if (!uri || (0, ramda_1.isNil)(height))
|
|
45
46
|
return;
|
|
46
47
|
setHeights(function (prev) {
|
|
47
48
|
var _a;
|
|
48
|
-
|
|
49
|
+
if (prev[uri] === height)
|
|
50
|
+
return prev;
|
|
51
|
+
return __assign(__assign({}, prev), (_a = {}, _a[uri] = height, _a));
|
|
49
52
|
});
|
|
50
|
-
}, [
|
|
51
|
-
var getHeight = (0, react_1.useCallback)(function (uri) { return
|
|
53
|
+
}, []);
|
|
54
|
+
var getHeight = (0, react_1.useCallback)(function (uri) { return heights[uri]; }, [heights]);
|
|
52
55
|
var clear = (0, react_1.useCallback)(function () {
|
|
53
56
|
setHeights({});
|
|
54
57
|
}, []);
|
|
55
58
|
var value = (0, react_1.useMemo)(function () { return ({ reportHeight: reportHeight, getHeight: getHeight, clear: clear }); }, [reportHeight, getHeight, clear]);
|
|
56
|
-
return react_1.default.createElement(SyncedValueHeightsContext.Provider, { value: value }, children);
|
|
59
|
+
return react_1.default.createElement(exports.SyncedValueHeightsContext.Provider, { value: value }, children);
|
|
57
60
|
};
|
|
58
61
|
exports.SyncedValueHeightsProvider = SyncedValueHeightsProvider;
|
|
59
|
-
var useSyncedValueHeights = function () {
|
|
60
|
-
var context = (0, react_1.useContext)(SyncedValueHeightsContext);
|
|
61
|
-
if (!context) {
|
|
62
|
-
throw new Error('useSyncedValueHeights must be used within SyncedValueHeightsProvider');
|
|
63
|
-
}
|
|
64
|
-
return context;
|
|
65
|
-
};
|
|
66
|
-
exports.useSyncedValueHeights = useSyncedValueHeights;
|
|
@@ -53,7 +53,8 @@ var helpers_1 = require("./helpers");
|
|
|
53
53
|
var ConfirmEditIgnoredDialog_1 = require("./components/ConfirmEditIgnoredDialog");
|
|
54
54
|
var CommonRowCellRenderer_1 = require("./components/CommonRowCellRenderer");
|
|
55
55
|
var LazyRenderer_1 = require("../../../LazyRenderer");
|
|
56
|
-
var SyncedValueHeightsContext_1 = require("
|
|
56
|
+
var SyncedValueHeightsContext_1 = require("../../../contexts/SyncedValueHeightsContext");
|
|
57
|
+
var SyncedExpandedAttributesContext_1 = require("../../../contexts/SyncedExpandedAttributesContext");
|
|
57
58
|
var styles_1 = require("./styles");
|
|
58
59
|
var DEFAULT_ROW_HEIGHT = 68;
|
|
59
60
|
var getIdFromRowValue = function (rowValue) { return rowValue.ovValues.attributeType.uri; };
|
|
@@ -148,8 +149,9 @@ var AttributesTable = function (_a) {
|
|
|
148
149
|
react_1.default.createElement(ColumnsSettings_1.ColumnsSettings, { columnsData: helpers_1.COLUMNS_DATA, selectedColumns: visibleColumns, onChangeColumns: onChangeVisibleColumns })),
|
|
149
150
|
react_1.default.createElement("div", { className: styles.tableContent },
|
|
150
151
|
isLoading && react_1.default.createElement(LinearLoadIndicator_1.LinearLoadIndicator, null),
|
|
151
|
-
react_1.default.createElement(
|
|
152
|
-
react_1.default.createElement(
|
|
152
|
+
react_1.default.createElement(SyncedExpandedAttributesContext_1.SyncedExpandedAttributesProvider, null,
|
|
153
|
+
react_1.default.createElement(SyncedValueHeightsContext_1.SyncedValueHeightsProvider, null,
|
|
154
|
+
react_1.default.createElement(BasicTable_1.BasicTable, { ref: tableRef, fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: false, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, onScroll: debouncedNotifyLazyRenderer, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })))),
|
|
153
155
|
react_1.default.createElement(ConfirmDeleteDialog_1.ConfirmDeleteDialog, { open: !!pendingDeletion, onClose: function () { return setPendingDeletion(null); }, onConfirm: handleDelete }),
|
|
154
156
|
react_1.default.createElement(ConfirmEditIgnoredDialog_1.ConfirmEditIgnoredDialog, { open: !!pendingIgnoredEditing, onClose: function () { return setPendingIgnoredEditing(null); }, onConfirmEditWithIgnore: function () { return pendingIgnoredEditing && onEdit(pendingIgnoredEditing); }, onConfirmEditWithoutIgnore: function () {
|
|
155
157
|
if (pendingIgnoredEditing)
|
|
@@ -2,7 +2,7 @@ import { Entity, Metadata } from '@reltio/mdm-sdk';
|
|
|
2
2
|
export declare const createEntity: ({ withAppliedSurvivorshipRules }?: {
|
|
3
3
|
withAppliedSurvivorshipRules?: boolean;
|
|
4
4
|
}) => Entity;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const createEntityWithAllParticipationStatuses: () => Entity;
|
|
6
6
|
export declare const createMetadata: () => Metadata;
|
|
7
7
|
export declare const selectedAttributeTypes: ({
|
|
8
8
|
description: string;
|