@reltio/components 1.4.1511 → 1.4.1512
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/components/ProfilesList/styles.d.ts +1 -1
- package/cjs/components/RelationEditor/RelationEditor.js +4 -4
- package/cjs/components/attributes/editMode/AttributesFactory/Attribute.d.ts +6 -1
- package/cjs/components/attributes/editMode/AttributesFactory/Attribute.js +40 -4
- package/cjs/components/attributes/editMode/AttributesList/AttributesList.d.ts +3 -39
- package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +10 -3
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +9 -7
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +8 -12
- package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.d.ts +38 -2
- package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.js +19 -28
- package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +4 -2
- package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +5 -2
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +3 -1
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -3
- package/cjs/components/attributes/editMode/AttributesPager/index.d.ts +4 -1
- package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +5 -4
- package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +3 -3
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +3 -3
- package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/styles.d.ts +1 -0
- package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/styles.js +38 -0
- package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +8 -0
- package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +17 -0
- package/cjs/components/workflow/helpers/errors.d.ts +3 -2
- package/cjs/components/workflow/helpers/errors.js +15 -9
- package/cjs/components/workflow/hooks/useChangeRequest.js +2 -2
- package/cjs/contexts/ScrollToElementContext/index.d.ts +20 -0
- package/cjs/contexts/ScrollToElementContext/index.js +73 -0
- package/cjs/contexts/index.d.ts +1 -1
- package/cjs/contexts/index.js +7 -4
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -2
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/esm/components/ProfilesList/styles.d.ts +1 -1
- package/esm/components/RelationEditor/RelationEditor.js +5 -5
- package/esm/components/attributes/editMode/AttributesFactory/Attribute.d.ts +6 -1
- package/esm/components/attributes/editMode/AttributesFactory/Attribute.js +17 -4
- package/esm/components/attributes/editMode/AttributesList/AttributesList.d.ts +3 -39
- package/esm/components/attributes/editMode/AttributesList/AttributesList.js +12 -5
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +9 -7
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +10 -14
- package/esm/components/attributes/editMode/AttributesPager/AttributesPager.d.ts +38 -2
- package/esm/components/attributes/editMode/AttributesPager/AttributesPager.js +20 -6
- package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +4 -2
- package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +5 -2
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +3 -1
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -3
- package/esm/components/attributes/editMode/AttributesPager/index.d.ts +4 -1
- package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -5
- package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +4 -4
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +4 -4
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/styles.d.ts +1 -0
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/styles.js +35 -0
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +8 -0
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +13 -0
- package/esm/components/workflow/helpers/errors.d.ts +3 -2
- package/esm/components/workflow/helpers/errors.js +13 -8
- package/esm/components/workflow/hooks/useChangeRequest.js +3 -3
- package/esm/contexts/ScrollToElementContext/index.d.ts +20 -0
- package/esm/contexts/ScrollToElementContext/index.js +44 -0
- package/esm/contexts/index.d.ts +1 -1
- package/esm/contexts/index.js +1 -1
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -2
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/package.json +3 -3
- package/cjs/contexts/ScrollToErrorContext/index.d.ts +0 -13
- package/cjs/contexts/ScrollToErrorContext/index.js +0 -48
- package/esm/contexts/ScrollToErrorContext/index.d.ts +0 -13
- package/esm/contexts/ScrollToErrorContext/index.js +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inactive" | "label" | "image" | "selected" | "secondaryLabel" | "item" | "info" | "avatar" | "clickable" | "businessCard" | "@keyframes animate" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inactive" | "label" | "image" | "selected" | "secondaryLabel" | "item" | "info" | "avatar" | "clickable" | "highlighted" | "businessCard" | "@keyframes animate" | "justImported" | "secondRow">;
|
|
@@ -202,10 +202,10 @@ RelationEditor.propTypes = {
|
|
|
202
202
|
parentEntityUri: prop_types_1.default.string,
|
|
203
203
|
highlightedError: prop_types_1.default.object
|
|
204
204
|
};
|
|
205
|
-
exports.default = (0, HOCs_1.withContext)(contexts_1.
|
|
205
|
+
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue, _a) {
|
|
206
206
|
var connection = _a.connection;
|
|
207
|
-
var _b =
|
|
208
|
-
var
|
|
209
|
-
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(
|
|
207
|
+
var _b = contextValue || {}, _c = _b.element, element = _c === void 0 ? {} : _c, type = _b.type;
|
|
208
|
+
var _d = connection.relation, relationUri = _d.relationUri, relationType = _d.relationType;
|
|
209
|
+
var isHighlighted = (0, contexts_1.isHighlightedErrorType)(type) && (0, mdm_sdk_1.isAttributeTypeError)(element, relationUri, relationType);
|
|
210
210
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
211
211
|
}, RelationEditor);
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const Attribute: React.ForwardRefExoticComponent<Pick<{
|
|
4
|
+
className?: string;
|
|
5
|
+
attributeType: AttributeType;
|
|
6
|
+
} & Record<string, unknown>, string> & React.RefAttributes<HTMLDivElement>>;
|
|
1
7
|
export default Attribute;
|
|
2
|
-
declare function Attribute(props: any): JSX.Element;
|
|
@@ -1,11 +1,47 @@
|
|
|
1
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 __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
2
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
38
|
};
|
|
5
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var react_1 = __importStar(require("react"));
|
|
6
41
|
var AttributesFactory_1 = __importDefault(require("./AttributesFactory"));
|
|
7
|
-
var Attribute = function (props) {
|
|
8
|
-
var
|
|
9
|
-
return AttributesFactory_1.default.build(attributeType,
|
|
10
|
-
};
|
|
42
|
+
var Attribute = (0, react_1.forwardRef)(function (props, ref) {
|
|
43
|
+
var className = props.className, otherProps = __rest(props, ["className"]);
|
|
44
|
+
return (react_1.default.createElement("div", { ref: ref, className: className }, AttributesFactory_1.default.build(props.attributeType, otherProps)));
|
|
45
|
+
});
|
|
46
|
+
Attribute.displayName = 'Attribute';
|
|
11
47
|
exports.default = Attribute;
|
|
@@ -1,41 +1,5 @@
|
|
|
1
|
-
declare const _default: React.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
attrTypes: any;
|
|
5
|
-
entity: any;
|
|
6
|
-
parentUri: any;
|
|
7
|
-
showEmptyEditors: any;
|
|
8
|
-
mode: any;
|
|
9
|
-
crosswalks: any;
|
|
10
|
-
drawLines: any;
|
|
11
|
-
children: any;
|
|
12
|
-
className: any;
|
|
13
|
-
alwaysVisibleTypeUris?: string[];
|
|
14
|
-
onAddAttributes: any;
|
|
15
|
-
onChangeAttribute: any;
|
|
16
|
-
onDeleteAttribute: any;
|
|
17
|
-
additionalControlsRenderer: any;
|
|
18
|
-
showNonOv: any;
|
|
19
|
-
}): JSX.Element;
|
|
20
|
-
propTypes: {
|
|
21
|
-
parentAttributeType: PropTypes.Requireable<object>;
|
|
22
|
-
attrTypes: PropTypes.Requireable<any[]>;
|
|
23
|
-
entity: PropTypes.Requireable<object>;
|
|
24
|
-
parentUri: PropTypes.Requireable<string>;
|
|
25
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
|
-
showEmptyEditors: PropTypes.Requireable<boolean>;
|
|
27
|
-
mode: PropTypes.Requireable<any>;
|
|
28
|
-
crosswalks: PropTypes.Requireable<any[]>;
|
|
29
|
-
drawLines: PropTypes.Requireable<boolean>;
|
|
30
|
-
showNonOv: PropTypes.Requireable<boolean>;
|
|
31
|
-
className: PropTypes.Requireable<string>;
|
|
32
|
-
alwaysVisibleTypeUris: PropTypes.Requireable<any[]>;
|
|
33
|
-
onAddAttributes: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
onChangeAttribute: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
-
onDeleteAttribute: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
additionalControlsRenderer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
1
|
+
declare const _default: React.ComponentType<{
|
|
2
|
+
[x: string]: unknown;
|
|
3
|
+
}> | ((props: any) => JSX.Element);
|
|
39
4
|
export default _default;
|
|
40
|
-
import PropTypes from "prop-types";
|
|
41
5
|
import React from "react";
|
|
@@ -50,8 +50,10 @@ var attributesView_1 = require("../../helpers/attributesView");
|
|
|
50
50
|
var helpers_1 = require("./helpers");
|
|
51
51
|
var PinnedAttributesContext_1 = require("../contexts/PinnedAttributesContext");
|
|
52
52
|
var HasDeletionsContext_1 = require("../contexts/HasDeletionsContext");
|
|
53
|
+
var HOCs_1 = require("../../../../HOCs");
|
|
54
|
+
var contexts_1 = require("../../../../contexts");
|
|
53
55
|
var AttributesList = function (_a) {
|
|
54
|
-
var parentAttributeType = _a.parentAttributeType, attrTypes = _a.attrTypes, entity = _a.entity, parentUri = _a.parentUri, showEmptyEditors = _a.showEmptyEditors, mode = _a.mode, crosswalks = _a.crosswalks, drawLines = _a.drawLines, children = _a.children, className = _a.className, _b = _a.alwaysVisibleTypeUris, alwaysVisibleTypeUris = _b === void 0 ? constants_1.ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv;
|
|
56
|
+
var parentAttributeType = _a.parentAttributeType, attrTypes = _a.attrTypes, entity = _a.entity, parentUri = _a.parentUri, showEmptyEditors = _a.showEmptyEditors, mode = _a.mode, crosswalks = _a.crosswalks, drawLines = _a.drawLines, children = _a.children, className = _a.className, _b = _a.alwaysVisibleTypeUris, alwaysVisibleTypeUris = _b === void 0 ? constants_1.ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv, highlightAttribute = _a.highlightAttribute;
|
|
55
57
|
var _c = entity.attributes, attributes = _c === void 0 ? {} : _c;
|
|
56
58
|
var _d = (0, react_1.useState)({}), hasDeletionsMap = _d[0], setHasDeletionsMap = _d[1];
|
|
57
59
|
var setHasDeletions = (0, react_1.useCallback)(function (attrTypeUri, value) {
|
|
@@ -74,6 +76,7 @@ var AttributesList = function (_a) {
|
|
|
74
76
|
attributeType: attributeType,
|
|
75
77
|
parentUri: attributeType === parentAttributeType ? (0, mdm_sdk_1.getParentUri)(parentUri) : parentUri
|
|
76
78
|
}); }));
|
|
79
|
+
highlightAttribute((0, ramda_1.last)(attributeTypes), contexts_1.ScrollType.NewAttribute);
|
|
77
80
|
}, [onAddAttributes, parentUri, parentAttributeType]);
|
|
78
81
|
var decoratorProps = {
|
|
79
82
|
enabled: drawLines
|
|
@@ -106,6 +109,10 @@ AttributesList.propTypes = {
|
|
|
106
109
|
onAddAttributes: prop_types_1.default.func,
|
|
107
110
|
onChangeAttribute: prop_types_1.default.func,
|
|
108
111
|
onDeleteAttribute: prop_types_1.default.func,
|
|
109
|
-
additionalControlsRenderer: prop_types_1.default.func
|
|
112
|
+
additionalControlsRenderer: prop_types_1.default.func,
|
|
113
|
+
highlightAttribute: prop_types_1.default.func
|
|
110
114
|
};
|
|
111
|
-
exports.default = (0,
|
|
115
|
+
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue) {
|
|
116
|
+
var highlightAttribute = (contextValue || {}).highlightAttribute;
|
|
117
|
+
return { highlightAttribute: highlightAttribute };
|
|
118
|
+
}, AttributesList);
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeValue, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
3
|
import { AttributePagerProps } from './index';
|
|
4
|
-
|
|
4
|
+
import { ScrollToElementContext } from '../../../../contexts';
|
|
5
|
+
declare type Props = Required<Omit<AttributePagerProps, 'values'>> & {
|
|
5
6
|
values?: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue)[];
|
|
6
7
|
nonVisibleValues: AttributeValue[];
|
|
7
|
-
highlightedError?:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
8
|
+
highlightedError?: React.ContextType<typeof ScrollToElementContext>;
|
|
9
|
+
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: React.MemoExoticComponent<{
|
|
12
|
+
({ max, values, attributeType, parentUri, mode, drawLines, showEmptyEditors, errorMessage, errors, paging, crosswalks, showNonOv, nonVisibleValues, highlightedError, highlightedAttribute, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: Props): JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
}>;
|
|
13
15
|
export default _default;
|
|
@@ -39,20 +39,20 @@ var ShowMore_1 = __importDefault(require("../../pagersCommon/ShowMore"));
|
|
|
39
39
|
var Attribute_1 = __importDefault(require("../AttributesFactory/Attribute"));
|
|
40
40
|
var CardinalityMessage_1 = __importDefault(require("./CardinalityMessage"));
|
|
41
41
|
var utils_1 = require("./utils");
|
|
42
|
-
var HOCs_1 = require("../../../../HOCs");
|
|
43
42
|
var PinnedAttributesContext_1 = require("../contexts/PinnedAttributesContext");
|
|
44
43
|
var hooks_1 = require("../../../../hooks");
|
|
45
|
-
var contexts_1 = require("../../../../contexts");
|
|
46
44
|
var DescriptionIcon_1 = __importDefault(require("../../DescriptionIcon/DescriptionIcon"));
|
|
45
|
+
var useScrollToAttribute_1 = require("../hooks/useScrollToAttribute/useScrollToAttribute");
|
|
47
46
|
var styles_1 = require("./styles");
|
|
48
47
|
var AttributeRenderer = function (_a) {
|
|
49
|
-
var max = _a.max, values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, drawLines = _a.drawLines, showEmptyEditors = _a.showEmptyEditors, errorMessage = _a.errorMessage, errors = _a.errors, paging = _a.paging, crosswalks = _a.crosswalks, showNonOv = _a.showNonOv, nonVisibleValues = _a.nonVisibleValues, highlightedError = _a.highlightedError, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
48
|
+
var max = _a.max, values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, drawLines = _a.drawLines, showEmptyEditors = _a.showEmptyEditors, errorMessage = _a.errorMessage, errors = _a.errors, paging = _a.paging, crosswalks = _a.crosswalks, showNonOv = _a.showNonOv, nonVisibleValues = _a.nonVisibleValues, highlightedError = _a.highlightedError, highlightedAttribute = _a.highlightedAttribute, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
50
49
|
var styles = (0, styles_1.useStyles)();
|
|
51
50
|
var _b = (0, react_1.useState)(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
|
|
52
51
|
var _c = (0, react_1.useState)(false), hadDeletions = _c[0], setHadDeletions = _c[1];
|
|
53
52
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality, name = attributeType.name, attributeTypeUri = attributeType.uri, description = attributeType.description;
|
|
54
53
|
var isEditableMode = (0, mdm_sdk_1.isEditableMode)(mode);
|
|
55
|
-
var _d = (0, hooks_1.useScrollToAttributeError)({ highlightedError: highlightedError }),
|
|
54
|
+
var _d = (0, hooks_1.useScrollToAttributeError)({ highlightedError: highlightedError }), errorRef = _d.ref, errorClassName = _d.errorClassName;
|
|
55
|
+
var _e = (0, useScrollToAttribute_1.useScrollToAttribute)(highlightedAttribute), attributeRef = _e.ref, highlightedClassName = _e.highlightedClassName;
|
|
56
56
|
var pinnedAttributes = (0, react_1.useContext)(PinnedAttributesContext_1.PinnedAttributesContext);
|
|
57
57
|
var isPinned = (0, react_1.useMemo)(function () { return pinnedAttributes === null || pinnedAttributes === void 0 ? void 0 : pinnedAttributes.includes(attributeTypeUri); }, [attributeTypeUri, pinnedAttributes]);
|
|
58
58
|
var isEmptyValues = (0, mdm_sdk_1.isEmptyValue)(values);
|
|
@@ -108,7 +108,7 @@ var AttributeRenderer = function (_a) {
|
|
|
108
108
|
var lastIndex = shownValues ? shownValues.length - 1 : 0;
|
|
109
109
|
var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
|
|
110
110
|
return (react_1.default.createElement(BranchDecorator_1.default, { enabled: drawLines },
|
|
111
|
-
react_1.default.createElement("div", { ref:
|
|
111
|
+
react_1.default.createElement("div", { ref: errorRef, className: (0, classnames_1.default)(styles.wrapper, errorClassName) },
|
|
112
112
|
react_1.default.createElement("div", { className: styles.titleWrapper },
|
|
113
113
|
react_1.default.createElement(Title_1.default, { label: label, isRequired: isRequired, className: styles.title, "data-reltio-id": "reltio-attribute-label" }),
|
|
114
114
|
react_1.default.createElement(DescriptionIcon_1.default, { description: description, className: styles.description }),
|
|
@@ -116,13 +116,9 @@ var AttributeRenderer = function (_a) {
|
|
|
116
116
|
isEditableMode && react_1.default.createElement(CardinalityMessage_1.default, { cardinality: cardinality }),
|
|
117
117
|
isEditableMode && react_1.default.createElement(ErrorMessage_1.default, { message: errorMessage, className: styles.typeError }),
|
|
118
118
|
react_1.default.createElement("div", { className: styles.attributesWrapper },
|
|
119
|
-
shownValues.map(function (value, idx) { return (react_1.default.createElement(Attribute_1.default, { key: value.uri, attributeValue: value, attributeType: attributeType, lazy: showEmpty && !isRequired, showEmptyEditors: showEmptyEditors, errors: errors, ownError: (0, mdm_sdk_1.getAttributeOwnError)(value, idx, attributeType.uri, errors), mode: mode, crosswalks: crosswalks, onAddOneMore: lastIndex === idx ? onAddOneMore : null, onAddAttributes: onAddAttributes, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute, onDeactivateError: onDeactivateError, additionalControlsRenderer: additionalControlsRenderer })); }),
|
|
119
|
+
shownValues.map(function (value, idx) { return (react_1.default.createElement(Attribute_1.default, { key: value.uri, attributeValue: value, attributeType: attributeType, lazy: showEmpty && !isRequired, showEmptyEditors: showEmptyEditors, errors: errors, ownError: (0, mdm_sdk_1.getAttributeOwnError)(value, idx, attributeType.uri, errors), mode: mode, crosswalks: crosswalks, onAddOneMore: lastIndex === idx ? onAddOneMore : null, onAddAttributes: onAddAttributes, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute, onDeactivateError: onDeactivateError, additionalControlsRenderer: additionalControlsRenderer, className: idx === 0 ? highlightedClassName : null, ref: idx === 0 ? attributeRef : null })); }),
|
|
120
120
|
showMore && (react_1.default.createElement(ShowMore_1.default, { moreNumber: (0, ramda_1.min)(max, hiddenValuesCount), valueNumber: hiddenValuesCount, onClick: onShowMore })),
|
|
121
121
|
showLess && react_1.default.createElement(ShowLess_1.default, { onClick: onShowLess })))));
|
|
122
122
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var error = (contextValue || {}).error;
|
|
126
|
-
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(error, parentUri, attributeType.uri);
|
|
127
|
-
return { highlightedError: isHighlighted ? contextValue : null };
|
|
128
|
-
}, AttributeRenderer);
|
|
123
|
+
AttributeRenderer.displayName = 'AttributeRenderer';
|
|
124
|
+
exports.default = (0, react_1.memo)(AttributeRenderer);
|
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const _default: React.
|
|
2
|
+
import { AttributeError, AttributeType, Mode, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
declare const _default: React.ComponentType<{
|
|
4
|
+
errorMessage: string;
|
|
5
|
+
errors: AttributeError[];
|
|
6
|
+
max: number;
|
|
7
|
+
} & {
|
|
8
|
+
onDeactivateError: (id: string) => void;
|
|
9
|
+
requestNextPageOfAttributeValues: (payload: import("@reltio/mdm-module").RequestNextPageOfAttributeValuesPayload) => void;
|
|
10
|
+
} & {
|
|
11
|
+
values: (string | number | SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue | import("@reltio/mdm-sdk").ImageAttributeValue)[];
|
|
12
|
+
attributeType: AttributeType;
|
|
13
|
+
paging?: import("@reltio/mdm-sdk").Paging;
|
|
14
|
+
mode?: Mode;
|
|
15
|
+
crosswalks?: import("@reltio/mdm-sdk").Crosswalk[];
|
|
16
|
+
parentUri: string;
|
|
17
|
+
drawLines: boolean;
|
|
18
|
+
max?: number;
|
|
19
|
+
showEmptyEditors: boolean;
|
|
20
|
+
showNonOv?: boolean;
|
|
21
|
+
onAddAttributes: (params: import("@reltio/mdm-sdk").AttributeItem[]) => void;
|
|
22
|
+
onDeleteAttribute: (param: import("@reltio/mdm-sdk").AttributeItem) => void;
|
|
23
|
+
onChangeAttribute: (param: import("@reltio/mdm-sdk").AttributeItem) => void;
|
|
24
|
+
additionalControlsRenderer?: (props: any) => JSX.Element;
|
|
25
|
+
highlightedError?: {
|
|
26
|
+
element: unknown;
|
|
27
|
+
type: import("../../../../contexts").ScrollType;
|
|
28
|
+
highlightError?: (element: unknown) => void;
|
|
29
|
+
highlightAttribute?: (element: unknown) => void;
|
|
30
|
+
scrollIntoRef: (ref: React.MutableRefObject<HTMLDivElement>) => void;
|
|
31
|
+
};
|
|
32
|
+
highlightedAttribute?: {
|
|
33
|
+
element: unknown;
|
|
34
|
+
type: import("../../../../contexts").ScrollType;
|
|
35
|
+
highlightError?: (element: unknown) => void;
|
|
36
|
+
highlightAttribute?: (element: unknown) => void;
|
|
37
|
+
scrollIntoRef: (ref: React.MutableRefObject<HTMLDivElement>) => void;
|
|
38
|
+
};
|
|
39
|
+
}> | ((props: any) => JSX.Element);
|
|
4
40
|
export default _default;
|
|
@@ -10,40 +10,19 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var react_1 =
|
|
17
|
+
var react_1 = __importDefault(require("react"));
|
|
41
18
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
42
19
|
var ramda_1 = require("ramda");
|
|
43
20
|
var BranchDecorator_1 = __importDefault(require("../../BranchDecorator/BranchDecorator"));
|
|
44
21
|
var AttributeRenderer_1 = __importDefault(require("./AttributeRenderer"));
|
|
45
22
|
var SpecialRenderer_1 = __importDefault(require("./SpecialRenderer"));
|
|
46
23
|
var ImageLineRenderer_1 = require("./ImageLineRenderer");
|
|
24
|
+
var HOCs_1 = require("../../../../HOCs");
|
|
25
|
+
var contexts_1 = require("../../../../contexts");
|
|
47
26
|
var RENDERER_TYPES;
|
|
48
27
|
(function (RENDERER_TYPES) {
|
|
49
28
|
RENDERER_TYPES["imageLine"] = "imageLine";
|
|
@@ -51,7 +30,7 @@ var RENDERER_TYPES;
|
|
|
51
30
|
RENDERER_TYPES["default"] = "default";
|
|
52
31
|
})(RENDERER_TYPES || (RENDERER_TYPES = {}));
|
|
53
32
|
var AttributesPager = function (_a) {
|
|
54
|
-
var values = _a.values, attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? mdm_sdk_1.Mode.Viewing : _b, crosswalks = _a.crosswalks, drawLines = _a.drawLines, _c = _a.paging, paging = _c === void 0 ? {} : _c, parentUri = _a.parentUri, errors = _a.errors, errorMessage = _a.errorMessage, _d = _a.max, max = _d === void 0 ? Infinity : _d, showEmptyEditors = _a.showEmptyEditors, showNonOv = _a.showNonOv, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
33
|
+
var values = _a.values, attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? mdm_sdk_1.Mode.Viewing : _b, crosswalks = _a.crosswalks, drawLines = _a.drawLines, _c = _a.paging, paging = _c === void 0 ? {} : _c, parentUri = _a.parentUri, errors = _a.errors, errorMessage = _a.errorMessage, _d = _a.max, max = _d === void 0 ? Infinity : _d, showEmptyEditors = _a.showEmptyEditors, showNonOv = _a.showNonOv, highlightedError = _a.highlightedError, highlightedAttribute = _a.highlightedAttribute, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
55
34
|
var partitionByOv = (0, ramda_1.partition)(mdm_sdk_1.isOv);
|
|
56
35
|
var _e = partitionByOv(values), ovValues = _e[0], nonOvValues = _e[1];
|
|
57
36
|
var visibleValues = showNonOv ? values : ovValues;
|
|
@@ -66,7 +45,9 @@ var AttributesPager = function (_a) {
|
|
|
66
45
|
onChangeAttribute: onChangeAttribute,
|
|
67
46
|
onDeactivateError: onDeactivateError,
|
|
68
47
|
additionalControlsRenderer: additionalControlsRenderer,
|
|
69
|
-
showEmptyEditors: showEmptyEditors
|
|
48
|
+
showEmptyEditors: showEmptyEditors,
|
|
49
|
+
highlightedError: highlightedError,
|
|
50
|
+
highlightedAttribute: highlightedAttribute
|
|
70
51
|
};
|
|
71
52
|
var renderAttribute = function () {
|
|
72
53
|
var type = (0, ramda_1.cond)([
|
|
@@ -81,11 +62,21 @@ var AttributesPager = function (_a) {
|
|
|
81
62
|
}
|
|
82
63
|
case RENDERER_TYPES.imageLine:
|
|
83
64
|
return (react_1.default.createElement(BranchDecorator_1.default, { enabled: drawLines },
|
|
84
|
-
react_1.default.createElement(ImageLineRenderer_1.ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })));
|
|
65
|
+
react_1.default.createElement(ImageLineRenderer_1.ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, highlightedAttribute: highlightedAttribute })));
|
|
85
66
|
default:
|
|
86
67
|
return (react_1.default.createElement(AttributeRenderer_1.default, __assign({ values: visibleValues, attributeType: attributeType, max: max, paging: paging, crosswalks: crosswalks, drawLines: drawLines, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, nonVisibleValues: nonVisibleValues }, commonProps)));
|
|
87
68
|
}
|
|
88
69
|
};
|
|
89
70
|
return renderAttribute();
|
|
90
71
|
};
|
|
91
|
-
exports.default = (0,
|
|
72
|
+
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue, _a) {
|
|
73
|
+
var attributeType = _a.attributeType, parentUri = _a.parentUri;
|
|
74
|
+
var _b = contextValue || {}, element = _b.element, type = _b.type;
|
|
75
|
+
var isHighlightedAttribute = (0, contexts_1.isHighlightedAttributeType)(type) && element.uri === attributeType.uri;
|
|
76
|
+
var isHighlightedError = (0, contexts_1.isHighlightedErrorType)(type) &&
|
|
77
|
+
(0, mdm_sdk_1.isAttributeTypeError)(element, parentUri, attributeType.uri);
|
|
78
|
+
return {
|
|
79
|
+
highlightedAttribute: isHighlightedAttribute ? contextValue : null,
|
|
80
|
+
highlightedError: isHighlightedError ? contextValue : null
|
|
81
|
+
};
|
|
82
|
+
}, AttributesPager);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AttributeItem, AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
|
|
3
3
|
import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
4
|
+
import { ScrollToElementContext } from '../../../../contexts';
|
|
4
5
|
declare type Props = {
|
|
5
6
|
attributeType: AttributeType;
|
|
6
7
|
attributeValues: ImageAttributeValue[];
|
|
@@ -10,6 +11,7 @@ declare type Props = {
|
|
|
10
11
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
11
12
|
onChangeAttribute: (param: AttributeItem) => void;
|
|
12
13
|
requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
|
|
14
|
+
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
13
15
|
};
|
|
14
|
-
export declare const ImageLineRenderer: ({ attributeType, attributeValues, paging, parentUri, showNonOv, onDeleteAttribute, onChangeAttribute, requestNextPageOfAttributeValues }: Props) => JSX.Element;
|
|
16
|
+
export declare const ImageLineRenderer: ({ attributeType, attributeValues, paging, parentUri, showNonOv, onDeleteAttribute, onChangeAttribute, requestNextPageOfAttributeValues, highlightedAttribute }: Props) => JSX.Element;
|
|
15
17
|
export {};
|
|
@@ -5,15 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ImageLineRenderer = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
8
9
|
var Title_1 = __importDefault(require("../../../Title/Title"));
|
|
9
10
|
var DescriptionIcon_1 = __importDefault(require("../../DescriptionIcon"));
|
|
10
11
|
var ImageAttributesLine_1 = __importDefault(require("../ImageAttributesLine"));
|
|
12
|
+
var useScrollToAttribute_1 = require("../hooks/useScrollToAttribute/useScrollToAttribute");
|
|
11
13
|
var styles_1 = require("./styles");
|
|
12
14
|
var ImageLineRenderer = function (_a) {
|
|
13
|
-
var attributeType = _a.attributeType, attributeValues = _a.attributeValues, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
15
|
+
var attributeType = _a.attributeType, attributeValues = _a.attributeValues, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, highlightedAttribute = _a.highlightedAttribute;
|
|
14
16
|
var styles = (0, styles_1.useStyles)();
|
|
15
17
|
var label = attributeType.label, description = attributeType.description;
|
|
16
|
-
|
|
18
|
+
var _b = (0, useScrollToAttribute_1.useScrollToAttribute)(highlightedAttribute), ref = _b.ref, highlightedClassName = _b.highlightedClassName;
|
|
19
|
+
return (react_1.default.createElement("div", { ref: ref, className: (0, classnames_1.default)(styles.wrapper, highlightedClassName) },
|
|
17
20
|
react_1.default.createElement("div", { className: styles.titleWrapper },
|
|
18
21
|
react_1.default.createElement(Title_1.default, { className: styles.title, label: label, "data-reltio-id": "reltio-attribute-label" }),
|
|
19
22
|
react_1.default.createElement(DescriptionIcon_1.default, { className: styles.description, description: description })),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, Mode, AttributeItem } from '@reltio/mdm-sdk';
|
|
3
|
+
import { ScrollToElementContext } from '../../../../contexts';
|
|
3
4
|
declare type Props = {
|
|
4
5
|
values: string[] | number[];
|
|
5
6
|
attributeType: AttributeType;
|
|
@@ -11,7 +12,8 @@ declare type Props = {
|
|
|
11
12
|
showEmptyEditors?: boolean;
|
|
12
13
|
hasDeletions?: boolean;
|
|
13
14
|
setHasDeletions?: (attrTypeUri: string, value: boolean) => void;
|
|
15
|
+
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
14
16
|
};
|
|
15
|
-
export declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, onChangeAttribute, showEmptyEditors, hasDeletions: hasDeletionsProp, setHasDeletions, ...otherProps }: Props) => JSX.Element;
|
|
17
|
+
export declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, onChangeAttribute, showEmptyEditors, hasDeletions: hasDeletionsProp, setHasDeletions, highlightedAttribute, ...otherProps }: Props) => JSX.Element;
|
|
16
18
|
declare const _default: React.ComponentType<Props> | ((props: any) => JSX.Element);
|
|
17
19
|
export default _default;
|
|
@@ -51,6 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
51
51
|
exports.SpecialRenderer = void 0;
|
|
52
52
|
var react_1 = __importStar(require("react"));
|
|
53
53
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
54
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
54
55
|
var ramda_1 = require("ramda");
|
|
55
56
|
var Box_1 = __importDefault(require("@material-ui/core/Box"));
|
|
56
57
|
var Title_1 = __importDefault(require("../../../Title/Title"));
|
|
@@ -62,8 +63,9 @@ var Tags_1 = __importDefault(require("../Tags"));
|
|
|
62
63
|
var styles_1 = require("./styles");
|
|
63
64
|
var HasDeletionsContext_1 = require("../contexts/HasDeletionsContext");
|
|
64
65
|
var HOCs_1 = require("../../../../HOCs");
|
|
66
|
+
var useScrollToAttribute_1 = require("../hooks/useScrollToAttribute/useScrollToAttribute");
|
|
65
67
|
var SpecialRenderer = function (_a) {
|
|
66
|
-
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, showEmptyEditors = _a.showEmptyEditors, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions"]);
|
|
68
|
+
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, showEmptyEditors = _a.showEmptyEditors, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, highlightedAttribute = _a.highlightedAttribute, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions", "highlightedAttribute"]);
|
|
67
69
|
var styles = (0, styles_1.useStyles)();
|
|
68
70
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality;
|
|
69
71
|
var isEditableMode = (0, mdm_sdk_1.isEditableMode)(mode);
|
|
@@ -84,6 +86,7 @@ var SpecialRenderer = function (_a) {
|
|
|
84
86
|
parentUri: parentUri,
|
|
85
87
|
attributeType: attributeType
|
|
86
88
|
}));
|
|
89
|
+
var _c = (0, useScrollToAttribute_1.useScrollToAttribute)(highlightedAttribute), ref = _c.ref, highlightedClassName = _c.highlightedClassName;
|
|
87
90
|
var renderValue = function () {
|
|
88
91
|
switch (attributeType.uri) {
|
|
89
92
|
case mdm_sdk_1.EntityAttrTypes.tags.uri:
|
|
@@ -100,8 +103,8 @@ var SpecialRenderer = function (_a) {
|
|
|
100
103
|
if ((0, mdm_sdk_1.isActivenessAttrType)(attributeType) && isEmptyValues && !showEmpty) {
|
|
101
104
|
return null;
|
|
102
105
|
}
|
|
103
|
-
return (react_1.default.createElement(
|
|
104
|
-
react_1.default.createElement(Title_1.default, { label: label, isRequired: isRequired, className: styles.title, "data-reltio-id": "reltio-attribute-label" }),
|
|
106
|
+
return (react_1.default.createElement("div", { ref: ref, className: (0, classnames_1.default)(highlightedClassName, styles.wrapper) },
|
|
107
|
+
react_1.default.createElement(Title_1.default, { label: label, isRequired: isRequired, className: (0, classnames_1.default)(styles.title, styles.titleWrapper), "data-reltio-id": "reltio-attribute-label" }),
|
|
105
108
|
isEditableMode && react_1.default.createElement(CardinalityMessage_1.default, { cardinality: cardinality }),
|
|
106
109
|
isEditableMode && react_1.default.createElement(ErrorMessage_1.default, { message: errorMessage }),
|
|
107
110
|
react_1.default.createElement(Box_1.default, { className: styles.attributesWrapper }, renderValue())));
|
|
@@ -3,6 +3,7 @@ import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
|
3
3
|
import { AttributeError, AttributeType, Crosswalk, ImageAttributeValue, Mode, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, AttributeItem } from '@reltio/mdm-sdk';
|
|
4
4
|
import AttributesPager from './AttributesPager';
|
|
5
5
|
import CardinalityMessage from './CardinalityMessage';
|
|
6
|
+
import { ScrollToElementContext } from '../../../../contexts';
|
|
6
7
|
declare type StateProps = {
|
|
7
8
|
errorMessage: string;
|
|
8
9
|
errors: AttributeError[];
|
|
@@ -27,8 +28,10 @@ declare type OwnProps = {
|
|
|
27
28
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
28
29
|
onChangeAttribute: (param: AttributeItem) => void;
|
|
29
30
|
additionalControlsRenderer?: (props: any) => JSX.Element;
|
|
31
|
+
highlightedError?: React.ContextType<typeof ScrollToElementContext>;
|
|
32
|
+
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
30
33
|
};
|
|
31
34
|
export declare type AttributePagerProps = StateProps & DispatchProps & OwnProps;
|
|
32
35
|
export { AttributesPager, CardinalityMessage };
|
|
33
|
-
declare const _default: import("react-redux").ConnectedComponent<import("react").
|
|
36
|
+
declare const _default: import("react-redux").ConnectedComponent<import("react").ComponentType<StateProps & DispatchProps & OwnProps> | ((props: any) => JSX.Element), import("react-redux").Omit<any, "max" | "errorMessage" | "errors" | "requestNextPageOfAttributeValues" | "onDeactivateError"> & OwnProps>;
|
|
34
37
|
export default _default;
|
|
@@ -117,11 +117,12 @@ var ComplexAttribute = function (_a) {
|
|
|
117
117
|
expanded && (react_1.default.createElement(AttributesList_1.default, { 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))));
|
|
118
118
|
};
|
|
119
119
|
ComplexAttribute.propTypes = __assign({ label: prop_types_1.default.string, children: prop_types_1.default.node, attributeTypesList: prop_types_1.default.arrayOf(mdm_sdk_1.AttributeTypeType), attributeValue: prop_types_1.default.oneOfType([mdm_sdk_1.NestedAttributeValueType, mdm_sdk_1.ReferenceAttributeValueType]), highlightedError: prop_types_1.default.object, isHighlightedPath: prop_types_1.default.bool }, mdm_sdk_1.ComplexAttributeType);
|
|
120
|
-
exports.default = (0, HOCs_1.withContext)(contexts_1.
|
|
120
|
+
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue, _a) {
|
|
121
121
|
var attributeValue = _a.attributeValue;
|
|
122
|
-
var
|
|
123
|
-
var
|
|
124
|
-
var
|
|
122
|
+
var _b = contextValue || {}, element = _b.element, type = _b.type;
|
|
123
|
+
var isError = (0, contexts_1.isHighlightedErrorType)(type);
|
|
124
|
+
var isHighlighted = isError && (element === null || element === void 0 ? void 0 : element.uri) === attributeValue.uri;
|
|
125
|
+
var isHighlightedPath = isError && (0, ramda_1.pipe)((0, ramda_1.propOr)([], 'path'), (0, ramda_1.any)((0, ramda_1.pathEq)(['value', 'uri'], attributeValue.uri)))(element);
|
|
125
126
|
return {
|
|
126
127
|
highlightedError: isHighlighted ? contextValue : null,
|
|
127
128
|
isHighlightedPath: isHighlightedPath
|
|
@@ -149,9 +149,9 @@ var ReferenceAttribute = function (props) {
|
|
|
149
149
|
_a)), entity: selectedEntity || {}, entityTypesUris: entityTypesUris, max: 20, globalSearchRequestOptions: globalSearchRequestOptions, mode: mode, isDisabled: !canChangeReferencedEntity, onChange: onChangeEntity, onCreate: canCreateReferencedEntity ? onCreateEntity : undefined, metadata: metadata, attributeTypesSelectionStrategy: newEntityAttrTypesSelectionStrategy })))));
|
|
150
150
|
};
|
|
151
151
|
ReferenceAttribute.propTypes = __assign(__assign({}, mdm_sdk_1.ReferenceAttributeType), { modifiedEntity: mdm_sdk_1.EntityType, metadata: mdm_sdk_1.MetadataType, globalSearchRequestOptions: prop_types_1.default.object, onDeleteModifiedEntity: prop_types_1.default.func, onUpdateModifiedEntity: prop_types_1.default.func, onDeactivateError: prop_types_1.default.func, highlightedError: prop_types_1.default.object });
|
|
152
|
-
exports.default = (0, HOCs_1.withContext)(contexts_1.
|
|
152
|
+
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue, _a) {
|
|
153
153
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
154
|
-
var
|
|
155
|
-
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(
|
|
154
|
+
var _b = contextValue || {}, element = _b.element, type = _b.type;
|
|
155
|
+
var isHighlighted = (0, contexts_1.isHighlightedErrorType)(type) && (0, mdm_sdk_1.isAttributeTypeError)(element, attributeValue.uri, attributeType.uri);
|
|
156
156
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
157
157
|
}, ReferenceAttribute);
|
|
@@ -144,9 +144,9 @@ SimpleAttributeEditor.propTypes = {
|
|
|
144
144
|
additionalControlsRenderer: prop_types_1.default.func,
|
|
145
145
|
highlightedError: prop_types_1.default.object
|
|
146
146
|
};
|
|
147
|
-
exports.default = (0, withAsyncMount_1.default)((0, HOCs_1.withContext)(contexts_1.
|
|
147
|
+
exports.default = (0, withAsyncMount_1.default)((0, HOCs_1.withContext)(contexts_1.ScrollToElementContext, function (contextValue, _a) {
|
|
148
148
|
var attributeValue = _a.attributeValue;
|
|
149
|
-
var
|
|
150
|
-
var isHighlighted = (
|
|
149
|
+
var _b = contextValue || {}, element = _b.element, type = _b.type;
|
|
150
|
+
var isHighlighted = (0, contexts_1.isHighlightedErrorType)(type) && (element === null || element === void 0 ? void 0 : element.uri) === attributeValue.uri;
|
|
151
151
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
152
152
|
}, SimpleAttributeEditor), AsyncMountPlaceholder);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"@keyframes highlightAnimation" | "highlighted">;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.useStyles = void 0;
|
|
15
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
16
|
+
var highlightBeforeStyles = {
|
|
17
|
+
content: '""',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
left: '-1000px',
|
|
20
|
+
top: '-4px',
|
|
21
|
+
width: '5000px',
|
|
22
|
+
height: 'calc(100% + 8px)',
|
|
23
|
+
animationName: '$highlightAnimation',
|
|
24
|
+
animationDuration: '2s',
|
|
25
|
+
animationIterationCount: 1,
|
|
26
|
+
opacity: 0
|
|
27
|
+
};
|
|
28
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
29
|
+
'@keyframes highlightAnimation': {
|
|
30
|
+
'0%': { opacity: 0 },
|
|
31
|
+
'50%': { opacity: 1 },
|
|
32
|
+
'100%': { opacity: 0 }
|
|
33
|
+
},
|
|
34
|
+
highlighted: {
|
|
35
|
+
'&::before': __assign(__assign({}, highlightBeforeStyles), { background: 'rgba(228, 151, 0, 0.08)' }),
|
|
36
|
+
position: 'relative'
|
|
37
|
+
}
|
|
38
|
+
}); });
|
package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useScrollToAttribute: (context: any) => {
|
|
3
|
+
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
4
|
+
highlightedClassName: string;
|
|
5
|
+
} | {
|
|
6
|
+
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
7
|
+
highlightedClassName?: undefined;
|
|
8
|
+
};
|