@reltio/components 1.4.1852 → 1.4.1854
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/AttributesFiltersBuilder/AttributesFiltersBuilder.js +1 -1
- package/cjs/ConnectionEditor/ConnectionEditor.d.ts +3 -3
- package/cjs/ConnectionEditor/ConnectionEditor.test.js +2 -2
- package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +14 -34
- package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.js +1 -20
- package/cjs/DependentLookupEditor/DependentLookupEditor.d.ts +27 -44
- package/cjs/DependentLookupEditor/DependentLookupEditor.js +3 -21
- package/cjs/DropDownEditor/DropDownEditor.d.ts +14 -15
- package/cjs/DropDownEditor/DropDownEditor.js +0 -6
- package/cjs/EditModeAttributesList/EditModeAttributesList.d.ts +14 -3
- package/cjs/EditModeAttributesList/EditModeAttributesList.js +0 -20
- package/cjs/EditModeAttributesPager/EditModeAttributesPager.d.ts +3 -2
- package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.d.ts +2 -3
- package/cjs/EditModeAttributesPager/types.d.ts +7 -6
- package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.d.ts +41 -4
- package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.js +6 -17
- package/cjs/EditModeComplexAttribute/index.d.ts +1 -0
- package/cjs/EntitySelector/EntitySelector.d.ts +19 -31
- package/cjs/EntitySelector/EntitySelector.js +0 -14
- package/cjs/EntitySelector/components/EntityOption/EntityOption.d.ts +17 -22
- package/cjs/EntitySelector/components/EntityOption/EntityOption.js +0 -18
- package/cjs/ErrorWrapper/ErrorWrapper.d.ts +2 -2
- package/cjs/FilterEditor/FilterEditor.d.ts +16 -23
- package/cjs/FilterEditor/FilterEditor.js +2 -14
- package/cjs/FilterValueEditor/FilterValueEditor.d.ts +14 -24
- package/cjs/FilterValueEditor/FilterValueEditor.js +0 -9
- package/cjs/HOCs/withFilter/ColumnFilter.js +1 -1
- package/cjs/LookupEditor/LookupEditor.d.ts +11 -33
- package/cjs/LookupEditor/LookupEditor.js +1 -14
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.d.ts +11 -21
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.js +0 -7
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.d.ts +9 -2
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.js +7 -7
- package/cjs/LookupEditor/components/GroupedDropDownEditor/styles.d.ts +1 -1
- package/cjs/NestedAttribute/NestedAttribute.d.ts +4 -124
- package/cjs/NestedAttribute/NestedAttribute.js +0 -1
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.d.ts +5 -1
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.js +0 -1
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +14 -44
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +0 -12
- package/cjs/ReadOnlyComplexAttribute/index.d.ts +1 -0
- package/cjs/ReferenceAttribute/ReferenceAttribute.d.ts +3 -24
- package/cjs/ReferenceAttribute/ReferenceAttribute.test.js +2 -2
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.d.ts +5 -2
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.js +2 -3
- package/cjs/RelationTypeSelector/RelationTypeSelector.d.ts +9 -26
- package/cjs/RelationTypeSelector/RelationTypeSelector.js +2 -14
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +39 -16
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.js +0 -17
- package/cjs/SimpleAttributeEditor/useAttributeValuePermissions.d.ts +1 -1
- package/cjs/components/ImageDetailsView/helpers/index.d.ts +5 -2
- package/cjs/components/ImportButton/ImportButton.d.ts +2 -1
- package/cjs/components/MultipliableSelect/MultipliableSelect.d.ts +20 -30
- package/cjs/components/MultipliableSelect/MultipliableSelect.js +0 -15
- package/cjs/components/ProfileBand/styles.d.ts +1 -1
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.d.ts +43 -107
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +0 -25
- package/cjs/components/QueryBuilderRow/components/ReadOnlyFilter.d.ts +4 -3
- package/cjs/components/QueryBuilderRow/components/ReadOnlyLogicOperator.d.ts +4 -10
- package/cjs/components/QueryBuilderRow/components/ReadOnlyLogicOperator.js +1 -6
- package/cjs/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.d.ts +33 -64
- package/cjs/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.js +3 -51
- package/cjs/components/ReactSelect/AsyncSelect.d.ts +0 -45
- package/cjs/components/ReactSelect/CreatableSelect.d.ts +0 -45
- package/cjs/components/ReactSelect/Select.d.ts +0 -45
- package/cjs/components/ReactSelect/withMuiSkin.d.ts +3 -48
- package/cjs/components/ReactSelect/withMuiSkin.js +0 -50
- package/cjs/components/ReactSortableTree/node-renderer-default.d.ts +2 -2
- package/cjs/components/ReadableSearchQuery/ReadableSearchQuery.d.ts +2 -4
- package/cjs/components/SearchInput/SearchInput.d.ts +1 -1
- package/cjs/components/SelectionPopup/SelectionPopup.d.ts +1 -1
- package/cjs/constants/index.d.ts +1 -1
- package/cjs/constants/index.js +1 -4
- package/cjs/constants/prop-types.d.ts +0 -81
- package/cjs/constants/prop-types.js +17 -46
- package/cjs/constants/textField.d.ts +2 -2
- package/cjs/contexts/ScrollToElementContext/index.d.ts +1 -1
- package/cjs/features/graph/DataModelGraph/DataModelGraph.d.ts +6 -5
- package/cjs/features/graph/DataModelGraph/DataModelGraph.js +4 -3
- package/cjs/features/graph/DataModelGraph/DataModelGraph.test.js +3 -8
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.d.ts → DataModelCircleLayout.d.ts} +2 -2
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.js → DataModelCircleLayout.js} +5 -7
- package/cjs/features/graph/DataModelGraph/hooks/defaultGraph.test-data.js +4 -2
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +6 -5
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +43 -13
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +39 -17
- package/cjs/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.js +4 -3
- package/cjs/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +3 -3
- package/cjs/features/graph/index.d.ts +1 -1
- package/cjs/features/graph/rendering/canvas/label.js +1 -1
- package/cjs/features/graph/types/graphDataTypes.d.ts +2 -1
- package/cjs/helpers/basicTable.d.ts +2 -7
- package/cjs/hooks/useRelationTypeSelector.d.ts +12 -8
- package/cjs/hooks/useRelationTypeSelector.js +3 -1
- package/cjs/types/index.d.ts +19 -2
- package/esm/AttributesFiltersBuilder/AttributesFiltersBuilder.js +1 -1
- package/esm/ConnectionEditor/ConnectionEditor.d.ts +3 -3
- package/esm/ConnectionEditor/ConnectionEditor.test.js +2 -2
- package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +14 -34
- package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.js +1 -17
- package/esm/DependentLookupEditor/DependentLookupEditor.d.ts +27 -44
- package/esm/DependentLookupEditor/DependentLookupEditor.js +4 -22
- package/esm/DropDownEditor/DropDownEditor.d.ts +14 -15
- package/esm/DropDownEditor/DropDownEditor.js +0 -6
- package/esm/EditModeAttributesList/EditModeAttributesList.d.ts +14 -3
- package/esm/EditModeAttributesList/EditModeAttributesList.js +1 -21
- package/esm/EditModeAttributesPager/EditModeAttributesPager.d.ts +3 -2
- package/esm/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.d.ts +2 -3
- package/esm/EditModeAttributesPager/types.d.ts +7 -6
- package/esm/EditModeComplexAttribute/EditModeComplexAttribute.d.ts +41 -4
- package/esm/EditModeComplexAttribute/EditModeComplexAttribute.js +7 -18
- package/esm/EditModeComplexAttribute/index.d.ts +1 -0
- package/esm/EntitySelector/EntitySelector.d.ts +19 -31
- package/esm/EntitySelector/EntitySelector.js +1 -15
- package/esm/EntitySelector/components/EntityOption/EntityOption.d.ts +17 -22
- package/esm/EntitySelector/components/EntityOption/EntityOption.js +0 -18
- package/esm/ErrorWrapper/ErrorWrapper.d.ts +2 -2
- package/esm/FilterEditor/FilterEditor.d.ts +16 -23
- package/esm/FilterEditor/FilterEditor.js +3 -15
- package/esm/FilterValueEditor/FilterValueEditor.d.ts +14 -24
- package/esm/FilterValueEditor/FilterValueEditor.js +1 -10
- package/esm/HOCs/withFilter/ColumnFilter.js +1 -1
- package/esm/LookupEditor/LookupEditor.d.ts +11 -33
- package/esm/LookupEditor/LookupEditor.js +1 -11
- package/esm/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.d.ts +11 -21
- package/esm/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.js +0 -7
- package/esm/LookupEditor/components/GroupedDropDownEditor/helpers.d.ts +9 -2
- package/esm/LookupEditor/components/GroupedDropDownEditor/helpers.js +7 -7
- package/esm/LookupEditor/components/GroupedDropDownEditor/styles.d.ts +1 -1
- package/esm/NestedAttribute/NestedAttribute.d.ts +4 -124
- package/esm/NestedAttribute/NestedAttribute.js +1 -2
- package/esm/NestedAttributeEditor/NestedAttributeEditor.d.ts +5 -1
- package/esm/NestedAttributeEditor/NestedAttributeEditor.js +1 -2
- package/esm/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +14 -44
- package/esm/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +1 -13
- package/esm/ReadOnlyComplexAttribute/index.d.ts +1 -0
- package/esm/ReferenceAttribute/ReferenceAttribute.d.ts +3 -24
- package/esm/ReferenceAttribute/ReferenceAttribute.test.js +2 -2
- package/esm/ReferenceAttributeEditor/ReferenceAttributeEditor.d.ts +5 -2
- package/esm/ReferenceAttributeEditor/ReferenceAttributeEditor.js +3 -4
- package/esm/RelationTypeSelector/RelationTypeSelector.d.ts +9 -26
- package/esm/RelationTypeSelector/RelationTypeSelector.js +2 -14
- package/esm/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +39 -16
- package/esm/SimpleAttributeEditor/SimpleAttributeEditor.js +1 -18
- package/esm/SimpleAttributeEditor/useAttributeValuePermissions.d.ts +1 -1
- package/esm/components/ImageDetailsView/helpers/index.d.ts +5 -2
- package/esm/components/ImportButton/ImportButton.d.ts +2 -1
- package/esm/components/MultipliableSelect/MultipliableSelect.d.ts +20 -30
- package/esm/components/MultipliableSelect/MultipliableSelect.js +0 -15
- package/esm/components/ProfileBand/styles.d.ts +1 -1
- package/esm/components/QueryBuilderRow/QueryBuilderRow.d.ts +43 -107
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +0 -25
- package/esm/components/QueryBuilderRow/components/ReadOnlyFilter.d.ts +4 -3
- package/esm/components/QueryBuilderRow/components/ReadOnlyLogicOperator.d.ts +4 -10
- package/esm/components/QueryBuilderRow/components/ReadOnlyLogicOperator.js +1 -6
- package/esm/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.d.ts +33 -64
- package/esm/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.js +3 -28
- package/esm/components/ReactSelect/AsyncSelect.d.ts +0 -45
- package/esm/components/ReactSelect/CreatableSelect.d.ts +0 -45
- package/esm/components/ReactSelect/Select.d.ts +0 -45
- package/esm/components/ReactSelect/withMuiSkin.d.ts +3 -48
- package/esm/components/ReactSelect/withMuiSkin.js +0 -50
- package/esm/components/ReactSortableTree/node-renderer-default.d.ts +2 -2
- package/esm/components/ReadableSearchQuery/ReadableSearchQuery.d.ts +2 -4
- package/esm/components/SearchInput/SearchInput.d.ts +1 -1
- package/esm/components/SelectionPopup/SelectionPopup.d.ts +1 -1
- package/esm/constants/index.d.ts +1 -1
- package/esm/constants/index.js +1 -1
- package/esm/constants/prop-types.d.ts +0 -81
- package/esm/constants/prop-types.js +17 -38
- package/esm/constants/textField.d.ts +2 -2
- package/esm/contexts/ScrollToElementContext/index.d.ts +1 -1
- package/esm/features/graph/DataModelGraph/DataModelGraph.d.ts +6 -5
- package/esm/features/graph/DataModelGraph/DataModelGraph.js +4 -3
- package/esm/features/graph/DataModelGraph/DataModelGraph.test.js +3 -8
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.d.ts → DataModelCircleLayout.d.ts} +2 -2
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.js → DataModelCircleLayout.js} +3 -5
- package/esm/features/graph/DataModelGraph/hooks/defaultGraph.test-data.js +4 -2
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +6 -5
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +44 -14
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +40 -18
- package/esm/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.js +4 -3
- package/esm/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +3 -3
- package/esm/features/graph/index.d.ts +1 -1
- package/esm/features/graph/rendering/canvas/label.js +1 -1
- package/esm/features/graph/types/graphDataTypes.d.ts +2 -1
- package/esm/helpers/basicTable.d.ts +2 -7
- package/esm/hooks/useRelationTypeSelector.d.ts +12 -8
- package/esm/hooks/useRelationTypeSelector.js +3 -1
- package/esm/types/index.d.ts +19 -2
- package/package.json +2 -2
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ConnectionRelation, TRelationType } from '@reltio/mdm-sdk';
|
|
2
|
+
import { RelationOption } from '../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
reversedContextLabels?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const useRelationTypeSelector: ({ reversedContextLabels }: Props) => {
|
|
7
|
+
getRelationTypesOptions: (inRelations: TRelationType[], outRelations: TRelationType[]) => RelationOption[];
|
|
8
|
+
fromEditorValue: (inRelationTypes: TRelationType[], outRelationTypes: TRelationType[]) => (relation: RelationOption) => {
|
|
9
|
+
type: TRelationType;
|
|
10
|
+
direction: string;
|
|
8
11
|
};
|
|
9
|
-
toEditorValue: (relation:
|
|
12
|
+
toEditorValue: (relation: ConnectionRelation, relationsTypesOptions: RelationOption[]) => RelationOption | undefined;
|
|
10
13
|
};
|
|
14
|
+
export {};
|
|
@@ -13,7 +13,9 @@ var useRelationTypeSelector = function (_a) {
|
|
|
13
13
|
var byLabel = (0, ramda_1.ascend)((0, ramda_1.prop)('label'));
|
|
14
14
|
var prepareRelation = (0, ramda_1.curry)(function (direction, _a) {
|
|
15
15
|
var uri = _a.uri, label = _a.label, startObject = _a.startObject, endObject = _a.endObject;
|
|
16
|
-
var dirObject = direction === (reversedContextLabels ? mdm_sdk_1.Directions.OUT : mdm_sdk_1.Directions.IN)
|
|
16
|
+
var dirObject = direction === (reversedContextLabels ? mdm_sdk_1.Directions.OUT : mdm_sdk_1.Directions.IN)
|
|
17
|
+
? startObject
|
|
18
|
+
: endObject;
|
|
17
19
|
return {
|
|
18
20
|
label: { directionalLabel: getDirectionalLabel(dirObject), typeLabel: label },
|
|
19
21
|
value: "".concat(uri, ",").concat(direction),
|
package/cjs/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, Crosswalk, RelationCrosswalk, SearchFilter, SearchOperator } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, AttributeValue, ConnectionRelationType, Crosswalk, RelationCrosswalk, SearchFilter, SearchOperator } from '@reltio/mdm-sdk';
|
|
3
3
|
import { Layout as LayoutItem } from 'react-grid-layout';
|
|
4
4
|
export type ReactGridLayoutItem = LayoutItem;
|
|
5
5
|
export type ReltioGridLayoutOptions = {
|
|
@@ -25,7 +25,7 @@ export type QueryBuilderAttributeData = {
|
|
|
25
25
|
filterOptions: Array<string>;
|
|
26
26
|
};
|
|
27
27
|
export type QueryBuilderAttribute = {
|
|
28
|
-
id: string;
|
|
28
|
+
id: string | number;
|
|
29
29
|
values: Array<unknown>;
|
|
30
30
|
data: QueryBuilderAttributeData;
|
|
31
31
|
filter: string;
|
|
@@ -161,3 +161,20 @@ export type ImageAttributeSize = ImageSize & {
|
|
|
161
161
|
imageHeight: number;
|
|
162
162
|
imageMargin: number;
|
|
163
163
|
};
|
|
164
|
+
export type RelationOption = {
|
|
165
|
+
label: string;
|
|
166
|
+
value: string;
|
|
167
|
+
} & Pick<ConnectionRelationType, 'startObject' | 'endObject'>;
|
|
168
|
+
export type DropDownEntryType = {
|
|
169
|
+
label?: string;
|
|
170
|
+
value: string;
|
|
171
|
+
};
|
|
172
|
+
export type DropDownGroupEntryType = {
|
|
173
|
+
label?: string;
|
|
174
|
+
values: DropDownEntryType[];
|
|
175
|
+
isGroup?: boolean;
|
|
176
|
+
};
|
|
177
|
+
export type AdditionalControlsRenderer<T extends AttributeValue> = {
|
|
178
|
+
attributeType: AttributeType;
|
|
179
|
+
attributeValue: T;
|
|
180
|
+
};
|
|
@@ -33,7 +33,7 @@ import { useStyles } from './styles';
|
|
|
33
33
|
var EMPTY_FILTER = { fieldName: null, filter: null, operator: SearchOperator.and, values: [] };
|
|
34
34
|
var AttributesFiltersBuilder = function (_a) {
|
|
35
35
|
var _b = _a.classes, classes = _b === void 0 ? {} : _b, attributesTypesGroups = _a.attributesTypesGroups, filters = _a.filters, onChange = _a.onChange, _c = _a.components, components = _c === void 0 ? {} : _c, onFilterAttributeChange = _a.onFilterAttributeChange;
|
|
36
|
-
var CustomValuesEditor =
|
|
36
|
+
var _d = components, CustomValuesEditor = _d.ValuesEditor, CustomFilterSelector = _d.FilterSelector, _e = _d.LogicalOperator, LogicalOperator = _e === void 0 ? EmptyStub : _e;
|
|
37
37
|
var styles = useStyles();
|
|
38
38
|
var actualFilters = useRef(filters);
|
|
39
39
|
var attributeFilterRef = useRef(null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttributeItem, EditingConnection, Entity,
|
|
1
|
+
import { AttributeItem, EditingConnection, Entity, ConnectionRelationType } from '@reltio/mdm-sdk';
|
|
2
2
|
type Props = {
|
|
3
3
|
connection: EditingConnection;
|
|
4
4
|
showEmptyEditors?: boolean;
|
|
@@ -11,8 +11,8 @@ type Props = {
|
|
|
11
11
|
}) => void;
|
|
12
12
|
onChangeEntity?: (entity: Entity) => void;
|
|
13
13
|
relatedEntity?: Entity;
|
|
14
|
-
inRelationTypes?:
|
|
15
|
-
outRelationTypes?:
|
|
14
|
+
inRelationTypes?: ConnectionRelationType[];
|
|
15
|
+
outRelationTypes?: ConnectionRelationType[];
|
|
16
16
|
entityErrorMessage?: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const ConnectionEditor: ({ connection, relatedEntity, inRelationTypes, outRelationTypes, showEmptyEditors, entityErrorMessage, onChangeAttribute, onRemoveAttribute, onAddAttributes, onChangeRelationType, onChangeEntity }: Props) => JSX.Element;
|
|
@@ -355,8 +355,8 @@ describe('ConnectionEditor test', function () {
|
|
|
355
355
|
onChangeEntity: onChangeEntity
|
|
356
356
|
});
|
|
357
357
|
newEntity = {
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
entityUri: 'entities/entityCommittee',
|
|
359
|
+
entityType: 'configuration/entityTypes/Committee'
|
|
360
360
|
};
|
|
361
361
|
act(function () {
|
|
362
362
|
component.find(EntitySelector).prop('onChange')(newEntity);
|
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ConnectionRelation, ConnectionRelationType, Metadata } from '@reltio/mdm-sdk';
|
|
2
|
+
type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
relation?: ConnectionRelation;
|
|
5
|
+
inRelationTypes?: ConnectionRelationType[];
|
|
6
|
+
outRelationTypes?: ConnectionRelationType[];
|
|
7
7
|
applyFirstByDefault?: boolean;
|
|
8
8
|
reversedContextLabels?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
typeColor: PropTypes.Requireable<string>;
|
|
18
|
-
direction: PropTypes.Requireable<string>;
|
|
19
|
-
startObject: PropTypes.Requireable<object>;
|
|
20
|
-
endObject: PropTypes.Requireable<object>;
|
|
21
|
-
}>[]>;
|
|
22
|
-
export let outRelationTypes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
|
-
label: PropTypes.Requireable<string>;
|
|
24
|
-
uri: PropTypes.Requireable<string>;
|
|
25
|
-
typeColor: PropTypes.Requireable<string>;
|
|
26
|
-
direction: PropTypes.Requireable<string>;
|
|
27
|
-
startObject: PropTypes.Requireable<object>;
|
|
28
|
-
endObject: PropTypes.Requireable<object>;
|
|
29
|
-
}>[]>;
|
|
30
|
-
export let applyFirstByDefault: PropTypes.Requireable<boolean>;
|
|
31
|
-
export let reversedContextLabels: PropTypes.Requireable<boolean>;
|
|
32
|
-
export let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
import PropTypes from 'prop-types';
|
|
36
|
-
import { ConnectionRelationType } from '@reltio/mdm-sdk';
|
|
9
|
+
onChange: ({ type, direction }: {
|
|
10
|
+
type: ConnectionRelationType;
|
|
11
|
+
direction: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
metadata?: Metadata;
|
|
14
|
+
};
|
|
15
|
+
export declare const ConnectionRelationTypeSelector: ({ relation, inRelationTypes, outRelationTypes, onChange, applyFirstByDefault, reversedContextLabels, ...otherProps }: Props) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -21,8 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React, { useMemo, useCallback, useEffect } from 'react';
|
|
24
|
-
import PropTypes from 'prop-types';
|
|
25
|
-
import { ConnectionRelationType, RelationTypeType } from '@reltio/mdm-sdk';
|
|
26
24
|
import { identity, pipe } from 'ramda';
|
|
27
25
|
import { useRelationTypeSelector } from '../hooks/useRelationTypeSelector';
|
|
28
26
|
import { RelationTypeSelector } from '../RelationTypeSelector';
|
|
@@ -30,12 +28,7 @@ export var ConnectionRelationTypeSelector = function (_a) {
|
|
|
30
28
|
var _b = _a.relation, relation = _b === void 0 ? {} : _b, _c = _a.inRelationTypes, inRelationTypes = _c === void 0 ? [] : _c, _d = _a.outRelationTypes, outRelationTypes = _d === void 0 ? [] : _d, _e = _a.onChange, onChange = _e === void 0 ? identity : _e, _f = _a.applyFirstByDefault, applyFirstByDefault = _f === void 0 ? false : _f, _g = _a.reversedContextLabels, reversedContextLabels = _g === void 0 ? false : _g, otherProps = __rest(_a, ["relation", "inRelationTypes", "outRelationTypes", "onChange", "applyFirstByDefault", "reversedContextLabels"]);
|
|
31
29
|
var _h = useRelationTypeSelector({ reversedContextLabels: reversedContextLabels }), getRelationTypesOptions = _h.getRelationTypesOptions, fromEditorValue = _h.fromEditorValue, toEditorValue = _h.toEditorValue;
|
|
32
30
|
var relationsTypesOptions = useMemo(function () { return getRelationTypesOptions(inRelationTypes, outRelationTypes); }, [getRelationTypesOptions, inRelationTypes, outRelationTypes]);
|
|
33
|
-
var handleChange = useCallback(pipe(fromEditorValue(inRelationTypes, outRelationTypes), onChange), [
|
|
34
|
-
fromEditorValue,
|
|
35
|
-
inRelationTypes,
|
|
36
|
-
outRelationTypes,
|
|
37
|
-
onChange
|
|
38
|
-
]);
|
|
31
|
+
var handleChange = useCallback(pipe(fromEditorValue(inRelationTypes, outRelationTypes), onChange), [fromEditorValue, inRelationTypes, outRelationTypes, onChange]);
|
|
39
32
|
var hasValue = !!relation.relationType;
|
|
40
33
|
useEffect(function () {
|
|
41
34
|
if (applyFirstByDefault && relationsTypesOptions.length && !hasValue) {
|
|
@@ -44,12 +37,3 @@ export var ConnectionRelationTypeSelector = function (_a) {
|
|
|
44
37
|
}, [relationsTypesOptions, applyFirstByDefault, handleChange, hasValue]);
|
|
45
38
|
return (React.createElement(RelationTypeSelector, __assign({ value: toEditorValue(relation, relationsTypesOptions), options: relationsTypesOptions, onChange: handleChange }, otherProps)));
|
|
46
39
|
};
|
|
47
|
-
ConnectionRelationTypeSelector.propTypes = {
|
|
48
|
-
className: PropTypes.string,
|
|
49
|
-
relation: ConnectionRelationType,
|
|
50
|
-
inRelationTypes: PropTypes.arrayOf(RelationTypeType),
|
|
51
|
-
outRelationTypes: PropTypes.arrayOf(RelationTypeType),
|
|
52
|
-
applyFirstByDefault: PropTypes.bool,
|
|
53
|
-
reversedContextLabels: PropTypes.bool,
|
|
54
|
-
onChange: PropTypes.func
|
|
55
|
-
};
|
|
@@ -1,45 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TextFieldProps:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { Lookups, LookupValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
export declare const DEBOUNCE_INTERVAL = 400;
|
|
4
|
+
type Props = {
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
value?: LookupValue | LookupValue[];
|
|
7
|
+
TextFieldProps: TextFieldProps;
|
|
8
|
+
lookupCode: string;
|
|
9
|
+
parents?: string[];
|
|
10
|
+
onChange: (value: LookupValue | LookupValue[]) => void;
|
|
11
|
+
getLookups: (params: {
|
|
12
|
+
type: string;
|
|
13
|
+
parents: string[];
|
|
14
|
+
displayNamePrefix: string;
|
|
15
|
+
max: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
}) => Promise<Lookups>;
|
|
18
|
+
lookups: {
|
|
19
|
+
[key: string]: LookupValue[];
|
|
20
|
+
};
|
|
21
|
+
resolveLookups: (lookupType: string, codeValues: LookupValue[]) => void;
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
placeholder?: string;
|
|
16
25
|
max?: number;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
let multiple: PropTypes.Requireable<boolean>;
|
|
21
|
-
let value: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
22
|
-
value: PropTypes.Requireable<string>;
|
|
23
|
-
lookupCode: PropTypes.Requireable<string>;
|
|
24
|
-
}> | PropTypes.InferProps<{
|
|
25
|
-
value: PropTypes.Requireable<string>;
|
|
26
|
-
lookupCode: PropTypes.Requireable<string>;
|
|
27
|
-
}>[]>>;
|
|
28
|
-
let TextFieldProps: PropTypes.Requireable<PropTypes.InferProps<{
|
|
29
|
-
variant: PropTypes.Requireable<string>;
|
|
30
|
-
margin: PropTypes.Requireable<string>;
|
|
31
|
-
hiddenLabel: PropTypes.Requireable<boolean>;
|
|
32
|
-
}>>;
|
|
33
|
-
let lookupCode: PropTypes.Validator<string>;
|
|
34
|
-
let parents: PropTypes.Requireable<any[]>;
|
|
35
|
-
let getLookups: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
|
-
let lookups: PropTypes.Requireable<object>;
|
|
38
|
-
let resolveLookups: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
-
let fullWidth: PropTypes.Requireable<boolean>;
|
|
40
|
-
let placeholder: PropTypes.Requireable<string>;
|
|
41
|
-
let disabled: PropTypes.Requireable<boolean>;
|
|
42
|
-
let max: PropTypes.Requireable<number>;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
import PropTypes from 'prop-types';
|
|
26
|
+
};
|
|
27
|
+
export declare const DependentLookupEditor: ({ multiple, value, lookupCode: lookupTypeCode, TextFieldProps, parents, onChange, getLookups, lookups, resolveLookups, fullWidth, disabled, placeholder, max, ...otherProps }: Props) => JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -23,8 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import classnames from 'classnames';
|
|
25
25
|
import { components } from 'react-select';
|
|
26
|
-
import
|
|
27
|
-
import { debounce, LookupValueType } from '@reltio/mdm-sdk';
|
|
26
|
+
import { debounce } from '@reltio/mdm-sdk';
|
|
28
27
|
import { concat, defaultTo, either, isEmpty, prop, T } from 'ramda';
|
|
29
28
|
import i18n from 'ui-i18n';
|
|
30
29
|
import { EmptyStub } from '../core/utils';
|
|
@@ -163,7 +162,9 @@ export var DependentLookupEditor = function (_a) {
|
|
|
163
162
|
}, [lookupTypeCode]);
|
|
164
163
|
var displayedOptions = useMemo(function () { return options.slice(0, pageNumber * max); }, [max, options, pageNumber]);
|
|
165
164
|
var showMoreButton = options.length > displayedOptions.length;
|
|
166
|
-
var isEmptyValue = multiple
|
|
165
|
+
var isEmptyValue = multiple
|
|
166
|
+
? isEmpty(value)
|
|
167
|
+
: !(value === null || value === void 0 ? void 0 : value.lookupCode) && !(value === null || value === void 0 ? void 0 : value.value);
|
|
167
168
|
var markAsTouched = useAutopopulation({
|
|
168
169
|
initialDefaultOptions: initialDefaultOptions,
|
|
169
170
|
isEmptyValue: isEmptyValue,
|
|
@@ -177,22 +178,3 @@ export var DependentLookupEditor = function (_a) {
|
|
|
177
178
|
return optionsAreLoading && !showMoreButton ? i18n.text('Loading...') : i18n.text('No results found');
|
|
178
179
|
}, components: SelectComponents, isClearable: true, isSearchable: true, controlShouldRenderValue: multiple, inputValue: inputValue, filterOption: multiple ? undefined : T, onInputChange: handleInputChange, loadingMessage: function () { return i18n.text('Loading...'); }, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: either(prop('value'), prop('lookupCode')), getOptionLabel: getOptionLabel, onChange: handleChange, onFocus: multiple ? undefined : handleFocus, value: defaultTo(multiple ? [] : null, value), menuListFooter: showMoreButton && React.createElement(ReactSelectLoadMoreButton, { loading: optionsAreLoading, onClick: loadMoreOptions }) })));
|
|
179
180
|
};
|
|
180
|
-
DependentLookupEditor.propTypes = {
|
|
181
|
-
multiple: PropTypes.bool,
|
|
182
|
-
value: PropTypes.oneOfType([LookupValueType, PropTypes.arrayOf(LookupValueType)]),
|
|
183
|
-
TextFieldProps: PropTypes.shape({
|
|
184
|
-
variant: PropTypes.string,
|
|
185
|
-
margin: PropTypes.string,
|
|
186
|
-
hiddenLabel: PropTypes.bool
|
|
187
|
-
}),
|
|
188
|
-
lookupCode: PropTypes.string.isRequired,
|
|
189
|
-
parents: PropTypes.array,
|
|
190
|
-
getLookups: PropTypes.func,
|
|
191
|
-
onChange: PropTypes.func,
|
|
192
|
-
lookups: PropTypes.object,
|
|
193
|
-
resolveLookups: PropTypes.func,
|
|
194
|
-
fullWidth: PropTypes.bool,
|
|
195
|
-
placeholder: PropTypes.string,
|
|
196
|
-
disabled: PropTypes.bool,
|
|
197
|
-
max: PropTypes.number
|
|
198
|
-
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MultipliableSelect from '../components/MultipliableSelect/MultipliableSelect';
|
|
3
|
+
import { DropDownEntryType } from '../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
entries: DropDownEntryType[];
|
|
6
|
+
classes?: Record<string, string>;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
disableUnderline?: boolean;
|
|
10
|
+
displayEmpty?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
} & Omit<React.ComponentProps<typeof MultipliableSelect>, 'children' | 'getValueLabel' | 'onChange' | 'value'>;
|
|
13
|
+
export declare const DropDownEditor: ({ entries, classes, ...otherProps }: Props) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -21,11 +21,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import PropTypes from 'prop-types';
|
|
25
24
|
import { pipe, prop, propEq } from 'ramda';
|
|
26
25
|
import MenuItem from '@mui/material/MenuItem';
|
|
27
26
|
import MultipliableSelect from '../components/MultipliableSelect/MultipliableSelect';
|
|
28
|
-
import { DropDownEntryType } from '../constants/prop-types';
|
|
29
27
|
var findEntryByValue = function (entries) { return function (value) { return entries.find(propEq('value', value)); }; };
|
|
30
28
|
export var DropDownEditor = function (_a) {
|
|
31
29
|
var entries = _a.entries, _b = _a.classes, classes = _b === void 0 ? {} : _b, otherProps = __rest(_a, ["entries", "classes"]);
|
|
@@ -35,7 +33,3 @@ export var DropDownEditor = function (_a) {
|
|
|
35
33
|
return (React.createElement(MenuItem, { key: index, value: value, className: menuItem }, label || value.toString()));
|
|
36
34
|
})));
|
|
37
35
|
};
|
|
38
|
-
DropDownEditor.propTypes = {
|
|
39
|
-
classes: PropTypes.object,
|
|
40
|
-
entries: PropTypes.arrayOf(DropDownEntryType).isRequired
|
|
41
|
-
};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeType, Entity, AttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
import { ScrollType } from '../contexts/ScrollToElementContext';
|
|
4
|
+
import { EditModeAttributesPagerProps } from '../EditModeAttributesPager/types';
|
|
1
5
|
declare const _default: React.ComponentType<{
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
parentAttributeType?: AttributeType;
|
|
7
|
+
attrTypes: AttributeType[];
|
|
8
|
+
entity: Entity;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
showEmptyEditors?: boolean;
|
|
11
|
+
showNonOv?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
alwaysVisibleTypeUris?: string[];
|
|
14
|
+
highlightAttribute?: (element: AttributeType, type: ScrollType) => void;
|
|
15
|
+
} & Pick<EditModeAttributesPagerProps<AttributeValue>, "mode" | "crosswalks" | "parentUri" | "onDeleteAttribute" | "onChangeAttribute" | "additionalControlsRenderer" | "showEmptyEditors" | "onAddAttributes" | "drawLines">>;
|
|
4
16
|
export default _default;
|
|
5
|
-
import React from 'react';
|
|
@@ -10,9 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useCallback, useContext, useMemo, useState, useEffect } from 'react';
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
13
|
import i18n from 'ui-i18n';
|
|
15
|
-
import { getCreatableAttributeTypes, getAttributesListForEditMode,
|
|
14
|
+
import { getCreatableAttributeTypes, getAttributesListForEditMode, getParentUri, checkCanCreateAttribute } from '@reltio/mdm-sdk';
|
|
16
15
|
import { last, path } from 'ramda';
|
|
17
16
|
import { EditModeAttributesPager } from '../EditModeAttributesPager';
|
|
18
17
|
import { BranchDecorator } from '../BranchDecorator';
|
|
@@ -72,25 +71,6 @@ var EditModeAttributesList = function (_a) {
|
|
|
72
71
|
return (React.createElement(EditModeAttributesPager, { key: "".concat(attrType.uri, "_").concat(parentUri), attributeType: attrType, drawLines: drawLines, values: values, paging: path(['paging', attrType.uri], attributes), parentUri: parentUri, showEmptyEditors: showEmptyEditors, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer, showNonOv: showNonOv }));
|
|
73
72
|
}))));
|
|
74
73
|
};
|
|
75
|
-
EditModeAttributesList.propTypes = {
|
|
76
|
-
parentAttributeType: PropTypes.object,
|
|
77
|
-
attrTypes: PropTypes.array,
|
|
78
|
-
entity: PropTypes.object,
|
|
79
|
-
parentUri: PropTypes.string,
|
|
80
|
-
children: PropTypes.node,
|
|
81
|
-
showEmptyEditors: PropTypes.bool,
|
|
82
|
-
mode: ModeType,
|
|
83
|
-
crosswalks: PropTypes.array,
|
|
84
|
-
drawLines: PropTypes.bool,
|
|
85
|
-
showNonOv: PropTypes.bool,
|
|
86
|
-
className: PropTypes.string,
|
|
87
|
-
alwaysVisibleTypeUris: PropTypes.array,
|
|
88
|
-
onAddAttributes: PropTypes.func,
|
|
89
|
-
onChangeAttribute: PropTypes.func,
|
|
90
|
-
onDeleteAttribute: PropTypes.func,
|
|
91
|
-
additionalControlsRenderer: PropTypes.func,
|
|
92
|
-
highlightAttribute: PropTypes.func
|
|
93
|
-
};
|
|
94
74
|
export default withContext(ScrollToElementContext, function (contextValue) {
|
|
95
75
|
var highlightAttribute = (contextValue || {}).highlightAttribute;
|
|
96
76
|
return { highlightAttribute: highlightAttribute };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { AttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
|
|
2
3
|
import { EditModeAttributesPagerProps } from './types';
|
|
3
|
-
declare const _default:
|
|
4
|
+
declare const _default: <T_1 extends AttributeValue | PrimitiveValue>(props: EditModeAttributesPagerProps<T_1>) => ReactElement;
|
|
4
5
|
export default _default;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeValue,
|
|
2
|
+
import { AttributeValue, AttributeError, RequestNextPageOfAttributeValuesPayload, Optional } from '@reltio/mdm-sdk';
|
|
3
3
|
import { EditModeAttributesPagerProps } from '../../types';
|
|
4
|
-
type Props =
|
|
5
|
-
values?: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue)[];
|
|
4
|
+
type Props = Optional<EditModeAttributesPagerProps<AttributeValue>, 'values'> & {
|
|
6
5
|
nonVisibleValues: AttributeValue[];
|
|
7
6
|
errorMessage?: string;
|
|
8
7
|
errors?: AttributeError[];
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AttributeType, Crosswalk,
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { AttributeType, Crosswalk, Mode, Paging, AttributeItem, AttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
|
|
3
3
|
import { ScrollToElementContext } from '../contexts/ScrollToElementContext';
|
|
4
|
+
import { AdditionalControlsRenderer } from '../types';
|
|
4
5
|
export declare enum RENDERER_TYPES {
|
|
5
6
|
imageLine = "imageLine",
|
|
6
7
|
special = "special",
|
|
7
8
|
default = "default"
|
|
8
9
|
}
|
|
9
|
-
export type EditModeAttributesPagerProps = {
|
|
10
|
-
values:
|
|
10
|
+
export type EditModeAttributesPagerProps<T extends AttributeValue | PrimitiveValue> = {
|
|
11
|
+
values: T[];
|
|
11
12
|
attributeType: AttributeType;
|
|
12
13
|
paging?: Paging;
|
|
13
14
|
mode?: Mode;
|
|
14
15
|
crosswalks?: Crosswalk[];
|
|
15
16
|
parentUri: string;
|
|
16
|
-
drawLines
|
|
17
|
+
drawLines?: boolean;
|
|
17
18
|
max?: number;
|
|
18
19
|
showEmptyEditors: boolean;
|
|
19
20
|
showNonOv?: boolean;
|
|
20
21
|
onAddAttributes: (params: AttributeItem[]) => void;
|
|
21
22
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
22
23
|
onChangeAttribute: (param: AttributeItem) => void;
|
|
23
|
-
additionalControlsRenderer?: (props:
|
|
24
|
+
additionalControlsRenderer?: (props: AdditionalControlsRenderer<AttributeValue>) => ReactNode;
|
|
24
25
|
highlightedError?: React.ContextType<typeof ScrollToElementContext>;
|
|
25
26
|
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
26
27
|
};
|
|
@@ -1,5 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
import React, { ContextType, ReactNode } from 'react';
|
|
2
|
+
import { Crosswalk, AttributeType, AttributeError, Mode, Metadata, ComplexAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
import { ScrollToElementContext } from '../contexts/ScrollToElementContext';
|
|
4
|
+
import { AdditionalControlsRenderer } from '../types';
|
|
5
|
+
export type EditModeComplexAttributeProps<T> = {
|
|
6
|
+
label?: string;
|
|
7
|
+
attributeTypesList?: AttributeType[];
|
|
8
|
+
attributeType: AttributeType;
|
|
9
|
+
attributeValue: T;
|
|
10
|
+
errors?: AttributeError[];
|
|
11
|
+
ownError?: AttributeError;
|
|
12
|
+
mode: Mode;
|
|
13
|
+
metadata: Metadata;
|
|
14
|
+
crosswalks?: Crosswalk[];
|
|
15
|
+
lazy?: boolean;
|
|
16
|
+
showEmptyEditors?: boolean;
|
|
17
|
+
onAddOneMore?: () => void;
|
|
18
|
+
onAddAttributes: (attribute: {
|
|
19
|
+
uri: string;
|
|
20
|
+
attributeType: AttributeType;
|
|
21
|
+
}[]) => void;
|
|
22
|
+
onDeleteAttribute: (attribute: {
|
|
23
|
+
uri: string;
|
|
24
|
+
attributeType: AttributeType;
|
|
25
|
+
attributeValue: T;
|
|
26
|
+
}) => void;
|
|
27
|
+
onChangeAttribute: (attribute: {
|
|
28
|
+
uri: string;
|
|
29
|
+
attributeType: AttributeType;
|
|
30
|
+
value: T;
|
|
31
|
+
}) => void;
|
|
32
|
+
additionalControlsRenderer: (props: AdditionalControlsRenderer<ComplexAttributeValue>) => ReactNode;
|
|
33
|
+
hideDeleteButton?: boolean;
|
|
34
|
+
state?: 'deleted' | 'edited';
|
|
35
|
+
showNonOv?: boolean;
|
|
36
|
+
isHighlightedPath?: boolean;
|
|
37
|
+
highlightedError?: ContextType<typeof ScrollToElementContext>;
|
|
38
|
+
expanded?: boolean;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
declare const _default: React.ComponentType<EditModeComplexAttributeProps<ComplexAttributeValue>>;
|
|
4
42
|
export default _default;
|
|
5
|
-
import React from 'react';
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import React, { useMemo, useState, useEffect } from 'react';
|
|
13
2
|
import { pipe, propOr, pathEq, any } from 'ramda';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
3
|
import classnames from 'classnames';
|
|
16
4
|
import i18n from 'ui-i18n';
|
|
17
|
-
import { checkCanDeleteAttribute, isReltioCrosswalk, isTempUri,
|
|
5
|
+
import { checkCanDeleteAttribute, isReltioCrosswalk, isTempUri, getErrorMessage, hasAttributeDescendantsWithErrors, isAnalyticAttribute } from '@reltio/mdm-sdk';
|
|
18
6
|
import Button from '@mui/material/Button';
|
|
19
7
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
20
8
|
import Typography from '@mui/material/Typography';
|
|
@@ -71,10 +59,12 @@ var EditModeComplexAttribute = function (_a) {
|
|
|
71
59
|
}
|
|
72
60
|
}, [deleted]);
|
|
73
61
|
var hasAnalyticValue = (attributeTypesList || []).some(function (attributeType) { return isAnalyticAttribute(attributeType); });
|
|
74
|
-
var attributeListEntity = useMemo(function () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
var attributeListEntity = useMemo(function () {
|
|
63
|
+
return ({
|
|
64
|
+
attributes: hasAnalyticValue ? null : attributeValue.value,
|
|
65
|
+
analyticsAttributes: hasAnalyticValue ? attributeValue.value : null
|
|
66
|
+
});
|
|
67
|
+
}, [attributeValue, hasAnalyticValue]);
|
|
78
68
|
var errorMessage = getErrorMessage(ownError) || (hasDescendantsWithErrors && i18n.text('Has an incorrect value')) || '';
|
|
79
69
|
return lazy ? (React.createElement(Button, { variant: "text", color: "primary", onClick: onAddOneMore }, "Create attribute")) : (React.createElement("div", { ref: ref, className: classnames(styles.complexWrapper, errorClassName) },
|
|
80
70
|
React.createElement("div", { className: styles.editor },
|
|
@@ -91,7 +81,6 @@ var EditModeComplexAttribute = function (_a) {
|
|
|
91
81
|
showDeleteButton && (React.createElement(SmallIconButton, { icon: DeleteIcon, onClick: onDeleteThis, size: "L", "data-reltio-id": "reltio-delete-complex-attribute-button" })))),
|
|
92
82
|
expanded && (React.createElement(EditModeAttributesList, { parentAttributeType: attributeType, attrTypes: attributeTypesList, entity: attributeListEntity, showEmptyEditors: showEmptyEditors || isNew, drawLines: true, parentUri: uri, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer, showNonOv: showNonOv }, children))));
|
|
93
83
|
};
|
|
94
|
-
EditModeComplexAttribute.propTypes = __assign({ label: PropTypes.string, children: PropTypes.node, attributeTypesList: PropTypes.arrayOf(AttributeTypeType), attributeValue: PropTypes.oneOfType([NestedAttributeValueType, ReferenceAttributeValueType]), highlightedError: PropTypes.object, isHighlightedPath: PropTypes.bool }, ComplexAttributeType);
|
|
95
84
|
export default withContext(ScrollToElementContext, function (contextValue, _a) {
|
|
96
85
|
var attributeValue = _a.attributeValue;
|
|
97
86
|
var _b = contextValue || {}, element = _b.element, type = _b.type;
|