@reltio/components 1.4.1372 → 1.4.1373
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/RelationEditor/RelationEditor.d.ts +5 -32
- package/cjs/components/RelationEditor/RelationEditor.js +33 -22
- package/cjs/components/RelationEditor/index.d.ts +3 -152
- package/cjs/components/RelationEditor/styles.js +2 -1
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +10 -6
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +19 -5
- package/cjs/components/attributes/editMode/AttributesPager/styles.d.ts +1 -1
- package/cjs/components/attributes/editMode/AttributesPager/styles.js +2 -1
- package/cjs/components/attributes/editMode/AttributesPager/utils.d.ts +2 -1
- package/cjs/components/attributes/editMode/AttributesView/styles.js +1 -0
- package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +5 -160
- package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +29 -13
- package/cjs/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
- package/cjs/components/attributes/editMode/ComplexAttribute/styles.js +3 -0
- package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -130
- package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +24 -19
- package/cjs/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -129
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +1 -1
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +23 -12
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/styles.js +2 -1
- package/cjs/components/editors/DataTypeValueEditor/DataTypeValueEditor.d.ts +18 -17
- package/cjs/components/editors/DataTypeValueEditor/DataTypeValueEditor.js +3 -1
- package/cjs/contexts/ScrollToErrorContext/index.d.ts +13 -0
- package/cjs/contexts/ScrollToErrorContext/index.js +48 -0
- package/cjs/contexts/index.d.ts +1 -0
- package/cjs/contexts/index.js +4 -1
- package/cjs/hooks/index.d.ts +1 -0
- package/cjs/hooks/index.js +3 -1
- package/cjs/hooks/useScrollToAttributeError/styles.d.ts +1 -0
- package/cjs/hooks/useScrollToAttributeError/styles.js +49 -0
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +14 -0
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +31 -0
- package/esm/components/RelationEditor/RelationEditor.d.ts +5 -32
- package/esm/components/RelationEditor/RelationEditor.js +33 -22
- package/esm/components/RelationEditor/index.d.ts +3 -152
- package/esm/components/RelationEditor/styles.js +2 -1
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +10 -6
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +20 -6
- package/esm/components/attributes/editMode/AttributesPager/styles.d.ts +1 -1
- package/esm/components/attributes/editMode/AttributesPager/styles.js +2 -1
- package/esm/components/attributes/editMode/AttributesPager/utils.d.ts +2 -1
- package/esm/components/attributes/editMode/AttributesView/styles.js +1 -0
- package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +5 -160
- package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +29 -13
- package/esm/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
- package/esm/components/attributes/editMode/ComplexAttribute/styles.js +3 -0
- package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -130
- package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +27 -22
- package/esm/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -129
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +1 -1
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +24 -13
- package/esm/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
- package/esm/components/attributes/editMode/SimpleAttributeEditor/styles.js +2 -1
- package/esm/components/editors/DataTypeValueEditor/DataTypeValueEditor.d.ts +18 -17
- package/esm/components/editors/DataTypeValueEditor/DataTypeValueEditor.js +3 -1
- package/esm/contexts/ScrollToErrorContext/index.d.ts +13 -0
- package/esm/contexts/ScrollToErrorContext/index.js +21 -0
- package/esm/contexts/index.d.ts +1 -0
- package/esm/contexts/index.js +1 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useScrollToAttributeError/styles.d.ts +1 -0
- package/esm/hooks/useScrollToAttributeError/styles.js +46 -0
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +14 -0
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.js +24 -0
- package/package.json +3 -3
|
@@ -0,0 +1,48 @@
|
|
|
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.ScrollToErrorProvider = exports.ScrollToErrorContext = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var core_1 = require("../../core");
|
|
29
|
+
exports.ScrollToErrorContext = react_1.default.createContext({
|
|
30
|
+
error: null,
|
|
31
|
+
highlightError: core_1.noop,
|
|
32
|
+
scrollIntoRef: core_1.noop
|
|
33
|
+
});
|
|
34
|
+
var ScrollToErrorProvider = function (_a) {
|
|
35
|
+
var children = _a.children;
|
|
36
|
+
var _b = (0, react_1.useState)(null), error = _b[0], setError = _b[1];
|
|
37
|
+
var highlightTimer = (0, react_1.useRef)(null);
|
|
38
|
+
var scrollIntoRef = (0, react_1.useCallback)(function (ref) {
|
|
39
|
+
ref.current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
40
|
+
if (highlightTimer) {
|
|
41
|
+
clearTimeout(highlightTimer.current);
|
|
42
|
+
}
|
|
43
|
+
highlightTimer.current = setTimeout(function () { return setError(null); }, 2000);
|
|
44
|
+
}, []);
|
|
45
|
+
var contextValue = (0, react_1.useMemo)(function () { return ({ error: error, highlightError: setError, scrollIntoRef: scrollIntoRef }); }, [error, scrollIntoRef]);
|
|
46
|
+
return react_1.default.createElement(exports.ScrollToErrorContext.Provider, { value: contextValue }, children);
|
|
47
|
+
};
|
|
48
|
+
exports.ScrollToErrorProvider = ScrollToErrorProvider;
|
package/cjs/contexts/index.d.ts
CHANGED
|
@@ -22,3 +22,4 @@ export { SnackbarContext } from './SnackbarContext';
|
|
|
22
22
|
export { HighlightedValuesContext } from './HighlightedValuesContext';
|
|
23
23
|
export { InterceptHandlersContext } from './InterceptHandlersContext';
|
|
24
24
|
export { SearchValueContext } from './SearchValueContext';
|
|
25
|
+
export { ScrollToErrorContext, ScrollToErrorProvider } from './ScrollToErrorContext';
|
package/cjs/contexts/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
|
|
3
|
+
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.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.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");
|
|
@@ -56,3 +56,6 @@ var InterceptHandlersContext_1 = require("./InterceptHandlersContext");
|
|
|
56
56
|
Object.defineProperty(exports, "InterceptHandlersContext", { enumerable: true, get: function () { return InterceptHandlersContext_1.InterceptHandlersContext; } });
|
|
57
57
|
var SearchValueContext_1 = require("./SearchValueContext");
|
|
58
58
|
Object.defineProperty(exports, "SearchValueContext", { enumerable: true, get: function () { return SearchValueContext_1.SearchValueContext; } });
|
|
59
|
+
var ScrollToErrorContext_1 = require("./ScrollToErrorContext");
|
|
60
|
+
Object.defineProperty(exports, "ScrollToErrorContext", { enumerable: true, get: function () { return ScrollToErrorContext_1.ScrollToErrorContext; } });
|
|
61
|
+
Object.defineProperty(exports, "ScrollToErrorProvider", { enumerable: true, get: function () { return ScrollToErrorContext_1.ScrollToErrorProvider; } });
|
package/cjs/hooks/index.d.ts
CHANGED
package/cjs/hooks/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = void 0;
|
|
3
|
+
exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useScrollToAttributeError = void 0;
|
|
4
|
+
var useScrollToAttributeError_1 = require("./useScrollToAttributeError/useScrollToAttributeError");
|
|
5
|
+
Object.defineProperty(exports, "useScrollToAttributeError", { enumerable: true, get: function () { return useScrollToAttributeError_1.useScrollToAttributeError; } });
|
|
4
6
|
var useActions_1 = require("./useActions");
|
|
5
7
|
Object.defineProperty(exports, "useActions", { enumerable: true, get: function () { return useActions_1.useActions; } });
|
|
6
8
|
var useAPI_1 = require("./useAPI");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"highlightError" | "@keyframes highlightAnimation" | "highlightWarning" | "simpleAttribute">;
|
|
@@ -0,0 +1,49 @@
|
|
|
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: '0px',
|
|
21
|
+
width: '5000px',
|
|
22
|
+
height: 'calc(100% - 10px)',
|
|
23
|
+
animationName: '$highlightAnimation',
|
|
24
|
+
animationDuration: '2s',
|
|
25
|
+
animationIterationCount: 1,
|
|
26
|
+
opacity: 0
|
|
27
|
+
};
|
|
28
|
+
var ERROR_COLOR = 'rgba(255, 0, 0, 0.06)';
|
|
29
|
+
var WARNING_COLOR = 'rgba(228, 151, 0, 0.08)';
|
|
30
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
31
|
+
'@keyframes highlightAnimation': {
|
|
32
|
+
'0%': { opacity: 0 },
|
|
33
|
+
'50%': { opacity: 1 },
|
|
34
|
+
'100%': { opacity: 0 }
|
|
35
|
+
},
|
|
36
|
+
highlightError: {
|
|
37
|
+
'&::before': __assign(__assign({}, highlightBeforeStyles), { background: ERROR_COLOR })
|
|
38
|
+
},
|
|
39
|
+
highlightWarning: {
|
|
40
|
+
'&::before': __assign(__assign({}, highlightBeforeStyles), { background: WARNING_COLOR })
|
|
41
|
+
},
|
|
42
|
+
simpleAttribute: {
|
|
43
|
+
position: 'relative',
|
|
44
|
+
'&::before': {
|
|
45
|
+
top: '-4px',
|
|
46
|
+
height: 'calc(100% + 8px)'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}); });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ContextType } from 'react';
|
|
2
|
+
import { ScrollToErrorContext } from '../../contexts';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
highlightedError: ContextType<typeof ScrollToErrorContext> | null;
|
|
5
|
+
isSimple?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useScrollToAttributeError: ({ highlightedError: context, isSimple }: Props) => {
|
|
8
|
+
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
9
|
+
errorClassName: string;
|
|
10
|
+
} | {
|
|
11
|
+
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
12
|
+
errorClassName?: undefined;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useScrollToAttributeError = void 0;
|
|
7
|
+
var react_1 = require("react");
|
|
8
|
+
var ramda_1 = require("ramda");
|
|
9
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
11
|
+
var styles_1 = require("./styles");
|
|
12
|
+
var useScrollToAttributeError = function (_a) {
|
|
13
|
+
var _b;
|
|
14
|
+
var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
|
|
15
|
+
var styles = (0, styles_1.useStyles)();
|
|
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]);
|
|
19
|
+
var errorClassName = (0, classnames_1.default)((_b = {},
|
|
20
|
+
_b[styles.highlightError] = severity === mdm_sdk_1.ErrorSeverity.ERROR,
|
|
21
|
+
_b[styles.highlightWarning] = severity === mdm_sdk_1.ErrorSeverity.WARNING,
|
|
22
|
+
_b[styles.simpleAttribute] = isSimple,
|
|
23
|
+
_b));
|
|
24
|
+
(0, react_1.useEffect)(function () {
|
|
25
|
+
if (context) {
|
|
26
|
+
scrollIntoRef(ref);
|
|
27
|
+
}
|
|
28
|
+
}, [context, scrollIntoRef]);
|
|
29
|
+
return context ? { ref: ref, errorClassName: errorClassName } : { ref: ref };
|
|
30
|
+
};
|
|
31
|
+
exports.useScrollToAttributeError = useScrollToAttributeError;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
dispatch: any;
|
|
7
|
-
config: any;
|
|
8
|
-
mode: any;
|
|
9
|
-
metadata: any;
|
|
10
|
-
globalSearchRequestOptions: any;
|
|
11
|
-
error: any;
|
|
12
|
-
}): JSX.Element;
|
|
13
|
-
declare namespace RelationEditor {
|
|
14
|
-
namespace propTypes {
|
|
15
|
-
export { ConnectionType as connection };
|
|
16
|
-
export { EntityType as modifiedEntity };
|
|
17
|
-
export const allModifiedEntities: PropTypes.Requireable<object>;
|
|
18
|
-
export const dispatch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
export { RelationsConfigType as config };
|
|
20
|
-
export const mode: PropTypes.Requireable<string>;
|
|
21
|
-
export { MetadataType as metadata };
|
|
22
|
-
export const globalSearchRequestOptions: PropTypes.Requireable<object>;
|
|
23
|
-
export { AttributeErrorType as error };
|
|
24
|
-
export const parentEntityUri: PropTypes.Requireable<string>;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
import { ConnectionType } from "@reltio/mdm-sdk/src/constants";
|
|
28
|
-
import { EntityType } from "@reltio/mdm-sdk/src/constants";
|
|
29
|
-
import PropTypes from "prop-types";
|
|
30
|
-
import { RelationsConfigType } from "@reltio/mdm-sdk/src/constants";
|
|
31
|
-
import { MetadataType } from "@reltio/mdm-sdk/src/constants";
|
|
32
|
-
import { AttributeErrorType } from "@reltio/mdm-sdk/src/constants";
|
|
1
|
+
declare const _default: React.ComponentType<{
|
|
2
|
+
[x: string]: unknown;
|
|
3
|
+
}> | ((props: any) => JSX.Element);
|
|
4
|
+
export default _default;
|
|
5
|
+
import React from "react";
|
|
@@ -10,30 +10,34 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
13
|
+
import i18n from 'ui-i18n';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
15
|
+
import classnames from 'classnames';
|
|
16
|
+
import { allPass, always, concat, differenceWith, equals, forEach, path, pipe, prop, when, uniq, propEq } from 'ramda';
|
|
14
17
|
import Button from '@material-ui/core/Button';
|
|
18
|
+
import Divider from '@material-ui/core/Divider';
|
|
15
19
|
import Typography from '@material-ui/core/Typography';
|
|
16
|
-
import i18n from 'ui-i18n';
|
|
17
|
-
import classnames from 'classnames';
|
|
18
|
-
import { always, concat, differenceWith, equals, forEach, path, pipe, prop, when, uniq } from 'ramda';
|
|
19
|
-
import { useStyles } from './styles';
|
|
20
20
|
import { AttributeErrorType, ConnectionType, createTemporaryEntity, EntityType, findRelatedTemporaryEntities, getActivenessAttributes, getCreatableAttributeTypes, getEntityType, getErrorMessage, getErrorId, MetadataType, omitMarks, relationEditorAttributeTypesSelectionStrategy, RelationsConfigType, validateConnection, updateConnectionEntityLabel, isTempUri, isEmptyValue, getRelationAttributesList, getDefaultRelationTypeObject, getInOutRelations } from '@reltio/mdm-sdk';
|
|
21
21
|
import { profile } from '@reltio/mdm-module';
|
|
22
|
-
import Divider from '@material-ui/core/Divider';
|
|
23
22
|
import ConnectionRelationTypeSelector from '../ConnectionRelationTypeSelector/ConnectionRelationTypeSelector';
|
|
24
23
|
import ErrorWrapper from '../ErrorWrapper/ErrorWrapper';
|
|
25
24
|
import EntitySelector from '../attributes/editMode/EntitySelector/EntitySelector';
|
|
26
25
|
import AttributesList from '../attributes/editMode/AttributesList';
|
|
26
|
+
import { withContext } from '../../HOCs';
|
|
27
|
+
import { ScrollToErrorContext } from '../../contexts';
|
|
28
|
+
import { useScrollToAttributeError } from '../../hooks';
|
|
29
|
+
import { useStyles } from './styles';
|
|
27
30
|
var areRelatedEntitiesChanged = function (initial, actual) {
|
|
28
31
|
return initial.length !== actual.length || initial.some(function (_, i) { return initial[i] !== actual[i]; });
|
|
29
32
|
};
|
|
30
33
|
var RelationEditor = function (_a) {
|
|
31
34
|
var _b;
|
|
32
|
-
var connection = _a.connection, modifiedEntity = _a.modifiedEntity, allModifiedEntities = _a.allModifiedEntities, dispatch = _a.dispatch, config = _a.config, mode = _a.mode, metadata = _a.metadata, globalSearchRequestOptions = _a.globalSearchRequestOptions, error = _a.error;
|
|
35
|
+
var connection = _a.connection, modifiedEntity = _a.modifiedEntity, allModifiedEntities = _a.allModifiedEntities, dispatch = _a.dispatch, config = _a.config, mode = _a.mode, metadata = _a.metadata, globalSearchRequestOptions = _a.globalSearchRequestOptions, error = _a.error, highlightedError = _a.highlightedError;
|
|
33
36
|
var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType, direction = _c.direction;
|
|
34
37
|
var isNew = connection.isNew;
|
|
35
38
|
var styles = useStyles();
|
|
36
|
-
var _d =
|
|
39
|
+
var _d = useScrollToAttributeError({ highlightedError: highlightedError, isSimple: true }), ref = _d.ref, errorClassName = _d.errorClassName;
|
|
40
|
+
var _e = useMemo(function () {
|
|
37
41
|
return getInOutRelations({
|
|
38
42
|
content: connection.parentEntityUri ? config.contentSecondLevel : config.content,
|
|
39
43
|
direction: direction,
|
|
@@ -41,18 +45,12 @@ var RelationEditor = function (_a) {
|
|
|
41
45
|
mode: mode,
|
|
42
46
|
metadata: metadata
|
|
43
47
|
});
|
|
44
|
-
}, [config, direction, relationType, mode, metadata, connection.parentEntityUri]),
|
|
45
|
-
var firstLevelRelationAttrTypes = useMemo(function () { return getRelationAttributesList(metadata, relationType); }, [
|
|
46
|
-
relationType,
|
|
47
|
-
metadata
|
|
48
|
-
]);
|
|
48
|
+
}, [config, direction, relationType, mode, metadata, connection.parentEntityUri]), _f = _e.inRelations, inRelationTypes = _f === void 0 ? [] : _f, _g = _e.outRelations, outRelationTypes = _g === void 0 ? [] : _g;
|
|
49
|
+
var firstLevelRelationAttrTypes = useMemo(function () { return getRelationAttributesList(metadata, relationType); }, [relationType, metadata]);
|
|
49
50
|
var attributeListEntity = useMemo(function () { return (__assign({ attributes: __assign({}, profile.relations.selectors.getRelationAttributesFromConnection(connection)) }, getActivenessAttributes(connection.relation))); }, [connection]);
|
|
50
51
|
var initialConnection = useRef(connection);
|
|
51
52
|
var initialModifiedEntity = useRef(modifiedEntity);
|
|
52
|
-
var relatedTempEntities = useMemo(function () { return findRelatedTemporaryEntities(allModifiedEntities, modifiedEntity); }, [
|
|
53
|
-
allModifiedEntities,
|
|
54
|
-
modifiedEntity
|
|
55
|
-
]);
|
|
53
|
+
var relatedTempEntities = useMemo(function () { return findRelatedTemporaryEntities(allModifiedEntities, modifiedEntity); }, [allModifiedEntities, modifiedEntity]);
|
|
56
54
|
var relatedTempEntitiesUrisHistory = useRef([]);
|
|
57
55
|
useEffect(function () {
|
|
58
56
|
relatedTempEntitiesUrisHistory.current = pipe(concat(relatedTempEntities.map(prop('uri'))), uniq)(relatedTempEntitiesUrisHistory.current);
|
|
@@ -142,10 +140,12 @@ var RelationEditor = function (_a) {
|
|
|
142
140
|
React.createElement(Typography, { className: styles.title }, isNew ? i18n.text('Add new item') : i18n.text('Edit item')),
|
|
143
141
|
defaultRelationType === null && (React.createElement(ConnectionRelationTypeSelector, { className: styles.item, relation: connection.relation, inRelationTypes: inRelationTypes, outRelationTypes: outRelationTypes, onChange: onRelationTypeChange })),
|
|
144
142
|
Boolean(relationType) && (React.createElement(React.Fragment, null,
|
|
145
|
-
React.createElement(
|
|
146
|
-
React.createElement(
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
React.createElement("div", { ref: ref, className: errorClassName },
|
|
144
|
+
React.createElement(ErrorWrapper, { errorMessage: errorMessage },
|
|
145
|
+
React.createElement(EntitySelector, { className: classnames(styles.item, (_b = {},
|
|
146
|
+
_b[styles.dense] = errorMessage ||
|
|
147
|
+
(connection.entity && isTempUri(connection.entity.entityUri)),
|
|
148
|
+
_b)), entity: connection.entity || {}, entityTypesUris: getEntityTypesUris() || [], max: config.max || 20, globalSearchRequestOptions: globalSearchRequestOptions, mode: mode, onChange: onChangeEntity, onCreate: onCreateEntity, metadata: metadata, attributeTypesSelectionStrategy: relationEditorAttributeTypesSelectionStrategy }))),
|
|
149
149
|
React.createElement(AttributesList, { className: styles.item, attrTypes: firstLevelRelationAttrTypes, entity: attributeListEntity, showEmptyEditors: true, crosswalks: connection.crosswalks, mode: mode, parentUri: relationUri, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })))),
|
|
150
150
|
React.createElement("div", { className: styles.actionButtons },
|
|
151
151
|
React.createElement(Button, { onClick: onCancel }, i18n.text('Cancel')),
|
|
@@ -162,6 +162,17 @@ RelationEditor.propTypes = {
|
|
|
162
162
|
metadata: MetadataType,
|
|
163
163
|
globalSearchRequestOptions: PropTypes.object,
|
|
164
164
|
error: AttributeErrorType,
|
|
165
|
-
parentEntityUri: PropTypes.string
|
|
165
|
+
parentEntityUri: PropTypes.string,
|
|
166
|
+
highlightedError: PropTypes.object
|
|
166
167
|
};
|
|
167
|
-
export default
|
|
168
|
+
export default withContext(ScrollToErrorContext, function (contextValue, _a) {
|
|
169
|
+
var connection = _a.connection;
|
|
170
|
+
var _b = (contextValue || {}).error, error = _b === void 0 ? {} : _b;
|
|
171
|
+
var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType;
|
|
172
|
+
var isHighlighted = allPass([
|
|
173
|
+
pipe(prop('uri'), isEmptyValue),
|
|
174
|
+
propEq('parentUri', relationUri),
|
|
175
|
+
propEq('attributeTypeUri', relationType)
|
|
176
|
+
])(error);
|
|
177
|
+
return { highlightedError: isHighlighted ? contextValue : null };
|
|
178
|
+
}, RelationEditor);
|
|
@@ -1,155 +1,6 @@
|
|
|
1
1
|
export { RelationEditor };
|
|
2
|
-
declare const _default: import("react-redux").ConnectedComponent<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
modifiedEntity: any;
|
|
6
|
-
allModifiedEntities: any;
|
|
7
|
-
dispatch: any;
|
|
8
|
-
config: any;
|
|
9
|
-
mode: any;
|
|
10
|
-
metadata: any;
|
|
11
|
-
globalSearchRequestOptions: any;
|
|
12
|
-
error: any;
|
|
13
|
-
}): JSX.Element;
|
|
14
|
-
propTypes: {
|
|
15
|
-
connection: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
16
|
-
entity: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
17
|
-
entityUri: import("prop-types").Requireable<string>;
|
|
18
|
-
entityType: import("prop-types").Requireable<string>;
|
|
19
|
-
entityLabel: import("prop-types").Requireable<string>;
|
|
20
|
-
object: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
21
|
-
uri: import("prop-types").Requireable<string>;
|
|
22
|
-
type: import("prop-types").Requireable<string>;
|
|
23
|
-
}>>;
|
|
24
|
-
}>>;
|
|
25
|
-
relation: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
26
|
-
relationUri: import("prop-types").Requireable<string>;
|
|
27
|
-
relationType: import("prop-types").Requireable<string>;
|
|
28
|
-
relationLabel: import("prop-types").Requireable<string>;
|
|
29
|
-
direction: import("prop-types").Requireable<string>;
|
|
30
|
-
object: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
31
|
-
uri: import("prop-types").Requireable<string>;
|
|
32
|
-
type: import("prop-types").Requireable<string>;
|
|
33
|
-
}>>;
|
|
34
|
-
}>>;
|
|
35
|
-
}>>;
|
|
36
|
-
modifiedEntity: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
37
|
-
uri: import("prop-types").Requireable<string>;
|
|
38
|
-
type: import("prop-types").Requireable<string>;
|
|
39
|
-
}>>;
|
|
40
|
-
allModifiedEntities: import("prop-types").Requireable<object>;
|
|
41
|
-
dispatch: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
42
|
-
config: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
43
|
-
id: import("prop-types").Requireable<string>;
|
|
44
|
-
content: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
45
|
-
inRelations: import("prop-types").Requireable<NonNullable<string | object>[]>;
|
|
46
|
-
outRelations: import("prop-types").Requireable<NonNullable<string | object>[]>;
|
|
47
|
-
groups: import("prop-types").Requireable<string[]>;
|
|
48
|
-
entityTypes: import("prop-types").Requireable<string[]>;
|
|
49
|
-
nextEntry: import("prop-types").Requireable<object>;
|
|
50
|
-
}>>;
|
|
51
|
-
allowOnlyCreateNew: import("prop-types").Requireable<boolean>;
|
|
52
|
-
sortColumn: import("prop-types").Requireable<string>;
|
|
53
|
-
sortOrder: import("prop-types").Requireable<string>;
|
|
54
|
-
'text-empty': import("prop-types").Requireable<string>;
|
|
55
|
-
max: import("prop-types").Requireable<number>;
|
|
56
|
-
icon: import("prop-types").Requireable<string>;
|
|
57
|
-
caption: import("prop-types").Requireable<string>;
|
|
58
|
-
canCreate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
59
|
-
deviceTypes: import("prop-types").Requireable<NonNullable<string | string[]>>;
|
|
60
|
-
roles: import("prop-types").Requireable<string[]>;
|
|
61
|
-
}>>;
|
|
62
|
-
canRead: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
63
|
-
deviceTypes: import("prop-types").Requireable<NonNullable<string | string[]>>;
|
|
64
|
-
roles: import("prop-types").Requireable<string[]>;
|
|
65
|
-
}>>;
|
|
66
|
-
canUpdate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
67
|
-
deviceTypes: import("prop-types").Requireable<NonNullable<string | string[]>>;
|
|
68
|
-
roles: import("prop-types").Requireable<string[]>;
|
|
69
|
-
}>>;
|
|
70
|
-
canDelete: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
71
|
-
deviceTypes: import("prop-types").Requireable<NonNullable<string | string[]>>;
|
|
72
|
-
roles: import("prop-types").Requireable<string[]>;
|
|
73
|
-
}>>;
|
|
74
|
-
editingEnabled: import("prop-types").Requireable<boolean>;
|
|
75
|
-
}>>;
|
|
76
|
-
mode: import("prop-types").Requireable<string>;
|
|
77
|
-
metadata: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
78
|
-
uri: import("prop-types").Requireable<string>;
|
|
79
|
-
description: import("prop-types").Requireable<string>;
|
|
80
|
-
label: import("prop-types").Requireable<string>;
|
|
81
|
-
schemaVersion: import("prop-types").Requireable<string>;
|
|
82
|
-
entityTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
83
|
-
typeColor: import("prop-types").Requireable<string>;
|
|
84
|
-
typeIcon: import("prop-types").Requireable<string>;
|
|
85
|
-
typeImage: import("prop-types").Requireable<string>;
|
|
86
|
-
label: import("prop-types").Requireable<string>;
|
|
87
|
-
uri: import("prop-types").Requireable<string>;
|
|
88
|
-
attributes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
89
|
-
label: import("prop-types").Requireable<string>;
|
|
90
|
-
name: import("prop-types").Requireable<string>;
|
|
91
|
-
description: import("prop-types").Requireable<string>;
|
|
92
|
-
type: import("prop-types").Requireable<string>;
|
|
93
|
-
hidden: import("prop-types").Requireable<boolean>;
|
|
94
|
-
faceted: import("prop-types").Requireable<boolean>;
|
|
95
|
-
searchable: import("prop-types").Requireable<boolean>;
|
|
96
|
-
uri: import("prop-types").Requireable<string>;
|
|
97
|
-
access: import("prop-types").Requireable<string[]>;
|
|
98
|
-
cardinality: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
99
|
-
minValue: import("prop-types").Requireable<number>;
|
|
100
|
-
maxValue: import("prop-types").Requireable<number>;
|
|
101
|
-
}>>;
|
|
102
|
-
}>[]>;
|
|
103
|
-
}>[]>;
|
|
104
|
-
roles: import("prop-types").Requireable<object[]>;
|
|
105
|
-
groupTypes: import("prop-types").Requireable<object[]>;
|
|
106
|
-
relationTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
107
|
-
label: import("prop-types").Requireable<string>;
|
|
108
|
-
uri: import("prop-types").Requireable<string>;
|
|
109
|
-
typeColor: import("prop-types").Requireable<string>;
|
|
110
|
-
direction: import("prop-types").Requireable<string>;
|
|
111
|
-
startObject: import("prop-types").Requireable<object>;
|
|
112
|
-
endObject: import("prop-types").Requireable<object>;
|
|
113
|
-
}>[]>;
|
|
114
|
-
graphTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
115
|
-
uri: import("prop-types").Requireable<string>;
|
|
116
|
-
label: import("prop-types").Requireable<string>;
|
|
117
|
-
extendsTypeUri: import("prop-types").Requireable<string>;
|
|
118
|
-
relationshipTypeURIs: import("prop-types").Requireable<string[]>;
|
|
119
|
-
}>[]>;
|
|
120
|
-
interactionTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
121
|
-
uri: import("prop-types").Requireable<string>;
|
|
122
|
-
label: import("prop-types").Requireable<string>;
|
|
123
|
-
memberTypes: import("prop-types").Requireable<any[]>;
|
|
124
|
-
extendsTypeUri: import("prop-types").Requireable<string>;
|
|
125
|
-
attributes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
126
|
-
label: import("prop-types").Requireable<string>;
|
|
127
|
-
name: import("prop-types").Requireable<string>;
|
|
128
|
-
description: import("prop-types").Requireable<string>;
|
|
129
|
-
type: import("prop-types").Requireable<string>;
|
|
130
|
-
hidden: import("prop-types").Requireable<boolean>;
|
|
131
|
-
faceted: import("prop-types").Requireable<boolean>;
|
|
132
|
-
searchable: import("prop-types").Requireable<boolean>;
|
|
133
|
-
uri: import("prop-types").Requireable<string>;
|
|
134
|
-
access: import("prop-types").Requireable<string[]>;
|
|
135
|
-
cardinality: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
136
|
-
minValue: import("prop-types").Requireable<number>;
|
|
137
|
-
maxValue: import("prop-types").Requireable<number>;
|
|
138
|
-
}>>;
|
|
139
|
-
}>[]>;
|
|
140
|
-
}>[]>;
|
|
141
|
-
sources: import("prop-types").Requireable<object[]>;
|
|
142
|
-
}>>;
|
|
143
|
-
globalSearchRequestOptions: import("prop-types").Requireable<object>;
|
|
144
|
-
error: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
145
|
-
type: import("prop-types").Validator<NonNullable<import("@reltio/mdm-sdk").ErrorType>>;
|
|
146
|
-
attributeTypeUri: import("prop-types").Validator<string>;
|
|
147
|
-
parentUri: import("prop-types").Validator<string>;
|
|
148
|
-
uri: import("prop-types").Requireable<string>;
|
|
149
|
-
message: import("prop-types").Requireable<string>;
|
|
150
|
-
}>>;
|
|
151
|
-
parentEntityUri: import("prop-types").Requireable<string>;
|
|
152
|
-
};
|
|
153
|
-
}, any>;
|
|
2
|
+
declare const _default: import("react-redux").ConnectedComponent<import("react").ComponentType<{
|
|
3
|
+
[x: string]: unknown;
|
|
4
|
+
}> | ((props: any) => JSX.Element), any>;
|
|
154
5
|
export default _default;
|
|
155
6
|
import RelationEditor from "./RelationEditor";
|
|
@@ -1,9 +1,13 @@
|
|
|
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
|
|
5
|
-
values
|
|
4
|
+
declare const _default: React.ComponentType<Required<Omit<AttributePagerProps, "values">> & {
|
|
5
|
+
values?: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue)[];
|
|
6
6
|
nonVisibleValues: AttributeValue[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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);
|
|
13
|
+
export default _default;
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState, useContext, useMemo } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { add, always, has, ifElse, min, pipe, prop, T } from 'ramda';
|
|
4
|
+
import { add, always, has, ifElse, min, pipe, prop, T, allPass, propEq } from 'ramda';
|
|
4
5
|
import BranchDecorator from '../../BranchDecorator/BranchDecorator';
|
|
5
6
|
import ErrorMessage from '../../../ErrorWrapper/ErrorMessage';
|
|
6
7
|
import Title from '../../../Title/Title';
|
|
8
|
+
import OvIcon from '../../OvIcon';
|
|
7
9
|
import ShowLess from '../../pagersCommon/ShowLess';
|
|
8
10
|
import ShowMore from '../../pagersCommon/ShowMore';
|
|
9
11
|
import Attribute from '../AttributesFactory/Attribute';
|
|
10
12
|
import Cardinality from './CardinalityMessage';
|
|
11
|
-
import { useStyles } from './styles';
|
|
12
13
|
import { filterNewValues } from './utils';
|
|
14
|
+
import { withContext } from '../../../../HOCs';
|
|
13
15
|
import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
|
|
14
|
-
import
|
|
16
|
+
import { useScrollToAttributeError } from '../../../../hooks';
|
|
17
|
+
import { ScrollToErrorContext } from '../../../../contexts';
|
|
18
|
+
import { useStyles } from './styles';
|
|
15
19
|
var AttributeRenderer = function (_a) {
|
|
16
|
-
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, 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, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
17
21
|
var styles = useStyles();
|
|
18
22
|
var _b = useState(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
|
|
19
23
|
var _c = useState(false), hadDeletions = _c[0], setHadDeletions = _c[1];
|
|
20
24
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality, name = attributeType.name, attributeTypeUri = attributeType.uri;
|
|
21
25
|
var isEditableMode = checkIsEditableMode(mode);
|
|
26
|
+
var _d = useScrollToAttributeError({ highlightedError: highlightedError }), ref = _d.ref, errorClassName = _d.errorClassName;
|
|
22
27
|
var pinnedAttributes = useContext(PinnedAttributesContext);
|
|
23
28
|
var isPinned = useMemo(function () { return pinnedAttributes === null || pinnedAttributes === void 0 ? void 0 : pinnedAttributes.includes(attributeTypeUri); }, [attributeTypeUri, pinnedAttributes]);
|
|
24
29
|
var isEmptyValues = isEmptyValue(values);
|
|
@@ -74,7 +79,7 @@ var AttributeRenderer = function (_a) {
|
|
|
74
79
|
var lastIndex = shownValues ? shownValues.length - 1 : 0;
|
|
75
80
|
var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
|
|
76
81
|
return (React.createElement(BranchDecorator, { enabled: drawLines },
|
|
77
|
-
React.createElement("div", { className: styles.wrapper },
|
|
82
|
+
React.createElement("div", { ref: ref, className: classNames(styles.wrapper, errorClassName) },
|
|
78
83
|
React.createElement("div", { className: styles.titleWrapper },
|
|
79
84
|
React.createElement(Title, { label: label, isRequired: isRequired, className: styles.title, "data-reltio-id": "reltio-attribute-label" }),
|
|
80
85
|
React.createElement(OvIcon, { nonOvValues: nonVisibleValues, attributeType: attributeType, className: styles.ovIcon, nonOvTotal: totalNonVisibleValues })),
|
|
@@ -85,4 +90,13 @@ var AttributeRenderer = function (_a) {
|
|
|
85
90
|
showMore && (React.createElement(ShowMore, { moreNumber: min(max, hiddenValuesCount), valueNumber: hiddenValuesCount, onClick: onShowMore })),
|
|
86
91
|
showLess && React.createElement(ShowLess, { onClick: onShowLess })))));
|
|
87
92
|
};
|
|
88
|
-
export default
|
|
93
|
+
export default withContext(ScrollToErrorContext, function (contextValue, _a) {
|
|
94
|
+
var parentUri = _a.parentUri, attributeType = _a.attributeType;
|
|
95
|
+
var error = (contextValue || {}).error;
|
|
96
|
+
var isHighlighted = allPass([
|
|
97
|
+
pipe(prop('uri'), isEmptyValue),
|
|
98
|
+
propEq('parentUri', parentUri),
|
|
99
|
+
propEq('attributeTypeUri', attributeType.uri)
|
|
100
|
+
])(error);
|
|
101
|
+
return { highlightedError: isHighlighted ? contextValue : null };
|
|
102
|
+
}, AttributeRenderer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"caption" | "title" | "link" | "wrapper" | "ovIcon" | "svg-icon__root" | "attributesWrapper" | "typeError" | "titleWrapper">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"caption" | "title" | "link" | "wrapper" | "ovIcon" | "svg-icon__root" | "attributesWrapper" | "typeError" | "titleWrapper">;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const filterNewValues: any;
|
|
2
|
+
export { filterNewValues };
|