@reltio/components 1.4.1466 → 1.4.1467
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/PivotingUriLink/PivotingUriLink.d.ts +11 -0
- package/cjs/components/PivotingUriLink/PivotingUriLink.js +48 -0
- package/cjs/components/PivotingUriLink/styles.d.ts +1 -0
- package/cjs/components/PivotingUriLink/styles.js +10 -0
- package/cjs/components/RelationEditor/RelationEditor.js +1 -5
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltip.js +8 -4
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltipContent.d.ts +2 -1
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltipContent.js +3 -2
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +1 -5
- package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +1 -5
- package/cjs/contexts/UrlGeneratorsContext/index.d.ts +6 -0
- package/cjs/contexts/UrlGeneratorsContext/index.js +1 -0
- package/esm/components/PivotingUriLink/PivotingUriLink.d.ts +11 -0
- package/esm/components/PivotingUriLink/PivotingUriLink.js +20 -0
- package/esm/components/PivotingUriLink/styles.d.ts +1 -0
- package/esm/components/PivotingUriLink/styles.js +7 -0
- package/esm/components/RelationEditor/RelationEditor.js +3 -7
- package/esm/components/attributes/PivotingAttributes/PivotingTooltip.js +8 -4
- package/esm/components/attributes/PivotingAttributes/PivotingTooltipContent.d.ts +2 -1
- package/esm/components/attributes/PivotingAttributes/PivotingTooltipContent.js +3 -2
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +3 -7
- package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +3 -7
- package/esm/contexts/UrlGeneratorsContext/index.d.ts +6 -0
- package/esm/contexts/UrlGeneratorsContext/index.js +2 -1
- package/package.json +3 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeType, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
className?: string;
|
|
5
|
+
value: PivotingValue[];
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
attributeType: AttributeType;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const PivotingUriLink: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
export default PivotingUriLink;
|
|
@@ -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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var react_1 = __importStar(require("react"));
|
|
30
|
+
var react_redux_1 = require("react-redux");
|
|
31
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
32
|
+
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
33
|
+
var contexts_1 = require("../../contexts");
|
|
34
|
+
var styles_1 = require("./styles");
|
|
35
|
+
var PivotingUriLink = (0, react_1.forwardRef)(function (_a, ref) {
|
|
36
|
+
var value = _a.value, attributeType = _a.attributeType, children = _a.children, className = _a.className, onClick = _a.onClick;
|
|
37
|
+
var styles = (0, styles_1.useStyles)();
|
|
38
|
+
var uiPath = (0, react_redux_1.useSelector)(mdm_module_1.default.selectors.getUIPath);
|
|
39
|
+
var generatePivotingUrl = (0, react_1.useContext)(contexts_1.UrlGeneratorsContext).generatePivotingUrl;
|
|
40
|
+
var url = generatePivotingUrl({ uiPath: uiPath, uri: attributeType.uri, value: JSON.stringify(value) });
|
|
41
|
+
return (react_1.default.createElement("a", { ref: ref, href: url, onClick: function (e) {
|
|
42
|
+
onClick();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
}, className: (0, classnames_1.default)(styles.link, className) }, children));
|
|
46
|
+
});
|
|
47
|
+
PivotingUriLink.displayName = 'PivotingUriLink';
|
|
48
|
+
exports.default = PivotingUriLink;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"link">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
|
|
6
|
+
link: {
|
|
7
|
+
color: theme.palette.primary.main,
|
|
8
|
+
textDecoration: 'none'
|
|
9
|
+
}
|
|
10
|
+
}); });
|
|
@@ -204,10 +204,6 @@ exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToErrorContext, funct
|
|
|
204
204
|
var connection = _a.connection;
|
|
205
205
|
var _b = (contextValue || {}).error, error = _b === void 0 ? {} : _b;
|
|
206
206
|
var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType;
|
|
207
|
-
var isHighlighted = (0,
|
|
208
|
-
(0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isEmptyValue),
|
|
209
|
-
(0, ramda_1.propEq)('parentUri', relationUri),
|
|
210
|
-
(0, ramda_1.propEq)('attributeTypeUri', relationType)
|
|
211
|
-
])(error);
|
|
207
|
+
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(error, relationUri, relationType);
|
|
212
208
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
213
209
|
}, RelationEditor);
|
|
@@ -37,6 +37,7 @@ var contexts_1 = require("../../../contexts");
|
|
|
37
37
|
var helpers_1 = require("./helpers");
|
|
38
38
|
var PivotingIcon_1 = __importDefault(require("../../../icons/PivotingIcon"));
|
|
39
39
|
var PivotingTooltipContent_1 = require("./PivotingTooltipContent");
|
|
40
|
+
var PivotingUriLink_1 = __importDefault(require("../../PivotingUriLink/PivotingUriLink"));
|
|
40
41
|
var styles_1 = require("./styles");
|
|
41
42
|
var PivotingTooltip = function (_a) {
|
|
42
43
|
var value = _a.value, attributeType = _a.attributeType, children = _a.children, className = _a.className;
|
|
@@ -59,15 +60,18 @@ var PivotingTooltip = function (_a) {
|
|
|
59
60
|
var uri = _a.uri;
|
|
60
61
|
return uri === attributeType.uri;
|
|
61
62
|
});
|
|
62
|
-
var
|
|
63
|
-
|
|
63
|
+
var convertPivotingValue = function () {
|
|
64
|
+
return Array.isArray(pivotingValue)
|
|
64
65
|
? (0, helpers_1.convertNestedAttributePivotingValue)(pivotingValue)
|
|
65
66
|
: (0, helpers_1.convertSimpleAttributePivotingValue)(attributeType, pivotingValue);
|
|
67
|
+
};
|
|
68
|
+
var generatedValue = isPivotingAttribute ? convertPivotingValue() : undefined;
|
|
69
|
+
var handleSeeAllClick = function () {
|
|
66
70
|
dispatch(mdm_module_1.ui.actions.openPivotingPerspective({ value: generatedValue, attributeType: attributeType }));
|
|
67
71
|
};
|
|
68
|
-
return isPivotingAttribute ? (react_1.default.createElement(Tooltip_1.default, { interactive: true, arrow: true, placement: "right-start", classes: styles, title: react_1.default.createElement(PivotingTooltipContent_1.PivotingTooltipContent, { value: pivotingValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick }) },
|
|
72
|
+
return isPivotingAttribute ? (react_1.default.createElement(Tooltip_1.default, { interactive: true, arrow: true, placement: "right-start", classes: styles, title: react_1.default.createElement(PivotingTooltipContent_1.PivotingTooltipContent, { value: pivotingValue, generatedValue: generatedValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick }) },
|
|
69
73
|
react_1.default.createElement("span", { className: className },
|
|
70
74
|
react_1.default.createElement(PivotingIcon_1.default, { className: contentStyles.icon }),
|
|
71
|
-
react_1.default.createElement(
|
|
75
|
+
react_1.default.createElement(PivotingUriLink_1.default, { onClick: handleSeeAllClick, className: contentStyles.content, value: generatedValue, attributeType: attributeType }, children)))) : (react_1.default.createElement(react_1.default.Fragment, null, children));
|
|
72
76
|
};
|
|
73
77
|
exports.PivotingTooltip = PivotingTooltip;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AttributeType, PrimitiveValue, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
3
|
export declare type Props = {
|
|
4
4
|
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
+
generatedValue: PivotingValue[];
|
|
5
6
|
attributeType: AttributeType;
|
|
6
7
|
config: {
|
|
7
8
|
label?: string;
|
|
@@ -9,4 +10,4 @@ export declare type Props = {
|
|
|
9
10
|
};
|
|
10
11
|
onSeeAllClick: () => void;
|
|
11
12
|
};
|
|
12
|
-
export declare const PivotingTooltipContent: ({ value, attributeType, config, onSeeAllClick }: Props) => JSX.Element;
|
|
13
|
+
export declare const PivotingTooltipContent: ({ value, attributeType, config, generatedValue, onSeeAllClick }: Props) => JSX.Element;
|
|
@@ -45,11 +45,12 @@ var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
|
45
45
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
46
46
|
var EntityAvatar_1 = __importDefault(require("../../EntityAvatar/EntityAvatar"));
|
|
47
47
|
var EntityUriLink_1 = __importDefault(require("../../EntityUriLink/EntityUriLink"));
|
|
48
|
+
var PivotingUriLink_1 = __importDefault(require("../../PivotingUriLink/PivotingUriLink"));
|
|
48
49
|
var hooks_1 = require("../../../hooks");
|
|
49
50
|
var styles_1 = require("./styles");
|
|
50
51
|
var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
51
52
|
var PivotingTooltipContent = function (_a) {
|
|
52
|
-
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, onSeeAllClick = _a.onSeeAllClick;
|
|
53
|
+
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, generatedValue = _a.generatedValue, onSeeAllClick = _a.onSeeAllClick;
|
|
53
54
|
var _c = (0, react_1.useState)([]), entities = _c[0], setEntities = _c[1];
|
|
54
55
|
var _d = (0, react_1.useState)(0), total = _d[0], setTotal = _d[1];
|
|
55
56
|
var entity = (0, react_redux_1.useSelector)(mdm_module_1.default.selectors.getEntity) || {};
|
|
@@ -83,6 +84,6 @@ var PivotingTooltipContent = function (_a) {
|
|
|
83
84
|
react_1.default.createElement(EntityAvatar_1.default, { entity: visibleEntity, avatarClassName: styles.profileIcon }),
|
|
84
85
|
react_1.default.createElement(EntityUriLink_1.default, { className: styles.entityLabel, value: (0, mdm_sdk_1.getEntityUriForLink)(visibleEntity) }, (0, mdm_sdk_1.getLabel)(visibleEntity.label)))); })),
|
|
85
86
|
shouldShowSeeAllButton && (react_1.default.createElement("div", { className: styles.footer },
|
|
86
|
-
react_1.default.createElement(
|
|
87
|
+
react_1.default.createElement(PivotingUriLink_1.default, { value: generatedValue, attributeType: attributeType, className: styles.seeAllButton, onClick: onSeeAllClick }, ui_i18n_1.default.text('See all'))))));
|
|
87
88
|
};
|
|
88
89
|
exports.PivotingTooltipContent = PivotingTooltipContent;
|
|
@@ -123,10 +123,6 @@ var AttributeRenderer = function (_a) {
|
|
|
123
123
|
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToErrorContext, function (contextValue, _a) {
|
|
124
124
|
var parentUri = _a.parentUri, attributeType = _a.attributeType;
|
|
125
125
|
var error = (contextValue || {}).error;
|
|
126
|
-
var isHighlighted = (0,
|
|
127
|
-
(0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isEmptyValue),
|
|
128
|
-
(0, ramda_1.propEq)('parentUri', parentUri),
|
|
129
|
-
(0, ramda_1.propEq)('attributeTypeUri', attributeType.uri)
|
|
130
|
-
])(error);
|
|
126
|
+
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(error, parentUri, attributeType.uri);
|
|
131
127
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
132
128
|
}, AttributeRenderer);
|
|
@@ -152,10 +152,6 @@ ReferenceAttribute.propTypes = __assign(__assign({}, mdm_sdk_1.ReferenceAttribut
|
|
|
152
152
|
exports.default = (0, HOCs_1.withContext)(contexts_1.ScrollToErrorContext, function (contextValue, _a) {
|
|
153
153
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
154
154
|
var error = (contextValue || {}).error;
|
|
155
|
-
var isHighlighted = (0,
|
|
156
|
-
(0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isEmptyValue),
|
|
157
|
-
(0, ramda_1.propEq)('parentUri', attributeValue.uri),
|
|
158
|
-
(0, ramda_1.propEq)('attributeTypeUri', attributeType.uri)
|
|
159
|
-
])(error);
|
|
155
|
+
var isHighlighted = (0, mdm_sdk_1.isAttributeTypeError)(error, attributeValue.uri, attributeType.uri);
|
|
160
156
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
161
157
|
}, ReferenceAttribute);
|
|
@@ -4,6 +4,11 @@ declare type GenerateEntityUrl = (params: {
|
|
|
4
4
|
uri: string;
|
|
5
5
|
screen?: string;
|
|
6
6
|
}) => string;
|
|
7
|
+
declare type GeneratePivotingUrl = (params: {
|
|
8
|
+
uiPath: string;
|
|
9
|
+
uri: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}) => string;
|
|
7
12
|
declare type GenerateTagUrl = (params: {
|
|
8
13
|
uiPath: string;
|
|
9
14
|
tag: string;
|
|
@@ -11,6 +16,7 @@ declare type GenerateTagUrl = (params: {
|
|
|
11
16
|
}) => string;
|
|
12
17
|
declare type UrlGenerators = {
|
|
13
18
|
generateEntityUrl?: GenerateEntityUrl;
|
|
19
|
+
generatePivotingUrl?: GeneratePivotingUrl;
|
|
14
20
|
generateTagUrl?: GenerateTagUrl;
|
|
15
21
|
};
|
|
16
22
|
export declare const UrlGeneratorsContext: React.Context<UrlGenerators>;
|
|
@@ -8,6 +8,7 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
9
9
|
exports.UrlGeneratorsContext = react_1.default.createContext({
|
|
10
10
|
generateEntityUrl: mdm_sdk_1.generateEntityUrlForOldMode,
|
|
11
|
+
generatePivotingUrl: mdm_sdk_1.generatePivotingUrlForOldMode,
|
|
11
12
|
generateTagUrl: mdm_sdk_1.generateTagUrlForOldMode
|
|
12
13
|
});
|
|
13
14
|
exports.UrlGeneratorsContext.displayName = 'UrlGeneratorsContext';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeType, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
className?: string;
|
|
5
|
+
value: PivotingValue[];
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
attributeType: AttributeType;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const PivotingUriLink: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
|
+
export default PivotingUriLink;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { forwardRef, useContext } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import mdmModule from '@reltio/mdm-module';
|
|
5
|
+
import { UrlGeneratorsContext } from '../../contexts';
|
|
6
|
+
import { useStyles } from './styles';
|
|
7
|
+
var PivotingUriLink = forwardRef(function (_a, ref) {
|
|
8
|
+
var value = _a.value, attributeType = _a.attributeType, children = _a.children, className = _a.className, onClick = _a.onClick;
|
|
9
|
+
var styles = useStyles();
|
|
10
|
+
var uiPath = useSelector(mdmModule.selectors.getUIPath);
|
|
11
|
+
var generatePivotingUrl = useContext(UrlGeneratorsContext).generatePivotingUrl;
|
|
12
|
+
var url = generatePivotingUrl({ uiPath: uiPath, uri: attributeType.uri, value: JSON.stringify(value) });
|
|
13
|
+
return (React.createElement("a", { ref: ref, href: url, onClick: function (e) {
|
|
14
|
+
onClick();
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
}, className: classnames(styles.link, className) }, children));
|
|
18
|
+
});
|
|
19
|
+
PivotingUriLink.displayName = 'PivotingUriLink';
|
|
20
|
+
export default PivotingUriLink;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"link">;
|
|
@@ -13,11 +13,11 @@ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
|
13
13
|
import i18n from 'ui-i18n';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import classnames from 'classnames';
|
|
16
|
-
import {
|
|
16
|
+
import { always, concat, differenceWith, equals, forEach, omit, path, pick, pipe, prop, when, uniq } from 'ramda';
|
|
17
17
|
import Button from '@material-ui/core/Button';
|
|
18
18
|
import Divider from '@material-ui/core/Divider';
|
|
19
19
|
import Typography from '@material-ui/core/Typography';
|
|
20
|
-
import { AttributeErrorType, ConnectionType, createTemporaryEntity, EntityType, findRelatedTemporaryEntities, getActivenessAttributes, getCreatableAttributeTypes, getEntityType, getErrorMessage, getErrorId, MetadataType, omitMarks, relationEditorAttributeTypesSelectionStrategy, RelationsConfigType, validateConnection, updateConnectionEntityLabel, isTempUri, isEmptyValue, getRelationAttributesList, getDefaultRelationTypeObject, getInOutRelations, isSuggestMode } from '@reltio/mdm-sdk';
|
|
20
|
+
import { AttributeErrorType, ConnectionType, createTemporaryEntity, EntityType, findRelatedTemporaryEntities, getActivenessAttributes, getCreatableAttributeTypes, getEntityType, getErrorMessage, getErrorId, MetadataType, omitMarks, relationEditorAttributeTypesSelectionStrategy, RelationsConfigType, validateConnection, updateConnectionEntityLabel, isTempUri, isEmptyValue, getRelationAttributesList, getDefaultRelationTypeObject, getInOutRelations, isSuggestMode, isAttributeTypeError } from '@reltio/mdm-sdk';
|
|
21
21
|
import { profile } from '@reltio/mdm-module';
|
|
22
22
|
import ConnectionRelationTypeSelector from '../ConnectionRelationTypeSelector/ConnectionRelationTypeSelector';
|
|
23
23
|
import ErrorWrapper from '../ErrorWrapper/ErrorWrapper';
|
|
@@ -176,10 +176,6 @@ export default withContext(ScrollToErrorContext, function (contextValue, _a) {
|
|
|
176
176
|
var connection = _a.connection;
|
|
177
177
|
var _b = (contextValue || {}).error, error = _b === void 0 ? {} : _b;
|
|
178
178
|
var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType;
|
|
179
|
-
var isHighlighted =
|
|
180
|
-
pipe(prop('uri'), isEmptyValue),
|
|
181
|
-
propEq('parentUri', relationUri),
|
|
182
|
-
propEq('attributeTypeUri', relationType)
|
|
183
|
-
])(error);
|
|
179
|
+
var isHighlighted = isAttributeTypeError(error, relationUri, relationType);
|
|
184
180
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
185
181
|
}, RelationEditor);
|
|
@@ -8,6 +8,7 @@ import { PivotingAttributeContext } from '../../../contexts';
|
|
|
8
8
|
import { convertNestedAttributePivotingValue, convertSimpleAttributePivotingValue, generatePivotingValue, preparePivotingAttributeValue } from './helpers';
|
|
9
9
|
import PivotingIcon from '../../../icons/PivotingIcon';
|
|
10
10
|
import { PivotingTooltipContent } from './PivotingTooltipContent';
|
|
11
|
+
import PivotingUriLink from '../../PivotingUriLink/PivotingUriLink';
|
|
11
12
|
import { usePivotingTooltipStyles, useStyles } from './styles';
|
|
12
13
|
export var PivotingTooltip = function (_a) {
|
|
13
14
|
var value = _a.value, attributeType = _a.attributeType, children = _a.children, className = _a.className;
|
|
@@ -30,14 +31,17 @@ export var PivotingTooltip = function (_a) {
|
|
|
30
31
|
var uri = _a.uri;
|
|
31
32
|
return uri === attributeType.uri;
|
|
32
33
|
});
|
|
33
|
-
var
|
|
34
|
-
|
|
34
|
+
var convertPivotingValue = function () {
|
|
35
|
+
return Array.isArray(pivotingValue)
|
|
35
36
|
? convertNestedAttributePivotingValue(pivotingValue)
|
|
36
37
|
: convertSimpleAttributePivotingValue(attributeType, pivotingValue);
|
|
38
|
+
};
|
|
39
|
+
var generatedValue = isPivotingAttribute ? convertPivotingValue() : undefined;
|
|
40
|
+
var handleSeeAllClick = function () {
|
|
37
41
|
dispatch(mdmModuleUi.actions.openPivotingPerspective({ value: generatedValue, attributeType: attributeType }));
|
|
38
42
|
};
|
|
39
|
-
return isPivotingAttribute ? (React.createElement(Tooltip, { interactive: true, arrow: true, placement: "right-start", classes: styles, title: React.createElement(PivotingTooltipContent, { value: pivotingValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick }) },
|
|
43
|
+
return isPivotingAttribute ? (React.createElement(Tooltip, { interactive: true, arrow: true, placement: "right-start", classes: styles, title: React.createElement(PivotingTooltipContent, { value: pivotingValue, generatedValue: generatedValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick }) },
|
|
40
44
|
React.createElement("span", { className: className },
|
|
41
45
|
React.createElement(PivotingIcon, { className: contentStyles.icon }),
|
|
42
|
-
React.createElement(
|
|
46
|
+
React.createElement(PivotingUriLink, { onClick: handleSeeAllClick, className: contentStyles.content, value: generatedValue, attributeType: attributeType }, children)))) : (React.createElement(React.Fragment, null, children));
|
|
43
47
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AttributeType, PrimitiveValue, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
3
|
export declare type Props = {
|
|
4
4
|
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
+
generatedValue: PivotingValue[];
|
|
5
6
|
attributeType: AttributeType;
|
|
6
7
|
config: {
|
|
7
8
|
label?: string;
|
|
@@ -9,4 +10,4 @@ export declare type Props = {
|
|
|
9
10
|
};
|
|
10
11
|
onSeeAllClick: () => void;
|
|
11
12
|
};
|
|
12
|
-
export declare const PivotingTooltipContent: ({ value, attributeType, config, onSeeAllClick }: Props) => JSX.Element;
|
|
13
|
+
export declare const PivotingTooltipContent: ({ value, attributeType, config, generatedValue, onSeeAllClick }: Props) => JSX.Element;
|
|
@@ -16,11 +16,12 @@ import mdm from '@reltio/mdm-module';
|
|
|
16
16
|
import { getEntityUriForLink, getFilteredEntities, getLabel, getTotals, convertPivotingValueToSearchFilters } from '@reltio/mdm-sdk';
|
|
17
17
|
import EntityAvatar from '../../EntityAvatar/EntityAvatar';
|
|
18
18
|
import EntityUriLink from '../../EntityUriLink/EntityUriLink';
|
|
19
|
+
import PivotingUriLink from '../../PivotingUriLink/PivotingUriLink';
|
|
19
20
|
import { useSafePromise } from '../../../hooks';
|
|
20
21
|
import { useStyles } from './styles';
|
|
21
22
|
var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
22
23
|
export var PivotingTooltipContent = function (_a) {
|
|
23
|
-
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, onSeeAllClick = _a.onSeeAllClick;
|
|
24
|
+
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, generatedValue = _a.generatedValue, onSeeAllClick = _a.onSeeAllClick;
|
|
24
25
|
var _c = useState([]), entities = _c[0], setEntities = _c[1];
|
|
25
26
|
var _d = useState(0), total = _d[0], setTotal = _d[1];
|
|
26
27
|
var entity = useSelector(mdm.selectors.getEntity) || {};
|
|
@@ -54,5 +55,5 @@ export var PivotingTooltipContent = function (_a) {
|
|
|
54
55
|
React.createElement(EntityAvatar, { entity: visibleEntity, avatarClassName: styles.profileIcon }),
|
|
55
56
|
React.createElement(EntityUriLink, { className: styles.entityLabel, value: getEntityUriForLink(visibleEntity) }, getLabel(visibleEntity.label)))); })),
|
|
56
57
|
shouldShowSeeAllButton && (React.createElement("div", { className: styles.footer },
|
|
57
|
-
React.createElement(
|
|
58
|
+
React.createElement(PivotingUriLink, { value: generatedValue, attributeType: attributeType, className: styles.seeAllButton, onClick: onSeeAllClick }, i18n.text('See all'))))));
|
|
58
59
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState, useContext, useMemo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue } from '@reltio/mdm-sdk';
|
|
4
|
-
import { add, always, has, ifElse, min, pipe, prop, T
|
|
3
|
+
import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue, isAttributeTypeError } from '@reltio/mdm-sdk';
|
|
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';
|
|
7
7
|
import Title from '../../../Title/Title';
|
|
@@ -95,10 +95,6 @@ var AttributeRenderer = function (_a) {
|
|
|
95
95
|
export default withContext(ScrollToErrorContext, function (contextValue, _a) {
|
|
96
96
|
var parentUri = _a.parentUri, attributeType = _a.attributeType;
|
|
97
97
|
var error = (contextValue || {}).error;
|
|
98
|
-
var isHighlighted =
|
|
99
|
-
pipe(prop('uri'), isEmptyValue),
|
|
100
|
-
propEq('parentUri', parentUri),
|
|
101
|
-
propEq('attributeTypeUri', attributeType.uri)
|
|
102
|
-
])(error);
|
|
98
|
+
var isHighlighted = isAttributeTypeError(error, parentUri, attributeType.uri);
|
|
103
99
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
104
100
|
}, AttributeRenderer);
|
|
@@ -23,8 +23,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React, { useMemo, useCallback, useRef } from 'react';
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import classnames from 'classnames';
|
|
26
|
-
import { identity, pipe, isEmpty
|
|
27
|
-
import { evaluateDeepEntityLabel, ReferenceAttributeType, referencedEntityAttributeTypesSelectionStrategy, getEntityType, getReferencedEntityFromAttrValue, getReferencedRelationFromAttrValue, getReferencedEntityUri, getReferencedEntityTypeUri, getReferencedEntityTypeUriFromAttrType, getReferencedRelationAttrTypesUris, findAttributeTypeByUri, getCreatableAttributeTypes, createTemporaryEntity, convertReferencedEntityForAttrValue, createReferencedRelationForAttrValue, addReferencedRelationCrosswalks, getReferencedEntityUriFromAttrValue, checkCanEditAttribute, checkMetadataForCreate, isReltioCrosswalk, getErrorMessage, EntityType, MetadataType, getErrorId, getReferencedEntityActiveError, isTempUri, getLabel,
|
|
26
|
+
import { identity, pipe, isEmpty } from 'ramda';
|
|
27
|
+
import { evaluateDeepEntityLabel, ReferenceAttributeType, referencedEntityAttributeTypesSelectionStrategy, getEntityType, getReferencedEntityFromAttrValue, getReferencedRelationFromAttrValue, getReferencedEntityUri, getReferencedEntityTypeUri, getReferencedEntityTypeUriFromAttrType, getReferencedRelationAttrTypesUris, findAttributeTypeByUri, getCreatableAttributeTypes, createTemporaryEntity, convertReferencedEntityForAttrValue, createReferencedRelationForAttrValue, addReferencedRelationCrosswalks, getReferencedEntityUriFromAttrValue, checkCanEditAttribute, checkMetadataForCreate, isReltioCrosswalk, getErrorMessage, EntityType, MetadataType, getErrorId, getReferencedEntityActiveError, isTempUri, getLabel, isAttributeTypeError } from '@reltio/mdm-sdk';
|
|
28
28
|
import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
|
|
29
29
|
import EntitySelector from '../EntitySelector/EntitySelector';
|
|
30
30
|
import { ErrorWrapper } from '../../../index';
|
|
@@ -124,10 +124,6 @@ ReferenceAttribute.propTypes = __assign(__assign({}, ReferenceAttributeType), {
|
|
|
124
124
|
export default withContext(ScrollToErrorContext, function (contextValue, _a) {
|
|
125
125
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
126
126
|
var error = (contextValue || {}).error;
|
|
127
|
-
var isHighlighted =
|
|
128
|
-
pipe(prop('uri'), isEmptyValue),
|
|
129
|
-
propEq('parentUri', attributeValue.uri),
|
|
130
|
-
propEq('attributeTypeUri', attributeType.uri)
|
|
131
|
-
])(error);
|
|
127
|
+
var isHighlighted = isAttributeTypeError(error, attributeValue.uri, attributeType.uri);
|
|
132
128
|
return { highlightedError: isHighlighted ? contextValue : null };
|
|
133
129
|
}, ReferenceAttribute);
|
|
@@ -4,6 +4,11 @@ declare type GenerateEntityUrl = (params: {
|
|
|
4
4
|
uri: string;
|
|
5
5
|
screen?: string;
|
|
6
6
|
}) => string;
|
|
7
|
+
declare type GeneratePivotingUrl = (params: {
|
|
8
|
+
uiPath: string;
|
|
9
|
+
uri: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}) => string;
|
|
7
12
|
declare type GenerateTagUrl = (params: {
|
|
8
13
|
uiPath: string;
|
|
9
14
|
tag: string;
|
|
@@ -11,6 +16,7 @@ declare type GenerateTagUrl = (params: {
|
|
|
11
16
|
}) => string;
|
|
12
17
|
declare type UrlGenerators = {
|
|
13
18
|
generateEntityUrl?: GenerateEntityUrl;
|
|
19
|
+
generatePivotingUrl?: GeneratePivotingUrl;
|
|
14
20
|
generateTagUrl?: GenerateTagUrl;
|
|
15
21
|
};
|
|
16
22
|
export declare const UrlGeneratorsContext: React.Context<UrlGenerators>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { generateEntityUrlForOldMode, generateTagUrlForOldMode } from '@reltio/mdm-sdk';
|
|
2
|
+
import { generateEntityUrlForOldMode, generatePivotingUrlForOldMode, generateTagUrlForOldMode } from '@reltio/mdm-sdk';
|
|
3
3
|
export var UrlGeneratorsContext = React.createContext({
|
|
4
4
|
generateEntityUrl: generateEntityUrlForOldMode,
|
|
5
|
+
generatePivotingUrl: generatePivotingUrlForOldMode,
|
|
5
6
|
generateTagUrl: generateTagUrlForOldMode
|
|
6
7
|
});
|
|
7
8
|
UrlGeneratorsContext.displayName = 'UrlGeneratorsContext';
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1467",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1467",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1467",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|