@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.
Files changed (67) hide show
  1. package/cjs/components/ProfilesList/styles.d.ts +1 -1
  2. package/cjs/components/RelationEditor/RelationEditor.js +4 -4
  3. package/cjs/components/attributes/editMode/AttributesFactory/Attribute.d.ts +6 -1
  4. package/cjs/components/attributes/editMode/AttributesFactory/Attribute.js +40 -4
  5. package/cjs/components/attributes/editMode/AttributesList/AttributesList.d.ts +3 -39
  6. package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +10 -3
  7. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +9 -7
  8. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +8 -12
  9. package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.d.ts +38 -2
  10. package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.js +19 -28
  11. package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +4 -2
  12. package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +5 -2
  13. package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +3 -1
  14. package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -3
  15. package/cjs/components/attributes/editMode/AttributesPager/index.d.ts +4 -1
  16. package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +5 -4
  17. package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +3 -3
  18. package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +3 -3
  19. package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/styles.d.ts +1 -0
  20. package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/styles.js +38 -0
  21. package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +8 -0
  22. package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +17 -0
  23. package/cjs/components/workflow/helpers/errors.d.ts +3 -2
  24. package/cjs/components/workflow/helpers/errors.js +15 -9
  25. package/cjs/components/workflow/hooks/useChangeRequest.js +2 -2
  26. package/cjs/contexts/ScrollToElementContext/index.d.ts +20 -0
  27. package/cjs/contexts/ScrollToElementContext/index.js +73 -0
  28. package/cjs/contexts/index.d.ts +1 -1
  29. package/cjs/contexts/index.js +7 -4
  30. package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -2
  31. package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
  32. package/esm/components/ProfilesList/styles.d.ts +1 -1
  33. package/esm/components/RelationEditor/RelationEditor.js +5 -5
  34. package/esm/components/attributes/editMode/AttributesFactory/Attribute.d.ts +6 -1
  35. package/esm/components/attributes/editMode/AttributesFactory/Attribute.js +17 -4
  36. package/esm/components/attributes/editMode/AttributesList/AttributesList.d.ts +3 -39
  37. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +12 -5
  38. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +9 -7
  39. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +10 -14
  40. package/esm/components/attributes/editMode/AttributesPager/AttributesPager.d.ts +38 -2
  41. package/esm/components/attributes/editMode/AttributesPager/AttributesPager.js +20 -6
  42. package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +4 -2
  43. package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +5 -2
  44. package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +3 -1
  45. package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -3
  46. package/esm/components/attributes/editMode/AttributesPager/index.d.ts +4 -1
  47. package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -5
  48. package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +4 -4
  49. package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +4 -4
  50. package/esm/components/attributes/editMode/hooks/useScrollToAttribute/styles.d.ts +1 -0
  51. package/esm/components/attributes/editMode/hooks/useScrollToAttribute/styles.js +35 -0
  52. package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +8 -0
  53. package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +13 -0
  54. package/esm/components/workflow/helpers/errors.d.ts +3 -2
  55. package/esm/components/workflow/helpers/errors.js +13 -8
  56. package/esm/components/workflow/hooks/useChangeRequest.js +3 -3
  57. package/esm/contexts/ScrollToElementContext/index.d.ts +20 -0
  58. package/esm/contexts/ScrollToElementContext/index.js +44 -0
  59. package/esm/contexts/index.d.ts +1 -1
  60. package/esm/contexts/index.js +1 -1
  61. package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -2
  62. package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
  63. package/package.json +3 -3
  64. package/cjs/contexts/ScrollToErrorContext/index.d.ts +0 -13
  65. package/cjs/contexts/ScrollToErrorContext/index.js +0 -48
  66. package/esm/contexts/ScrollToErrorContext/index.d.ts +0 -13
  67. package/esm/contexts/ScrollToErrorContext/index.js +0 -21
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useScrollToAttribute = void 0;
4
+ var react_1 = require("react");
5
+ var styles_1 = require("./styles");
6
+ var useScrollToAttribute = function (context) {
7
+ var styles = (0, styles_1.useStyles)();
8
+ var ref = (0, react_1.useRef)(null);
9
+ var scrollIntoRef = (context || {}).scrollIntoRef;
10
+ (0, react_1.useEffect)(function () {
11
+ if (context) {
12
+ scrollIntoRef(ref);
13
+ }
14
+ }, [context, scrollIntoRef]);
15
+ return context ? { ref: ref, highlightedClassName: styles.highlighted } : { ref: ref };
16
+ };
17
+ exports.useScrollToAttribute = useScrollToAttribute;
@@ -1,2 +1,3 @@
1
- import { ApiError } from '@reltio/mdm-sdk';
2
- export declare const showWorkflowError: (error?: ApiError) => void;
1
+ import { ApiError, WorkflowApiError } from '@reltio/mdm-sdk';
2
+ export declare const showApiError: (error?: ApiError) => void;
3
+ export declare const showWorkflowError: (apiError?: WorkflowApiError) => void;
@@ -3,19 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.showWorkflowError = void 0;
6
+ exports.showWorkflowError = exports.showApiError = void 0;
7
7
  var ui_i18n_1 = __importDefault(require("ui-i18n"));
8
8
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
9
9
  var ErrorPopup_1 = __importDefault(require("../../ErrorPopup/ErrorPopup"));
10
- var showWorkflowError = function (error) {
10
+ var showApiError = function (error) {
11
11
  if (error === void 0) { error = {}; }
12
- var errorMessage = error.errorMessage, errorCode = error.errorCode;
13
- if (errorCode !== mdm_sdk_1.ApiErrorCode.WORKFLOW_IS_NOT_REGISTERED_ERROR) {
14
- console.error(error); // eslint-disable-line
15
- ErrorPopup_1.default.addError({
16
- title: ui_i18n_1.default.text('Error'),
17
- message: errorMessage || ui_i18n_1.default.text('Something went wrong...')
18
- });
12
+ console.error(error); // eslint-disable-line
13
+ ErrorPopup_1.default.addError({
14
+ title: ui_i18n_1.default.text('Error'),
15
+ message: error.errorMessage || ui_i18n_1.default.text('Something went wrong...')
16
+ });
17
+ };
18
+ exports.showApiError = showApiError;
19
+ var showWorkflowError = function (apiError) {
20
+ if (apiError === void 0) { apiError = {}; }
21
+ var error = apiError.error;
22
+ if ((error === null || error === void 0 ? void 0 : error.errorCode) === mdm_sdk_1.ApiErrorCode.WORKFLOW_IS_NOT_REGISTERED_ERROR) {
23
+ return;
19
24
  }
25
+ (0, exports.showApiError)(error);
20
26
  };
21
27
  exports.showWorkflowError = showWorkflowError;
@@ -48,10 +48,10 @@ var useChangeRequest = function (dcrUri) {
48
48
  relationsObjectsWithRequestedEntities
49
49
  ]);
50
50
  })
51
- .catch(errors_1.showWorkflowError);
51
+ .catch(errors_1.showApiError);
52
52
  setDcr(dcr);
53
53
  })
54
- .catch(errors_1.showWorkflowError);
54
+ .catch(errors_1.showApiError);
55
55
  }, [dcrUri, requestEntities]);
56
56
  return { dcr: dcr, groupedObjects: groupedObjects };
57
57
  };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export declare enum ScrollType {
3
+ Error = "Error",
4
+ NewAttribute = "NewAttribute"
5
+ }
6
+ declare type ScrollToElementContextProps = {
7
+ element: unknown;
8
+ type: ScrollType;
9
+ highlightError?: (element: unknown) => void;
10
+ highlightAttribute?: (element: unknown) => void;
11
+ scrollIntoRef: (ref: React.MutableRefObject<HTMLDivElement>) => void;
12
+ };
13
+ export declare const isHighlightedErrorType: (type: ScrollType) => boolean;
14
+ export declare const isHighlightedAttributeType: (type: ScrollType) => boolean;
15
+ export declare const ScrollToElementContext: React.Context<ScrollToElementContextProps>;
16
+ declare type Props = {
17
+ children: React.ReactNode;
18
+ };
19
+ export declare const ScrollToElementProvider: ({ children }: Props) => JSX.Element;
20
+ export {};
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = void 0;
27
+ var react_1 = __importStar(require("react"));
28
+ var core_1 = require("../../core");
29
+ var ScrollType;
30
+ (function (ScrollType) {
31
+ ScrollType["Error"] = "Error";
32
+ ScrollType["NewAttribute"] = "NewAttribute";
33
+ })(ScrollType = exports.ScrollType || (exports.ScrollType = {}));
34
+ var isHighlightedErrorType = function (type) { return type === ScrollType.Error; };
35
+ exports.isHighlightedErrorType = isHighlightedErrorType;
36
+ var isHighlightedAttributeType = function (type) { return type === ScrollType.NewAttribute; };
37
+ exports.isHighlightedAttributeType = isHighlightedAttributeType;
38
+ exports.ScrollToElementContext = react_1.default.createContext({
39
+ element: null,
40
+ type: null,
41
+ highlightError: core_1.noop,
42
+ highlightAttribute: core_1.noop,
43
+ scrollIntoRef: core_1.noop
44
+ });
45
+ var ScrollToElementProvider = function (_a) {
46
+ var children = _a.children;
47
+ var _b = (0, react_1.useState)(null), element = _b[0], setElement = _b[1];
48
+ var highlightTimer = (0, react_1.useRef)(null);
49
+ var scrollIntoRef = (0, react_1.useCallback)(function (ref) {
50
+ ref.current.scrollIntoView({ behavior: 'smooth', block: 'center' });
51
+ if (highlightTimer) {
52
+ clearTimeout(highlightTimer.current);
53
+ }
54
+ highlightTimer.current = setTimeout(function () {
55
+ setElement(null);
56
+ }, 2000);
57
+ }, []);
58
+ var handleHighlightError = (0, react_1.useCallback)(function (highlightedError) {
59
+ setElement({ value: highlightedError, type: ScrollType.Error });
60
+ }, []);
61
+ var handleHighlightAttribute = (0, react_1.useCallback)(function (highlightedAttribute) {
62
+ setTimeout(function () { return setElement({ value: highlightedAttribute, type: ScrollType.NewAttribute }); }, 300);
63
+ }, []);
64
+ var contextValue = (0, react_1.useMemo)(function () { return ({
65
+ element: element === null || element === void 0 ? void 0 : element.value,
66
+ highlightError: handleHighlightError,
67
+ highlightAttribute: handleHighlightAttribute,
68
+ scrollIntoRef: scrollIntoRef,
69
+ type: element === null || element === void 0 ? void 0 : element.type
70
+ }); }, [element, scrollIntoRef]);
71
+ return react_1.default.createElement(exports.ScrollToElementContext.Provider, { value: contextValue }, children);
72
+ };
73
+ exports.ScrollToElementProvider = ScrollToElementProvider;
@@ -23,7 +23,7 @@ export { SnackbarContext } from './SnackbarContext';
23
23
  export { HighlightedValuesContext } from './HighlightedValuesContext';
24
24
  export { InterceptHandlersContext } from './InterceptHandlersContext';
25
25
  export { SearchValueContext } from './SearchValueContext';
26
- export { ScrollToErrorContext, ScrollToErrorProvider } from './ScrollToErrorContext';
26
+ export { ScrollToElementContext, ScrollToElementProvider, ScrollType, isHighlightedErrorType, isHighlightedAttributeType } from './ScrollToElementContext';
27
27
  export { UrlGeneratorsContext } from './UrlGeneratorsContext';
28
28
  export { LabelsContext } from './LabelsContext';
29
29
  export { FeaturesContext } from './FeaturesContext';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.ScrollToErrorProvider = exports.ScrollToErrorContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.EntityLoadingIndicationContext = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
3
+ exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.EntityLoadingIndicationContext = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
4
4
  var AsyncMountContext_1 = require("./AsyncMountContext");
5
5
  Object.defineProperty(exports, "AsyncMountContext", { enumerable: true, get: function () { return AsyncMountContext_1.AsyncMountContext; } });
6
6
  var HistoryAppearanceContext_1 = require("./HistoryAppearanceContext");
@@ -59,9 +59,12 @@ var InterceptHandlersContext_1 = require("./InterceptHandlersContext");
59
59
  Object.defineProperty(exports, "InterceptHandlersContext", { enumerable: true, get: function () { return InterceptHandlersContext_1.InterceptHandlersContext; } });
60
60
  var SearchValueContext_1 = require("./SearchValueContext");
61
61
  Object.defineProperty(exports, "SearchValueContext", { enumerable: true, get: function () { return SearchValueContext_1.SearchValueContext; } });
62
- var ScrollToErrorContext_1 = require("./ScrollToErrorContext");
63
- Object.defineProperty(exports, "ScrollToErrorContext", { enumerable: true, get: function () { return ScrollToErrorContext_1.ScrollToErrorContext; } });
64
- Object.defineProperty(exports, "ScrollToErrorProvider", { enumerable: true, get: function () { return ScrollToErrorContext_1.ScrollToErrorProvider; } });
62
+ var ScrollToElementContext_1 = require("./ScrollToElementContext");
63
+ Object.defineProperty(exports, "ScrollToElementContext", { enumerable: true, get: function () { return ScrollToElementContext_1.ScrollToElementContext; } });
64
+ Object.defineProperty(exports, "ScrollToElementProvider", { enumerable: true, get: function () { return ScrollToElementContext_1.ScrollToElementProvider; } });
65
+ Object.defineProperty(exports, "ScrollType", { enumerable: true, get: function () { return ScrollToElementContext_1.ScrollType; } });
66
+ Object.defineProperty(exports, "isHighlightedErrorType", { enumerable: true, get: function () { return ScrollToElementContext_1.isHighlightedErrorType; } });
67
+ Object.defineProperty(exports, "isHighlightedAttributeType", { enumerable: true, get: function () { return ScrollToElementContext_1.isHighlightedAttributeType; } });
65
68
  var UrlGeneratorsContext_1 = require("./UrlGeneratorsContext");
66
69
  Object.defineProperty(exports, "UrlGeneratorsContext", { enumerable: true, get: function () { return UrlGeneratorsContext_1.UrlGeneratorsContext; } });
67
70
  var LabelsContext_1 = require("./LabelsContext");
@@ -1,7 +1,7 @@
1
1
  import { ContextType } from 'react';
2
- import { ScrollToErrorContext } from '../../contexts';
2
+ import { ScrollToElementContext } from '../../contexts';
3
3
  declare type Props = {
4
- highlightedError: ContextType<typeof ScrollToErrorContext> | null;
4
+ highlightedError: ContextType<typeof ScrollToElementContext> | null;
5
5
  isSimple?: boolean;
6
6
  };
7
7
  export declare const useScrollToAttributeError: ({ highlightedError: context, isSimple }: Props) => {
@@ -14,8 +14,8 @@ var useScrollToAttributeError = function (_a) {
14
14
  var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
15
15
  var styles = (0, styles_1.useStyles)();
16
16
  var ref = (0, react_1.useRef)(null);
17
- var _d = context || {}, error = _d.error, scrollIntoRef = _d.scrollIntoRef;
18
- var severity = (0, react_1.useMemo)(function () { return (0, ramda_1.propOr)(mdm_sdk_1.ErrorSeverity.ERROR, 'severity')(error); }, [error]);
17
+ var _d = context || {}, element = _d.element, scrollIntoRef = _d.scrollIntoRef;
18
+ var severity = (0, react_1.useMemo)(function () { return (0, ramda_1.propOr)(mdm_sdk_1.ErrorSeverity.ERROR, 'severity')(element); }, [element]);
19
19
  var errorClassName = (0, classnames_1.default)((_b = {},
20
20
  _b[styles.highlightError] = severity === mdm_sdk_1.ErrorSeverity.ERROR,
21
21
  _b[styles.highlightWarning] = severity === mdm_sdk_1.ErrorSeverity.WARNING,
@@ -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" | "highlighted" | "justImported" | "secondRow">;
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">;
@@ -24,7 +24,7 @@ import ErrorWrapper from '../ErrorWrapper/ErrorWrapper';
24
24
  import EntitySelector from '../attributes/editMode/EntitySelector/EntitySelector';
25
25
  import AttributesList from '../attributes/editMode/AttributesList';
26
26
  import { withContext } from '../../HOCs';
27
- import { ScrollToErrorContext } from '../../contexts';
27
+ import { isHighlightedErrorType, ScrollToElementContext } from '../../contexts';
28
28
  import { useScrollToAttributeError } from '../../hooks';
29
29
  import { useStyles } from './styles';
30
30
  var areRelatedEntitiesChanged = function (initial, actual) {
@@ -174,10 +174,10 @@ RelationEditor.propTypes = {
174
174
  parentEntityUri: PropTypes.string,
175
175
  highlightedError: PropTypes.object
176
176
  };
177
- export default withContext(ScrollToErrorContext, function (contextValue, _a) {
177
+ export default withContext(ScrollToElementContext, function (contextValue, _a) {
178
178
  var connection = _a.connection;
179
- var _b = (contextValue || {}).error, error = _b === void 0 ? {} : _b;
180
- var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType;
181
- var isHighlighted = isAttributeTypeError(error, relationUri, relationType);
179
+ var _b = contextValue || {}, _c = _b.element, element = _c === void 0 ? {} : _c, type = _b.type;
180
+ var _d = connection.relation, relationUri = _d.relationUri, relationType = _d.relationType;
181
+ var isHighlighted = isHighlightedErrorType(type) && isAttributeTypeError(element, relationUri, relationType);
182
182
  return { highlightedError: isHighlighted ? contextValue : null };
183
183
  }, 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,6 +1,19 @@
1
- import EditModeAttributesFactory from './AttributesFactory';
2
- var Attribute = function (props) {
3
- var attributeType = props.attributeType;
4
- return EditModeAttributesFactory.build(attributeType, props);
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
5
11
  };
12
+ import React, { forwardRef } from 'react';
13
+ import EditModeAttributesFactory from './AttributesFactory';
14
+ var Attribute = forwardRef(function (props, ref) {
15
+ var className = props.className, otherProps = __rest(props, ["className"]);
16
+ return (React.createElement("div", { ref: ref, className: className }, EditModeAttributesFactory.build(props.attributeType, otherProps)));
17
+ });
18
+ Attribute.displayName = 'Attribute';
6
19
  export default Attribute;
@@ -1,41 +1,5 @@
1
- declare const _default: React.MemoExoticComponent<{
2
- ({ parentAttributeType, attrTypes, entity, parentUri, showEmptyEditors, mode, crosswalks, drawLines, children, className, alwaysVisibleTypeUris, onAddAttributes, onChangeAttribute, onDeleteAttribute, additionalControlsRenderer, showNonOv }: {
3
- parentAttributeType: any;
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";
@@ -9,11 +9,11 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import React, { memo, useCallback, useContext, useMemo, useState, useEffect } from 'react';
12
+ import React, { useCallback, useContext, useMemo, useState, useEffect } from 'react';
13
13
  import PropTypes from 'prop-types';
14
14
  import i18n from 'ui-i18n';
15
15
  import { getCreatableAttributeTypes, getAttributesListForEditMode, ModeType, getParentUri, checkCanCreateAttribute } from '@reltio/mdm-sdk';
16
- import { path } from 'ramda';
16
+ import { last, path } from 'ramda';
17
17
  import AttributesPager from '../AttributesPager';
18
18
  import BranchDecorator from '../../BranchDecorator/BranchDecorator';
19
19
  import MoreAttributesButton from '../MoreAttributesButton';
@@ -22,8 +22,10 @@ import { splitPagersData } from '../../helpers/attributesView';
22
22
  import { getMoreAttrTypes } from './helpers';
23
23
  import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
24
24
  import { HasDeletionsContext } from '../contexts/HasDeletionsContext';
25
+ import { withContext } from '../../../../HOCs';
26
+ import { ScrollType, ScrollToElementContext } from '../../../../contexts';
25
27
  var AttributesList = function (_a) {
26
- 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 ? ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv;
28
+ 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 ? ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv, highlightAttribute = _a.highlightAttribute;
27
29
  var _c = entity.attributes, attributes = _c === void 0 ? {} : _c;
28
30
  var _d = useState({}), hasDeletionsMap = _d[0], setHasDeletionsMap = _d[1];
29
31
  var setHasDeletions = useCallback(function (attrTypeUri, value) {
@@ -46,6 +48,7 @@ var AttributesList = function (_a) {
46
48
  attributeType: attributeType,
47
49
  parentUri: attributeType === parentAttributeType ? getParentUri(parentUri) : parentUri
48
50
  }); }));
51
+ highlightAttribute(last(attributeTypes), ScrollType.NewAttribute);
49
52
  }, [onAddAttributes, parentUri, parentAttributeType]);
50
53
  var decoratorProps = {
51
54
  enabled: drawLines
@@ -78,6 +81,10 @@ AttributesList.propTypes = {
78
81
  onAddAttributes: PropTypes.func,
79
82
  onChangeAttribute: PropTypes.func,
80
83
  onDeleteAttribute: PropTypes.func,
81
- additionalControlsRenderer: PropTypes.func
84
+ additionalControlsRenderer: PropTypes.func,
85
+ highlightAttribute: PropTypes.func
82
86
  };
83
- export default memo(AttributesList);
87
+ export default withContext(ScrollToElementContext, function (contextValue) {
88
+ var highlightAttribute = (contextValue || {}).highlightAttribute;
89
+ return { highlightAttribute: highlightAttribute };
90
+ }, 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
- declare const _default: React.ComponentType<Required<Omit<AttributePagerProps, "values">> & {
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
- error: import("@reltio/mdm-sdk").AttributeError;
9
- highlightError: (error: import("@reltio/mdm-sdk").AttributeError) => void;
10
- scrollIntoRef: (ref: React.MutableRefObject<HTMLDivElement>) => void;
11
- };
12
- }> | ((props: any) => JSX.Element);
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;
@@ -1,6 +1,6 @@
1
- import React, { useCallback, useRef, useState, useContext, useMemo } from 'react';
1
+ import React, { useCallback, useRef, useState, useContext, useMemo, memo } from 'react';
2
2
  import classNames from 'classnames';
3
- import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue, isAttributeTypeError } from '@reltio/mdm-sdk';
3
+ import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue } from '@reltio/mdm-sdk';
4
4
  import { add, always, has, ifElse, min, pipe, prop, T } from 'ramda';
5
5
  import BranchDecorator from '../../BranchDecorator/BranchDecorator';
6
6
  import ErrorMessage from '../../../ErrorWrapper/ErrorMessage';
@@ -11,20 +11,20 @@ import ShowMore from '../../pagersCommon/ShowMore';
11
11
  import Attribute from '../AttributesFactory/Attribute';
12
12
  import Cardinality from './CardinalityMessage';
13
13
  import { filterNewValues } from './utils';
14
- import { withContext } from '../../../../HOCs';
15
14
  import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
16
15
  import { useScrollToAttributeError } from '../../../../hooks';
17
- import { ScrollToErrorContext } from '../../../../contexts';
18
16
  import DescriptionIcon from '../../DescriptionIcon/DescriptionIcon';
17
+ import { useScrollToAttribute } from '../hooks/useScrollToAttribute/useScrollToAttribute';
19
18
  import { useStyles } from './styles';
20
19
  var AttributeRenderer = function (_a) {
21
- 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;
20
+ 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;
22
21
  var styles = useStyles();
23
22
  var _b = useState(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
24
23
  var _c = useState(false), hadDeletions = _c[0], setHadDeletions = _c[1];
25
24
  var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality, name = attributeType.name, attributeTypeUri = attributeType.uri, description = attributeType.description;
26
25
  var isEditableMode = checkIsEditableMode(mode);
27
- var _d = useScrollToAttributeError({ highlightedError: highlightedError }), ref = _d.ref, errorClassName = _d.errorClassName;
26
+ var _d = useScrollToAttributeError({ highlightedError: highlightedError }), errorRef = _d.ref, errorClassName = _d.errorClassName;
27
+ var _e = useScrollToAttribute(highlightedAttribute), attributeRef = _e.ref, highlightedClassName = _e.highlightedClassName;
28
28
  var pinnedAttributes = useContext(PinnedAttributesContext);
29
29
  var isPinned = useMemo(function () { return pinnedAttributes === null || pinnedAttributes === void 0 ? void 0 : pinnedAttributes.includes(attributeTypeUri); }, [attributeTypeUri, pinnedAttributes]);
30
30
  var isEmptyValues = isEmptyValue(values);
@@ -80,7 +80,7 @@ var AttributeRenderer = function (_a) {
80
80
  var lastIndex = shownValues ? shownValues.length - 1 : 0;
81
81
  var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
82
82
  return (React.createElement(BranchDecorator, { enabled: drawLines },
83
- React.createElement("div", { ref: ref, className: classNames(styles.wrapper, errorClassName) },
83
+ React.createElement("div", { ref: errorRef, className: classNames(styles.wrapper, errorClassName) },
84
84
  React.createElement("div", { className: styles.titleWrapper },
85
85
  React.createElement(Title, { label: label, isRequired: isRequired, className: styles.title, "data-reltio-id": "reltio-attribute-label" }),
86
86
  React.createElement(DescriptionIcon, { description: description, className: styles.description }),
@@ -88,13 +88,9 @@ var AttributeRenderer = function (_a) {
88
88
  isEditableMode && React.createElement(Cardinality, { cardinality: cardinality }),
89
89
  isEditableMode && React.createElement(ErrorMessage, { message: errorMessage, className: styles.typeError }),
90
90
  React.createElement("div", { className: styles.attributesWrapper },
91
- shownValues.map(function (value, idx) { return (React.createElement(Attribute, { key: value.uri, attributeValue: value, attributeType: attributeType, lazy: showEmpty && !isRequired, showEmptyEditors: showEmptyEditors, errors: errors, ownError: 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 })); }),
91
+ shownValues.map(function (value, idx) { return (React.createElement(Attribute, { key: value.uri, attributeValue: value, attributeType: attributeType, lazy: showEmpty && !isRequired, showEmptyEditors: showEmptyEditors, errors: errors, ownError: 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 })); }),
92
92
  showMore && (React.createElement(ShowMore, { moreNumber: min(max, hiddenValuesCount), valueNumber: hiddenValuesCount, onClick: onShowMore })),
93
93
  showLess && React.createElement(ShowLess, { onClick: onShowLess })))));
94
94
  };
95
- export default withContext(ScrollToErrorContext, function (contextValue, _a) {
96
- var parentUri = _a.parentUri, attributeType = _a.attributeType;
97
- var error = (contextValue || {}).error;
98
- var isHighlighted = isAttributeTypeError(error, parentUri, attributeType.uri);
99
- return { highlightedError: isHighlighted ? contextValue : null };
100
- }, AttributeRenderer);
95
+ AttributeRenderer.displayName = 'AttributeRenderer';
96
+ export default memo(AttributeRenderer);
@@ -1,4 +1,40 @@
1
1
  import React from 'react';
2
- import { AttributePagerProps } from './index';
3
- declare const _default: React.MemoExoticComponent<({ values, attributeType, mode, crosswalks, drawLines, paging, parentUri, errors, errorMessage, max, showEmptyEditors, showNonOv, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: AttributePagerProps) => JSX.Element>;
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;
@@ -9,13 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import React, { memo } from 'react';
13
- import { isImage, isOv, isSpecialAttribute, Mode } from '@reltio/mdm-sdk';
12
+ import React from 'react';
13
+ import { isAttributeTypeError, isImage, isOv, isSpecialAttribute, Mode } from '@reltio/mdm-sdk';
14
14
  import { always, cond, T, partition } from 'ramda';
15
15
  import BranchDecorator from '../../BranchDecorator/BranchDecorator';
16
16
  import AttributeRenderer from './AttributeRenderer';
17
17
  import SpecialRenderer from './SpecialRenderer';
18
18
  import { ImageLineRenderer } from './ImageLineRenderer';
19
+ import { withContext } from '../../../../HOCs';
20
+ import { isHighlightedAttributeType, isHighlightedErrorType, ScrollToElementContext } from '../../../../contexts';
19
21
  var RENDERER_TYPES;
20
22
  (function (RENDERER_TYPES) {
21
23
  RENDERER_TYPES["imageLine"] = "imageLine";
@@ -23,7 +25,7 @@ var RENDERER_TYPES;
23
25
  RENDERER_TYPES["default"] = "default";
24
26
  })(RENDERER_TYPES || (RENDERER_TYPES = {}));
25
27
  var AttributesPager = function (_a) {
26
- var values = _a.values, attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? 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;
28
+ var values = _a.values, attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? 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;
27
29
  var partitionByOv = partition(isOv);
28
30
  var _e = partitionByOv(values), ovValues = _e[0], nonOvValues = _e[1];
29
31
  var visibleValues = showNonOv ? values : ovValues;
@@ -38,7 +40,9 @@ var AttributesPager = function (_a) {
38
40
  onChangeAttribute: onChangeAttribute,
39
41
  onDeactivateError: onDeactivateError,
40
42
  additionalControlsRenderer: additionalControlsRenderer,
41
- showEmptyEditors: showEmptyEditors
43
+ showEmptyEditors: showEmptyEditors,
44
+ highlightedError: highlightedError,
45
+ highlightedAttribute: highlightedAttribute
42
46
  };
43
47
  var renderAttribute = function () {
44
48
  var type = cond([
@@ -53,11 +57,21 @@ var AttributesPager = function (_a) {
53
57
  }
54
58
  case RENDERER_TYPES.imageLine:
55
59
  return (React.createElement(BranchDecorator, { enabled: drawLines },
56
- React.createElement(ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })));
60
+ React.createElement(ImageLineRenderer, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, highlightedAttribute: highlightedAttribute })));
57
61
  default:
58
62
  return (React.createElement(AttributeRenderer, __assign({ values: visibleValues, attributeType: attributeType, max: max, paging: paging, crosswalks: crosswalks, drawLines: drawLines, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv, nonVisibleValues: nonVisibleValues }, commonProps)));
59
63
  }
60
64
  };
61
65
  return renderAttribute();
62
66
  };
63
- export default memo(AttributesPager);
67
+ export default withContext(ScrollToElementContext, function (contextValue, _a) {
68
+ var attributeType = _a.attributeType, parentUri = _a.parentUri;
69
+ var _b = contextValue || {}, element = _b.element, type = _b.type;
70
+ var isHighlightedAttribute = isHighlightedAttributeType(type) && element.uri === attributeType.uri;
71
+ var isHighlightedError = isHighlightedErrorType(type) &&
72
+ isAttributeTypeError(element, parentUri, attributeType.uri);
73
+ return {
74
+ highlightedAttribute: isHighlightedAttribute ? contextValue : null,
75
+ highlightedError: isHighlightedError ? contextValue : null
76
+ };
77
+ }, AttributesPager);
@@ -1,6 +1,7 @@
1
- /// <reference types="react" />
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 {};